From 1405d94241578a1979ba8913b3a2017fbd2c232e Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Thu, 4 Jun 2020 21:32:45 +0100 Subject: [PATCH] Fix command test --- .../fabricmc/fabric/test/command/CommandTest.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/fabric-command-api-v1/src/testmod/java/net/fabricmc/fabric/test/command/CommandTest.java b/fabric-command-api-v1/src/testmod/java/net/fabricmc/fabric/test/command/CommandTest.java index a815a3a29..21c201b6c 100644 --- a/fabric-command-api-v1/src/testmod/java/net/fabricmc/fabric/test/command/CommandTest.java +++ b/fabric-command-api-v1/src/testmod/java/net/fabricmc/fabric/test/command/CommandTest.java @@ -32,7 +32,6 @@ import net.minecraft.text.LiteralText; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.server.ServerTickCallback; -import net.fabricmc.fabric.api.event.server.ServerStopCallback; public class CommandTest implements ModInitializer { private static final Logger LOGGER = LogManager.getLogger(CommandTest.class); @@ -40,17 +39,10 @@ public class CommandTest implements ModInitializer { private static final SimpleCommandExceptionType WRONG_SIDE_SHOULD_BE_DEDICATED = new SimpleCommandExceptionType(new LiteralText("This command was registered incorrectly. Should only be present on an dedicated server but was ran on an integrated server!")); private boolean hasTested = false; - private boolean hasRegistered = false; @Override public void onInitialize() { CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> { - if (this.hasRegistered) { - throw new AssertionError("Commands should not be registered twice per server instance!"); - } - - this.hasRegistered = true; - // A command that exists on both types of servers dispatcher.register(literal("fabric_common_test_command").executes(this::executeCommonCommand)); @@ -109,11 +101,6 @@ public class CommandTest implements ModInitializer { this.hasTested = true; CommandTest.LOGGER.info("The command tests have passed! Please make sure you execute the three commands for extra safety."); }); - - ServerStopCallback.EVENT.register(server -> { - // When the server shuts down, we reset the registered flag. - this.hasRegistered = false; - }); } private int executeCommonCommand(CommandContext context) {