Tweak block interaction flags

This commit is contained in:
boy0001 2015-08-24 04:31:33 +10:00
parent d427ba3152
commit 66f73374ac
3 changed files with 26 additions and 16 deletions

View File

@ -82,51 +82,61 @@ public abstract class EventUtil {
} }
case BREAK_BLOCK: { case BREAK_BLOCK: {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
Flag flag = FlagManager.getPlotFlag(plot, "break"); Flag use = FlagManager.getPlotFlag(plot, "break");
HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue(); if (use != null) {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { HashSet<PlotBlock> value = (HashSet<PlotBlock>) use.getValue();
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms); if (value.contains(PlotBlock.EVERYTHING) || value.contains(block.getPlotBlock())) {
return true;
}
} }
return true;
Flag destroy = FlagManager.getPlotFlag(plot, "break");
if (destroy != null) {
HashSet<PlotBlock> value = (HashSet<PlotBlock>) destroy.getValue();
if (value.contains(PlotBlock.EVERYTHING) || value.contains(block.getPlotBlock())) {
return true;
}
}
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
case BREAK_HANGING: case BREAK_HANGING:
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) { if (FlagManager.isPlotFlagTrue(plot, "hanging-break")) {
return true; return true;
} }
if (plot.hasOwner()) { if (plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
case BREAK_MISC: case BREAK_MISC:
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (FlagManager.isPlotFlagTrue(plot, "misc-break")) { if (FlagManager.isPlotFlagTrue(plot, "misc-break")) {
return true; return true;
} }
if (plot.hasOwner()) { if (plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
case BREAK_VEHICLE: case BREAK_VEHICLE:
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) { if (FlagManager.isPlotFlagTrue(plot, "vehicle-break")) {
return true; return true;
} }
if (plot.hasOwner()) { if (plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_OTHER.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_DESTROY_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
case INTERACT_BLOCK: { case INTERACT_BLOCK: {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);

Binary file not shown.

Binary file not shown.