Skip to content

Commit

Permalink
Adds setting option for async golum checking
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed May 3, 2021
1 parent 0ae58db commit 6a2768e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/main/java/world/bentobox/limits/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Settings {
private final Map<EntityType, Integer> limits = new EnumMap<>(EntityType.class);
private final Map<EntityType, List<EntityGroup>> groupLimits = new EnumMap<>(EntityType.class);
private final List<String> gameModes;
private final boolean asyncGolums;
private static final List<EntityType> DISALLOWED = Arrays.asList(
EntityType.PRIMED_TNT,
EntityType.EVOKER_FANGS,
Expand Down Expand Up @@ -65,6 +66,9 @@ public Settings(Limits addon) {
}
}
}
// Async Golums
asyncGolums = addon.getConfig().getBoolean("async-golums", true);

addon.log("Entity limits:");
limits.entrySet().stream().map(e -> "Limit " + e.getKey().toString() + " to " + e.getValue()).forEach(addon::log);

Expand Down Expand Up @@ -193,4 +197,11 @@ public String toString()
return "EntityGroup{" + "name=" + name + ", types=" + types + ", limit=" + limit + '}';
}
}

/**
* @return the asyncGolums
*/
public boolean isAsyncGolums() {
return asyncGolums;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void onCreatureSpawn(final CreatureSpawnEvent e) {
switch (e.getSpawnReason()) {
case BUILD_SNOWMAN:
case BUILD_IRONGOLEM:
checkLimit(e, e.getEntity(), e.getSpawnReason(), bypass, true);
checkLimit(e, e.getEntity(), e.getSpawnReason(), bypass, addon.getSettings().isAsyncGolums());
default:
// Check limit sync
checkLimit(e, e.getEntity(), e.getSpawnReason(), bypass, false);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ gamemodes:
# Cooldown for player recount command in seconds
cooldown: 120

# Use async checks for snowmen and iron golums. Set to false if you see problems.
async-golums: true

# General block limiting
# Use this section to limit how many blocks can be added to an island.
# 0 means the item will be blocked from placement completely.
Expand Down

0 comments on commit 6a2768e

Please sign in to comment.