Add tab completion for CheckType.

This commit is contained in:
asofold 2012-11-07 07:03:35 +01:00
parent ae5427e01d
commit 28afa77c74
3 changed files with 30 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package fr.neatmonster.nocheatplus.command.admin;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@ -9,6 +10,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.command.CommandUtil;
import fr.neatmonster.nocheatplus.command.NCPCommand;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.permissions.Permissions;
@ -48,5 +50,13 @@ public class ExemptCommand extends NCPCommand {
sender.sendMessage(TAG + "Player " + playerName + " is now exempted from: " + checkType);
return true;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args)
{
// At least complete CheckType
if (args.length == 3) return CommandUtil.getCheckTypeTabMatches(args[2]);
return null;
}
}

View File

@ -1,6 +1,7 @@
package fr.neatmonster.nocheatplus.command.admin;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@ -10,6 +11,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.ViolationHistory;
import fr.neatmonster.nocheatplus.command.CommandUtil;
import fr.neatmonster.nocheatplus.command.NCPCommand;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.players.DataManager;
@ -75,4 +77,12 @@ public class RemovePlayerCommand extends NCPCommand {
return true;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args)
{
// At least complete CheckType
if (args.length == 3) return CommandUtil.getCheckTypeTabMatches(args[2]);
return null;
}
}

View File

@ -1,6 +1,7 @@
package fr.neatmonster.nocheatplus.command.admin;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
@ -9,6 +10,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.command.CommandUtil;
import fr.neatmonster.nocheatplus.command.NCPCommand;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.permissions.Permissions;
@ -43,5 +45,13 @@ public class UnexemptCommand extends NCPCommand {
sender.sendMessage(TAG + "Player " + playerName + " will not be exempted from: " + checkType);
return true;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args)
{
// At least complete CheckType
if (args.length == 3) return CommandUtil.getCheckTypeTabMatches(args[2]);
return null;
}
}