Adds setting option for async golum checking

https://github.com/BentoBoxWorld/Limits/issues/127
This commit is contained in:
tastybento 2021-05-03 16:22:42 -07:00
parent 0ae58db8a9
commit 6a2768e572
3 changed files with 15 additions and 1 deletions

View File

@ -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,
@ -65,6 +66,9 @@ public class Settings {
}
}
}
// 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);
@ -193,4 +197,11 @@ public class Settings {
return "EntityGroup{" + "name=" + name + ", types=" + types + ", limit=" + limit + '}';
}
}
/**
* @return the asyncGolums
*/
public boolean isAsyncGolums() {
return asyncGolums;
}
}

View File

@ -148,7 +148,7 @@ public class EntityLimitListener implements Listener {
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);

View File

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