minor changes

This commit is contained in:
Jerom van der Sar 2012-11-21 17:03:00 +01:00
parent a696a8b23b
commit 477c8ffdd0
10 changed files with 22 additions and 39 deletions

View File

@ -43,6 +43,7 @@ public class Command_cage extends TFM_Command
{ {
if (TFM_Util.isStopCommand(args[1])) if (TFM_Util.isStopCommand(args[1]))
{ {
TFM_Util.adminAction(sender.getName(), "Uncaging " + p.getName(), true);
playerdata.setCaged(false); playerdata.setCaged(false);
playerdata.regenerateHistory(); playerdata.regenerateHistory();
playerdata.clearHistory(); playerdata.clearHistory();
@ -80,8 +81,7 @@ public class Command_cage extends TFM_Command
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER)); TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER));
p.setGameMode(GameMode.SURVIVAL); p.setGameMode(GameMode.SURVIVAL);
TFM_Util.adminAction(sender.getName(), "Caging " + p.getName(), true);
TFM_Util.bcastMsg(sender.getName() + " caged " + p.getName() + "!", ChatColor.YELLOW);
} }
else else
{ {

View File

@ -17,13 +17,7 @@ public class Command_fuckoff extends TFM_Command
return true; return true;
} }
if (!TFM_SuperadminList.isUserSuperadmin(sender)) if (!(TFM_SuperadminList.isUserSuperadmin(sender) || !TFM_SuperadminList.isSeniorAdmin(sender_p)))
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (!TFM_SuperadminList.isSeniorAdmin(sender_p))
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -34,7 +34,6 @@ public class Command_gadmin extends TFM_Command
if (mode.equals("list")) if (mode.equals("list"))
{ {
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s", sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
p.getName(),
ChatColor.stripColor(p.getDisplayName()), ChatColor.stripColor(p.getDisplayName()),
hash)); hash));
} }
@ -42,13 +41,14 @@ public class Command_gadmin extends TFM_Command
{ {
if (mode.equals("kick")) if (mode.equals("kick"))
{ {
TFM_Util.adminAction(sender.getName(), "Kicking " + p.getName(), true);
p.kickPlayer("Kicked by Administrator"); p.kickPlayer("Kicked by Administrator");
} }
else if (mode.equals("nameban")) else if (mode.equals("nameban"))
{ {
//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);
TFM_Util.bcastMsg(String.format("Banning Name: %s.", p.getName()), ChatColor.RED); TFM_Util.adminAction(sender.getName(), "Banning name: " + p.getName(), true);
p.kickPlayer("Username banned by Administrator."); p.kickPlayer("Username banned by Administrator.");
} }
else if (mode.equals("ipban")) else if (mode.equals("ipban"))
@ -59,7 +59,7 @@ public class Command_gadmin extends TFM_Command
{ {
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]); user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
} }
TFM_Util.bcastMsg(String.format("Banning IP: %s.", p.getName(), user_ip), ChatColor.RED); TFM_Util.adminAction(sender.getName(), "Banning name: " + p.getName(), true);
//server.banIP(user_ip); //server.banIP(user_ip);
TFM_Util.banIP(user_ip, null, null, null); TFM_Util.banIP(user_ip, null, null, null);
p.kickPlayer("IP address banned by Administrator."); p.kickPlayer("IP address banned by Administrator.");
@ -72,8 +72,7 @@ public class Command_gadmin extends TFM_Command
{ {
user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]); user_ip = String.format("%s.%s.*.*", ip_parts[0], ip_parts[1]);
} }
TFM_Util.bcastMsg(String.format("Banning Name: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED); TFM_Util.adminAction(sender.getName(), "Banning " + p.getName() + ", IP " + user_ip, true);
//server.banIP(user_ip);
//server.getOfflinePlayer(p.getName()).setBanned(true); //server.getOfflinePlayer(p.getName()).setBanned(true);
TFM_Util.banIP(user_ip, null, null, null); TFM_Util.banIP(user_ip, null, null, null);
TFM_Util.banUsername(p.getName(), null, null, null); TFM_Util.banUsername(p.getName(), null, null, null);
@ -81,13 +80,13 @@ public class Command_gadmin extends TFM_Command
} }
else if (mode.equals("op")) else if (mode.equals("op"))
{ {
TFM_Util.bcastMsg(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY); TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
p.setOp(false); p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_OP); p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
} }
else if (mode.equals("deop")) else if (mode.equals("deop"))
{ {
TFM_Util.bcastMsg(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY); TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
p.setOp(false); p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP); p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
} }
@ -100,7 +99,7 @@ public class Command_gadmin extends TFM_Command
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p); TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
playerdata.setFrozen(!playerdata.isFrozen()); playerdata.setFrozen(!playerdata.isFrozen());
sender.sendMessage(ChatColor.AQUA + p.getName() + " has been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + "."); TFM_Util.adminAction(sender.getName(), "Freezing " + p.getName(), false);
p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + "."); p.sendMessage(ChatColor.AQUA + "You have been " + (playerdata.isFrozen() ? "frozen" : "unfrozen") + ".");
} }

View File

@ -33,13 +33,13 @@ public class Command_list extends TFM_Command
{ {
if (TFM_SuperadminList.isUserSuperadmin(p)) if (TFM_SuperadminList.isUserSuperadmin(p))
{ {
if (p.isOp()) if(TFM_SuperadminList.isSeniorAdmin(p))
{ {
prefix = (ChatColor.GOLD + "[SA+OP]"); prefix = (ChatColor.GOLD + "[SenAdmin]");
} }
else else
{ {
prefix = (ChatColor.GOLD + "[SA]"); prefix = (ChatColor.RED + "[SupAdmin]");
} }
} }
else else

View File

@ -4,7 +4,6 @@ import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo; import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -42,7 +41,7 @@ public class Command_orbit extends TFM_Command
{ {
if (TFM_Util.isStopCommand(args[1])) if (TFM_Util.isStopCommand(args[1]))
{ {
sender.sendMessage(ChatColor.GRAY + "Stopped orbiting " + p.getName()); TFM_Util.adminAction(sender.getName(), "Stopping " + p.getName() + "'s Orbit", true);
playerdata.stopOrbiting(); playerdata.stopOrbiting();
return true; return true;
} }
@ -61,7 +60,7 @@ public class Command_orbit extends TFM_Command
p.setVelocity(new Vector(0, strength, 0)); p.setVelocity(new Vector(0, strength, 0));
sender.sendMessage(ChatColor.GRAY + "Orbiting " + p.getName()); TFM_Util.adminAction(sender.getName(), "Orbiting " + p.getName(), true);
} }
else else
{ {

View File

@ -55,10 +55,7 @@ public class Command_permban extends TFM_Command
else else
{ {
TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_players.size() + " permanently banned players:"); TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_players.size() + " permanently banned players:");
for (String player_name : TotalFreedomMod.permbanned_players) TFM_Util.playerMsg(sender, ChatColor.GRAY + TFM_Util.implodeStringList(", ", TotalFreedomMod.permbanned_players));
{
TFM_Util.playerMsg(sender, "- " + player_name);
}
} }
if (TotalFreedomMod.permbanned_ips.isEmpty()) if (TotalFreedomMod.permbanned_ips.isEmpty())
@ -68,10 +65,7 @@ public class Command_permban extends TFM_Command
else else
{ {
TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_ips.size() + " permanently banned IPs:"); TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_ips.size() + " permanently banned IPs:");
for (String ip_address : TotalFreedomMod.permbanned_ips) TFM_Util.playerMsg(sender, ChatColor.GRAY + TFM_Util.implodeStringList(", ", TotalFreedomMod.permbanned_ips));
{
TFM_Util.playerMsg(sender, "- " + ip_address);
}
} }
} }
} }

View File

@ -27,7 +27,7 @@ public class Command_rank extends TFM_Command
if (args.length == 0) if (args.length == 0)
{ {
TFM_Util.playerMsg(sender, sender.getName() + " is " + TFM_Util.getRank(sender), ChatColor.AQUA); TFM_Util.bcastMsg(sender.getName() + " is " + TFM_Util.getRank(sender), ChatColor.AQUA);
return true; return true;
} }

View File

@ -20,6 +20,7 @@ public class Command_rd extends TFM_Command
} }
// This terminology is wrong, this doesn't remove *all* entities, by far. - Madgeek // This terminology is wrong, this doesn't remove *all* entities, by far. - Madgeek
// Back when I was just a player, I didn't even know what "entity" meant... :P - Darth
TFM_Util.adminAction(sender.getName(), "Removing all server entities.", false); TFM_Util.adminAction(sender.getName(), "Removing all server entities.", false);
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true, true)) + " enties removed."); sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true, true)) + " enties removed.");

View File

@ -15,7 +15,7 @@ public class Command_stop extends TFM_Command
{ {
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)) if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
{ {
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY); TFM_Util.bcastMsg("Server is going offline!", ChatColor.LIGHT_PURPLE);
for (Player p : server.getOnlinePlayers()) for (Player p : server.getOnlinePlayers())
{ {

View File

@ -68,19 +68,16 @@ public class TFM_Util
TFM_Util.bcastMsg(message, null); TFM_Util.bcastMsg(message, null);
} }
//JeromSar
public static void playerMsg(CommandSender sender, String message, ChatColor color) public static void playerMsg(CommandSender sender, String message, ChatColor color)
{ {
sender.sendMessage(color + message); sender.sendMessage(color + message);
} }
//JeromSar
public static void playerMsg(CommandSender sender, String message) public static void playerMsg(CommandSender sender, String message)
{ {
TFM_Util.playerMsg(sender, message, ChatColor.GRAY); TFM_Util.playerMsg(sender, message, ChatColor.GRAY);
} }
//JeromSar
public static void adminAction(String adminName, String action, boolean isRed) public static void adminAction(String adminName, String action, boolean isRed)
{ {
TFM_Util.bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA)); TFM_Util.bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA));
@ -544,7 +541,6 @@ public class TFM_Util
return TFM_SuperadminList.isSuperadminImpostor(user); return TFM_SuperadminList.isSuperadminImpostor(user);
} }
//JeromSar
public static String getRank(CommandSender sender) public static String getRank(CommandSender sender)
{ {
if (TFM_SuperadminList.isSuperadminImpostor(sender)) if (TFM_SuperadminList.isSuperadminImpostor(sender))
@ -574,7 +570,7 @@ public class TFM_Util
} }
else else
{ {
return "an " + ChatColor.RED + "admin" + ChatColor.AQUA + "."; return "a " + ChatColor.RED + "super admin" + ChatColor.AQUA + ".";
} }
} }
} }