mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Send message on perm check
This commit is contained in:
parent
52496af9a1
commit
38a33248e7
@ -444,6 +444,7 @@ public class MainListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD)) {
|
||||||
|
MainUtil.sendMessage(pp, C.PERMISSION_ADMIN_DESTROY_ROAD);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -519,6 +520,7 @@ public class MainListener {
|
|||||||
Plot plot = area.getPlot(loc);
|
Plot plot = area.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
if (!Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD)) {
|
||||||
|
MainUtil.sendMessage(pp, C.PERMISSION_ADMIN_BUILD_ROAD);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -527,10 +529,10 @@ public class MainListener {
|
|||||||
if (plot.isAdded(pp.getUUID()) || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
if (plot.isAdded(pp.getUUID()) || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
|
||||||
com.google.common.base.Optional<HashSet<PlotBlock>> place = plot.getFlag(Flags.PLACE);
|
com.google.common.base.Optional<HashSet<PlotBlock>> place = plot.getFlag(Flags.PLACE);
|
||||||
BlockState state = pos.getState();
|
BlockState state = pos.getState();
|
||||||
if (!place.isPresent() || !place.get().contains(SpongeUtil.getPlotBlock(state))) {
|
if (!place.isPresent() || !place.get().contains(SpongeUtil.getPlotBlock(state))) {
|
||||||
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -543,37 +545,37 @@ public class MainListener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
event.filter(new Predicate<org.spongepowered.api.world.Location<World>>() {
|
event.filter(new Predicate<org.spongepowered.api.world.Location<World>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(org.spongepowered.api.world.Location<World> l) {
|
public boolean test(org.spongepowered.api.world.Location<World> l) {
|
||||||
Location loc = SpongeUtil.getLocation(worldName, l);
|
Location loc = SpongeUtil.getLocation(worldName, l);
|
||||||
Plot plot = loc.getPlot();
|
Plot plot = loc.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return loc.getPlotAbs() == null || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD);
|
return loc.getPlotArea() != null && !Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD, true);
|
||||||
}
|
}
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED)) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.isAdded(pp.getUUID()) || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER)) {
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
if (plot.isAdded(pp.getUUID()) || Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER, true)) {
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
com.google.common.base.Optional<HashSet<PlotBlock>> place = plot.getFlag(Flags.PLACE);
|
com.google.common.base.Optional<HashSet<PlotBlock>> place = plot.getFlag(Flags.PLACE);
|
||||||
BlockState state = l.getBlock();
|
BlockState state = l.getBlock();
|
||||||
if (place.isPresent() && place.get().contains(SpongeUtil.getPlotBlock(state))) {
|
if (place.isPresent() && place.get().contains(SpongeUtil.getPlotBlock(state))) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_BUILD_OTHER);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
public void onJoin(ClientConnectionEvent.Join event) {
|
public void onJoin(ClientConnectionEvent.Join event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user