mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
fixes teleport
This commit is contained in:
parent
56cb409a43
commit
d8801b17cf
@ -76,21 +76,23 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
public static void PlayerMove(final PlayerMoveEvent event) {
|
public static void PlayerMove(final PlayerMoveEvent event) {
|
||||||
try {
|
try {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final Location from = event.getFrom();
|
final Location f = event.getFrom();
|
||||||
final Location to = event.getTo();
|
final Location t = event.getTo();
|
||||||
if ((from.getBlockX() != to.getBlockX()) || (from.getBlockZ() != to.getBlockZ())) {
|
final Location q = new Location(t.getWorld(), t.getBlockX(), 64, t.getZ());
|
||||||
|
|
||||||
|
if ((f.getBlockX() != q.getBlockX()) || (f.getBlockZ() != q.getBlockZ())) {
|
||||||
if (!isPlotWorld(player.getWorld())) {
|
if (!isPlotWorld(player.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (enteredPlot(from, to)) {
|
if (enteredPlot(f, q)) {
|
||||||
final Plot plot = getCurrentPlot(event.getTo());
|
final Plot plot = getCurrentPlot(q);
|
||||||
final boolean admin = PlotMain.hasPermission(player, "plots.admin");
|
final boolean admin = PlotMain.hasPermission(player, "plots.admin");
|
||||||
if (plot.deny_entry(player) && !admin) {
|
if (plot.deny_entry(player) && !admin) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plotEntry(player, plot);
|
plotEntry(player, plot);
|
||||||
} else if (leftPlot(event.getFrom(), event.getTo())) {
|
} else if (leftPlot(f, q)) {
|
||||||
final Plot plot = getCurrentPlot(event.getFrom());
|
final Plot plot = getCurrentPlot(event.getFrom());
|
||||||
plotExit(player, plot);
|
plotExit(player, plot);
|
||||||
}
|
}
|
||||||
@ -474,7 +476,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
|
|
||||||
if (isPlotWorld(q)) {
|
if (isPlotWorld(q)) {
|
||||||
if (isInPlot(q)) {
|
if (isInPlot(q)) {
|
||||||
final Plot plot = getCurrentPlot(event.getTo());
|
final Plot plot = getCurrentPlot(q);
|
||||||
if (plot.deny_entry(event.getPlayer())) {
|
if (plot.deny_entry(event.getPlayer())) {
|
||||||
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
|
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -489,7 +491,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
plotExit(event.getPlayer(), plot);
|
plotExit(event.getPlayer(), plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((event.getTo().getBlockX() >= 29999999) || (event.getTo().getBlockX() <= -29999999) || (event.getTo().getBlockZ() >= 29999999) || (event.getTo().getBlockZ() <= -29999999)) {
|
if ((q.getBlockX() >= 29999999) || (q.getBlockX() <= -29999999) || (q.getBlockZ() >= 29999999) || (q.getBlockZ() <= -29999999)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,14 +179,15 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
final Location t = e.getTo();
|
final Location t = e.getTo();
|
||||||
|
final Location q = new Location(t.getWorld(), t.getBlockX(), 64, t.getZ());
|
||||||
final Location f = e.getFrom();
|
final Location f = e.getFrom();
|
||||||
if (!isPlotWorld(t)) {
|
if (!isPlotWorld(q)) {
|
||||||
if (isPlotWorld(f)) {
|
if (isPlotWorld(f)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(p);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PWE.setMask(p, t);
|
PWE.setMask(p, q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user