From ac03b9f539e16d14d1a994d32b4e2250e4100169 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Sun, 7 Mar 2021 11:01:24 +0100 Subject: [PATCH] Set player gamemode to spectator when tping to studio --- .../iris/manager/command/CommandIrisStudioTPStudio.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/volmit/iris/manager/command/CommandIrisStudioTPStudio.java b/src/main/java/com/volmit/iris/manager/command/CommandIrisStudioTPStudio.java index 56deaf19c..e7423ca7d 100644 --- a/src/main/java/com/volmit/iris/manager/command/CommandIrisStudioTPStudio.java +++ b/src/main/java/com/volmit/iris/manager/command/CommandIrisStudioTPStudio.java @@ -5,6 +5,7 @@ import com.volmit.iris.IrisSettings; import com.volmit.iris.util.KList; import com.volmit.iris.util.MortarCommand; import com.volmit.iris.util.MortarSender; +import org.bukkit.GameMode; public class CommandIrisStudioTPStudio extends MortarCommand { @@ -30,6 +31,11 @@ public class CommandIrisStudioTPStudio extends MortarCommand return true; } + if(!sender.isPlayer()){ + sender.sendMessage("Cannot be ran by console."); + return true; + } + if(!Iris.proj.isProjectOpen()) { sender.sendMessage("There is not a studio currently loaded."); @@ -40,6 +46,7 @@ public class CommandIrisStudioTPStudio extends MortarCommand { sender.sendMessage("Teleporting you to the active studio world."); sender.player().teleport(Iris.proj.getActiveProject().getActiveProvider().getTarget().getWorld().getSpawnLocation()); + sender.player().setGameMode(GameMode.SPECTATOR); } catch(Throwable e)