From 8a244d12fc5fa7056cd6aae8cd1c89875a817789 Mon Sep 17 00:00:00 2001 From: "Patrick \"IPat\" Hein" Date: Wed, 2 Jun 2021 19:55:35 +0200 Subject: [PATCH] Fix if-condition limited to roads for animal attack cancelling on plots (#3079) * Negate mob-place flag debug message * fixed a little typo :) * Added check for dragon egg teleportation event https://github.com/IntellectualSites/PlotSquared/issues/3074 * Basic dragon egg interact bugfix (Left-click interaction) * Lifted admin if-condition out of roads (out-of-plot) only block (for animals) Co-authored-by: NotMyFault --- .../bukkit/util/BukkitEntityUtil.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java index 76890c957..baa29bc59 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEntityUtil.java @@ -279,19 +279,22 @@ public class BukkitEntityUtil { if (isPlot) { if (plot.getFlag(AnimalAttackFlag.class) || plot.getFlag(PveFlag.class) || plot .isAdded(plotPlayer.getUUID())) { - plot.debug(player.getName() + " could not attack " + entityType - + " because pve = false OR animal-attack = false"); return true; } } else if (roadFlags && (area.getRoadFlag(AnimalAttackFlag.class) || area .getFlag(PveFlag.class))) { - if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { - plotPlayer.sendMessage( - TranslatableCaption.of("permission.no_permission_event"), - Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) - ); - return false; + return true; + } + if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) { + plotPlayer.sendMessage( + TranslatableCaption.of("permission.no_permission_event"), + Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub) + ); + if (plot != null) { + plot.debug(player.getName() + " could not attack " + entityType + + " because pve = false OR animal-attack = false"); } + return false; } } else if (EntityCategories.VEHICLE .contains(entityType)) { // Vehicles are managed in vehicle destroy event