mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-03 19:00:30 +02:00
Hide NoCheat from players by responding to failed commands with the
default command not found message
This commit is contained in:
parent
66c93513bd
commit
2874b41e88
|
@ -5,10 +5,15 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
@ -108,6 +113,10 @@ public class NoCheat extends JavaPlugin {
|
|||
lagMeasureTask = new LagMeasureTask(this);
|
||||
lagMeasureTask.start();
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvent(Type.PLAYER_DROP_ITEM, new PlayerListener() { @Override public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
System.out.println("Drop");
|
||||
}}, Priority.Low, this);
|
||||
|
||||
// Then print a list of active checks per world
|
||||
ActiveCheckPrinter.printActiveChecks(this, eventManagers);
|
||||
|
@ -138,7 +147,14 @@ public class NoCheat extends JavaPlugin {
|
|||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
return CommandHandler.handleCommand(this, sender, command, label, args);
|
||||
boolean result = CommandHandler.handleCommand(this, sender, command, label, args);
|
||||
|
||||
if(!result && sender instanceof Player) {
|
||||
sender.sendMessage("Unknown command. Type \"help\" for help.");
|
||||
return true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getIngameSeconds() {
|
||||
|
|
|
@ -23,30 +23,30 @@ public class CommandHandler {
|
|||
|
||||
public static boolean handleCommand(NoCheat plugin, CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
boolean result = false;
|
||||
// Not our command
|
||||
if(!command.getName().equalsIgnoreCase("nocheat") || args.length == 0)
|
||||
return false;
|
||||
|
||||
if(args[0].equalsIgnoreCase("permlist") && args.length >= 2) {
|
||||
if(!command.getName().equalsIgnoreCase("nocheat") || args.length == 0) {
|
||||
result = false;
|
||||
} else if(args[0].equalsIgnoreCase("permlist") && args.length >= 2) {
|
||||
// permlist command was used
|
||||
return handlePermlistCommand(plugin, sender, args);
|
||||
result = handlePermlistCommand(plugin, sender, args);
|
||||
|
||||
} else if(args[0].equalsIgnoreCase("reload")) {
|
||||
// reload command was used
|
||||
return handleReloadCommand(plugin, sender);
|
||||
result = handleReloadCommand(plugin, sender);
|
||||
}
|
||||
|
||||
else if(args[0].equalsIgnoreCase("performance")) {
|
||||
// performance command was used
|
||||
return handlePerformanceCommand(plugin, sender);
|
||||
result = handlePerformanceCommand(plugin, sender);
|
||||
}
|
||||
|
||||
else if(args[0].equalsIgnoreCase("playerinfo") && args.length >= 2) {
|
||||
// performance command was used
|
||||
return handlePlayerInfoCommand(plugin, sender, args);
|
||||
result = handlePlayerInfoCommand(plugin, sender, args);
|
||||
}
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean handlePlayerInfoCommand(NoCheat plugin, CommandSender sender, String[] args) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user