- Fix for Users.yml containing only 'users:' causing a crash.

- GroupManager will now generate a fresh Users and Groups yml if either
file is empty.
This commit is contained in:
ElgarL 2011-09-03 16:13:43 +01:00
parent 8f28073b29
commit e3756623a1
4 changed files with 11 additions and 4 deletions

View file

@ -5,4 +5,6 @@ v 1.1:
- Added SuperPerms support so GM will update and provide the permissions to plugins which only support Bukkit Perms.
- Added more helpful output to errors on argument lengths.
- GroupManager will now attempt to select the default world when using commands instead of failing and telling you to use '/manselect <world>'.
- Invalid groups assigned to players in users.yml will no longer cause a crash. GM will now set them to the default group instead.
- Invalid groups assigned to players in users.yml will no longer cause a crash. GM will now set them to the default group instead.
- Fix for Users.yml containing only 'users:' causing a crash.
- GroupManager will now generate a fresh Users and Groups yml if either file is empty.

View file

@ -578,6 +578,11 @@ public class WorldDataHolder {
// PROCESS USERS FILE
Map<String, Object> allUsersNode = (Map<String, Object>) usersRootDataNode.get("users");
// Stop loading if the file is empty
if (allUsersNode == null)
return ph;
for (String usersKey : allUsersNode.keySet()) {
Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey);
User thisUser = ph.createUser(usersKey);

View file

@ -265,7 +265,7 @@ public class WorldsHolder {
File groupsFile = new File(defaultWorldFolder, "groups.yml");
File usersFile = new File(defaultWorldFolder, "users.yml");
File oldDataFile = new File(plugin.getDataFolder(), "data.yml");
if (!groupsFile.exists()) {
if (!groupsFile.exists() || groupsFile.length() == 0) {
if (oldDataFile.exists()) {
try {
Tasks.copy(oldDataFile, groupsFile);
@ -281,7 +281,7 @@ public class WorldsHolder {
}
}
}
if (!usersFile.exists()) {
if (!usersFile.exists() || usersFile.length() == 0) {
if (oldDataFile.exists()) {
try {
Tasks.copy(oldDataFile, usersFile);

View file

@ -1,5 +1,5 @@
name: GroupManager
version: "1.1"
version: "1.1 (Phoenix)"
main: org.anjocaido.groupmanager.GroupManager
website: http://www.anjocaido.info/
description: Provides on-the-fly system for Permission system created by Nijikokun. But all in memory, and with flat-file saving schedule.