diff --git a/.travis.yml b/.travis.yml index 568528f..ae6bc33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,12 @@ addons: - develop - master jdk: - - oraclejdk8 + - openjdk8 + - openjdk11 + +matrix: + allow_failures: + - jdk: openjdk11 script: - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package -P sonar sonar:sonar -B diff --git a/README.md b/README.md index 6d5b042..2ff2a20 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,31 @@ for game modes listed in the config.yml. 1. Read the release notes carefully, but you may have to delete the old config.yml to use a new one. +## Permissons +Permissions are given automatically to players as listed below for BSkyBlock, AcidIsland and CaveBlock. If your permissions plugin strips permissions then you may have to allocate these manually. Note that if a player doesn't have the intopten permission, they will not be listed in the top ten. + +``` +permissions: + bskyblock.intopten: + description: Player is in the top ten. + default: true + bskyblock.island.level: + description: Player can use level command + default: true + bskyblock.island.top: + description: Player can use top ten command + default: true + bskyblock.island.value: + description: Player can use value command + default: true + bskyblock.admin.level: + description: Player can use admin level command + default: true + bskyblock.admin.topten: + description: Player can use admin top ten command + default: true +``` + ## Config.yml The config.yml has the following sections: diff --git a/pom.xml b/pom.xml index 88003e2..dd87100 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ -LOCAL - 1.6.0 + 1.7.0 diff --git a/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java b/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java index a1b060b..30ba3a0 100644 --- a/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java +++ b/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java @@ -191,12 +191,8 @@ public class CalcIslandLevel { result.ofCount.add(md); return 0; } - } else if (addon.getSettings().getBlockValues().containsKey(md)) { - return getValue(md); - } else { - result.ncCount.add(md); - return 0; } + return getValue(md); } /** @@ -206,10 +202,17 @@ public class CalcIslandLevel { * @return value of a material */ private int getValue(Material md) { + // Check world settings if (addon.getSettings().getWorldBlockValues().containsKey(world) && addon.getSettings().getWorldBlockValues().get(world).containsKey(md)) { return addon.getSettings().getWorldBlockValues().get(world).get(md); } - return addon.getSettings().getBlockValues().getOrDefault(md, 0); + // Check baseline + if (addon.getSettings().getBlockValues().containsKey(md)) { + return addon.getSettings().getBlockValues().get(md); + } + // Not in config + result.ncCount.add(md); + return 0; } /** @@ -327,15 +330,12 @@ public class CalcIslandLevel { for (Entry en : entriesSortedByCount) { Material type = en.getElement(); - int value = 0; - if (addon.getSettings().getBlockValues().containsKey(type)) { - // Specific - value = addon.getSettings().getBlockValues().get(type); + int value = getValue(type); + + r.add(type.toString() + ":" + + String.format("%,d", en.getCount()) + " blocks x " + value + " = " + (value * en.getCount())); + total += (value * en.getCount()); - r.add(type.toString() + ":" - + String.format("%,d", en.getCount()) + " blocks x " + value + " = " + (value * en.getCount())); - total += (value * en.getCount()); - } } r.add("Subtotal = " + total); r.add(LINE_BREAK); diff --git a/src/main/java/world/bentobox/level/config/Settings.java b/src/main/java/world/bentobox/level/config/Settings.java index 0c63609..a0e1e31 100644 --- a/src/main/java/world/bentobox/level/config/Settings.java +++ b/src/main/java/world/bentobox/level/config/Settings.java @@ -69,7 +69,7 @@ public class Settings { setLevelCost(level.getConfig().getInt("levelcost", 100)); if (getLevelCost() < 1) { setLevelCost(1); - level.getLogger().warning("levelcost in blockvalues.yml cannot be less than 1. Setting to 1."); + level.logWarning("levelcost in blockvalues.yml cannot be less than 1. Setting to 1."); } if (level.getConfig().isSet("limits")) { @@ -79,7 +79,7 @@ public class Settings { Material mat = Material.valueOf(material); 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.logWarning("Unknown material (" + material + ") in blockvalues.yml Limits section. Skipping..."); } } setBlockLimits(bl); @@ -92,12 +92,12 @@ public class Settings { Material mat = Material.valueOf(material); bv.put(mat, level.getConfig().getInt("blocks." + material, 0)); } catch (Exception e) { - level.getLogger().warning(()-> "Unknown material (" + material + ") in config.yml blocks section. Skipping..."); + level.logWarning("Unknown material (" + material + ") in config.yml blocks section. Skipping..."); } } setBlockValues(bv); } else { - level.getLogger().severe("No block values in config.yml! All island levels will be zero!"); + level.logWarning("No block values in config.yml! All island levels will be zero!"); } // Worlds if (level.getConfig().isSet("worlds")) { @@ -109,11 +109,11 @@ public class Settings { for (String material : worldValues.getKeys(false)) { Material mat = Material.valueOf(material); Map values = worldBlockValues.getOrDefault(bWorld, new HashMap<>()); - values.put(mat, worldValues.getInt("blocks." + material, 0)); + values.put(mat, worldValues.getInt(material)); worldBlockValues.put(bWorld, values); } } else { - level.getLogger().severe(() -> "Level Addon: No such world in config.yml : " + world); + level.logWarning("Level Addon: No such world in config.yml : " + world); } } } diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index 6035359..edee9a7 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -1,6 +1,7 @@ name: Level main: world.bentobox.level.Level version: ${version}${build.number} +icon: DIAMOND softdepend: AcidIsland, BSkyBlock @@ -81,4 +82,4 @@ permissions: default: true skygird.admin.topten: description: Player can use admin top ten command - default: true \ No newline at end of file + default: true diff --git a/src/main/resources/locales/es-ES.yml b/src/main/resources/locales/es.yml similarity index 100% rename from src/main/resources/locales/es-ES.yml rename to src/main/resources/locales/es.yml diff --git a/src/main/resources/locales/fr-FR.yml b/src/main/resources/locales/fr.yml similarity index 100% rename from src/main/resources/locales/fr-FR.yml rename to src/main/resources/locales/fr.yml diff --git a/src/main/resources/locales/lv-LV.yml b/src/main/resources/locales/lv.yml similarity index 100% rename from src/main/resources/locales/lv-LV.yml rename to src/main/resources/locales/lv.yml diff --git a/src/main/resources/locales/tr-TR.yml b/src/main/resources/locales/tr.yml similarity index 100% rename from src/main/resources/locales/tr-TR.yml rename to src/main/resources/locales/tr.yml