Fix road interact on sponge

This commit is contained in:
Jesse Boyd 2017-03-13 07:16:16 +11:00
parent 4d4950090d
commit 52496af9a1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -311,13 +311,13 @@ public class MainListener {
return; return;
} }
Location loc = SpongeUtil.getLocation(player.getWorld().getName(), target.get()); Location loc = SpongeUtil.getLocation(player.getWorld().getName(), target.get());
org.spongepowered.api.world.Location l = SpongeUtil.getLocation(loc); PlotArea area = loc.getPlotArea();
Plot plot = loc.getPlot(); if (area == null) {
return;
}
Plot plot = area.getPlot(loc);
PlotPlayer pp = SpongeUtil.getPlayer(player); PlotPlayer pp = SpongeUtil.getPlayer(player);
if (plot == null) { if (plot == null) {
if (loc.getPlotAbs() == null) {
return;
}
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -336,6 +336,7 @@ public class MainListener {
return; return;
} else { } else {
com.google.common.base.Optional<HashSet<PlotBlock>> flag = plot.getFlag(Flags.USE); com.google.common.base.Optional<HashSet<PlotBlock>> flag = plot.getFlag(Flags.USE);
org.spongepowered.api.world.Location l = SpongeUtil.getLocation(loc);
if (flag.isPresent() && flag.get().contains(SpongeUtil.getPlotBlock(l.getBlock()))) { if (flag.isPresent() && flag.get().contains(SpongeUtil.getPlotBlock(l.getBlock()))) {
return; return;
} }
@ -511,11 +512,12 @@ public class MainListener {
Transaction<BlockSnapshot> first = transactions.get(0); Transaction<BlockSnapshot> first = transactions.get(0);
BlockSnapshot pos = first.getOriginal(); BlockSnapshot pos = first.getOriginal();
Location loc = SpongeUtil.getLocation(worldName, pos.getPosition()); Location loc = SpongeUtil.getLocation(worldName, pos.getPosition());
Plot plot = loc.getPlot(); PlotArea area = loc.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getPlot(loc);
if (plot == null) { if (plot == null) {
if (loc.getPlotAbs() == null) {
return;
}
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) { if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
event.setCancelled(true); event.setCancelled(true);
return; return;