From af115811338c60d38111d8a738b8103b5ae7db1e Mon Sep 17 00:00:00 2001 From: marcocorriero Date: Tue, 14 Nov 2017 11:34:49 +0100 Subject: [PATCH] Forgot to cancel the event im a such stupid xD --- .../me/totalfreedom/totalfreedommod/PvpMonitor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/PvpMonitor.java b/src/main/java/me/totalfreedom/totalfreedommod/PvpMonitor.java index d387a933..6798d459 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/PvpMonitor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/PvpMonitor.java @@ -43,12 +43,16 @@ public class PvpMonitor extends FreedomService { // Checks 4 cases if (player.getGameMode() == GameMode.CREATIVE && plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on creative and god mode on. player.sendMessage(ChatColor.RED + "Hey! You cannot PVP with God Mode and creative!"); + event.setCancelled(true); } else if (player.getGameMode() == GameMode.CREATIVE && !plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on creative and god mode off. player.sendMessage(ChatColor.RED + "Hey! You cannot PVP in creative!"); + event.setCancelled(true); } else if (player.getGameMode() == GameMode.SURVIVAL && plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on survival with god mode on. player.sendMessage(ChatColor.RED + "Hey! You can't PVP with godmode!"); + event.setCancelled(true); } else if (player.getGameMode() == GameMode.ADVENTURE && plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on Adventure with god mode on. player.sendMessage(ChatColor.RED + "Hey! You can't PVP with godmode!"); + event.setCancelled(true); } } @@ -58,7 +62,7 @@ public class PvpMonitor extends FreedomService { ProjectileSource ps = ((Projectile) damager).getShooter(); Player player = (Player) ps; - + // Bypasses the block if Player is actually a Supered-Admin. if (plugin.al.isAdmin((player))) { return; @@ -66,12 +70,16 @@ public class PvpMonitor extends FreedomService { if (player.getGameMode() == GameMode.CREATIVE && plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on creative and god mode on. player.sendMessage(ChatColor.RED + "Hey! You cannot PVP with God Mode and creative!"); + event.setCancelled(true); } else if (player.getGameMode() == GameMode.CREATIVE && !plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on creative and god mode off. player.sendMessage(ChatColor.RED + "Hey! You cannot PVP in creative!"); + event.setCancelled(true); } else if (player.getGameMode() == GameMode.SURVIVAL && plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on survival with god mode on. player.sendMessage(ChatColor.RED + "Hey! You can't PVP with godmode!"); + event.setCancelled(true); } else if (player.getGameMode() == GameMode.ADVENTURE && plugin.esb.getEssentialsUser(player.getName()).isGodModeEnabled()) { // This checks if player is on Adventure with god mode on. player.sendMessage(ChatColor.RED + "Hey! You can't PVP with godmode!"); + event.setCancelled(true); } } }