Show old flag value in remove command (#3711)

This commit is contained in:
Traks 2022-06-27 13:31:45 +02:00 committed by GitHub
parent 26bec7fe2f
commit 005600c99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -462,6 +462,7 @@ public final class FlagCommand extends Command {
return; return;
} }
final Plot plot = player.getLocation().getPlotAbs(); final Plot plot = player.getLocation().getPlotAbs();
final PlotFlag<?, ?> flagWithOldValue = plot.getFlagContainer().getFlag(flag.getClass());
PlotFlagRemoveEvent event = eventDispatcher.callFlagRemove(flag, plot); PlotFlagRemoveEvent event = eventDispatcher.callFlagRemove(flag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
@ -506,7 +507,7 @@ public final class FlagCommand extends Command {
if (plot.removeFlag(flag)) { if (plot.removeFlag(flag)) {
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of( player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
"value", "value",
String.valueOf(flag) String.valueOf(flagWithOldValue)
)); ));
return; return;
} else { } else {
@ -544,7 +545,7 @@ public final class FlagCommand extends Command {
} }
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of( player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
"value", "value",
String.valueOf(flag) String.valueOf(flagWithOldValue)
)); ));
} }