2011-10-19 00:37:00 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
|
|
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2012-11-24 01:22:52 +00:00
|
|
|
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, ignore_permissions = false)
|
2011-10-19 00:37:00 +00:00
|
|
|
public class Command_qdeop extends TFM_Command
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2012-11-03 01:03:12 +00:00
|
|
|
if (args.length < 1)
|
2011-10-19 00:37:00 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2012-12-01 19:43:03 +00:00
|
|
|
|
2012-11-03 01:03:12 +00:00
|
|
|
boolean silent = false;
|
|
|
|
if (args.length == 2)
|
|
|
|
{
|
|
|
|
silent = args[1].equalsIgnoreCase("-s");
|
|
|
|
}
|
|
|
|
|
2012-09-16 17:41:41 +00:00
|
|
|
boolean matched_player = false;
|
|
|
|
|
|
|
|
String target_name = args[0].toLowerCase();
|
|
|
|
|
|
|
|
for (Player p : server.getOnlinePlayers())
|
|
|
|
{
|
2012-09-17 22:35:22 +00:00
|
|
|
if (p.getName().toLowerCase().indexOf(target_name) != -1 || p.getDisplayName().toLowerCase().indexOf(target_name) != -1)
|
2011-10-19 00:37:00 +00:00
|
|
|
{
|
|
|
|
matched_player = true;
|
|
|
|
|
2012-11-03 01:03:12 +00:00
|
|
|
if (!silent)
|
|
|
|
{
|
|
|
|
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
|
|
|
|
}
|
2011-10-19 00:37:00 +00:00
|
|
|
p.setOp(false);
|
|
|
|
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
|
|
|
}
|
|
|
|
}
|
2012-09-16 17:41:41 +00:00
|
|
|
|
|
|
|
if (!matched_player)
|
2011-10-19 00:37:00 +00:00
|
|
|
{
|
2012-09-16 17:41:41 +00:00
|
|
|
TFM_Util.playerMsg(sender, "No targets matched.");
|
2011-10-19 00:37:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|