Merge pull request #4 from marcocorriero/patch-1

Forgot to cancel the event
This commit is contained in:
Lemon 2017-11-14 15:44:54 +05:00 committed by GitHub
commit 9e7c385fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,12 +43,16 @@ public class PvpMonitor extends FreedomService {
// Checks 4 cases // 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. 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!"); 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. } 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!"); 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. } 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!"); 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. } 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!"); 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(); ProjectileSource ps = ((Projectile) damager).getShooter();
Player player = (Player) ps; Player player = (Player) ps;
// Bypasses the block if Player is actually a Supered-Admin. // Bypasses the block if Player is actually a Supered-Admin.
if (plugin.al.isAdmin((player))) { if (plugin.al.isAdmin((player))) {
return; 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. 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!"); 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. } 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!"); 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. } 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!"); 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. } 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!"); player.sendMessage(ChatColor.RED + "Hey! You can't PVP with godmode!");
event.setCancelled(true);
} }
} }
} }