mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Fixed error in /qop
This commit is contained in:
parent
89cfbbcef8
commit
8e0b7d94a8
@ -43,16 +43,16 @@ public class Command_gtfo extends TFM_Command
|
|||||||
server.dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
|
server.dispatchCommand(sender, String.format("/undo %d %s", 15, p.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deop
|
// deop
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
|
|
||||||
//Set gamemode to survival:
|
// set gamemode to survival:
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
//Clear inventory:
|
// clear inventory:
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
|
|
||||||
//Strike with lightning effect:
|
// strike with lightning effect:
|
||||||
final Location target_pos = p.getLocation();
|
final Location target_pos = p.getLocation();
|
||||||
for (int x = -1; x <= 1; x++)
|
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 user_ip = p.getAddress().getAddress().getHostAddress();
|
||||||
String[] ip_parts = user_ip.split("\\.");
|
String[] ip_parts = user_ip.split("\\.");
|
||||||
if (ip_parts.length == 4)
|
if (ip_parts.length == 4)
|
||||||
@ -74,11 +74,11 @@ public class Command_gtfo extends TFM_Command
|
|||||||
//server.banIP(user_ip);
|
//server.banIP(user_ip);
|
||||||
TFM_Util.banIP(user_ip, null, null, null);
|
TFM_Util.banIP(user_ip, null, null, null);
|
||||||
|
|
||||||
//Ban Username:
|
// ban username:
|
||||||
//server.getOfflinePlayer(p.getName()).setBanned(true);
|
// server.getOfflinePlayer(p.getName()).setBanned(true);
|
||||||
TFM_Util.banUsername(p.getName(), null, null, null);
|
TFM_Util.banUsername(p.getName(), null, null, null);
|
||||||
|
|
||||||
//Kick Player:
|
// kick Player:
|
||||||
p.kickPlayer("GTFO");
|
p.kickPlayer("GTFO");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -16,9 +16,14 @@ public class Command_qop extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (!(senderIsConsole || sender.isOp()))
|
||||||
{
|
{
|
||||||
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
boolean matched_player = false;
|
boolean matched_player = false;
|
||||||
|
|
||||||
for (Player p : server.matchPlayer(args[0]))
|
for (Player p : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
matched_player = true;
|
matched_player = true;
|
||||||
@ -27,26 +32,11 @@ public class Command_qop extends TFM_Command
|
|||||||
p.setOp(true);
|
p.setOp(true);
|
||||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!matched_player)
|
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("No targets matched.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user