Fixed error in /qop

This commit is contained in:
Jerome van der Sar 2012-09-16 14:29:40 +02:00
parent 89cfbbcef8
commit 8e0b7d94a8
2 changed files with 25 additions and 35 deletions

View File

@ -43,16 +43,16 @@ public class Command_gtfo extends TFM_Command
server.dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
}
//Deop
// deop
p.setOp(false);
//Set gamemode to survival:
// set gamemode to survival:
p.setGameMode(GameMode.SURVIVAL);
//Clear inventory:
// clear inventory:
p.getInventory().clear();
//Strike with lightning effect:
// strike with lightning effect:
final Location target_pos = p.getLocation();
for (int x = -1; x <= 1; x++)
{
@ -63,7 +63,7 @@ public class Command_gtfo extends TFM_Command
}
}
//Ban IP Address:
// ban IP address:
String user_ip = p.getAddress().getAddress().getHostAddress();
String[] ip_parts = user_ip.split("\\.");
if (ip_parts.length == 4)
@ -74,11 +74,11 @@ public class Command_gtfo extends TFM_Command
//server.banIP(user_ip);
TFM_Util.banIP(user_ip, null, null, null);
//Ban Username:
//server.getOfflinePlayer(p.getName()).setBanned(true);
// ban username:
// server.getOfflinePlayer(p.getName()).setBanned(true);
TFM_Util.banUsername(p.getName(), null, null, null);
//Kick Player:
// kick Player:
p.kickPlayer("GTFO");
}
else

View File

@ -16,36 +16,26 @@ public class Command_qop extends TFM_Command
return false;
}
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
if (!(senderIsConsole || sender.isOp()))
{
boolean matched_player = false;
for (Player p : server.matchPlayer(args[0]))
{
matched_player = true;
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
p.setOp(true);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
}
if (!matched_player)
{
for (Player p : server.getOnlinePlayers())
{
if (args[0].toLowerCase().startsWith(p.getDisplayName().toLowerCase()))
{
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
p.setOp(true);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
return true;
}
}
sender.sendMessage("No targets matched.");
}
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
else
boolean matched_player = false;
for (Player p : server.matchPlayer(args[0]))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
matched_player = true;
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
p.setOp(true);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
}
if (!matched_player)
{
sender.sendMessage("No targets matched.");
}
return true;