From 60f42086d7e3b4857b5fe5ad6b416ca4d57a77b6 Mon Sep 17 00:00:00 2001 From: gdamms Date: Wed, 18 May 2022 14:23:36 +0200 Subject: [PATCH] fix: auto specmode --- src/main/java/com/tocard/cam/ExecuteTraveling.java | 4 ++++ src/main/java/com/tocard/cam/NewPoint.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/tocard/cam/ExecuteTraveling.java b/src/main/java/com/tocard/cam/ExecuteTraveling.java index 8be8231..cc93d54 100644 --- a/src/main/java/com/tocard/cam/ExecuteTraveling.java +++ b/src/main/java/com/tocard/cam/ExecuteTraveling.java @@ -5,6 +5,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import java.util.Iterator; @@ -43,8 +44,11 @@ public class ExecuteTraveling implements CommandExecutor { return true; } + player.setGameMode(GameMode.SPECTATOR); + curveIterator = Camera.curve.subList(fromIndex * (Camera.nbSubdiv + 1), toIndex * (Camera.nbSubdiv + 1)) .iterator(); + player.teleport(curveIterator.next()); taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Camera.plugin, new Runnable() { diff --git a/src/main/java/com/tocard/cam/NewPoint.java b/src/main/java/com/tocard/cam/NewPoint.java index f07d9a0..746a65e 100644 --- a/src/main/java/com/tocard/cam/NewPoint.java +++ b/src/main/java/com/tocard/cam/NewPoint.java @@ -28,6 +28,9 @@ public class NewPoint implements CommandExecutor { case "fix": fix(args, null, null); break; + case "ins": + ins(args, new ExtendedLocation(player.getLocation()), player.getWorld()); + break; default: break; }