Added overridden-commands. Commands beginning with /e will also give Essentials precedence.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1193 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
zenexer 2011-04-15 01:41:42 +00:00
parent 7463d06594
commit a8ef55e057
5 changed files with 52 additions and 19 deletions

View File

@ -0,0 +1 @@
user.properties.file=C:\\Users\\Paul\\.netbeans\\7.0beta2\\build.properties

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View File

@ -496,31 +496,34 @@ public class Essentials extends JavaPlugin
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
{
// Allow plugins to override the command via onCommand
for (Plugin p : getServer().getPluginManager().getPlugins())
if (!getSettings().isCommandOverridden(command.getName()) && !commandLabel.startsWith("e"))
{
if (p == this)
continue;
for (Plugin p : getServer().getPluginManager().getPlugins())
{
if (p == this)
continue;
PluginDescriptionFile desc = p.getDescription();
if (desc == null)
continue;
PluginDescriptionFile desc = p.getDescription();
if (desc == null)
continue;
if (desc.getName() == null)
continue;
if (desc.getName() == null)
continue;
if (!(desc.getCommands() instanceof Map))
continue;
if (!(desc.getCommands() instanceof Map))
continue;
Map<String, Object> cmds = (Map<String, Object>)desc.getCommands();
if (!cmds.containsKey(command.getName()))
continue;
Map<String, Object> cmds = (Map<String, Object>)desc.getCommands();
if (!cmds.containsKey(command.getName()))
continue;
PluginCommand pcmd = getServer().getPluginCommand(desc.getName() + ":" + commandLabel);
PluginCommand pcmd = getServer().getPluginCommand(desc.getName() + ":" + commandLabel);
if (pcmd == null)
continue;
if (pcmd == null)
continue;
return getServer().getPluginCommand(p.getDescription().getName() + ":" + commandLabel).execute(sender, commandLabel, args);
return getServer().getPluginCommand(p.getDescription().getName() + ":" + commandLabel).execute(sender, commandLabel, args);
}
}
try

View File

@ -98,6 +98,19 @@ public class Settings implements IConf
return config.getBoolean("restrict-" + label.toLowerCase(), false);
}
public boolean isCommandOverridden(String name)
{
List<String> defaultList = new ArrayList<String>(1);
defaultList.add("god");
for (String c : config.getStringList("overridden-commands", defaultList))
{
if (!c.equalsIgnoreCase(name))
continue;
return true;
}
return config.getBoolean("override-" + name.toLowerCase(), false);
}
public int getCommandCost(IEssentialsCommand cmd)
{
return getCommandCost(cmd.getName());
@ -436,12 +449,12 @@ public class Settings implements IConf
return epBreakList;
}
public Boolean spawnIfNoHome()
public boolean spawnIfNoHome()
{
return config.getBoolean("spawn-if-no-home", false);
}
public Boolean warnOnBuildDisallow()
public boolean warnOnBuildDisallow()
{
return config.getBoolean("warn-on-build-disallow", false);
}

View File

@ -74,12 +74,24 @@ motd:
- '&cWelcome, {PLAYER}&c!'
- '&fType &c/help&f for a list of commands.'
- 'Currently online: {PLAYERLIST}'
- 'Did you know that you can make [Disposal] signs with Essentials?'
# The server rules, available by typing /rules
rules:
- '[1] Be respectful'
- '[2] Be ethical'
- '[3] Use common sense'
# When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take
# priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:
# usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.
# For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god
# will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an "e",
# such as /egod, will always grant Essentials priority.
# Because WorldGuard's /god is broken/unreliable, we should try to take priority over /god. If this doesn't work, use
# /essentials:god or /egod. Do NOT use WorldGuard's /god, or you will likely be stuck in god mode.
overridden-commands:
- god
# Disabled commands will be completelly unavailable on the server.
disabled-commands: