Skip to content

Commit

Permalink
improve: checks if the biome exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 committed Feb 20, 2024
1 parent 262f7b2 commit 351a49b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.github.siroshun09.biomefinder.util.SeedGenerator;
import net.kyori.adventure.key.Key;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.block.Biome;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -49,8 +51,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
key = Key.key("minecraft:plains");
}

sender.sendMessage(START_GENERATING_SEED.apply(key));
if (Registry.BIOME.get(new NamespacedKey(key.namespace(), key.value())) == null) {
sender.sendMessage(INVALID_BIOME.apply(key.asString()));
return true;
}

sender.sendMessage(START_GENERATING_SEED.apply(key));

var executor = getExecutor();
setCurrentTask(
Expand Down

0 comments on commit 351a49b

Please sign in to comment.