Show command conflict in debug mode.

This commit is contained in:
KHobbits 2011-12-03 23:38:28 +00:00
parent ea21e402ec
commit 90f87804b1
2 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,8 @@
package com.earth2me.essentials;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.command.Command;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.PluginCommandYamlParser;
@ -9,8 +11,9 @@ import org.bukkit.plugin.Plugin;
public class AlternativeCommandsHandler
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private final transient Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>();
private final transient Map<String, String> executed = new HashMap<String, String>();
private final transient Map<String, String> disabledList = new HashMap<String, String>();
private final transient IEssentials ess;
public AlternativeCommandsHandler(final IEssentials ess)
@ -118,13 +121,17 @@ public class AlternativeCommandsHandler
return commands.get(0);
}
public void executed(final String label, final String otherlabel)
public void executed(final String label, final String otherLabel)
{
executed.put(label, otherlabel);
if (ess.getSettings().isDebug())
{
LOGGER.log(Level.INFO, "Essentials: Alternative command " + label + " found, using " + otherLabel);
}
disabledList.put(label, otherLabel);
}
public Map<String, String> disabledCommands()
{
return executed;
return disabledList;
}
}

View File

@ -309,8 +309,7 @@ public class Essentials extends JavaPlugin implements IEssentials
final PluginCommand pc = alternativeCommandsHandler.getAlternative(commandLabel);
if (pc != null)
{
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
LOGGER.log(Level.FINE, "Essentials: Alternative command " + commandLabel + " found, using " + pc.getLabel());
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
return pc.execute(sender, commandLabel, args);
}
}