summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2011-12-08 02:28:12 +0000
committerElgarL <ElgarL@palmergames.com>2011-12-08 02:28:12 +0000
commit789a6b9540bdf4478aee88109d286d0258c4a3f9 (patch)
tree38b5c3173216ba0e7d383965bd2af3aba9fd521d /EssentialsGroupManager
parent5f0936cf44185ea4116dd3c396b0909e008d9c6b (diff)
downloadEssentials-789a6b9540bdf4478aee88109d286d0258c4a3f9.tar
Essentials-789a6b9540bdf4478aee88109d286d0258c4a3f9.tar.gz
Essentials-789a6b9540bdf4478aee88109d286d0258c4a3f9.tar.lz
Essentials-789a6b9540bdf4478aee88109d286d0258c4a3f9.tar.xz
Essentials-789a6b9540bdf4478aee88109d286d0258c4a3f9.zip
Fix manload to properly clone user variables.
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java9
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java8
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java20
3 files changed, 17 insertions, 20 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
index eea488ab2..10757475d 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java
@@ -76,7 +76,7 @@ public class User extends DataUnit implements Cloneable {
for (String perm : this.getPermissionList()) {
clone.addPermission(perm);
}
- // clone.variables = this.variables.clone();
+ clone.variables = this.variables.clone(this);
clone.flagAsChanged();
return clone;
}
@@ -213,10 +213,11 @@ public class User extends DataUnit implements Cloneable {
* @param varList
*/
public void setVariables(Map<String, Object> varList) {
- UserVariables temp = new UserVariables(this, varList);
+ //UserVariables temp = new UserVariables(this, varList);
variables.clearVars();
- for (String key : temp.getVarKeyList()) {
- variables.addVar(key, temp.getVarObject(key));
+ for (String key : varList.keySet()) {
+ System.out.print("Adding variable - " + key);
+ variables.addVar(key, varList.get(key));
}
flagAsChanged();
if (GroupManager.isLoaded())
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
index e97b01a48..140d6626a 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java
@@ -108,8 +108,6 @@ public abstract class Variables implements Cloneable {
return o == null ? -1.0D : Double.parseDouble(o.toString());
} catch (Exception e) {
return -1.0D;
-
-
}
}
@@ -119,8 +117,6 @@ public abstract class Variables implements Cloneable {
*/
public Set<String> getVarKeyList() {
return variables.keySet();
-
-
}
/**
@@ -130,8 +126,6 @@ public abstract class Variables implements Cloneable {
*/
public boolean hasVar(String name) {
return variables.containsKey(name);
-
-
}
/**
@@ -140,8 +134,6 @@ public abstract class Variables implements Cloneable {
*/
public int getSize() {
return variables.size();
-
-
}
/**
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 2b6a80da6..4ef77687a 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -631,7 +631,6 @@ public class WorldDataHolder {
} else
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
-
//END INFO NODE
if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
@@ -753,14 +752,19 @@ public class WorldDataHolder {
}
- //USER INFO NODE - BETA
-
+ //USER INFO NODE
+
//INFO NODE
- Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info");
- if (infoNode != null) {
- thisUser.setVariables(infoNode);
- }
- //END INFO NODE - BETA
+ if (thisUserNode.get("info") instanceof Map) {
+ Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info");
+ if (infoNode != null) {
+ thisUser.setVariables(infoNode);
+ }
+ } else if (thisUserNode.get("info") != null)
+ throw new IllegalArgumentException("Unknown entry found in Info section for user: " + thisUser.getName() + " in file: " + usersFile.getPath());
+
+ //END INFO NODE
+
if (thisUserNode.get("group") != null) {
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());