mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Fix deny-teleport flag: Fixes #2128
This commit is contained in:
parent
7e56e47046
commit
8733dc6dab
1 changed files with 15 additions and 3 deletions
|
@ -619,8 +619,8 @@ import java.util.regex.Pattern;
|
||||||
public void onTeleport(PlayerTeleportEvent event) {
|
public void onTeleport(PlayerTeleportEvent event) {
|
||||||
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
|
if (event.getTo() == null || event.getFrom() == null || !event.getFrom().getWorld()
|
||||||
.equals(event.getTo().getWorld())) {
|
.equals(event.getTo().getWorld())) {
|
||||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
|
final Object lastLoc = BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LOCATION);
|
||||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
|
final Object lastPlot = BukkitUtil.getPlayer(event.getPlayer()).deleteMeta(PlotPlayer.META_LAST_PLOT);
|
||||||
org.bukkit.Location to = event.getTo();
|
org.bukkit.Location to = event.getTo();
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
@ -632,7 +632,19 @@ import java.util.regex.Pattern;
|
||||||
}
|
}
|
||||||
Plot plot = area.getPlot(loc);
|
Plot plot = area.getPlot(loc);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
plotEntry(pp, plot);
|
final boolean result = Flags.DENY_TELEPORT.allowsTeleport(pp, plot);
|
||||||
|
if (!result) {
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
|
||||||
|
event.setCancelled(true);
|
||||||
|
if (lastLoc != null) {
|
||||||
|
pp.setMeta(PlotPlayer.META_LOCATION, lastLoc);
|
||||||
|
}
|
||||||
|
if (lastPlot != null) {
|
||||||
|
pp.setMeta(PlotPlayer.META_LAST_PLOT, lastPlot);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
plotEntry(pp, plot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue