mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +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);
|
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, () -> {
|
return plot1.getPlotModificationManager().move(plot2, player, () -> {
|
||||||
}, false).thenApply(result -> {
|
}, false).thenApply(result -> {
|
||||||
if (result) {
|
if (result) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("move.move_success"),
|
TranslatableCaption.of("move.move_success"),
|
||||||
Template.of("origin", plot1.toString()),
|
Template.of("origin", p1),
|
||||||
Template.of("target", plot2.toString())
|
Template.of("target", p2)
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,11 +82,17 @@ public class Swap extends SubCommand {
|
|||||||
return CompletableFuture.completedFuture(false);
|
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, () -> {
|
return plot1.getPlotModificationManager().move(plot2, player, () -> {
|
||||||
}, true).thenApply(result -> {
|
}, true).thenApply(result -> {
|
||||||
if (result) {
|
if (result) {
|
||||||
player.sendMessage(TranslatableCaption.of("swap.swap_success"), Template.of("origin", String.valueOf(plot1)),
|
player.sendMessage(
|
||||||
Template.of("target", String.valueOf(plot2))
|
TranslatableCaption.of("swap.swap_success"),
|
||||||
|
Template.of("origin", p1),
|
||||||
|
Template.of("target", p2)
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user