Embrace Java 7's diamond operator project-wide.
This commit is contained in:
@@ -36,10 +36,10 @@ public class ArenaClass
|
|||||||
this.configName = name;
|
this.configName = name;
|
||||||
this.lowercaseName = name.toLowerCase().replace(" ", "");
|
this.lowercaseName = name.toLowerCase().replace(" ", "");
|
||||||
|
|
||||||
this.items = new ArrayList<ItemStack>();
|
this.items = new ArrayList<>();
|
||||||
this.armor = new ArrayList<ItemStack>(4);
|
this.armor = new ArrayList<>(4);
|
||||||
this.perms = new HashMap<String,Boolean>();
|
this.perms = new HashMap<>();
|
||||||
this.lobbyperms = new HashMap<String,Boolean>();
|
this.lobbyperms = new HashMap<>();
|
||||||
|
|
||||||
this.unbreakableWeapons = unbreakableWeapons;
|
this.unbreakableWeapons = unbreakableWeapons;
|
||||||
this.unbreakableArmor = unbreakableArmor;
|
this.unbreakableArmor = unbreakableArmor;
|
||||||
@@ -137,7 +137,7 @@ public class ArenaClass
|
|||||||
* @param stacks a list of items
|
* @param stacks a list of items
|
||||||
*/
|
*/
|
||||||
public void setItems(List<ItemStack> stacks) {
|
public void setItems(List<ItemStack> stacks) {
|
||||||
this.items = new ArrayList<ItemStack>(stacks.size());
|
this.items = new ArrayList<>(stacks.size());
|
||||||
for (ItemStack stack : stacks) {
|
for (ItemStack stack : stacks) {
|
||||||
addItem(stack);
|
addItem(stack);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class ArenaImpl implements Arena
|
|||||||
private RewardManager rewardManager;
|
private RewardManager rewardManager;
|
||||||
private ClassLimitManager limitManager;
|
private ClassLimitManager limitManager;
|
||||||
private Map<Player,ArenaPlayer> arenaPlayerMap;
|
private Map<Player,ArenaPlayer> arenaPlayerMap;
|
||||||
private Map<Player,PlayerData> playerData = new HashMap<Player,PlayerData>();
|
private Map<Player,PlayerData> playerData = new HashMap<>();
|
||||||
|
|
||||||
private Set<Player> arenaPlayers, lobbyPlayers, readyPlayers, specPlayers, deadPlayers;
|
private Set<Player> arenaPlayers, lobbyPlayers, readyPlayers, specPlayers, deadPlayers;
|
||||||
private Set<Player> randoms;
|
private Set<Player> randoms;
|
||||||
@@ -155,17 +155,17 @@ public class ArenaImpl implements Arena
|
|||||||
this.leaderboard = new Leaderboard(plugin, this, region.getLeaderboard());
|
this.leaderboard = new Leaderboard(plugin, this, region.getLeaderboard());
|
||||||
|
|
||||||
// Player stuff
|
// Player stuff
|
||||||
this.arenaPlayerMap = new HashMap<Player,ArenaPlayer>();
|
this.arenaPlayerMap = new HashMap<>();
|
||||||
this.arenaPlayers = new HashSet<Player>();
|
this.arenaPlayers = new HashSet<>();
|
||||||
this.lobbyPlayers = new HashSet<Player>();
|
this.lobbyPlayers = new HashSet<>();
|
||||||
this.readyPlayers = new HashSet<Player>();
|
this.readyPlayers = new HashSet<>();
|
||||||
this.specPlayers = new HashSet<Player>();
|
this.specPlayers = new HashSet<>();
|
||||||
this.deadPlayers = new HashSet<Player>();
|
this.deadPlayers = new HashSet<>();
|
||||||
this.randoms = new HashSet<Player>();
|
this.randoms = new HashSet<>();
|
||||||
|
|
||||||
// Classes, items and permissions
|
// Classes, items and permissions
|
||||||
this.classes = plugin.getArenaMaster().getClasses();
|
this.classes = plugin.getArenaMaster().getClasses();
|
||||||
this.attachments = new HashMap<Player,PermissionAttachment>();
|
this.attachments = new HashMap<>();
|
||||||
this.limitManager = new ClassLimitManager(this, classes, makeSection(section, "class-limits"));
|
this.limitManager = new ClassLimitManager(this, classes, makeSection(section, "class-limits"));
|
||||||
|
|
||||||
String defaultClassName = settings.getString("default-class", null);
|
String defaultClassName = settings.getString("default-class", null);
|
||||||
@@ -174,10 +174,10 @@ public class ArenaImpl implements Arena
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Blocks and pets
|
// Blocks and pets
|
||||||
this.repairQueue = new PriorityBlockingQueue<Repairable>(100, new RepairableComparator());
|
this.repairQueue = new PriorityBlockingQueue<>(100, new RepairableComparator());
|
||||||
this.blocks = new HashSet<Block>();
|
this.blocks = new HashSet<>();
|
||||||
this.repairables = new LinkedList<Repairable>();
|
this.repairables = new LinkedList<>();
|
||||||
this.containables = new LinkedList<Repairable>();
|
this.containables = new LinkedList<>();
|
||||||
|
|
||||||
// Monster stuff
|
// Monster stuff
|
||||||
this.monsterManager = new MonsterManager();
|
this.monsterManager = new MonsterManager();
|
||||||
@@ -607,7 +607,7 @@ public class ArenaImpl implements Arena
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Set operations.
|
// Set operations.
|
||||||
Set<Player> tmp = new HashSet<Player>();
|
Set<Player> tmp = new HashSet<>();
|
||||||
tmp.addAll(lobbyPlayers);
|
tmp.addAll(lobbyPlayers);
|
||||||
tmp.removeAll(readyPlayers);
|
tmp.removeAll(readyPlayers);
|
||||||
|
|
||||||
@@ -1298,7 +1298,7 @@ public class ArenaImpl implements Arena
|
|||||||
public void assignRandomClass(Player p)
|
public void assignRandomClass(Player p)
|
||||||
{
|
{
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
List<String> classes = new LinkedList<String>(this.classes.keySet());
|
List<String> classes = new LinkedList<>(this.classes.keySet());
|
||||||
|
|
||||||
String className = classes.remove(r.nextInt(classes.size()));
|
String className = classes.remove(r.nextInt(classes.size()));
|
||||||
while (!plugin.has(p, "mobarena.classes." + className))
|
while (!plugin.has(p, "mobarena.classes." + className))
|
||||||
@@ -1480,7 +1480,7 @@ public class ArenaImpl implements Arena
|
|||||||
@Override
|
@Override
|
||||||
public List<Player> getAllPlayers()
|
public List<Player> getAllPlayers()
|
||||||
{
|
{
|
||||||
List<Player> result = new LinkedList<Player>();
|
List<Player> result = new LinkedList<>();
|
||||||
result.addAll(arenaPlayers);
|
result.addAll(arenaPlayers);
|
||||||
result.addAll(lobbyPlayers);
|
result.addAll(lobbyPlayers);
|
||||||
result.addAll(specPlayers);
|
result.addAll(specPlayers);
|
||||||
@@ -1514,7 +1514,7 @@ public class ArenaImpl implements Arena
|
|||||||
@Override
|
@Override
|
||||||
public List<Player> getNonreadyPlayers()
|
public List<Player> getNonreadyPlayers()
|
||||||
{
|
{
|
||||||
List<Player> result = new LinkedList<Player>();
|
List<Player> result = new LinkedList<>();
|
||||||
result.addAll(lobbyPlayers);
|
result.addAll(lobbyPlayers);
|
||||||
result.removeAll(readyPlayers);
|
result.removeAll(readyPlayers);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class ArenaListener
|
|||||||
|
|
||||||
this.allowMonsters = arena.getWorld().getAllowMonsters();
|
this.allowMonsters = arena.getWorld().getAllowMonsters();
|
||||||
|
|
||||||
this.banned = new HashSet<Player>();
|
this.banned = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pvpActivate() {
|
void pvpActivate() {
|
||||||
@@ -465,7 +465,7 @@ public class ArenaListener
|
|||||||
|
|
||||||
// If the arena isn't destructible, just clear the blocklist.
|
// If the arena isn't destructible, just clear the blocklist.
|
||||||
if (!softRestore && protect) {
|
if (!softRestore && protect) {
|
||||||
List<Block> blocks = new LinkedList<Block>(arena.getBlocks());
|
List<Block> blocks = new LinkedList<>(arena.getBlocks());
|
||||||
event.blockList().retainAll(blocks);
|
event.blockList().retainAll(blocks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = plugin.getConfig();
|
this.config = plugin.getConfig();
|
||||||
|
|
||||||
this.arenas = new ArrayList<Arena>();
|
this.arenas = new ArrayList<>();
|
||||||
this.arenaMap = new HashMap<Player, Arena>();
|
this.arenaMap = new HashMap<>();
|
||||||
|
|
||||||
this.classes = new HashMap<String, ArenaClass>();
|
this.classes = new HashMap<>();
|
||||||
|
|
||||||
this.allowedCommands = new HashSet<String>();
|
this.allowedCommands = new HashSet<>();
|
||||||
|
|
||||||
this.enabled = config.getBoolean("global-settings.enabled", true);
|
this.enabled = config.getBoolean("global-settings.enabled", true);
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Arena> getEnabledArenas(List<Arena> arenas) {
|
public List<Arena> getEnabledArenas(List<Arena> arenas) {
|
||||||
List<Arena> result = new ArrayList<Arena>(arenas.size());
|
List<Arena> result = new ArrayList<>(arenas.size());
|
||||||
for (Arena arena : arenas)
|
for (Arena arena : arenas)
|
||||||
if (arena.isEnabled())
|
if (arena.isEnabled())
|
||||||
result.add(arena);
|
result.add(arena);
|
||||||
@@ -133,7 +133,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Arena> getPermittedArenas(Player p) {
|
public List<Arena> getPermittedArenas(Player p) {
|
||||||
List<Arena> result = new ArrayList<Arena>(arenas.size());
|
List<Arena> result = new ArrayList<>(arenas.size());
|
||||||
for (Arena arena : arenas)
|
for (Arena arena : arenas)
|
||||||
if (plugin.has(p, "mobarena.arenas." + arena.configName()))
|
if (plugin.has(p, "mobarena.arenas." + arena.configName()))
|
||||||
result.add(arena);
|
result.add(arena);
|
||||||
@@ -141,7 +141,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Arena> getEnabledAndPermittedArenas(Player p) {
|
public List<Arena> getEnabledAndPermittedArenas(Player p) {
|
||||||
List<Arena> result = new ArrayList<Arena>(arenas.size());
|
List<Arena> result = new ArrayList<>(arenas.size());
|
||||||
for (Arena arena : arenas)
|
for (Arena arena : arenas)
|
||||||
if (arena.isEnabled() && plugin.has(p, "mobarena.arenas." + arena.configName()))
|
if (arena.isEnabled() && plugin.has(p, "mobarena.arenas." + arena.configName()))
|
||||||
result.add(arena);
|
result.add(arena);
|
||||||
@@ -156,7 +156,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Arena> getArenasInWorld(World world) {
|
public List<Arena> getArenasInWorld(World world) {
|
||||||
List<Arena> result = new ArrayList<Arena>(arenas.size());
|
List<Arena> result = new ArrayList<>(arenas.size());
|
||||||
for (Arena arena : arenas)
|
for (Arena arena : arenas)
|
||||||
if (arena.getWorld().equals(world))
|
if (arena.getWorld().equals(world))
|
||||||
result.add(arena);
|
result.add(arena);
|
||||||
@@ -164,7 +164,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> getAllPlayers() {
|
public List<Player> getAllPlayers() {
|
||||||
List<Player> result = new ArrayList<Player>(arenas.size());
|
List<Player> result = new ArrayList<>(arenas.size());
|
||||||
for (Arena arena : arenas)
|
for (Arena arena : arenas)
|
||||||
result.addAll(arena.getAllPlayers());
|
result.addAll(arena.getAllPlayers());
|
||||||
return result;
|
return result;
|
||||||
@@ -172,11 +172,11 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
|
|
||||||
public List<Player> getAllPlayersInArena(String arenaName) {
|
public List<Player> getAllPlayersInArena(String arenaName) {
|
||||||
Arena arena = getArenaWithName(arenaName);
|
Arena arena = getArenaWithName(arenaName);
|
||||||
return (arena != null) ? new ArrayList<Player>(arena.getPlayersInArena()) : new ArrayList<Player>();
|
return (arena != null) ? new ArrayList<>(arena.getPlayersInArena()) : new ArrayList<Player>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Player> getAllLivingPlayers() {
|
public List<Player> getAllLivingPlayers() {
|
||||||
List<Player> result = new ArrayList<Player>();
|
List<Player> result = new ArrayList<>();
|
||||||
for (Arena arena : arenas)
|
for (Arena arena : arenas)
|
||||||
result.addAll(arena.getPlayersInArena());
|
result.addAll(arena.getPlayersInArena());
|
||||||
return result;
|
return result;
|
||||||
@@ -184,7 +184,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
|
|
||||||
public List<Player> getLivingPlayersInArena(String arenaName) {
|
public List<Player> getLivingPlayersInArena(String arenaName) {
|
||||||
Arena arena = getArenaWithName(arenaName);
|
Arena arena = getArenaWithName(arenaName);
|
||||||
return (arena != null) ? new ArrayList<Player>(arena.getPlayersInArena()) : new ArrayList<Player>();
|
return (arena != null) ? new ArrayList<>(arena.getPlayersInArena()) : new ArrayList<Player>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Arena getArenaWithPlayer(Player p) {
|
public Arena getArenaWithPlayer(Player p) {
|
||||||
@@ -271,7 +271,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
|
|
||||||
|
|
||||||
// Establish the map.
|
// Establish the map.
|
||||||
classes = new HashMap<String, ArenaClass>();
|
classes = new HashMap<>();
|
||||||
Set<String> classNames = section.getKeys(false);
|
Set<String> classNames = section.getKeys(false);
|
||||||
|
|
||||||
// Load each individual class.
|
// Load each individual class.
|
||||||
@@ -331,7 +331,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
List<ItemStack> stacks = ItemParser.parseItems(str);
|
List<ItemStack> stacks = ItemParser.parseItems(str);
|
||||||
arenaClass.setItems(stacks);
|
arenaClass.setItems(stacks);
|
||||||
} else {
|
} else {
|
||||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
List<ItemStack> stacks = new ArrayList<>();
|
||||||
for (String item : items) {
|
for (String item : items) {
|
||||||
ItemStack stack = ItemParser.parseItem(item);
|
ItemStack stack = ItemParser.parseItem(item);
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
@@ -536,7 +536,7 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
createArenaNode(section, "default", plugin.getServer().getWorlds().get(0), false);
|
createArenaNode(section, "default", plugin.getServer().getWorlds().get(0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
arenas = new ArrayList<Arena>();
|
arenas = new ArrayList<>();
|
||||||
for (World w : Bukkit.getServer().getWorlds()) {
|
for (World w : Bukkit.getServer().getWorlds()) {
|
||||||
loadArenasInWorld(w.getName());
|
loadArenasInWorld(w.getName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class ArenaPlayerStatistics
|
|||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
if (ints == null) {
|
if (ints == null) {
|
||||||
ints = new HashMap<String, MutableInt>();
|
ints = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
ints.clear();
|
ints.clear();
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public class ClassLimitManager
|
|||||||
public ClassLimitManager(Arena arena, Map<String,ArenaClass> classes, ConfigurationSection limits) {
|
public ClassLimitManager(Arena arena, Map<String,ArenaClass> classes, ConfigurationSection limits) {
|
||||||
this.limits = limits;
|
this.limits = limits;
|
||||||
this.classes = classes;
|
this.classes = classes;
|
||||||
this.classLimits = new HashMap<ArenaClass,MutableInt>();
|
this.classLimits = new HashMap<>();
|
||||||
this.classesInUse = new HashMap<ArenaClass, HashSet<String>>();
|
this.classesInUse = new HashMap<>();
|
||||||
|
|
||||||
loadLimitMap(arena.getPlugin());
|
loadLimitMap(arena.getPlugin());
|
||||||
initInUseMap();
|
initInUseMap();
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class MASpawnThread implements Runnable
|
|||||||
plugin.getServer().getPluginManager().callEvent(complete);
|
plugin.getServer().getPluginManager().callEvent(complete);
|
||||||
|
|
||||||
// Then force leave everyone
|
// Then force leave everyone
|
||||||
List<Player> players = new ArrayList<Player>(arena.getPlayersInArena());
|
List<Player> players = new ArrayList<>(arena.getPlayersInArena());
|
||||||
for (Player p : players) {
|
for (Player p : players) {
|
||||||
arena.playerLeave(p);
|
arena.playerLeave(p);
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ public class MASpawnThread implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeCheatingPlayers() {
|
private void removeCheatingPlayers() {
|
||||||
List<Player> players = new ArrayList<Player>(arena.getPlayersInArena());
|
List<Player> players = new ArrayList<>(arena.getPlayersInArena());
|
||||||
for (Player p : players) {
|
for (Player p : players) {
|
||||||
if (region.contains(p.getLocation())) {
|
if (region.contains(p.getLocation())) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class MAUtils
|
|||||||
public static Map<Integer,List<ItemStack>> getArenaRewardMap(MobArena plugin, ConfigurationSection config, String arena, String type)
|
public static Map<Integer,List<ItemStack>> getArenaRewardMap(MobArena plugin, ConfigurationSection config, String arena, String type)
|
||||||
{
|
{
|
||||||
//String arenaPath = "arenas." + arena + ".rewards.waves.";
|
//String arenaPath = "arenas." + arena + ".rewards.waves.";
|
||||||
Map<Integer,List<ItemStack>> result = new HashMap<Integer,List<ItemStack>>();
|
Map<Integer,List<ItemStack>> result = new HashMap<>();
|
||||||
|
|
||||||
String typePath = "rewards.waves." + type;
|
String typePath = "rewards.waves." + type;
|
||||||
if (!config.contains(typePath)) return result;
|
if (!config.contains(typePath)) return result;
|
||||||
@@ -141,7 +141,7 @@ public class MAUtils
|
|||||||
|
|
||||||
/* Iterate through the ArrayList, and update current and result every
|
/* Iterate through the ArrayList, and update current and result every
|
||||||
* time a squared distance smaller than current is found. */
|
* time a squared distance smaller than current is found. */
|
||||||
List<Player> players = new ArrayList<Player>(arena.getPlayersInArena());
|
List<Player> players = new ArrayList<>(arena.getPlayersInArena());
|
||||||
for (Player p : players) {
|
for (Player p : players) {
|
||||||
if (!arena.getWorld().equals(p.getWorld())) {
|
if (!arena.getWorld().equals(p.getWorld())) {
|
||||||
plugin.getLogger().info("Player '" + p.getName() + "' is not in the right world. Kicking...");
|
plugin.getLogger().info("Player '" + p.getName() + "' is not in the right world. Kicking...");
|
||||||
@@ -261,7 +261,7 @@ public class MAUtils
|
|||||||
*/
|
*/
|
||||||
public static List<String> stringToList(String list)
|
public static List<String> stringToList(String list)
|
||||||
{
|
{
|
||||||
List<String> result = new LinkedList<String>();
|
List<String> result = new LinkedList<>();
|
||||||
if (list == null) return result;
|
if (list == null) return result;
|
||||||
|
|
||||||
String[] parts = list.trim().split(",");
|
String[] parts = list.trim().split(",");
|
||||||
@@ -303,7 +303,7 @@ public class MAUtils
|
|||||||
int lz2 = z1 + 6;
|
int lz2 = z1 + 6;
|
||||||
|
|
||||||
// Save the precious patch
|
// Save the precious patch
|
||||||
HashMap<EntityPosition,Integer> preciousPatch = new HashMap<EntityPosition,Integer>();
|
HashMap<EntityPosition,Integer> preciousPatch = new HashMap<>();
|
||||||
Location lo;
|
Location lo;
|
||||||
int id;
|
int id;
|
||||||
for (int i = x1; i <= x2; i++)
|
for (int i = x1; i <= x2; i++)
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ public class MobArena extends JavaPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerInventories() {
|
private void registerInventories() {
|
||||||
this.inventoriesToRestore = new HashSet<String>();
|
this.inventoriesToRestore = new HashSet<>();
|
||||||
|
|
||||||
File dir = new File(getDataFolder(), "inventories");
|
File dir = new File(getDataFolder(), "inventories");
|
||||||
if (!dir.exists()) {
|
if (!dir.exists()) {
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ public class MonsterManager
|
|||||||
private Set<LivingEntity> mounts;
|
private Set<LivingEntity> mounts;
|
||||||
|
|
||||||
public MonsterManager() {
|
public MonsterManager() {
|
||||||
this.monsters = new HashSet<LivingEntity>();
|
this.monsters = new HashSet<>();
|
||||||
this.sheep = new HashSet<LivingEntity>();
|
this.sheep = new HashSet<>();
|
||||||
this.golems = new HashSet<LivingEntity>();
|
this.golems = new HashSet<>();
|
||||||
this.pets = new HashSet<Wolf>();
|
this.pets = new HashSet<>();
|
||||||
this.bosses = new HashMap<LivingEntity,MABoss>();
|
this.bosses = new HashMap<>();
|
||||||
this.suppliers = new HashMap<LivingEntity,List<ItemStack>>();
|
this.suppliers = new HashMap<>();
|
||||||
this.mounts = new HashSet<LivingEntity>();
|
this.mounts = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class RewardManager
|
|||||||
public RewardManager(Arena arena) {
|
public RewardManager(Arena arena) {
|
||||||
this.plugin = arena.getPlugin();
|
this.plugin = arena.getPlugin();
|
||||||
this.arena = arena;
|
this.arena = arena;
|
||||||
this.players = new HashMap<Player,List<ItemStack>>();
|
this.players = new HashMap<>();
|
||||||
this.rewarded = new HashSet<Player>();
|
this.rewarded = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class CommandHandler implements CommandExecutor
|
|||||||
* @return a list of commands whose patterns match the given string
|
* @return a list of commands whose patterns match the given string
|
||||||
*/
|
*/
|
||||||
private List<Command> getMatchingCommands(String arg) {
|
private List<Command> getMatchingCommands(String arg) {
|
||||||
List<Command> result = new ArrayList<Command>();
|
List<Command> result = new ArrayList<>();
|
||||||
|
|
||||||
// Grab the commands that match the argument.
|
// Grab the commands that match the argument.
|
||||||
for (Entry<String,Command> entry : commands.entrySet()) {
|
for (Entry<String,Command> entry : commands.entrySet()) {
|
||||||
@@ -209,7 +209,7 @@ public class CommandHandler implements CommandExecutor
|
|||||||
* method, but this is neater, albeit more manual work.
|
* method, but this is neater, albeit more manual work.
|
||||||
*/
|
*/
|
||||||
private void registerCommands() {
|
private void registerCommands() {
|
||||||
commands = new LinkedHashMap<String,Command>();
|
commands = new LinkedHashMap<>();
|
||||||
|
|
||||||
// mobarena.use
|
// mobarena.use
|
||||||
register(JoinCommand.class);
|
register(JoinCommand.class);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class SetupCommand implements Command, Listener {
|
|||||||
player.getInventory().setContents(getToolbox());
|
player.getInventory().setContents(getToolbox());
|
||||||
player.getInventory().setHeldItemSlot(0);
|
player.getInventory().setHeldItemSlot(0);
|
||||||
|
|
||||||
this.missing = new ArrayList<String>();
|
this.missing = new ArrayList<>();
|
||||||
this.next = color(String.format(
|
this.next = color(String.format(
|
||||||
"Setup Mode for arena &a%s&r. Type &e?&r for help.",
|
"Setup Mode for arena &a%s&r. Type &e?&r for help.",
|
||||||
"&a" + arena.configName() + "&r"
|
"&a" + arena.configName() + "&r"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class PlayerListCommand implements Command
|
|||||||
list = MAUtils.listToString(arena.getPlayersInArena(), am.getPlugin());
|
list = MAUtils.listToString(arena.getPlayersInArena(), am.getPlugin());
|
||||||
} else {
|
} else {
|
||||||
StringBuilder buffy = new StringBuilder();
|
StringBuilder buffy = new StringBuilder();
|
||||||
List<Player> players = new LinkedList<Player>();
|
List<Player> players = new LinkedList<>();
|
||||||
|
|
||||||
for (Arena arena : am.getArenas()) {
|
for (Arena arena : am.getArenas()) {
|
||||||
players.addAll(arena.getPlayersInArena());
|
players.addAll(arena.getPlayersInArena());
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class ArenaCompleteEvent extends Event {
|
|||||||
|
|
||||||
public ArenaCompleteEvent(Arena arena) {
|
public ArenaCompleteEvent(Arena arena) {
|
||||||
this.arena = arena;
|
this.arena = arena;
|
||||||
this.survivors = new HashSet<Player>();
|
this.survivors = new HashSet<>();
|
||||||
this.survivors.addAll(arena.getPlayersInArena());
|
this.survivors.addAll(arena.getPlayersInArena());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public class Leaderboard
|
|||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.arena = arena;
|
this.arena = arena;
|
||||||
this.boards = new ArrayList<LeaderboardColumn>();
|
this.boards = new ArrayList<>();
|
||||||
this.stats = new ArrayList<ArenaPlayerStatistics>();
|
this.stats = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,7 +183,7 @@ public class Leaderboard
|
|||||||
if (stat == null) continue;
|
if (stat == null) continue;
|
||||||
|
|
||||||
// Create the list of signs
|
// Create the list of signs
|
||||||
List<Sign> signs = new ArrayList<Sign>();
|
List<Sign> signs = new ArrayList<>();
|
||||||
current = header;
|
current = header;
|
||||||
for (int i = 1; i < rows; i++)
|
for (int i = 1; i < rows; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class ArenaRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reloadSpawnpoints() {
|
public void reloadSpawnpoints() {
|
||||||
spawnpoints = new HashMap<String,Location>();
|
spawnpoints = new HashMap<>();
|
||||||
Set<String> keys = spawns.getKeys(false);
|
Set<String> keys = spawns.getKeys(false);
|
||||||
if (keys != null) {
|
if (keys != null) {
|
||||||
for (String spwn : keys) {
|
for (String spwn : keys) {
|
||||||
@@ -105,7 +105,7 @@ public class ArenaRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reloadChests() {
|
public void reloadChests() {
|
||||||
containers = new HashMap<String,Location>();
|
containers = new HashMap<>();
|
||||||
Set<String> keys = chests.getKeys(false);
|
Set<String> keys = chests.getKeys(false);
|
||||||
if (keys != null) {
|
if (keys != null) {
|
||||||
for (String chst : keys) {
|
for (String chst : keys) {
|
||||||
@@ -131,7 +131,7 @@ public class ArenaRegion
|
|||||||
verifyData();
|
verifyData();
|
||||||
|
|
||||||
// Prepare the list
|
// Prepare the list
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<>();
|
||||||
|
|
||||||
// Region points
|
// Region points
|
||||||
if (region) {
|
if (region) {
|
||||||
@@ -363,7 +363,7 @@ public class ArenaRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Chunk> getChunks() {
|
public List<Chunk> getChunks() {
|
||||||
List<Chunk> result = new ArrayList<Chunk>();
|
List<Chunk> result = new ArrayList<>();
|
||||||
|
|
||||||
if (p1 == null || p2 == null) {
|
if (p1 == null || p2 == null) {
|
||||||
return result;
|
return result;
|
||||||
@@ -406,7 +406,7 @@ public class ArenaRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Location> getSpawnpointList() {
|
public List<Location> getSpawnpointList() {
|
||||||
return new ArrayList<Location>(spawnpoints.values());
|
return new ArrayList<>(spawnpoints.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Location> getContainers() {
|
public Collection<Location> getContainers() {
|
||||||
@@ -626,7 +626,7 @@ public class ArenaRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find all the spawnpoints that cover the location
|
// Find all the spawnpoints that cover the location
|
||||||
Map<String,Location> map = new HashMap<String,Location>();
|
Map<String,Location> map = new HashMap<>();
|
||||||
for (Map.Entry<String,Location> entry : spawnpoints.entrySet()) {
|
for (Map.Entry<String,Location> entry : spawnpoints.entrySet()) {
|
||||||
if (p.getLocation().distanceSquared(entry.getValue()) < MobArena.MIN_PLAYER_DISTANCE_SQUARED) {
|
if (p.getLocation().distanceSquared(entry.getValue()) < MobArena.MIN_PLAYER_DISTANCE_SQUARED) {
|
||||||
map.put(entry.getKey(), entry.getValue());
|
map.put(entry.getKey(), entry.getValue());
|
||||||
@@ -673,7 +673,7 @@ public class ArenaRegion
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Grab all the blocks, and send block change events.
|
// Grab all the blocks, and send block change events.
|
||||||
final Map<Location,BlockState> blocks = new HashMap<Location,BlockState>();
|
final Map<Location,BlockState> blocks = new HashMap<>();
|
||||||
for (Location l : points) {
|
for (Location l : points) {
|
||||||
Block b = l.getBlock();
|
Block b = l.getBlock();
|
||||||
blocks.put(l, b.getState());
|
blocks.put(l, b.getState());
|
||||||
@@ -702,7 +702,7 @@ public class ArenaRegion
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<Location> getFramePoints(Location loc1, Location loc2) {
|
private List<Location> getFramePoints(Location loc1, Location loc2) {
|
||||||
List<Location> result = new ArrayList<Location>();
|
List<Location> result = new ArrayList<>();
|
||||||
int x1 = loc1.getBlockX(); int y1 = loc1.getBlockY(); int z1 = loc1.getBlockZ();
|
int x1 = loc1.getBlockX(); int y1 = loc1.getBlockY(); int z1 = loc1.getBlockZ();
|
||||||
int x2 = loc2.getBlockX(); int y2 = loc2.getBlockY(); int z2 = loc2.getBlockZ();
|
int x2 = loc2.getBlockX(); int y2 = loc2.getBlockY(); int z2 = loc2.getBlockZ();
|
||||||
|
|
||||||
|
|||||||
@@ -126,11 +126,11 @@ public class ItemParser
|
|||||||
|
|
||||||
public static List<ItemStack> parseItems(String s) {
|
public static List<ItemStack> parseItems(String s) {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
return new ArrayList<ItemStack>(1);
|
return new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] items = s.split(",");
|
String[] items = s.split(",");
|
||||||
List<ItemStack> result = new ArrayList<ItemStack>(items.length);
|
List<ItemStack> result = new ArrayList<>(items.length);
|
||||||
|
|
||||||
for (String item : items) {
|
for (String item : items) {
|
||||||
ItemStack stack = parseItem(item.trim());
|
ItemStack stack = parseItem(item.trim());
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class PotionEffectParser
|
|||||||
if (s == null || s.isEmpty())
|
if (s == null || s.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<PotionEffect> potions = new ArrayList<PotionEffect>();
|
List<PotionEffect> potions = new ArrayList<>();
|
||||||
for (String potion : s.split(",")) {
|
for (String potion : s.split(",")) {
|
||||||
PotionEffect eff = parsePotionEffect(potion.trim());
|
PotionEffect eff = parsePotionEffect(potion.trim());
|
||||||
if (eff != null) {
|
if (eff != null) {
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public class InventoryManager
|
|||||||
this.dir = new File(arena.getPlugin().getDataFolder(), "inventories");
|
this.dir = new File(arena.getPlugin().getDataFolder(), "inventories");
|
||||||
this.dir.mkdir();
|
this.dir.mkdir();
|
||||||
|
|
||||||
this.items = new HashMap<Player,ItemStack[]>();
|
this.items = new HashMap<>();
|
||||||
this.armor = new HashMap<Player,ItemStack[]>();
|
this.armor = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void storeInv(Player p) throws IOException {
|
public void storeInv(Player p) throws IOException {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
public class InventoryUtils
|
public class InventoryUtils
|
||||||
{
|
{
|
||||||
public static List<ItemStack> extractAll(int id, List<ItemStack> items) {
|
public static List<ItemStack> extractAll(int id, List<ItemStack> items) {
|
||||||
List<ItemStack> result = new ArrayList<ItemStack>();
|
List<ItemStack> result = new ArrayList<>();
|
||||||
|
|
||||||
for (ItemStack stack : items) {
|
for (ItemStack stack : items) {
|
||||||
if (stack.getTypeId() == id) {
|
if (stack.getTypeId() == id) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class SheepBouncer implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Put all the sheep in a new collection for iteration purposes.
|
// Put all the sheep in a new collection for iteration purposes.
|
||||||
sheep = new HashSet<LivingEntity>(arena.getMonsterManager().getExplodingSheep());
|
sheep = new HashSet<>(arena.getMonsterManager().getExplodingSheep());
|
||||||
|
|
||||||
// If there are no sheep, reschedule and return.
|
// If there are no sheep, reschedule and return.
|
||||||
if (sheep.isEmpty()) {
|
if (sheep.isEmpty()) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class WaveManager
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
reloadWaves();
|
reloadWaves();
|
||||||
wave = 0;
|
wave = 0;
|
||||||
singleWavesInstance = new TreeSet<Wave>(singleWaves);
|
singleWavesInstance = new TreeSet<>(singleWaves);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadWaves() {
|
public void reloadWaves() {
|
||||||
@@ -119,7 +119,7 @@ public class WaveManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
private SortedSet<Wave> getMatchingRecurrentWaves(int wave) {
|
private SortedSet<Wave> getMatchingRecurrentWaves(int wave) {
|
||||||
TreeSet<Wave> result = new TreeSet<Wave>(WaveUtils.getRecurrentComparator());
|
TreeSet<Wave> result = new TreeSet<>(WaveUtils.getRecurrentComparator());
|
||||||
for (Wave w : recurrentWaves) {
|
for (Wave w : recurrentWaves) {
|
||||||
if (w.matches(wave)) {
|
if (w.matches(wave)) {
|
||||||
result.add(w);
|
result.add(w);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class WaveParser
|
|||||||
{
|
{
|
||||||
public static TreeSet<Wave> parseWaves(Arena arena, ConfigurationSection config, WaveBranch branch) {
|
public static TreeSet<Wave> parseWaves(Arena arena, ConfigurationSection config, WaveBranch branch) {
|
||||||
// Create a TreeSet with the Comparator for the specific branch.
|
// Create a TreeSet with the Comparator for the specific branch.
|
||||||
TreeSet<Wave> result = new TreeSet<Wave>(WaveUtils.getComparator(branch));
|
TreeSet<Wave> result = new TreeSet<>(WaveUtils.getComparator(branch));
|
||||||
|
|
||||||
// If the config is null, return the empty set.
|
// If the config is null, return the empty set.
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
@@ -358,7 +358,7 @@ public class WaveParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the map.
|
// Prepare the map.
|
||||||
SortedMap<Integer,MACreature> monsterMap = new TreeMap<Integer,MACreature>();
|
SortedMap<Integer,MACreature> monsterMap = new TreeMap<>();
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
String path = "monsters.";
|
String path = "monsters.";
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ public class WaveParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<Location> getSpawnpoints(Arena arena, String name, ConfigurationSection config) {
|
private static List<Location> getSpawnpoints(Arena arena, String name, ConfigurationSection config) {
|
||||||
List<Location> result = new ArrayList<Location>();
|
List<Location> result = new ArrayList<>();
|
||||||
|
|
||||||
String spawnString = config.getString("spawnpoints");
|
String spawnString = config.getString("spawnpoints");
|
||||||
if (spawnString == null) {
|
if (spawnString == null) {
|
||||||
@@ -414,7 +414,7 @@ public class WaveParser
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String,List<Upgrade>> upgrades = new HashMap<String,List<Upgrade>>();
|
Map<String,List<Upgrade>> upgrades = new HashMap<>();
|
||||||
String path = "upgrades.";
|
String path = "upgrades.";
|
||||||
|
|
||||||
for (String className : classes) {
|
for (String className : classes) {
|
||||||
@@ -424,7 +424,7 @@ public class WaveParser
|
|||||||
if (val instanceof String) {
|
if (val instanceof String) {
|
||||||
itemList = (String) val;
|
itemList = (String) val;
|
||||||
List<ItemStack> stacks = ItemParser.parseItems(itemList);
|
List<ItemStack> stacks = ItemParser.parseItems(itemList);
|
||||||
List<Upgrade> list = new ArrayList<Upgrade>();
|
List<Upgrade> list = new ArrayList<>();
|
||||||
for (ItemStack stack : stacks) {
|
for (ItemStack stack : stacks) {
|
||||||
list.add(new GenericUpgrade(stack));
|
list.add(new GenericUpgrade(stack));
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,7 @@ public class WaveParser
|
|||||||
// New complex setup
|
// New complex setup
|
||||||
else if (val instanceof ConfigurationSection) {
|
else if (val instanceof ConfigurationSection) {
|
||||||
ConfigurationSection classSection = (ConfigurationSection) val;
|
ConfigurationSection classSection = (ConfigurationSection) val;
|
||||||
List<Upgrade> list = new ArrayList<Upgrade>();
|
List<Upgrade> list = new ArrayList<>();
|
||||||
|
|
||||||
// Items (Generic + Weapons)
|
// Items (Generic + Weapons)
|
||||||
itemList = classSection.getString("items", null);
|
itemList = classSection.getString("items", null);
|
||||||
@@ -468,7 +468,7 @@ public class WaveParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Wave createDefaultWave() {
|
public static Wave createDefaultWave() {
|
||||||
SortedMap<Integer,MACreature> monsters = new TreeMap<Integer,MACreature>();
|
SortedMap<Integer,MACreature> monsters = new TreeMap<>();
|
||||||
monsters.put(10, MACreature.ZOMBIE);
|
monsters.put(10, MACreature.ZOMBIE);
|
||||||
monsters.put(20, MACreature.SKELETON);
|
monsters.put(20, MACreature.SKELETON);
|
||||||
monsters.put(30, MACreature.SPIDER);
|
monsters.put(30, MACreature.SPIDER);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class WaveUtils
|
|||||||
*/
|
*/
|
||||||
public static List<Location> getValidSpawnpoints(Arena arena, List<Location> spawnpoints, Collection<Player> players) {
|
public static List<Location> getValidSpawnpoints(Arena arena, List<Location> spawnpoints, Collection<Player> players) {
|
||||||
MobArena plugin = arena.getPlugin();
|
MobArena plugin = arena.getPlugin();
|
||||||
List<Location> result = new ArrayList<Location>();
|
List<Location> result = new ArrayList<>();
|
||||||
|
|
||||||
// Ensure that we do have some spawnpoints.
|
// Ensure that we do have some spawnpoints.
|
||||||
if (spawnpoints == null || spawnpoints.isEmpty()) {
|
if (spawnpoints == null || spawnpoints.isEmpty()) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class AbilityManager
|
|||||||
* Load all the core abilities included in MobArena
|
* Load all the core abilities included in MobArena
|
||||||
*/
|
*/
|
||||||
public static void loadCoreAbilities() {
|
public static void loadCoreAbilities() {
|
||||||
if (abilities == null) abilities = new HashMap<String,Class<? extends Ability>>();
|
if (abilities == null) abilities = new HashMap<>();
|
||||||
|
|
||||||
register(ChainLightning.class);
|
register(ChainLightning.class);
|
||||||
register(DisorientDistant.class);
|
register(DisorientDistant.class);
|
||||||
@@ -96,7 +96,7 @@ public class AbilityManager
|
|||||||
* @param classDir a directory of .class (and/or .java) files
|
* @param classDir a directory of .class (and/or .java) files
|
||||||
*/
|
*/
|
||||||
public static void loadCustomAbilities(File classDir) {
|
public static void loadCustomAbilities(File classDir) {
|
||||||
if (abilities == null) abilities = new HashMap<String,Class<? extends Ability>>();
|
if (abilities == null) abilities = new HashMap<>();
|
||||||
|
|
||||||
// Grab the source directory.
|
// Grab the source directory.
|
||||||
File javaDir = new File(classDir, "src");
|
File javaDir = new File(classDir, "src");
|
||||||
@@ -179,7 +179,7 @@ public class AbilityManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<File> getSourceFilesToCompile(File javaDir, File classDir) {
|
private static List<File> getSourceFilesToCompile(File javaDir, File classDir) {
|
||||||
List<File> result = new ArrayList<File>();
|
List<File> result = new ArrayList<>();
|
||||||
|
|
||||||
if (javaDir == null || !javaDir.exists()) {
|
if (javaDir == null || !javaDir.exists()) {
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class AbilityUtils
|
|||||||
* @return a random arena player, or null if none were found
|
* @return a random arena player, or null if none were found
|
||||||
*/
|
*/
|
||||||
public static Player getRandomPlayer(Arena arena) {
|
public static Player getRandomPlayer(Arena arena) {
|
||||||
List<Player> list = new ArrayList<Player>(arena.getPlayersInArena());
|
List<Player> list = new ArrayList<>(arena.getPlayersInArena());
|
||||||
if (list.isEmpty()) return null;
|
if (list.isEmpty()) return null;
|
||||||
|
|
||||||
return list.get(random.nextInt(list.size()));
|
return list.get(random.nextInt(list.size()));
|
||||||
@@ -57,7 +57,7 @@ public class AbilityUtils
|
|||||||
* @return a list of nearby players
|
* @return a list of nearby players
|
||||||
*/
|
*/
|
||||||
public static List<Player> getNearbyPlayers(Arena arena, Entity boss, int x) {
|
public static List<Player> getNearbyPlayers(Arena arena, Entity boss, int x) {
|
||||||
List<Player> result = new ArrayList<Player>();
|
List<Player> result = new ArrayList<>();
|
||||||
for (Entity e : boss.getNearbyEntities(x, x, x)) {
|
for (Entity e : boss.getNearbyEntities(x, x, x)) {
|
||||||
if (arena.getPlayersInArena().contains(e)) {
|
if (arena.getPlayersInArena().contains(e)) {
|
||||||
result.add((Player) e);
|
result.add((Player) e);
|
||||||
@@ -74,7 +74,7 @@ public class AbilityUtils
|
|||||||
* @return a list of distant players
|
* @return a list of distant players
|
||||||
*/
|
*/
|
||||||
public static List<Player> getDistantPlayers(Arena arena, Entity boss, int x) {
|
public static List<Player> getDistantPlayers(Arena arena, Entity boss, int x) {
|
||||||
List<Player> result = new ArrayList<Player>();
|
List<Player> result = new ArrayList<>();
|
||||||
for (Player p : arena.getPlayersInArena()) {
|
for (Player p : arena.getPlayersInArena()) {
|
||||||
if (MAUtils.distanceSquared(arena.getPlugin(), p, boss.getLocation()) > (double) (x*x)) {
|
if (MAUtils.distanceSquared(arena.getPlugin(), p, boss.getLocation()) > (double) (x*x)) {
|
||||||
result.add(p);
|
result.add(p);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ShufflePositions implements Ability
|
|||||||
entities.add(boss.getEntity());
|
entities.add(boss.getEntity());
|
||||||
|
|
||||||
// Grab the locations
|
// Grab the locations
|
||||||
List<Location> locations = new LinkedList<Location>();
|
List<Location> locations = new LinkedList<>();
|
||||||
for (LivingEntity e : entities) {
|
for (LivingEntity e : entities) {
|
||||||
locations.add(e.getLocation());
|
locations.add(e.getLocation());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ public class BossWave extends AbstractWave
|
|||||||
|
|
||||||
public BossWave(MACreature monster) {
|
public BossWave(MACreature monster) {
|
||||||
this.monster = monster;
|
this.monster = monster;
|
||||||
this.bosses = new HashSet<MABoss>();
|
this.bosses = new HashSet<>();
|
||||||
this.abilities = new ArrayList<Ability>();
|
this.abilities = new ArrayList<>();
|
||||||
this.potions = new ArrayList<PotionEffect>();
|
this.potions = new ArrayList<>();
|
||||||
this.activated = false;
|
this.activated = false;
|
||||||
this.abilityAnnounce = false;
|
this.abilityAnnounce = false;
|
||||||
this.setType(WaveType.BOSS);
|
this.setType(WaveType.BOSS);
|
||||||
@@ -57,7 +57,7 @@ public class BossWave extends AbstractWave
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<MACreature,Integer> getMonstersToSpawn(int wave, int playerCount, Arena arena) {
|
public Map<MACreature,Integer> getMonstersToSpawn(int wave, int playerCount, Arena arena) {
|
||||||
Map<MACreature,Integer> result = new HashMap<MACreature,Integer>();
|
Map<MACreature,Integer> result = new HashMap<>();
|
||||||
result.put(monster, 1);
|
result.put(monster, 1);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ public class BossWave extends AbstractWave
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<MABoss> getMABosses() {
|
public Set<MABoss> getMABosses() {
|
||||||
Set<MABoss> result = new HashSet<MABoss>();
|
Set<MABoss> result = new HashSet<>();
|
||||||
for (MABoss b : bosses) {
|
for (MABoss b : bosses) {
|
||||||
if (!b.isDead()) {
|
if (!b.isDead()) {
|
||||||
result.add(b);
|
result.add(b);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class DefaultWave extends AbstractWave
|
|||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
|
||||||
// Prepare the monster map.
|
// Prepare the monster map.
|
||||||
Map<MACreature,Integer> monsters = new HashMap<MACreature,Integer>();
|
Map<MACreature,Integer> monsters = new HashMap<>();
|
||||||
|
|
||||||
// Generate some random amounts.
|
// Generate some random amounts.
|
||||||
for (int i = 0; i < toSpawn; i++) {
|
for (int i = 0; i < toSpawn; i++) {
|
||||||
@@ -60,7 +60,7 @@ public class DefaultWave extends AbstractWave
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<MACreature,Integer> getFixed() {
|
private Map<MACreature,Integer> getFixed() {
|
||||||
Map<MACreature,Integer> result = new HashMap<MACreature,Integer>();
|
Map<MACreature,Integer> result = new HashMap<>();
|
||||||
|
|
||||||
// For fixed waves, we just convert the accumulated map
|
// For fixed waves, we just convert the accumulated map
|
||||||
int last = 0;
|
int last = 0;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class SpecialWave extends AbstractWave
|
|||||||
int value = random.nextInt(monsterMap.lastKey());
|
int value = random.nextInt(monsterMap.lastKey());
|
||||||
|
|
||||||
// Prepare the monster map.
|
// Prepare the monster map.
|
||||||
Map<MACreature,Integer> result = new HashMap<MACreature,Integer>();
|
Map<MACreature,Integer> result = new HashMap<>();
|
||||||
|
|
||||||
for (Map.Entry<Integer,MACreature> entry : monsterMap.entrySet()) {
|
for (Map.Entry<Integer,MACreature> entry : monsterMap.entrySet()) {
|
||||||
if (value > entry.getKey()) {
|
if (value > entry.getKey()) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class SupplyWave extends AbstractWave
|
|||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
|
||||||
// Prepare the monster map.
|
// Prepare the monster map.
|
||||||
Map<MACreature,Integer> monsters = new HashMap<MACreature,Integer>();
|
Map<MACreature,Integer> monsters = new HashMap<>();
|
||||||
|
|
||||||
int toSpawn = (int) Math.max(1D, playerCount * super.getAmountMultiplier());
|
int toSpawn = (int) Math.max(1D, playerCount * super.getAmountMultiplier());
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ public class SupplyWave extends AbstractWave
|
|||||||
|
|
||||||
public Wave copy() {
|
public Wave copy() {
|
||||||
SupplyWave result = new SupplyWave(monsterMap);
|
SupplyWave result = new SupplyWave(monsterMap);
|
||||||
result.drops = new ArrayList<ItemStack>(this.drops);
|
result.drops = new ArrayList<>(this.drops);
|
||||||
|
|
||||||
// From AbstractWave
|
// From AbstractWave
|
||||||
result.setAmountMultiplier(getAmountMultiplier());
|
result.setAmountMultiplier(getAmountMultiplier());
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class SwarmWave extends AbstractWave
|
|||||||
@Override
|
@Override
|
||||||
public Map<MACreature,Integer> getMonstersToSpawn(int wave, int playerCount, Arena arena) {
|
public Map<MACreature,Integer> getMonstersToSpawn(int wave, int playerCount, Arena arena) {
|
||||||
// Prepare the monster map.
|
// Prepare the monster map.
|
||||||
Map<MACreature,Integer> result = new HashMap<MACreature,Integer>();
|
Map<MACreature,Integer> result = new HashMap<>();
|
||||||
|
|
||||||
// Add the monster and the swarm amount.
|
// Add the monster and the swarm amount.
|
||||||
int toSpawn = (int) Math.max(1D, amount.getAmount(playerCount) * super.getAmountMultiplier());
|
int toSpawn = (int) Math.max(1D, amount.getAmount(playerCount) * super.getAmountMultiplier());
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class UpgradeWave extends AbstractWave
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<MACreature,Integer> getMonstersToSpawn(int wave, int playerCount, Arena arena) {
|
public Map<MACreature,Integer> getMonstersToSpawn(int wave, int playerCount, Arena arena) {
|
||||||
return new HashMap<MACreature,Integer>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grantItems(Arena arena, Player p, String className) {
|
public void grantItems(Arena arena, Player p, String className) {
|
||||||
@@ -49,9 +49,9 @@ public class UpgradeWave extends AbstractWave
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Wave copy() {
|
public Wave copy() {
|
||||||
Map<String,List<Upgrade>> upgrades = new HashMap<String,List<Upgrade>>();
|
Map<String,List<Upgrade>> upgrades = new HashMap<>();
|
||||||
for (Map.Entry<String,List<Upgrade>> entry : this.upgrades.entrySet()) {
|
for (Map.Entry<String,List<Upgrade>> entry : this.upgrades.entrySet()) {
|
||||||
upgrades.put(entry.getKey(), new ArrayList<Upgrade>(entry.getValue()));
|
upgrades.put(entry.getKey(), new ArrayList<>(entry.getValue()));
|
||||||
}
|
}
|
||||||
UpgradeWave result = new UpgradeWave(upgrades);
|
UpgradeWave result = new UpgradeWave(upgrades);
|
||||||
result.giveAll = this.giveAll;
|
result.giveAll = this.giveAll;
|
||||||
|
|||||||
Reference in New Issue
Block a user