mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 17:47:34 +01:00
Fix overloadedWorldHolder so it correctly calls the new WorldHolder code when the user is not overloaded.
This commit is contained in:
parent
32f49350cf
commit
aae586f79a
@ -100,14 +100,14 @@ public abstract class DataUnit {
|
||||
public String getLastName() {
|
||||
|
||||
if (uUID.length() < 36)
|
||||
return uUID;
|
||||
return this.uUID;
|
||||
|
||||
return lastName;
|
||||
return this.lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
|
||||
if (!this.lastName.equals(lastName)) {
|
||||
if (!lastName.equals(this.lastName)) {
|
||||
|
||||
this.lastName = lastName;
|
||||
changed = true;
|
||||
|
@ -69,10 +69,10 @@ public class User extends DataUnit implements Cloneable {
|
||||
*/
|
||||
public User clone(WorldDataHolder dataSource) {
|
||||
|
||||
if (dataSource.isUserDeclared(this.getLastName())) {
|
||||
if (dataSource.isUserDeclared(this.getUUID())) {
|
||||
return null;
|
||||
}
|
||||
User clone = dataSource.createUser(this.getLastName());
|
||||
User clone = dataSource.createUser(this.getUUID());
|
||||
if (dataSource.getGroup(group) == null) {
|
||||
clone.setGroup(dataSource.getDefaultGroup());
|
||||
} else {
|
||||
@ -86,17 +86,14 @@ public class User extends DataUnit implements Cloneable {
|
||||
return clone;
|
||||
}
|
||||
|
||||
public User clone(String uUID) {
|
||||
public User clone(String uUID, String CurrentName) {
|
||||
|
||||
User clone = this.getDataSource().createUser(uUID);
|
||||
|
||||
if (this.getDataSource().getGroup(group) == null) {
|
||||
clone.setGroup(this.getDataSource().getDefaultGroup());
|
||||
} else {
|
||||
clone.setGroup(this.getDataSource().getGroup(this.getGroupName()));
|
||||
}
|
||||
clone.setLastName(CurrentName);
|
||||
|
||||
clone.setLastName(this.getLastName());
|
||||
// Set the group silently.
|
||||
clone.setGroup(this.getDataSource().getGroup(this.getGroupName()), false);
|
||||
|
||||
for (String perm : this.getPermissionList()) {
|
||||
clone.addPermission(perm);
|
||||
@ -181,6 +178,7 @@ public class User extends DataUnit implements Cloneable {
|
||||
if (notify)
|
||||
GroupManager.notify(this.getLastName(), String.format(" moved to the group %s in %s.", group.getName(), this.getDataSource().getName()));
|
||||
|
||||
if (updatePerms)
|
||||
GroupManager.getGMEventHandler().callEvent(this, Action.USER_GROUP_CHANGED);
|
||||
}
|
||||
}
|
||||
|
@ -49,12 +49,8 @@ public class OverloadedWorldHolder extends WorldDataHolder {
|
||||
return overloadedUsers.get(userNameLowered);
|
||||
}
|
||||
//END CODE
|
||||
if (getUsers().containsKey(userNameLowered)) {
|
||||
return getUsers().get(userNameLowered);
|
||||
}
|
||||
User newUser = createUser(userName);
|
||||
setUsersChanged(true);
|
||||
return newUser;
|
||||
|
||||
return super.getUser(userName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,9 +119,10 @@ public class WorldDataHolder {
|
||||
// Search for a LastName match
|
||||
for (User user : getUserList()) {
|
||||
|
||||
if (user.getLastName().equalsIgnoreCase(userId))
|
||||
if (user.getLastName().equalsIgnoreCase(userId)) {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -157,14 +158,13 @@ public class WorldDataHolder {
|
||||
if (usr.getLastName().equalsIgnoreCase(currentName)) {
|
||||
|
||||
// Clone this user so we can set it's uUID
|
||||
user = usr.clone(uUID);
|
||||
user = usr.clone(uUID, currentName);
|
||||
|
||||
// Delete it and replace with the new clone.
|
||||
this.removeUser(usr.getUUID());
|
||||
user.setLastName(currentName);
|
||||
this.addUser(user);
|
||||
|
||||
return user;
|
||||
return getUsers().get(uUID.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user