Skip to content

Commit 5d86ded

Browse files
authored
Merge pull request #377 from BentoBoxWorld/376_Limits_not_working_with_Level_addon
376 limits not working with level addon
2 parents 04cdbe6 + 52768ff commit 5d86ded

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<powermock.version>2.0.9</powermock.version>
5656
<!-- More visible way how to change dependency versions -->
5757
<spigot.version>1.21.5-R0.1-SNAPSHOT</spigot.version>
58-
<bentobox.version>3.3.1</bentobox.version>
58+
<bentobox.version>3.4.0</bentobox.version>
5959
<!-- Warps addon version -->
6060
<warps.version>1.12.0</warps.version>
6161
<!-- Visit addon version -->
@@ -67,7 +67,7 @@
6767
<!-- Do not change unless you want different name for local builds. -->
6868
<build.number>-LOCAL</build.number>
6969
<!-- This allows to change between versions. -->
70-
<build.version>2.21.1</build.version>
70+
<build.version>2.21.2</build.version>
7171
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
7272
<sonar.organization>bentobox-world</sonar.organization>
7373
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private List<String> getReport() {
272272
while (it.hasNext()) {
273273

274274
Entry<Object> type = it.next();
275-
Integer limit = addon.getBlockConfig().getLimit(type);
275+
Integer limit = addon.getBlockConfig().getLimit(type.getElement());
276276
String explain = ")";
277277
reportLines.add(Util.prettifyText(type.toString()) + ": " + String.format("%,d", type.getCount())
278278
+ " blocks (max " + limit + explain);
@@ -374,7 +374,10 @@ private int limitCountAndValue(Object obj) {
374374
}
375375

376376
int count = limitCount.getOrDefault(obj, 0);
377+
377378
if (count > limit) {
379+
// Add block to ofCount
380+
this.results.ofCount.add(obj);
378381
return 0;
379382
}
380383
limitCount.put(obj, count + 1);

src/main/java/world/bentobox/level/config/BlockConfig.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.bukkit.configuration.file.YamlConfiguration;
2020
import org.bukkit.entity.EntityType;
2121

22+
import world.bentobox.bentobox.BentoBox;
2223
import world.bentobox.bentobox.hooks.ItemsAdderHook;
2324
import world.bentobox.level.Level;
2425

@@ -177,14 +178,15 @@ private void loadWorlds(YamlConfiguration blockValues2) {
177178
*/
178179
public Integer getLimit(Object obj) {
179180
if (obj instanceof Material m) {
180-
return blockLimits.get(m.name());
181+
return blockLimits.get(m.getKey().getKey());
181182
}
182183
if (obj instanceof EntityType et) {
183-
return blockLimits.get(et.name().concat(SPAWNER));
184+
return blockLimits.get(et.name().toLowerCase(Locale.ENGLISH).concat(SPAWNER));
184185
}
185186
if (obj instanceof String s) {
186187
return blockLimits.get(s);
187188
}
189+
188190
return null;
189191
}
190192

0 commit comments

Comments
 (0)