diff --git a/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java b/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java index ace3dc7d9..b9a6ab496 100644 --- a/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java +++ b/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java @@ -26,6 +26,8 @@ import com.volmit.iris.util.decree.DecreeExecutor; import com.volmit.iris.util.decree.DecreeOrigin; import com.volmit.iris.util.decree.annotations.Decree; import com.volmit.iris.util.decree.annotations.Param; +import com.volmit.iris.util.decree.specialhandlers.NullableBiomeHandler; +import com.volmit.iris.util.decree.specialhandlers.NullableRegionHandler; import com.volmit.iris.util.format.C; import org.bukkit.block.Biome; diff --git a/core/src/main/java/com/volmit/iris/util/decree/specialhandlers/NullableBiomeHandler.java b/core/src/main/java/com/volmit/iris/util/decree/specialhandlers/NullableBiomeHandler.java new file mode 100644 index 000000000..252a340ae --- /dev/null +++ b/core/src/main/java/com/volmit/iris/util/decree/specialhandlers/NullableBiomeHandler.java @@ -0,0 +1,31 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2024 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.volmit.iris.util.decree.specialhandlers; + +import com.volmit.iris.engine.object.IrisBiome; +import com.volmit.iris.util.decree.exceptions.DecreeParsingException; +import com.volmit.iris.util.decree.handlers.BiomeHandler; + +public class NullableBiomeHandler extends BiomeHandler { + + @Override + public IrisBiome parse(String in, boolean force) throws DecreeParsingException { + return getPossibilities(in).stream().filter((i) -> toString(i).equalsIgnoreCase(in)).findFirst().orElse(null); + } +} diff --git a/core/src/main/java/com/volmit/iris/util/decree/specialhandlers/NullableRegionHandler.java b/core/src/main/java/com/volmit/iris/util/decree/specialhandlers/NullableRegionHandler.java new file mode 100644 index 000000000..0493e4dd7 --- /dev/null +++ b/core/src/main/java/com/volmit/iris/util/decree/specialhandlers/NullableRegionHandler.java @@ -0,0 +1,31 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2024 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.volmit.iris.util.decree.specialhandlers; + +import com.volmit.iris.engine.object.IrisRegion; +import com.volmit.iris.util.decree.exceptions.DecreeParsingException; +import com.volmit.iris.util.decree.handlers.RegionHandler; + +public class NullableRegionHandler extends RegionHandler { + + @Override + public IrisRegion parse(String in, boolean force) throws DecreeParsingException { + return getPossibilities(in).stream().filter((i) -> toString(i).equalsIgnoreCase(in)).findFirst().orElse(null); + } +}