mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-12-31 22:28:45 +01:00
Compare commits
2 Commits
renovate/w
...
fix/v7/spe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48a47be17d | ||
|
|
79c7b5275a |
@@ -40,6 +40,7 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
|||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@CommandDeclaration(command = "merge",
|
@CommandDeclaration(command = "merge",
|
||||||
aliases = "m",
|
aliases = "m",
|
||||||
@@ -116,9 +117,11 @@ public class Merge extends SubCommand {
|
|||||||
if (direction == null) {
|
if (direction == null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||||
TagResolver.resolver("value", Tag.inserting(Component.text(
|
TagResolver.resolver(
|
||||||
"/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]"
|
"value", Tag.inserting(Component.text(
|
||||||
)))
|
"/plot merge <" + StringMan.join(values, " | ") + "> [removeroads]"
|
||||||
|
))
|
||||||
|
)
|
||||||
);
|
);
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("help.direction"),
|
TranslatableCaption.of("help.direction"),
|
||||||
@@ -154,14 +157,26 @@ public class Merge extends SubCommand {
|
|||||||
|
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
|
|
||||||
if (!force && !plot.isOwner(uuid)) {
|
if (!force) {
|
||||||
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
if (!plot.isOwner(uuid)) {
|
||||||
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
if (!player.hasPermission(Permission.PERMISSION_ADMIN_COMMAND_MERGE)) {
|
||||||
|
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
uuid = plot.getOwnerAbs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d && this.econHandler.getMoney(
|
||||||
|
player) < price) {
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.cannot_afford_merge"),
|
||||||
|
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
uuid = plot.getOwnerAbs();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direction == Direction.ALL) {
|
if (direction == Direction.ALL) {
|
||||||
boolean terrain = true;
|
boolean terrain = true;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
@@ -178,17 +193,15 @@ public class Merge extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, player, terrain)) {
|
if (plot.getPlotModificationManager().autoMerge(Direction.ALL, maxSize, uuid, player, terrain)) {
|
||||||
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
this.econHandler.withdrawMoney(player, price);
|
||||||
this.econHandler.withdrawMoney(player, price);
|
player.sendMessage(
|
||||||
player.sendMessage(
|
TranslatableCaption.of("economy.removed_balance"),
|
||||||
TranslatableCaption.of("economy.removed_balance"),
|
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))),
|
||||||
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price)))),
|
TagResolver.resolver(
|
||||||
TagResolver.resolver(
|
"balance",
|
||||||
"balance",
|
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
|
||||||
Tag.inserting(Component.text(this.econHandler.format(this.econHandler.getMoney(player))))
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||||
eventDispatcher.callPostMerge(player, plot);
|
eventDispatcher.callPostMerge(player, plot);
|
||||||
return true;
|
return true;
|
||||||
@@ -196,14 +209,6 @@ public class Merge extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!force && this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d && this.econHandler.getMoney(
|
|
||||||
player) < price) {
|
|
||||||
player.sendMessage(
|
|
||||||
TranslatableCaption.of("economy.cannot_afford_merge"),
|
|
||||||
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final boolean terrain;
|
final boolean terrain;
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
terrain = "true".equalsIgnoreCase(args[1]);
|
terrain = "true".equalsIgnoreCase(args[1]);
|
||||||
@@ -244,54 +249,66 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
java.util.Set<UUID> uuids = adjacent.getOwners();
|
java.util.Set<UUID> uuids = adjacent.getOwners();
|
||||||
boolean isOnline = false;
|
boolean isOnline = false;
|
||||||
for (final UUID owner : uuids) {
|
if (!force) {
|
||||||
final PlotPlayer<?> accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner);
|
for (final UUID owner : uuids) {
|
||||||
if (!force && accepter == null) {
|
final PlotPlayer<?> accepter = PlotSquared.platform().playerManager().getPlayerIfExists(owner);
|
||||||
continue;
|
if (accepter == null) {
|
||||||
}
|
continue;
|
||||||
isOnline = true;
|
|
||||||
final Direction dir = direction;
|
|
||||||
Runnable run = () -> {
|
|
||||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
|
|
||||||
plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain);
|
|
||||||
PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(player.getUUID());
|
|
||||||
if (plotPlayer == null) {
|
|
||||||
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
isOnline = true;
|
||||||
if (!force && this.econHandler.getMoney(player) < price) {
|
final Direction dir = direction;
|
||||||
player.sendMessage(
|
Supplier<Boolean> run = () -> {
|
||||||
TranslatableCaption.of("economy.cannot_afford_merge"),
|
accepter.sendMessage(TranslatableCaption.of("merge.merge_accepted"));
|
||||||
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
if (plot.getPlotModificationManager().autoMerge(dir, maxSize - size, owner, player, terrain)) {
|
||||||
);
|
PlotPlayer<?> plotPlayer = PlotSquared.platform().playerManager().getPlayerIfExists(player.getUUID());
|
||||||
return;
|
if (plotPlayer == null) {
|
||||||
|
accepter.sendMessage(TranslatableCaption.of("merge.merge_not_valid"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.econHandler.isEnabled(plotArea) && !player.hasPermission(Permission.PERMISSION_ADMIN_BYPASS_ECON) && price > 0d) {
|
||||||
|
if (this.econHandler.getMoney(player) < price) {
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.cannot_afford_merge"),
|
||||||
|
TagResolver.resolver(
|
||||||
|
"money",
|
||||||
|
Tag.inserting(Component.text(this.econHandler.format(price)))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.econHandler.withdrawMoney(player, price);
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("economy.removed_balance"),
|
||||||
|
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
||||||
|
eventDispatcher.callPostMerge(player, plot);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
this.econHandler.withdrawMoney(player, price);
|
player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
|
||||||
player.sendMessage(
|
return false;
|
||||||
TranslatableCaption.of("economy.removed_balance"),
|
};
|
||||||
TagResolver.resolver("money", Tag.inserting(Component.text(this.econHandler.format(price))))
|
if (hasConfirmation(player)) {
|
||||||
|
CmdConfirm.addPending(
|
||||||
|
accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||||
|
.deserialize(
|
||||||
|
TranslatableCaption.of("merge.merge_request_confirm").getComponent(player),
|
||||||
|
TagResolver.builder()
|
||||||
|
.tag("player", Tag.inserting(Component.text(player.getName())))
|
||||||
|
.tag(
|
||||||
|
"location",
|
||||||
|
Tag.inserting(Component.text(plot.getWorldName() + " " + plot.getId()))
|
||||||
|
)
|
||||||
|
.build()
|
||||||
|
)),
|
||||||
|
run::get
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return run.get();
|
||||||
}
|
}
|
||||||
player.sendMessage(TranslatableCaption.of("merge.success_merge"));
|
// find first
|
||||||
eventDispatcher.callPostMerge(player, plot);
|
break;
|
||||||
};
|
|
||||||
if (!force && hasConfirmation(player)) {
|
|
||||||
CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
|
|
||||||
.deserialize(
|
|
||||||
TranslatableCaption.of("merge.merge_request_confirm").getComponent(player),
|
|
||||||
TagResolver.builder()
|
|
||||||
.tag("player", Tag.inserting(Component.text(player.getName())))
|
|
||||||
.tag(
|
|
||||||
"location",
|
|
||||||
Tag.inserting(Component.text(plot.getWorldName() + " " + plot.getId()))
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
)),
|
|
||||||
run
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
run.run();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (force || !isOnline) {
|
if (force || !isOnline) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ adventure-bukkit = "4.4.1"
|
|||||||
log4j = "2.19.0"
|
log4j = "2.19.0"
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
worldedit = "7.3.18"
|
worldedit = "7.2.20"
|
||||||
fawe = "2.14.3"
|
fawe = "2.14.3"
|
||||||
placeholderapi = "2.11.7"
|
placeholderapi = "2.11.7"
|
||||||
luckperms = "5.5"
|
luckperms = "5.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user