mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Account for mutability of plot objects when sending move/swap success messages (#3414)
Fixes #3337
This commit is contained in:
parent
b501a81e21
commit
07fdc94dd8
@ -105,13 +105,17 @@ public class Move extends SubCommand {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
// Set strings here as the plot objects are mutable (the PlotID changes after being moved).
|
||||
String p1 = plot1.toString();
|
||||
String p2 = plot2.toString();
|
||||
|
||||
return plot1.getPlotModificationManager().move(plot2, player, () -> {
|
||||
}, false).thenApply(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("move.move_success"),
|
||||
Template.of("origin", plot1.toString()),
|
||||
Template.of("target", plot2.toString())
|
||||
Template.of("origin", p1),
|
||||
Template.of("target", p2)
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -82,11 +82,17 @@ public class Swap extends SubCommand {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
// Set strings here as the plot objects are mutable (the PlotID changes after being moved).
|
||||
String p1 = plot1.toString();
|
||||
String p2 = plot2.toString();
|
||||
|
||||
return plot1.getPlotModificationManager().move(plot2, player, () -> {
|
||||
}, true).thenApply(result -> {
|
||||
if (result) {
|
||||
player.sendMessage(TranslatableCaption.of("swap.swap_success"), Template.of("origin", String.valueOf(plot1)),
|
||||
Template.of("target", String.valueOf(plot2))
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("swap.swap_success"),
|
||||
Template.of("origin", p1),
|
||||
Template.of("target", p2)
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user