refactor: Use player friendly done message on restricted building (#3309)

This commit is contained in:
Alex 2021-11-02 14:32:04 +01:00 committed by GitHub
parent 7263290bbe
commit 48c7a3e94e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -318,8 +318,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -401,8 +400,7 @@ public class BlockEventListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -985,8 +985,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
e.setCancelled(true); e.setCancelled(true);
return; return;
@ -1258,8 +1257,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }
@ -1332,8 +1330,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
} else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { } else if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -178,8 +178,7 @@ public class BukkitEntityUtil {
if (!Permissions if (!Permissions
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { .hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
plotPlayer.sendMessage( plotPlayer.sendMessage(
TranslatableCaption.of("permission.no_permission_event"), TranslatableCaption.of("done.building_restricted")
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_OTHER))
); );
return false; return false;
} }

View File

@ -94,6 +94,7 @@
"done.done_insufficient_complexity": "<prefix><red>This plot is too simple. Please add more detail before using this command.</red>", "done.done_insufficient_complexity": "<prefix><red>This plot is too simple. Please add more detail before using this command.</red>",
"done.done_success": "<prefix><gold>Successfully marked this plot as done.</gold>", "done.done_success": "<prefix><gold>Successfully marked this plot as done.</gold>",
"done.done_removed": "<prefix><gray>You may now continue building in this plot.</gray>", "done.done_removed": "<prefix><gray>You may now continue building in this plot.</gray>",
"done.building_restricted": "<prefix><gray>You can't build on plots marked as done.</gray>",
"ratings.ratings_purged": "<prefix><gray>Purged ratings for this plot.</gray>", "ratings.ratings_purged": "<prefix><gray>Purged ratings for this plot.</gray>",
"ratings.rating_not_valid": "<prefix><red>You need to specify a number between 1 and 10.</red>", "ratings.rating_not_valid": "<prefix><red>You need to specify a number between 1 and 10.</red>",
"ratings.rating_already_exists": "<prefix><gray>You have already rated plot <plot>.</gray>", "ratings.rating_already_exists": "<prefix><gray>You have already rated plot <plot>.</gray>",