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 9612b562b..6a20e1aed 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 @@ -739,7 +739,8 @@ import java.util.regex.Pattern; Plot now = area.getPlot(loc); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { - if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) { + if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp + .getMeta("kick", false)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); this.tmpTeleport = false; if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) { @@ -800,7 +801,8 @@ import java.util.regex.Pattern; Plot now = area.getPlot(loc); Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT); if (now == null) { - if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport) { + if (lastPlot != null && !plotExit(pp, lastPlot) && this.tmpTeleport && !pp + .getMeta("kick", false)) { MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); this.tmpTeleport = false; if (lastPlot.equals(BukkitUtil.getLocation(from).getPlot())) { @@ -2272,7 +2274,8 @@ import java.util.regex.Pattern; event.setCancelled(true); } else if (Settings.Done.RESTRICT_BUILDING && plot.getFlags().containsKey(Flags.DONE)) { if (!Permissions.hasPermission(plotPlayer, C.PERMISSION_ADMIN_BUILD_OTHER)) { - MainUtil.sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); + MainUtil + .sendMessage(plotPlayer, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER); event.setCancelled(true); } } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java index fe026b362..fc16db715 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Kick.java @@ -68,7 +68,7 @@ import java.util.UUID; MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]); return false; } - if (player2.hasPermission("plots.admin.entry.denied")) { + if (Permissions.hasPermission(player2, C.PERMISSION_ADMIN_ENTRY_DENIED)) { C.CANNOT_KICK_PLAYER.send(player, player2.getName()); return false; } @@ -81,10 +81,10 @@ import java.util.UUID; // Kick from server if you can't be teleported to spawn player2.kick(C.YOU_GOT_KICKED.s()); } else { - player2.teleport(newSpawn); + player2.plotkick(newSpawn); } } else { - player2.teleport(spawn); + player2.plotkick(spawn); } } return true; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index dccc4f3a7..d535c625e 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -353,6 +353,17 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { */ public abstract void teleport(Location location); + /** + * Kick this player to a location + * + * @param location the target location + */ + public void plotkick(Location location) { + setMeta("kick", true); + teleport(location); + deleteMeta("kick"); + } + /** * Set this compass target. *