Merge branch 'groupmanager' of github.com:essentials/Essentials into 2.9

Conflicts:
	EssentialsGroupManager/src/Changelog.txt
This commit is contained in:
KHobbits 2013-01-31 20:38:36 +00:00
commit fddbd7a52a
8 changed files with 87 additions and 18 deletions

View file

@ -34,10 +34,10 @@ v 1.3:
(for all worlds named in config.yml) (for all worlds named in config.yml)
- Attempt to stop GM wiping groups/users yml's on a bad shut down. - 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 event handling to manage new world creation at runtime.
- Added the ability to handle unknown worlds at server start. - 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) (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 - 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 - Added two new permission nodes - groupmanager.notify.self & groupmanager.notify.other
These allow players/admins to be notified when players are moved between groups. These allow players/admins to be notified when players are moved between groups.
v 1.4: v 1.4:
@ -208,4 +208,8 @@ v 2.0:
- Synchronize the raising of GroupManager events to Bukkit.getServer() (should prevent deadlocks). - Synchronize the raising of GroupManager events to Bukkit.getServer() (should prevent deadlocks).
- Synchronize pushing to Bukkit perms to prevent any ConcurrentModificationException. - 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'. - 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. - 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.

View file

@ -7,6 +7,10 @@ settings:
# Default setting for 'mantoglevalidate' # Default setting for 'mantoglevalidate'
# true will cause GroupManager to attempt name matching by default. # true will cause GroupManager to attempt name matching by default.
validate_toggle: true validate_toggle: true
# **********************************************************************************************************************************
# *** NOTE: Having this feature enabled, improper use of commandblocks will lead to undesireable permission changes, be alarmed! ***
# **********************************************************************************************************************************
allow_commandblocks: false
data: data:
save: save:
@ -39,4 +43,4 @@ settings:
# world4: # world4:
# - groups (World4 would use the groups.yml from world2, but it's own users.yml) # - groups (World4 would use the groups.yml from world2, but it's own users.yml)
# world5: # world5:
# - world6 (this would cause world6 to mirror both files from world5) # - world6 (this would cause world6 to mirror both files from world5)

View file

@ -22,6 +22,7 @@ import org.yaml.snakeyaml.reader.UnicodeReader;
*/ */
public class GMConfiguration { public class GMConfiguration {
private boolean allowCommandBlocks = false;
private boolean opOverride = true; private boolean opOverride = true;
private boolean toggleValidate = true; private boolean toggleValidate = true;
private Integer saveInterval = 10; private Integer saveInterval = 10;
@ -40,6 +41,7 @@ public class GMConfiguration {
/* /*
* Set defaults * Set defaults
*/ */
allowCommandBlocks = false;
opOverride = true; opOverride = true;
toggleValidate = true; toggleValidate = true;
saveInterval = 10; saveInterval = 10;
@ -83,6 +85,7 @@ public class GMConfiguration {
try { try {
Map<String, Object> config = getElement("config", getElement("settings", GMconfig)); Map<String, Object> config = getElement("config", getElement("settings", GMconfig));
allowCommandBlocks = (Boolean) config.get("allow_commandblocks");
opOverride = (Boolean) config.get("opOverrides"); opOverride = (Boolean) config.get("opOverrides");
toggleValidate = (Boolean) config.get("validate_toggle"); toggleValidate = (Boolean) config.get("validate_toggle");
@ -142,6 +145,10 @@ public class GMConfiguration {
return (Map<String, Object>) map.get(element); return (Map<String, Object>) map.get(element);
} }
public boolean isAllowCommandBlocks() {
return allowCommandBlocks;
}
public boolean isOpOverride() { public boolean isOpOverride() {
@ -183,4 +190,4 @@ public class GMConfiguration {
} }
} }

View file

@ -34,6 +34,7 @@ import org.anjocaido.groupmanager.utils.Tasks;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
import org.bukkit.command.BlockCommandSender; import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -387,10 +388,12 @@ public class GroupManager extends JavaPlugin {
Group senderGroup = null; Group senderGroup = null;
User senderUser = null; User senderUser = null;
boolean isOpOverride = config.isOpOverride(); boolean isOpOverride = config.isOpOverride();
boolean isAllowCommandBlocks = config.isAllowCommandBlocks();
// PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS // PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS
if (sender instanceof BlockCommandSender) { if (sender instanceof BlockCommandSender && !isAllowCommandBlocks) {
sender.sendMessage(ChatColor.RED + "GM Commands can not be called from CommandBlocks"); 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; return true;
} }
@ -404,7 +407,7 @@ public class GroupManager extends JavaPlugin {
senderPlayer = (Player) sender; senderPlayer = (Player) sender;
if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { 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; return true;
} }
@ -1900,7 +1903,7 @@ public class GroupManager extends JavaPlugin {
case manselect: case manselect:
if (args.length < 1) { 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: "); sender.sendMessage(ChatColor.YELLOW + "Worlds available: ");
ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList();
auxString = ""; 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)."); sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible).");
return true; 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: default:
break; break;

View file

@ -477,14 +477,22 @@ public class WorldsHolder {
private void verifyFirstRun() { private void verifyFirstRun() {
Properties server = new Properties(); /* Do not use the folder name if this
try { * is a Bukkit Forge server.
server.load(new FileInputStream(new File("server.properties"))); */
serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); if (plugin.getServer().getName().equalsIgnoreCase("BukkitForge")) {
setupWorldFolder(serverDefaultWorldName); serverDefaultWorldName = "overworld";
} catch (IOException ex) {
GroupManager.logger.log(Level.SEVERE, null, ex); } 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);
} }

View file

@ -172,6 +172,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren)); permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
allPerms = true; allPerms = true;
perms.remove("*"); perms.remove("*");
// Remove the no offline perms node as this should not be given.
perms.remove("groupmanager.noofflineperms");
} }
for (String perm : perms) { for (String perm : perms) {

View file

@ -49,5 +49,6 @@ public enum GroupManagerPermissions {
mantogglesave, mantogglesave,
manworld, manworld,
manselect, manselect,
manclear manclear,
mancheckw
} }

View file

@ -164,6 +164,10 @@ commands:
description: Clear world selection. Next commands will work on your world. description: Clear world selection. Next commands will work on your world.
usage: /<command> usage: /<command>
permissions: groupmanager.manclear 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: Permissions:
groupmanager.op: groupmanager.op: