From 535d8f497b1d44b70f4648128285dc74e703d482 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 4 Jun 2021 00:25:49 +0200 Subject: [PATCH] Add Flying Signed-off-by: Chaoscaot --- .../steamwar/bausystem/features/other/NoClipCommand.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java index bbd8e9de..592b1a55 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java @@ -42,6 +42,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -121,4 +122,12 @@ public class NoClipCommand extends SWCommand implements Listener { event.setBuildable(true); } } + + @EventHandler(ignoreCancelled = true) + public void onPlayerToggleFlight(PlayerToggleFlightEvent event) { + if (NOCLIPS.contains(event.getPlayer())) { + event.setCancelled(true); + event.getPlayer().setFlying(true); + } + } } \ No newline at end of file