mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 10:04:51 +02:00
Try command fallback
This commit is contained in:
@@ -47,6 +47,8 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
|
import org.bukkit.command.SimpleCommandMap;
|
||||||
|
import org.bukkit.command.defaults.VanillaCommand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -85,6 +87,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
private transient Metrics metrics;
|
private transient Metrics metrics;
|
||||||
private transient EssentialsTimer timer;
|
private transient EssentialsTimer timer;
|
||||||
private transient List<String> vanishedPlayers = new ArrayList<String>();
|
private transient List<String> vanishedPlayers = new ArrayList<String>();
|
||||||
|
private transient SimpleCommandMap scm;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISettings getSettings()
|
public ISettings getSettings()
|
||||||
@@ -123,6 +126,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
i18n = new I18n(this);
|
i18n = new I18n(this);
|
||||||
i18n.onEnable();
|
i18n.onEnable();
|
||||||
execTimer.mark("I18n1");
|
execTimer.mark("I18n1");
|
||||||
|
scm = new SimpleCommandMap(this.getServer());
|
||||||
final PluginManager pm = getServer().getPluginManager();
|
final PluginManager pm = getServer().getPluginManager();
|
||||||
for (Plugin plugin : pm.getPlugins())
|
for (Plugin plugin : pm.getPlugins())
|
||||||
{
|
{
|
||||||
@@ -235,7 +239,8 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerListeners(PluginManager pm) {
|
private void registerListeners(PluginManager pm)
|
||||||
|
{
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
|
||||||
if (getSettings().isDebug())
|
if (getSettings().isDebug())
|
||||||
@@ -357,6 +362,16 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
// Check for disabled commands
|
// Check for disabled commands
|
||||||
if (getSettings().isCommandDisabled(commandLabel))
|
if (getSettings().isCommandDisabled(commandLabel))
|
||||||
{
|
{
|
||||||
|
if (scm != null)
|
||||||
|
{
|
||||||
|
for (VanillaCommand cmd : scm.getFallbackCommands())
|
||||||
|
{
|
||||||
|
if (cmd.matches(commandLabel))
|
||||||
|
{
|
||||||
|
cmd.execute(sender, commandLabel, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user