WE tweak / Fix teleport event

This commit is contained in:
boy0001 2015-08-25 05:56:22 +10:00
parent 3164838e05
commit 0e8ae9e6e4
2 changed files with 4 additions and 11 deletions

View File

@ -1422,7 +1422,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
} }
final org.bukkit.Location from = event.getFrom(); final org.bukkit.Location from = event.getFrom();
final org.bukkit.Location to = event.getTo(); final org.bukkit.Location to = event.getTo();
int x2; int x2;
if (MathMan.roundInt(from.getX()) != (x2 = MathMan.roundInt(to.getX()))) { if (MathMan.roundInt(from.getX()) != (x2 = MathMan.roundInt(to.getX()))) {
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -1440,10 +1439,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
PlotId id = plotManager.getPlotId(plotworld, x2, 0, MathMan.roundInt(to.getZ())); PlotId id = plotManager.getPlotId(plotworld, x2, 0, MathMan.roundInt(to.getZ()));
Plot lastPlot = (Plot) pp.getMeta("lastplot"); Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (id == null) { if (id == null) {
if (lastPlot == null) { if (lastPlot != null && !plotExit(pp, lastPlot)) {
return;
}
if (!plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) { if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) {
player.teleport(from); player.teleport(from);
@ -1506,10 +1502,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2); PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
Plot lastPlot = (Plot) pp.getMeta("lastplot"); Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (id == null) { if (id == null) {
if (lastPlot == null) { if (lastPlot != null && !plotExit(pp, lastPlot)) {
return;
}
if (!plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) { if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) {
player.teleport(from); player.teleport(from);

View File

@ -28,7 +28,7 @@ public class WEManager {
HashSet<RegionWrapper> regions = new HashSet<>(); HashSet<RegionWrapper> regions = new HashSet<>();
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) { for (Plot plot : PS.get().getPlotsInWorld(player.getLocation().getWorld())) {
if (!plot.isBasePlot() || Settings.DONE_RESTRICTS_BUILDING && FlagManager.getPlotFlag(plot, "done") != null) { if (!plot.isBasePlot() || (Settings.DONE_RESTRICTS_BUILDING && FlagManager.getPlotFlag(plot, "done") != null)) {
continue; continue;
} }
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) { if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {