staff -> admins

* rename everything containing staff back to admin (as requested by ryan i've renamed commands like slconfig to saconfig but left "slconfig" as an alias)
* format almost every file correctly
* a few other improvements
This commit is contained in:
speed
2020-12-03 19:28:53 -05:00
parent aae1f524ea
commit 293ea04c56
205 changed files with 1667 additions and 1696 deletions

View File

@ -40,7 +40,9 @@ public class CommandLoader extends FreedomService
for (FreedomCommand command : commands)
{
if (name.equals(command.getName()))
{
return command;
}
}
return null;
}
@ -50,7 +52,9 @@ public class CommandLoader extends FreedomService
for (FreedomCommand command : commands)
{
if (Arrays.asList(command.getAliases().split(",")).contains(alias))
{
return true;
}
}
return false;
}
@ -69,7 +73,7 @@ public class CommandLoader extends FreedomService
}
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
{
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_" , ""));
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_", ""));
}
}

View File

@ -8,8 +8,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Talk privately with other staff on the server.", usage = "/<command> [message]", aliases = "o,sc")
public class Command_staffchat extends FreedomCommand
@CommandParameters(description = "Talk privately with other admins on the server.", usage = "/<command> [message]", aliases = "o,sc,ac,staffchat")
public class Command_adminchat extends FreedomCommand
{
@Override
@ -19,18 +19,18 @@ public class Command_staffchat extends FreedomCommand
{
if (senderIsConsole)
{
msg("You must be in-game to toggle staff chat, it cannot be toggled via CONSOLE or Telnet.");
msg("You must be in-game to toggle admin chat, it cannot be toggled via CONSOLE or Telnet.");
return true;
}
FPlayer userinfo = plugin.pl.getPlayer(playerSender);
userinfo.setStaffChat(!userinfo.inStaffChat());
msg("Toggled your staff chat " + (userinfo.inStaffChat() ? "on" : "off") + ".");
userinfo.setAdminChat(!userinfo.inAdminChat());
msg("Admin chat turned " + (userinfo.inAdminChat() ? "on" : "off") + ".");
}
else
{
plugin.cm.staffChat(sender, StringUtils.join(args, " "));
plugin.cm.adminChat(sender, StringUtils.join(args, " "));
}
return true;
}
}
}

View File

@ -11,23 +11,23 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Information on how to apply for staff.", usage = "/<command>", aliases = "si")
public class Command_staffinfo extends FreedomCommand
@CommandParameters(description = "Information on how to apply for admin.", usage = "/<command>", aliases = "si,ai,staffinfo")
public class Command_admininfo extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
List<String> staffInfo = ConfigEntry.STAFF_INFO.getStringList();
List<String> adminInfo = ConfigEntry.ADMIN_INFO.getStringList();
if (staffInfo.isEmpty())
if (adminInfo.isEmpty())
{
msg("The staff information section of the config.yml file has not been configured.", ChatColor.RED);
msg("The admin information section of the config.yml file has not been configured.", ChatColor.RED);
}
else
{
msg(FUtil.colorize(StringUtils.join(staffInfo, "\n")));
msg(FUtil.colorize(StringUtils.join(adminInfo, "\n")));
}
return true;
}
}
}

View File

@ -11,8 +11,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Denies joining of operators and only allows staff members to join.", usage = "/<command> [on | off]")
public class Command_staffmode extends FreedomCommand
@CommandParameters(description = "Denies joining of operators and only allows admins to join.", usage = "/<command> [on | off]", aliases = "staffmode")
public class Command_adminmode extends FreedomCommand
{
@Override
@ -25,19 +25,19 @@ public class Command_staffmode extends FreedomCommand
if (args[0].equalsIgnoreCase("off"))
{
ConfigEntry.STAFF_ONLY_MODE.setBoolean(false);
FUtil.staffAction(sender.getName(), "Opening the server to all players.", true);
ConfigEntry.ADMIN_ONLY_MODE.setBoolean(false);
FUtil.adminAction(sender.getName(), "Opening the server to all players", true);
return true;
}
else if (args[0].equalsIgnoreCase("on"))
{
ConfigEntry.STAFF_ONLY_MODE.setBoolean(true);
FUtil.staffAction(sender.getName(), "Closing the server to non-staff.", true);
ConfigEntry.ADMIN_ONLY_MODE.setBoolean(true);
FUtil.adminAction(sender.getName(), "Closing the server to non-admins", true);
for (Player player : server.getOnlinePlayers())
{
if (!isStaff(player))
if (!isAdmin(player))
{
player.kickPlayer("Server is now closed to non-staff.");
player.kickPlayer("Server is now closed to non-admins.");
}
}
return true;
@ -49,11 +49,11 @@ public class Command_staffmode extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isStaff(sender) && !(sender instanceof Player))
if (args.length == 1 && plugin.al.isAdmin(sender) && !(sender instanceof Player))
{
return Arrays.asList("on", "off");
}
return Collections.emptyList();
}
}
}

View File

@ -13,10 +13,10 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Allows for staff to configure time, and weather of the StaffWorld, and allows for staff and ops to go to the StaffWorld.",
@CommandParameters(description = "Allows for admins to configure time, and weather of the AdminWorld, and allows for admins and ops to go to the AdminWorld.",
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
aliases = "sw")
public class Command_staffworld extends FreedomCommand
aliases = "sw,aw,staffworld")
public class Command_adminworld extends FreedomCommand
{
private enum CommandMode
@ -61,24 +61,24 @@ public class Command_staffworld extends FreedomCommand
return false;
}
World staffWorld = null;
World adminWorld = null;
try
{
staffWorld = plugin.wm.staffworld.getWorld();
adminWorld = plugin.wm.adminworld.getWorld();
}
catch (Exception ex)
{
}
if (staffWorld == null || playerSender.getWorld() == staffWorld)
if (adminWorld == null || playerSender.getWorld() == adminWorld)
{
msg("Going to the main world.");
PaperLib.teleportAsync(playerSender, server.getWorlds().get(0).getSpawnLocation());
}
else
{
msg("Going to the StaffWorld.");
plugin.wm.staffworld.sendToWorld(playerSender);
msg("Going to the AdminWorld.");
plugin.wm.adminworld.sendToWorld(playerSender);
}
break;
}
@ -91,8 +91,8 @@ public class Command_staffworld extends FreedomCommand
WorldTime timeOfDay = WorldTime.getByAlias(args[1]);
if (timeOfDay != null)
{
plugin.wm.staffworld.setTimeOfDay(timeOfDay);
msg("StaffWorld time set to: " + timeOfDay.name());
plugin.wm.adminworld.setTimeOfDay(timeOfDay);
msg("AdminWorld time set to: " + timeOfDay.name());
}
else
{
@ -115,8 +115,8 @@ public class Command_staffworld extends FreedomCommand
WorldWeather weatherMode = WorldWeather.getByAlias(args[1]);
if (weatherMode != null)
{
plugin.wm.staffworld.setWeatherMode(weatherMode);
msg("StaffWorld weather set to: " + weatherMode.name());
plugin.wm.adminworld.setWeatherMode(weatherMode);
msg("AdminWorld weather set to: " + weatherMode.name());
}
else
{
@ -152,7 +152,7 @@ public class Command_staffworld extends FreedomCommand
// TODO: Redo this properly
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
{
if (!(sender instanceof Player) || playerSender == null || !isStaff(sender))
if (!(sender instanceof Player) || playerSender == null || !isAdmin(sender))
{
throw new PermissionDeniedException();
}
@ -177,7 +177,7 @@ public class Command_staffworld extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}

View File

@ -37,7 +37,7 @@ public class Command_adventure extends FreedomCommand
targetPlayer.setGameMode(GameMode.ADVENTURE);
}
FUtil.staffAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to adventure", false);
msg("Your gamemode has been set to adventure.");
return true;
}
@ -55,4 +55,4 @@ public class Command_adventure extends FreedomCommand
player.setGameMode(GameMode.ADVENTURE);
return true;
}
}
}

View File

@ -17,7 +17,7 @@ public class Command_aeclear extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.staffAction(sender.getName(), "Removing all area effect clouds.", true);
FUtil.adminAction(sender.getName(), "Removing all area effect clouds", true);
int removed = 0;
for (World world : server.getWorlds())
{
@ -33,4 +33,4 @@ public class Command_aeclear extends FreedomCommand
msg(removed + " area effect clouds removed.");
return true;
}
}
}

View File

@ -22,5 +22,4 @@ public class Command_announce extends FreedomCommand
plugin.an.announce(StringUtils.join(args, " "));
return true;
}
}
}

View File

@ -154,7 +154,7 @@ public class Command_ban extends FreedomCommand
bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason);
}
msg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", "));
FUtil.staffAction(sender.getName(), String.format(bcast.toString()), true);
FUtil.adminAction(sender.getName(), String.format(bcast.toString()), true);
}
// Kick player and handle others on IP

View File

@ -27,7 +27,7 @@ public class Command_banip extends FreedomCommand
boolean silent = false;
String reason = null;
String ip = args[0];
if (!FUtil.isValidIPv4(ip))
@ -72,7 +72,7 @@ public class Command_banip extends FreedomCommand
{
// Broadcast
FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip);
String message = ChatColor.RED + sender.getName() + " - Banned " + (plugin.sl.isStaff(player) ? "the IP " + ip : "an IP");
String message = ChatColor.RED + sender.getName() + " - Banned " + (plugin.al.isAdmin(player) ? "the IP " + ip : "an IP");
player.sendMessage(message);
}
}

View File

@ -20,7 +20,7 @@ public class Command_banlist extends FreedomCommand
{
checkRank(Rank.SENIOR_ADMIN);
FUtil.staffAction(sender.getName(), "Purging the ban list", true);
FUtil.adminAction(sender.getName(), "Purging the ban list", true);
int amount = plugin.bm.purge();
msg("Purged " + amount + " player bans.");
return true;

View File

@ -26,8 +26,8 @@ public class Command_banname extends FreedomCommand
boolean silent = false;
String reason = null;
String name = args[0];;
String name = args[0];
if (plugin.bm.getByUsername(name) != null)
{
@ -55,7 +55,7 @@ public class Command_banname extends FreedomCommand
if (!silent)
{
FUtil.staffAction(sender.getName(), "Banned the name " + name, true);
FUtil.adminAction(sender.getName(), "Banned the name " + name, true);
}
Player player = getPlayer(name);

View File

@ -23,7 +23,7 @@ public class Command_blockcmd extends FreedomCommand
if (args[0].equals("purge"))
{
FUtil.staffAction(sender.getName(), "Unblocking commands for all players", true);
FUtil.adminAction(sender.getName(), "Unblocking commands for all players", true);
int counter = 0;
for (Player player : server.getOnlinePlayers())
{
@ -40,18 +40,18 @@ public class Command_blockcmd extends FreedomCommand
if (args[0].equals("-a"))
{
FUtil.staffAction(sender.getName(), "Blocking commands for all non-staff", true);
FUtil.adminAction(sender.getName(), "Blocking commands for all non-admins", true);
int counter = 0;
for (Player player : server.getOnlinePlayers())
{
if (isStaff(player))
if (isAdmin(player))
{
continue;
}
counter += 1;
plugin.pl.getPlayer(player).setCommandsBlocked(true);
msg(player, "Your commands have been blocked by a staff member.", ChatColor.RED);
msg(player, "Your commands have been blocked by an admin.", ChatColor.RED);
}
msg("Blocked commands for " + counter + " players.");
@ -66,9 +66,9 @@ public class Command_blockcmd extends FreedomCommand
return true;
}
if (isStaff(player))
if (isAdmin(player))
{
msg(player.getName() + " is a staff member, and cannot have their commands blocked.");
msg(player.getName() + " is an admin, and cannot have their commands blocked.");
return true;
}
@ -76,7 +76,7 @@ public class Command_blockcmd extends FreedomCommand
if (!playerdata.allCommandsBlocked())
{
playerdata.setCommandsBlocked(true);
FUtil.staffAction(sender.getName(), "Blocking all commands for " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true);
msg("Blocked commands for " + player.getName() + ".");
}
else

View File

@ -46,7 +46,7 @@ public class Command_blockedit extends FreedomCommand
if (args[0].equals("purge"))
{
FUtil.staffAction(sender.getName(), "Unblocking block modification abilities for all players.", true);
FUtil.adminAction(sender.getName(), "Unblocking block modification abilities for all players", true);
int count = 0;
for (final Player player : this.server.getOnlinePlayers())
{
@ -63,11 +63,11 @@ public class Command_blockedit extends FreedomCommand
if (args[0].equals("all"))
{
FUtil.staffAction(sender.getName(), "Blocking block modification abilities for all non-staff.", true);
FUtil.adminAction(sender.getName(), "Blocking block modification abilities for all non-admins", true);
int counter = 0;
for (final Player player : this.server.getOnlinePlayers())
{
if (!plugin.sl.isStaff(player))
if (!plugin.al.isAdmin(player))
{
final FPlayer playerdata = plugin.pl.getPlayer(player);
playerdata.setEditBlocked(true);
@ -105,20 +105,20 @@ public class Command_blockedit extends FreedomCommand
final FPlayer pd = plugin.pl.getPlayer(player2);
if (pd.isEditBlocked())
{
FUtil.staffAction(sender.getName(), "Unblocking block modification abilities for " + player2.getName(), true);
FUtil.adminAction(sender.getName(), "Unblocking block modification abilities for " + player2.getName(), true);
pd.setEditBlocked(false);
msg("Unblocking block modification abilities for " + player2.getName());
msg(player2, "Your block modification abilities have been restored.", ChatColor.RED);
}
else
{
if (plugin.sl.isStaff(player2))
if (plugin.al.isAdmin(player2))
{
msg(player2.getName() + " is a staff member, and cannot have their block edits blocked.");
msg(player2.getName() + " is an admin, and cannot have their block edits blocked.");
return true;
}
FUtil.staffAction(sender.getName(), "Blocking block modification abilities for " + player2.getName(), true);
FUtil.adminAction(sender.getName(), "Blocking block modification abilities for " + player2.getName(), true);
pd.setEditBlocked(true);
if (smite)

View File

@ -46,7 +46,7 @@ public class Command_blockpvp extends FreedomCommand
if (args[0].equals("purge"))
{
FUtil.staffAction(sender.getName(), "Enabling PVP for all players.", true);
FUtil.adminAction(sender.getName(), "Enabling PVP for all players.", true);
int count = 0;
for (Player player : server.getOnlinePlayers())
{
@ -64,11 +64,11 @@ public class Command_blockpvp extends FreedomCommand
if (args[0].equals("all"))
{
FUtil.staffAction(sender.getName(), "Disabling PVP for all non-staff", true);
FUtil.adminAction(sender.getName(), "Disabling PVP for all non-admins", true);
int counter = 0;
for (Player player : server.getOnlinePlayers())
{
if (!plugin.sl.isStaff(player))
if (!plugin.al.isAdmin(player))
{
final FPlayer playerdata = plugin.pl.getPlayer(player);
playerdata.setPvpBlocked(true);
@ -106,20 +106,20 @@ public class Command_blockpvp extends FreedomCommand
final FPlayer pd = plugin.pl.getPlayer(p);
if (pd.isPvpBlocked())
{
FUtil.staffAction(sender.getName(), "Enabling PVP for " + p.getName(), true);
FUtil.adminAction(sender.getName(), "Enabling PVP for " + p.getName(), true);
pd.setPvpBlocked(false);
msg("Enabling PVP for " + p.getName());
msg("Enabling PVP for " + p.getName());
msg(p, "Your PVP have been enabled.", ChatColor.GREEN);
}
else
{
if (plugin.sl.isStaff(p))
if (plugin.al.isAdmin(p))
{
msg(p.getName() + " is a staff member, and cannot have their PVP disabled.");
msg(p.getName() + " is an admin, and cannot have their PVP disabled.");
return true;
}
FUtil.staffAction(sender.getName(), "Disabling PVP for " + p.getName(), true);
FUtil.adminAction(sender.getName(), "Disabling PVP for " + p.getName(), true);
pd.setPvpBlocked(true);
if (smite)
{

View File

@ -18,14 +18,14 @@ public class Command_blockredstone extends FreedomCommand
if (ConfigEntry.ALLOW_REDSTONE.getBoolean())
{
ConfigEntry.ALLOW_REDSTONE.setBoolean(false);
FUtil.staffAction(sender.getName(), "Blocking all redstone", true);
FUtil.adminAction(sender.getName(), "Blocking all redstone", true);
new BukkitRunnable()
{
public void run()
{
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
{
FUtil.staffAction("TotalFreedom", "Unblocking all redstone", false);
FUtil.adminAction("TotalFreedom", "Unblocking all redstone", false);
ConfigEntry.ALLOW_REDSTONE.setBoolean(true);
}
}
@ -34,8 +34,8 @@ public class Command_blockredstone extends FreedomCommand
else
{
ConfigEntry.ALLOW_REDSTONE.setBoolean(true);
FUtil.staffAction(sender.getName(), "Unblocking all redstone", true);
FUtil.adminAction(sender.getName(), "Unblocking all redstone", true);
}
return true;
}
}
}

View File

@ -28,9 +28,9 @@ public class Command_cage extends FreedomCommand
}
String skullName = null;
if ("purge".equals(args[0]))
if (args[0].equalsIgnoreCase("purge"))
{
FUtil.staffAction(sender.getName(), "Uncaging all players", true);
FUtil.adminAction(sender.getName(), "Uncaging all players", true);
for (Player player : server.getOnlinePlayers())
{
final FPlayer fPlayer = plugin.pl.getPlayer(player);
@ -101,11 +101,11 @@ public class Command_cage extends FreedomCommand
if (outerMaterial == Material.PLAYER_HEAD)
{
FUtil.staffAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
}
else
{
FUtil.staffAction(sender.getName(), "Caging " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Caging " + player.getName(), true);
}
return true;
}
@ -113,7 +113,7 @@ public class Command_cage extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return null;
}
@ -146,4 +146,4 @@ public class Command_cage extends FreedomCommand
return Collections.emptyList();
}
}
}

View File

@ -16,9 +16,8 @@ public class Command_cartsit extends FreedomCommand
{
Player targetPlayer = playerSender;
if (args.length == 1 && plugin.sl.isStaff(sender))
if (args.length == 1 && plugin.al.isAdmin(sender))
{
targetPlayer = getPlayer(args[0]);
if (targetPlayer == null)
@ -74,4 +73,4 @@ public class Command_cartsit extends FreedomCommand
return true;
}
}
}

View File

@ -16,7 +16,7 @@ public class Command_clearchat extends FreedomCommand
{
for (Player player : server.getOnlinePlayers())
{
if (!plugin.sl.isStaff(player))
if (!plugin.al.isAdmin(player))
{
for (int i = 0; i < 100; i++)
{
@ -24,7 +24,7 @@ public class Command_clearchat extends FreedomCommand
}
}
}
FUtil.staffAction(sender.getName(), "Cleared chat", true);
FUtil.adminAction(sender.getName(), "Cleared chat", true);
return true;
}
}
}

View File

@ -29,11 +29,11 @@ public class Command_clearinventory extends FreedomCommand
}
else
{
if (plugin.sl.isStaff(sender))
if (plugin.al.isAdmin(sender))
{
if (args[0].equals("-a"))
{
FUtil.staffAction(sender.getName(), "Clearing everyone's inventory", true);
FUtil.adminAction(sender.getName(), "Clearing everyone's inventory", true);
for (Player player : server.getOnlinePlayers())
{
player.getInventory().clear();
@ -67,7 +67,7 @@ public class Command_clearinventory extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isStaff(sender))
if (args.length == 1 && plugin.al.isAdmin(sender))
{
List<String> players = FUtil.getPlayerList();
players.add("-a");
@ -76,4 +76,4 @@ public class Command_clearinventory extends FreedomCommand
return Collections.emptyList();
}
}
}

View File

@ -1,7 +1,7 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.Admin;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -14,12 +14,11 @@ public class Command_cmdspy extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
StaffMember staffMember = plugin.sl.getAdmin(playerSender);
staffMember.setCommandSpy(!staffMember.getCommandSpy());
msg("CommandSpy " + (staffMember.getCommandSpy() ? "enabled." : "disabled."));
plugin.sl.save(staffMember);
plugin.sl.updateTables();
Admin admin = plugin.al.getAdmin(playerSender);
admin.setCommandSpy(!admin.getCommandSpy());
msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled."));
plugin.al.save(admin);
plugin.al.updateTables();
return true;
}
}
}

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.command;
import java.util.Iterator;
import java.util.Map;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
@ -23,7 +22,7 @@ public class Command_colorme extends FreedomCommand
return false;
}
if ("list".equalsIgnoreCase(args[0]))
if (args[0].equalsIgnoreCase("list"))
{
msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", "));
return true;
@ -31,10 +30,8 @@ public class Command_colorme extends FreedomCommand
final String needle = args[0].trim().toLowerCase();
ChatColor color = null;
final Iterator<Map.Entry<String, ChatColor>> it = FUtil.CHAT_COLOR_NAMES.entrySet().iterator();
while (it.hasNext())
for (Map.Entry<String, ChatColor> entry : FUtil.CHAT_COLOR_NAMES.entrySet())
{
final Map.Entry<String, ChatColor> entry = it.next();
if (entry.getKey().contains(needle))
{
color = entry.getValue();
@ -53,7 +50,6 @@ public class Command_colorme extends FreedomCommand
plugin.esb.setNickname(sender.getName(), newNick);
msg("Your nickname is now: " + newNick);
return true;
}
}
}

View File

@ -37,7 +37,7 @@ public class Command_creative extends FreedomCommand
targetPlayer.setGameMode(GameMode.CREATIVE);
}
FUtil.staffAction(sender.getName(), "Changing everyone's gamemode to creative", false);
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false);
msg("Your gamemode has been set to creative.");
return true;
}
@ -56,4 +56,4 @@ public class Command_creative extends FreedomCommand
return true;
}
}
}

View File

@ -49,18 +49,16 @@ public class Command_curse extends FreedomCommand
player.setResourcePack("http://play.totalfreedom.me/cursed.zip");
msg("Attempting to curse " + player.getName(), ChatColor.GREEN);
plugin.cul.cursedPlayers.put(player, playerSender);
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isStaff(sender) && FUtil.isExecutive(sender.getName()))
if (args.length == 1 && plugin.al.isAdmin(sender) && FUtil.isExecutive(sender.getName()))
{
return FUtil.getPlayerList();
}
return Collections.emptyList();
}
}
}

View File

@ -20,7 +20,7 @@ public class Command_denick extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Removing all nicknames", false);
FUtil.adminAction(sender.getName(), "Removing all nicknames", false);
for (Player player : server.getOnlinePlayers())
{

View File

@ -35,7 +35,7 @@ public class Command_deop extends FreedomCommand
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
{
if (player.isOp() && !plugin.sl.isVanished(player.getName()))
if (player.isOp() && !plugin.al.isVanished(player.getName()))
{
matchedPlayerNames.add(player.getName());
player.setOp(false);
@ -48,7 +48,7 @@ public class Command_deop extends FreedomCommand
{
if (!silent)
{
FUtil.staffAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
FUtil.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
}
}
else

View File

@ -14,7 +14,7 @@ public class Command_deopall extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.staffAction(sender.getName(), "De-opping all players on the server", true);
FUtil.adminAction(sender.getName(), "De-opping all players on the server", true);
for (Player player : server.getOnlinePlayers())
{

View File

@ -20,7 +20,7 @@ public class Command_disguisetoggle extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), (plugin.ldb.isDisguisesEnabled() ? "Disabling" : "Enabling") + " disguises", false);
FUtil.adminAction(sender.getName(), (plugin.ldb.isDisguisesEnabled() ? "Disabling" : "Enabling") + " disguises", false);
if (plugin.ldb.isDisguisesEnabled())
{
@ -33,7 +33,6 @@ public class Command_disguisetoggle extends FreedomCommand
}
msg("Disguises are now " + (plugin.ldb.isDisguisesEnabled() ? "enabled." : "disabled."));
return true;
}
}
}

View File

@ -5,7 +5,7 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
@ -38,23 +38,23 @@ public class Command_doom extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true);
FUtil.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED);
final String ip = player.getAddress().getAddress().getHostAddress().trim();
// Remove from admin
StaffMember staffMember = getStaffMember(player);
if (staffMember != null)
Admin admin = getAdmin(player);
if (admin != null)
{
FUtil.staffAction(sender.getName(), "Removing " + player.getName() + " from the staff list", true);
staffMember.setActive(false);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
plugin.ptero.updateAccountStatus(staffMember);
FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the admin list", true);
admin.setActive(false);
plugin.al.save(admin);
plugin.al.updateTables();
plugin.ptero.updateAccountStatus(admin);
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
plugin.dc.syncRoles(admin, plugin.pl.getData(admin.getName()).getDiscordID());
}
}
@ -120,11 +120,12 @@ public class Command_doom extends FreedomCommand
public void run()
{
// message
FUtil.staffAction(sender.getName(), "Banning " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Banning " + player.getName(), true);
msg(sender, player.getName() + " has been banned and IP is: " + ip);
// generate explosion
player.getWorld().createExplosion(player.getLocation(), 0F, false);;
player.getWorld().createExplosion(player.getLocation(), 0F, false);
;
// kick player
player.kickPlayer(ChatColor.RED + kickReason);
@ -133,4 +134,4 @@ public class Command_doom extends FreedomCommand
return true;
}
}
}

View File

@ -266,5 +266,4 @@ public class Command_enchant extends FreedomCommand
return Collections.emptyList();
}
}
}

View File

@ -54,7 +54,7 @@ public class Command_entitywipe extends FreedomCommand
entityName = FUtil.formatName(type.name());
}
FUtil.staffAction(sender.getName(), "Purging all " + (type != null ? entityName + "s" : "entities"), true);
FUtil.adminAction(sender.getName(), "Purging all " + (type != null ? entityName + "s" : "entities"), true);
int count;
if (type != null)
{

View File

@ -33,10 +33,12 @@ public class Command_explode extends FreedomCommand
player.setFlying(false);
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 50, 0)));
for (int i = 1; i <= 3; i++)
{
FUtil.createExplosionOnDelay(player.getLocation(), 2L, i * 10);
}
new BukkitRunnable()
{
@Override
@ -58,7 +60,7 @@ public class Command_explode extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isStaff(sender))
if (args.length == 1 && plugin.al.isAdmin(sender))
{
return FUtil.getPlayerList();
}

View File

@ -28,4 +28,4 @@ public class Command_explosivearrows extends FreedomCommand
return true;
}
}
}

View File

@ -13,7 +13,7 @@ public class Command_forcekill extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.sl.isMod(sender) && !senderIsConsole)
if (!plugin.al.isAdmin(sender) && !senderIsConsole)
{
playerSender.setHealth(0);
return true;

View File

@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Freeze/Unfreeze a specified player, or all non-staff on the server.", usage = "/<command> [target | purge]", aliases = "fr")
@CommandParameters(description = "Freeze/Unfreeze a specified player, or all non-admins on the server.", usage = "/<command> [target | purge]", aliases = "fr")
public class Command_freeze extends FreedomCommand
{
@ -23,15 +23,15 @@ public class Command_freeze extends FreedomCommand
if (!gFreeze)
{
FUtil.staffAction(sender.getName(), "Disabling global player freeze", false);
FUtil.adminAction(sender.getName(), "Disabling global player freeze", false);
msg("Players are now free to move.");
return true;
}
FUtil.staffAction(sender.getName(), "Enabling global player freeze", false);
FUtil.adminAction(sender.getName(), "Enabling global player freeze", false);
for (Player player : server.getOnlinePlayers())
{
if (!isStaff(player))
if (!isAdmin(player))
{
player.sendTitle(ChatColor.RED + "You've been globally frozen.", ChatColor.YELLOW + "Please be patient and you will be unfrozen shortly.", 20, 100, 60);
msg(player, "You have been globally frozen due to an OP breaking the rules, please wait and you will be unfrozen soon.", ChatColor.RED);
@ -41,12 +41,12 @@ public class Command_freeze extends FreedomCommand
return true;
}
if (args[0].equals("purge"))
if (args[0].equalsIgnoreCase("purge"))
{
FUtil.staffAction(sender.getName(), "Unfreezing all players", false);
FUtil.adminAction(sender.getName(), "Unfreezing all players", false);
for (Player player : server.getOnlinePlayers())
{
if (!isStaff(player))
if (!isAdmin(player))
{
player.sendTitle(ChatColor.GREEN + "You've been unfrozen.", ChatColor.YELLOW + "You may now move again.", 20, 100, 60);
}

View File

@ -21,13 +21,8 @@ public class Command_fuckoff extends FreedomCommand
FPlayer player = plugin.pl.getPlayer(playerSender);
if (!args[0].equals("on"))
if (args[0].equalsIgnoreCase("off"))
{
player.disableFuckoff();
}
else
{
double radius = 25.0;
if (args.length >= 2)
{
@ -39,12 +34,14 @@ public class Command_fuckoff extends FreedomCommand
{
}
}
player.setFuckoff(radius);
}
else
{
player.disableFuckoff();
}
msg("Fuckoff " + (player.isFuckOff() ? ("enabled. Radius: " + player.getFuckoffRadius() + ".") : "disabled."));
return true;
}
}
}

View File

@ -107,5 +107,4 @@ public class Command_health extends FreedomCommand
return (double)tickCount / ((double)elapsed / 1000.0);
}
}
}
}

View File

@ -153,7 +153,7 @@ public class Command_hubworld extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}
@ -178,7 +178,7 @@ public class Command_hubworld extends FreedomCommand
// TODO: Redo this properly
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
{
if (!(sender instanceof Player) || playerSender == null || !plugin.sl.isAdmin(playerSender))
if (!(sender instanceof Player) || playerSender == null || !plugin.al.isAdmin(playerSender))
{
throw new PermissionDeniedException();
}

View File

@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
@CommandParameters(description = "Reload the indefinite ban list.", usage = "/<command> reload", aliases = "ib")
@CommandParameters(description = "Reload the indefinite ban list.", usage = "/<command> <reload>", aliases = "ib")
public class Command_indefban extends FreedomCommand
{
@ -29,5 +29,4 @@ public class Command_indefban extends FreedomCommand
msg("Reloaded the indefinite ban list.");
return true;
}
}
}

View File

@ -16,7 +16,7 @@ import org.bukkit.potion.PotionEffectType;
@CommandParameters(description = "Shows (optionally clears) invisible players", usage = "/<command> [clear]")
public class Command_invis extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
@ -26,16 +26,20 @@ public class Command_invis extends FreedomCommand
{
if (args[0].equalsIgnoreCase("clear"))
{
if(!plugin.sl.isStaff(sender))
return noPerms();
else
if (!plugin.al.isAdmin(sender))
{
FUtil.staffAction(sender.getName(), "Clearing all invisibility potion effects from all players", true);
return noPerms();
}
else
{
FUtil.adminAction(sender.getName(), "Clearing all invisibility potion effects from all players", true);
clear = true;
}
}
else
{
return false;
}
}
List<String> players = new ArrayList<String>();
@ -43,10 +47,10 @@ public class Command_invis extends FreedomCommand
for (Player player : server.getOnlinePlayers())
{
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.sl.isVanished(player.getName()))
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.isVanished(player.getName()))
{
players.add(player.getName());
if (clear && !plugin.sl.isStaff(player))
if (clear && !plugin.al.isAdmin(player))
{
player.removePotionEffect((PotionEffectType.INVISIBILITY));
clears++;
@ -59,20 +63,26 @@ public class Command_invis extends FreedomCommand
msg("There are no invisible players");
return true;
}
if (clear)
{
msg("Cleared " + clears + " players");
}
else
{
msg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", "));
}
return true;
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isStaff(sender))
if (args.length == 1 && plugin.al.isAdmin(sender))
{
return Arrays.asList("clear");
}
return Collections.emptyList();
}

View File

@ -35,9 +35,9 @@ public class Command_invsee extends FreedomCommand
return true;
}
if (plugin.sl.isStaff(player) && !plugin.sl.isStaff(playerSender))
if (plugin.al.isAdmin(player) && !plugin.al.isAdmin(playerSender))
{
msg("You cannot see the inventory of staff members.", ChatColor.RED);
msg("You cannot see the inventory of admins.", ChatColor.RED);
return true;
}
@ -67,7 +67,7 @@ public class Command_invsee extends FreedomCommand
}
inv = player.getInventory();
playerSender.closeInventory();
if (!plugin.sl.isStaff(player))
if (!plugin.al.isAdmin(player))
{
FPlayer fPlayer = plugin.pl.getPlayer(playerSender);
fPlayer.setInvSee(true);

View File

@ -32,9 +32,9 @@ public class Command_jumppads extends FreedomCommand
return true;
}
if ("off".equals(args[0]))
if (args[0].equalsIgnoreCase("off"))
{
if(plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.OFF)
if (plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.OFF)
{
msg("Your jumppads are already disabled.");
return true;
@ -44,7 +44,7 @@ public class Command_jumppads extends FreedomCommand
}
else
{
if(plugin.jp.players.get(playerSender) != Jumppads.JumpPadMode.OFF)
if (plugin.jp.players.get(playerSender) != Jumppads.JumpPadMode.OFF)
{
msg("Your jumppads are already enabled.");
return true;
@ -65,7 +65,7 @@ public class Command_jumppads extends FreedomCommand
{
if ("off".equals(args[1]))
{
if(plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.MADGEEK)
if (plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.MADGEEK)
{
msg("Your jumppads are already set to normal mode.");
return true;
@ -75,7 +75,7 @@ public class Command_jumppads extends FreedomCommand
}
else
{
if(plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS)
if (plugin.jp.players.get(playerSender) == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS)
{
msg("Your jumppads are already set to normal and sideways mode.");
return true;
@ -95,7 +95,7 @@ public class Command_jumppads extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}

View File

@ -65,11 +65,11 @@ public class Command_kick extends FreedomCommand
{
if (reason != null)
{
FUtil.staffAction(sender.getName(), "Kicking " + player.getName() + " - Reason: " + reason, true);
FUtil.adminAction(sender.getName(), "Kicking " + player.getName() + " - Reason: " + reason, true);
}
else
{
FUtil.staffAction(sender.getName(), "Kicking " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Kicking " + player.getName(), true);
}
}
else

View File

@ -8,23 +8,23 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Kick all non-staff on server.", usage = "/<command>", aliases = "kickall")
@CommandParameters(description = "Kick all non-admins on server.", usage = "/<command>", aliases = "kickall")
public class Command_kicknoob extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.staffAction(sender.getName(), "Disconnecting all non-staff.", true);
FUtil.adminAction(sender.getName(), "Disconnecting all non-admins", true);
for (Player player : server.getOnlinePlayers())
{
if (!plugin.sl.isStaff(player))
if (!plugin.al.isAdmin(player))
{
player.kickPlayer(ChatColor.RED + "All non-staff were kicked by " + sender.getName() + ".");
player.kickPlayer(ChatColor.RED + "All non-admins were kicked by " + sender.getName() + ".");
}
}
return true;
}
}
}

View File

@ -60,8 +60,6 @@ public class Command_landmine extends FreedomCommand
plugin.lm.add(new Landmine(landmine.getLocation(), playerSender, radius));
msg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN);
return true;
}
}
}

View File

@ -42,4 +42,4 @@ public class Command_lastcmd extends FreedomCommand
return true;
}
}
}

View File

@ -22,7 +22,7 @@ public class Command_linkdiscord extends FreedomCommand
return true;
}
if (args.length > 1 && plugin.sl.isStaff(playerSender))
if (args.length > 1 && plugin.al.isAdmin(playerSender))
{
PlayerData playerData = plugin.pl.getData(args[0]);
if (playerData == null)
@ -58,4 +58,4 @@ public class Command_linkdiscord extends FreedomCommand
msg("Take this code and DM the server bot (" + plugin.dc.formatBotTag() + ") the code (do not put anything else in the message, only the code)");
return true;
}
}
}

View File

@ -5,8 +5,8 @@ import java.util.List;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffList;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.AdminList;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.StringUtils;
@ -42,13 +42,13 @@ public class Command_list extends FreedomCommand
{
case "-s":
{
listFilter = ListFilter.STAFF;
listFilter = ListFilter.ADMINS;
break;
}
case "-v":
{
checkRank(Rank.ADMIN);
listFilter = ListFilter.VANISHED_STAFF;
listFilter = ListFilter.VANISHED_ADMINS;
break;
}
case "-t":
@ -82,20 +82,20 @@ public class Command_list extends FreedomCommand
List<String> n = new ArrayList<>();
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(playerSender).getRank().isAtLeast(Rank.ADMIN))
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.al.isAdmin(sender) && plugin.al.getAdmin(playerSender).getRank().isAtLeast(Rank.ADMIN))
{
List<StaffMember> connectedStaffMembers = plugin.btb.getConnectedAdmins();
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
List<Admin> connectedAdmins = plugin.btb.getConnectedAdmins();
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedAdmins.size())
.append(ChatColor.BLUE)
.append(" staff members connected to telnet.");
for (StaffMember staffMember : connectedStaffMembers)
.append(" admins connected to telnet.");
for (Admin admin : connectedAdmins)
{
n.add(staffMember.getName());
n.add(admin.getName());
}
}
else
{
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - StaffList.vanished.size())
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - AdminList.vanished.size())
.append(ChatColor.BLUE)
.append(" out of a maximum ")
.append(ChatColor.RED)
@ -104,19 +104,19 @@ public class Command_list extends FreedomCommand
.append(" players online.");
for (Player p : server.getOnlinePlayers())
{
if (listFilter == ListFilter.STAFF && !plugin.sl.isStaff(p))
if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(p))
{
continue;
}
if (listFilter == ListFilter.STAFF && plugin.sl.isVanished(p.getName()))
if (listFilter == ListFilter.ADMINS && plugin.al.isVanished(p.getName()))
{
continue;
}
if (listFilter == ListFilter.VANISHED_STAFF && !plugin.sl.isVanished(p.getName()))
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.isVanished(p.getName()))
{
continue;
}
if (listFilter == ListFilter.IMPOSTORS && !plugin.sl.isStaffImpostor(p))
if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p))
{
continue;
}
@ -124,7 +124,7 @@ public class Command_list extends FreedomCommand
{
continue;
}
if (listFilter == ListFilter.PLAYERS && plugin.sl.isVanished(p.getName()))
if (listFilter == ListFilter.PLAYERS && plugin.al.isVanished(p.getName()))
{
continue;
}
@ -155,8 +155,8 @@ public class Command_list extends FreedomCommand
private enum ListFilter
{
PLAYERS,
STAFF,
VANISHED_STAFF,
ADMINS,
VANISHED_ADMINS,
TELNET_SESSIONS,
FAMOUS_PLAYERS,
IMPOSTORS

View File

@ -22,7 +22,7 @@ public class Command_lockup extends FreedomCommand
{
if (args[0].equalsIgnoreCase("all"))
{
FUtil.staffAction(sender.getName(), "Locking up all players", true);
FUtil.adminAction(sender.getName(), "Locking up all players", true);
for (Player player : server.getOnlinePlayers())
{
@ -32,7 +32,7 @@ public class Command_lockup extends FreedomCommand
}
else if (args[0].equalsIgnoreCase("purge"))
{
FUtil.staffAction(sender.getName(), "Unlocking all players", true);
FUtil.adminAction(sender.getName(), "Unlocking all players", true);
for (Player player : server.getOnlinePlayers())
{
cancelLockup(player);
@ -59,7 +59,7 @@ public class Command_lockup extends FreedomCommand
if (!silent)
{
FUtil.staffAction(sender.getName(), "Locking up " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Locking up " + player.getName(), true);
}
startLockup(player);
msg("Locked up " + player.getName() + ".");
@ -76,7 +76,7 @@ public class Command_lockup extends FreedomCommand
if (!silent)
{
FUtil.staffAction(sender.getName(), "Unlocking " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Unlocking " + player.getName(), true);
}
cancelLockup(player);
msg("Unlocked " + player.getName() + ".");
@ -132,4 +132,4 @@ public class Command_lockup extends FreedomCommand
}
}.runTaskTimer(plugin, 0L, 5L));
}
}
}

View File

@ -16,7 +16,7 @@ public class Command_loginmessage extends FreedomCommand
@Override
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.LOGIN_MESSAGES) && !isStaff(playerSender))
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.LOGIN_MESSAGES) && !isAdmin(playerSender))
{
msg("You did not purchase the ability to use login messages! Purchase the ability from the shop.", ChatColor.RED);
return true;

View File

@ -55,7 +55,7 @@ public class Command_makeopregion extends FreedomCommand
LocalSession session = plugin.web.getWorldEditPlugin().getSession(playerSender);
Region selection = null;
Region selection;
try
{
@ -91,7 +91,6 @@ public class Command_makeopregion extends FreedomCommand
regionManager.addRegion(region);
msg("Successfully created the region '" + name + "' for " + player.getName(), ChatColor.GREEN);
return true;
}
}
}

View File

@ -218,5 +218,4 @@ public class Command_manageshop extends FreedomCommand
}
return false;
}
}
}

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Manually verify someone", usage = "/<command> <playername>", aliases="mv")
@CommandParameters(description = "Manually verify someone", usage = "/<command> <playername>", aliases = "mv")
public class Command_manuallyverify extends FreedomCommand
{
@Override
@ -39,7 +39,7 @@ public class Command_manuallyverify extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Manually verifying player " + player.getName(), false);
FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false);
player.setOp(true);
player.sendMessage(YOU_ARE_OP);

View File

@ -153,7 +153,7 @@ public class Command_masterbuilderworld extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}
@ -178,7 +178,7 @@ public class Command_masterbuilderworld extends FreedomCommand
// TODO: Redo this properly
private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException
{
if (!(sender instanceof Player) || playerSender == null || !plugin.sl.isAdmin(playerSender))
if (!(sender instanceof Player) || playerSender == null || !plugin.al.isAdmin(playerSender))
{
throw new PermissionDeniedException();
}
@ -199,5 +199,4 @@ public class Command_masterbuilderworld extends FreedomCommand
super(string);
}
}
}

View File

@ -58,7 +58,7 @@ public class Command_mbconfig extends FreedomCommand
plugin.sql.addPlayer(data);
msg(counter + " IPs removed.");
msg(data.getIps().get(0) + " is now your only IP address");
FUtil.staffAction(sender.getName(), "Clearing my IPs", true);
FUtil.adminAction(sender.getName(), "Clearing my IPs", true);
return true;
}
case "clearip":
@ -118,7 +118,7 @@ public class Command_mbconfig extends FreedomCommand
if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player))
{
FUtil.staffAction(sender.getName(), "Re-adding " + data.getName() + " to the Master Builder list", true);
FUtil.adminAction(sender.getName(), "Re-adding " + data.getName() + " to the Master Builder list", true);
if (plugin.pl.getPlayer(player).getFreezeData().isFrozen())
{
@ -134,7 +134,7 @@ public class Command_mbconfig extends FreedomCommand
}
else if (!data.isMasterBuilder())
{
FUtil.staffAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
FUtil.adminAction(sender.getName(), "Adding " + data.getName() + " to the Master Builder list", true);
data.setMasterBuilder(true);
data.setVerification(true);
plugin.pl.save(data);
@ -171,7 +171,7 @@ public class Command_mbconfig extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true);
FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true);
data.setMasterBuilder(false);
if (data.getDiscordID() == null)
{

View File

@ -46,7 +46,7 @@ public class Command_mobpurge extends FreedomCommand
mobName = FUtil.formatName(type.name());
}
FUtil.staffAction(sender.getName(), "Purging all " + (type != null ? mobName + "s" : "mobs"), true);
FUtil.adminAction(sender.getName(), "Purging all " + (type != null ? mobName + "s" : "mobs"), true);
int count = plugin.ew.purgeMobs(type);
msg(count + " " + (type != null ? mobName : "mob") + FUtil.showS(count) + " removed.");
return true;

View File

@ -29,7 +29,7 @@ public class Command_mute extends FreedomCommand
return false;
}
if (args[0].equals("list"))
if (args[0].equalsIgnoreCase("list"))
{
msg("Muted players:");
FPlayer info;
@ -51,9 +51,9 @@ public class Command_mute extends FreedomCommand
return true;
}
if (args[0].equals("purge"))
if (args[0].equalsIgnoreCase("purge"))
{
FUtil.staffAction(sender.getName(), "Unmuting all players.", true);
FUtil.adminAction(sender.getName(), "Unmuting all players.", true);
FPlayer info;
int count = 0;
for (Player mp : server.getOnlinePlayers())
@ -71,15 +71,15 @@ public class Command_mute extends FreedomCommand
return true;
}
if (args[0].equals("all"))
if (args[0].equalsIgnoreCase("all"))
{
FUtil.staffAction(sender.getName(), "Muting all non-staff", true);
FUtil.adminAction(sender.getName(), "Muting all non-admins", true);
FPlayer playerdata;
int counter = 0;
for (Player player : server.getOnlinePlayers())
{
if (!plugin.sl.isStaff(player))
if (!plugin.al.isAdmin(player))
{
player.sendTitle(ChatColor.RED + "You've been muted globally.", ChatColor.YELLOW + "Please be patient and you will be unmuted shortly.", 20, 100, 60);
playerdata = plugin.pl.getPlayer(player);
@ -120,9 +120,9 @@ public class Command_mute extends FreedomCommand
}
FPlayer playerdata = plugin.pl.getPlayer(player);
if (plugin.sl.isStaff(player))
if (plugin.al.isAdmin(player))
{
msg(player.getName() + " is a staff member, and can't be muted.");
msg(player.getName() + " is an admin, and can't be muted.");
return true;
}
@ -140,7 +140,7 @@ public class Command_mute extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Muting " + player.getName(), true);
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
if (smite)
{
@ -163,7 +163,7 @@ public class Command_mute extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return null;
}

View File

@ -8,7 +8,7 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
@ -29,7 +29,7 @@ public class Command_myadmin extends FreedomCommand
}
Player init = null;
StaffMember target = getStaffMember(playerSender);
Admin target = getAdmin(playerSender);
Player targetPlayer = playerSender;
// -o switch
@ -44,10 +44,10 @@ public class Command_myadmin extends FreedomCommand
return true;
}
target = getStaffMember(targetPlayer);
target = getAdmin(targetPlayer);
if (target == null)
{
msg("That player is not a staff member", ChatColor.RED);
msg("That player is not an admin", ChatColor.RED);
return true;
}
@ -72,19 +72,19 @@ public class Command_myadmin extends FreedomCommand
if (init == null)
{
FUtil.staffAction(sender.getName(), "Clearing my IPs", true);
FUtil.adminAction(sender.getName(), "Clearing my IPs", true);
}
else
{
FUtil.staffAction(sender.getName(), "Clearing " + target.getName() + "'s IPs", true);
FUtil.adminAction(sender.getName(), "Clearing " + target.getName() + "'s IPs", true);
}
int counter = target.getIps().size() - 1;
target.clearIPs();
target.addIp(targetIp);
plugin.sl.save(target);
plugin.sl.updateTables();
plugin.al.save(target);
plugin.al.updateTables();
plugin.pl.syncIps(target);
msg(counter + " IPs removed.");
@ -120,16 +120,16 @@ public class Command_myadmin extends FreedomCommand
}
else
{
msg("You cannot remove that staff members current IP.");
msg("You cannot remove that admins current IP.");
}
return true;
}
FUtil.staffAction(sender.getName(), "Removing an IP" + (init == null ? "" : " from " + targetPlayer.getName() + "'s IPs"), true);
FUtil.adminAction(sender.getName(), "Removing an IP" + (init == null ? "" : " from " + targetPlayer.getName() + "'s IPs"), true);
target.removeIp(args[1]);
plugin.sl.save(target);
plugin.sl.updateTables();
plugin.al.save(target);
plugin.al.updateTables();
plugin.pl.syncIps(target);
@ -142,10 +142,10 @@ public class Command_myadmin extends FreedomCommand
{
String format = StringUtils.join(args, " ", 1, args.length);
target.setAcFormat(format);
plugin.sl.save(target);
plugin.sl.updateTables();
msg("Set staff chat format to \"" + format + "\".", ChatColor.GRAY);
String example = format.replace("%name%", "ExampleStaff").replace("%rank%", Rank.ADMIN.getAbbr()).replace("%rankcolor%", Rank.ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
plugin.al.save(target);
plugin.al.updateTables();
msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY);
String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", Rank.ADMIN.getAbbr()).replace("%rankcolor%", Rank.ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example));
return true;
}
@ -153,9 +153,9 @@ public class Command_myadmin extends FreedomCommand
case "clearscformat":
{
target.setAcFormat(null);
plugin.sl.save(target);
plugin.sl.updateTables();
msg("Cleared staff chat format.", ChatColor.GRAY);
plugin.al.save(target);
plugin.al.updateTables();
msg("Cleared admin chat format.", ChatColor.GRAY);
return true;
}
@ -198,7 +198,7 @@ public class Command_myadmin extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}
@ -225,7 +225,7 @@ public class Command_myadmin extends FreedomCommand
{
if (args[0].equals("clearip"))
{
List<String> ips = plugin.sl.getAdmin(sender).getIps();
List<String> ips = plugin.al.getAdmin(sender).getIps();
ips.remove(FUtil.getIp((Player)sender));
return ips;
}
@ -246,13 +246,13 @@ public class Command_myadmin extends FreedomCommand
{
if (args[0].equals("-o") && args[2].equals("clearip"))
{
StaffMember staffMember = plugin.sl.getEntryByName(args[1]);
if (staffMember != null)
Admin admin = plugin.al.getEntryByName(args[1]);
if (admin != null)
{
return staffMember.getIps();
return admin.getIps();
}
}
}
return FUtil.getPlayerList();
}
}
}

View File

@ -53,12 +53,12 @@ public class Command_nickclean extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Cleaning " + player.getName() + "'s nickname", false);
FUtil.adminAction(sender.getName(), "Cleaning " + player.getName() + "'s nickname", false);
cleanNickname(player);
return true;
}
FUtil.staffAction(sender.getName(), "Cleaning all nicknames", false);
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
for (final Player player : server.getOnlinePlayers())
{
cleanNickname(player);

View File

@ -41,11 +41,11 @@ public class Command_nickfilter extends FreedomCommand
player = getPlayerByDisplayName(displayName);
if (player == null || plugin.sl.isVanished(player.getName()) && !plugin.sl.isStaff(sender))
if (player == null || plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
{
player = getPlayerByDisplayNameAlt(displayName);
if (player == null || !plugin.sl.isVanished(player.getName()) && !plugin.sl.isStaff(sender))
if (player == null || !plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
{
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
return true;

View File

@ -56,7 +56,9 @@ public class Command_nickgradient extends FreedomCommand
from = " (From: " + FUtil.getHexStringOfAWTColor(awt1) + ")";
}
else
{
awt1 = java.awt.Color.decode(args[0]);
}
if (args[1].equalsIgnoreCase("random") ||
args[1].equalsIgnoreCase("r"))
{
@ -64,7 +66,9 @@ public class Command_nickgradient extends FreedomCommand
to = " (To: " + FUtil.getHexStringOfAWTColor(awt2) + ")";
}
else
{
awt2 = java.awt.Color.decode(args[1]);
}
}
catch (NumberFormatException ex)
{
@ -85,7 +89,6 @@ public class Command_nickgradient extends FreedomCommand
plugin.esb.setNickname(sender.getName(), outputNick);
msg("Your nickname is now: '" + outputNick + ChatColor.GRAY + "'" + from + to);
return true;
}
}
}

View File

@ -21,7 +21,7 @@ public class Command_nicknyan extends FreedomCommand
return false;
}
if ("off".equals(args[0]))
if (args[0].equalsIgnoreCase("off"))
{
plugin.esb.setNickname(sender.getName(), null);
msg("Nickname cleared.");
@ -67,7 +67,6 @@ public class Command_nicknyan extends FreedomCommand
plugin.esb.setNickname(sender.getName(), newNick.toString());
msg("Your nickname is now: " + newNick.toString());
return true;
}
}
}

View File

@ -46,67 +46,76 @@ public class Command_notes extends FreedomCommand
playerData = plugin.pl.getData(player);
}
if (args[1].equals("list"))
switch (args[1])
{
final StringBuilder noteList = new StringBuilder();
noteList.append(ChatColor.GREEN + "Player notes for " + playerData.getName() + ":");
int id = 1;
for (String note : playerData.getNotes())
case "list":
{
String noteLine = id + ". " + note;
noteList.append("\n" + ChatColor.GOLD + noteLine);
id++;
}
msg(noteList.toString());
return true;
}
else if (args[1].equals("add"))
{
if (args.length < 3)
{
return false;
}
String note = sender.getName() + ": " + StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
playerData.addNote(note);
plugin.pl.save(playerData);
msg("Note added.", ChatColor.GREEN);
return true;
}
else if (args[1].equals("remove"))
{
if (args.length < 3)
{
return false;
}
int id;
try
{
id = Integer.valueOf(args[2]);
}
catch (NumberFormatException e)
{
msg("Invalid number: " + args[2], ChatColor.RED);
final StringBuilder noteList = new StringBuilder();
noteList.append(ChatColor.GREEN + "Player notes for " + playerData.getName() + ":");
int id = 1;
for (String note : playerData.getNotes())
{
String noteLine = id + ". " + note;
noteList.append("\n" + ChatColor.GOLD + noteLine);
id++;
}
msg(noteList.toString());
return true;
}
id--;
if (playerData.removeNote(id))
case "add":
{
if (args.length < 3)
{
return false;
}
String note = sender.getName() + ": " + StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
playerData.addNote(note);
plugin.pl.save(playerData);
msg("Note removed.");
msg("Note added.", ChatColor.GREEN);
return true;
}
else
case "remove":
{
msg("No note with the ID of " + args[2] + " exists.", ChatColor.RED);
if (args.length < 3)
{
return false;
}
int id;
try
{
id = Integer.parseInt(args[2]);
}
catch (NumberFormatException e)
{
msg("Invalid number: " + args[2], ChatColor.RED);
return true;
}
id--;
if (playerData.removeNote(id))
{
plugin.pl.save(playerData);
msg("Note removed.");
}
else
{
msg("No note with the ID of " + args[2] + " exists.", ChatColor.RED);
}
return true;
}
case "clear":
{
int count = playerData.getNotes().size();
playerData.clearNotes();
plugin.pl.save(playerData);
msg("Cleared " + count + " notes.", ChatColor.GREEN);
return true;
}
return true;
}
else if (args[1].equals("clear"))
{
int count = playerData.getNotes().size();
playerData.clearNotes();
plugin.pl.save(playerData);
msg("Cleared " + count + " notes.", ChatColor.GREEN);
return true;
}
return false;
}
@ -128,4 +137,4 @@ public class Command_notes extends FreedomCommand
}
return Collections.emptyList();
}
}
}

View File

@ -36,7 +36,7 @@ public class Command_op extends FreedomCommand
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
{
if (!player.isOp() && !plugin.sl.isVanished(player.getName()))
if (!player.isOp() && !plugin.al.isVanished(player.getName()))
{
matchedPlayerNames.add(player.getName());
player.setOp(true);
@ -49,7 +49,7 @@ public class Command_op extends FreedomCommand
{
if (!silent)
{
FUtil.staffAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
FUtil.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
}
}
else

View File

@ -14,7 +14,7 @@ public class Command_opall extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.staffAction(sender.getName(), "Opping all players on the server", false);
FUtil.adminAction(sender.getName(), "Opping all players on the server", false);
for (Player player : server.getOnlinePlayers())
{
@ -27,4 +27,4 @@ public class Command_opall extends FreedomCommand
return true;
}
}
}

View File

@ -14,7 +14,7 @@ public class Command_opme extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.staffAction(sender.getName(), "Opping " + sender.getName(), false);
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
sender.setOp(true);
sender.sendMessage(FreedomCommand.YOU_ARE_OP);
return true;

View File

@ -20,7 +20,7 @@ public class Command_ops extends FreedomCommand
return false;
}
if (args[0].equals("count"))
if (args[0].equalsIgnoreCase("count"))
{
int totalOps = server.getOperators().size();
int onlineOps = 0;
@ -36,19 +36,18 @@ public class Command_ops extends FreedomCommand
msg("Online OPs: " + onlineOps);
msg("Offline OPs: " + (totalOps - onlineOps));
msg("Total OPs: " + totalOps);
return true;
}
if (args[0].equals("purge"))
if (args[0].equalsIgnoreCase("purge"))
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
noPerms();
return true;
}
FUtil.staffAction(sender.getName(), "Purging all operators", true);
FUtil.adminAction(sender.getName(), "Purging all operators", true);
for (OfflinePlayer player : server.getOperators())
{
@ -60,7 +59,6 @@ public class Command_ops extends FreedomCommand
}
return true;
}
return false;
}
}
}

View File

@ -38,7 +38,7 @@ public class Command_orbit extends FreedomCommand
if (args.length >= 2)
{
if (args[1].equals("stop"))
if (args[1].equalsIgnoreCase("stop"))
{
msg("Stopped orbiting " + player.getName());
playerdata.stopOrbiting();
@ -60,8 +60,7 @@ public class Command_orbit extends FreedomCommand
playerdata.startOrbiting(strength);
player.setVelocity(new Vector(0, strength, 0));
FUtil.staffAction(sender.getName(), "Orbiting " + player.getName(), false);
FUtil.adminAction(sender.getName(), "Orbiting " + player.getName(), false);
return true;
}
}
}

View File

@ -6,7 +6,7 @@ import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@ -41,12 +41,12 @@ public class Command_panel extends FreedomCommand
return false;
}
if (args[0].equals("create"))
if (args[0].equalsIgnoreCase("create"))
{
msg("Creating your Pterodactyl account...", ChatColor.GREEN);
StaffMember staffMember = getStaffMember(playerSender);
Admin admin = getAdmin(playerSender);
if (staffMember.getPteroID() != null)
if (admin.getPteroID() != null)
{
msg("You already have a Pterodactyl account.", ChatColor.RED);
return true;
@ -64,26 +64,26 @@ public class Command_panel extends FreedomCommand
plugin.ptero.addAccountToServer(id);
staffMember.setPteroID(id);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
admin.setPteroID(id);
plugin.al.save(admin);
plugin.al.updateTables();
plugin.dc.sendPteroInfo(playerData, username, password);
msg("Successfully created your Pterodactyl account. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
return true;
}
else if (args[0].equals("delete"))
else if (args[0].equalsIgnoreCase("delete"))
{
msg("Deleting your Pterodactyl account...", ChatColor.GREEN);
StaffMember staffMember = getStaffMember(playerSender);
Admin admin = getAdmin(playerSender);
if (staffMember.getPteroID() == null)
if (admin.getPteroID() == null)
{
msg("You do not have a Pterodactyl account.", ChatColor.RED);
return true;
}
boolean deleted = plugin.ptero.deleteAccount(staffMember.getPteroID());
boolean deleted = plugin.ptero.deleteAccount(admin.getPteroID());
if (!deleted)
{
@ -91,18 +91,18 @@ public class Command_panel extends FreedomCommand
return true;
}
staffMember.setPteroID(null);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
admin.setPteroID(null);
plugin.al.save(admin);
plugin.al.updateTables();
msg("Successfully deleted your Pterodactyl account.", ChatColor.GREEN);
return true;
}
/*else if (args[0].equals("resetpassword"))
{
StaffMember staffMember = getAdmin(playerSender);
Admin admin = getAdmin(playerSender);
if (staffMember.getAmpUsername() == null)
if (admin.getAmpUsername() == null)
{
msg("You do not have a Pterodactyl account.", ChatColor.RED);
return true;
@ -110,7 +110,7 @@ public class Command_panel extends FreedomCommand
msg("Resetting your password...", ChatColor.GREEN);
String id = staffMember.getPteroID();
String id = admin.getPteroID();
String password = FUtil.randomString(30);
plugin.ptero.setPassword(id, password);
plugin.dc.sendPteroInfo(playerData, null, password);
@ -125,12 +125,11 @@ public class Command_panel extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isAdmin(sender))
if (args.length == 1 && plugin.al.isSeniorAdmin(sender))
{
return Arrays.asList("create", "delete");
}
return Collections.emptyList();
}
}
}

View File

@ -15,7 +15,7 @@ public class Command_permissions extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length > 0 && args[0].equals("reload") && plugin.sl.isStaff(sender))
if (args.length > 0 && args[0].equalsIgnoreCase("reload") && plugin.al.isAdmin(sender))
{
plugin.permissions.load();
plugin.pem.loadPermissionNodes();

View File

@ -68,6 +68,7 @@ public class Command_playerverification extends FreedomCommand
switch (args[0].toLowerCase())
{
case "enable":
{
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
@ -87,8 +88,10 @@ public class Command_playerverification extends FreedomCommand
plugin.pl.save(data);
msg("Re-enabled Discord verification.", ChatColor.GREEN);
return true;
}
case "disable":
{
if (!data.hasVerification())
{
msg("Discord verification is already disabled for you.", ChatColor.RED);
@ -98,16 +101,20 @@ public class Command_playerverification extends FreedomCommand
plugin.pl.save(data);
msg("Disabled Discord verification.", ChatColor.GREEN);
return true;
}
case "status":
{
boolean enabled = target.hasVerification();
boolean specified = target.getDiscordID() != null;
msg(ChatColor.GRAY + "Discord Verification Enabled: " + (enabled ? ChatColor.GREEN + "true" : ChatColor.RED + "false"));
msg(ChatColor.GRAY + "Discord ID: " + (specified ? ChatColor.GREEN + target.getDiscordID() : ChatColor.RED + "not set"));
msg(ChatColor.GRAY + "Backup Codes: " + data.getBackupCodes().size() + "/" + "10");
return true;
}
case "genbackupcodes":
{
if (!plugin.dc.enabled)
{
msg("The Discord verification system is currently disabled.", ChatColor.RED);
@ -130,11 +137,12 @@ public class Command_playerverification extends FreedomCommand
msg("Failed to generate backup codes, please contact a developer (preferably Seth)", ChatColor.RED);
}
return true;
}
default:
return false;
}
}
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
@ -145,4 +153,4 @@ public class Command_playerverification extends FreedomCommand
return Collections.emptyList();
}
}
}

View File

@ -4,7 +4,7 @@ import java.time.Instant;
import java.util.Date;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.ActivityLogEntry;
import me.totalfreedom.totalfreedommod.admin.ActivityLogEntry;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;

View File

@ -135,7 +135,7 @@ public class Command_plugincontrol extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}
@ -190,4 +190,4 @@ public class Command_plugincontrol extends FreedomCommand
}
return null;
}
}
}

View File

@ -18,7 +18,7 @@ import org.bukkit.potion.PotionEffectType;
@CommandParameters(
description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).",
usage = "/<command> <list | clearall | clear [target name] | add <type> <duration> <amplifier> [target name]>",
aliases="effect")
aliases = "effect")
public class Command_potion extends FreedomCommand
{
@ -42,13 +42,13 @@ public class Command_potion extends FreedomCommand
}
else if (args[0].equalsIgnoreCase("clearall"))
{
if (!(plugin.sl.isStaff(sender) || senderIsConsole))
if (!(plugin.al.isAdmin(sender) || senderIsConsole))
{
noPerms();
return true;
}
FUtil.staffAction(sender.getName(), "Cleared all potion effects from all players", true);
FUtil.adminAction(sender.getName(), "Cleared all potion effects from all players", true);
for (Player target : server.getOnlinePlayers())
{
for (PotionEffect potion_effect : target.getActivePotionEffects())
@ -62,11 +62,11 @@ public class Command_potion extends FreedomCommand
if (args[0].equalsIgnoreCase("clear"))
{
Player target = playerSender;
if(args.length == 2)
if (args.length == 2)
{
if (!plugin.sl.isStaff(sender) && !target.equals(getPlayer(sender.getName())))
if (!plugin.al.isAdmin(sender) && !target.equals(getPlayer(sender.getName())))
{
msg(ChatColor.RED + "Only staff can clear potion effects from other players.");
msg(ChatColor.RED + "Only admins can clear potion effects from other players.");
return true;
}
target = getPlayer(args[1], true);
@ -103,15 +103,15 @@ public class Command_potion extends FreedomCommand
if (args.length == 5)
{
if (!plugin.sl.isStaff(sender) && !getPlayer(args[4]).equals(getPlayer(sender.getName())))
if (!plugin.al.isAdmin(sender) && !getPlayer(args[4]).equals(getPlayer(sender.getName())))
{
sender.sendMessage(ChatColor.RED + "Only staff can apply potion effects to other players.");
sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players.");
return true;
}
target = getPlayer(args[4]);
if (target == null || plugin.sl.isVanished(target.getName()) && !plugin.sl.isStaff(sender))
if (target == null || plugin.al.isVanished(target.getName()) && !plugin.al.isAdmin(sender))
{
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
return true;
@ -180,7 +180,7 @@ public class Command_potion extends FreedomCommand
case 1:
List<String> arguments = new ArrayList<>();
arguments.addAll(Arrays.asList("list", "clear", "add"));
if (plugin.sl.isStaff(sender))
if (plugin.al.isAdmin(sender))
{
arguments.add("clearall");
}
@ -189,7 +189,7 @@ public class Command_potion extends FreedomCommand
case 2:
if (args[0].equals("clear"))
{
if (plugin.sl.isStaff(sender))
if (plugin.al.isAdmin(sender))
{
return FUtil.getPlayerList();
}
@ -213,9 +213,9 @@ public class Command_potion extends FreedomCommand
return Arrays.asList("<amplifier>");
}
break;
case 5:
if (plugin.sl.isStaff(sender))
if (plugin.al.isAdmin(sender))
{
if (args[0].equals("add"))
{

View File

@ -5,7 +5,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.Bukkit;
@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Allows staff to see potions that are thrown.", usage = "/<command> <enable | on | disable | off> | history [player] <page>", aliases = "potspy")
@CommandParameters(description = "Allows admins to see potions that are thrown.", usage = "/<command> <enable | on | disable | off> | history [player] <page>", aliases = "potspy")
public class Command_potionspy extends FreedomCommand
{
private String titleText = "&8&m------------------&r &ePotionSpy &8&m------------------&r";
@ -28,11 +28,11 @@ public class Command_potionspy extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
StaffMember staffMember = plugin.sl.getAdmin(playerSender);
Admin admin = plugin.al.getAdmin(playerSender);
if (args.length <= 0)
{
setPotionSpyState(staffMember, !staffMember.getPotionSpy());
setPotionSpyState(admin, !admin.getPotionSpy());
return true;
}
else
@ -41,12 +41,12 @@ public class Command_potionspy extends FreedomCommand
{
case "enable":
case "on":
setPotionSpyState(staffMember, true);
setPotionSpyState(admin, true);
break;
case "disable":
case "off":
setPotionSpyState(staffMember, false);
setPotionSpyState(admin, false);
break;
case "history":
@ -115,7 +115,7 @@ public class Command_potionspy extends FreedomCommand
if (thrownPotions.isEmpty())
{
if(Bukkit.getPlayer(args[1]) != null)
if (Bukkit.getPlayer(args[1]) != null)
{
msg(sender, noPlayerRecord);
}
@ -176,18 +176,19 @@ public class Command_potionspy extends FreedomCommand
return true;
}
private void setPotionSpyState(StaffMember staffMember, boolean state)
private void setPotionSpyState(Admin admin, boolean state)
{
staffMember.setPotionSpy(state);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
msg("PotionSpy is now " + (staffMember.getPotionSpy() ? "enabled." : "disabled."));
admin.setPotionSpy(state);
plugin.al.save(admin);
plugin.al.updateTables();
msg("PotionSpy is now " + (admin.getPotionSpy() ? "enabled." : "disabled."));
}
/**
* Get the unix time difference in string format (1h, 30m, 15s).
*
* @param past The unix time at the start.
* @param now The current unix time.
* @param now The current unix time.
* @return A string that displays the time difference between the two unix time values.
*/
private String getUnixTimeDifference(long past, long now)
@ -219,4 +220,4 @@ public class Command_potionspy extends FreedomCommand
}
}
}
}
}

View File

@ -21,15 +21,21 @@ public class Command_premium extends FreedomCommand
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
final Player player = getPlayer(args[0]);
final String name;
if (player != null)
{
name = player.getName();
}
else
{
name = args[0];
}
new BukkitRunnable()
{
@ -49,16 +55,20 @@ public class Command_premium extends FreedomCommand
try
{
if (urlConnection.getResponseCode() == 200)
{
message = ChatColor.GREEN + "Yes";
}
else
message = ChatColor.RED + "No";
{
message = ChatColor.RED + "No";
}
FSync.playerMsg(sender, "Player " + name + " is premium: " + message);
}
catch (IOException e)
{
FSync.playerMsg(sender, ChatColor.RED + "There was an error on trying to connect to the API server");
FSync.playerMsg(sender, ChatColor.RED + "There was an error on trying to connect to the API server");
}
}
catch (IOException ex)
{
@ -70,4 +80,4 @@ public class Command_premium extends FreedomCommand
return true;
}
}
}

View File

@ -19,7 +19,7 @@ public class Command_purgeall extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.staffAction(sender.getName(), "Purging all player data", true);
FUtil.adminAction(sender.getName(), "Purging all player data", true);
// Purge entities
for (World world : Bukkit.getWorlds())

View File

@ -54,16 +54,14 @@ public class Command_rank extends FreedomCommand
Rank rank = plugin.rm.getRank(player);
StringBuilder sb = new StringBuilder();
sb
.append(ChatColor.AQUA)
sb.append(ChatColor.AQUA)
.append(player.getName())
.append(" is ")
.append(display.getColoredLoginMessage());
if (rank != display)
{
sb
.append(ChatColor.AQUA)
sb.append(ChatColor.AQUA)
.append(" (")
.append(rank.getColoredName())
.append(ChatColor.AQUA)

View File

@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME, blockHostConsole = true)
@CommandParameters(description = "Report a player for all staff to see.", usage = "/<command> <player> <reason>")
@CommandParameters(description = "Report a player for all admins to see.", usage = "/<command> <player> <reason>")
public class Command_report extends FreedomCommand
{
@ -38,9 +38,9 @@ public class Command_report extends FreedomCommand
}
}
if (plugin.sl.isStaff(player))
if (plugin.al.isAdmin(player))
{
msg(ChatColor.RED + "You can not report server staff.");
msg(ChatColor.RED + "You can not report admins.");
return true;
}

View File

@ -114,7 +114,7 @@ public class Command_ride extends FreedomCommand
return true;
}
if (playerData.getRideMode().equals("off") && !isStaff(sender))
if (playerData.getRideMode().equals("off") && !isAdmin(sender))
{
msg("That player cannot be ridden.", ChatColor.RED);
return true;

View File

@ -92,10 +92,10 @@ public class Command_ro extends FreedomCommand
names = StringUtils.join(materials, ", ");
}
World staffWorld = null;
World adminWorld = null;
try
{
staffWorld = plugin.wm.staffworld.getWorld();
adminWorld = plugin.wm.adminworld.getWorld();
}
catch (Exception ex)
{
@ -104,11 +104,11 @@ public class Command_ro extends FreedomCommand
int affected = 0;
if (targetPlayer == null)
{
FUtil.staffAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of all players... Brace for lag!", false);
FUtil.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of all players... Brace for lag!", false);
for (final Player player : server.getOnlinePlayers())
{
if (player.getWorld() == staffWorld)
if (player.getWorld() == adminWorld)
{
continue;
}
@ -121,9 +121,9 @@ public class Command_ro extends FreedomCommand
}
else
{
if (targetPlayer.getWorld() != staffWorld)
if (targetPlayer.getWorld() != adminWorld)
{
FUtil.staffAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of " + targetPlayer.getName(), false);
FUtil.adminAction(sender.getName(), "Removing all " + names + " within " + radius + " blocks of " + targetPlayer.getName(), false);
for (Material material : materials)
{
affected += replaceBlocks(targetPlayer.getLocation(), material, Material.AIR, radius);
@ -131,7 +131,7 @@ public class Command_ro extends FreedomCommand
}
}
FUtil.staffAction(sender.getName(), "Remove complete! " + affected + " blocks removed.", false);
FUtil.adminAction(sender.getName(), "Remove complete! " + affected + " blocks removed.", false);
return true;
}

View File

@ -9,7 +9,7 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
@ -18,8 +18,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "List, add, remove, or set the rank of staff, clean or reload the staff list, or view the info of staff.", usage = "/<command> <list | clean | reload | | setrank <username> <rank> | <add | remove | info> <username>>")
public class Command_slconfig extends FreedomCommand
@CommandParameters(description = "List, add, remove, or set the rank of admins, clean or reload the admin list, or view admin information.", usage = "/<command> <list | clean | reload | | setrank <username> <rank> | <add | remove | info> <username>>", aliases = "slconfig")
public class Command_saconfig extends FreedomCommand
{
@Override
@ -34,7 +34,7 @@ public class Command_slconfig extends FreedomCommand
{
case "list":
{
msg("Staff: " + StringUtils.join(plugin.sl.getAdminNames(), ", "), ChatColor.GOLD);
msg("Admins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
@ -43,9 +43,9 @@ public class Command_slconfig extends FreedomCommand
checkConsole();
checkRank(Rank.SENIOR_ADMIN);
FUtil.staffAction(sender.getName(), "Cleaning staff list", true);
plugin.sl.deactivateOldEntries(true);
msg("Staff: " + StringUtils.join(plugin.sl.getAdminNames(), ", "), ChatColor.GOLD);
FUtil.adminAction(sender.getName(), "Cleaning the admin list", true);
plugin.al.deactivateOldEntries(true);
msg("Admins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
@ -54,9 +54,9 @@ public class Command_slconfig extends FreedomCommand
{
checkRank(Rank.SENIOR_ADMIN);
FUtil.staffAction(sender.getName(), "Reloading the staff list", true);
plugin.sl.load();
msg("Staff list reloaded!");
FUtil.adminAction(sender.getName(), "Reloading the admin list", true);
plugin.al.load();
msg("Admin list reloaded!");
return true;
}
@ -89,19 +89,19 @@ public class Command_slconfig extends FreedomCommand
return true;
}
StaffMember staffMember = plugin.sl.getEntryByName(args[1]);
if (staffMember == null)
Admin admin = plugin.al.getEntryByName(args[1]);
if (admin == null)
{
msg("Unknown staff member: " + args[1]);
msg("Unknown admin: " + args[1]);
return true;
}
FUtil.staffAction(sender.getName(), "Setting " + staffMember.getName() + "'s rank to " + rank.getName(), true);
FUtil.adminAction(sender.getName(), "Setting " + admin.getName() + "'s rank to " + rank.getName(), true);
staffMember.setRank(rank);
plugin.sl.save(staffMember);
admin.setRank(rank);
plugin.al.save(admin);
Player player = getPlayer(staffMember.getName());
Player player = getPlayer(admin.getName());
if (player != null)
{
plugin.rm.updateDisplay(player);
@ -109,12 +109,12 @@ public class Command_slconfig extends FreedomCommand
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
Discord.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
Discord.syncRoles(admin, plugin.pl.getData(admin.getName()).getDiscordID());
}
plugin.ptero.updateAccountStatus(staffMember);
plugin.ptero.updateAccountStatus(admin);
msg("Set " + staffMember.getName() + "'s rank to " + rank.getName());
msg("Set " + admin.getName() + "'s rank to " + rank.getName());
return true;
}
@ -127,24 +127,24 @@ public class Command_slconfig extends FreedomCommand
checkRank(Rank.ADMIN);
StaffMember staffMember = plugin.sl.getEntryByName(args[1]);
Admin admin = plugin.al.getEntryByName(args[1]);
if (staffMember == null)
if (admin == null)
{
final Player player = getPlayer(args[1]);
if (player != null)
{
staffMember = plugin.sl.getAdmin(player);
admin = plugin.al.getAdmin(player);
}
}
if (staffMember == null)
if (admin == null)
{
msg("Staff member not found: " + args[1]);
msg("Admin not found: " + args[1]);
}
else
{
msg(staffMember.toString());
msg(admin.toString());
}
return true;
@ -160,7 +160,7 @@ public class Command_slconfig extends FreedomCommand
checkConsole();
checkRank(Rank.ADMIN);
// Player already staff?
// Player already admin?
final Player player = getPlayer(args[1]);
if (player == null)
@ -169,31 +169,31 @@ public class Command_slconfig extends FreedomCommand
return true;
}
if (plugin.sl.isStaff(player))
if (plugin.al.isAdmin(player))
{
msg("That player is already a staff member.");
msg("That player is already an admin.");
return true;
}
// Find the old staff entry
// Find the old admin entry
String name = player != null ? player.getName() : args[1];
StaffMember staffMember = null;
for (StaffMember loopStaffMember : plugin.sl.getAllStaffMembers())
Admin admin = null;
for (Admin loopAdmin : plugin.al.getAllAdmins())
{
if (loopStaffMember.getName().equalsIgnoreCase(name) || loopStaffMember.getIps().contains(FUtil.getIp(player)))
if (loopAdmin.getName().equalsIgnoreCase(name) || loopAdmin.getIps().contains(FUtil.getIp(player)))
{
staffMember = loopStaffMember;
admin = loopAdmin;
break;
}
}
if (plugin.pl.isPlayerImpostor(player))
{
msg("This player was labeled as a Player impostor and is not a staff member, therefore they cannot be added to the staff list.", ChatColor.RED);
msg("This player was labeled as a Player impostor and is not an admin, therefore they cannot be added to the admin list.", ChatColor.RED);
return true;
}
if (staffMember == null) // New staff member
if (admin == null) // New admin
{
if (player == null)
{
@ -201,39 +201,39 @@ public class Command_slconfig extends FreedomCommand
return true;
}
FUtil.staffAction(sender.getName(), "Adding " + player.getName() + " to the staff list", true);
staffMember = new StaffMember(player);
FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true);
admin = new Admin(player);
plugin.sl.addAdmin(staffMember);
plugin.al.addAdmin(admin);
plugin.rm.updateDisplay(player);
plugin.ptero.updateAccountStatus(staffMember);
plugin.ptero.updateAccountStatus(admin);
}
else // Existing staff member
else // Existing admin
{
FUtil.staffAction(sender.getName(), "Re-adding " + player.getName() + " to the staff list", true);
FUtil.adminAction(sender.getName(), "Re-adding " + player.getName() + " to the admin list", true);
if (player != null)
{
String oldName = staffMember.getName();
String oldName = admin.getName();
if (oldName != player.getName())
{
staffMember.setName(player.getName());
plugin.sql.updateStaffMemberName(oldName, staffMember.getName());
admin.setName(player.getName());
plugin.sql.updateAdminName(oldName, admin.getName());
}
staffMember.addIp(FUtil.getIp(player));
admin.addIp(FUtil.getIp(player));
}
staffMember.setActive(true);
staffMember.setLastLogin(new Date());
admin.setActive(true);
admin.setLastLogin(new Date());
if (plugin.sl.isVerifiedStaff(player))
if (plugin.al.isVerifiedAdmin(player))
{
plugin.sl.verifiedNoStaff.remove(player.getName());
plugin.sl.verifiedNoStaffIps.remove(player.getName());
plugin.al.verifiedNoAdmin.remove(player.getName());
plugin.al.verifiedNoAdminIps.remove(player.getName());
}
plugin.sl.save(staffMember);
plugin.sl.updateTables();
plugin.al.save(admin);
plugin.al.updateTables();
if (player != null)
{
plugin.rm.updateDisplay(player);
@ -241,9 +241,9 @@ public class Command_slconfig extends FreedomCommand
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
plugin.dc.syncRoles(staffMember, plugin.pl.getData(player).getDiscordID());
plugin.dc.syncRoles(admin, plugin.pl.getData(player).getDiscordID());
}
plugin.ptero.updateAccountStatus(staffMember);
plugin.ptero.updateAccountStatus(admin);
}
if (player != null)
@ -275,31 +275,31 @@ public class Command_slconfig extends FreedomCommand
checkRank(Rank.ADMIN);
Player player = getPlayer(args[1]);
StaffMember staffMember = player != null ? plugin.sl.getAdmin(player) : plugin.sl.getEntryByName(args[1]);
Admin admin = player != null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]);
if (staffMember == null)
if (admin == null)
{
msg("Staff member not found: " + args[1]);
msg("Admin not found: " + args[1]);
return true;
}
FUtil.staffAction(sender.getName(), "Removing " + staffMember.getName() + " from the staff list", true);
staffMember.setActive(false);
FUtil.adminAction(sender.getName(), "Removing " + admin.getName() + " from the admin list", true);
admin.setActive(false);
plugin.sl.save(staffMember);
plugin.sl.updateTables();
plugin.al.save(admin);
plugin.al.updateTables();
if (player != null)
{
plugin.rm.updateDisplay(player);
plugin.pl.getPlayer(player).setStaffChat(false);
plugin.pl.getPlayer(player).setAdminChat(false);
}
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
Discord.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
Discord.syncRoles(admin, plugin.pl.getData(admin.getName()).getDiscordID());
}
plugin.ptero.updateAccountStatus(staffMember);
plugin.ptero.updateAccountStatus(admin);
return true;
}
@ -318,16 +318,13 @@ public class Command_slconfig extends FreedomCommand
{
List<String> arguments = new ArrayList<>();
arguments.add("list");
if (plugin.sl.isStaff(sender))
if (plugin.al.isAdmin(sender))
{
arguments.add("info");
}
if (plugin.sl.isMod(sender))
{
arguments.add("add");
arguments.add("remove");
}
if (plugin.sl.isAdmin(sender))
if (plugin.al.isSeniorAdmin(sender))
{
arguments.add("reload");
arguments.add("clean");

View File

@ -53,7 +53,7 @@ public class Command_scare extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (args.length == 1 && plugin.sl.isStaff(sender))
if (args.length == 1 && plugin.al.isAdmin(sender))
{
return FUtil.getPlayerList();
}

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
@CommandParameters(description = "Check the status of the server, including opped players, staff, etc.", usage = "/<command>", aliases = "ss")
@CommandParameters(description = "Check the status of the server, including opped players, admins, etc.", usage = "/<command>", aliases = "ss")
public class Command_serverstats extends FreedomCommand
{
@ -17,7 +17,7 @@ public class Command_serverstats extends FreedomCommand
{
msg("-==" + ConfigEntry.SERVER_NAME.getString() + " server stats==-", ChatColor.GOLD);
msg("Total opped players: " + server.getOperators().size(), ChatColor.RED);
msg("Total staff: " + plugin.sl.getAllStaffMembers().size() + " (" + plugin.sl.getActiveStaffMembers().size() + " active)", ChatColor.BLUE);
msg("Total admins: " + plugin.al.getAllAdmins().size() + " (" + plugin.al.getActiveAdmins().size() + " active)", ChatColor.BLUE);
int bans = plugin.im.getIndefBans().size();
int nameBans = plugin.im.getNameBanCount();
int uuidBans = plugin.im.getUuidBanCount();

View File

@ -15,7 +15,6 @@ public class Command_setcompass extends FreedomCommand
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 3)
{
return false;
@ -23,7 +22,7 @@ public class Command_setcompass extends FreedomCommand
try
{
Location location = new Location(playerSender.getWorld(), Integer.valueOf(args[0]), Integer.valueOf(args[1]), Integer.valueOf(args[2]));
Location location = new Location(playerSender.getWorld(), Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
playerSender.setCompassTarget(location);
msg("Successfully set your compass coordinates to X: " + args[0] + ", Y: " + args[1] + ", Z: " + args[2] + ".", ChatColor.GREEN);
}
@ -34,4 +33,4 @@ public class Command_setcompass extends FreedomCommand
return true;
}
}
}

View File

@ -42,8 +42,8 @@ public class Command_setlevel extends FreedomCommand
playerSender.setLevel(new_level);
msg("Your XP level is now set to " + ChatColor.GOLD + Integer.toString(new_level));
msg("Your XP level is now set to " + ChatColor.GOLD + new_level);
return true;
}
}
}

View File

@ -43,8 +43,8 @@ public class Command_setlimit extends FreedomCommand
}
if (success)
{
FUtil.staffAction(sender.getName(), "Setting everyone's WorldEdit block modification limit to " + amount + ".", true);
FUtil.adminAction(sender.getName(), "Setting everyone's WorldEdit block modification limit to " + amount + ".", true);
}
return true;
}
}
}

View File

@ -59,8 +59,8 @@ public class Command_setplayerlimit extends FreedomCommand
}
if (success)
{
FUtil.staffAction(sender.getName(), "Setting " + player.getName() + "'s WorldEdit block modification limit to " + amount + ".", true);
FUtil.adminAction(sender.getName(), "Setting " + player.getName() + "'s WorldEdit block modification limit to " + amount + ".", true);
}
return true;
}
}
}

View File

@ -27,14 +27,14 @@ public class Command_settotalvotes extends FreedomCommand
return false;
}
int votes = 0;
int votes;
try
{
votes = Integer.parseInt(args[0]);
}
catch (NumberFormatException e)
{
msg("Invalid number: " + args[0]);
msg("Invalid number: " + args[0]);
return true;
}
@ -60,4 +60,4 @@ public class Command_settotalvotes extends FreedomCommand
return true;
}
}
}

View File

@ -21,7 +21,8 @@ public class Command_sit extends FreedomCommand
{
return false;
}
ArmorStand stand = (ArmorStand) playerSender.getWorld().spawnEntity(playerSender.getLocation().clone().subtract(0.0, 1.7, 0.0), EntityType.ARMOR_STAND);
ArmorStand stand = (ArmorStand)playerSender.getWorld().spawnEntity(playerSender.getLocation().clone().subtract(0.0, 1.7, 0.0), EntityType.ARMOR_STAND);
stand.setGravity(false);
stand.setAI(false);
stand.setVisible(false);
@ -31,4 +32,4 @@ public class Command_sit extends FreedomCommand
msg("You are now sitting.");
return true;
}
}
}

View File

@ -77,7 +77,7 @@ public class Command_spawnmob extends FreedomCommand
return true;
}
Location l = playerSender.getTargetBlock((Set<Material>)null, 30).getLocation().add(0, 1, 0);
Location l = playerSender.getTargetBlock(null, 30).getLocation().add(0, 1, 0);
World w = playerSender.getWorld();
msg("Spawning " + amount + " " + type.name().toLowerCase() + (amount > 1 ? "s." : "."));
@ -87,5 +87,4 @@ public class Command_spawnmob extends FreedomCommand
}
return true;
}
}
}

View File

@ -38,7 +38,6 @@ public class Command_spectator extends FreedomCommand
msg("Setting " + player.getName() + " to game mode spectator");
msg(player, sender.getName() + " set your game mode to spectator");
player.setGameMode(GameMode.SPECTATOR);
return true;
}
}
}

View File

@ -37,7 +37,7 @@ public class Command_survival extends FreedomCommand
targetPlayer.setGameMode(GameMode.SURVIVAL);
}
FUtil.staffAction(sender.getName(), "Changing everyone's gamemode to survival", false);
FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to survival", false);
msg("Your gamemode has been set to survival.");
return true;
}

View File

@ -41,238 +41,252 @@ public class Command_tag extends FreedomCommand
if (args.length == 1)
{
if ("list".equalsIgnoreCase(args[0]))
switch (args[0].toLowerCase())
{
msg("Tags for all online players:");
for (final Player player : server.getOnlinePlayers())
case "list":
{
if (plugin.sl.isVanished(player.getName()) && !plugin.sl.isStaff(sender))
{
continue;
}
final FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata.getTag() != null)
{
msg(player.getName() + ": " + playerdata.getTag());
}
}
msg("Tags for all online players:");
return true;
}
else if ("clearall".equalsIgnoreCase(args[0]))
{
if (!plugin.sl.isStaff(sender))
{
noPerms();
for (final Player player : server.getOnlinePlayers())
{
if (plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
{
continue;
}
final FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata.getTag() != null)
{
msg(player.getName() + ": " + playerdata.getTag());
}
}
return true;
}
FUtil.staffAction(sender.getName(), "Removing all tags", false);
int count = 0;
for (final Player player : server.getOnlinePlayers())
case "clearall":
{
final FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata.getTag() != null)
if (!plugin.al.isAdmin(sender))
{
count++;
playerdata.setTag(null);
noPerms();
return true;
}
}
msg(count + " tag(s) removed.");
FUtil.adminAction(sender.getName(), "Removing all tags", false);
return true;
}
else if ("off".equalsIgnoreCase(args[0]))
{
if (senderIsConsole)
{
msg("\"/tag off\" can't be used from the console. Use \"/tag clear <player>\" or \"/tag clearall\" instead.");
}
else
{
plugin.pl.getPlayer(playerSender).setTag(null);
if (save)
int count = 0;
for (final Player player : server.getOnlinePlayers())
{
save(playerSender, null);
final FPlayer playerdata = plugin.pl.getPlayer(player);
if (playerdata.getTag() != null)
{
count++;
playerdata.setTag(null);
}
}
msg("Your tag has been removed." + (save ? " (Saved)" : ""));
msg(count + " tag(s) removed.");
return true;
}
return true;
}
else
{
return false;
case "off":
{
if (senderIsConsole)
{
msg("\"/tag off\" can't be used from the console. Use \"/tag clear <player>\" or \"/tag clearall\" instead.");
}
else
{
plugin.pl.getPlayer(playerSender).setTag(null);
if (save)
{
save(playerSender, null);
}
msg("Your tag has been removed." + (save ? " (Saved)" : ""));
}
return true;
}
/*
{
return false;
}*/
}
}
else if (args.length >= 2)
{
if ("clear".equalsIgnoreCase(args[0]))
switch (args[0].toLowerCase())
{
if (!plugin.sl.isStaff(sender))
case "clear":
{
noPerms();
return true;
}
final Player player = getPlayer(args[1]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
plugin.pl.getPlayer(player).setTag(null);
if (save)
{
save(player, null);
}
msg("Removed " + player.getName() + "'s tag." + (save ? " (Saved)" : ""));
return true;
}
else if ("set".equalsIgnoreCase(args[0]))
{
if (senderIsConsole)
{
msg("\"/tag set\" can't be used from the console.");
return true;
}
final String inputTag = StringUtils.join(args, " ", 1, args.length);
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
new String[]
{
"" + ChatColor.COLOR_CHAR, "&k"
},
new String[]
{
"", ""
});
final String outputTag = FUtil.colorize(strippedTag);
int tagLimit = (plugin.sl.isStaff(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(outputTag).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + tagLimit + " characters).");
return true;
}
if (!plugin.sl.isStaff(sender))
{
for (String word : FORBIDDEN_WORDS)
if (!plugin.al.isAdmin(sender))
{
if (rawTag.contains(word))
noPerms();
return true;
}
final Player player = getPlayer(args[1]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
plugin.pl.getPlayer(player).setTag(null);
if (save)
{
save(player, null);
}
msg("Removed " + player.getName() + "'s tag." + (save ? " (Saved)" : ""));
return true;
}
case "set":
{
if (senderIsConsole)
{
msg("\"/tag set\" can't be used from the console.");
return true;
}
final String inputTag = StringUtils.join(args, " ", 1, args.length);
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
new String[]
{
"" + ChatColor.COLOR_CHAR, "&k"
},
new String[]
{
"", ""
});
final String outputTag = FUtil.colorize(strippedTag);
int tagLimit = (plugin.al.isAdmin(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(outputTag).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + tagLimit + " characters).");
return true;
}
if (!plugin.al.isAdmin(sender))
{
for (String word : FORBIDDEN_WORDS)
{
msg("That tag contains a forbidden word.");
return true;
if (rawTag.contains(word))
{
msg("That tag contains a forbidden word.");
return true;
}
}
}
}
plugin.pl.getPlayer(playerSender).setTag(outputTag);
if (save)
{
save(playerSender, strippedTag);
}
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : ""));
plugin.pl.getPlayer(playerSender).setTag(outputTag);
return true;
}
else if (args[0].equalsIgnoreCase("gradient"))
{
if (senderIsConsole)
{
msg("\"/tag gradient\" can't be used from the console.");
return true;
}
String from = "", to = "";
java.awt.Color awt1, awt2;
try
{
if (args[1].equalsIgnoreCase("random") ||
args[1].equalsIgnoreCase("r"))
if (save)
{
awt1 = FUtil.getRandomAWTColor();
from = " (From: " + FUtil.getHexStringOfAWTColor(awt1) + ")";
save(playerSender, strippedTag);
}
else
awt1 = java.awt.Color.decode(args[1]);
if (args[2].equalsIgnoreCase("random") ||
args[2].equalsIgnoreCase("r"))
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : ""));
return true;
}
case "gradient":
{
if (senderIsConsole)
{
awt2 = FUtil.getRandomAWTColor();
to = " (To: " + FUtil.getHexStringOfAWTColor(awt2) + ")";
msg("\"/tag gradient\" can't be used from the console.");
return true;
}
else
awt2 = java.awt.Color.decode(args[2]);
}
catch (NumberFormatException ex)
{
msg("Invalid hex values.");
return true;
}
Color c1 = FUtil.fromAWT(awt1);
Color c2 = FUtil.fromAWT(awt2);
String tag = StringUtils.join(args, " ", 3, args.length);
List<Color> gradient = FUtil.createColorGradient(c1, c2, tag.length());
String[] splitTag = tag.split("");
for (int i = 0; i < splitTag.length; i++)
{
splitTag[i] = net.md_5.bungee.api.ChatColor.of(FUtil.toAWT(gradient.get(i))) + splitTag[i];
}
tag = StringUtils.join(splitTag, "");
final String outputTag = FUtil.colorize(tag);
int tagLimit = (plugin.sl.isStaff(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(outputTag).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + tagLimit + " characters).");
return true;
}
if (!plugin.sl.isStaff(sender))
{
for (String word : FORBIDDEN_WORDS)
String from = "", to = "";
java.awt.Color awt1, awt2;
try
{
if (rawTag.contains(word))
if (args[1].equalsIgnoreCase("random") || args[1].equalsIgnoreCase("r"))
{
msg("That tag contains a forbidden word.");
return true;
awt1 = FUtil.getRandomAWTColor();
from = " (From: " + FUtil.getHexStringOfAWTColor(awt1) + ")";
}
else
{
awt1 = java.awt.Color.decode(args[1]);
}
if (args[2].equalsIgnoreCase("random") || args[2].equalsIgnoreCase("r"))
{
awt2 = FUtil.getRandomAWTColor();
to = " (To: " + FUtil.getHexStringOfAWTColor(awt2) + ")";
}
else
{
awt2 = java.awt.Color.decode(args[2]);
}
}
catch (NumberFormatException ex)
{
msg("Invalid hex values.");
return true;
}
Color c1 = FUtil.fromAWT(awt1);
Color c2 = FUtil.fromAWT(awt2);
String tag = StringUtils.join(args, " ", 3, args.length);
List<Color> gradient = FUtil.createColorGradient(c1, c2, tag.length());
String[] splitTag = tag.split("");
for (int i = 0; i < splitTag.length; i++)
{
splitTag[i] = net.md_5.bungee.api.ChatColor.of(FUtil.toAWT(gradient.get(i))) + splitTag[i];
}
tag = StringUtils.join(splitTag, "");
final String outputTag = FUtil.colorize(tag);
int tagLimit = (plugin.al.isAdmin(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(outputTag).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + tagLimit + " characters).");
return true;
}
if (!plugin.al.isAdmin(sender))
{
for (String word : FORBIDDEN_WORDS)
{
if (rawTag.contains(word))
{
msg("That tag contains a forbidden word.");
return true;
}
}
}
plugin.pl.getPlayer(playerSender).setTag(outputTag);
if (save)
{
save(playerSender, tag);
}
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : "") + from + to);
return true;
}
plugin.pl.getPlayer(playerSender).setTag(outputTag);
if (save)
default:
{
save(playerSender, tag);
return false;
}
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : "") + from + to);
return true;
}
else
{
return false;
}
}
else
{
return false;
}
return true;
}
public void save(Player player, String tag)

View File

@ -31,17 +31,17 @@ public class Command_tagnyan extends FreedomCommand
String tagStr = tag.toString();
int tagLimit = (plugin.sl.isStaff(sender) ? 30 : 20);
int tagLimit = (plugin.al.isAdmin(sender) ? 30 : 20);
final String rawTag = ChatColor.stripColor(tagStr).toLowerCase();
if (rawTag.length() > tagLimit)
{
msg("That tag is too long (Max is " + String.valueOf(tagLimit) + " characters).");
msg("That tag is too long (Max is " + tagLimit + " characters).");
return true;
}
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
for (String word : Command_tag.FORBIDDEN_WORDS)
{
@ -57,7 +57,6 @@ public class Command_tagnyan extends FreedomCommand
data.setTag(tagStr);
msg("Set tag to " + tag);
return true;
}
}
}

View File

@ -23,7 +23,7 @@ public class Command_tagrainbow extends FreedomCommand
final String tag = ChatColor.stripColor(FUtil.colorize(StringUtils.join(args, " ")));
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
final String rawTag = ChatColor.stripColor(tag).toLowerCase();
@ -44,9 +44,7 @@ public class Command_tagrainbow extends FreedomCommand
}
plugin.pl.getPlayer(playerSender).setTag(FUtil.rainbowify(tag));
msg("Set tag to " + tag);
return true;
}
}

View File

@ -93,7 +93,7 @@ public class Command_tban extends FreedomCommand
if (reason != null)
{
FUtil.staffAction(sender.getName(), "Tempbanning " + player.getName() + " for 5 minutes - Reason: " + reason, true);
FUtil.adminAction(sender.getName(), "Tempbanning " + player.getName() + " for 5 minutes - Reason: " + reason, true);
kick.append("\n")
.append(ChatColor.RED)
.append("Reason: ")
@ -102,7 +102,7 @@ public class Command_tban extends FreedomCommand
}
else
{
FUtil.staffAction(sender.getName(), "Tempbanning " + player.getName() + " for 5 minutes", true);
FUtil.adminAction(sender.getName(), "Tempbanning " + player.getName() + " for 5 minutes", true);
}
}
}

View File

@ -97,7 +97,7 @@ public class Command_tempban extends FreedomCommand
}
}
FUtil.staffAction(sender.getName(), message.toString(), true);
FUtil.adminAction(sender.getName(), message.toString(), true);
}
else
{

View File

@ -111,7 +111,7 @@ public class Command_toggle extends FreedomCommand
{
boolean active = !plugin.lp.isLockdownEnabled();
plugin.lp.setLockdownEnabled(active);
FUtil.staffAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true);
break;
}
@ -308,7 +308,7 @@ public class Command_toggle extends FreedomCommand
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
{
if (!plugin.sl.isStaff(sender))
if (!plugin.al.isAdmin(sender))
{
return Collections.emptyList();
}

View File

@ -15,7 +15,7 @@ public class Command_togglechat extends FreedomCommand
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
ConfigEntry.TOGGLE_CHAT.setBoolean(!ConfigEntry.TOGGLE_CHAT.getBoolean());
FUtil.staffAction(sender.getName(), "Chat " + (ConfigEntry.TOGGLE_CHAT.getBoolean() ? "enabled" : "disabled") + ".", true);
FUtil.adminAction(sender.getName(), "Chat " + (ConfigEntry.TOGGLE_CHAT.getBoolean() ? "enabled" : "disabled") + ".", true);
return true;
}
}
}

Some files were not shown because too many files have changed in this diff Show More