From 2ec13e4e76d448f089be5060682be33a5f09fbdf Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 1 May 2019 12:31:50 -0400 Subject: [PATCH] Replace code with hasFlag() where appropriate. --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 10 +++++----- .../intellectualsites/plotsquared/plot/flag/Flags.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index ebb7a8617..de3fd6dab 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1115,7 +1115,7 @@ import org.bukkit.util.Vector; MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_DESTROY_OTHER); event.setCancelled(true); - } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + } else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); @@ -2475,7 +2475,7 @@ import org.bukkit.util.Vector; MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); - } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + } else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); @@ -2537,7 +2537,7 @@ import org.bukkit.util.Vector; MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); - } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + } else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); @@ -2929,7 +2929,7 @@ import org.bukkit.util.Vector; if (victim instanceof Hanging) { // hanging if (plot != null && (plot.getFlag(Flags.HANGING_BREAK, false) || plot .isAdded(plotPlayer.getUUID()))) { - if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); return false; @@ -3097,7 +3097,7 @@ import org.bukkit.util.Vector; event.setCancelled(true); return; } - } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { + } else if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { if (!Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) { MainUtil.sendMessage(pp, Captions.NO_PERMISSION_EVENT, Captions.PERMISSION_ADMIN_BUILD_OTHER); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java index f4be6b5d6..12d9e2b06 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/flag/Flags.java @@ -180,7 +180,7 @@ public final class Flags { } }); PlotSquared.get().forEachPlotRaw(value -> { - if (value.getFlags().containsKey(duplicate)) { + if (value.hasFlag(duplicate)) { Object remove = value.getFlags().remove(duplicate); try { if (remove instanceof Collection