diff --git a/src/main/java/org/mvplugins/multiverse/core/commands/EntitySpawnConfigCommand.java b/src/main/java/org/mvplugins/multiverse/core/commands/EntitySpawnConfigCommand.java index e4f9a150d..2963b4221 100644 --- a/src/main/java/org/mvplugins/multiverse/core/commands/EntitySpawnConfigCommand.java +++ b/src/main/java/org/mvplugins/multiverse/core/commands/EntitySpawnConfigCommand.java @@ -113,9 +113,9 @@ void onModifyCommand( .getSpawnCategoryConfig(spawnCategory) .getStringPropertyHandle() .modifyPropertyString(property, value, action) - .onSuccess(ignore -> issuer.sendMessage("Successfully set " + property + " to " + value + .onSuccess(ignore -> issuer.sendInfo("Successfully set " + property + " to " + value + " for " + spawnCategory.name() + " in " + world.getName())) - .onFailure(e -> issuer.sendMessage("Unable to set " + property + " to " + value + .onFailure(e -> issuer.sendError("Unable to set " + property + " to " + value + " for " + spawnCategory.name() + " in " + world.getName() + ": " + e.getMessage())); worldManager.saveWorldsConfig(); diff --git a/src/main/java/org/mvplugins/multiverse/core/world/entity/SpawnCategoryConfig.java b/src/main/java/org/mvplugins/multiverse/core/world/entity/SpawnCategoryConfig.java index 2eee36ad8..e4d54ce1c 100644 --- a/src/main/java/org/mvplugins/multiverse/core/world/entity/SpawnCategoryConfig.java +++ b/src/main/java/org/mvplugins/multiverse/core/world/entity/SpawnCategoryConfig.java @@ -167,12 +167,20 @@ private N node(N node) { final ConfigNode tickRate = node(ConfigNode.builder("tick-rate", Integer.class) .defaultValue(-1) .suggester(input -> List.of("-1", "10", "100", "400", "1000")) + .validator(input -> config.getApplyEntitySpawnRate() + ? Try.success(null) + : Try.failure(new IllegalStateException("Cannot set tick rate as 'apply-entity-spawn-rate' is false in config. " + + "You can re-enable this option with '/mv config set apply-entity-spawn-rate true' command."))) .onSetValue((oldValue, newValue) -> applyConfigToWorld()) .build()); final ConfigNode spawnLimit = node(ConfigNode.builder("spawn-limit", Integer.class) .defaultValue(-1) .suggester(input -> List.of("-1", "10", "100", "400", "1000")) + .validator(input -> config.getApplyEntitySpawnLimit() + ? Try.success(null) + : Try.failure(new IllegalStateException("Cannot set spawn limit as 'apply-entity-spawn-limit' is false in config. " + + "You can re-enable this option with '/mv config set apply-entity-spawn-limit true' command."))) .onSetValue((oldValue, newValue) -> applyConfigToWorld()) .build());