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)
- 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.
- 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'
# 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)
# - 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 {
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 {
}
}
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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) {

View File

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

View File

@ -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: