This commit is contained in:
Jesse Boyd 2016-11-30 16:00:47 +11:00
parent 28e7f5bc08
commit 2e23ae0811
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 11 additions and 5 deletions

View File

@ -1,18 +1,19 @@
package com.plotsquared.bukkit.listeners; package com.plotsquared.bukkit.listeners;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flags; import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class ForceFieldListener { public class ForceFieldListener {
@ -79,15 +80,19 @@ public class ForceFieldListener {
if (plot.isAdded(uuid)) { if (plot.isAdded(uuid)) {
Set<PlotPlayer> players = getNearbyPlayers(player, plot); Set<PlotPlayer> players = getNearbyPlayers(player, plot);
for (PlotPlayer oPlayer : players) { for (PlotPlayer oPlayer : players) {
if (!Permissions.hasPermission(oPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(plotPlayer, oPlayer)); ((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(plotPlayer, oPlayer));
} }
}
} else { } else {
PlotPlayer oPlayer = hasNearbyPermitted(player, plot); PlotPlayer oPlayer = hasNearbyPermitted(player, plot);
if (oPlayer == null) { if (oPlayer == null) {
return; return;
} }
if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
player.setVelocity(calculateVelocity(oPlayer, plotPlayer)); player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
} }
} }
} }
} }
}

View File

@ -56,6 +56,7 @@ public enum C {
PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat", "static.permissions"), PERMISSION_PLOT_TOGGLE_CHAT("plots.toggle.chat", "static.permissions"),
PERMISSION_ADMIN_EXIT_DENIED("plots.admin.exit.denied", "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_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_COMMANDS_CHAT("plots.admin.command.chat", "static.permissions"),
PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"), PERMISSION_MERGE_OTHER("plots.merge.other", "static.permissions"),
PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned", "static.permissions"),