mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-06 19:24:15 +00:00
Optimize notify test so it's not run as often
This commit is contained in:
parent
269947bdae
commit
e7234e621d
|
@ -117,16 +117,18 @@ public class User extends DataUnit implements Cloneable {
|
||||||
getDataSource().addGroup(group);
|
getDataSource().addGroup(group);
|
||||||
}
|
}
|
||||||
group = getDataSource().getGroup(group.getName());
|
group = getDataSource().getGroup(group.getName());
|
||||||
// Do we notify of the group change?
|
String oldGroup = this.group;
|
||||||
String defaultGroupName = getDataSource().getDefaultGroup().getName();
|
|
||||||
// if we are not in the default group
|
|
||||||
// or we are in the default group and the move is to a different group.
|
|
||||||
boolean notify = (!this.group.equalsIgnoreCase(defaultGroupName)) || ((this.group.equalsIgnoreCase(defaultGroupName)) && (!group.getName().equalsIgnoreCase(defaultGroupName))) ;
|
|
||||||
this.group = group.getName();
|
this.group = group.getName();
|
||||||
flagAsChanged();
|
flagAsChanged();
|
||||||
if (GroupManager.isLoaded()) {
|
if (GroupManager.isLoaded()) {
|
||||||
if (GroupManager.BukkitPermissions.player_join = false)
|
if (GroupManager.BukkitPermissions.player_join = false)
|
||||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||||
|
|
||||||
|
// Do we notify of the group change?
|
||||||
|
String defaultGroupName = getDataSource().getDefaultGroup().getName();
|
||||||
|
// if we were not in the default group
|
||||||
|
// or we were in the default group and the move is to a different group.
|
||||||
|
boolean notify = (!oldGroup.equalsIgnoreCase(defaultGroupName)) || ((oldGroup.equalsIgnoreCase(defaultGroupName)) && (!this.group.equalsIgnoreCase(defaultGroupName))) ;
|
||||||
|
|
||||||
if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName()));
|
if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue