Merge remote-tracking branch 'origin/develop'

This commit is contained in:
tastybento 2019-10-20 17:44:09 -07:00
commit 737df3b778
10 changed files with 54 additions and 23 deletions

View File

@ -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

View File

@ -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:

View File

@ -65,7 +65,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.6.0</build.version>
<build.version>1.7.0</build.version>
</properties>
<!-- Profiles will allow to automatically change build version. -->

View File

@ -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<Material> 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("Subtotal = " + total);
r.add(LINE_BREAK);

View File

@ -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<Material, Integer> 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);
}
}
}

View File

@ -1,6 +1,7 @@
name: Level
main: world.bentobox.level.Level
version: ${version}${build.number}
icon: DIAMOND
softdepend: AcidIsland, BSkyBlock