Finish up permissions

This commit is contained in:
N0tMyFaultOG 2020-11-02 21:03:46 +01:00
parent fed7f89f96
commit 81c72ee5d9
4 changed files with 23 additions and 19 deletions

View File

@ -187,10 +187,10 @@ public class BukkitEntityUtil {
}
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
);
return false;
}
@ -199,10 +199,10 @@ public class BukkitEntityUtil {
.isAdded(plotPlayer.getUUID()))) {
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.destroy." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.destroy." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
);
if (plot != null) {
plot.debug(player.getName()
@ -220,10 +220,10 @@ public class BukkitEntityUtil {
.getFlag(PveFlag.class))) {
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pve." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -241,10 +241,10 @@ public class BukkitEntityUtil {
.getFlag(PveFlag.class))) {
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pve." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType
@ -255,10 +255,10 @@ public class BukkitEntityUtil {
} else if (EntityCategories.PLAYER.contains(entityType)) {
if (isPlot) {
if (!plot.getFlag(PvpFlag.class) && !Permissions
.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pvp." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
);
plot.debug(player.getName() + " could not attack " + entityType
+ " because pve = false");
@ -269,10 +269,10 @@ public class BukkitEntityUtil {
} else if (roadFlags && area.getRoadFlag(PvpFlag.class)) {
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pvp." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pvp." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
);
return false;
}
@ -286,10 +286,10 @@ public class BukkitEntityUtil {
}
} else if (roadFlags && (area.getRoadFlag(AnimalAttackFlag.class) || area
.getFlag(PveFlag.class))) {
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pve." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
return false;
}
@ -305,10 +305,10 @@ public class BukkitEntityUtil {
} else if (roadFlags && area.getRoadFlag(PveFlag.class)) {
return true;
}
if (!Permissions.hasPermission(plotPlayer, "plots.admin.pve." + stub)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"),
Template.of("node", "plots.admin.pve." + stub)
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
);
if (plot != null) {
plot.debug(player.getName() + " could not attack " + entityType

View File

@ -214,7 +214,7 @@ public class Cluster extends SubCommand {
if (current + cluster.getArea() > allowed) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.cluster.size" + "." + (current + cluster.getArea()))
Template.of("node", Permission.PERMISSION_CLUSTER_SIZE + "." + (current + cluster.getArea()))
);
return false;
}
@ -385,7 +385,7 @@ public class Cluster extends SubCommand {
if (current + cluster.getArea() > allowed) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.cluster" + "." + (current + cluster.getArea()))
Template.of("node", Permission.PERMISSION_CLUSTER + "." + (current + cluster.getArea()))
);
return false;
}

View File

@ -158,7 +158,7 @@ public class Merge extends SubCommand {
if (!force && size - 1 > maxSize) {
player.sendMessage(
TranslatableCaption.of("permission.no_permission"),
Template.of("node", "plots.merge." + (size + 1))
Template.of("node", Permission.PERMISSION_MERGE + "." + (size + 1))
);
return false;
}

View File

@ -50,10 +50,12 @@ public enum Permission {
PERMISSION_ADMIN_VISIT_UNTRUSTED("plots.admin.visit.untrusted"),
PERMISSION_ADMIN_ENTRY_FORCEFIELD("plots.admin.entry.forcefield"),
PERMISSION_ADMIN_COMMANDS_CHATSPY("plots.admin.command.chatspy"),
PERMISSION_MERGE("plots.merge"),
PERMISSION_MERGE_OTHER("plots.merge.other"),
PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad"),
PERMISSION_ADMIN_CAPS_OTHER("plots.admin.caps.other"),
PERMISSION_ADMIN_MUSIC_OTHER("plots.admin.music.other"),
PERMISSION_ADMIN_DESTROY("plots.admin.destroy"),
PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned"),
PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel"),
PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other"),
@ -61,6 +63,8 @@ public enum Permission {
PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD("plots.admin.vehicle.break.road"),
PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED("plots.admin.vehicle.break.unowned"),
PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER("plots.admin.vehicle.break.other"),
PERMISSION_ADMIN_PVE("plots.admin.pve"),
PERMISSION_ADMIN_PVP("plots.admin.pvp"),
PERMISSION_ADMIN_BUILD_ROAD("plots.admin.build.road"),
PERMISSION_ADMIN_PROJECTILE_ROAD("plots.admin.projectile.road"),
PERMISSION_ADMIN_PROJECTILE_UNOWNED("plots.admin.projectile.unowned"),