Merge branch 'develop' of

https://github.com/BentoBoxWorld/addon-level.git into develop
This commit is contained in:
tastybento 2018-08-31 11:03:47 +09:00
commit afbe7dddde
18 changed files with 307 additions and 387 deletions

View File

@ -46,7 +46,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version> <version>1.13.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -55,7 +55,7 @@ public class Level extends Addon {
/** /**
* Get level from cache for a player * Get level from cache for a player
* @param targetPlayer * @param targetPlayer - target player
* @return Level of player * @return Level of player
*/ */
public long getIslandLevel(World world, UUID targetPlayer) { public long getIslandLevel(World world, UUID targetPlayer) {
@ -92,7 +92,7 @@ public class Level extends Addon {
public void onDisable(){ public void onDisable(){
// Save the cache // Save the cache
if (levelsCache != null) { if (levelsCache != null) {
save(false); save();
} }
if (topTen != null) { if (topTen != null) {
topTen.saveTopTen(); topTen.saveTopTen();
@ -147,18 +147,17 @@ public class Level extends Addon {
/** /**
* Save the levels to the database * Save the levels to the database
* @param async - if true, saving will be done async
*/ */
public void save(boolean async){ private void save(){
// No async for now // No async for now
levelsCache.values().forEach(handler::saveObject); levelsCache.values().forEach(handler::saveObject);
} }
/** /**
* Sets the player's level to a value * Sets the player's level to a value
* @param world * @param world - world
* @param targetPlayer * @param targetPlayer - target player
* @param level * @param level - level
*/ */
public void setIslandLevel(World world, UUID targetPlayer, long level) { public void setIslandLevel(World world, UUID targetPlayer, long level) {
LevelsData ld = getLevelsData(targetPlayer); LevelsData ld = getLevelsData(targetPlayer);

View File

@ -10,14 +10,14 @@ import bentobox.addon.level.calculators.PlayerLevel;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.api.user.User;
public class LevelPresenter { class LevelPresenter {
private int levelWait; private int levelWait;
private final Level addon; private final Level addon;
private final BentoBox plugin; private final BentoBox plugin;
// Level calc cool down // Level calc cool down
private HashMap<UUID, Long> levelWaitTime = new HashMap<UUID, Long>(); private final HashMap<UUID, Long> levelWaitTime = new HashMap<>();
public LevelPresenter(Level addon, BentoBox plugin) { public LevelPresenter(Level addon, BentoBox plugin) {
this.addon = addon; this.addon = addon;
@ -28,10 +28,9 @@ public class LevelPresenter {
* Calculates the island level * Calculates the island level
* @param world - world to check * @param world - world to check
* @param sender - asker of the level info * @param sender - asker of the level info
* @param targetPlayer * @param targetPlayer - target player
* @return - false if this is cannot be done
*/ */
public boolean calculateIslandLevel(World world, final User sender, UUID targetPlayer) { public void calculateIslandLevel(World world, final User sender, UUID targetPlayer) {
// Get permission prefix for this world // Get permission prefix for this world
String permPrefix = plugin.getIWM().getPermissionPrefix(world); String permPrefix = plugin.getIWM().getPermissionPrefix(world);
// Check if target has island // Check if target has island
@ -43,7 +42,7 @@ public class LevelPresenter {
inTeam = true; inTeam = true;
} else { } else {
sender.sendMessage("general.errors.player-has-no-island"); sender.sendMessage("general.errors.player-has-no-island");
return false; return;
} }
} }
// Player asking for their own island calc // Player asking for their own island calc
@ -62,22 +61,20 @@ public class LevelPresenter {
// Asking for the level of another player // Asking for the level of another player
sender.sendMessage("island.level.island-level-is","[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer))); sender.sendMessage("island.level.island-level-is","[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
} }
return true;
} }
/** /**
* Sets cool down for the level command * Sets cool down for the level command
* *
* @param player * @param user - user
*/ */
private void setLevelWaitTime(final User player) { private void setLevelWaitTime(final User user) {
levelWaitTime.put(player.getUniqueId(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + levelWait * 1000)); levelWaitTime.put(user.getUniqueId(), Calendar.getInstance().getTimeInMillis() + levelWait * 1000);
} }
private boolean onLevelWaitTime(final User sender) { private boolean onLevelWaitTime(final User sender) {
if (levelWaitTime.containsKey(sender.getUniqueId())) { if (levelWaitTime.containsKey(sender.getUniqueId())) {
return levelWaitTime.get(sender.getUniqueId()).longValue() > Calendar.getInstance().getTimeInMillis(); return levelWaitTime.get(sender.getUniqueId()) > Calendar.getInstance().getTimeInMillis();
} }
return false; return false;
@ -85,8 +82,8 @@ public class LevelPresenter {
private long getLevelWaitTime(final User sender) { private long getLevelWaitTime(final User sender) {
if (levelWaitTime.containsKey(sender.getUniqueId())) { if (levelWaitTime.containsKey(sender.getUniqueId())) {
if (levelWaitTime.get(sender.getUniqueId()).longValue() > Calendar.getInstance().getTimeInMillis()) { if (levelWaitTime.get(sender.getUniqueId()) > Calendar.getInstance().getTimeInMillis()) {
return (levelWaitTime.get(sender.getUniqueId()).longValue() - Calendar.getInstance().getTimeInMillis()) / 1000; return (levelWaitTime.get(sender.getUniqueId()) - Calendar.getInstance().getTimeInMillis()) / 1000;
} }
return 0L; return 0L;

View File

@ -14,7 +14,6 @@ import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import bentobox.addon.level.database.object.LevelsData;
import bentobox.addon.level.database.object.TopTenData; import bentobox.addon.level.database.object.TopTenData;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder; import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
@ -29,11 +28,11 @@ import world.bentobox.bentobox.database.Database;
* *
*/ */
public class TopTen implements Listener { public class TopTen implements Listener {
private Level addon; private final Level addon;
// Top ten list of players // Top ten list of players
private Map<World,TopTenData> topTenList; private Map<World,TopTenData> topTenList;
private final int[] SLOTS = new int[] {4, 12, 14, 19, 20, 21, 22, 23, 24, 25}; private final int[] SLOTS = new int[] {4, 12, 14, 19, 20, 21, 22, 23, 24, 25};
private Database<TopTenData> handler; private final Database<TopTenData> handler;
public TopTen(Level addon) { public TopTen(Level addon) {
this.addon = addon; this.addon = addon;
@ -46,8 +45,8 @@ public class TopTen implements Listener {
/** /**
* Adds a player to the top ten, if the level is good enough * Adds a player to the top ten, if the level is good enough
* *
* @param ownerUUID * @param ownerUUID - owner UUID
* @param l * @param l - level
*/ */
public void addEntry(World world, UUID ownerUUID, long l) { public void addEntry(World world, UUID ownerUUID, long l) {
// Check if player is an island owner or not // Check if player is an island owner or not
@ -60,52 +59,22 @@ public class TopTen implements Listener {
// Try and see if the player is online // Try and see if the player is online
Player player = addon.getServer().getPlayer(ownerUUID); Player player = addon.getServer().getPlayer(ownerUUID);
if (player != null) { if (player != null && !player.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(world) + ".intopten")) {
// Online
if (!player.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(world) + ".intopten")) {
topTenList.get(world).remove(ownerUUID); topTenList.get(world).remove(ownerUUID);
return; return;
} }
}
topTenList.get(world).addLevel(ownerUUID, l); topTenList.get(world).addLevel(ownerUUID, l);
} }
/**
* Creates the top ten list from scratch. Does not get the level of each island. Just
* takes the level from the player's file.
* Runs asynchronously from the main thread.
*/
public void create(String permPrefix) {
// Obtain all the levels for each known player
Database<LevelsData> levelHandler = addon.getHandler();
long index = 0;
for (LevelsData lv : levelHandler.loadObjects()) {
if (index++ % 1000 == 0) {
addon.getLogger().info("Processed " + index + " players for top ten");
}
// Convert to UUID
UUID playerUUID = UUID.fromString(lv.getUniqueId());
// Get the world
lv.getLevels().forEach((k,v) -> addEntry(Bukkit.getWorld(k), playerUUID, v));
}
saveTopTen();
}
/** /**
* Displays the Top Ten list * Displays the Top Ten list
* @param world * @param world - world
* * @param user - the requesting player
* @param user
* - the requesting player
* @return - true if successful, false if no Top Ten list exists
*/ */
public boolean getGUI(World world, final User user, String permPrefix) { public void getGUI(World world, final User user, String permPrefix) {
// Check world // Check world
topTenList.putIfAbsent(world, new TopTenData()); topTenList.putIfAbsent(world, new TopTenData());
topTenList.get(world).setUniqueId(world.getName()); topTenList.get(world).setUniqueId(world.getName());
boolean DEBUG = false;
if (DEBUG)
addon.getLogger().info("DEBUG: GUI display");
PanelBuilder panel = new PanelBuilder() PanelBuilder panel = new PanelBuilder()
.name(user.getTranslation("island.top.gui-title")) .name(user.getTranslation("island.top.gui-title"))
@ -116,22 +85,14 @@ public class TopTen implements Listener {
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry<UUID, Long> m = it.next(); Map.Entry<UUID, Long> m = it.next();
UUID topTenUUID = m.getKey(); UUID topTenUUID = m.getKey();
if (DEBUG)
addon.getLogger().info("DEBUG: " + i + ": " + topTenUUID);
// Remove from TopTen if the player is online and has the permission // Remove from TopTen if the player is online and has the permission
Player entry = addon.getServer().getPlayer(topTenUUID); Player entry = addon.getServer().getPlayer(topTenUUID);
boolean show = true; boolean show = true;
if (entry != null) { if (entry != null) {
if (DEBUG)
addon.getLogger().info("DEBUG: removing from topten");
if (!entry.hasPermission(permPrefix + "intopten")) { if (!entry.hasPermission(permPrefix + "intopten")) {
it.remove(); it.remove();
show = false; show = false;
} }
} else {
if (DEBUG)
addon.getLogger().info("DEBUG: player not online, so no per check");
} }
if (show) { if (show) {
panel.item(SLOTS[i-1], getHead(i, m.getValue(), topTenUUID, user, world)); panel.item(SLOTS[i-1], getHead(i, m.getValue(), topTenUUID, user, world));
@ -139,7 +100,6 @@ public class TopTen implements Listener {
} }
} }
panel.build(); panel.build();
return true;
} }
/** /**
@ -168,21 +128,6 @@ public class TopTen implements Listener {
.icon(name) .icon(name)
.name(name) .name(name)
.description(description); .description(description);
// If welcome warps is present then add warping
/*
addon.getAddonByName("BSkyBlock-WelcomeWarps").ifPresent(warp -> {
if (((Warp)warp).getWarpSignsManager().hasWarp(world, playerUUID)) {
builder.clickHandler((panel, user, click, slot) -> {
if (click.equals(ClickType.LEFT)) {
user.sendMessage("island.top.warp-to", "[name]", name);
((Warp)warp).getWarpSignsManager().warpPlayer(world, user, playerUUID);
}
return true;
});
}
});*/
return builder.build(); return builder.build();
} }
@ -193,7 +138,7 @@ public class TopTen implements Listener {
/** /**
* Loads all the top tens from the database * Loads all the top tens from the database
*/ */
public void loadTopTen() { private void loadTopTen() {
topTenList = new HashMap<>(); topTenList = new HashMap<>();
handler.loadObjects().forEach(tt -> topTenList.put(Bukkit.getWorld(tt.getUniqueId()), tt)); handler.loadObjects().forEach(tt -> topTenList.put(Bukkit.getWorld(tt.getUniqueId()), tt));
} }
@ -201,7 +146,7 @@ public class TopTen implements Listener {
/** /**
* Removes ownerUUID from the top ten list * Removes ownerUUID from the top ten list
* *
* @param ownerUUID * @param ownerUUID - uuid to remove
*/ */
public void removeEntry(World world, UUID ownerUUID) { public void removeEntry(World world, UUID ownerUUID) {
topTenList.putIfAbsent(world, new TopTenData()); topTenList.putIfAbsent(world, new TopTenData());

View File

@ -17,11 +17,9 @@ import org.bukkit.scheduler.BukkitTask;
import com.google.common.collect.HashMultiset; import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset; import com.google.common.collect.Multiset;
import com.google.common.collect.Multiset.Entry; import com.google.common.collect.Multiset.Entry;
import bentobox.addon.level.Level;
import com.google.common.collect.Multisets; import com.google.common.collect.Multisets;
import bentobox.addon.level.Level;
import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Pair; import world.bentobox.bentobox.util.Pair;
import world.bentobox.bentobox.util.Util; import world.bentobox.bentobox.util.Util;
@ -31,6 +29,7 @@ public class CalcIslandLevel {
private static final int MAX_CHUNKS = 200; private static final int MAX_CHUNKS = 200;
private static final long SPEED = 1; private static final long SPEED = 1;
private static final String LINE_BREAK = "==================================";
private boolean checking; private boolean checking;
private final BukkitTask task; private final BukkitTask task;
@ -124,7 +123,8 @@ public class CalcIslandLevel {
for (int y = 0; y < island.getCenter().getWorld().getMaxHeight(); y++) { for (int y = 0; y < island.getCenter().getWorld().getMaxHeight(); y++) {
Material blockData = chunk.getBlockType(x, y, z); Material blockData = chunk.getBlockType(x, y, z);
boolean belowSeaLevel = addon.getSettings().getSeaHeight() > 0 && y <= addon.getSettings().getSeaHeight(); int seaHeight = addon.getPlugin().getIWM().getSeaHeight(world);
boolean belowSeaLevel = seaHeight > 0 && y <= seaHeight;
// Air is free // Air is free
if (!blockData.equals(Material.AIR)) { if (!blockData.equals(Material.AIR)) {
checkBlock(blockData, belowSeaLevel); checkBlock(blockData, belowSeaLevel);
@ -147,7 +147,11 @@ public class CalcIslandLevel {
/** /**
* Checks if a block has been limited or not and whether a block has any value or not * Checks if a block has been limited or not and whether a block has any value or not
<<<<<<< HEAD
* @param md Material * @param md Material
=======
* @param md - Material to check
>>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git
* @return value of the block if can be counted * @return value of the block if can be counted
*/ */
private int limitCount(Material md) { private int limitCount(Material md) {
@ -171,7 +175,11 @@ public class CalcIslandLevel {
/** /**
* Get value of a material * Get value of a material
* World blocks trump regular block values * World blocks trump regular block values
<<<<<<< HEAD
* @param md Material * @param md Material
=======
* @param md - Material to check
>>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git
* @return value of a material * @return value of a material
*/ */
private int getValue(Material md) { private int getValue(Material md) {
@ -184,7 +192,11 @@ public class CalcIslandLevel {
/** /**
* Get a set of all the chunks in island * Get a set of all the chunks in island
* @param island - island * @param island - island
<<<<<<< HEAD
* @return - set of all the chunks in the island to scan * @return - set of all the chunks in the island to scan
=======
* @return - set of pairs of x,z coordinates to check
>>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git
*/ */
private Set<Pair<Integer, Integer>> getChunksToScan(Island island) { private Set<Pair<Integer, Integer>> getChunksToScan(Island island) {
Set<Pair<Integer, Integer>> chunkSnapshot = new HashSet<>(); Set<Pair<Integer, Integer>> chunkSnapshot = new HashSet<>();
@ -226,7 +238,7 @@ public class CalcIslandLevel {
reportLines.add("Level cost = " + addon.getSettings().getLevelCost()); reportLines.add("Level cost = " + addon.getSettings().getLevelCost());
reportLines.add("Deaths handicap = " + result.deathHandicap); reportLines.add("Deaths handicap = " + result.deathHandicap);
reportLines.add("Level calculated = " + result.level); reportLines.add("Level calculated = " + result.level);
reportLines.add("=================================="); reportLines.add(LINE_BREAK);
int total = 0; int total = 0;
if (!result.uwCount.isEmpty()) { if (!result.uwCount.isEmpty()) {
reportLines.add("Underwater block count (Multiplier = x" + addon.getSettings().getUnderWaterMultiplier() + ") value"); reportLines.add("Underwater block count (Multiplier = x" + addon.getSettings().getUnderWaterMultiplier() + ") value");
@ -251,7 +263,7 @@ public class CalcIslandLevel {
} }
reportLines.add(type.getElement().toString() + ": " + String.format("%,d",type.getCount()) + " blocks (max " + limit + explain); reportLines.add(type.getElement().toString() + ": " + String.format("%,d",type.getCount()) + " blocks (max " + limit + explain);
} }
reportLines.add("=================================="); reportLines.add(LINE_BREAK);
reportLines.add("Blocks on island that are not in config.yml"); reportLines.add("Blocks on island that are not in config.yml");
reportLines.add("Total number = " + String.format("%,d",result.ncCount.size())); reportLines.add("Total number = " + String.format("%,d",result.ncCount.size()));
entriesSortedByCount = result.ncCount.entrySet(); entriesSortedByCount = result.ncCount.entrySet();
@ -260,13 +272,13 @@ public class CalcIslandLevel {
Entry<Material> type = it.next(); Entry<Material> type = it.next();
reportLines.add(type.getElement().toString() + ": " + String.format("%,d",type.getCount()) + " blocks"); reportLines.add(type.getElement().toString() + ": " + String.format("%,d",type.getCount()) + " blocks");
} }
reportLines.add("================================="); reportLines.add(LINE_BREAK);
return reportLines; return reportLines;
} }
private Collection<String> sortedReport(int total, Multiset<Material> MaterialCount) { private Collection<String> sortedReport(int total, Multiset<Material> MaterialCount) {
Collection<String> result = new ArrayList<>(); Collection<String> r = new ArrayList<>();
Iterable<Multiset.Entry<Material>> entriesSortedByCount = Multisets.copyHighestCountFirst(MaterialCount).entrySet(); Iterable<Multiset.Entry<Material>> entriesSortedByCount = Multisets.copyHighestCountFirst(MaterialCount).entrySet();
for (Entry<Material> en : entriesSortedByCount) { for (Entry<Material> en : entriesSortedByCount) {
Material type = en.getElement(); Material type = en.getElement();
@ -276,13 +288,13 @@ public class CalcIslandLevel {
// Specific // Specific
value = addon.getSettings().getBlockValues().get(type); value = addon.getSettings().getBlockValues().get(type);
} }
result.add(type.toString() + ":" r.add(type.toString() + ":"
+ String.format("%,d", en.getCount()) + " blocks x " + value + " = " + (value * en.getCount())); + String.format("%,d", en.getCount()) + " blocks x " + value + " = " + (value * en.getCount()));
total += (value * en.getCount()); total += (value * en.getCount());
} }
result.add("Subtotal = " + total); r.add("Subtotal = " + total);
result.add("=================================="); r.add(LINE_BREAK);
return result; return r;
} }
/** /**

View File

@ -19,14 +19,14 @@ import world.bentobox.bentobox.database.objects.Island;
*/ */
public class PlayerLevel { public class PlayerLevel {
private Level addon; private final Level addon;
private Island island; private final Island island;
private World world; private final World world;
private User asker; private final User asker;
private UUID targetPlayer; private final UUID targetPlayer;
private long oldLevel; private final long oldLevel;
private CalcIslandLevel calc; private CalcIslandLevel calc;
@ -34,7 +34,7 @@ public class PlayerLevel {
public PlayerLevel(final Level addon, final Island island, final UUID targetPlayer, final User asker) { public PlayerLevel(final Level addon, final Island island, final UUID targetPlayer, final User asker) {
this.addon = addon; this.addon = addon;
this.island = island; this.island = island;
this.world = island != null ? island.getCenter().getWorld() : null; this.world = island.getCenter().getWorld();
this.asker = asker; this.asker = asker;
this.targetPlayer = targetPlayer; this.targetPlayer = targetPlayer;
this.oldLevel = addon.getIslandLevel(world, targetPlayer); this.oldLevel = addon.getIslandLevel(world, targetPlayer);
@ -44,20 +44,26 @@ public class PlayerLevel {
addon.getServer().getPluginManager().callEvent(e); addon.getServer().getPluginManager().callEvent(e);
if (!e.isCancelled()) { if (!e.isCancelled()) {
// Calculate if not cancelled // Calculate if not cancelled
calc = new CalcIslandLevel(addon, island, ()-> informPlayers()); calc = new CalcIslandLevel(addon, island, this::fireIslandLevelCalcEvent);
} }
} }
private void informPlayers() { private void fireIslandLevelCalcEvent() {
// Fire post calculation event // Fire post calculation event
IslandLevelCalculatedEvent ilce = new IslandLevelCalculatedEvent(targetPlayer, island, calc.getResult()); IslandLevelCalculatedEvent ilce = new IslandLevelCalculatedEvent(targetPlayer, island, calc.getResult());
addon.getServer().getPluginManager().callEvent(ilce); addon.getServer().getPluginManager().callEvent(ilce);
Results results = ilce.getResults(); Results results = ilce.getResults();
// Save the results // Save the results
island.getMemberSet().forEach(m -> addon.setIslandLevel(world, m, results.getLevel())); island.getMemberSet().forEach(m -> addon.setIslandLevel(world, m, results.getLevel()));
// Display result // Display result if event is not cancelled
if (!ilce.isCancelled()) { if (!ilce.isCancelled()) {
informPlayers(results);
}
}
private void informPlayers(Results results) {
// Tell the asker // Tell the asker
asker.sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer))); asker.sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
// Console // Console
@ -75,13 +81,11 @@ public class PlayerLevel {
} }
// Tell other team members // Tell other team members
if (addon.getIslandLevel(world, targetPlayer) != oldLevel) { if (addon.getIslandLevel(world, targetPlayer) != oldLevel) {
for (UUID member : island.getMemberSet()) { island.getMemberSet().stream()
if (!member.equals(asker.getUniqueId())) { .filter(u -> !u.equals(asker.getUniqueId()))
User.getInstance(member).sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer))); .forEach(m -> User.getInstance(m).sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer))));
}
}
}
} }
} }

View File

@ -22,7 +22,6 @@ public class AdminLevel extends CompositeCommand {
// Asking for another player's level? // Asking for another player's level?
// Convert name to a UUID // Convert name to a UUID
final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0)); final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0));
//getLogger().info("DEBUG: console player info UUID = " + playerUUID);
if (playerUUID == null) { if (playerUUID == null) {
user.sendMessage("general.errors.unknown-player"); user.sendMessage("general.errors.unknown-player");
return true; return true;

View File

@ -22,7 +22,6 @@ public class IslandLevel extends CompositeCommand {
// Asking for another player's level? // Asking for another player's level?
// Convert name to a UUID // Convert name to a UUID
final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0)); final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0));
//getLogger().info("DEBUG: console player info UUID = " + playerUUID);
if (playerUUID == null) { if (playerUUID == null) {
user.sendMessage("general.errors.unknown-player"); user.sendMessage("general.errors.unknown-player");
return true; return true;

View File

@ -13,14 +13,12 @@ import bentobox.addon.level.Level;
public class Settings { public class Settings {
private boolean sumTeamDeaths; private boolean sumTeamDeaths;
private int seaHeight;
private Map<Material, Integer> blockLimits = new HashMap<>(); private Map<Material, Integer> blockLimits = new HashMap<>();
private Map<Material, Integer> blockValues = new HashMap<>(); private Map<Material, Integer> blockValues = new HashMap<>();
private Map<World, Map<Material, Integer>> worldBlockValues = new HashMap<>(); private final Map<World, Map<Material, Integer>> worldBlockValues = new HashMap<>();
private double underWaterMultiplier; private double underWaterMultiplier;
private int deathpenalty; private int deathpenalty;
private long levelCost; private long levelCost;
private Object defaultLanguage;
private int levelWait; private int levelWait;
private int maxDeaths; private int maxDeaths;
private boolean islandResetDeathReset; private boolean islandResetDeathReset;
@ -47,30 +45,29 @@ public class Settings {
} }
if (level.getConfig().isSet("limits")) { if (level.getConfig().isSet("limits")) {
HashMap<Material, Integer> blockLimits = new HashMap<>(); HashMap<Material, Integer> bl = new HashMap<>();
for (String material : level.getConfig().getConfigurationSection("limits").getKeys(false)) { for (String material : level.getConfig().getConfigurationSection("limits").getKeys(false)) {
try { try {
Material mat = Material.valueOf(material); Material mat = Material.valueOf(material);
blockLimits.put(mat, level.getConfig().getInt("limits." + material, 0)); bl.put(mat, level.getConfig().getInt("limits." + material, 0));
} catch (Exception e) { } catch (Exception e) {
level.getLogger().warning("Unknown material (" + material + ") in blockvalues.yml Limits section. Skipping..."); level.getLogger().warning(() -> "Unknown material (" + material + ") in blockvalues.yml Limits section. Skipping...");
} }
} }
setBlockLimits(blockLimits); setBlockLimits(bl);
} }
if (level.getConfig().isSet("blocks")) { if (level.getConfig().isSet("blocks")) {
Map<Material, Integer> blockValues = new HashMap<>(); Map<Material, Integer> bv = new HashMap<>();
for (String material : level.getConfig().getConfigurationSection("blocks").getKeys(false)) { for (String material : level.getConfig().getConfigurationSection("blocks").getKeys(false)) {
try { try {
Material mat = Material.valueOf(material); Material mat = Material.valueOf(material);
blockValues.put(mat, level.getConfig().getInt("blocks." + material, 0)); bv.put(mat, level.getConfig().getInt("blocks." + material, 0));
} catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); level.getLogger().warning(()-> "Unknown material (" + material + ") in config.yml blocks section. Skipping...");
level.getLogger().warning("Unknown material (" + material + ") in config.yml blocks section. Skipping...");
} }
} }
setBlockValues(blockValues); setBlockValues(bv);
} else { } else {
level.getLogger().severe("No block values in config.yml! All island levels will be zero!"); level.getLogger().severe("No block values in config.yml! All island levels will be zero!");
} }
@ -88,7 +85,7 @@ public class Settings {
worldBlockValues.put(bWorld, values); worldBlockValues.put(bWorld, values);
} }
} else { } else {
level.getLogger().severe("Level Addon: No such world : " + world); level.getLogger().severe(() -> "Level Addon: No such world : " + world);
} }
} }
} }
@ -104,21 +101,9 @@ public class Settings {
/** /**
* @param sumTeamDeaths the sumTeamDeaths to set * @param sumTeamDeaths the sumTeamDeaths to set
*/ */
public final void setSumTeamDeaths(boolean sumTeamDeaths) { private void setSumTeamDeaths(boolean sumTeamDeaths) {
this.sumTeamDeaths = sumTeamDeaths; this.sumTeamDeaths = sumTeamDeaths;
} }
/**
* @return the seaHeight
*/
public final int getSeaHeight() {
return seaHeight;
}
/**
* @param seaHeight the seaHeight to set
*/
public final void setSeaHeight(int seaHeight) {
this.seaHeight = seaHeight;
}
/** /**
* @return the blockLimits * @return the blockLimits
*/ */
@ -128,7 +113,7 @@ public class Settings {
/** /**
* @param blockLimits2 the blockLimits to set * @param blockLimits2 the blockLimits to set
*/ */
public final void setBlockLimits(HashMap<Material, Integer> blockLimits2) { private void setBlockLimits(HashMap<Material, Integer> blockLimits2) {
this.blockLimits = blockLimits2; this.blockLimits = blockLimits2;
} }
/** /**
@ -140,7 +125,7 @@ public class Settings {
/** /**
* @param blockValues2 the blockValues to set * @param blockValues2 the blockValues to set
*/ */
public final void setBlockValues(Map<Material, Integer> blockValues2) { private void setBlockValues(Map<Material, Integer> blockValues2) {
this.blockValues = blockValues2; this.blockValues = blockValues2;
} }
/** /**
@ -152,7 +137,7 @@ public class Settings {
/** /**
* @param underWaterMultiplier the underWaterMultiplier to set * @param underWaterMultiplier the underWaterMultiplier to set
*/ */
public final void setUnderWaterMultiplier(double underWaterMultiplier) { private void setUnderWaterMultiplier(double underWaterMultiplier) {
this.underWaterMultiplier = underWaterMultiplier; this.underWaterMultiplier = underWaterMultiplier;
} }
/** /**
@ -164,7 +149,7 @@ public class Settings {
/** /**
* @param deathpenalty the deathpenalty to set * @param deathpenalty the deathpenalty to set
*/ */
public final void setDeathpenalty(int deathpenalty) { private void setDeathpenalty(int deathpenalty) {
this.deathpenalty = deathpenalty; this.deathpenalty = deathpenalty;
} }
/** /**
@ -176,34 +161,23 @@ public class Settings {
/** /**
* @param levelCost the levelCost to set * @param levelCost the levelCost to set
*/ */
public final void setLevelCost(long levelCost) { private void setLevelCost(long levelCost) {
this.levelCost = levelCost; this.levelCost = levelCost;
} }
/**
* @return the defaultLanguage
*/
public final Object getDefaultLanguage() {
return defaultLanguage;
}
/**
* @param defaultLanguage the defaultLanguage to set
*/
public final void setDefaultLanguage(Object defaultLanguage) {
this.defaultLanguage = defaultLanguage;
}
/** /**
* @return the levelWait * @return the levelWait
*/ */
public final int getLevelWait() { private int getLevelWait() {
return levelWait; return levelWait;
} }
/** /**
* @param levelWait the levelWait to set * @param levelWait the levelWait to set
*/ */
public final void setLevelWait(int levelWait) { private void setLevelWait(int levelWait) {
this.levelWait = levelWait; this.levelWait = levelWait;
} }
/** /**
* TODO: Use max deaths
* @return the maxDeaths * @return the maxDeaths
*/ */
public final int getMaxDeaths() { public final int getMaxDeaths() {
@ -212,7 +186,7 @@ public class Settings {
/** /**
* @param maxDeaths the maxDeaths to set * @param maxDeaths the maxDeaths to set
*/ */
public final void setMaxDeaths(int maxDeaths) { private void setMaxDeaths(int maxDeaths) {
this.maxDeaths = maxDeaths; this.maxDeaths = maxDeaths;
} }
/** /**
@ -224,7 +198,7 @@ public class Settings {
/** /**
* @param islandResetDeathReset the islandResetDeathReset to set * @param islandResetDeathReset the islandResetDeathReset to set
*/ */
public final void setIslandResetDeathReset(boolean islandResetDeathReset) { private void setIslandResetDeathReset(boolean islandResetDeathReset) {
this.islandResetDeathReset = islandResetDeathReset; this.islandResetDeathReset = islandResetDeathReset;
} }
/** /**
@ -236,7 +210,7 @@ public class Settings {
/** /**
* @param teamJoinDeathReset the teamJoinDeathReset to set * @param teamJoinDeathReset the teamJoinDeathReset to set
*/ */
public final void setTeamJoinDeathReset(boolean teamJoinDeathReset) { private void setTeamJoinDeathReset(boolean teamJoinDeathReset) {
this.teamJoinDeathReset = teamJoinDeathReset; this.teamJoinDeathReset = teamJoinDeathReset;
} }

View File

@ -26,9 +26,9 @@ public class LevelsData implements DataObject {
/** /**
* Create a level entry for target player * Create a level entry for target player
* @param targetPlayer * @param targetPlayer - target player
* @param level * @param level - level
* @param world * @param world - world
*/ */
public LevelsData(UUID targetPlayer, long level, World world) { public LevelsData(UUID targetPlayer, long level, World world) {
uniqueId = targetPlayer.toString(); uniqueId = targetPlayer.toString();

View File

@ -23,8 +23,6 @@ public class TopTenData implements DataObject {
@Expose @Expose
private Map<UUID, Long> topTen = new LinkedHashMap<>(); private Map<UUID, Long> topTen = new LinkedHashMap<>();
public TopTenData() {}
public Map<UUID, Long> getTopTen() { public Map<UUID, Long> getTopTen() {
return topTen.entrySet().stream() return topTen.entrySet().stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue())).limit(10) .sorted(Collections.reverseOrder(Map.Entry.comparingByValue())).limit(10)
@ -57,7 +55,7 @@ public class TopTenData implements DataObject {
/** /**
* Get the level for this UUID, or zero if the UUID is not found * Get the level for this UUID, or zero if the UUID is not found
* @param uuid * @param uuid - UUID to check
* @return island level * @return island level
*/ */
public long getLevel(UUID uuid) { public long getLevel(UUID uuid) {
@ -68,7 +66,7 @@ public class TopTenData implements DataObject {
/** /**
* Removes ownerUUID from the top ten * Removes ownerUUID from the top ten
* @param ownerUUID * @param ownerUUID - UUID to remove
*/ */
public void remove(UUID ownerUUID) { public void remove(UUID ownerUUID) {
this.topTen.remove(ownerUUID); this.topTen.remove(ownerUUID);

View File

@ -18,9 +18,9 @@ public class IslandLevelCalculatedEvent extends IslandBaseEvent {
private UUID targetPlayer; private UUID targetPlayer;
/** /**
* @param targetPlayer * @param targetPlayer - target player
* @param island * @param island - island
* @param results * @param results - results object to set
*/ */
public IslandLevelCalculatedEvent(UUID targetPlayer, Island island, Results results) { public IslandLevelCalculatedEvent(UUID targetPlayer, Island island, Results results) {
super(island); super(island);

View File

@ -12,7 +12,7 @@ import world.bentobox.bentobox.database.objects.Island;
*/ */
public class IslandPreLevelEvent extends IslandBaseEvent { public class IslandPreLevelEvent extends IslandBaseEvent {
private UUID targetPlayer; private final UUID targetPlayer;
/** /**

View File

@ -9,7 +9,7 @@ import org.bukkit.event.HandlerList;
* *
* @author tastybento * @author tastybento
*/ */
public class TopTenClick extends Event implements Cancellable { class TopTenClick extends Event implements Cancellable {
private boolean cancelled; private boolean cancelled;
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -40,10 +40,10 @@ public class TopTenClick extends Event implements Cancellable {
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return getHandlerList();
} }
public static HandlerList getHandlerList() { private static HandlerList getHandlerList() {
return handlers; return handlers;
} }

View File

@ -15,10 +15,10 @@ import bentobox.addon.level.Level;
*/ */
public class JoinLeaveListener implements Listener { public class JoinLeaveListener implements Listener {
private Level addon; private final Level addon;
/** /**
* @param addon * @param addon - addon
*/ */
public JoinLeaveListener(Level addon) { public JoinLeaveListener(Level addon) {
this.addon = addon; this.addon = addon;

View File

@ -20,11 +20,11 @@ import world.bentobox.bentobox.database.objects.Island;
*/ */
public class NewIslandListener implements Listener { public class NewIslandListener implements Listener {
private Level addon; private final Level addon;
private Map<Island, CalcIslandLevel> cil; private final Map<Island, CalcIslandLevel> cil;
/** /**
* @param addon * @param addon - addon
*/ */
public NewIslandListener(Level addon) { public NewIslandListener(Level addon) {
this.addon = addon; this.addon = addon;

View File

@ -46,17 +46,17 @@ limits:
blocks: blocks:
ACACIA_BUTTON: 1 ACACIA_BUTTON: 1
ACACIA_DOOR: 1 ACACIA_DOOR: 2
ACACIA_FENCE: 2 ACACIA_FENCE: 2
ACACIA_FENCE_GATE: 1 ACACIA_FENCE_GATE: 4
ACACIA_LEAVES: 0 ACACIA_LEAVES: 0
ACACIA_LOG: 0 ACACIA_LOG: 0
ACACIA_PLANKS: 1 ACACIA_PLANKS: 1
ACACIA_PRESSURE_PLATE: 1 ACACIA_PRESSURE_PLATE: 2
ACACIA_SAPLING: 1 ACACIA_SAPLING: 1
ACACIA_SLAB: 1 ACACIA_SLAB: 1
ACACIA_STAIRS: 2 ACACIA_STAIRS: 2
ACACIA_TRAPDOOR: 1 ACACIA_TRAPDOOR: 3
ACACIA_WOOD: 1 ACACIA_WOOD: 1
ACTIVATOR_RAIL: 1 ACTIVATOR_RAIL: 1
ALLIUM: 1 ALLIUM: 1
@ -70,44 +70,44 @@ blocks:
BEDROCK: 0 BEDROCK: 0
BEETROOTS: 1 BEETROOTS: 1
BIRCH_BUTTON: 1 BIRCH_BUTTON: 1
BIRCH_DOOR: 1 BIRCH_DOOR: 2
BIRCH_FENCE: 2 BIRCH_FENCE: 2
BIRCH_FENCE_GATE: 1 BIRCH_FENCE_GATE: 4
BIRCH_LEAVES: 0 BIRCH_LEAVES: 0
BIRCH_LOG: 0 BIRCH_LOG: 0
BIRCH_PLANKS: 1 BIRCH_PLANKS: 1
BIRCH_PRESSURE_PLATE: 1 BIRCH_PRESSURE_PLATE: 2
BIRCH_SAPLING: 1 BIRCH_SAPLING: 1
BIRCH_SLAB: 1 BIRCH_SLAB: 1
BIRCH_STAIRS: 2 BIRCH_STAIRS: 2
BIRCH_TRAPDOOR: 1 BIRCH_TRAPDOOR: 3
BIRCH_WOOD: 1 BIRCH_WOOD: 1
BLACK_BANNER: 2 BLACK_BANNER: 2
BLACK_BED: 2 BLACK_BED: 6
BLACK_CARPET: 1 BLACK_CARPET: 1
BLACK_CONCRETE: 1 BLACK_CONCRETE: 3
BLACK_CONCRETE_POWDER: 1 BLACK_CONCRETE_POWDER: 2
BLACK_GLAZED_TERRACOTTA: 1 BLACK_GLAZED_TERRACOTTA: 5
BLACK_SHULKER_BOX: 1 BLACK_SHULKER_BOX: 11
BLACK_STAINED_GLASS: 2 BLACK_STAINED_GLASS: 2
BLACK_STAINED_GLASS_PANE: 1 BLACK_STAINED_GLASS_PANE: 1
BLACK_TERRACOTTA: 1 BLACK_TERRACOTTA: 2
BLACK_WALL_BANNER: 2 BLACK_WALL_BANNER: 2
BLACK_WOOL: 1 BLACK_WOOL: 2
BLUE_BANNER: 2 BLUE_BANNER: 2
BLUE_BED: 2 BLUE_BED: 6
BLUE_CARPET: 1 BLUE_CARPET: 1
BLUE_CONCRETE: 1 BLUE_CONCRETE: 3
BLUE_CONCRETE_POWDER: 1 BLUE_CONCRETE_POWDER: 2
BLUE_GLAZED_TERRACOTTA: 1 BLUE_GLAZED_TERRACOTTA: 5
BLUE_ICE: 1 BLUE_ICE: 1
BLUE_ORCHID: 1 BLUE_ORCHID: 1
BLUE_SHULKER_BOX: 1 BLUE_SHULKER_BOX: 11
BLUE_STAINED_GLASS: 2 BLUE_STAINED_GLASS: 2
BLUE_STAINED_GLASS_PANE: 1 BLUE_STAINED_GLASS_PANE: 1
BLUE_TERRACOTTA: 1 BLUE_TERRACOTTA: 2
BLUE_WALL_BANNER: 2 BLUE_WALL_BANNER: 2
BLUE_WOOL: 1 BLUE_WOOL: 2
BONE_BLOCK: 1 BONE_BLOCK: 1
BOOKSHELF: 5 BOOKSHELF: 5
BRAIN_CORAL: 1 BRAIN_CORAL: 1
@ -119,50 +119,50 @@ blocks:
BRICK_SLAB: 3 BRICK_SLAB: 3
BRICK_STAIRS: 5 BRICK_STAIRS: 5
BROWN_BANNER: 2 BROWN_BANNER: 2
BROWN_BED: 2 BROWN_BED: 6
BROWN_CARPET: 1 BROWN_CARPET: 1
BROWN_CONCRETE: 1 BROWN_CONCRETE: 3
BROWN_CONCRETE_POWDER: 1 BROWN_CONCRETE_POWDER: 2
BROWN_GLAZED_TERRACOTTA: 1 BROWN_GLAZED_TERRACOTTA: 5
BROWN_MUSHROOM: 1 BROWN_MUSHROOM: 1
BROWN_MUSHROOM_BLOCK: 1 BROWN_MUSHROOM_BLOCK: 1
BROWN_SHULKER_BOX: 1 BROWN_SHULKER_BOX: 11
BROWN_STAINED_GLASS: 2 BROWN_STAINED_GLASS: 2
BROWN_STAINED_GLASS_PANE: 1 BROWN_STAINED_GLASS_PANE: 1
BROWN_TERRACOTTA: 1 BROWN_TERRACOTTA: 2
BROWN_WALL_BANNER: 2 BROWN_WALL_BANNER: 2
BROWN_WOOL: 1 BROWN_WOOL: 2
BUBBLE_COLUMN: 1 BUBBLE_COLUMN: 1
BUBBLE_CORAL: 1 BUBBLE_CORAL: 1
BUBBLE_CORAL_BLOCK: 1 BUBBLE_CORAL_BLOCK: 1
BUBBLE_CORAL_FAN: 1 BUBBLE_CORAL_FAN: 1
BUBBLE_CORAL_WALL_FAN: 1 BUBBLE_CORAL_WALL_FAN: 1
CACTUS: 1 CACTUS: 1
CAKE: 1 CAKE: 9
CARROTS: 1 CARROTS: 1
CARVED_PUMPKIN: 1 CARVED_PUMPKIN: 2
CAULDRON: 10 CAULDRON: 10
CAVE_AIR: 1 CAVE_AIR: 0
CHAIN_COMMAND_BLOCK: 1 CHAIN_COMMAND_BLOCK: 0
CHEST: 2 CHEST: 8
CHIPPED_ANVIL: 9 CHIPPED_ANVIL: 9
CHISELED_QUARTZ_BLOCK: 1 CHISELED_QUARTZ_BLOCK: 2
CHISELED_RED_SANDSTONE: 1 CHISELED_RED_SANDSTONE: 2
CHISELED_SANDSTONE: 1 CHISELED_SANDSTONE: 2
CHISELED_STONE_BRICKS: 2 CHISELED_STONE_BRICKS: 2
CHORUS_FLOWER: 1 CHORUS_FLOWER: 1
CHORUS_PLANT: 1 CHORUS_PLANT: 1
CLAY: 2 CLAY: 2
COAL_BLOCK: 9 COAL_BLOCK: 9
COAL_ORE: 1 COAL_ORE: 1
COARSE_DIRT: 1 COARSE_DIRT: 2
COBBLESTONE: 1 COBBLESTONE: 1
COBBLESTONE_SLAB: 1 COBBLESTONE_SLAB: 1
COBBLESTONE_STAIRS: 2 COBBLESTONE_STAIRS: 2
COBBLESTONE_WALL: 1 COBBLESTONE_WALL: 1
COBWEB: 10 COBWEB: 10
COCOA: 1 COCOA: 1
COMMAND_BLOCK: 1 COMMAND_BLOCK: 0
COMPARATOR: 10 COMPARATOR: 10
CONDUIT: 1 CONDUIT: 1
CRACKED_STONE_BRICKS: 2 CRACKED_STONE_BRICKS: 2
@ -172,31 +172,31 @@ blocks:
CUT_RED_SANDSTONE: 1 CUT_RED_SANDSTONE: 1
CUT_SANDSTONE: 1 CUT_SANDSTONE: 1
CYAN_BANNER: 2 CYAN_BANNER: 2
CYAN_BED: 2 CYAN_BED: 6
CYAN_CARPET: 1 CYAN_CARPET: 1
CYAN_CONCRETE: 1 CYAN_CONCRETE: 3
CYAN_CONCRETE_POWDER: 1 CYAN_CONCRETE_POWDER: 2
CYAN_GLAZED_TERRACOTTA: 1 CYAN_GLAZED_TERRACOTTA: 5
CYAN_SHULKER_BOX: 1 CYAN_SHULKER_BOX: 11
CYAN_STAINED_GLASS: 2 CYAN_STAINED_GLASS: 2
CYAN_STAINED_GLASS_PANE: 1 CYAN_STAINED_GLASS_PANE: 1
CYAN_TERRACOTTA: 1 CYAN_TERRACOTTA: 2
CYAN_WALL_BANNER: 2 CYAN_WALL_BANNER: 2
CYAN_WOOL: 1 CYAN_WOOL: 2
DAMAGED_ANVIL: 5 DAMAGED_ANVIL: 5
DANDELION: 1 DANDELION: 1
DARK_OAK_BUTTON: 1 DARK_OAK_BUTTON: 1
DARK_OAK_DOOR: 1 DARK_OAK_DOOR: 2
DARK_OAK_FENCE: 2 DARK_OAK_FENCE: 2
DARK_OAK_FENCE_GATE: 1 DARK_OAK_FENCE_GATE: 4
DARK_OAK_LEAVES: 0 DARK_OAK_LEAVES: 0
DARK_OAK_LOG: 0 DARK_OAK_LOG: 0
DARK_OAK_PLANKS: 1 DARK_OAK_PLANKS: 1
DARK_OAK_PRESSURE_PLATE: 1 DARK_OAK_PRESSURE_PLATE: 2
DARK_OAK_SAPLING: 1 DARK_OAK_SAPLING: 1
DARK_OAK_SLAB: 1 DARK_OAK_SLAB: 1
DARK_OAK_STAIRS: 2 DARK_OAK_STAIRS: 2
DARK_OAK_TRAPDOOR: 1 DARK_OAK_TRAPDOOR: 3
DARK_OAK_WOOD: 1 DARK_OAK_WOOD: 1
DARK_PRISMARINE: 1 DARK_PRISMARINE: 1
DARK_PRISMARINE_SLAB: 1 DARK_PRISMARINE_SLAB: 1
@ -222,7 +222,7 @@ blocks:
DIAMOND_BLOCK: 300 DIAMOND_BLOCK: 300
DIAMOND_ORE: 1 DIAMOND_ORE: 1
DIORITE: 1 DIORITE: 1
DIRT: 1 DIRT: 3
DISPENSER: 5 DISPENSER: 5
DRAGON_EGG: 150 DRAGON_EGG: 150
DRAGON_HEAD: 1 DRAGON_HEAD: 1
@ -255,36 +255,36 @@ blocks:
GOLD_BLOCK: 150 GOLD_BLOCK: 150
GOLD_ORE: 1 GOLD_ORE: 1
GRANITE: 1 GRANITE: 1
GRASS: 1 GRASS: 4
GRASS_BLOCK: 1 GRASS_BLOCK: 4
GRASS_PATH: 1 GRASS_PATH: 4
GRAVEL: 1 GRAVEL: 1
GRAY_BANNER: 2 GRAY_BANNER: 2
GRAY_BED: 2 GRAY_BED: 6
GRAY_CARPET: 1 GRAY_CARPET: 1
GRAY_CONCRETE: 1 GRAY_CONCRETE: 3
GRAY_CONCRETE_POWDER: 1 GRAY_CONCRETE_POWDER: 2
GRAY_GLAZED_TERRACOTTA: 1 GRAY_GLAZED_TERRACOTTA: 5
GRAY_SHULKER_BOX: 1 GRAY_SHULKER_BOX: 11
GRAY_STAINED_GLASS: 2 GRAY_STAINED_GLASS: 2
GRAY_STAINED_GLASS_PANE: 1 GRAY_STAINED_GLASS_PANE: 1
GRAY_TERRACOTTA: 1 GRAY_TERRACOTTA: 2
GRAY_WALL_BANNER: 2 GRAY_WALL_BANNER: 2
GRAY_WOOL: 1 GRAY_WOOL: 2
GREEN_BANNER: 2 GREEN_BANNER: 2
GREEN_BED: 2 GREEN_BED: 6
GREEN_CARPET: 1 GREEN_CARPET: 1
GREEN_CONCRETE: 1 GREEN_CONCRETE: 3
GREEN_CONCRETE_POWDER: 1 GREEN_CONCRETE_POWDER: 2
GREEN_GLAZED_TERRACOTTA: 1 GREEN_GLAZED_TERRACOTTA: 5
GREEN_SHULKER_BOX: 1 GREEN_SHULKER_BOX: 11
GREEN_STAINED_GLASS: 2 GREEN_STAINED_GLASS: 2
GREEN_STAINED_GLASS_PANE: 1 GREEN_STAINED_GLASS_PANE: 1
GREEN_TERRACOTTA: 1 GREEN_TERRACOTTA: 2
GREEN_WALL_BANNER: 2 GREEN_WALL_BANNER: 2
GREEN_WOOL: 1 GREEN_WOOL: 2
HAY_BLOCK: 2 HAY_BLOCK: 2
HEAVY_WEIGHTED_PRESSURE_PLATE: 1 HEAVY_WEIGHTED_PRESSURE_PLATE: 3
HOPPER: -10 HOPPER: -10
HORN_CORAL: 1 HORN_CORAL: 1
HORN_CORAL_BLOCK: 1 HORN_CORAL_BLOCK: 1
@ -297,85 +297,85 @@ blocks:
INFESTED_MOSSY_STONE_BRICKS: 2 INFESTED_MOSSY_STONE_BRICKS: 2
INFESTED_STONE: 1 INFESTED_STONE: 1
INFESTED_STONE_BRICKS: 2 INFESTED_STONE_BRICKS: 2
IRON_BARS: 1 IRON_BARS: 2
IRON_BLOCK: 10 IRON_BLOCK: 10
IRON_DOOR: 5 IRON_DOOR: 5
IRON_ORE: 1 IRON_ORE: 1
IRON_TRAPDOOR: 1 IRON_TRAPDOOR: 4
JACK_O_LANTERN: 1 JACK_O_LANTERN: 2
JUKEBOX: 10 JUKEBOX: 10
JUNGLE_BUTTON: 1 JUNGLE_BUTTON: 1
JUNGLE_DOOR: 1 JUNGLE_DOOR: 2
JUNGLE_FENCE: 2 JUNGLE_FENCE: 2
JUNGLE_FENCE_GATE: 1 JUNGLE_FENCE_GATE: 4
JUNGLE_LEAVES: 0 JUNGLE_LEAVES: 0
JUNGLE_LOG: 0 JUNGLE_LOG: 0
JUNGLE_PLANKS: 1 JUNGLE_PLANKS: 1
JUNGLE_PRESSURE_PLATE: 1 JUNGLE_PRESSURE_PLATE: 2
JUNGLE_SAPLING: 1 JUNGLE_SAPLING: 1
JUNGLE_SLAB: 1 JUNGLE_SLAB: 1
JUNGLE_STAIRS: 2 JUNGLE_STAIRS: 2
JUNGLE_TRAPDOOR: 1 JUNGLE_TRAPDOOR: 3
JUNGLE_WOOD: 1 JUNGLE_WOOD: 1
KELP: 1 KELP: 1
KELP_PLANT: 1 KELP_PLANT: 1
LADDER: 1 LADDER: 2
LAPIS_BLOCK: 10 LAPIS_BLOCK: 10
LAPIS_ORE: 1 LAPIS_ORE: 1
LARGE_FERN: 1 LARGE_FERN: 1
LAVA: 0 LAVA: 0
LEVER: 1 LEVER: 1
LIGHT_BLUE_BANNER: 2 LIGHT_BLUE_BANNER: 2
LIGHT_BLUE_BED: 2 LIGHT_BLUE_BED: 6
LIGHT_BLUE_CARPET: 1 LIGHT_BLUE_CARPET: 1
LIGHT_BLUE_CONCRETE: 1 LIGHT_BLUE_CONCRETE: 3
LIGHT_BLUE_CONCRETE_POWDER: 1 LIGHT_BLUE_CONCRETE_POWDER: 2
LIGHT_BLUE_GLAZED_TERRACOTTA: 1 LIGHT_BLUE_GLAZED_TERRACOTTA: 5
LIGHT_BLUE_SHULKER_BOX: 1 LIGHT_BLUE_SHULKER_BOX: 11
LIGHT_BLUE_STAINED_GLASS: 2 LIGHT_BLUE_STAINED_GLASS: 2
LIGHT_BLUE_STAINED_GLASS_PANE: 1 LIGHT_BLUE_STAINED_GLASS_PANE: 1
LIGHT_BLUE_TERRACOTTA: 1 LIGHT_BLUE_TERRACOTTA: 2
LIGHT_BLUE_WALL_BANNER: 2 LIGHT_BLUE_WALL_BANNER: 2
LIGHT_BLUE_WOOL: 1 LIGHT_BLUE_WOOL: 2
LIGHT_GRAY_BANNER: 2 LIGHT_GRAY_BANNER: 2
LIGHT_GRAY_BED: 2 LIGHT_GRAY_BED: 6
LIGHT_GRAY_CARPET: 1 LIGHT_GRAY_CARPET: 1
LIGHT_GRAY_CONCRETE: 1 LIGHT_GRAY_CONCRETE: 3
LIGHT_GRAY_CONCRETE_POWDER: 1 LIGHT_GRAY_CONCRETE_POWDER: 2
LIGHT_GRAY_GLAZED_TERRACOTTA: 1 LIGHT_GRAY_GLAZED_TERRACOTTA: 5
LIGHT_GRAY_SHULKER_BOX: 1 LIGHT_GRAY_SHULKER_BOX: 11
LIGHT_GRAY_STAINED_GLASS: 2 LIGHT_GRAY_STAINED_GLASS: 2
LIGHT_GRAY_STAINED_GLASS_PANE: 1 LIGHT_GRAY_STAINED_GLASS_PANE: 1
LIGHT_GRAY_TERRACOTTA: 1 LIGHT_GRAY_TERRACOTTA: 2
LIGHT_GRAY_WALL_BANNER: 2 LIGHT_GRAY_WALL_BANNER: 2
LIGHT_GRAY_WOOL: 1 LIGHT_GRAY_WOOL: 2
LIGHT_WEIGHTED_PRESSURE_PLATE: 1 LIGHT_WEIGHTED_PRESSURE_PLATE: 3
LILAC: 1 LILAC: 1
LILY_PAD: 5 LILY_PAD: 5
LIME_BANNER: 2 LIME_BANNER: 2
LIME_BED: 2 LIME_BED: 6
LIME_CARPET: 1 LIME_CARPET: 1
LIME_CONCRETE: 1 LIME_CONCRETE: 3
LIME_CONCRETE_POWDER: 1 LIME_CONCRETE_POWDER: 2
LIME_GLAZED_TERRACOTTA: 1 LIME_GLAZED_TERRACOTTA: 5
LIME_SHULKER_BOX: 1 LIME_SHULKER_BOX: 11
LIME_STAINED_GLASS: 2 LIME_STAINED_GLASS: 2
LIME_STAINED_GLASS_PANE: 1 LIME_STAINED_GLASS_PANE: 1
LIME_TERRACOTTA: 1 LIME_TERRACOTTA: 2
LIME_WALL_BANNER: 2 LIME_WALL_BANNER: 2
LIME_WOOL: 1 LIME_WOOL: 2
MAGENTA_BANNER: 2 MAGENTA_BANNER: 2
MAGENTA_BED: 2 MAGENTA_BED: 6
MAGENTA_CARPET: 1 MAGENTA_CARPET: 1
MAGENTA_CONCRETE: 1 MAGENTA_CONCRETE: 3
MAGENTA_CONCRETE_POWDER: 1 MAGENTA_CONCRETE_POWDER: 2
MAGENTA_GLAZED_TERRACOTTA: 1 MAGENTA_GLAZED_TERRACOTTA: 5
MAGENTA_SHULKER_BOX: 1 MAGENTA_SHULKER_BOX: 11
MAGENTA_STAINED_GLASS: 2 MAGENTA_STAINED_GLASS: 2
MAGENTA_STAINED_GLASS_PANE: 1 MAGENTA_STAINED_GLASS_PANE: 1
MAGENTA_TERRACOTTA: 1 MAGENTA_TERRACOTTA: 2
MAGENTA_WALL_BANNER: 2 MAGENTA_WALL_BANNER: 2
MAGENTA_WOOL: 1 MAGENTA_WOOL: 2
MAGMA_BLOCK: 1 MAGMA_BLOCK: 1
MELON: 1 MELON: 1
MELON_STEM: 1 MELON_STEM: 1
@ -396,55 +396,55 @@ blocks:
NETHER_WART_BLOCK: 2 NETHER_WART_BLOCK: 2
NOTE_BLOCK: 10 NOTE_BLOCK: 10
OAK_BUTTON: 1 OAK_BUTTON: 1
OAK_DOOR: 1 OAK_DOOR: 2
OAK_FENCE: 2 OAK_FENCE: 2
OAK_FENCE_GATE: 1 OAK_FENCE_GATE: 4
OAK_LEAVES: 0 OAK_LEAVES: 0
OAK_LOG: 0 OAK_LOG: 0
OAK_PLANKS: 1 OAK_PLANKS: 1
OAK_PRESSURE_PLATE: 1 OAK_PRESSURE_PLATE: 2
OAK_SAPLING: 1 OAK_SAPLING: 1
OAK_SLAB: 1 OAK_SLAB: 1
OAK_STAIRS: 2 OAK_STAIRS: 2
OAK_TRAPDOOR: 1 OAK_TRAPDOOR: 3
OAK_WOOD: 1 OAK_WOOD: 1
OBSERVER: 1 OBSERVER: 1
OBSIDIAN: 10 OBSIDIAN: 10
ORANGE_BANNER: 2 ORANGE_BANNER: 2
ORANGE_BED: 2 ORANGE_BED: 6
ORANGE_CARPET: 1 ORANGE_CARPET: 1
ORANGE_CONCRETE: 1 ORANGE_CONCRETE: 3
ORANGE_CONCRETE_POWDER: 1 ORANGE_CONCRETE_POWDER: 2
ORANGE_GLAZED_TERRACOTTA: 1 ORANGE_GLAZED_TERRACOTTA: 5
ORANGE_SHULKER_BOX: 1 ORANGE_SHULKER_BOX: 11
ORANGE_STAINED_GLASS: 2 ORANGE_STAINED_GLASS: 2
ORANGE_STAINED_GLASS_PANE: 1 ORANGE_STAINED_GLASS_PANE: 1
ORANGE_TERRACOTTA: 1 ORANGE_TERRACOTTA: 2
ORANGE_TULIP: 1 ORANGE_TULIP: 1
ORANGE_WALL_BANNER: 2 ORANGE_WALL_BANNER: 2
ORANGE_WOOL: 1 ORANGE_WOOL: 2
OXEYE_DAISY: 1 OXEYE_DAISY: 1
PACKED_ICE: 5 PACKED_ICE: 5
PEONY: 1 PEONY: 1
PETRIFIED_OAK_SLAB: 1 PETRIFIED_OAK_SLAB: 1
PINK_BANNER: 2 PINK_BANNER: 2
PINK_BED: 2 PINK_BED: 6
PINK_CARPET: 1 PINK_CARPET: 1
PINK_CONCRETE: 1 PINK_CONCRETE: 3
PINK_CONCRETE_POWDER: 1 PINK_CONCRETE_POWDER: 2
PINK_GLAZED_TERRACOTTA: 1 PINK_GLAZED_TERRACOTTA: 5
PINK_SHULKER_BOX: 1 PINK_SHULKER_BOX: 11
PINK_STAINED_GLASS: 2 PINK_STAINED_GLASS: 2
PINK_STAINED_GLASS_PANE: 1 PINK_STAINED_GLASS_PANE: 1
PINK_TERRACOTTA: 1 PINK_TERRACOTTA: 2
PINK_TULIP: 1 PINK_TULIP: 1
PINK_WALL_BANNER: 2 PINK_WALL_BANNER: 2
PINK_WOOL: 1 PINK_WOOL: 2
PISTON: 2 PISTON: 2
PISTON_HEAD: 1 PISTON_HEAD: 1
PLAYER_HEAD: 1 PLAYER_HEAD: 1
PLAYER_WALL_HEAD: 1 PLAYER_WALL_HEAD: 1
PODZOL: 1 PODZOL: 2
POLISHED_ANDESITE: 1 POLISHED_ANDESITE: 1
POLISHED_DIORITE: 1 POLISHED_DIORITE: 1
POLISHED_GRANITE: 1 POLISHED_GRANITE: 1
@ -471,7 +471,7 @@ blocks:
POTTED_RED_TULIP: 1 POTTED_RED_TULIP: 1
POTTED_SPRUCE_SAPLING: 1 POTTED_SPRUCE_SAPLING: 1
POTTED_WHITE_TULIP: 1 POTTED_WHITE_TULIP: 1
POWERED_RAIL: 1 POWERED_RAIL: 2
PRISMARINE: 1 PRISMARINE: 1
PRISMARINE_BRICKS: 2 PRISMARINE_BRICKS: 2
PRISMARINE_BRICK_SLAB: 1 PRISMARINE_BRICK_SLAB: 1
@ -481,17 +481,17 @@ blocks:
PUMPKIN: 1 PUMPKIN: 1
PUMPKIN_STEM: 1 PUMPKIN_STEM: 1
PURPLE_BANNER: 2 PURPLE_BANNER: 2
PURPLE_BED: 2 PURPLE_BED: 6
PURPLE_CARPET: 1 PURPLE_CARPET: 1
PURPLE_CONCRETE: 1 PURPLE_CONCRETE: 3
PURPLE_CONCRETE_POWDER: 1 PURPLE_CONCRETE_POWDER: 2
PURPLE_GLAZED_TERRACOTTA: 1 PURPLE_GLAZED_TERRACOTTA: 5
PURPLE_SHULKER_BOX: 1 PURPLE_SHULKER_BOX: 11
PURPLE_STAINED_GLASS: 2 PURPLE_STAINED_GLASS: 2
PURPLE_STAINED_GLASS_PANE: 1 PURPLE_STAINED_GLASS_PANE: 1
PURPLE_TERRACOTTA: 1 PURPLE_TERRACOTTA: 2
PURPLE_WALL_BANNER: 2 PURPLE_WALL_BANNER: 2
PURPLE_WOOL: 1 PURPLE_WOOL: 2
PURPUR_BLOCK: 1 PURPUR_BLOCK: 1
PURPUR_PILLAR: 1 PURPUR_PILLAR: 1
PURPUR_SLAB: 1 PURPUR_SLAB: 1
@ -507,11 +507,11 @@ blocks:
REDSTONE_TORCH: 5 REDSTONE_TORCH: 5
REDSTONE_WALL_TORCH: 5 REDSTONE_WALL_TORCH: 5
REDSTONE_WIRE: 1 REDSTONE_WIRE: 1
RED_BED: 2 RED_BED: 6
RED_CARPET: 1 RED_CARPET: 1
RED_CONCRETE: 1 RED_CONCRETE: 3
RED_CONCRETE_POWDER: 1 RED_CONCRETE_POWDER: 2
RED_GLAZED_TERRACOTTA: 1 RED_GLAZED_TERRACOTTA: 5
RED_MUSHROOM: 1 RED_MUSHROOM: 1
RED_MUSHROOM_BLOCK: 1 RED_MUSHROOM_BLOCK: 1
RED_NETHER_BRICKS: 2 RED_NETHER_BRICKS: 2
@ -519,25 +519,25 @@ blocks:
RED_SANDSTONE: 1 RED_SANDSTONE: 1
RED_SANDSTONE_SLAB: 1 RED_SANDSTONE_SLAB: 1
RED_SANDSTONE_STAIRS: 2 RED_SANDSTONE_STAIRS: 2
RED_SHULKER_BOX: 1 RED_SHULKER_BOX: 11
RED_STAINED_GLASS: 2 RED_STAINED_GLASS: 2
RED_STAINED_GLASS_PANE: 1 RED_STAINED_GLASS_PANE: 1
RED_TERRACOTTA: 1 RED_TERRACOTTA: 2
RED_TULIP: 1 RED_TULIP: 1
RED_WALL_BANNER: 2 RED_WALL_BANNER: 2
RED_WOOL: 1 RED_WOOL: 2
REPEATER: 1 REPEATER: 6
REPEATING_COMMAND_BLOCK: 1 REPEATING_COMMAND_BLOCK: 0
ROSE_BUSH: 1 ROSE_BUSH: 1
SAND: 1 SAND: 1
SANDSTONE: 1 SANDSTONE: 1
SANDSTONE_SLAB: 1 SANDSTONE_SLAB: 1
SANDSTONE_STAIRS: 2 SANDSTONE_STAIRS: 2
SEAGRASS: 1 SEAGRASS: 1
SEA_LANTERN: 1 SEA_LANTERN: 9
SEA_PICKLE: 1 SEA_PICKLE: 1
SHULKER_BOX: 1 SHULKER_BOX: 10
SIGN: 1 SIGN: 6
SKELETON_SKULL: 10 SKELETON_SKULL: 10
SKELETON_WALL_SKULL: 100 SKELETON_WALL_SKULL: 100
SLIME_BLOCK: 10 SLIME_BLOCK: 10
@ -551,17 +551,17 @@ blocks:
SPAWNER: 1 SPAWNER: 1
SPONGE: 10 SPONGE: 10
SPRUCE_BUTTON: 1 SPRUCE_BUTTON: 1
SPRUCE_DOOR: 1 SPRUCE_DOOR: 2
SPRUCE_FENCE: 2 SPRUCE_FENCE: 2
SPRUCE_FENCE_GATE: 1 SPRUCE_FENCE_GATE: 4
SPRUCE_LEAVES: 0 SPRUCE_LEAVES: 0
SPRUCE_LOG: 0 SPRUCE_LOG: 0
SPRUCE_PLANKS: 1 SPRUCE_PLANKS: 1
SPRUCE_PRESSURE_PLATE: 1 SPRUCE_PRESSURE_PLATE: 2
SPRUCE_SAPLING: 1 SPRUCE_SAPLING: 1
SPRUCE_SLAB: 1 SPRUCE_SLAB: 1
SPRUCE_STAIRS: 2 SPRUCE_STAIRS: 2
SPRUCE_TRAPDOOR: 1 SPRUCE_TRAPDOOR: 3
SPRUCE_WOOD: 1 SPRUCE_WOOD: 1
STICKY_PISTON: 1 STICKY_PISTON: 1
STONE: 1 STONE: 1
@ -569,7 +569,7 @@ blocks:
STONE_BRICK_SLAB: 1 STONE_BRICK_SLAB: 1
STONE_BRICK_STAIRS: 2 STONE_BRICK_STAIRS: 2
STONE_BUTTON: 1 STONE_BUTTON: 1
STONE_PRESSURE_PLATE: 1 STONE_PRESSURE_PLATE: 2
STONE_SLAB: 1 STONE_SLAB: 1
STRIPPED_ACACIA_LOG: 0 STRIPPED_ACACIA_LOG: 0
STRIPPED_ACACIA_WOOD: 1 STRIPPED_ACACIA_WOOD: 1
@ -587,10 +587,10 @@ blocks:
SUNFLOWER: 1 SUNFLOWER: 1
TALL_GRASS: 1 TALL_GRASS: 1
TALL_SEAGRASS: 1 TALL_SEAGRASS: 1
TERRACOTTA: 1 TERRACOTTA: 2
TNT: 5 TNT: 5
TORCH: 1 TORCH: 1
TRAPPED_CHEST: 5 TRAPPED_CHEST: 10
TRIPWIRE: 2 TRIPWIRE: 2
TRIPWIRE_HOOK: 2 TRIPWIRE_HOOK: 2
TUBE_CORAL: 1 TUBE_CORAL: 1
@ -599,39 +599,39 @@ blocks:
TUBE_CORAL_WALL_FAN: 1 TUBE_CORAL_WALL_FAN: 1
TURTLE_EGG: 1 TURTLE_EGG: 1
VINE: 1 VINE: 1
VOID_AIR: 1 VOID_AIR: 0
WALL_SIGN: 1 WALL_SIGN: 6
WALL_TORCH: 1 WALL_TORCH: 1
WATER: 0 WATER: 0
WET_SPONGE: 10 WET_SPONGE: 10
WHEAT: 1 WHEAT: 1
WHITE_BANNER: 2 WHITE_BANNER: 2
WHITE_BED: 2 WHITE_BED: 6
WHITE_CARPET: 1 WHITE_CARPET: 1
WHITE_CONCRETE: 1 WHITE_CONCRETE: 3
WHITE_CONCRETE_POWDER: 1 WHITE_CONCRETE_POWDER: 2
WHITE_GLAZED_TERRACOTTA: 1 WHITE_GLAZED_TERRACOTTA: 5
WHITE_SHULKER_BOX: 1 WHITE_SHULKER_BOX: 11
WHITE_STAINED_GLASS: 2 WHITE_STAINED_GLASS: 2
WHITE_STAINED_GLASS_PANE: 1 WHITE_STAINED_GLASS_PANE: 1
WHITE_TERRACOTTA: 1 WHITE_TERRACOTTA: 2
WHITE_TULIP: 1 WHITE_TULIP: 1
WHITE_WALL_BANNER: 2 WHITE_WALL_BANNER: 2
WHITE_WOOL: 1 WHITE_WOOL: 2
WITHER_SKELETON_SKULL: 10 WITHER_SKELETON_SKULL: 10
WITHER_SKELETON_WALL_SKULL: 10 WITHER_SKELETON_WALL_SKULL: 10
YELLOW_BANNER: 2 YELLOW_BANNER: 2
YELLOW_BED: 2 YELLOW_BED: 6
YELLOW_CARPET: 1 YELLOW_CARPET: 1
YELLOW_CONCRETE: 1 YELLOW_CONCRETE: 3
YELLOW_CONCRETE_POWDER: 1 YELLOW_CONCRETE_POWDER: 2
YELLOW_GLAZED_TERRACOTTA: 1 YELLOW_GLAZED_TERRACOTTA: 5
YELLOW_SHULKER_BOX: 1 YELLOW_SHULKER_BOX: 11
YELLOW_STAINED_GLASS: 2 YELLOW_STAINED_GLASS: 2
YELLOW_STAINED_GLASS_PANE: 1 YELLOW_STAINED_GLASS_PANE: 1
YELLOW_TERRACOTTA: 1 YELLOW_TERRACOTTA: 2
YELLOW_WALL_BANNER: 2 YELLOW_WALL_BANNER: 2
YELLOW_WOOL: 1 YELLOW_WOOL: 2
ZOMBIE_HEAD: 1 ZOMBIE_HEAD: 1
ZOMBIE_WALL_HEAD: 1 ZOMBIE_WALL_HEAD: 1

View File

@ -1,9 +1,5 @@
/**
*
*/
package bentobox.addon.level; package bentobox.addon.level;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -37,9 +33,6 @@ public class LevelPresenterTest {
private Level addon; private Level addon;
private PlayerLevel pl; private PlayerLevel pl;
/**
* @throws java.lang.Exception
*/
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
plugin = mock(BentoBox.class); plugin = mock(BentoBox.class);
@ -66,7 +59,7 @@ public class LevelPresenterTest {
*/ */
@Test @Test
public void testLevelPresenter() { public void testLevelPresenter() {
assertNotNull(new LevelPresenter(addon, plugin)); new LevelPresenter(addon, plugin);
} }
/** /**