From 8bb516465d23c356474b01d2a81216e689f0ceb7 Mon Sep 17 00:00:00 2001 From: Ryan Fox Date: Sat, 27 Jul 2019 21:54:35 +0000 Subject: [PATCH] Verify spawn exists before teleporting Signed-off-by: Ryan Fox --- src/party/_2a03/mc/command/SpawnCommand.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/party/_2a03/mc/command/SpawnCommand.java b/src/party/_2a03/mc/command/SpawnCommand.java index 410d9e5..9a05c70 100644 --- a/src/party/_2a03/mc/command/SpawnCommand.java +++ b/src/party/_2a03/mc/command/SpawnCommand.java @@ -14,6 +14,14 @@ public class SpawnCommand { public static void register(CommandDispatcher dispatcher) { LiteralArgumentBuilder literalargumentbuilder = Commands.func_197057_a("spawn").executes((source) -> { PlayerPosition position = Config.parsePosition(Config.getData("spawn")); + if (position.world == null) { + if (source.getSource().func_197034_c(2)) { + source.getSource().func_197030_a(new TranslationTextComponent("Spawn not found, do /spawn set"), false); + } else { + source.getSource().func_197030_a(new TranslationTextComponent("Spawn not found, ask an admin to set it"), false); + } + return 1; + } ((ServerPlayerEntity)source.getSource().func_197035_h()).func_200619_a(position.world, position.x, position.y, position.z, position.yaw, position.pitch); source.getSource().func_197030_a(new TranslationTextComponent("Teleported to the spawn point"), true); return 1;