summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/src/Changelog.txt12
-rw-r--r--EssentialsGroupManager/src/config.yml6
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java9
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java47
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java22
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java3
-rw-r--r--EssentialsGroupManager/src/plugin.yml4
8 files changed, 87 insertions, 18 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 014b4b9ea..f3bc35baa 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -34,10 +34,10 @@ v 1.3:
(for all worlds named in config.yml)
- Attempt to stop GM wiping groups/users yml's on a bad shut down.
- Added event handling to manage new world creation at runtime.
- - Added the ability to handle unknown worlds at server start.
- (GM will create the data files for any worlds it finds which are not in the config.yml)
+ - Added the ability to handle unknown worlds at server start.
+ (GM will create the data files for any worlds it finds which are not in the config.yml)
- Fix for Bukkit passing a null To location on a player Portaling
- - Fixed manudelsub not correctly selecting the group to remove.
+ - Fixed manudelsub not correctly selecting the group to remove.
- Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other
These allow players/admins to be notified when players are moved between groups.
v 1.4:
@@ -208,4 +208,8 @@ v 2.0:
- Synchronize the raising of GroupManager events to Bukkit.getServer() (should prevent deadlocks).
- Synchronize pushing to Bukkit perms to prevent any ConcurrentModificationException.
- Do not grant any permissions (nor update Bukkit) if the server is in offline mode and the player has the permission node 'groupmanager.noofflineperms'.
- - Negate 'groupmanager.noofflineperms' by default in the owner group. \ No newline at end of file
+ - Negate 'groupmanager.noofflineperms' by default in the owner group.
+ - Add support for BukkitForge using 'overworld' as the main world name.
+ - Prevent '*' permissions granting the 'groupmanager.noofflineperms' permission.
+ - Added '/mancheckw <world>' to inspect which permission files a world is referencing.
+ - Add config potion to set if GM commands should be allowed on CommnandBlocks.
diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml
index cc90bea6f..479399bb6 100644
--- a/EssentialsGroupManager/src/config.yml
+++ b/EssentialsGroupManager/src/config.yml
@@ -7,6 +7,10 @@ settings:
# Default setting for 'mantoglevalidate'
# true will cause GroupManager to attempt name matching by default.
validate_toggle: true
+ # **********************************************************************************************************************************
+ # *** NOTE: Having this feature enabled, improper use of commandblocks will lead to undesireable permission changes, be alarmed! ***
+ # **********************************************************************************************************************************
+ allow_commandblocks: false
data:
save:
@@ -39,4 +43,4 @@ settings:
# world4:
# - groups (World4 would use the groups.yml from world2, but it's own users.yml)
# world5:
- # - world6 (this would cause world6 to mirror both files from world5) \ No newline at end of file
+ # - world6 (this would cause world6 to mirror both files from world5)
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
index 4fcd0a554..e5a24258e 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
@@ -22,6 +22,7 @@ import org.yaml.snakeyaml.reader.UnicodeReader;
*/
public class GMConfiguration {
+ private boolean allowCommandBlocks = false;
private boolean opOverride = true;
private boolean toggleValidate = true;
private Integer saveInterval = 10;
@@ -40,6 +41,7 @@ public class GMConfiguration {
/*
* Set defaults
*/
+ allowCommandBlocks = false;
opOverride = true;
toggleValidate = true;
saveInterval = 10;
@@ -83,6 +85,7 @@ public class GMConfiguration {
try {
Map<String, Object> config = getElement("config", getElement("settings", GMconfig));
+ allowCommandBlocks = (Boolean) config.get("allow_commandblocks");
opOverride = (Boolean) config.get("opOverrides");
toggleValidate = (Boolean) config.get("validate_toggle");
@@ -142,6 +145,10 @@ public class GMConfiguration {
return (Map<String, Object>) map.get(element);
}
+ public boolean isAllowCommandBlocks() {
+
+ return allowCommandBlocks;
+ }
public boolean isOpOverride() {
@@ -183,4 +190,4 @@ public class GMConfiguration {
}
-} \ No newline at end of file
+}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 474ceae84..4bac6d2ef 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -34,6 +34,7 @@ import org.anjocaido.groupmanager.utils.Tasks;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
+import org.bukkit.block.Block;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -387,10 +388,12 @@ public class GroupManager extends JavaPlugin {
Group senderGroup = null;
User senderUser = null;
boolean isOpOverride = config.isOpOverride();
+ boolean isAllowCommandBlocks = config.isAllowCommandBlocks();
// PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS
- if (sender instanceof BlockCommandSender) {
- sender.sendMessage(ChatColor.RED + "GM Commands can not be called from CommandBlocks");
+ if (sender instanceof BlockCommandSender && !isAllowCommandBlocks) {
+ Block block = ((BlockCommandSender)sender).getBlock();
+ GroupManager.logger.warning(ChatColor.RED + "GM Commands can not be called from the CommandBlock at location: " + ChatColor.GREEN + block.getWorld().getName() + " - " + block.getX() + ", " + block.getY() + ", " + block.getZ());
return true;
}
@@ -404,7 +407,7 @@ public class GroupManager extends JavaPlugin {
senderPlayer = (Player) sender;
if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) {
- sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check the log" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'.");
+ GroupManager.logger.warning(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check the log" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'.");
return true;
}
@@ -1900,7 +1903,7 @@ public class GroupManager extends JavaPlugin {
case manselect:
if (args.length < 1) {
- sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)");
+ sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manselect <world>)");
sender.sendMessage(ChatColor.YELLOW + "Worlds available: ");
ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();
auxString = "";
@@ -1940,6 +1943,42 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible).");
return true;
+
+ case mancheckw:
+ if (args.length < 1) {
+ sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mancheckw <world>)");
+ sender.sendMessage(ChatColor.YELLOW + "Worlds available: ");
+ ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();
+ auxString = "";
+ for (int i = 0; i < worlds.size(); i++) {
+ auxString += worlds.get(i).getName();
+ if ((i + 1) < worlds.size()) {
+ auxString += ", ";
+ }
+ }
+ sender.sendMessage(ChatColor.YELLOW + auxString);
+ return false;
+ }
+
+ auxString = "";
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] == null) {
+ logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length);
+ return false;
+ }
+ auxString += args[i];
+ if (i < (args.length - 1)) {
+ auxString += " ";
+ }
+ }
+ dataHolder = worldsHolder.getWorldData(auxString);
+
+ sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'.");
+ sender.sendMessage(ChatColor.YELLOW + "This world is using the following data files..");
+ sender.sendMessage(ChatColor.YELLOW + "Groups: " + dataHolder.getGroupsFile().getAbsolutePath());
+ sender.sendMessage(ChatColor.YELLOW + "Users: " + dataHolder.getUsersFile().getAbsolutePath());
+
+ return true;
default:
break;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index 12a6a5150..2661c6bc0 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -477,14 +477,22 @@ public class WorldsHolder {
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);
+ /* Do not use the folder name if this
+ * is a Bukkit Forge server.
+ */
+ if (plugin.getServer().getName().equalsIgnoreCase("BukkitForge")) {
+ serverDefaultWorldName = "overworld";
+
+ } else {
+ Properties server = new Properties();
+ try {
+ server.load(new FileInputStream(new File("server.properties")));
+ serverDefaultWorldName = server.getProperty("level-name").toLowerCase();
+ } catch (IOException ex) {
+ GroupManager.logger.log(Level.SEVERE, null, ex);
+ }
}
+ setupWorldFolder(serverDefaultWorldName);
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
index 7396f3f70..a221c56a2 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
@@ -172,6 +172,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
allPerms = true;
perms.remove("*");
+ // Remove the no offline perms node as this should not be given.
+ perms.remove("groupmanager.noofflineperms");
}
for (String perm : perms) {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
index 4a7298b9c..020e4c6f1 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java
@@ -49,5 +49,6 @@ public enum GroupManagerPermissions {
mantogglesave,
manworld,
manselect,
- manclear
+ manclear,
+ mancheckw
}
diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml
index abe199aad..3aec73096 100644
--- a/EssentialsGroupManager/src/plugin.yml
+++ b/EssentialsGroupManager/src/plugin.yml
@@ -164,6 +164,10 @@ commands:
description: Clear world selection. Next commands will work on your world.
usage: /<command>
permissions: groupmanager.manclear
+ mancheckw:
+ description: Obtain the paths to each file a world is storing it's data in (users/groups).
+ usage: /<command> <world>
+ permissions: groupmanager.mancheckw
Permissions:
groupmanager.op: