From 2e23ae0811605f3a228ab082425fbe2730d78e08 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 30 Nov 2016 16:00:47 +1100 Subject: [PATCH] Fixes #1243 --- .../bukkit/listeners/ForceFieldListener.java | 15 ++++++++++----- .../com/intellectualcrafters/plot/config/C.java | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java index d32185f23..32b421a56 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java @@ -1,18 +1,19 @@ package com.plotsquared.bukkit.listeners; import com.google.common.collect.Iterables; +import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.flag.Flags; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.Permissions; import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.util.BukkitUtil; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - import java.util.HashSet; import java.util.Set; import java.util.UUID; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; public class ForceFieldListener { @@ -79,14 +80,18 @@ public class ForceFieldListener { if (plot.isAdded(uuid)) { Set players = getNearbyPlayers(player, plot); for (PlotPlayer oPlayer : players) { - ((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(plotPlayer, oPlayer)); + if (!Permissions.hasPermission(oPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { + ((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(plotPlayer, oPlayer)); + } } } else { PlotPlayer oPlayer = hasNearbyPermitted(player, plot); if (oPlayer == null) { return; } - player.setVelocity(calculateVelocity(oPlayer, plotPlayer)); + if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) { + player.setVelocity(calculateVelocity(oPlayer, plotPlayer)); + } } } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index 67c483713..4b57e5026 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -56,6 +56,7 @@ public enum C { PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat", "static.permissions"), PERMISSION_ADMIN_EXIT_DENIED("plots.admin.exit.denied", "static.permissions"), PERMISSION_ADMIN_ENTRY_DENIED("plots.admin.entry.denied", "static.permissions"), + PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield", "static.permissions"), PERMISSION_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"), PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"),