mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-03 15:08:18 +01:00
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:
parent
7463d06594
commit
a8ef55e057
1
Essentials/nbproject/private/private.properties
Normal file
1
Essentials/nbproject/private/private.properties
Normal file
@ -0,0 +1 @@
|
||||
user.properties.file=C:\\Users\\Paul\\.netbeans\\7.0beta2\\build.properties
|
4
Essentials/nbproject/private/private.xml
Normal file
4
Essentials/nbproject/private/private.xml
Normal 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>
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user