Minor cleanup in ArenaMaster.

Removes unused imports and fields, trailing whitespace.
This commit is contained in:
Andreas Troelsen
2018-08-10 23:23:33 +02:00
parent 2081405d3b
commit a1e802c6f0
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -36,13 +35,12 @@ public class ArenaMasterImpl implements ArenaMaster
private List<Arena> arenas; private List<Arena> arenas;
private Map<Player, Arena> arenaMap; private Map<Player, Arena> arenaMap;
private Arena selectedArena;
private Map<String, ArenaClass> classes; private Map<String, ArenaClass> classes;
private Set<String> allowedCommands; private Set<String> allowedCommands;
private SpawnsPets spawnsPets; private SpawnsPets spawnsPets;
private boolean enabled; private boolean enabled;
private JoinInterruptTimer joinInterruptTimer; private JoinInterruptTimer joinInterruptTimer;
@@ -134,7 +132,7 @@ public class ArenaMasterImpl implements ArenaMaster
public List<Arena> getEnabledArenas() { public List<Arena> getEnabledArenas() {
return getEnabledArenas(arenas); return getEnabledArenas(arenas);
} }
public List<Arena> getEnabledArenas(List<Arena> arenas) { public List<Arena> getEnabledArenas(List<Arena> arenas) {
List<Arena> result = new ArrayList<>(arenas.size()); List<Arena> result = new ArrayList<>(arenas.size());
for (Arena arena : arenas) for (Arena arena : arenas)
@@ -301,7 +299,6 @@ public class ArenaMasterImpl implements ArenaMaster
ConfigurationSection section = makeSection(plugin.getConfig(), "classes"); ConfigurationSection section = makeSection(plugin.getConfig(), "classes");
ConfigUtils.addIfEmpty(plugin, "classes.yml", section); ConfigUtils.addIfEmpty(plugin, "classes.yml", section);
// Establish the map. // Establish the map.
classes = new HashMap<>(); classes = new HashMap<>();
Set<String> classNames = section.getKeys(false); Set<String> classNames = section.getKeys(false);
@@ -334,7 +331,7 @@ public class ArenaMasterImpl implements ArenaMaster
plugin.getLogger().severe("Failed to load class '" + classname + "'."); plugin.getLogger().severe("Failed to load class '" + classname + "'.");
return null; return null;
} }
// Check if weapons and armor for this class should be unbreakable // Check if weapons and armor for this class should be unbreakable
boolean weps = section.getBoolean("unbreakable-weapons", true); boolean weps = section.getBoolean("unbreakable-weapons", true);
boolean arms = section.getBoolean("unbreakable-armor", true); boolean arms = section.getBoolean("unbreakable-armor", true);
@@ -502,13 +499,13 @@ public class ArenaMasterImpl implements ArenaMaster
if (arenanames == null || arenanames.isEmpty()) { if (arenanames == null || arenanames.isEmpty()) {
createArenaNode(section, "default", plugin.getServer().getWorlds().get(0), false); createArenaNode(section, "default", plugin.getServer().getWorlds().get(0), false);
} }
arenas = new ArrayList<>(); arenas = new ArrayList<>();
for (World w : Bukkit.getServer().getWorlds()) { for (World w : Bukkit.getServer().getWorlds()) {
loadArenasInWorld(w.getName()); loadArenasInWorld(w.getName());
} }
} }
public void loadArenasInWorld(String worldName) { public void loadArenasInWorld(String worldName) {
FileConfiguration config = plugin.getConfig(); FileConfiguration config = plugin.getConfig();
Set<String> arenaNames = config.getConfigurationSection("arenas").getKeys(false); Set<String> arenaNames = config.getConfigurationSection("arenas").getKeys(false);
@@ -518,14 +515,14 @@ public class ArenaMasterImpl implements ArenaMaster
for (String arenaName : arenaNames) { for (String arenaName : arenaNames) {
Arena arena = getArenaWithName(arenaName); Arena arena = getArenaWithName(arenaName);
if (arena != null) continue; if (arena != null) continue;
String arenaWorld = config.getString("arenas." + arenaName + ".settings.world", ""); String arenaWorld = config.getString("arenas." + arenaName + ".settings.world", "");
if (!arenaWorld.equals(worldName)) continue; if (!arenaWorld.equals(worldName)) continue;
loadArena(arenaName); loadArena(arenaName);
} }
} }
public void unloadArenasInWorld(String worldName) { public void unloadArenasInWorld(String worldName) {
FileConfiguration config = plugin.getConfig(); FileConfiguration config = plugin.getConfig();
Set<String> arenaNames = config.getConfigurationSection("arenas").getKeys(false); Set<String> arenaNames = config.getConfigurationSection("arenas").getKeys(false);
@@ -535,10 +532,10 @@ public class ArenaMasterImpl implements ArenaMaster
for (String arenaName : arenaNames) { for (String arenaName : arenaNames) {
Arena arena = getArenaWithName(arenaName); Arena arena = getArenaWithName(arenaName);
if (arena == null) continue; if (arena == null) continue;
String arenaWorld = arena.getWorld().getName(); String arenaWorld = arena.getWorld().getName();
if (!arenaWorld.equals(worldName)) continue; if (!arenaWorld.equals(worldName)) continue;
arena.forceEnd(); arena.forceEnd();
arenas.remove(arena); arenas.remove(arena);
} }