diff --git a/src/me/yaruma/fightsystem/FightSystem.java b/src/me/yaruma/fightsystem/FightSystem.java index acf6b7f..1c5790c 100644 --- a/src/me/yaruma/fightsystem/FightSystem.java +++ b/src/me/yaruma/fightsystem/FightSystem.java @@ -87,6 +87,7 @@ public class FightSystem extends JavaPlugin { pm.registerEvents(new PlayerRespawnListener(), plugin); pm.registerEvents(new EntityDamageListener(), plugin); pm.registerEvents(new EntityExplodeListener(), plugin); + pm.registerEvents(new PlayerTeleportListener(), plugin); //WinConditions if(Config.AllDead) pm.registerEvents(new WinconditionAllDead(), plugin); diff --git a/src/me/yaruma/fightsystem/listener/PlayerTeleportListener.java b/src/me/yaruma/fightsystem/listener/PlayerTeleportListener.java new file mode 100644 index 0000000..344ffc7 --- /dev/null +++ b/src/me/yaruma/fightsystem/listener/PlayerTeleportListener.java @@ -0,0 +1,22 @@ +package me.yaruma.fightsystem.listener; + +import me.yaruma.fightsystem.FightSystem; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerTeleportEvent; + +public class PlayerTeleportListener implements Listener { + + @EventHandler + public void onTpGM3(PlayerTeleportEvent e) { + if (e.getPlayer().hasPermission("bukkit.command.teleport")) { + return; + } + if (e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) { + e.setCancelled(true); + e.getPlayer().sendMessage(FightSystem.PREFIX + "§cDu darfst die GM3 Teleportfunktion nicht benutzen!"); + } + } + + +}