mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-21 19:01:55 +00:00
Merge remote branch 'remotes/origin/groupmanager'
This commit is contained in:
commit
07baa6e611
|
@ -141,4 +141,8 @@ v 1.9:
|
|||
- Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data.
|
||||
- Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent.
|
||||
This also means we no longer update permissions before we change worlds.
|
||||
- A command of '/manload' with no world arguments now performs a full reload of GM.
|
||||
- A command of '/manload' with no world arguments now performs a full reload of GM.
|
||||
- Update for Bukkit R5 compatability.
|
||||
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
|
||||
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
|
||||
- Prevent promoting players to, and demoting to GlobalGroups.
|
|
@ -4,10 +4,6 @@ settings:
|
|||
# The user will be able to promote players to the same group or even above.
|
||||
opOverrides: true
|
||||
|
||||
# If enabled any bukkit permissiosn which default to true will be left enabled.
|
||||
# If the player is op any permissions set to Op will follow suit.
|
||||
bukkit_perms_override: true
|
||||
|
||||
# Default setting for 'mantoglevalidate'
|
||||
# true will cause GroupManager to attempt name matching by default.
|
||||
validate_toggle: true
|
||||
|
|
|
@ -57,9 +57,6 @@ public class GMConfiguration {
|
|||
public boolean isOpOverride() {
|
||||
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
||||
}
|
||||
public boolean isBukkitPermsOverride() {
|
||||
return GMconfig.getBoolean("settings.config.bukkit_perms_override", false);
|
||||
}
|
||||
public boolean isToggleValidate() {
|
||||
return GMconfig.getBoolean("settings.config.validate_toggle", true);
|
||||
}
|
||||
|
|
|
@ -398,6 +398,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||
|
@ -1019,6 +1023,11 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// VALIDANDO PERMISSAO
|
||||
if (permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
|
||||
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)");
|
||||
|
@ -1052,6 +1061,11 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
|
||||
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + ".");
|
||||
|
@ -1222,6 +1236,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
// PARECE OK
|
||||
auxString = "";
|
||||
|
@ -1251,6 +1269,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!auxGroup.getVariables().hasVar(args[1])) {
|
||||
sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!");
|
||||
|
@ -1276,6 +1298,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
// PARECE OK
|
||||
auxString = "";
|
||||
|
@ -1313,6 +1339,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null);
|
||||
if (auxGroup2 == null) {
|
||||
|
@ -1578,6 +1608,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||
|
@ -1634,6 +1668,10 @@ public class GroupManager extends JavaPlugin {
|
|||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||
|
|
|
@ -48,6 +48,15 @@ public class Group extends DataUnit implements Cloneable {
|
|||
public Group(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a GlobalGroup
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isGlobal() {
|
||||
return (getDataSource() == null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone this group
|
||||
|
@ -57,7 +66,7 @@ public class Group extends DataUnit implements Cloneable {
|
|||
public Group clone() {
|
||||
Group clone;
|
||||
|
||||
if (getDataSource() == null) {
|
||||
if (isGlobal()) {
|
||||
clone = new Group(this.getName());
|
||||
} else {
|
||||
clone = new Group(getDataSource(), this.getName());
|
||||
|
@ -85,7 +94,7 @@ public class Group extends DataUnit implements Cloneable {
|
|||
Group clone = dataSource.createGroup(this.getName());
|
||||
|
||||
// Don't add inheritance for GlobalGroups
|
||||
if (getDataSource() != null) {
|
||||
if (!isGlobal()) {
|
||||
clone.inherits = new ArrayList<String>(this.getInherits());
|
||||
}
|
||||
for (String perm : this.getPermissionList()) {
|
||||
|
@ -110,26 +119,30 @@ public class Group extends DataUnit implements Cloneable {
|
|||
* @param inherit the inherits to set
|
||||
*/
|
||||
public void addInherits(Group inherit) {
|
||||
if (!this.getDataSource().groupExists(inherit.getName())) {
|
||||
getDataSource().addGroup(inherit);
|
||||
}
|
||||
if (!inherits.contains(inherit.getName().toLowerCase())) {
|
||||
inherits.add(inherit.getName().toLowerCase());
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
}
|
||||
if (!isGlobal()) {
|
||||
if (!this.getDataSource().groupExists(inherit.getName())) {
|
||||
getDataSource().addGroup(inherit);
|
||||
}
|
||||
if (!inherits.contains(inherit.getName().toLowerCase())) {
|
||||
inherits.add(inherit.getName().toLowerCase());
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeInherits(String inherit) {
|
||||
if (this.inherits.contains(inherit.toLowerCase())) {
|
||||
this.inherits.remove(inherit.toLowerCase());
|
||||
flagAsChanged();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
return true;
|
||||
}
|
||||
if (!isGlobal()) {
|
||||
if (this.inherits.contains(inherit.toLowerCase())) {
|
||||
this.inherits.remove(inherit.toLowerCase());
|
||||
flagAsChanged();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -145,15 +158,17 @@ public class Group extends DataUnit implements Cloneable {
|
|||
* @param varList
|
||||
*/
|
||||
public void setVariables(Map<String, Object> varList) {
|
||||
GroupVariables temp = new GroupVariables(this, varList);
|
||||
variables.clearVars();
|
||||
for (String key : temp.getVarKeyList()) {
|
||||
variables.addVar(key, temp.getVarObject(key));
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
|
||||
}
|
||||
if (!isGlobal()) {
|
||||
GroupVariables temp = new GroupVariables(this, varList);
|
||||
variables.clearVars();
|
||||
for (String key : temp.getVarKeyList()) {
|
||||
variables.addVar(key, temp.getVarObject(key));
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ public class GMGroupEvent extends Event {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5294917600434510451L;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,6 @@ public class GMSystemEvent extends Event {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8786811924448821548L;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,6 @@ public class GMUserEvent extends Event {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5294917600434510451L;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue