mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Fixed for worldguard 6 + fixes
- Improved plot perm checking (faster) - Added toString() method for PlotId - Fixed WorldGuard listener for WG 6
This commit is contained in:
parent
26249d00a3
commit
f331b1abaa
@ -195,15 +195,12 @@ public class PlayerFunctions {
|
|||||||
if (p.hasPermission("plots.admin")) {
|
if (p.hasPermission("plots.admin")) {
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
int y = 0;
|
for (int x = 0; x <= 100; x++) {
|
||||||
for (int x = 1; x <= 100; x++) {
|
if (p.hasPermission("plots.plot." + (100-x))) {
|
||||||
if (p.hasPermission("plots.plot." + x)) {
|
return 100-x;
|
||||||
y = x;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return y;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +23,11 @@ public class PlotId {
|
|||||||
PlotId other = (PlotId) obj;
|
PlotId other = (PlotId) obj;
|
||||||
return ((this.x == other.x) && (this.y == other.y));
|
return ((this.x == other.x) && (this.y == other.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.x+";"+this.y;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
@ -41,7 +41,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
|
BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
|
||||||
BlockVector vector2 = new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ());
|
BlockVector vector2 = new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ());
|
||||||
|
|
||||||
ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + ";" + plot.getId().y, vector1, vector2);
|
ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + "-" + plot.getId().y, vector1, vector2);
|
||||||
|
|
||||||
DefaultDomain owner = new DefaultDomain();
|
DefaultDomain owner = new DefaultDomain();
|
||||||
owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player));
|
owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player));
|
||||||
@ -57,6 +57,6 @@ public class WorldGuardListener implements Listener {
|
|||||||
World world = Bukkit.getWorld(event.getWorld());
|
World world = Bukkit.getWorld(event.getWorld());
|
||||||
|
|
||||||
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
manager.removeRegion(plot.x + ";" + plot.y);
|
manager.removeRegion(plot.x + "-" + plot.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user