From ead9cf691088f0f4811f52434295665dc30470da Mon Sep 17 00:00:00 2001 From: SuperErnD Date: Tue, 17 Dec 2024 22:04:34 +0200 Subject: [PATCH] fix #314 --- .../plasmid/impl/game/composite/RandomGame.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/xyz/nucleoid/plasmid/impl/game/composite/RandomGame.java b/src/main/java/xyz/nucleoid/plasmid/impl/game/composite/RandomGame.java index 13edb6014..06519af41 100644 --- a/src/main/java/xyz/nucleoid/plasmid/impl/game/composite/RandomGame.java +++ b/src/main/java/xyz/nucleoid/plasmid/impl/game/composite/RandomGame.java @@ -2,6 +2,7 @@ import net.minecraft.text.Text; import net.minecraft.util.math.random.Random; +import net.minecraft.registry.entry.RegistryEntry; import xyz.nucleoid.plasmid.api.game.GameOpenContext; import xyz.nucleoid.plasmid.api.game.GameOpenException; import xyz.nucleoid.plasmid.api.game.GameOpenProcedure; @@ -11,11 +12,16 @@ public final class RandomGame { public static GameOpenProcedure open(GameOpenContext context) { var config = context.config(); - var game = config.selectGame(Random.createLocal()); - if (game == null) { + if(config.isEmpty()) { throw new GameOpenException(Text.translatable("text.plasmid.random.empty_composite_game_config")); } + + RegistryEntry> game = null; + while(game == null) game = config.selectGame(Random.createLocal()); return GameOpenProcedure.withOverride(GameConfig.openProcedure(context.server(), game), game); } } + + +