mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fixed worldedit bypass command
This commit is contained in:
parent
63b13ffb1a
commit
ab465868ee
@ -45,7 +45,7 @@ public class WE_Anywhere extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask");
|
PlayerFunctions.sendMessage(plr, "&6Cleared your WorldEdit mask");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PWE.setMask(plr, plr.getLocation());
|
PWE.setMask(plr, plr.getLocation(), true);
|
||||||
PlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask");
|
PlayerFunctions.sendMessage(plr, "&6Updated your WorldEdit mask");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -110,7 +110,7 @@ public class WorldEditListener implements Listener {
|
|||||||
final Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
final Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
||||||
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, l);
|
PWE.setMask(p, l, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ public class WorldEditListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotWorld(l)) {
|
if (isPlotWorld(l)) {
|
||||||
PWE.setMask(p, l);
|
PWE.setMask(p, l, false);
|
||||||
} else {
|
} else {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(p);
|
||||||
}
|
}
|
||||||
@ -192,17 +192,16 @@ 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 (PlotMain.hasPermission(p, "plots.worldedit.bypass") && !PWE.hasMask(p)) {
|
if (PlotMain.hasPermission(p, "plots.worldedit.bypass")) {
|
||||||
return;
|
if (!PWE.hasMask(p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((f.getBlockX() != t.getBlockX()) || (f.getBlockZ() != t.getBlockZ())) {
|
if ((f.getBlockX() != t.getBlockX()) || (f.getBlockZ() != t.getBlockZ())) {
|
||||||
final PlotId idF = PlayerFunctions.getPlot(f);
|
final PlotId idF = PlayerFunctions.getPlot(f);
|
||||||
final PlotId idT = PlayerFunctions.getPlot(t);
|
final PlotId idT = PlayerFunctions.getPlot(t);
|
||||||
if ((!PWE.hasMask(e.getPlayer())) && PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((idT != null) && !(idF == idT)) {
|
if ((idT != null) && !(idF == idT)) {
|
||||||
PWE.setMask(p, t);
|
PWE.setMask(p, t, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +219,7 @@ public class WorldEditListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isPlotWorld(t)) {
|
if (isPlotWorld(t)) {
|
||||||
PWE.setMask(p, t);
|
PWE.setMask(p, t, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((f != null) && isPlotWorld(f)) {
|
if ((f != null) && isPlotWorld(f)) {
|
||||||
@ -230,10 +229,12 @@ public class WorldEditListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onTeleport(final PlayerTeleportEvent e) {
|
public void onTeleport(final PlayerTeleportEvent e) {
|
||||||
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
|
if (PlotMain.hasPermission(e.getPlayer(), "plots.worldedit.bypass")) {
|
||||||
|
if (!PWE.hasMask(p)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
final Location t = e.getTo();
|
final Location t = e.getTo();
|
||||||
final Location q = new Location(t.getWorld(), t.getBlockX(), 64, t.getZ());
|
final Location q = new Location(t.getWorld(), t.getBlockX(), 64, t.getZ());
|
||||||
final Location f = e.getFrom();
|
final Location f = e.getFrom();
|
||||||
@ -243,6 +244,6 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PWE.setMask(p, q);
|
PWE.setMask(p, q, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("ALL") public class PWE {
|
@SuppressWarnings("ALL") public class PWE {
|
||||||
|
|
||||||
public static void setMask(final Player p, final Location l) {
|
public static void setMask(final Player p, final Location l, boolean force) {
|
||||||
try {
|
try {
|
||||||
LocalSession s;
|
LocalSession s;
|
||||||
if (PlotMain.worldEdit == null) {
|
if (PlotMain.worldEdit == null) {
|
||||||
@ -63,15 +63,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
if (FlagManager.isPlotFlagTrue(plot, "no-worldedit")) {
|
if (FlagManager.isPlotFlagTrue(plot, "no-worldedit")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean r;
|
boolean r = ((plot.getOwner() != null) && plot.getOwner().equals(UUIDHandler.getUUID(p))) || plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(UUIDHandler.getUUID(p));
|
||||||
r = ((plot.getOwner() != null) && plot.getOwner().equals(UUIDHandler.getUUID(p))) || plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(UUIDHandler.getUUID(p));
|
if (r) {
|
||||||
if (!r) {
|
|
||||||
if (p.hasPermission("plots.worldedit.bypass")) {
|
|
||||||
removeMask(p, s);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
final World w = p.getWorld();
|
final World w = p.getWorld();
|
||||||
|
|
||||||
final Location bloc = PlotHelper.getPlotBottomLoc(w, plot.id);
|
final Location bloc = PlotHelper.getPlotBottomLoc(w, plot.id);
|
||||||
@ -89,12 +82,13 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (noMask(s)) {
|
if (force ^ (noMask(s) && !PlotMain.hasPermission(p, "plots.worldedit.bypass"))) {
|
||||||
final BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p);
|
final BukkitPlayer plr = PlotMain.worldEdit.wrapPlayer(p);
|
||||||
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
|
final Vector p1 = new Vector(69, 69, 69), p2 = new Vector(69, 69, 69);
|
||||||
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
|
s.setMask(new RegionMask(new CuboidRegion(plr.getWorld(), p1, p2)));
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
// throw new
|
// throw new
|
||||||
// PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY,
|
// PlotSquaredException(PlotSquaredException.PlotError.MISSING_DEPENDENCY,
|
||||||
// "WorldEdit == Null?");
|
// "WorldEdit == Null?");
|
||||||
|
Loading…
Reference in New Issue
Block a user