Cleanup code

This commit is contained in:
business-goose 2022-03-21 17:11:24 +00:00
parent ef4d2c46d8
commit 846c4350e7
36 changed files with 86 additions and 128 deletions

View file

@ -107,10 +107,7 @@ public class Admin
public void removeIp(String ip) public void removeIp(String ip)
{ {
if (ips.contains(ip)) ips.remove(ip);
{
ips.remove(ip);
}
} }
public void clearIPs() public void clearIPs()

View file

@ -153,7 +153,7 @@ public class AdminList
adminList.remove(oldUuid); adminList.remove(oldUuid);
final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true); final Configuration config = new Configuration(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true);
config.load(); config.load();
config.set("admins." + oldUuid.toString(), null); config.set("admins." + oldUuid, null);
config.save(); config.save();
} }
@ -433,12 +433,7 @@ public class AdminList
return true; return true;
} }
if (Bukkit.getOnlineMode() && superUUIDs.contains(UUIDManager.getUniqueId(player))) return Bukkit.getOnlineMode() && superUUIDs.contains(UUIDManager.getUniqueId(player));
{
return true;
}
return false;
} }
public static boolean isTelnetAdmin(CommandSender sender, boolean verifySuperadmin) public static boolean isTelnetAdmin(CommandSender sender, boolean verifySuperadmin)

View file

@ -12,7 +12,7 @@ import java.util.regex.Pattern;
public class Ban public class Ban
{ {
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
public static final Pattern IP_BAN_REGEX; public static final Pattern IP_BAN_REGEX;
public static final Pattern UUID_BAN_REGEX; public static final Pattern UUID_BAN_REGEX;
@ -93,10 +93,10 @@ public class Ban
complete = true; complete = true;
} }
public static enum BanType public enum BanType
{ {
IP, IP,
UUID; UUID
} }
public BanType getType() public BanType getType()
@ -191,12 +191,7 @@ public class Ban
return false; return false;
} }
if (!getSubject().equals(ban.getSubject())) return getSubject().equals(ban.getSubject());
{
return false;
}
return true;
} }
@Override @Override

View file

@ -165,7 +165,7 @@ public class CommandBlocker
return true; return true;
} }
public static enum CommandBlockerRank public enum CommandBlockerRank
{ {
ANYONE("a", 0), ANYONE("a", 0),
OP("o", 1), OP("o", 1),
@ -177,7 +177,7 @@ public class CommandBlocker
private final String token; private final String token;
private final int level; private final int level;
private CommandBlockerRank(String token, int level) CommandBlockerRank(String token, int level)
{ {
this.token = token; this.token = token;
this.level = level; this.level = level;
@ -231,14 +231,14 @@ public class CommandBlocker
} }
} }
public static enum CommandBlockerAction public enum CommandBlockerAction
{ {
BLOCK("b"), BLOCK("b"),
BLOCK_AND_EJECT("a"), BLOCK_AND_EJECT("a"),
BLOCK_UNKNOWN("u"); BLOCK_UNKNOWN("u");
private final String token; private final String token;
private CommandBlockerAction(String token) CommandBlockerAction(String token)
{ {
this.token = token; this.token = token;
} }

View file

@ -5,7 +5,7 @@ public enum AdminLevel {
// //
private final String friendlyName; private final String friendlyName;
private AdminLevel(String friendlyName) { AdminLevel(String friendlyName) {
this.friendlyName = friendlyName; this.friendlyName = friendlyName;
} }

View file

@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
public class Command_adminworld extends FreedomCommand { public class Command_adminworld extends FreedomCommand {
private enum CommandMode { private enum CommandMode {
TELEPORT, GUEST, TIME, WEATHER; TELEPORT, GUEST, TIME, WEATHER
} }
@Override @Override

View file

@ -72,7 +72,7 @@ public class Command_cbtool extends FreedomCommand {
return SubCommand.getByName(args[0]).getExecutable().execute(ArrayUtils.remove(args, 0)); return SubCommand.getByName(args[0]).getExecutable().execute(ArrayUtils.remove(args, 0));
} }
private static enum SubCommand private enum SubCommand
{ {
PLAYER_DETECT("playerdetect", new SubCommandExecutable() PLAYER_DETECT("playerdetect", new SubCommandExecutable()
{ {
@ -160,7 +160,7 @@ public class Command_cbtool extends FreedomCommand {
private final String name; private final String name;
private final SubCommandExecutable executable; private final SubCommandExecutable executable;
private SubCommand(String subCommandName, SubCommandExecutable subCommandImpl) SubCommand(String subCommandName, SubCommandExecutable subCommandImpl)
{ {
this.name = subCommandName; this.name = subCommandName;
this.executable = subCommandImpl; this.executable = subCommandImpl;
@ -192,7 +192,7 @@ public class Command_cbtool extends FreedomCommand {
private interface SubCommandExecutable private interface SubCommandExecutable
{ {
public String execute(String[] args) throws SubCommandFailureException; String execute(String[] args) throws SubCommandFailureException;
} }
private static class SubCommandFailureException extends Exception private static class SubCommandFailureException extends Exception

View file

@ -21,13 +21,13 @@ public class Command_cmdlist extends FreedomCommand {
for (Plugin targetPlugin : server.getPluginManager().getPlugins()) { for (Plugin targetPlugin : server.getPluginManager().getPlugins()) {
try { try {
PluginDescriptionFile desc = targetPlugin.getDescription(); PluginDescriptionFile desc = targetPlugin.getDescription();
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands(); Map<String, Map<String, Object>> map = desc.getCommands();
if (map != null) if (map != null)
{ {
for (Entry<String, Map<String, Object>> entry : map.entrySet()) for (Entry<String, Map<String, Object>> entry : map.entrySet())
{ {
String command_name = (String) entry.getKey(); String command_name = entry.getKey();
commands.add(command_name); commands.add(command_name);
} }
} }

View file

@ -41,7 +41,7 @@ public class Command_fr extends FreedomCommand {
} }
else else
{ {
if (args[0].toLowerCase().equals("purge")) if (args[0].equalsIgnoreCase("purge"))
{ {
setAllFrozen(false); setAllFrozen(false);
Utilities.adminAction(sender.getName(), "Unfreezing all players", false); Utilities.adminAction(sender.getName(), "Unfreezing all players", false);

View file

@ -31,10 +31,7 @@ public class Command_fuckoff extends FreedomCommand {
} }
} }
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(sender_p)) TotalFreedomMod.fuckoffEnabledFor.remove(sender_p);
{
TotalFreedomMod.fuckoffEnabledFor.remove(sender_p);
}
if (fuckoff_enabled) if (fuckoff_enabled)
{ {

View file

@ -26,7 +26,7 @@ public class Command_gadmin extends FreedomCommand {
SMITE("smite"); SMITE("smite");
private final String modeName; private final String modeName;
private GadminMode(String command) GadminMode(String command)
{ {
this.modeName = command; this.modeName = command;
} }

View file

@ -73,7 +73,7 @@ public class Command_jumppads extends FreedomCommand {
return true; return true;
} }
Utilities.adminAction(sender.getName(), "Setting Jumppads strength to: " + String.valueOf(strength), false); Utilities.adminAction(sender.getName(), "Setting Jumppads strength to: " + strength, false);
JumpPads.setStrength((strength / 10) + 0.1F); JumpPads.setStrength((strength / 10) + 0.1F);
} }
else else

View file

@ -14,10 +14,10 @@ import java.util.List;
@CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.ALL, source = SourceType.BOTH)
public class Command_list extends FreedomCommand { public class Command_list extends FreedomCommand {
private static enum ListFilter { private enum ListFilter {
ALL, ALL,
ADMINS, ADMINS,
IMPOSTORS; IMPOSTORS
} }
@Override @Override

View file

@ -76,7 +76,7 @@ public class Command_logs extends FreedomCommand {
{ {
if (responseCode == 200) if (responseCode == 200)
{ {
sender.sendMessage(ChatColor.GREEN + "Registration " + mode.toString() + "d."); sender.sendMessage(ChatColor.GREEN + "Registration " + mode + "d.");
} }
else else
{ {
@ -105,12 +105,12 @@ public class Command_logs extends FreedomCommand {
return true; return true;
} }
public static enum LogsRegistrationMode public enum LogsRegistrationMode
{ {
UPDATE("update"), DELETE("delete"); UPDATE("update"), DELETE("delete");
private final String mode; private final String mode;
private LogsRegistrationMode(String mode) LogsRegistrationMode(String mode)
{ {
this.mode = mode; this.mode = mode;
} }

View file

@ -23,7 +23,7 @@ public class Command_nf extends FreedomCommand {
final List<String> outputCommand = new ArrayList<String>(); final List<String> outputCommand = new ArrayList<String>();
if (args.length >= 1) { if (args.length >= 1) {
final List<String> argsList = Arrays.asList(args); final String[] argsList = args;
for (String arg : argsList) { for (String arg : argsList) {
Player player = null; Player player = null;

View file

@ -60,7 +60,7 @@ public class Command_nicknyan extends FreedomCommand {
EssentialsBridge.setNickname(sender.getName(), newNick.toString()); EssentialsBridge.setNickname(sender.getName(), newNick.toString());
playerMsg(sender, "Your nickname is now: " + newNick.toString()); playerMsg(sender, "Your nickname is now: " + newNick);
return true; return true;
} }

View file

@ -187,7 +187,7 @@ public class Command_saconfig extends FreedomCommand {
return true; return true;
} }
private static enum SAConfigMode { private enum SAConfigMode {
LIST("list", AdminLevel.OP, SourceType.BOTH, 1, 1), LIST("list", AdminLevel.OP, SourceType.BOTH, 1, 1),
CLEAN("clean", AdminLevel.SENIOR, SourceType.BOTH, 1, 1), CLEAN("clean", AdminLevel.SENIOR, SourceType.BOTH, 1, 1),
CLEARME("clearme", AdminLevel.SUPER, SourceType.ONLY_IN_GAME, 1, 2), CLEARME("clearme", AdminLevel.SUPER, SourceType.ONLY_IN_GAME, 1, 2),
@ -200,7 +200,7 @@ public class Command_saconfig extends FreedomCommand {
private final int minArgs; private final int minArgs;
private final int maxArgs; private final int maxArgs;
private SAConfigMode(String modeName, AdminLevel adminLevel, SourceType sourceType, int minArgs, int maxArgs) { SAConfigMode(String modeName, AdminLevel adminLevel, SourceType sourceType, int minArgs, int maxArgs) {
this.modeName = modeName; this.modeName = modeName;
this.adminLevel = adminLevel; this.adminLevel = adminLevel;
this.sourceType = sourceType; this.sourceType = sourceType;
@ -216,7 +216,7 @@ public class Command_saconfig extends FreedomCommand {
} }
boolean isSuperAdmin = AdminList.isSuperAdmin(sender); boolean isSuperAdmin = AdminList.isSuperAdmin(sender);
boolean isSeniorAdmin = isSuperAdmin ? AdminList.isSeniorAdmin(sender, false) : false; boolean isSeniorAdmin = isSuperAdmin && AdminList.isSeniorAdmin(sender, false);
for (final SAConfigMode mode : values()) for (final SAConfigMode mode : values())
{ {

View file

@ -34,7 +34,7 @@ public class Command_setlevel extends FreedomCommand {
sender_p.setLevel(new_level); sender_p.setLevel(new_level);
playerMsg(sender, "You have been set to level " + Integer.toString(new_level), ChatColor.AQUA); playerMsg(sender, "You have been set to level " + new_level, ChatColor.AQUA);
return true; return true;
} }

View file

@ -14,10 +14,7 @@ import java.util.List;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
public class Command_tag extends FreedomCommand { public class Command_tag extends FreedomCommand {
public static final List<String> FORBIDDEN_WORDS = Arrays.asList(new String[] public static final List<String> FORBIDDEN_WORDS = Arrays.asList("admin", "owner", "moderator", "developer", "console");
{
"admin", "owner", "moderator", "developer", "console"
});
@Override @Override
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {

View file

@ -16,7 +16,7 @@ import java.util.Date;
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
public class Command_tempban extends FreedomCommand { public class Command_tempban extends FreedomCommand {
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
@Override @Override
public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
@ -67,7 +67,7 @@ public class Command_tempban extends FreedomCommand {
BanManager.addIpBan(new Ban(Utilities.getIp(player), player.getName(), sender.getName(), expires, reason)); BanManager.addIpBan(new Ban(Utilities.getIp(player), player.getName(), sender.getName(), expires, reason));
BanManager.addUuidBan(new Ban(UUIDManager.getUniqueId(player), player.getName(), sender.getName(), expires, reason)); BanManager.addUuidBan(new Ban(UUIDManager.getUniqueId(player), player.getName(), sender.getName(), expires, reason));
player.kickPlayer(sender.getName() + " - " + message.toString()); player.kickPlayer(sender.getName() + " - " + message);
return true; return true;
} }

View file

@ -73,7 +73,7 @@ public class Command_tossmob extends FreedomCommand {
playerData.enableMobThrower(creature, speed); playerData.enableMobThrower(creature, speed);
playerMsg(sender, "MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN); playerMsg(sender, "MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN);
playerMsg(sender, "Left click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN); playerMsg(sender, "Left click while holding a " + Material.BONE + " to throw mobs!", ChatColor.GREEN);
playerMsg(sender, "Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN); playerMsg(sender, "Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN);
sender_p.setItemInHand(new ItemStack(Material.BONE, 1)); sender_p.setItemInHand(new ItemStack(Material.BONE, 1));

View file

@ -100,12 +100,7 @@ public abstract class FreedomCommand implements CommandExecutor {
return false; return false;
} }
if (blockHostConsole && Utilities.isFromHostConsole(commandSender.getName())) return !blockHostConsole || !Utilities.isFromHostConsole(commandSender.getName());
{
return false;
}
return true;
} }
final Player senderPlayer = (Player) commandSender; final Player senderPlayer = (Player) commandSender;
@ -120,22 +115,14 @@ public abstract class FreedomCommand implements CommandExecutor {
return false; return false;
} }
if (!PlayerData.getPlayerData(senderPlayer).isSuperadminIdVerified()) { return PlayerData.getPlayerData(senderPlayer).isSuperadminIdVerified();
return false;
}
return true;
} }
if (level == AdminLevel.SUPER && !isSuper) { if (level == AdminLevel.SUPER && !isSuper) {
return false; return false;
} }
if (level == AdminLevel.OP && !senderPlayer.isOp()) { return level != AdminLevel.OP || senderPlayer.isOp();
return false;
}
return true;
} }
public Player getPlayer(final String partialName) public Player getPlayer(final String partialName)

View file

@ -2,5 +2,5 @@ package me.StevenLawson.TotalFreedomMod.commands;
public enum SourceType public enum SourceType
{ {
ONLY_IN_GAME, ONLY_CONSOLE, BOTH; ONLY_IN_GAME, ONLY_CONSOLE, BOTH
} }

View file

@ -100,7 +100,7 @@ public enum ConfigurationEntry
private final Class<?> type; private final Class<?> type;
private final String configName; private final String configName;
private ConfigurationEntry(Class<?> type, String configName) { ConfigurationEntry(Class<?> type, String configName) {
this.type = type; this.type = type;
this.configName = configName; this.configName = configName;
} }

View file

@ -115,12 +115,12 @@ public class JumpPads
JumpPads.strength = strength; JumpPads.strength = strength;
} }
public static enum JumpPadMode public enum JumpPadMode
{ {
OFF(false), NORMAL(true), NORMAL_AND_SIDEWAYS(true), MADGEEK(true); OFF(false), NORMAL(true), NORMAL_AND_SIDEWAYS(true), MADGEEK(true);
private boolean on; private final boolean on;
private JumpPadMode(boolean on) JumpPadMode(boolean on)
{ {
this.on = on; this.on = on;
} }

View file

@ -74,7 +74,7 @@ public class GameRuleHandler
private final String gameRuleName; private final String gameRuleName;
private final TFM_GameRule_Value defaultValue; private final TFM_GameRule_Value defaultValue;
private TFM_GameRule(String gameRuleName, TFM_GameRule_Value defaultValue) TFM_GameRule(String gameRuleName, TFM_GameRule_Value defaultValue)
{ {
this.gameRuleName = gameRuleName; this.gameRuleName = gameRuleName;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
@ -96,7 +96,7 @@ public class GameRuleHandler
TRUE("true"), FALSE("false"); TRUE("true"), FALSE("false");
private final String value; private final String value;
private TFM_GameRule_Value(String value) TFM_GameRule_Value(String value)
{ {
this.value = value; this.value = value;
} }
@ -109,7 +109,7 @@ public class GameRuleHandler
public boolean toBoolean() public boolean toBoolean()
{ {
return (this.value.equals(TFM_GameRule_Value.TRUE.value) ? true : false); return (this.value.equals(TFM_GameRule_Value.TRUE.value));
} }
public static TFM_GameRule_Value fromBoolean(boolean in) public static TFM_GameRule_Value fromBoolean(boolean in)

View file

@ -129,7 +129,7 @@ public class HTTPDManager {
} }
} }
private static enum ModuleType { private enum ModuleType {
DUMP(new ModuleExecutable(false, "dump") { DUMP(new ModuleExecutable(false, "dump") {
@Override @Override
public Response getResponse(HTTPSession session) { public Response getResponse(HTTPSession session) {
@ -187,7 +187,7 @@ public class HTTPDManager {
// //
private final ModuleExecutable moduleExecutable; private final ModuleExecutable moduleExecutable;
private ModuleType(ModuleExecutable moduleExecutable) ModuleType(ModuleExecutable moduleExecutable)
{ {
this.moduleExecutable = moduleExecutable; this.moduleExecutable = moduleExecutable;
} }

View file

@ -261,7 +261,7 @@ public class HTTPDSchematicModule extends HTTPDModule {
return (out == null ? null : (out.trim().isEmpty() ? null : out.trim())); return (out == null ? null : (out.trim().isEmpty() ? null : out.trim()));
} }
private static enum ModuleMode private enum ModuleMode
{ {
LIST("list"), LIST("list"),
UPLOAD("upload"), UPLOAD("upload"),
@ -270,7 +270,7 @@ public class HTTPDSchematicModule extends HTTPDModule {
// //
private final String modeName; private final String modeName;
private ModuleMode(String modeName) ModuleMode(String modeName)
{ {
this.modeName = modeName; this.modeName = modeName;
} }

View file

@ -21,6 +21,7 @@ import java.net.SocketException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -563,8 +564,8 @@ public abstract class NanoHTTPD
*/ */
public static class DefaultTempFile implements TempFile public static class DefaultTempFile implements TempFile
{ {
private File file; private final File file;
private OutputStream fstream; private final OutputStream fstream;
public DefaultTempFile(String tempdir) throws IOException public DefaultTempFile(String tempdir) throws IOException
{ {
@ -612,7 +613,7 @@ public abstract class NanoHTTPD
/** /**
* Headers for the HTTP response. Use addHeader() to add lines. * Headers for the HTTP response. Use addHeader() to add lines.
*/ */
private Map<String, String> header = new HashMap<String, String>(); private final Map<String, String> header = new HashMap<String, String>();
/** /**
* The request method that spawned this response. * The request method that spawned this response.
*/ */
@ -647,14 +648,7 @@ public abstract class NanoHTTPD
{ {
this.status = status; this.status = status;
this.mimeType = mimeType; this.mimeType = mimeType;
try this.data = txt != null ? new ByteArrayInputStream(txt.getBytes(StandardCharsets.UTF_8)) : null;
{
this.data = txt != null ? new ByteArrayInputStream(txt.getBytes("UTF-8")) : null;
}
catch (java.io.UnsupportedEncodingException uee)
{
Log.severe(uee);
}
} }
/** /**
@ -1063,7 +1057,7 @@ public abstract class NanoHTTPD
String boundaryStartString = "boundary="; String boundaryStartString = "boundary=";
int boundaryContentStart = contentTypeHeader.indexOf(boundaryStartString) + boundaryStartString.length(); int boundaryContentStart = contentTypeHeader.indexOf(boundaryStartString) + boundaryStartString.length();
String boundary = contentTypeHeader.substring(boundaryContentStart, contentTypeHeader.length()); String boundary = contentTypeHeader.substring(boundaryContentStart);
if (boundary.startsWith("\"") && boundary.endsWith("\"")) if (boundary.startsWith("\"") && boundary.endsWith("\""))
{ {
boundary = boundary.substring(1, boundary.length() - 1); boundary = boundary.substring(1, boundary.length() - 1);
@ -1075,7 +1069,7 @@ public abstract class NanoHTTPD
{ {
// Handle application/x-www-form-urlencoded // Handle application/x-www-form-urlencoded
String postLine = ""; String postLine = "";
char pbuf[] = new char[512]; char[] pbuf = new char[512];
int read = in.read(pbuf); int read = in.read(pbuf);
while (read >= 0 && !postLine.endsWith("\r\n")) while (read >= 0 && !postLine.endsWith("\r\n"))
{ {
@ -1448,7 +1442,9 @@ public abstract class NanoHTTPD
public static class Cookie public static class Cookie
{ {
private String n, v, e; private final String n;
private final String v;
private final String e;
public Cookie(String name, String value, String expires) public Cookie(String name, String value, String expires)
{ {
@ -1494,8 +1490,8 @@ public abstract class NanoHTTPD
*/ */
public class CookieHandler implements Iterable<String> public class CookieHandler implements Iterable<String>
{ {
private HashMap<String, String> cookies = new HashMap<String, String>(); private final HashMap<String, String> cookies = new HashMap<String, String>();
private ArrayList<Cookie> queue = new ArrayList<Cookie>(); private final ArrayList<Cookie> queue = new ArrayList<Cookie>();
public CookieHandler(Map<String, String> httpHeaders) public CookieHandler(Map<String, String> httpHeaders)
{ {

View file

@ -742,10 +742,7 @@ public class PlayerListener implements Listener {
private void playerLeave(org.bukkit.entity.Player player) private void playerLeave(org.bukkit.entity.Player player)
{ {
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(player)) TotalFreedomMod.fuckoffEnabledFor.remove(player);
{
TotalFreedomMod.fuckoffEnabledFor.remove(player);
}
final PlayerData playerdata = PlayerData.getPlayerData(player); final PlayerData playerdata = PlayerData.getPlayerData(player);

View file

@ -79,7 +79,7 @@ public class PlayerData {
private int freecamPlaceCount = 0; private int freecamPlaceCount = 0;
private boolean isCaged = false; private boolean isCaged = false;
private Location cagePosition; private Location cagePosition;
private List<TFM_BlockData> cageHistory = new ArrayList<TFM_BlockData>(); private final List<TFM_BlockData> cageHistory = new ArrayList<TFM_BlockData>();
private Material cageOuterMaterial = Material.GLASS; private Material cageOuterMaterial = Material.GLASS;
private Material cageInnerMatterial = Material.AIR; private Material cageInnerMatterial = Material.AIR;
private boolean isOrbiting = false; private boolean isOrbiting = false;
@ -87,7 +87,7 @@ public class PlayerData {
private boolean mobThrowerEnabled = false; private boolean mobThrowerEnabled = false;
private EntityType mobThrowerEntity = EntityType.PIG; private EntityType mobThrowerEntity = EntityType.PIG;
private double mobThrowerSpeed = 4.0; private double mobThrowerSpeed = 4.0;
private List<LivingEntity> mobThrowerQueue = new ArrayList<LivingEntity>(); private final List<LivingEntity> mobThrowerQueue = new ArrayList<LivingEntity>();
private BukkitTask mp44ScheduleTask = null; private BukkitTask mp44ScheduleTask = null;
private boolean mp44Armed = false; private boolean mp44Armed = false;
private boolean mp44Firing = false; private boolean mp44Firing = false;
@ -568,7 +568,7 @@ public class PlayerData {
private class ArrowShooter extends BukkitRunnable private class ArrowShooter extends BukkitRunnable
{ {
private Player player; private final Player player;
private ArrowShooter(Player player) private ArrowShooter(Player player)
{ {

View file

@ -453,7 +453,7 @@ public class Utilities
method = EjectMethod.STRIKE_THREE; method = EjectMethod.STRIKE_THREE;
} }
Log.info("AutoEject -> name: " + player.getName() + " - player ip: " + ip + " - method: " + method.toString()); Log.info("AutoEject -> name: " + player.getName() + " - player ip: " + ip + " - method: " + method);
player.setOp(false); player.setOp(false);
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
@ -782,7 +782,7 @@ public class Utilities
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static boolean isFromHostConsole(String senderName) public static boolean isFromHostConsole(String senderName)
{ {
return ((List<String>) ConfigurationEntry.HOST_SENDER_NAMES.getList()).contains(senderName.toLowerCase()); return ConfigurationEntry.HOST_SENDER_NAMES.getList().contains(senderName.toLowerCase());
} }
public static List<String> removeDuplicates(List<String> oldList) public static List<String> removeDuplicates(List<String> oldList)
@ -890,7 +890,7 @@ public class Utilities
if (verbose) if (verbose)
{ {
Log.info("Downloaded " + url + " to " + output.toString() + "."); Log.info("Downloaded " + url + " to " + output + ".");
} }
} }
@ -1060,9 +1060,9 @@ public class Utilities
} }
} }
public static enum EjectMethod public enum EjectMethod
{ {
STRIKE_ONE, STRIKE_TWO, STRIKE_THREE; STRIKE_ONE, STRIKE_TWO, STRIKE_THREE
} }
public static class MethodTimer public static class MethodTimer

View file

@ -28,7 +28,7 @@ public final class AdminWorld extends CustomWorld
private final Map<CommandSender, Boolean> accessCache = new HashMap<CommandSender, Boolean>(); private final Map<CommandSender, Boolean> accessCache = new HashMap<CommandSender, Boolean>();
// //
private Long cacheLastCleared = null; private Long cacheLastCleared = null;
private Map<Player, Player> guestList = new HashMap<Player, Player>(); // Guest, Supervisor private final Map<Player, Player> guestList = new HashMap<Player, Player>(); // Guest, Supervisor
private WeatherMode weatherMode = WeatherMode.OFF; private WeatherMode weatherMode = WeatherMode.OFF;
private TimeOfDay timeOfDay = TimeOfDay.INHERIT; private TimeOfDay timeOfDay = TimeOfDay.INHERIT;
@ -215,7 +215,7 @@ public final class AdminWorld extends CustomWorld
return cached; return cached;
} }
public static enum WeatherMode public enum WeatherMode
{ {
OFF("off"), OFF("off"),
RAIN("rain"), RAIN("rain"),
@ -223,7 +223,7 @@ public final class AdminWorld extends CustomWorld
// //
private final List<String> aliases; private final List<String> aliases;
private WeatherMode(String aliases) WeatherMode(String aliases)
{ {
this.aliases = Arrays.asList(StringUtils.split(aliases, ",")); this.aliases = Arrays.asList(StringUtils.split(aliases, ","));
} }
@ -251,7 +251,7 @@ public final class AdminWorld extends CustomWorld
} }
} }
public static enum TimeOfDay public enum TimeOfDay
{ {
INHERIT(), INHERIT(),
SUNRISE("sunrise,morning", 0), SUNRISE("sunrise,morning", 0),
@ -262,13 +262,13 @@ public final class AdminWorld extends CustomWorld
private final int timeTicks; private final int timeTicks;
private final List<String> aliases; private final List<String> aliases;
private TimeOfDay() TimeOfDay()
{ {
this.timeTicks = 0; this.timeTicks = 0;
this.aliases = null; this.aliases = null;
} }
private TimeOfDay(String aliases, int timeTicks) TimeOfDay(String aliases, int timeTicks)
{ {
this.timeTicks = timeTicks; this.timeTicks = timeTicks;
this.aliases = Arrays.asList(StringUtils.split(aliases, ",")); this.aliases = Arrays.asList(StringUtils.split(aliases, ","));

View file

@ -64,7 +64,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
if (id.length() > 0) if (id.length() > 0)
{ {
String tokens[] = id.split("[,]"); String[] tokens = id.split("[,]");
if ((tokens.length % 2) != 0) if ((tokens.length % 2) != 0)
{ {
@ -80,7 +80,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
height = 64; height = 64;
} }
String materialTokens[] = tokens[i + 1].split("[:]", 2); String[] materialTokens = tokens[i + 1].split("[:]", 2);
byte dataValue = 0; byte dataValue = 0;
if (materialTokens.length == 2) if (materialTokens.length == 2)
{ {
@ -163,7 +163,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
} }
catch (Exception e) catch (Exception e)
{ {
log.severe("[CleanroomGenerator] Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e.toString()); log.severe("[CleanroomGenerator] Error parsing CleanroomGenerator ID '" + id + "'. using defaults '64,1': " + e);
e.printStackTrace(); e.printStackTrace();
layerDataValues = null; layerDataValues = null;
layer = new short[65]; layer = new short[65];
@ -209,7 +209,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
{ {
if (layerDataValues != null) if (layerDataValues != null)
{ {
return Arrays.asList((BlockPopulator) new CleanroomBlockPopulator(layerDataValues)); return Arrays.asList(new CleanroomBlockPopulator(layerDataValues));
} }
else else
{ {

View file

@ -168,10 +168,7 @@ public class RollbackManager
} }
} }
if (REMOVE_ROLLBACK_HISTORY.contains(playerName.toLowerCase())) REMOVE_ROLLBACK_HISTORY.remove(playerName.toLowerCase());
{
REMOVE_ROLLBACK_HISTORY.remove(playerName.toLowerCase());
}
return count; return count;
} }
@ -216,7 +213,7 @@ public class RollbackManager
BLOCK_BREAK("broke"); BLOCK_BREAK("broke");
private final String action; private final String action;
private EntryType(String action) EntryType(String action)
{ {
this.action = action; this.action = action;
} }

View file

@ -52,7 +52,7 @@ public class SQLite extends Database
try try
{ {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
connection = DriverManager.getConnection("jdbc:sqlite:" + plugin.getDataFolder().toPath().toString() + "/" + dbLocation); connection = DriverManager.getConnection("jdbc:sqlite:" + plugin.getDataFolder().toPath() + "/" + dbLocation);
} }
catch (SQLException e) catch (SQLException e)
{ {