This commit is contained in:
tastybento 2018-09-02 02:42:25 +00:00 committed by GitHub
commit 513045665c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 335 additions and 446 deletions

View File

@ -6,7 +6,7 @@
<groupId>bskyblock.addon</groupId>
<artifactId>Level</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.2-SNAPSHOT</version>
<name>Level</name>
<description>Level is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.</description>
@ -46,7 +46,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<version>1.13.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -202,7 +202,7 @@
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>tastybento-github</sonar.organization>
<sonar.organization>bentobox-world</sonar.organization>
</properties>
<build>
<plugins>

View File

@ -55,7 +55,7 @@ public class Level extends Addon {
/**
* Get level from cache for a player
* @param targetPlayer
* @param targetPlayer - target player
* @return Level of player
*/
public long getIslandLevel(World world, UUID targetPlayer) {
@ -92,7 +92,7 @@ public class Level extends Addon {
public void onDisable(){
// Save the cache
if (levelsCache != null) {
save(false);
save();
}
if (topTen != null) {
topTen.saveTopTen();
@ -147,18 +147,17 @@ public class Level extends Addon {
/**
* 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
levelsCache.values().forEach(handler::saveObject);
}
/**
* Sets the player's level to a value
* @param world
* @param targetPlayer
* @param level
* @param world - world
* @param targetPlayer - target player
* @param level - level
*/
public void setIslandLevel(World world, UUID targetPlayer, long level) {
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.api.user.User;
public class LevelPresenter {
class LevelPresenter {
private int levelWait;
private final Level addon;
private final BentoBox plugin;
// 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) {
this.addon = addon;
@ -28,10 +28,9 @@ public class LevelPresenter {
* Calculates the island level
* @param world - world to check
* @param sender - asker of the level info
* @param targetPlayer
* @return - false if this is cannot be done
* @param targetPlayer - target player
*/
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
String permPrefix = plugin.getIWM().getPermissionPrefix(world);
// Check if target has island
@ -43,7 +42,7 @@ public class LevelPresenter {
inTeam = true;
} else {
sender.sendMessage("general.errors.player-has-no-island");
return false;
return;
}
}
// Player asking for their own island calc
@ -62,25 +61,20 @@ public class LevelPresenter {
// Asking for the level of another player
sender.sendMessage("island.level.island-level-is","[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
}
return true;
}
/**
* Sets cool down for the level command
*
* @param player
* @param user - user
*/
private void setLevelWaitTime(final User player) {
levelWaitTime.put(player.getUniqueId(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + levelWait * 1000));
private void setLevelWaitTime(final User user) {
levelWaitTime.put(user.getUniqueId(), Calendar.getInstance().getTimeInMillis() + levelWait * 1000);
}
private boolean onLevelWaitTime(final User sender) {
if (levelWaitTime.containsKey(sender.getUniqueId())) {
if (levelWaitTime.get(sender.getUniqueId()).longValue() > Calendar.getInstance().getTimeInMillis()) {
return true;
}
return false;
return levelWaitTime.get(sender.getUniqueId()) > Calendar.getInstance().getTimeInMillis();
}
return false;
@ -88,8 +82,8 @@ public class LevelPresenter {
private long getLevelWaitTime(final User sender) {
if (levelWaitTime.containsKey(sender.getUniqueId())) {
if (levelWaitTime.get(sender.getUniqueId()).longValue() > Calendar.getInstance().getTimeInMillis()) {
return (levelWaitTime.get(sender.getUniqueId()).longValue() - Calendar.getInstance().getTimeInMillis()) / 1000;
if (levelWaitTime.get(sender.getUniqueId()) > Calendar.getInstance().getTimeInMillis()) {
return (levelWaitTime.get(sender.getUniqueId()) - Calendar.getInstance().getTimeInMillis()) / 1000;
}
return 0L;

View File

@ -14,7 +14,6 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import bentobox.addon.level.database.object.LevelsData;
import bentobox.addon.level.database.object.TopTenData;
import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.builders.PanelBuilder;
@ -29,12 +28,11 @@ import world.bentobox.bentobox.database.Database;
*
*/
public class TopTen implements Listener {
private Level addon;
private final Level addon;
// Top ten list of players
private Map<World,TopTenData> topTenList;
private final int[] SLOTS = new int[] {4, 12, 14, 19, 20, 21, 22, 23, 24, 25};
private final boolean DEBUG = false;
private Database<TopTenData> handler;
private final Database<TopTenData> handler;
public TopTen(Level addon) {
this.addon = addon;
@ -47,8 +45,8 @@ public class TopTen implements Listener {
/**
* Adds a player to the top ten, if the level is good enough
*
* @param ownerUUID
* @param l
* @param ownerUUID - owner UUID
* @param l - level
*/
public void addEntry(World world, UUID ownerUUID, long l) {
// Check if player is an island owner or not
@ -61,51 +59,22 @@ public class TopTen implements Listener {
// Try and see if the player is online
Player player = addon.getServer().getPlayer(ownerUUID);
if (player != null) {
// Online
if (!player.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(world) + ".intopten")) {
topTenList.get(world).remove(ownerUUID);
return;
}
if (player != null && !player.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(world) + ".intopten")) {
topTenList.get(world).remove(ownerUUID);
return;
}
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
* @param world
*
* @param user
* - the requesting player
* @return - true if successful, false if no Top Ten list exists
* @param world - world
* @param user - the requesting player
*/
public boolean getGUI(World world, final User user, String permPrefix) {
public void getGUI(World world, final User user, String permPrefix) {
// Check world
topTenList.putIfAbsent(world, new TopTenData());
topTenList.get(world).setUniqueId(world.getName());
if (DEBUG)
addon.getLogger().info("DEBUG: GUI display");
PanelBuilder panel = new PanelBuilder()
.name(user.getTranslation("island.top.gui-title"))
@ -116,22 +85,14 @@ public class TopTen implements Listener {
while (it.hasNext()) {
Map.Entry<UUID, Long> m = it.next();
UUID topTenUUID = m.getKey();
if (DEBUG)
addon.getLogger().info("DEBUG: " + i + ": " + topTenUUID);
// Remove from TopTen if the player is online and has the permission
Player entry = addon.getServer().getPlayer(topTenUUID);
boolean show = true;
if (entry != null) {
if (DEBUG)
addon.getLogger().info("DEBUG: removing from topten");
if (!entry.hasPermission(permPrefix + "intopten")) {
it.remove();
show = false;
}
} else {
if (DEBUG)
addon.getLogger().info("DEBUG: player not online, so no per check");
}
if (show) {
panel.item(SLOTS[i-1], getHead(i, m.getValue(), topTenUUID, user, world));
@ -139,7 +100,6 @@ public class TopTen implements Listener {
}
}
panel.build();
return true;
}
/**
@ -168,21 +128,6 @@ public class TopTen implements Listener {
.icon(name)
.name(name)
.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();
}
@ -193,7 +138,7 @@ public class TopTen implements Listener {
/**
* Loads all the top tens from the database
*/
public void loadTopTen() {
private void loadTopTen() {
topTenList = new HashMap<>();
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
*
* @param ownerUUID
* @param ownerUUID - uuid to remove
*/
public void removeEntry(World world, UUID ownerUUID) {
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.Multiset;
import com.google.common.collect.Multiset.Entry;
import bentobox.addon.level.Level;
import com.google.common.collect.Multisets;
import bentobox.addon.level.Level;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Pair;
import world.bentobox.bentobox.util.Util;
@ -31,19 +29,20 @@ public class CalcIslandLevel {
private static final int MAX_CHUNKS = 200;
private static final long SPEED = 1;
private boolean checking = true;
private BukkitTask task;
private static final String LINE_BREAK = "==================================";
private boolean checking;
private final BukkitTask task;
private Level addon;
private final Level addon;
private Set<Pair<Integer, Integer>> chunksToScan;
private Island island;
private World world;
private Results result;
private Runnable onExit;
private final Set<Pair<Integer, Integer>> chunksToScan;
private final Island island;
private final World world;
private final Results result;
private final Runnable onExit;
// Copy the limits hashmap
HashMap<Material, Integer> limitCount;
// Copy the limits hash map
private final HashMap<Material, Integer> limitCount;
/**
@ -56,7 +55,7 @@ public class CalcIslandLevel {
public CalcIslandLevel(final Level addon, final Island island, final Runnable onExit) {
this.addon = addon;
this.island = island;
this.world = island != null ? island.getCenter().getWorld() : null;
this.world = island.getCenter().getWorld();
this.limitCount = new HashMap<>(addon.getSettings().getBlockLimits());
this.onExit = onExit;
@ -112,19 +111,20 @@ public class CalcIslandLevel {
private void scanChunk(ChunkSnapshot chunk) {
for (int x = 0; x< 16; x++) {
// Check if the block coord is inside the protection zone and if not, don't count it
// Check if the block coordinate is inside the protection zone and if not, don't count it
if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + island.getProtectionRange() * 2) {
continue;
}
for (int z = 0; z < 16; z++) {
// Check if the block coord is inside the protection zone and if not, don't count it
// Check if the block coordinate is inside the protection zone and if not, don't count it
if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + island.getProtectionRange() * 2) {
continue;
}
for (int y = 0; y < island.getCenter().getWorld().getMaxHeight(); y++) {
Material blockData = chunk.getBlockType(x, y, z);
boolean belowSeaLevel = (addon.getSettings().getSeaHeight() > 0 && y<=addon.getSettings().getSeaHeight()) ? true : false;
int seaHeight = addon.getPlugin().getIWM().getSeaHeight(world);
boolean belowSeaLevel = seaHeight > 0 && y <= seaHeight;
// Air is free
if (!blockData.equals(Material.AIR)) {
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
* @param md
<<<<<<< HEAD
* @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
*/
private int limitCount(Material md) {
@ -171,7 +175,11 @@ public class CalcIslandLevel {
/**
* Get value of a material
* World blocks trump regular block values
* @param md
<<<<<<< HEAD
* @param md Material
=======
* @param md - Material to check
>>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git
* @return value of a material
*/
private int getValue(Material md) {
@ -183,8 +191,12 @@ public class CalcIslandLevel {
/**
* Get a set of all the chunks in island
* @param island
* @return
* @param island - island
<<<<<<< HEAD
* @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) {
Set<Pair<Integer, Integer>> chunkSnapshot = new HashSet<>();
@ -226,7 +238,7 @@ public class CalcIslandLevel {
reportLines.add("Level cost = " + addon.getSettings().getLevelCost());
reportLines.add("Deaths handicap = " + result.deathHandicap);
reportLines.add("Level calculated = " + result.level);
reportLines.add("==================================");
reportLines.add(LINE_BREAK);
int total = 0;
if (!result.uwCount.isEmpty()) {
reportLines.add("Underwater block count (Multiplier = x" + addon.getSettings().getUnderWaterMultiplier() + ") value");
@ -238,7 +250,6 @@ public class CalcIslandLevel {
reportLines.addAll(sortedReport(total, result.mdCount));
reportLines.add("Blocks not counted because they exceeded limits: " + String.format("%,d",result.ofCount.size()));
//entriesSortedByCount = Multisets.copyHighestCountFirst(ofCount).entrySet();
Iterable<Multiset.Entry<Material>> entriesSortedByCount = result.ofCount.entrySet();
Iterator<Entry<Material>> it = entriesSortedByCount.iterator();
while (it.hasNext()) {
@ -252,27 +263,24 @@ public class CalcIslandLevel {
}
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("Total number = " + String.format("%,d",result.ncCount.size()));
//entriesSortedByCount = Multisets.copyHighestCountFirst(ncCount).entrySet();
entriesSortedByCount = result.ncCount.entrySet();
it = entriesSortedByCount.iterator();
while (it.hasNext()) {
Entry<Material> type = it.next();
reportLines.add(type.getElement().toString() + ": " + String.format("%,d",type.getCount()) + " blocks");
}
reportLines.add("=================================");
reportLines.add(LINE_BREAK);
return reportLines;
}
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();
Iterator<Entry<Material>> it = entriesSortedByCount.iterator();
while (it.hasNext()) {
Entry<Material> en = it.next();
for (Entry<Material> en : entriesSortedByCount) {
Material type = en.getElement();
int value = 0;
@ -280,13 +288,13 @@ public class CalcIslandLevel {
// Specific
value = addon.getSettings().getBlockValues().get(type);
}
result.add(type.toString() + ":"
+ String.format("%,d",en.getCount()) + " blocks x " + value + " = " + (value * en.getCount()));
r.add(type.toString() + ":"
+ String.format("%,d", en.getCount()) + " blocks x " + value + " = " + (value * en.getCount()));
total += (value * en.getCount());
}
result.add("Subtotal = " + total);
result.add("==================================");
return result;
r.add("Subtotal = " + total);
r.add(LINE_BREAK);
return r;
}
/**
@ -302,10 +310,10 @@ public class CalcIslandLevel {
*/
public class Results {
private List<String> report;
private Multiset<Material> mdCount = HashMultiset.create();
private Multiset<Material> uwCount = HashMultiset.create();
private Multiset<Material> ncCount = HashMultiset.create();
private Multiset<Material> ofCount = HashMultiset.create();
private final Multiset<Material> mdCount = HashMultiset.create();
private final Multiset<Material> uwCount = HashMultiset.create();
private final Multiset<Material> ncCount = HashMultiset.create();
private final Multiset<Material> ofCount = HashMultiset.create();
private long rawBlockCount = 0;
private long underWaterBlockCount = 0;
private long level = 0;
@ -317,12 +325,7 @@ public class CalcIslandLevel {
public int getDeathHandicap() {
return deathHandicap;
}
/**
* @param deathHandicap the deathHandicap to set
*/
public void setDeathHandicap(int deathHandicap) {
this.deathHandicap = deathHandicap;
}
/**
* @return the report
*/
@ -341,24 +344,6 @@ public class CalcIslandLevel {
public long getPointsToNextLevel() {
return pointsToNextLevel;
}
/**
* @param report the report to set
*/
public void setReport(List<String> report) {
this.report = report;
}
/**
* @param level the level to set
*/
public void setLevel(long level) {
this.level = level;
}
/**
* @param pointsToNextLevel the pointsToNextLevel to set
*/
public void setPointsToNextLevel(long pointsToNextLevel) {
this.pointsToNextLevel = pointsToNextLevel;
}
}
}

View File

@ -19,14 +19,14 @@ import world.bentobox.bentobox.database.objects.Island;
*/
public class PlayerLevel {
private Level addon;
private final Level addon;
private Island island;
private World world;
private User asker;
private UUID targetPlayer;
private final Island island;
private final World world;
private final User asker;
private final UUID targetPlayer;
private long oldLevel;
private final long oldLevel;
private CalcIslandLevel calc;
@ -34,7 +34,7 @@ public class PlayerLevel {
public PlayerLevel(final Level addon, final Island island, final UUID targetPlayer, final User asker) {
this.addon = addon;
this.island = island;
this.world = island != null ? island.getCenter().getWorld() : null;
this.world = island.getCenter().getWorld();
this.asker = asker;
this.targetPlayer = targetPlayer;
this.oldLevel = addon.getIslandLevel(world, targetPlayer);
@ -44,45 +44,49 @@ public class PlayerLevel {
addon.getServer().getPluginManager().callEvent(e);
if (!e.isCancelled()) {
// 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
IslandLevelCalculatedEvent ilce = new IslandLevelCalculatedEvent(targetPlayer, island, calc.getResult());
addon.getServer().getPluginManager().callEvent(ilce);
Results results = ilce.getResults();
// Save the results
island.getMemberSet().forEach(m -> addon.setIslandLevel(world, m, results.getLevel()));
// Display result
// Display result if event is not cancelled
if (!ilce.isCancelled()) {
// Tell the asker
asker.sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
// Console
if (!asker.isPlayer()) {
results.getReport().forEach(asker::sendRawMessage);
return;
}
// Player
if (addon.getSettings().getDeathPenalty() != 0) {
asker.sendMessage("island.level.deaths", "[number]", String.valueOf(results.getDeathHandicap()));
}
// Send player how many points are required to reach next island level
if (results.getPointsToNextLevel() >= 0) {
asker.sendMessage("island.level.required-points-to-next-level", "[points]", String.valueOf(results.getPointsToNextLevel()));
}
// Tell other team members
if (addon.getIslandLevel(world, targetPlayer) != oldLevel) {
for (UUID member : island.getMemberSet()) {
if (!member.equals(asker.getUniqueId())) {
User.getInstance(member).sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
}
}
}
informPlayers(results);
}
}
private void informPlayers(Results results) {
// Tell the asker
asker.sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
// Console
if (!asker.isPlayer()) {
results.getReport().forEach(asker::sendRawMessage);
return;
}
// Player
if (addon.getSettings().getDeathPenalty() != 0) {
asker.sendMessage("island.level.deaths", "[number]", String.valueOf(results.getDeathHandicap()));
}
// Send player how many points are required to reach next island level
if (results.getPointsToNextLevel() >= 0) {
asker.sendMessage("island.level.required-points-to-next-level", "[points]", String.valueOf(results.getPointsToNextLevel()));
}
// Tell other team members
if (addon.getIslandLevel(world, targetPlayer) != oldLevel) {
island.getMemberSet().stream()
.filter(u -> !u.equals(asker.getUniqueId()))
.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?
// Convert name to a UUID
final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0));
//getLogger().info("DEBUG: console player info UUID = " + playerUUID);
if (playerUUID == null) {
user.sendMessage("general.errors.unknown-player");
return true;

View File

@ -23,7 +23,7 @@ public class AdminTop extends CompositeCommand {
@Override
public boolean execute(User user, String label, List<String> args) {
// Get world
World world = null;
World world;
if (args.isEmpty()) {
if (getPlugin().getIWM().getOverWorlds().size() == 1) {
world = getPlugin().getIWM().getOverWorlds().get(0);

View File

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

View File

@ -13,14 +13,12 @@ import bentobox.addon.level.Level;
public class Settings {
private boolean sumTeamDeaths;
private int seaHeight;
private Map<Material, Integer> blockLimits = 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 int deathpenalty;
private long levelCost;
private Object defaultLanguage;
private int levelWait;
private int maxDeaths;
private boolean islandResetDeathReset;
@ -47,30 +45,29 @@ public class Settings {
}
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)) {
try {
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) {
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")) {
Map<Material, Integer> blockValues = new HashMap<>();
Map<Material, Integer> bv = new HashMap<>();
for (String material : level.getConfig().getConfigurationSection("blocks").getKeys(false)) {
try {
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) {
// 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 {
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);
}
} 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
*/
public final void setSumTeamDeaths(boolean sumTeamDeaths) {
private void setSumTeamDeaths(boolean 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
*/
@ -128,7 +113,7 @@ public class Settings {
/**
* @param blockLimits2 the blockLimits to set
*/
public final void setBlockLimits(HashMap<Material, Integer> blockLimits2) {
private void setBlockLimits(HashMap<Material, Integer> blockLimits2) {
this.blockLimits = blockLimits2;
}
/**
@ -140,7 +125,7 @@ public class Settings {
/**
* @param blockValues2 the blockValues to set
*/
public final void setBlockValues(Map<Material, Integer> blockValues2) {
private void setBlockValues(Map<Material, Integer> blockValues2) {
this.blockValues = blockValues2;
}
/**
@ -152,7 +137,7 @@ public class Settings {
/**
* @param underWaterMultiplier the underWaterMultiplier to set
*/
public final void setUnderWaterMultiplier(double underWaterMultiplier) {
private void setUnderWaterMultiplier(double underWaterMultiplier) {
this.underWaterMultiplier = underWaterMultiplier;
}
/**
@ -164,7 +149,7 @@ public class Settings {
/**
* @param deathpenalty the deathpenalty to set
*/
public final void setDeathpenalty(int deathpenalty) {
private void setDeathpenalty(int deathpenalty) {
this.deathpenalty = deathpenalty;
}
/**
@ -176,34 +161,23 @@ public class Settings {
/**
* @param levelCost the levelCost to set
*/
public final void setLevelCost(long levelCost) {
private void setLevelCost(long 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
*/
public final int getLevelWait() {
private int getLevelWait() {
return levelWait;
}
/**
* @param levelWait the levelWait to set
*/
public final void setLevelWait(int levelWait) {
private void setLevelWait(int levelWait) {
this.levelWait = levelWait;
}
/**
* TODO: Use max deaths
* @return the maxDeaths
*/
public final int getMaxDeaths() {
@ -212,7 +186,7 @@ public class Settings {
/**
* @param maxDeaths the maxDeaths to set
*/
public final void setMaxDeaths(int maxDeaths) {
private void setMaxDeaths(int maxDeaths) {
this.maxDeaths = maxDeaths;
}
/**
@ -224,7 +198,7 @@ public class Settings {
/**
* @param islandResetDeathReset the islandResetDeathReset to set
*/
public final void setIslandResetDeathReset(boolean islandResetDeathReset) {
private void setIslandResetDeathReset(boolean islandResetDeathReset) {
this.islandResetDeathReset = islandResetDeathReset;
}
/**
@ -236,7 +210,7 @@ public class Settings {
/**
* @param teamJoinDeathReset the teamJoinDeathReset to set
*/
public final void setTeamJoinDeathReset(boolean teamJoinDeathReset) {
private void setTeamJoinDeathReset(boolean teamJoinDeathReset) {
this.teamJoinDeathReset = teamJoinDeathReset;
}

View File

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

View File

@ -16,14 +16,12 @@ import world.bentobox.bentobox.database.objects.DataObject;
*
*/
public class TopTenData implements DataObject {
// UniqueId is the world name
@Expose
private String uniqueId = "";
@Expose
private Map<UUID, Long> topTen = new LinkedHashMap<>();
public TopTenData() {}
public Map<UUID, Long> getTopTen() {
return topTen.entrySet().stream()
@ -54,10 +52,10 @@ public class TopTenData implements DataObject {
public void addLevel(UUID uuid, Long level) {
this.topTen.put(uuid, level);
}
/**
* Get the level for this UUID, or zero if the UUID is not found
* @param uuid
* @param uuid - UUID to check
* @return island level
*/
public long getLevel(UUID uuid) {
@ -68,10 +66,10 @@ public class TopTenData implements DataObject {
/**
* Removes ownerUUID from the top ten
* @param ownerUUID
* @param ownerUUID - UUID to remove
*/
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;
/**
* @param targetPlayer
* @param island
* @param results
* @param targetPlayer - target player
* @param island - island
* @param results - results object to set
*/
public IslandLevelCalculatedEvent(UUID targetPlayer, Island island, Results results) {
super(island);

View File

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

View File

@ -6,15 +6,15 @@ import org.bukkit.event.HandlerList;
/**
* This event is fired when a player clicks on a top ten head.
*
*
* @author tastybento
*/
public class TopTenClick extends Event implements Cancellable {
class TopTenClick extends Event implements Cancellable {
private boolean cancelled;
private static final HandlerList handlers = new HandlerList();
private final String owner;
public TopTenClick(String owner) {
this.owner = owner;
@ -35,15 +35,15 @@ public class TopTenClick extends Event implements Cancellable {
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return handlers;
return getHandlerList();
}
public static HandlerList getHandlerList() {
private static HandlerList getHandlerList() {
return handlers;
}

View File

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

View File

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

View File

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

View File

@ -1,9 +1,5 @@
/**
*
*/
package bentobox.addon.level;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -35,12 +31,8 @@ public class LevelPresenterTest {
private BentoBox plugin;
private Level addon;
private IslandsManager im;
private PlayerLevel pl;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
plugin = mock(BentoBox.class);
@ -48,7 +40,7 @@ public class LevelPresenterTest {
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(plugin.getIWM()).thenReturn(iwm);
when(iwm.getPermissionPrefix(Mockito.any())).thenReturn("world");
im = mock(IslandsManager.class);
IslandsManager im = mock(IslandsManager.class);
when(plugin.getIslands()).thenReturn(im);
// Has island
when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true);
@ -67,7 +59,7 @@ public class LevelPresenterTest {
*/
@Test
public void testLevelPresenter() {
assertNotNull(new LevelPresenter(addon, plugin));
new LevelPresenter(addon, plugin);
}
/**