Add flag placeholders to flag commands

This commit is contained in:
NotMyFault 2021-04-02 17:50:37 +02:00
parent 07fd7e497f
commit 600d38d3e2
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
3 changed files with 19 additions and 9 deletions

View File

@ -352,7 +352,8 @@ public final class FlagCommand extends Command {
return;
}
plot.setFlag(parsed);
player.sendMessage(TranslatableCaption.of("flag.flag_added"));
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
Template.of("value", String.valueOf(parsed)));
}
@CommandDeclaration(command = "add",
@ -418,7 +419,8 @@ public final class FlagCommand extends Command {
player.sendMessage(TranslatableCaption.of("flag.flag_not_added"));
return;
}
player.sendMessage(TranslatableCaption.of("flag.flag_added"));
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(event.getFlag())),
Template.of("value", String.valueOf(event.getFlag().getValue())));
}
@CommandDeclaration(command = "remove",
@ -490,14 +492,16 @@ public final class FlagCommand extends Command {
if (list.removeAll((List) parsedFlag.getValue())) {
if (list.isEmpty()) {
if (plot.removeFlag(flag)) {
player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", String.valueOf(flag)), Template.of(
"value",
String.valueOf(parsedFlag.getValue())
));
return;
} else {
player.sendMessage(TranslatableCaption.of("flag.flag_not_removed"));
return;
}
} else {
// MainUtil.sendMessage(player, Permission.FLAG_REMOVED);
PlotFlag plotFlag = parsedFlag.createFlagInstance(list);
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot);
if (addEvent.getEventResult() == Result.DENY) {
@ -526,7 +530,9 @@ public final class FlagCommand extends Command {
return;
}
}
player.sendMessage(TranslatableCaption.of("flag.flag_removed"));
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of("value",
String.valueOf(flag)
));
}
@CommandDeclaration(command = "list",

View File

@ -104,7 +104,9 @@ public class Music extends SubCommand {
return true;
}
plot.removeFlag(event.getFlag());
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"));
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag",
String.valueOf(event.getFlag())
));
} else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
.createFlagInstance(item.getType());
@ -117,7 +119,9 @@ public class Music extends SubCommand {
return true;
}
plot.setFlag(event.getFlag());
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"));
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag",
String.valueOf(event.getFlag())
), Template.of("value", String.valueOf(event.getFlag().getValue())));
} else {
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added"));
}

View File

@ -463,9 +463,9 @@
"flag.no_flags": "Global flags: None",
"flag.flag_not_removed": "<prefix><red>The flag could not be removed.</red>",
"flag.flag_not_added": "<prefix><red>The flag could not be added.</red>",
"flag.flag_removed": "<prefix><dark_aqua>The flag has been removed successfully.</dark_aqua>",
"flag.flag_removed": "<prefix><dark_aqua>The flag </dark_aqua><gold><flag></gold><dark_aqua> with the value </dark_aqua><gold><value></gold><dark_aqua> has been removed successfully.</dark_aqua>",
"flag.flag_partially_removed": "<prefix><dark_aqua>Successfully removed flag value(s).</dark_aqua>",
"flag.flag_added": "<prefix><dark_aqua>The flag has been added successfully.</dark_aqua>",
"flag.flag_added": "<prefix><dark_aqua>The flag</dark_aqua><gold> <flag></gold><dark_aqua> with the value </dark_aqua><gold><value></gold><dark_aqua> has been added successfully.</dark_aqua>",
"flag.flag_list_see_info": "<prefix><gray>Click to view information about the flag.</gray>",
"flag.flag_parse_error": "<prefix><red>Failed to parse flag </red><gray><flag_name></gray><red>, value provided </red><gray><flag_value><red>. </red></gray><red>Error: <error></red>",
"flag.flag_info_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Flags </gold><dark_gray><strikethrough>---------<reset>",