mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
PWE
This commit is contained in:
parent
dfb56986b3
commit
7514d3c5db
@ -47,7 +47,9 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
|||||||
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
||||||
@ -110,7 +112,7 @@ public class WorldEditListener implements Listener {
|
|||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if (plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(UUIDHandler.getUUID(p)))) {
|
if (plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(UUIDHandler.getUUID(p)))) {
|
||||||
PWE.setMask(p, loc, false);
|
PWE.setMask(BukkitUtil.getPlayer(p), loc, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +120,8 @@ public class WorldEditListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerCommand(final PlayerCommandPreprocessEvent e) {
|
public void onPlayerCommand(final PlayerCommandPreprocessEvent e) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (!PlotSquared.isPlotWorld(p.getWorld().getName()) || BukkitMain.hasPermission(p, "plots.worldedit.bypass")) {
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
|
if (!PlotSquared.isPlotWorld(p.getWorld().getName()) || Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String cmd = e.getMessage().toLowerCase();
|
String cmd = e.getMessage().toLowerCase();
|
||||||
@ -149,16 +152,16 @@ public class WorldEditListener implements Listener {
|
|||||||
final LocalSession session = PlotSquared.worldEdit.getSession(p);
|
final LocalSession session = PlotSquared.worldEdit.getSession(p);
|
||||||
final Mask mask = session.getMask();
|
final Mask mask = session.getMask();
|
||||||
if (mask == null) {
|
if (mask == null) {
|
||||||
BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Both points");
|
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "Both points");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mask.test(pos1)) {
|
if (!mask.test(pos1)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 1");
|
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "Position 1");
|
||||||
}
|
}
|
||||||
if (!mask.test(pos2)) {
|
if (!mask.test(pos2)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
BukkitPlayerFunctions.sendMessage(p, C.REQUIRE_SELECTION_IN_MASK, "Position 2");
|
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "Position 2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,17 +171,18 @@ public class WorldEditListener implements Listener {
|
|||||||
public void onPlayerJoin(final PlayerJoinEvent e) {
|
public void onPlayerJoin(final PlayerJoinEvent e) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
final Location l = p.getLocation();
|
final Location l = p.getLocation();
|
||||||
if (BukkitMain.hasPermission(p, "plots.worldedit.bypass")) {
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
if (isPlotWorld(l)) {
|
if (isPlotWorld(l)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(pp);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotWorld(l)) {
|
if (isPlotWorld(l)) {
|
||||||
com.intellectualcrafters.plot.object.Location loc = BukkitUtil.getLocation(l);
|
com.intellectualcrafters.plot.object.Location loc = BukkitUtil.getLocation(l);
|
||||||
PWE.setMask(p, loc, false);
|
PWE.setMask(pp, loc, false);
|
||||||
} else {
|
} else {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +194,8 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
final Location f = e.getFrom();
|
final Location f = e.getFrom();
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (BukkitMain.hasPermission(p, "plots.worldedit.bypass")) {
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
if (!PWE.hasMask(p)) {
|
if (!PWE.hasMask(p)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -201,37 +206,39 @@ public class WorldEditListener implements Listener {
|
|||||||
final PlotId idF = MainUtil.getPlotId(locf);
|
final PlotId idF = MainUtil.getPlotId(locf);
|
||||||
final PlotId idT = MainUtil.getPlotId(loct);
|
final PlotId idT = MainUtil.getPlotId(loct);
|
||||||
if ((idT != null) && !(idF == idT)) {
|
if ((idT != null) && !(idF == idT)) {
|
||||||
PWE.setMask(p, loct, false);
|
PWE.setMask(pp, loct, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPortal(final PlayerPortalEvent e) {
|
public void onPortal(final PlayerPortalEvent e) {
|
||||||
if (BukkitMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
Player p = e.getPlayer();
|
||||||
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Player p = e.getPlayer();
|
|
||||||
final Location t = e.getTo();
|
final Location t = e.getTo();
|
||||||
final Location f = e.getFrom();
|
final Location f = e.getFrom();
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(pp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotWorld(t)) {
|
if (isPlotWorld(t)) {
|
||||||
com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
|
com.intellectualcrafters.plot.object.Location loct = BukkitUtil.getLocation(t);
|
||||||
PWE.setMask(p, loct, false);
|
PWE.setMask(pp, loct, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((f != null) && isPlotWorld(f)) {
|
if ((f != null) && isPlotWorld(f)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(pp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onTeleport(final PlayerTeleportEvent e) {
|
public void onTeleport(final PlayerTeleportEvent e) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (BukkitMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||||
|
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
|
||||||
if (!PWE.hasMask(p)) {
|
if (!PWE.hasMask(p)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -241,11 +248,11 @@ public class WorldEditListener implements Listener {
|
|||||||
final Location f = e.getFrom();
|
final Location f = e.getFrom();
|
||||||
if (!PlotSquared.isPlotWorld(loct.getWorld())) {
|
if (!PlotSquared.isPlotWorld(loct.getWorld())) {
|
||||||
if (isPlotWorld(f)) {
|
if (isPlotWorld(f)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(pp);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PWE.setMask(p, loct, false);
|
PWE.setMask(pp, loct, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user