Use enum map

This commit is contained in:
tastybento 2019-12-18 14:45:15 -08:00
parent 5c9c84c98a
commit 09583aa3a7

View File

@ -1,6 +1,16 @@
package world.bentobox.level.calculators; package world.bentobox.level.calculators;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
@ -38,7 +48,7 @@ public class CalcIslandLevel {
private final Runnable onExit; private final Runnable onExit;
// Copy the limits hash map // Copy the limits hash map
private final HashMap<Material, Integer> limitCount; private final Map<Material, Integer> limitCount;
private final List<World> worlds; private final List<World> worlds;
private final World world; private final World world;
@ -59,7 +69,7 @@ public class CalcIslandLevel {
this.addon = addon; this.addon = addon;
this.island = island; this.island = island;
this.world = island.getWorld(); this.world = island.getWorld();
this.limitCount = new HashMap<>(addon.getSettings().getBlockLimits()); this.limitCount = new EnumMap<>(addon.getSettings().getBlockLimits());
this.onExit = onExit; this.onExit = onExit;
this.worlds = new ArrayList<>(); this.worlds = new ArrayList<>();
this.worlds.add(world); this.worlds.add(world);
@ -93,6 +103,7 @@ public class CalcIslandLevel {
} }
} }
queueid = Bukkit.getScheduler().scheduleSyncRepeatingTask(addon.getPlugin(), new Runnable() { queueid = Bukkit.getScheduler().scheduleSyncRepeatingTask(addon.getPlugin(), new Runnable() {
@Override
public void run() { public void run() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
if (q.size() == 0) { if (q.size() == 0) {