summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-01-25 03:06:21 +0000
committerKHobbits <rob@khobbits.co.uk>2013-01-25 03:06:53 +0000
commit286091cd32fe5de8da9c2587769e6f4d305853ba (patch)
tree011e9b045a9f661a9753e73c6810e65ba8709990
parent20786654a4c45af37a83ae60ccfb5255ef816d6a (diff)
downloadEssentials-286091cd32fe5de8da9c2587769e6f4d305853ba.tar
Essentials-286091cd32fe5de8da9c2587769e6f4d305853ba.tar.gz
Essentials-286091cd32fe5de8da9c2587769e6f4d305853ba.tar.lz
Essentials-286091cd32fe5de8da9c2587769e6f4d305853ba.tar.xz
Essentials-286091cd32fe5de8da9c2587769e6f4d305853ba.zip
Try command fallback
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java33
1 files changed, 24 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index c390e8e7a..4be868d4c 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -47,6 +47,8 @@ import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
+import org.bukkit.command.SimpleCommandMap;
+import org.bukkit.command.defaults.VanillaCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -85,6 +87,7 @@ public class Essentials extends JavaPlugin implements IEssentials
private transient Metrics metrics;
private transient EssentialsTimer timer;
private transient List<String> vanishedPlayers = new ArrayList<String>();
+ private transient SimpleCommandMap scm;
@Override
public ISettings getSettings()
@@ -123,6 +126,7 @@ public class Essentials extends JavaPlugin implements IEssentials
i18n = new I18n(this);
i18n.onEnable();
execTimer.mark("I18n1");
+ scm = new SimpleCommandMap(this.getServer());
final PluginManager pm = getServer().getPluginManager();
for (Plugin plugin : pm.getPlugins())
{
@@ -210,7 +214,7 @@ public class Essentials extends JavaPlugin implements IEssentials
backup = new Backup(this);
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
-
+
timer = new EssentialsTimer(this);
getScheduler().scheduleSyncRepeatingTask(this, timer, 100, 100);
@@ -234,15 +238,16 @@ public class Essentials extends JavaPlugin implements IEssentials
LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
}
}
-
- private void registerListeners(PluginManager pm) {
+
+ private void registerListeners(PluginManager pm)
+ {
HandlerList.unregisterAll(this);
-
+
if (getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Registering Listeners");
}
-
+
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
pm.registerEvents(serverListener, this);
confList.add(serverListener);
@@ -267,10 +272,10 @@ public class Essentials extends JavaPlugin implements IEssentials
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
pm.registerEvents(worldListener, this);
-
+
pm.registerEvents(tntListener, this);
-
- jails.resetListener();
+
+ jails.resetListener();
}
@Override
@@ -302,7 +307,7 @@ public class Essentials extends JavaPlugin implements IEssentials
}
i18n.updateLocale(settings.getLocale());
-
+
final PluginManager pm = getServer().getPluginManager();
registerListeners(pm);
}
@@ -357,6 +362,16 @@ public class Essentials extends JavaPlugin implements IEssentials
// Check for disabled commands
if (getSettings().isCommandDisabled(commandLabel))
{
+ if (scm != null)
+ {
+ for (VanillaCommand cmd : scm.getFallbackCommands())
+ {
+ if (cmd.matches(commandLabel))
+ {
+ cmd.execute(sender, commandLabel, args);
+ }
+ }
+ }
return true;
}