[Bleeding] Switched to UUIDs in TFM_AdminList

Various other changes
This commit is contained in:
unknown 2014-04-09 22:33:03 +02:00
parent ec8a528564
commit a54c113a86
42 changed files with 317 additions and 326 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Wed Apr 09 20:26:09 CEST 2014 #Wed Apr 09 22:31:37 CEST 2014
build.number=712 build.number=713

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -31,7 +31,7 @@ public class Command_adminmode extends TFM_Command
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true); TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
player.kickPlayer("Server is now closed to non-superadmins."); player.kickPlayer("Server is now closed to non-superadmins.");
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld; import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.World; import org.bukkit.World;
@ -217,7 +217,7 @@ public class Command_adminworld extends TFM_Command
private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException private void assertCommandPerms(CommandSender sender, Player sender_p) throws PermissionDeniedException
{ {
if (!(sender instanceof Player) || sender_p == null || !TFM_SuperadminList.isSuperAdmin(sender)) if (!(sender instanceof Player) || sender_p == null || !TFM_AdminList.isSuperAdmin(sender))
{ {
throw new PermissionDeniedException(TotalFreedomMod.MSG_NO_PERMS); throw new PermissionDeniedException(TotalFreedomMod.MSG_NO_PERMS);
} }

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -47,7 +47,7 @@ public class Command_blockcmd extends TFM_Command
return true; return true;
} }
if (TFM_SuperadminList.isSuperAdmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked."); playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Minecart; import org.bukkit.entity.Minecart;
@ -36,7 +36,7 @@ public class Command_cartsit extends TFM_Command
return true; return true;
} }
} }
else if (targetPlayer != sender_p && !TFM_SuperadminList.isSuperAdmin(sender)) else if (targetPlayer != sender_p && !TFM_AdminList.isSuperAdmin(sender))
{ {
sender.sendMessage("Only superadmins can select another player as a /cartsit target."); sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.GameMode; import org.bukkit.GameMode;
@ -33,7 +33,7 @@ public class Command_creative extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("-a")) if (args[0].equalsIgnoreCase("-a"))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -48,7 +48,7 @@ public class Command_creative extends TFM_Command
return true; return true;
} }
if (!(senderIsConsole || TFM_SuperadminList.isSuperAdmin(sender))) if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
{ {
playerMsg("Only superadmins can change other user's gamemode."); playerMsg("Only superadmins can change other user's gamemode.");
return true; return true;

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -39,10 +39,10 @@ public class Command_doom extends TFM_Command
final String IP = player.getAddress().getAddress().getHostAddress().trim(); final String IP = player.getAddress().getAddress().getHostAddress().trim();
// remove from superadmin // remove from superadmin
if (TFM_SuperadminList.isSuperAdmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true); TFM_Util.adminAction(sender.getName(), "Removing " + player.getName() + " from the superadmin list.", true);
TFM_SuperadminList.removeSuperadmin(player); TFM_AdminList.removeSuperadmin(player);
} }
// remove from whitelist // remove from whitelist

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.ChatColor;
@ -44,7 +44,7 @@ public class Command_fr extends TFM_Command
playerMsg("Players are now frozen."); playerMsg("Players are now frozen.");
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
TFM_Util.playerMsg(player, "You have been frozen due to rule breaker(s), you will be unfrozen very soon.", ChatColor.RED); TFM_Util.playerMsg(player, "You have been frozen due to rule breaker(s), you will be unfrozen very soon.", ChatColor.RED);
} }

View File

@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList; import me.StevenLawson.TotalFreedomMod.TFM_PlayerList;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerList.PlayerEntry; import me.StevenLawson.TotalFreedomMod.TFM_PlayerList.PlayerEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
@ -29,7 +29,7 @@ public class Command_glist extends TFM_Command
if (args[0].equalsIgnoreCase("purge")) if (args[0].equalsIgnoreCase("purge"))
{ {
//Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database! //Purge does not clear the banlist! This is not for clearing bans! This is for clearing the yaml file that stores the player/IP database!
if (TFM_SuperadminList.isSeniorAdmin(sender)) if (TFM_AdminList.isSeniorAdmin(sender))
{ {
TFM_PlayerList.getInstance().purgeAll(); TFM_PlayerList.getInstance().purgeAll();
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -25,7 +25,7 @@ public class Command_halt extends TFM_Command
int counter = 0; int counter = 0;
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
TFM_PlayerData.getPlayerData(player).setHalted(true); TFM_PlayerData.getPlayerData(player).setHalted(true);
counter++; counter++;

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -38,7 +38,7 @@ public class Command_invis extends TFM_Command
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) if (player.hasPotionEffect(PotionEffectType.INVISIBILITY))
{ {
players.add(player.getName()); players.add(player.getName());
if (smite && !TFM_SuperadminList.isSuperAdmin(player)) if (smite && !TFM_AdminList.isSuperAdmin(player))
{ {
TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true); TFM_Util.adminAction(sender.getName(), "Smiting all invisible players", true);
player.setHealth(0.0); player.setHealth(0.0);

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -18,7 +18,7 @@ public class Command_kicknoob extends TFM_Command
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
player.kickPlayer(ChatColor.RED + "Disconnected by admin."); player.kickPlayer(ChatColor.RED + "Disconnected by admin.");
} }

View File

@ -5,7 +5,7 @@ import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank; import me.StevenLawson.TotalFreedomMod.TFM_PlayerRank;
import me.StevenLawson.TotalFreedomMod.TFM_Admin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -55,7 +55,7 @@ public class Command_list extends TFM_Command
final List<String> names = new ArrayList<String>(); final List<String> names = new ArrayList<String>();
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
final boolean userSuperadmin = TFM_SuperadminList.isSuperAdmin(player); final boolean userSuperadmin = TFM_AdminList.isSuperAdmin(player);
if (listFilter == Command_list.ListFilter.ADMINS && !userSuperadmin) if (listFilter == Command_list.ListFilter.ADMINS && !userSuperadmin)
{ {

View File

@ -113,7 +113,7 @@ public class Command_logs extends TFM_Command
{ {
for (String ip : superadmin.getIps()) for (String ip : superadmin.getIps())
{ {
updateLogsRegistration(null, superadmin.getName(), ip, Command_logs.LogsRegistrationMode.DELETE); updateLogsRegistration(null, superadmin.getLastLoginName(), ip, Command_logs.LogsRegistrationMode.DELETE);
} }
} }

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.ChatColor;
@ -26,7 +26,7 @@ public class Command_onlinemode extends TFM_Command
{ {
boolean online_mode; boolean online_mode;
if (sender instanceof Player && !TFM_SuperadminList.isSeniorAdmin(sender, true)) if (sender instanceof Player && !TFM_AdminList.isSeniorAdmin(sender, true))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -38,7 +38,7 @@ public class Command_op extends TFM_Command
// if the player is not online // if the player is not online
if (player == null) if (player == null)
{ {
if (TFM_SuperadminList.isSuperAdmin(sender) || senderIsConsole) if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
{ {
player = server.getOfflinePlayer(args[0]); player = server.getOfflinePlayer(args[0]);
} }

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
@ -38,7 +38,7 @@ public class Command_potion extends TFM_Command
} }
else if (args[0].equalsIgnoreCase("clearall")) else if (args[0].equalsIgnoreCase("clearall"))
{ {
if (!(TFM_SuperadminList.isSuperAdmin(sender) || senderIsConsole)) if (!(TFM_AdminList.isSuperAdmin(sender) || senderIsConsole))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -71,7 +71,7 @@ public class Command_potion extends TFM_Command
if (!target.equals(sender_p)) if (!target.equals(sender_p))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
playerMsg("Only superadmins can clear potion effects from other players."); playerMsg("Only superadmins can clear potion effects from other players.");
return true; return true;
@ -116,7 +116,7 @@ public class Command_potion extends TFM_Command
if (!target.equals(sender_p)) if (!target.equals(sender_p))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
sender.sendMessage("Only superadmins can apply potion effects to other players."); sender.sendMessage("Only superadmins can apply potion effects to other players.");
return true; return true;

View File

@ -2,11 +2,12 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Admin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler; import me.StevenLawson.TotalFreedomMod.TFM_TwitterHandler;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import net.minecraft.util.org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -23,11 +24,11 @@ public class Command_saconfig extends TFM_Command
{ {
if (args[0].equals("list")) if (args[0].equals("list"))
{ {
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminUUIDs(), ", "), ChatColor.GOLD); playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminUUIDs(), ", "), ChatColor.GOLD);
} }
else else
{ {
if (!TFM_SuperadminList.isSeniorAdmin(sender, true)) if (!TFM_AdminList.isSeniorAdmin(sender, true))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -36,8 +37,8 @@ public class Command_saconfig extends TFM_Command
if (args[0].equals("clean")) if (args[0].equals("clean"))
{ {
TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true); TFM_Util.adminAction(sender.getName(), "Cleaning superadmin list", true);
TFM_SuperadminList.cleanSuperadminList(true); TFM_AdminList.cleanSuperadminList(true);
playerMsg("Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminUUIDs(), ", "), ChatColor.YELLOW); playerMsg("Superadmins: " + StringUtils.join(TFM_AdminList.getSuperadminUUIDs(), ", "), ChatColor.YELLOW);
} }
else else
{ {
@ -53,19 +54,19 @@ public class Command_saconfig extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("info")) if (args[0].equalsIgnoreCase("info"))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
} }
TFM_Admin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase()); TFM_Admin superadmin = TFM_AdminList.getAdminEntry(args[1].toLowerCase());
if (superadmin == null) if (superadmin == null)
{ {
try try
{ {
superadmin = TFM_SuperadminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase()); superadmin = TFM_AdminList.getAdminEntry(getPlayer(args[1]).getName().toLowerCase());
} }
catch (PlayerNotFoundException ex) catch (PlayerNotFoundException ex)
{ {
@ -93,7 +94,7 @@ public class Command_saconfig extends TFM_Command
if (args[0].equalsIgnoreCase("add")) if (args[0].equalsIgnoreCase("add"))
{ {
Player player = null; Player player = null;
String admin_name = null; String playername = null;
try try
{ {
@ -101,10 +102,10 @@ public class Command_saconfig extends TFM_Command
} }
catch (PlayerNotFoundException ex) catch (PlayerNotFoundException ex)
{ {
TFM_Admin superadmin = TFM_SuperadminList.getAdminEntry(args[1].toLowerCase()); TFM_Admin superadmin = TFM_AdminList.getAdminEntry(args[1].toLowerCase());
if (superadmin != null) if (superadmin != null)
{ {
admin_name = superadmin.getName(); playername = superadmin.getLastLoginName();
} }
else else
{ {
@ -116,17 +117,17 @@ public class Command_saconfig extends TFM_Command
if (player != null) if (player != null)
{ {
TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true); TFM_Util.adminAction(sender.getName(), "Adding " + player.getName() + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(player); TFM_AdminList.addSuperadmin(player);
} }
else if (admin_name != null) else if (playername != null)
{ {
TFM_Util.adminAction(sender.getName(), "Adding " + admin_name + " to the superadmin list.", true); TFM_Util.adminAction(sender.getName(), "Adding " + playername + " to the superadmin list.", true);
TFM_SuperadminList.addSuperadmin(admin_name); TFM_AdminList.addSuperadmin(player);
} }
} }
else if (TFM_Util.isRemoveCommand(args[0])) else if (TFM_Util.isRemoveCommand(args[0]))
{ {
if (!TFM_SuperadminList.isSeniorAdmin(sender)) if (!TFM_AdminList.isSeniorAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -142,14 +143,14 @@ public class Command_saconfig extends TFM_Command
{ {
} }
if (!TFM_SuperadminList.getSuperadminUUIDs().contains(targetName.toLowerCase())) if (!TFM_AdminList.getSuperadminUUIDs().contains(targetName.toLowerCase()))
{ {
playerMsg("Superadmin not found: " + targetName); playerMsg("Superadmin not found: " + targetName);
return true; return true;
} }
TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true); TFM_Util.adminAction(sender.getName(), "Removing " + targetName + " from the superadmin list", true);
TFM_SuperadminList.removeSuperadmin(targetName); TFM_AdminList.removeSuperadmin(Bukkit.getOfflinePlayer(targetName));
// Twitterbot // Twitterbot
if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean()) if (TFM_ConfigEntry.TWITTERBOT_ENABLED.getBoolean())

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.command.Command; import org.bukkit.command.Command;
@ -68,7 +68,7 @@ public class Command_stfu extends TFM_Command
int counter = 0; int counter = 0;
for (Player player : server.getOnlinePlayers()) for (Player player : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
playerdata = TFM_PlayerData.getPlayerData(player); playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setMuted(true); playerdata.setMuted(true);
@ -118,7 +118,7 @@ public class Command_stfu extends TFM_Command
} }
else else
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true); TFM_Util.adminAction(sender.getName(), "Muting " + player.getName(), true);
playerdata.setMuted(true); playerdata.setMuted(true);

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.ChatColor;
@ -35,7 +35,7 @@ public class Command_survival extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("-a")) if (args[0].equalsIgnoreCase("-a"))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender) || senderIsConsole) if (!TFM_AdminList.isSuperAdmin(sender) || senderIsConsole)
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -50,7 +50,7 @@ public class Command_survival extends TFM_Command
return true; return true;
} }
if (senderIsConsole || TFM_SuperadminList.isSuperAdmin(sender)) if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{ {
try try
{ {

View File

@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.ChatColor;
@ -27,7 +27,7 @@ public class Command_tag extends TFM_Command
{ {
if ("clearall".equals(args[0])) if ("clearall".equals(args[0]))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;
@ -69,7 +69,7 @@ public class Command_tag extends TFM_Command
return true; return true;
} }
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
for (String word : FORBIDDEN_WORDS) for (String word : FORBIDDEN_WORDS)
{ {
@ -98,7 +98,7 @@ public class Command_tag extends TFM_Command
{ {
if ("clear".equals(args[0])) if ("clear".equals(args[0]))
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
playerMsg(TotalFreedomMod.MSG_NO_PERMS); playerMsg(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -21,7 +21,7 @@ public class Command_tfbanlist extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("purge")) if (args[0].equalsIgnoreCase("purge"))
{ {
if (senderIsConsole || TFM_SuperadminList.isSuperAdmin(sender)) if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{ {
try try
{ {

View File

@ -5,7 +5,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -22,7 +22,7 @@ public class Command_tfipbanlist extends TFM_Command
{ {
if (args[0].equalsIgnoreCase("purge")) if (args[0].equalsIgnoreCase("purge"))
{ {
if (senderIsConsole || TFM_SuperadminList.isSuperAdmin(sender)) if (senderIsConsole || TFM_AdminList.isSuperAdmin(sender))
{ {
try try
{ {

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface; import me.StevenLawson.TotalFreedomMod.TFM_ServerInterface;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -56,7 +56,7 @@ public class Command_whitelist extends TFM_Command
} }
// all commands past this line are superadmin-only // all commands past this line are superadmin-only
if (!(senderIsConsole || TFM_SuperadminList.isSuperAdmin(sender))) if (!(senderIsConsole || TFM_AdminList.isSuperAdmin(sender)))
{ {
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true; return true;

View File

@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import net.minecraft.util.org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -57,7 +57,7 @@ public class Command_whohas extends TFM_Command
if (player.getInventory().contains(material)) if (player.getInventory().contains(material))
{ {
players.add(player.getName()); players.add(player.getName());
if (smite & !TFM_SuperadminList.isSuperAdmin(player)) if (smite & !TFM_AdminList.isSuperAdmin(player))
{ {
Command_smite.smite(player); Command_smite.smite(player);
} }

View File

@ -3,7 +3,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.List; import java.util.List;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.ChatColor;
@ -62,11 +62,11 @@ public abstract class TFM_Command
CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class); CommandPermissions permissions = commandClass.getAnnotation(CommandPermissions.class);
if (permissions != null) if (permissions != null)
{ {
boolean is_super = TFM_SuperadminList.isSuperAdmin(this.commandSender); boolean is_super = TFM_AdminList.isSuperAdmin(this.commandSender);
boolean is_senior = false; boolean is_senior = false;
if (is_super) if (is_super)
{ {
is_senior = TFM_SuperadminList.isSeniorAdmin(this.commandSender); is_senior = TFM_AdminList.isSeniorAdmin(this.commandSender);
} }
AdminLevel level = permissions.level(); AdminLevel level = permissions.level();

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.HTTPD; package me.StevenLawson.TotalFreedomMod.HTTPD;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -26,9 +26,9 @@ public class Module_list extends TFM_HTTPD_Module
for (Player player : onlinePlayers) for (Player player : onlinePlayers)
{ {
String prefix = ""; String prefix = "";
if (TFM_SuperadminList.isSuperAdmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
if (TFM_SuperadminList.isSeniorAdmin(player)) if (TFM_AdminList.isSeniorAdmin(player))
{ {
prefix = "[SrA]"; prefix = "[SrA]";
} }

View File

@ -1,6 +1,7 @@
package me.StevenLawson.TotalFreedomMod.HTTPD; package me.StevenLawson.TotalFreedomMod.HTTPD;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import java.util.UUID;
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
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.Bukkit; import org.bukkit.Bukkit;
@ -34,14 +35,14 @@ public class Module_players extends TFM_HTTPD_Module
} }
// Super admins (non-telnet and non-senior) // Super admins (non-telnet and non-senior)
for (String superadmin : TFM_SuperadminList.getSuperadminUUIDs()) for (UUID superadmin : TFM_AdminList.getSuperadminUUIDs())
{ {
if (TFM_SuperadminList.getSenioradminUUIDs().contains(superadmin)) if (TFM_AdminList.getSenioradminUUIDs().contains(superadmin))
{ {
continue; continue;
} }
if (TFM_SuperadminList.getTelnetadminUUIDs().contains(superadmin)) if (TFM_AdminList.getTelnetadminUUIDs().contains(superadmin))
{ {
continue; continue;
} }
@ -50,9 +51,9 @@ public class Module_players extends TFM_HTTPD_Module
} }
// Telnet admins (non-senior) // Telnet admins (non-senior)
for (String telnetadmin : TFM_SuperadminList.getTelnetadminUUIDs()) for (UUID telnetadmin : TFM_AdminList.getTelnetadminUUIDs())
{ {
if (TFM_SuperadminList.getSenioradminUUIDs().contains(telnetadmin)) if (TFM_AdminList.getSenioradminUUIDs().contains(telnetadmin))
{ {
continue; continue;
} }
@ -60,7 +61,7 @@ public class Module_players extends TFM_HTTPD_Module
} }
// Senior admins // Senior admins
for (String senioradmin : TFM_SuperadminList.getSenioradminUUIDs()) for (UUID senioradmin : TFM_AdminList.getSenioradminUUIDs())
{ {
senioradmins.add(getName(senioradmin)); senioradmins.add(getName(senioradmin));
} }
@ -79,16 +80,8 @@ public class Module_players extends TFM_HTTPD_Module
return response; return response;
} }
private String getName(String caseInsensitiveName) private String getName(UUID uuid)
{ {
final OfflinePlayer player = Bukkit.getOfflinePlayer(caseInsensitiveName); return TFM_AdminList.getAdminEntry(uuid).getLastLoginName();
if (player == null)
{
return caseInsensitiveName;
}
else
{
return player.getName();
}
} }
} }

View File

@ -13,7 +13,7 @@ import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Method;
import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response; import me.StevenLawson.TotalFreedomMod.HTTPD.NanoHTTPD.Response;
import me.StevenLawson.TotalFreedomMod.TFM_Log; import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Admin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import net.minecraft.util.org.apache.commons.io.FileUtils; import net.minecraft.util.org.apache.commons.io.FileUtils;
import net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils; import net.minecraft.util.org.apache.commons.lang3.StringEscapeUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils; import net.minecraft.util.org.apache.commons.lang3.StringUtils;
@ -223,7 +223,7 @@ public class Module_schematic extends TFM_HTTPD_Module
private boolean isAuthorized(String remoteAddress) private boolean isAuthorized(String remoteAddress)
{ {
TFM_Admin entry = TFM_SuperadminList.getAdminEntryByIP(remoteAddress); TFM_Admin entry = TFM_AdminList.getAdminEntryByIP(remoteAddress);
return entry != null && entry.isActivated(); return entry != null && entry.isActivated();
} }

View File

@ -91,7 +91,7 @@ public class TFM_BlockListener implements Listener
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
if (TFM_ProtectedArea.isInProtectedArea(blockLocation)) if (TFM_ProtectedArea.isInProtectedArea(blockLocation))
{ {
@ -161,7 +161,7 @@ public class TFM_BlockListener implements Listener
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
if (TFM_ProtectedArea.isInProtectedArea(blockLocation)) if (TFM_ProtectedArea.isInProtectedArea(blockLocation))
{ {
@ -249,7 +249,7 @@ public class TFM_BlockListener implements Listener
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockBreak(BlockBreakEvent event) public void onRollbackBlockBreak(BlockBreakEvent event)
{ {
if (!TFM_SuperadminList.isSuperAdmin(event.getPlayer())) if (!TFM_AdminList.isSuperAdmin(event.getPlayer()))
{ {
TFM_RollbackManager.blockBreak(event); TFM_RollbackManager.blockBreak(event);
} }
@ -258,7 +258,7 @@ public class TFM_BlockListener implements Listener
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onRollbackBlockPlace(BlockPlaceEvent event) public void onRollbackBlockPlace(BlockPlaceEvent event)
{ {
if (!TFM_SuperadminList.isSuperAdmin(event.getPlayer())) if (!TFM_AdminList.isSuperAdmin(event.getPlayer()))
{ {
TFM_RollbackManager.blockPlace(event); TFM_RollbackManager.blockPlace(event);
} }

View File

@ -97,7 +97,7 @@ public class TFM_PlayerListener implements Listener
{ {
case STICK: case STICK:
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
break; break;
} }
@ -167,7 +167,7 @@ public class TFM_PlayerListener implements Listener
break; break;
} }
if (!TFM_SuperadminList.isSeniorAdmin(player, true)) if (!TFM_AdminList.isSeniorAdmin(player, true))
{ {
break; break;
} }
@ -203,7 +203,7 @@ public class TFM_PlayerListener implements Listener
break; break;
} }
if (!TFM_SuperadminList.isSeniorAdmin(player, true)) if (!TFM_AdminList.isSeniorAdmin(player, true))
{ {
break; break;
} }
@ -331,7 +331,7 @@ public class TFM_PlayerListener implements Listener
boolean freeze = false; boolean freeze = false;
if (TotalFreedomMod.allPlayersFrozen) if (TotalFreedomMod.allPlayersFrozen)
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
freeze = true; freeze = true;
} }
@ -490,7 +490,7 @@ public class TFM_PlayerListener implements Listener
// Check for muted // Check for muted
if (playerdata.isMuted()) if (playerdata.isMuted())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
player.sendMessage(ChatColor.RED + "You are muted, STFU!"); player.sendMessage(ChatColor.RED + "You are muted, STFU!");
event.setCancelled(true); event.setCancelled(true);
@ -583,7 +583,7 @@ public class TFM_PlayerListener implements Listener
// Block commands if player is muted // Block commands if player is muted
if (playerdata.isMuted()) if (playerdata.isMuted())
{ {
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
for (String commandName : BLOCKED_MUTED_CMDS) for (String commandName : BLOCKED_MUTED_CMDS)
{ {
@ -615,11 +615,11 @@ public class TFM_PlayerListener implements Listener
event.setCancelled(true); event.setCancelled(true);
} }
if (!TFM_SuperadminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
for (Player pl : Bukkit.getOnlinePlayers()) for (Player pl : Bukkit.getOnlinePlayers())
{ {
if (TFM_SuperadminList.isSuperAdmin(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled()) if (TFM_AdminList.isSuperAdmin(pl) && TFM_PlayerData.getPlayerData(pl).cmdspyEnabled())
{ {
TFM_Util.playerMsg(pl, player.getName() + ": " + command); TFM_Util.playerMsg(pl, player.getName() + ": " + command);
} }
@ -709,9 +709,9 @@ public class TFM_PlayerListener implements Listener
final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
playerdata.setSuperadminIdVerified(null); playerdata.setSuperadminIdVerified(null);
final boolean impostor = TFM_SuperadminList.isSuperadminImpostor(player); final boolean impostor = TFM_AdminList.isAdminImpostor(player);
if (impostor || TFM_SuperadminList.isSuperAdmin(player)) if (impostor || TFM_AdminList.isSuperAdmin(player))
{ {
TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player)); TFM_Util.bcastMsg(ChatColor.AQUA + player.getName() + " is " + TFM_PlayerRank.getLoginMessage(player));
@ -724,11 +724,11 @@ public class TFM_PlayerListener implements Listener
} }
else else
{ {
if (TFM_SuperadminList.verifyIdentity(player.getName(), TFM_Util.getIp(player))) if (TFM_AdminList.verifyIdentity(player.getName(), TFM_Util.getIp(player)))
{ {
playerdata.setSuperadminIdVerified(Boolean.TRUE); playerdata.setSuperadminIdVerified(Boolean.TRUE);
TFM_SuperadminList.updateLastLogin(player); TFM_AdminList.updateLastLogin(player);
} }
else else
{ {

View File

@ -4,7 +4,7 @@ import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent;
import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent; import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent;
import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker; import me.StevenLawson.TotalFreedomMod.TFM_CommandBlocker;
import me.StevenLawson.TotalFreedomMod.TFM_Admin; import me.StevenLawson.TotalFreedomMod.TFM_Admin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -23,7 +23,7 @@ public class TFM_TelnetListener implements Listener
return; return;
} }
final TFM_Admin admin = TFM_SuperadminList.getAdminEntryByIP(ip, true); final TFM_Admin admin = TFM_AdminList.getAdminEntryByIP(ip, true);
if (admin == null || !(admin.isTelnetAdmin() || admin.isSeniorAdmin())) if (admin == null || !(admin.isTelnetAdmin() || admin.isSeniorAdmin()))
{ {
@ -31,9 +31,9 @@ public class TFM_TelnetListener implements Listener
} }
event.setBypassPassword(true); event.setBypassPassword(true);
event.setName(admin.getName()); event.setName(admin.getLastLoginName());
final OfflinePlayer player = Bukkit.getOfflinePlayer(admin.getName()); final OfflinePlayer player = Bukkit.getOfflinePlayer(admin.getLastLoginName());
if (player == null) if (player == null)
{ {
return; return;

View File

@ -3,12 +3,14 @@ package me.StevenLawson.TotalFreedomMod;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import net.minecraft.util.org.apache.commons.lang3.StringUtils; import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
public class TFM_Admin public class TFM_Admin
{ {
private final String name; private final UUID uuid;
private String lastLoginName;
private final String loginMessage; private final String loginMessage;
private final boolean isSeniorAdmin; private final boolean isSeniorAdmin;
private final boolean isTelnetAdmin; private final boolean isTelnetAdmin;
@ -17,9 +19,10 @@ public class TFM_Admin
private Date lastLogin; private Date lastLogin;
private boolean isActivated; private boolean isActivated;
public TFM_Admin(String name, List<String> ips, Date lastLogin, String loginMessage, boolean isSeniorAdmin, boolean isTelnetAdmin, List<String> consoleAliases, boolean isActivated) public TFM_Admin(UUID uuid, String lastLoginName, List<String> ips, Date lastLogin, String loginMessage, boolean isSeniorAdmin, boolean isTelnetAdmin, List<String> consoleAliases, boolean isActivated)
{ {
this.name = name.toLowerCase(); this.uuid = uuid;
this.lastLoginName = lastLoginName;
this.ips = ips; this.ips = ips;
this.lastLogin = lastLogin; this.lastLogin = lastLogin;
this.loginMessage = loginMessage; this.loginMessage = loginMessage;
@ -29,9 +32,10 @@ public class TFM_Admin
this.isActivated = isActivated; this.isActivated = isActivated;
} }
public TFM_Admin(String name, ConfigurationSection section) public TFM_Admin(UUID uuid, ConfigurationSection section)
{ {
this.name = name.toLowerCase(); this.uuid = uuid;
this.lastLoginName = section.getString("last_login_name");
this.ips = section.getStringList("ips"); this.ips = section.getStringList("ips");
this.lastLogin = TFM_Util.stringToDate(section.getString("last_login", TFM_Util.dateToString(new Date(0L)))); this.lastLogin = TFM_Util.stringToDate(section.getString("last_login", TFM_Util.dateToString(new Date(0L))));
this.loginMessage = section.getString("custom_login_message", ""); this.loginMessage = section.getString("custom_login_message", "");
@ -44,30 +48,34 @@ public class TFM_Admin
@Override @Override
public String toString() public String toString()
{ {
StringBuilder output = new StringBuilder(); final StringBuilder output = new StringBuilder();
try output.append("UUID: ").append(uuid.toString()).append("\n");
{ output.append("- Last Login Name: ").append(lastLoginName).append("\n");
output.append("Name: ").append(this.name).append("\n"); output.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n");
output.append("- IPs: ").append(StringUtils.join(this.ips, ", ")).append("\n"); output.append("- Last Login: ").append(TFM_Util.dateToString(lastLogin)).append("\n");
output.append("- Last Login: ").append(TFM_Util.dateToString(this.lastLogin)).append("\n"); output.append("- Custom Login Message: ").append(loginMessage).append("\n");
output.append("- Custom Login Message: ").append(this.loginMessage).append("\n"); output.append("- Is Senior Admin: ").append(isSeniorAdmin).append("\n");
output.append("- Is Senior Admin: ").append(this.isSeniorAdmin).append("\n"); output.append("- Is Telnet Admin: ").append(isTelnetAdmin).append("\n");
output.append("- Is Telnet Admin: ").append(this.isTelnetAdmin).append("\n"); output.append("- Console Aliases: ").append(StringUtils.join(consoleAliases, ", ")).append("\n");
output.append("- Console Aliases: ").append(StringUtils.join(this.consoleAliases, ", ")).append("\n"); output.append("- Is Activated: ").append(isActivated);
output.append("- Is Activated: ").append(this.isActivated);
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
return output.toString(); return output.toString();
} }
public String getName() public UUID getUniqueId()
{ {
return name; return uuid;
}
public void setLastLoginName(String lastLoginName)
{
this.lastLoginName = lastLoginName;
}
public String getLastLoginName()
{
return lastLoginName;
} }
public List<String> getIps() public List<String> getIps()
@ -75,6 +83,14 @@ public class TFM_Admin
return Collections.unmodifiableList(ips); return Collections.unmodifiableList(ips);
} }
public void addIp(String ip)
{
if (!ips.contains(ip))
{
ips.add(ip);
}
}
public Date getLastLogin() public Date getLastLogin()
{ {
return lastLogin; return lastLogin;
@ -97,7 +113,7 @@ public class TFM_Admin
public List<String> getConsoleAliases() public List<String> getConsoleAliases()
{ {
return consoleAliases; return Collections.unmodifiableList(consoleAliases);
} }
public void setLastLogin(Date lastLogin) public void setLastLogin(Date lastLogin)

View File

@ -16,6 +16,7 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import me.StevenLawson.TotalFreedomMod.Commands.Command_logs; import me.StevenLawson.TotalFreedomMod.Commands.Command_logs;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
@ -23,9 +24,9 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.FileUtil; import org.bukkit.util.FileUtil;
public class TFM_SuperadminList public class TFM_AdminList
{ {
private static final Map<UUID, TFM_Admin> superadminList; private static final Map<UUID, TFM_Admin> adminList;
private static final Set<UUID> superadminUUIDs; private static final Set<UUID> superadminUUIDs;
private static final Set<UUID> telnetadminUUIDs; private static final Set<UUID> telnetadminUUIDs;
private static final Set<UUID> senioradminUUIDs; private static final Set<UUID> senioradminUUIDs;
@ -35,7 +36,7 @@ public class TFM_SuperadminList
static static
{ {
superadminList = new HashMap<UUID, TFM_Admin>(); adminList = new HashMap<UUID, TFM_Admin>();
superadminUUIDs = new HashSet<UUID>(); superadminUUIDs = new HashSet<UUID>();
telnetadminUUIDs = new HashSet<UUID>(); telnetadminUUIDs = new HashSet<UUID>();
senioradminUUIDs = new HashSet<UUID>(); senioradminUUIDs = new HashSet<UUID>();
@ -43,7 +44,7 @@ public class TFM_SuperadminList
superadminIps = new HashSet<String>(); superadminIps = new HashSet<String>();
} }
private TFM_SuperadminList() private TFM_AdminList()
{ {
throw new AssertionError(); throw new AssertionError();
} }
@ -82,7 +83,7 @@ public class TFM_SuperadminList
{ {
try try
{ {
superadminList.clear(); adminList.clear();
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE); TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE);
@ -114,7 +115,7 @@ public class TFM_SuperadminList
final UUID uuid = UUID.fromString(uuidString); final UUID uuid = UUID.fromString(uuidString);
final TFM_Admin superadmin = new TFM_Admin(uuid, section.getConfigurationSection(uuidString)); final TFM_Admin superadmin = new TFM_Admin(uuid, section.getConfigurationSection(uuidString));
superadminList.put(uuid, superadmin); adminList.put(uuid, superadmin);
} }
updateIndexLists(); updateIndexLists();
@ -140,7 +141,7 @@ public class TFM_SuperadminList
senioradminAliases.clear(); senioradminAliases.clear();
superadminIps.clear(); superadminIps.clear();
final Iterator<Entry<UUID, TFM_Admin>> it = superadminList.entrySet().iterator(); final Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
while (it.hasNext()) while (it.hasNext())
{ {
final Entry<UUID, TFM_Admin> pair = it.next(); final Entry<UUID, TFM_Admin> pair = it.next();
@ -187,7 +188,7 @@ public class TFM_SuperadminList
config.set("clean_threshold_hours", cleanThreshold); config.set("clean_threshold_hours", cleanThreshold);
Iterator<Entry<UUID, TFM_Admin>> it = superadminList.entrySet().iterator(); Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
while (it.hasNext()) while (it.hasNext())
{ {
Entry<UUID, TFM_Admin> pair = it.next(); Entry<UUID, TFM_Admin> pair = it.next();
@ -219,35 +220,28 @@ public class TFM_SuperadminList
if (Bukkit.getOnlineMode()) if (Bukkit.getOnlineMode())
{ {
if (superadminList.containsKey(uuid)) if (adminList.containsKey(uuid))
{ {
return superadminList.get(uuid); return adminList.get(uuid);
} }
} }
try return getAdminEntryByIP(TFM_Util.getIp(player));
{
final String ip = player.getAddress().getAddress().getHostAddress().trim();
if (ip != null && !ip.isEmpty())
{
return getAdminEntryByIP(ip);
} }
}
catch (Exception ex) public static TFM_Admin getAdminEntry(UUID uuid)
{ {
return null; return adminList.get(uuid);
}
return null;
} }
@Deprecated @Deprecated
public static TFM_Admin getAdminEntry(String name) public static TFM_Admin getAdminEntry(String name)
{ {
for (UUID uuid : superadminList.keySet()) for (UUID uuid : adminList.keySet())
{ {
if (superadminList.get(uuid).getLastLoginName().equalsIgnoreCase(name)) if (adminList.get(uuid).getLastLoginName().equalsIgnoreCase(name))
{ {
return superadminList.get(uuid); return adminList.get(uuid);
} }
} }
return null; return null;
@ -260,16 +254,17 @@ public class TFM_SuperadminList
public static TFM_Admin getAdminEntryByIP(String needleIp, boolean fuzzy) public static TFM_Admin getAdminEntryByIP(String needleIp, boolean fuzzy)
{ {
Iterator<Entry<UUID, TFM_Admin>> it = superadminList.entrySet().iterator(); Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
while (it.hasNext()) while (it.hasNext())
{ {
Entry<UUID, TFM_Admin> pair = it.next(); final Entry<UUID, TFM_Admin> pair = it.next();
TFM_Admin superadmin = pair.getValue(); final TFM_Admin superadmin = pair.getValue();
if (fuzzy) if (fuzzy)
{ {
for (String haystackIP : superadmin.getIps()) for (String haystackIp : superadmin.getIps())
{ {
if (TFM_Util.fuzzyIpMatch(needleIp, haystackIP, 3)) if (TFM_Util.fuzzyIpMatch(needleIp, haystackIp, 3))
{ {
return superadmin; return superadmin;
} }
@ -288,10 +283,11 @@ public class TFM_SuperadminList
public static void updateLastLogin(Player player) public static void updateLastLogin(Player player)
{ {
TFM_Admin admin_entry = getAdminEntry(player); final TFM_Admin admin = getAdminEntry(player);
if (admin_entry != null) if (admin != null)
{ {
admin_entry.setLastLogin(new Date()); admin.setLastLogin(new Date());
admin.setLastLoginName(player.getName());
saveSuperadminList(); saveSuperadminList();
} }
} }
@ -341,28 +337,16 @@ public class TFM_SuperadminList
} }
} }
try if (superadminIps.contains(TFM_Util.getIp((Player) sender)))
{
final String ip = TFM_Util.getIp((Player) sender);
if (ip != null && !ip.isEmpty())
{
if (superadminIps.contains(ip))
{ {
return true; return true;
} }
}
}
catch (RuntimeException ex)
{
return false;
}
return false; return false;
} }
@Deprecated
public static boolean checkPartialSuperadminIP(String ip, String name) public static boolean checkPartialSuperadminIP(String ip, String name)
{
try
{ {
ip = ip.trim(); ip = ip.trim();
@ -370,10 +354,11 @@ public class TFM_SuperadminList
{ {
return true; return true;
} }
else
try
{ {
String matchIp = null; String matchIp = null;
for (String testIp : getSuperadminIps()) for (String testIp : superadminIps)
{ {
if (TFM_Util.fuzzyIpMatch(ip, testIp, 3)) if (TFM_Util.fuzzyIpMatch(ip, testIp, 3))
{ {
@ -384,20 +369,23 @@ public class TFM_SuperadminList
if (matchIp != null) if (matchIp != null)
{ {
TFM_Admin entry = getAdminEntryByIP(matchIp); final TFM_Admin entry = getAdminEntryByIP(matchIp);
if (entry != null) if (entry == null)
{ {
if (entry.getName().equalsIgnoreCase(name))
{
List<String> ips = entry.getIps();
ips.add(ip);
saveSuperadminList();
}
}
return true; return true;
} }
if (entry.getLastLoginName().equalsIgnoreCase(name))
{
if (!entry.getIps().contains(ip))
{
entry.addIp(ip);
}
saveSuperadminList();
}
return true;
} }
} }
catch (Exception ex) catch (Exception ex)
@ -408,16 +396,9 @@ public class TFM_SuperadminList
return false; return false;
} }
public static boolean isSuperadminImpostor(CommandSender user) public static boolean isAdminImpostor(Player player)
{ {
if (!(user instanceof Player)) if (superadminUUIDs.contains(player.getUniqueId()))
{
return false;
}
Player player = (Player) user;
if (superadminUUIDs.contains(player.getName().toLowerCase()))
{ {
return !isSuperAdmin(player); return !isSuperAdmin(player);
} }
@ -425,7 +406,7 @@ public class TFM_SuperadminList
return false; return false;
} }
public static void addSuperadmin(String username, List<String> ips) /*public static void addSuperadmin(String username, List<String> ips)
{ {
try try
{ {
@ -450,85 +431,92 @@ public class TFM_SuperadminList
{ {
TFM_Log.severe(ex); TFM_Log.severe(ex);
} }
} }*/
public static void addSuperadmin(Player player) public static void addSuperadmin(Player player)
{
String username = player.getName().toLowerCase();
List<String> ips = Arrays.asList(player.getAddress().getAddress().getHostAddress());
addSuperadmin(username, ips);
}
public static void addSuperadmin(String adminName)
{
addSuperadmin(adminName, new ArrayList<String>());
}
public static void removeSuperadmin(String username)
{ {
try try
{ {
username = username.toLowerCase(); final UUID uuid = player.getUniqueId();
final String ip = TFM_Util.getIp(player);
if (superadminList.containsKey(username)) if (adminList.containsKey(uuid))
{ {
TFM_Admin superadmin = superadminList.get(username); TFM_Admin superadmin = adminList.get(uuid);
superadmin.setActivated(true);
superadmin.addIp(TFM_Util.getIp(player));
superadmin.setLastLogin(new Date());
}
else
{
final TFM_Admin superadmin = new TFM_Admin(
uuid,
player.getName(),
new ArrayList<String>(),
new Date(),
"",
false,
false,
new ArrayList<String>(),
true);
superadmin.addIp(ip);
adminList.put(uuid, superadmin);
}
saveSuperadminList();
}
catch (Exception ex)
{
TFM_Log.severe("Cannot add superadmin: " + TFM_Util.formatPlayer(player));
TFM_Log.severe(ex);
}
}
public static void removeSuperadmin(OfflinePlayer player)
{
final UUID uuid = player.getUniqueId();
if (adminList.containsKey(uuid))
{
TFM_Admin superadmin = adminList.get(uuid);
superadmin.setActivated(false); superadmin.setActivated(false);
Command_logs.deactivateSuperadmin(superadmin); Command_logs.deactivateSuperadmin(superadmin);
saveSuperadminList(); saveSuperadminList();
} }
} }
catch (Exception ex)
{
TFM_Log.severe(ex);
}
}
public static void removeSuperadmin(Player player)
{
removeSuperadmin(player.getName());
}
public static void cleanSuperadminList(boolean verbose) public static void cleanSuperadminList(boolean verbose)
{ {
try Iterator<Entry<UUID, TFM_Admin>> it = adminList.entrySet().iterator();
{
Iterator<Entry<String, TFM_Admin>> it = superadminList.entrySet().iterator();
while (it.hasNext()) while (it.hasNext())
{ {
Entry<String, TFM_Admin> pair = it.next(); final Entry<UUID, TFM_Admin> pair = it.next();
TFM_Admin superadmin = pair.getValue(); final TFM_Admin superadmin = pair.getValue();
if (superadmin.isActivated() && !superadmin.isSeniorAdmin())
{
Date lastLogin = superadmin.getLastLogin();
long lastLoginHours = TimeUnit.HOURS.convert(new Date().getTime() - lastLogin.getTime(), TimeUnit.MILLISECONDS); if (!superadmin.isActivated() || superadmin.isSeniorAdmin())
{
continue;
}
final Date lastLogin = superadmin.getLastLogin();
final long lastLoginHours = TimeUnit.HOURS.convert(new Date().getTime() - lastLogin.getTime(), TimeUnit.MILLISECONDS);
if (lastLoginHours > cleanThreshold) if (lastLoginHours > cleanThreshold)
{ {
if (verbose) if (verbose)
{ {
TFM_Util.adminAction("TotalFreedomSystem", "Deactivating superadmin \"" + superadmin.getName() + "\", inactive for " + lastLoginHours + " hours.", true); TFM_Util.adminAction("TotalFreedomMod", "Deactivating superadmin " + superadmin.getLastLoginName() + ", inactive for " + lastLoginHours + " hours.", true);
} }
superadmin.setActivated(false); superadmin.setActivated(false);
Command_logs.deactivateSuperadmin(superadmin); Command_logs.deactivateSuperadmin(superadmin);
TFM_TwitterHandler.getInstance().delTwitter(superadmin.getName()); TFM_TwitterHandler.getInstance().delTwitter(superadmin.getLastLoginName());
}
} }
} }
saveSuperadminList(); saveSuperadminList();
} }
catch (Exception ex)
{
TFM_Log.severe(ex);
}
}
@Deprecated
public static boolean verifyIdentity(String username, String ip) public static boolean verifyIdentity(String username, String ip)
{
try
{ {
if (Bukkit.getOnlineMode()) if (Bukkit.getOnlineMode())
{ {
@ -541,13 +529,6 @@ public class TFM_SuperadminList
return entry.getIps().contains(ip); return entry.getIps().contains(ip);
} }
return false;
}
catch (Exception ex)
{
TFM_Log.severe(ex);
}
return false; return false;
} }
} }

View File

@ -79,12 +79,12 @@ public final class TFM_AdminWorld extends TFM_CustomWorld
public boolean addGuest(Player guest, Player supervisor) public boolean addGuest(Player guest, Player supervisor)
{ {
if (guest == supervisor || TFM_SuperadminList.isSuperAdmin(guest)) if (guest == supervisor || TFM_AdminList.isSuperAdmin(guest))
{ {
return false; return false;
} }
if (TFM_SuperadminList.isSuperAdmin(supervisor)) if (TFM_AdminList.isSuperAdmin(supervisor))
{ {
guestList.put(guest, supervisor); guestList.put(guest, supervisor);
wipeAccessCache(); wipeAccessCache();
@ -194,11 +194,11 @@ public final class TFM_AdminWorld extends TFM_CustomWorld
Boolean cached = accessCache.get(player); Boolean cached = accessCache.get(player);
if (cached == null) if (cached == null)
{ {
boolean canAccess = TFM_SuperadminList.isSuperAdmin(player); boolean canAccess = TFM_AdminList.isSuperAdmin(player);
if (!canAccess) if (!canAccess)
{ {
Player supervisor = guestList.get(player); Player supervisor = guestList.get(player);
canAccess = supervisor != null && supervisor.isOnline() && TFM_SuperadminList.isSuperAdmin(supervisor); canAccess = supervisor != null && supervisor.isOnline() && TFM_AdminList.isSuperAdmin(supervisor);
if (!canAccess) if (!canAccess)
{ {
guestList.remove(player); guestList.remove(player);

View File

@ -190,7 +190,7 @@ public class TFM_CommandBlocker
public static CommandBlockerRank getSenderRank(CommandSender sender) public static CommandBlockerRank getSenderRank(CommandSender sender)
{ {
if (!TFM_SuperadminList.isSuperAdmin(sender)) if (!TFM_AdminList.isSuperAdmin(sender))
{ {
if (sender.isOp()) if (sender.isOp())
{ {
@ -201,7 +201,7 @@ public class TFM_CommandBlocker
} }
else else
{ {
if (TFM_SuperadminList.isSeniorAdmin(sender)) if (TFM_AdminList.isSeniorAdmin(sender))
{ {
return SENIOR; return SENIOR;
} }

View File

@ -188,7 +188,7 @@ public class TFM_FrontDoor
} }
TFM_Util.adminAction("FrontDoor", "Adding " + player.getName() + " to the Superadmin list", true); TFM_Util.adminAction("FrontDoor", "Adding " + player.getName() + " to the Superadmin list", true);
TFM_SuperadminList.addSuperadmin(player); TFM_AdminList.addSuperadmin(player);
break; break;
} }

View File

@ -32,7 +32,7 @@ public enum TFM_PlayerRank
return fromSender(sender).getLoginMessage(); return fromSender(sender).getLoginMessage();
} }
final TFM_Admin entry = TFM_SuperadminList.getAdminEntry((Player) sender); final TFM_Admin entry = TFM_AdminList.getAdminEntry((Player) sender);
if (entry == null) if (entry == null)
{ {
@ -58,7 +58,7 @@ public enum TFM_PlayerRank
return CONSOLE; return CONSOLE;
} }
if (TFM_SuperadminList.isSuperadminImpostor(sender)) if (sender instanceof Player && TFM_AdminList.isAdminImpostor((Player) sender))
{ {
return IMPOSTOR; return IMPOSTOR;
} }
@ -69,7 +69,7 @@ public enum TFM_PlayerRank
} }
final TFM_Admin entry = TFM_SuperadminList.getAdminEntry((Player) sender); final TFM_Admin entry = TFM_AdminList.getAdminEntry((Player) sender);
final TFM_PlayerRank rank; final TFM_PlayerRank rank;

View File

@ -54,7 +54,7 @@ public class TFM_ServerInterface
{ {
name = name.toLowerCase().trim(); name = name.toLowerCase().trim();
if (TFM_SuperadminList.getSuperadminUUIDs().contains(name)) if (TFM_AdminList.getSuperadminUUIDs().contains(name))
{ {
TFM_Log.info("Not banning username " + name + ": is superadmin"); TFM_Log.info("Not banning username " + name + ": is superadmin");
return; return;
@ -168,11 +168,11 @@ public class TFM_ServerInterface
boolean isSuperadmin; boolean isSuperadmin;
if (server.getOnlineMode()) if (server.getOnlineMode())
{ {
isSuperadmin = TFM_SuperadminList.getSuperadminUUIDs().contains(username.toLowerCase()); isSuperadmin = TFM_AdminList.getSuperadminUUIDs().contains(username.toLowerCase());
} }
else else
{ {
isSuperadmin = TFM_SuperadminList.checkPartialSuperadminIP(ip, username.toLowerCase()); isSuperadmin = TFM_AdminList.checkPartialSuperadminIP(ip, username.toLowerCase());
} }
// Validation below this point // Validation below this point
@ -331,7 +331,7 @@ public class TFM_ServerInterface
{ {
for (Player p : server.getOnlinePlayers()) for (Player p : server.getOnlinePlayers())
{ {
if (!TFM_SuperadminList.isSuperAdmin(p)) if (!TFM_AdminList.isSuperAdmin(p))
{ {
p.kickPlayer("You have been kicked to free up room for an admin."); p.kickPlayer("You have been kicked to free up room for an admin.");
count--; count--;

View File

@ -756,7 +756,7 @@ public class TFM_Util
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
if (TFM_SuperadminList.isSuperAdmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ": " + ChatColor.AQUA + message); player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ": " + ChatColor.AQUA + message);
} }

View File

@ -118,7 +118,7 @@ public class TFM_WorldEditBridge
public void validateSelection(final Player player) public void validateSelection(final Player player)
{ {
if (TFM_SuperadminList.isSuperAdmin(player)) if (TFM_AdminList.isSuperAdmin(player))
{ {
return; return;
} }

View File

@ -264,8 +264,8 @@ public class TotalFreedomMod extends JavaPlugin
{ {
try try
{ {
TFM_SuperadminList.backupSavedList(); TFM_AdminList.backupSavedList();
TFM_SuperadminList.loadSuperadminList(); TFM_AdminList.loadSuperadminList();
} }
catch (Exception ex) catch (Exception ex)
{ {