mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-10 08:34:17 +02:00
Missing gm changes
This commit is contained in:
@@ -147,3 +147,40 @@ v 1.9:
|
|||||||
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
|
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
|
||||||
- Prevent promoting players to, and demoting to GlobalGroups.
|
- Prevent promoting players to, and demoting to GlobalGroups.
|
||||||
- Make 'manload' reload the config correctly.
|
- Make 'manload' reload the config correctly.
|
||||||
|
- Minor optimization when checking bukkit permissions.
|
||||||
|
- Better reporting when a users.yml is failing to load.
|
||||||
|
- Expanded '/manuadd'to accept an optional variable for the world (eg '/manuadd <player> <group> <world>').
|
||||||
|
- Removed some debug spam.
|
||||||
|
- Don't remove an attachment on a player leaving as Bukkit never forgets it. This fixes non mirrored permissions being messed up if a player relogs.
|
||||||
|
- Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
|
||||||
|
- Auto rename all case sensitive world folders to lower case (if possible).
|
||||||
|
- Update GlobalGroups.yml for new/changed Towny permission nodes.
|
||||||
|
- Stop attempting to push empty permissions when players edit the yml's incorrectly.
|
||||||
|
- Catch errors caused by bad indentation in yml's.
|
||||||
|
- Force remove player attachments on disconnect, and tidyup during player join in case of any errors. Fixes a bug of losing permissions.
|
||||||
|
- Added a new permission node 'groupmanager.op'. This will cause players with this node to be treated as op's when
|
||||||
|
using GroupManager commands (they will still require each commands permission node to use them).
|
||||||
|
- Prevent Null entries in group inheritance from throwing errors.
|
||||||
|
v 2.0:
|
||||||
|
- Fix GM reporting of permission inheritance to retain the correct order. Lower inheritance groups can no longer negate a higher groups permissions.
|
||||||
|
- Fix an error I caused trying to modify an unmodifiable list when parsing '*' permissions.
|
||||||
|
- Don't throw errors when attempting to remove permission attachments (bukkit will have already removed it).
|
||||||
|
- Remove all permission attachments when performing a manload or restart.
|
||||||
|
- Expand 'manwhois' to also list a users subgroups.
|
||||||
|
- Fix a concurrent modification error when removing all attachments.
|
||||||
|
- Better handling of errors in user and group yml's.
|
||||||
|
- Added missing confirmation message on '/manload'.
|
||||||
|
- Stop the error on shutdown if GM failed to load at startup.
|
||||||
|
- GroupManager will now generate it's own log (in the GM folder) to keep things tidy, but also to account of those players unable to find/access their server.log.
|
||||||
|
- Startup errors will now lock out ALL commands other than '/manload'
|
||||||
|
- Fix 'manuadd' to use the default or selected world (via 'manselect'), if the world is not specified in the command.
|
||||||
|
- Expand GlobalGroups.yml and groups.yml to cover the VanishNoPacket plugin. Demonstrating how to negate and add nodes when using the '*' permission with inheritance.
|
||||||
|
- Fix silly nested throw/catch statements. Errors are now correctly generated when reading yml's.
|
||||||
|
- Unregister the worldsHolder as a service on a reload/shutdown instead of the whole plugin.
|
||||||
|
- Update all code formatting to use tabs for indentation.
|
||||||
|
- Stop using our own deprecated methods as we tell others to do.
|
||||||
|
- Finally remove all deprecated methods.
|
||||||
|
- Re-initialize the WorldsHolder on a reload, as un-registering and re-registering a new holder means all plugins have to check for the new service on every quiery.
|
||||||
|
- Prevent null perms getting past the GlobalGroups loader.
|
||||||
|
- Fix forgetting sub groups on a manload.
|
||||||
|
- Allow 'manucheckp' to notify when superperms reports false but it is really negated.
|
@@ -18,76 +18,84 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
*/
|
*/
|
||||||
public class GMConfiguration {
|
public class GMConfiguration {
|
||||||
|
|
||||||
private GroupManager plugin;
|
private GroupManager plugin;
|
||||||
private File configFile;
|
private File configFile;
|
||||||
private YamlConfiguration GMconfig;
|
private YamlConfiguration GMconfig;
|
||||||
|
|
||||||
public GMConfiguration(GroupManager plugin) {
|
public GMConfiguration(GroupManager plugin) {
|
||||||
this.plugin = plugin;
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void load() {
|
this.plugin = plugin;
|
||||||
if (!plugin.getDataFolder().exists()) {
|
load();
|
||||||
plugin.getDataFolder().mkdirs();
|
}
|
||||||
}
|
|
||||||
configFile = new File(plugin.getDataFolder(), "config.yml");
|
|
||||||
|
|
||||||
if (!configFile.exists()) {
|
public void load() {
|
||||||
try {
|
|
||||||
Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
GroupManager.logger.log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GMconfig = new YamlConfiguration();
|
if (!plugin.getDataFolder().exists()) {
|
||||||
|
plugin.getDataFolder().mkdirs();
|
||||||
|
}
|
||||||
|
configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||||
|
|
||||||
try {
|
if (!configFile.exists()) {
|
||||||
GMconfig.load(configFile);
|
try {
|
||||||
} catch (Exception ex) {
|
Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile);
|
||||||
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
|
} catch (IOException ex) {
|
||||||
}
|
GroupManager.logger.log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Setup defaults
|
GMconfig = new YamlConfiguration();
|
||||||
adjustLoggerLevel();
|
|
||||||
plugin.setValidateOnlinePlayer(isToggleValidate());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOpOverride() {
|
try {
|
||||||
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
GMconfig.load(configFile);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
public boolean isToggleValidate() {
|
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
|
||||||
return GMconfig.getBoolean("settings.config.validate_toggle", true);
|
}
|
||||||
}
|
|
||||||
|
// Setup defaults
|
||||||
|
adjustLoggerLevel();
|
||||||
|
plugin.setValidateOnlinePlayer(isToggleValidate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOpOverride() {
|
||||||
|
|
||||||
|
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isToggleValidate() {
|
||||||
|
|
||||||
|
return GMconfig.getBoolean("settings.config.validate_toggle", true);
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, Object> getMirrorsMap() {
|
public Map<String, Object> getMirrorsMap() {
|
||||||
// Try to fetch the old mirror path first
|
|
||||||
|
// Try to fetch the old mirror path first
|
||||||
if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) {
|
if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) {
|
||||||
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
|
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
|
||||||
} else if (GMconfig.isConfigurationSection("settings.mirrors")){
|
} else if (GMconfig.isConfigurationSection("settings.mirrors")) {
|
||||||
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
|
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSaveInterval() {
|
public Integer getSaveInterval() {
|
||||||
return GMconfig.getInt("settings.data.save.minutes", 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getBackupDuration() {
|
return GMconfig.getInt("settings.data.save.minutes", 10);
|
||||||
return GMconfig.getInt("settings.data.save.hours", 24);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void adjustLoggerLevel() {
|
public Integer getBackupDuration() {
|
||||||
|
|
||||||
try {
|
return GMconfig.getInt("settings.data.save.hours", 24);
|
||||||
GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
|
}
|
||||||
return;
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupManager.logger.setLevel(Level.INFO);
|
public void adjustLoggerLevel() {
|
||||||
}
|
|
||||||
|
try {
|
||||||
|
GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
|
||||||
|
return;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupManager.logger.setLevel(Level.INFO);
|
||||||
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@@ -20,155 +20,168 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class Group extends DataUnit implements Cloneable {
|
public class Group extends DataUnit implements Cloneable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The group it inherits DIRECTLY!
|
* The group it inherits DIRECTLY!
|
||||||
*/
|
*/
|
||||||
private ArrayList<String> inherits = new ArrayList<String>();
|
private ArrayList<String> inherits = new ArrayList<String>();
|
||||||
/**
|
/**
|
||||||
*This one holds the fields in INFO node.
|
* This one holds the fields in INFO node.
|
||||||
* like prefix = 'c'
|
* like prefix = 'c'
|
||||||
* or build = false
|
* or build = false
|
||||||
*/
|
*/
|
||||||
private GroupVariables variables = new GroupVariables(this);
|
private GroupVariables variables = new GroupVariables(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for individual World Groups.
|
* Constructor for individual World Groups.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public Group(WorldDataHolder source, String name) {
|
public Group(WorldDataHolder source, String name) {
|
||||||
super(source, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
super(source, name);
|
||||||
* Constructor for Global Groups.
|
}
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public Group(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this a GlobalGroup
|
* Constructor for Global Groups.
|
||||||
*
|
*
|
||||||
* @return
|
* @param name
|
||||||
*/
|
*/
|
||||||
public boolean isGlobal() {
|
public Group(String name) {
|
||||||
return (getDataSource() == null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
super(name);
|
||||||
* Clone this group
|
}
|
||||||
* @return a clone of this group
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Group clone() {
|
|
||||||
Group clone;
|
|
||||||
|
|
||||||
if (isGlobal()) {
|
/**
|
||||||
clone = new Group(this.getName());
|
* Is this a GlobalGroup
|
||||||
} else {
|
*
|
||||||
clone = new Group(getDataSource(), this.getName());
|
* @return true if this is a global group
|
||||||
clone.inherits = new ArrayList<String>(this.getInherits());
|
*/
|
||||||
}
|
public boolean isGlobal() {
|
||||||
|
|
||||||
for (String perm : this.getPermissionList()) {
|
return (getDataSource() == null);
|
||||||
clone.addPermission(perm);
|
}
|
||||||
}
|
|
||||||
clone.variables = ((GroupVariables) variables).clone(clone);
|
|
||||||
//clone.flagAsChanged();
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this to deliver a group from a different dataSource to another
|
* Clone this group
|
||||||
* @param dataSource
|
*
|
||||||
* @return Null or Clone
|
* @return a clone of this group
|
||||||
*/
|
*/
|
||||||
public Group clone(WorldDataHolder dataSource) {
|
@Override
|
||||||
if (dataSource.groupExists(this.getName())) {
|
public Group clone() {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Group clone = dataSource.createGroup(this.getName());
|
Group clone;
|
||||||
|
|
||||||
// Don't add inheritance for GlobalGroups
|
if (isGlobal()) {
|
||||||
if (!isGlobal()) {
|
clone = new Group(this.getName());
|
||||||
clone.inherits = new ArrayList<String>(this.getInherits());
|
} else {
|
||||||
}
|
clone = new Group(getDataSource(), this.getName());
|
||||||
for (String perm : this.getPermissionList()) {
|
clone.inherits = new ArrayList<String>(this.getInherits());
|
||||||
clone.addPermission(perm);
|
}
|
||||||
}
|
|
||||||
clone.variables = variables.clone(clone);
|
|
||||||
clone.flagAsChanged(); //use this to make the new dataSource save the new group
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
for (String perm : this.getPermissionList()) {
|
||||||
* an unmodifiable list of inherits list
|
clone.addPermission(perm);
|
||||||
* You can't manage the list by here
|
}
|
||||||
* Lol... version 0.6 had a problem because this.
|
clone.variables = ((GroupVariables) variables).clone(clone);
|
||||||
* @return the inherits
|
//clone.flagAsChanged();
|
||||||
*/
|
return clone;
|
||||||
public List<String> getInherits() {
|
}
|
||||||
return Collections.unmodifiableList(inherits);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param inherit the inherits to set
|
* Use this to deliver a group from a different dataSource to another
|
||||||
*/
|
*
|
||||||
public void addInherits(Group inherit) {
|
* @param dataSource
|
||||||
if (!isGlobal()) {
|
* @return Null or Clone
|
||||||
if (!this.getDataSource().groupExists(inherit.getName())) {
|
*/
|
||||||
getDataSource().addGroup(inherit);
|
public Group clone(WorldDataHolder dataSource) {
|
||||||
}
|
|
||||||
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 (dataSource.groupExists(this.getName())) {
|
||||||
if (!isGlobal()) {
|
return null;
|
||||||
if (this.inherits.contains(inherit.toLowerCase())) {
|
}
|
||||||
this.inherits.remove(inherit.toLowerCase());
|
|
||||||
flagAsChanged();
|
|
||||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
Group clone = dataSource.createGroup(this.getName());
|
||||||
* @return the variables
|
|
||||||
*/
|
|
||||||
public GroupVariables getVariables() {
|
|
||||||
return variables;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// Don't add inheritance for GlobalGroups
|
||||||
*
|
if (!isGlobal()) {
|
||||||
* @param varList
|
clone.inherits = new ArrayList<String>(this.getInherits());
|
||||||
*/
|
}
|
||||||
public void setVariables(Map<String, Object> varList) {
|
for (String perm : this.getPermissionList()) {
|
||||||
if (!isGlobal()) {
|
clone.addPermission(perm);
|
||||||
GroupVariables temp = new GroupVariables(this, varList);
|
}
|
||||||
variables.clearVars();
|
clone.variables = variables.clone(clone);
|
||||||
for (String key : temp.getVarKeyList()) {
|
clone.flagAsChanged(); //use this to make the new dataSource save the new group
|
||||||
variables.addVar(key, temp.getVarObject(key));
|
return clone;
|
||||||
}
|
}
|
||||||
flagAsChanged();
|
|
||||||
if (GroupManager.isLoaded()) {
|
/**
|
||||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
* an unmodifiable list of inherits list
|
||||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
|
* You can't manage the list by here
|
||||||
}
|
* Lol... version 0.6 had a problem because this.
|
||||||
}
|
*
|
||||||
}
|
* @return the inherits
|
||||||
|
*/
|
||||||
|
public List<String> getInherits() {
|
||||||
|
|
||||||
|
return Collections.unmodifiableList(inherits);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inherit the inherits to set
|
||||||
|
*/
|
||||||
|
public void addInherits(Group inherit) {
|
||||||
|
|
||||||
|
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 (!isGlobal()) {
|
||||||
|
if (this.inherits.contains(inherit.toLowerCase())) {
|
||||||
|
this.inherits.remove(inherit.toLowerCase());
|
||||||
|
flagAsChanged();
|
||||||
|
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the variables
|
||||||
|
*/
|
||||||
|
public GroupVariables getVariables() {
|
||||||
|
|
||||||
|
return variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param varList
|
||||||
|
*/
|
||||||
|
public void setVariables(Map<String, Object> varList) {
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user