summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzenexer <zenexer@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-15 01:41:42 +0000
committerzenexer <zenexer@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-15 01:41:42 +0000
commita8ef55e057232bed38f1f1f904a28f6c83bf44e9 (patch)
tree2da2e608dee31203fbaa4a89ba701dbf33e5a83d
parent7463d0659496a2c4793d1dccedc4c1ca23ff971b (diff)
downloadEssentials-a8ef55e057232bed38f1f1f904a28f6c83bf44e9.tar
Essentials-a8ef55e057232bed38f1f1f904a28f6c83bf44e9.tar.gz
Essentials-a8ef55e057232bed38f1f1f904a28f6c83bf44e9.tar.lz
Essentials-a8ef55e057232bed38f1f1f904a28f6c83bf44e9.tar.xz
Essentials-a8ef55e057232bed38f1f1f904a28f6c83bf44e9.zip
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
-rw-r--r--Essentials/nbproject/private/private.properties1
-rw-r--r--Essentials/nbproject/private/private.xml4
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java37
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java17
-rw-r--r--Essentials/src/config.yml12
5 files changed, 52 insertions, 19 deletions
diff --git a/Essentials/nbproject/private/private.properties b/Essentials/nbproject/private/private.properties
new file mode 100644
index 000000000..94183418a
--- /dev/null
+++ b/Essentials/nbproject/private/private.properties
@@ -0,0 +1 @@
+user.properties.file=C:\\Users\\Paul\\.netbeans\\7.0beta2\\build.properties
diff --git a/Essentials/nbproject/private/private.xml b/Essentials/nbproject/private/private.xml
new file mode 100644
index 000000000..cc2c0e57c
--- /dev/null
+++ b/Essentials/nbproject/private/private.xml
@@ -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>
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 524be35e0..a373f55e9 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -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
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 3d2b55739..6d6ee3225 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -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);
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 11d3c323e..a8bbadb0d 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -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: