mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-12 05:08:48 +00:00
Fix manload to properly clone user variables.
This commit is contained in:
parent
5f0936cf44
commit
789a6b9540
|
@ -76,7 +76,7 @@ public class User extends DataUnit implements Cloneable {
|
||||||
for (String perm : this.getPermissionList()) {
|
for (String perm : this.getPermissionList()) {
|
||||||
clone.addPermission(perm);
|
clone.addPermission(perm);
|
||||||
}
|
}
|
||||||
// clone.variables = this.variables.clone();
|
clone.variables = this.variables.clone(this);
|
||||||
clone.flagAsChanged();
|
clone.flagAsChanged();
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
@ -213,10 +213,11 @@ public class User extends DataUnit implements Cloneable {
|
||||||
* @param varList
|
* @param varList
|
||||||
*/
|
*/
|
||||||
public void setVariables(Map<String, Object> varList) {
|
public void setVariables(Map<String, Object> varList) {
|
||||||
UserVariables temp = new UserVariables(this, varList);
|
//UserVariables temp = new UserVariables(this, varList);
|
||||||
variables.clearVars();
|
variables.clearVars();
|
||||||
for (String key : temp.getVarKeyList()) {
|
for (String key : varList.keySet()) {
|
||||||
variables.addVar(key, temp.getVarObject(key));
|
System.out.print("Adding variable - " + key);
|
||||||
|
variables.addVar(key, varList.get(key));
|
||||||
}
|
}
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
if (GroupManager.isLoaded())
|
if (GroupManager.isLoaded())
|
||||||
|
|
|
@ -108,8 +108,6 @@ public abstract class Variables implements Cloneable {
|
||||||
return o == null ? -1.0D : Double.parseDouble(o.toString());
|
return o == null ? -1.0D : Double.parseDouble(o.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return -1.0D;
|
return -1.0D;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,8 +117,6 @@ public abstract class Variables implements Cloneable {
|
||||||
*/
|
*/
|
||||||
public Set<String> getVarKeyList() {
|
public Set<String> getVarKeyList() {
|
||||||
return variables.keySet();
|
return variables.keySet();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,8 +126,6 @@ public abstract class Variables implements Cloneable {
|
||||||
*/
|
*/
|
||||||
public boolean hasVar(String name) {
|
public boolean hasVar(String name) {
|
||||||
return variables.containsKey(name);
|
return variables.containsKey(name);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,8 +134,6 @@ public abstract class Variables implements Cloneable {
|
||||||
*/
|
*/
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return variables.size();
|
return variables.size();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -631,7 +631,6 @@ public class WorldDataHolder {
|
||||||
} else
|
} else
|
||||||
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||||
|
|
||||||
|
|
||||||
//END INFO NODE
|
//END INFO NODE
|
||||||
|
|
||||||
if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
|
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
|
//INFO NODE
|
||||||
Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info");
|
if (thisUserNode.get("info") instanceof Map) {
|
||||||
if (infoNode != null) {
|
Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info");
|
||||||
thisUser.setVariables(infoNode);
|
if (infoNode != null) {
|
||||||
}
|
thisUser.setVariables(infoNode);
|
||||||
//END INFO NODE - BETA
|
}
|
||||||
|
} 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) {
|
if (thisUserNode.get("group") != null) {
|
||||||
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
|
Group hisGroup = ph.getGroup(thisUserNode.get("group").toString());
|
||||||
|
|
Loading…
Reference in a new issue