Skip to content

Commit 52768ff

Browse files
committed
Fix for limits in config #376
1 parent 8987fde commit 52768ff

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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)