Merge pull request #161 from BentoBoxWorld/placeholder-fix

Fixes wrong placeholder value #159
This commit is contained in:
BONNe 2022-03-27 14:45:56 +03:00 committed by GitHub
commit 388f973aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -191,11 +191,11 @@ public class Limits extends Addon {
if (is == null) { if (is == null) {
return LIMIT_NOT_SET; return LIMIT_NOT_SET;
} }
@Nullable IslandBlockCount ibc = getBlockLimitListener().getIsland(is.getUniqueId());
if (ibc == null) { int limit = this.getBlockLimitListener().
return LIMIT_NOT_SET; getMaterialLimits(is.getWorld(), is.getUniqueId()).
} getOrDefault(m, -1);
int limit = ibc.getBlockLimit(m);
return limit == -1 ? LIMIT_NOT_SET : String.valueOf(limit); return limit == -1 ? LIMIT_NOT_SET : String.valueOf(limit);
} }

View File

@ -431,7 +431,12 @@ public class BlockLimitsListener implements Listener {
} }
// Island // Island
if (islandCountMap.containsKey(id)) { if (islandCountMap.containsKey(id)) {
result.putAll(islandCountMap.get(id).getBlockLimits()); IslandBlockCount islandBlockCount = islandCountMap.get(id);
result.putAll(islandBlockCount.getBlockLimits());
// Add offsets to the every limit.
islandBlockCount.getBlockLimitsOffset().forEach((material, offset) ->
result.put(material, result.getOrDefault(material, 0) + offset));
} }
return result; return result;
} }