Skip to content

Commit 5e97b11

Browse files
authored
Merge pull request #3294 from Multiverse/fix/removed-property
Add warning on removed animals and monsters world properties
2 parents c3f4f11 + c389a41 commit 5e97b11

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/main/java/org/mvplugins/multiverse/core/commands/ModifyCommand.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@
2323
import org.mvplugins.multiverse.core.world.MultiverseWorld;
2424
import org.mvplugins.multiverse.core.world.WorldManager;
2525

26+
import java.util.Map;
27+
2628
import static org.mvplugins.multiverse.core.locale.message.MessageReplacement.*;
2729
import static org.mvplugins.multiverse.core.locale.message.MessageReplacement.replace;
2830

2931
@Service
3032
class ModifyCommand extends CoreCommand {
3133

34+
private static final Map<String, String> REMOVED_PROPERTIES = Map.of(
35+
"animals", "/mv entity-spawn-config modify [world] animal set spawn <true|false>",
36+
"monsters", "/mv entity-spawn-config modify [world] monster set spawn <true|false>"
37+
);
38+
3239
private final WorldManager worldManager;
3340

3441
@Inject
@@ -65,6 +72,13 @@ void onModifyCommand(// SUPPRESS CHECKSTYLE: ParameterNumber
6572
@Syntax("[value]")
6673
@Description("{@@mv-core.modify.value.description}")
6774
@Nullable String propertyValue) {
75+
if (REMOVED_PROPERTIES.containsKey(propertyName)) {
76+
issuer.sendMessage(MVCorei18n.MODIFY_PROPERTYREMOVED,
77+
replace("{property}").with(propertyName),
78+
replace("{replacement}").with(REMOVED_PROPERTIES.get(propertyName)));
79+
return;
80+
}
81+
6882
MultiverseWorld world = worldValue.value();
6983

7084
if (action.isRequireValue() && propertyValue == null) {

src/main/java/org/mvplugins/multiverse/core/locale/MVCorei18n.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public enum MVCorei18n implements MessageKeyProvider {
151151
MODIFY_WORLD_DESCRIPTION,
152152
MODIFY_PROPERTY_DESCRIPTION,
153153
MODIFY_VALUE_DESCRIPTION,
154+
MODIFY_PROPERTYREMOVED,
154155
MODIFY_CANNOTHAVEVALUE,
155156
MODIFY_SPECIFYVALUE,
156157
MODIFY_SUCCESS,

src/main/resources/multiverse-core_en.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ mv-core.modify.description=Modifies a world property of a given world.
132132
mv-core.modify.world.description=Name of world you want to modify.
133133
mv-core.modify.property.description=Property you want to modify.
134134
mv-core.modify.value.description=Value of property.
135+
mv-core.modify.propertyremoved=&cYou cannot modify '&3{property}&c' because it has been changed or removed. Please use '&a{replacement}&c' instead.
135136
mv-core.modify.cannothavevalue=You cannot specify a value to {action} '{property}'.
136137
mv-core.modify.specifyvalue=You must specify a value to {action} '{property}'.
137138
mv-core.modify.success=&aSuccessfully {action} '&9{property}&a' to '&9{value}&a' in world &9{world}&a.

0 commit comments

Comments
 (0)