mirror of
https://github.com/essentials/Essentials.git
synced 2025-01-18 21:58:00 +01:00
Rewrote Config loading to use Bukkits Configuration features
Added an opOverride setting in config. If present and set to false, op's will not get overriding permissions in GroupManager. (one op will not be able to alter another op's settings) GM will now create all relevant world data files for non mirrored worlds. (for all worlds named in config.yml)
This commit is contained in:
parent
5cfb600708
commit
b022a83694
@ -24,4 +24,10 @@ v 1.1:
|
|||||||
- Optimized getAllPlayersPermissions and fixed pushing unknown perms to superperms.
|
- Optimized getAllPlayersPermissions and fixed pushing unknown perms to superperms.
|
||||||
v 1.2:
|
v 1.2:
|
||||||
- Changed priority of Registered events to lowest.
|
- Changed priority of Registered events to lowest.
|
||||||
- Fixed an issue with superperms where plugins define perms with inheritance after the root perms
|
- Fixed an issue with superperms where plugins define perms with inheritance after the root perms
|
||||||
|
- Rewrote Config loading to use Bukkits Configuration features
|
||||||
|
- Added an opOverride setting in config.
|
||||||
|
If present and set to false, op's will not get overriding permissions in GroupManager.
|
||||||
|
(one op will not be able to alter another op's settings)
|
||||||
|
- GM will now create all relevant world data files for non mirrored worlds.
|
||||||
|
(for all worlds named in config.yml)
|
@ -1,12 +1,19 @@
|
|||||||
settings:
|
settings:
|
||||||
|
config:
|
||||||
|
# With this enabled anyone set as op has full permissions when managing GroupManager
|
||||||
|
opOverrides: true
|
||||||
data:
|
data:
|
||||||
save:
|
save:
|
||||||
|
# How often GroupManager will save it's data back to groups and users.yml
|
||||||
minutes: 10
|
minutes: 10
|
||||||
logging:
|
logging:
|
||||||
|
# level of detail GroupManager will use when logging.
|
||||||
|
# Acceptable entries are - ALL,CONFIG,FINE,FINER,FINEST,INFO,OFF,SEVERE,WARNING
|
||||||
level: INFO
|
level: INFO
|
||||||
permission:
|
permission:
|
||||||
world:
|
world:
|
||||||
mirror:
|
mirror:
|
||||||
|
# Worlds listed here have their permissions mirrored in their children.
|
||||||
world:
|
world:
|
||||||
- world_nether
|
- world_nether
|
||||||
- world2
|
- world2
|
||||||
|
90
EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
Executable file → Normal file
90
EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
Executable file → Normal file
@ -5,15 +5,11 @@
|
|||||||
package org.anjocaido.groupmanager;
|
package org.anjocaido.groupmanager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.anjocaido.groupmanager.utils.Tasks;
|
import org.anjocaido.groupmanager.utils.Tasks;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.bukkit.util.config.Configuration;
|
||||||
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
|
||||||
import org.yaml.snakeyaml.reader.UnicodeReader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -22,9 +18,9 @@ import org.yaml.snakeyaml.reader.UnicodeReader;
|
|||||||
public class GMConfiguration {
|
public class GMConfiguration {
|
||||||
|
|
||||||
private GroupManager plugin;
|
private GroupManager plugin;
|
||||||
private Map<String, Object> rootDataNode;
|
|
||||||
private File configFile;
|
private File configFile;
|
||||||
|
private Configuration GMconfig;
|
||||||
|
|
||||||
public GMConfiguration(GroupManager plugin) {
|
public GMConfiguration(GroupManager plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
load();
|
load();
|
||||||
@ -44,77 +40,37 @@ public class GMConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Yaml yaml = new Yaml(new SafeConstructor());
|
GMconfig = new Configuration(configFile);
|
||||||
FileInputStream rx = null;
|
|
||||||
try {
|
try {
|
||||||
rx = new FileInputStream(configFile);
|
GMconfig.load();
|
||||||
} catch (FileNotFoundException ex) {
|
|
||||||
GroupManager.logger.log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
rootDataNode = (Map<String, Object>) yaml.load(new UnicodeReader(rx));
|
|
||||||
if (rootDataNode == null) {
|
|
||||||
throw new NullPointerException();
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
|
throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex);
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
rx.close();
|
|
||||||
} catch (IOException ex) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
adjustLoggerLevel();
|
adjustLoggerLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getMirrorsMap() {
|
public boolean isOpOverride() {
|
||||||
if (rootDataNode.get("settings") instanceof Map) {
|
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
||||||
Map<String, Object> settingsNode = (Map<String, Object>) rootDataNode.get("settings");
|
|
||||||
if (settingsNode.get("permission") instanceof Map) {
|
|
||||||
Map<String, Object> permissionNode = (Map<String, Object>) settingsNode.get("permission");
|
|
||||||
if (permissionNode.get("world") instanceof Map) {
|
|
||||||
Map<String, Object> worldsNode = (Map<String, Object>) permissionNode.get("world");
|
|
||||||
if (worldsNode.get("mirror") instanceof Map) {
|
|
||||||
Map<String, Object> mirrorsNode = (Map<String, Object>) worldsNode.get("mirror");
|
|
||||||
return mirrorsNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSaveInterval() {
|
@SuppressWarnings("unchecked")
|
||||||
if (rootDataNode.get("settings") instanceof Map) {
|
public Map<String, Object> getMirrorsMap() {
|
||||||
Map<String, Object> settingsNode = (Map<String, Object>) rootDataNode.get("settings");
|
return (Map<String, Object>) GMconfig.getProperty("settings.permission.world.mirror");
|
||||||
if (settingsNode.get("data") instanceof Map) {
|
}
|
||||||
Map<String, Object> dataNode = (Map<String, Object>) settingsNode.get("data");
|
|
||||||
if (dataNode.get("save") instanceof Map) {
|
public Integer getSaveInterval() {
|
||||||
Map<String, Object> saveNode = (Map<String, Object>) dataNode.get("save");
|
return GMconfig.getInt("settings.data.save.minutes", 10);
|
||||||
if (saveNode.get("minutes") instanceof Integer) {
|
|
||||||
return (Integer) saveNode.get("minutes");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adjustLoggerLevel() {
|
public void adjustLoggerLevel() {
|
||||||
if (rootDataNode.get("settings") instanceof Map) {
|
|
||||||
Map<String, Object> settingsNode = (Map<String, Object>) rootDataNode.get("settings");
|
try {
|
||||||
if (settingsNode.get("logging") instanceof Map) {
|
GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO")));
|
||||||
Map<String, Object> loggingNode = (Map<String, Object>) settingsNode.get("logging");
|
return;
|
||||||
if (loggingNode.get("level") instanceof String) {
|
} catch (Exception e) {
|
||||||
String level = (String) loggingNode.get("level");
|
|
||||||
try {
|
|
||||||
GroupManager.logger.setLevel(Level.parse(level));
|
|
||||||
return;
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
GroupManager.logger.setLevel(Level.INFO);
|
|
||||||
|
GroupManager.logger.setLevel(Level.INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -232,6 +232,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
Player senderPlayer = null, targetPlayer = null;
|
Player senderPlayer = null, targetPlayer = null;
|
||||||
Group senderGroup = null;
|
Group senderGroup = null;
|
||||||
User senderUser = null;
|
User senderUser = null;
|
||||||
|
boolean isOpOverride = config.isOpOverride();
|
||||||
|
|
||||||
|
|
||||||
//DETERMINING PLAYER INFORMATION
|
//DETERMINING PLAYER INFORMATION
|
||||||
@ -239,8 +240,10 @@ public class GroupManager extends JavaPlugin {
|
|||||||
senderPlayer = (Player) sender;
|
senderPlayer = (Player) sender;
|
||||||
senderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getName());
|
senderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getName());
|
||||||
senderGroup = senderUser.getGroup();
|
senderGroup = senderUser.getGroup();
|
||||||
|
isOpOverride = (isOpOverride && senderPlayer.isOp());
|
||||||
|
|
||||||
System.out.println("[PLAYER_COMMAND] " + senderPlayer.getName() + ": /" + commandLabel + " " + Tasks.join(args, " "));
|
System.out.println("[PLAYER_COMMAND] " + senderPlayer.getName() + ": /" + commandLabel + " " + Tasks.join(args, " "));
|
||||||
if (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) {
|
if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) {
|
||||||
playerCanDo = true;
|
playerCanDo = true;
|
||||||
}
|
}
|
||||||
} else if (sender instanceof ConsoleCommandSender) {
|
} else if (sender instanceof ConsoleCommandSender) {
|
||||||
@ -338,23 +341,23 @@ public class GroupManager extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
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.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
|
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -392,7 +395,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
auxUser = dataHolder.getUser(args[0]);
|
auxUser = dataHolder.getUser(args[0]);
|
||||||
}
|
}
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
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.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -436,7 +439,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
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.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -472,7 +475,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
auxUser = dataHolder.getUser(args[0]);
|
auxUser = dataHolder.getUser(args[0]);
|
||||||
}
|
}
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
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.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -557,7 +560,7 @@ public class GroupManager extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
|
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
|
||||||
if (!isConsole && !senderPlayer.isOp() && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)
|
if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)
|
||||||
|| permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
|
|| permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't add a permission you don't have.");
|
sender.sendMessage(ChatColor.RED + "Can't add a permission you don't have.");
|
||||||
return false;
|
return false;
|
||||||
@ -620,12 +623,12 @@ public class GroupManager extends JavaPlugin {
|
|||||||
auxUser = dataHolder.getUser(args[0]);
|
auxUser = dataHolder.getUser(args[0]);
|
||||||
}
|
}
|
||||||
//VALIDANDO SUA PERMISSAO
|
//VALIDANDO SUA PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
|
permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]);
|
||||||
if (!isConsole && !senderPlayer.isOp() && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)
|
if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)
|
||||||
|| permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
|
|| permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have.");
|
sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have.");
|
||||||
return false;
|
return false;
|
||||||
@ -1554,23 +1557,23 @@ public class GroupManager extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
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.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
|
sender.sendMessage(ChatColor.RED + "The new group must be a higher rank.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1612,23 +1615,23 @@ public class GroupManager extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//VALIDANDO PERMISSAO
|
//VALIDANDO PERMISSAO
|
||||||
if (!isConsole && !senderPlayer.isOp() && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
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.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don' inherit.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don' inherit.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isConsole && !senderPlayer.isOp() && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) {
|
||||||
sender.sendMessage(ChatColor.RED + "The new group must be a lower rank.");
|
sender.sendMessage(ChatColor.RED + "The new group must be a lower rank.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder;
|
|||||||
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
|
||||||
import org.anjocaido.groupmanager.utils.Tasks;
|
import org.anjocaido.groupmanager.utils.Tasks;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.config.ConfigurationNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -85,6 +86,8 @@ public class WorldsHolder {
|
|||||||
Map<String, Object> mirrorsMap = plugin.getConfig().getMirrorsMap();
|
Map<String, Object> mirrorsMap = plugin.getConfig().getMirrorsMap();
|
||||||
if (mirrorsMap != null) {
|
if (mirrorsMap != null) {
|
||||||
for (String source : mirrorsMap.keySet()) {
|
for (String source : mirrorsMap.keySet()) {
|
||||||
|
// Make sure all non mirrored worlds have a set of data files.
|
||||||
|
setupWorldFolder(source);
|
||||||
if (mirrorsMap.get(source) instanceof ArrayList) {
|
if (mirrorsMap.get(source) instanceof ArrayList) {
|
||||||
ArrayList mirrorList = (ArrayList) mirrorsMap.get(source);
|
ArrayList mirrorList = (ArrayList) mirrorsMap.get(source);
|
||||||
for (Object o : mirrorList) {
|
for (Object o : mirrorList) {
|
||||||
@ -246,17 +249,24 @@ public class WorldsHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void verifyFirstRun() {
|
private void verifyFirstRun() {
|
||||||
|
|
||||||
|
Properties server = new Properties();
|
||||||
|
try {
|
||||||
|
server.load(new FileInputStream(new File("server.properties")));
|
||||||
|
serverDefaultWorldName = server.getProperty("level-name").toLowerCase();
|
||||||
|
setupWorldFolder(serverDefaultWorldName);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
GroupManager.logger.log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupWorldFolder(String worldName) {
|
||||||
worldsFolder = new File(plugin.getDataFolder(), "worlds");
|
worldsFolder = new File(plugin.getDataFolder(), "worlds");
|
||||||
if (!worldsFolder.exists()) {
|
if (!worldsFolder.exists()) {
|
||||||
worldsFolder.mkdirs();
|
worldsFolder.mkdirs();
|
||||||
}
|
}
|
||||||
Properties server = new Properties();
|
|
||||||
try {
|
|
||||||
server.load(new FileInputStream(new File("server.properties")));
|
|
||||||
} catch (IOException ex) {
|
|
||||||
GroupManager.logger.log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
serverDefaultWorldName = server.getProperty("level-name").toLowerCase();
|
|
||||||
File defaultWorldFolder = new File(worldsFolder, serverDefaultWorldName);
|
File defaultWorldFolder = new File(worldsFolder, serverDefaultWorldName);
|
||||||
if (!defaultWorldFolder.exists()) {
|
if (!defaultWorldFolder.exists()) {
|
||||||
defaultWorldFolder.mkdirs();
|
defaultWorldFolder.mkdirs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user