Compare commits

...

3 Commits
7.5.6 ... main

Author SHA1 Message Date
Jordan
58016bb1c8 fix: allow admin override when setting plot context in command (#4712)
* fix: allow admin override when setting plot context in command
 - when admins (plots.admin or console) attempted to use /plot x;z to set context on a plot they are denied on, it would not work
 - fixes #4696

* Print error to user if denied
2025-08-03 11:13:48 +02:00
Alexander Brandes
e5943ba627 Update adventure-platform-bukkit to 4.4.1
Signed-off-by: Alexander Brandes <mc.cache@web.de>
2025-07-30 09:01:56 +02:00
Alexander Brandes
07dfdeef2c Back to snapshot for development
Signed-off-by: Alexander Brandes <mc.cache@web.de>
2025-07-29 21:20:36 +02:00
5 changed files with 37 additions and 33 deletions

View File

@@ -15,12 +15,6 @@ repositories {
name = "EssentialsX"
url = uri("https://repo.essentialsx.net/releases/")
}
// To be removed when "adventure-platform-bukkit" cuts a new release of 4.4.1 or higher
maven("https://central.sonatype.com/repository/maven-snapshots/") {
content {
includeGroup("net.kyori")
}
}
}
dependencies {

View File

@@ -283,32 +283,41 @@ public class MainCommand extends Command {
}
}
private CompletableFuture<Optional<CommandExecutionData>> preparePlotArgument(@Nullable Plot newPlot,
@Nonnull CommandExecutionData data,
@Nullable PlotArea area) {
if (newPlot != null && (data.player() instanceof ConsolePlayer
|| (area != null && area.equals(newPlot.getArea()))
|| data.player().hasPermission(Permission.PERMISSION_ADMIN)
|| data.player().hasPermission(Permission.PERMISSION_ADMIN_AREA_SUDO))
&& !newPlot.isDenied(data.player().getUUID())) {
return fetchPlotCenterLocation(newPlot)
.thenApply(newLoc -> {
if (!data.player().canTeleport(newLoc)) {
data.player().sendMessage(TranslatableCaption.of("border.denied"));
return Optional.empty();
}
// Save meta
var originalCommandMeta = setCommandScope(data.player(), new TemporaryCommandMeta(newLoc, newPlot));
return Optional.of(new CommandExecutionData(
data.player(),
Arrays.copyOfRange(data.args(), 1, data.args().length), // Trimmed command
data.confirm(),
data.whenDone(),
originalCommandMeta
));
});
private CompletableFuture<Optional<CommandExecutionData>> preparePlotArgument(
@Nullable Plot newPlot,
@Nonnull CommandExecutionData data,
@Nullable PlotArea area
) {
if (newPlot == null) {
return CompletableFuture.completedFuture(Optional.of(data));
}
return CompletableFuture.completedFuture(Optional.of(data));
final PlotPlayer<?> player = data.player();
final boolean isAdmin = player instanceof ConsolePlayer || player.hasPermission(Permission.PERMISSION_ADMIN);
final boolean isDenied = newPlot.isDenied(player.getUUID());
if (!isAdmin) {
if (isDenied) {
throw new CommandException(TranslatableCaption.of("deny.cannot_interact"));
}
if (area != null && area.equals(newPlot.getArea()) && !player.hasPermission(Permission.PERMISSION_ADMIN_AREA_SUDO)) {
return CompletableFuture.completedFuture(Optional.of(data));
}
}
return fetchPlotCenterLocation(newPlot)
.thenApply(newLoc -> {
if (!player.canTeleport(newLoc)) {
player.sendMessage(TranslatableCaption.of("border.denied"));
return Optional.empty();
}
// Save meta
var originalCommandMeta = setCommandScope(player, new TemporaryCommandMeta(newLoc, newPlot));
return Optional.of(new CommandExecutionData(
player,
Arrays.copyOfRange(data.args(), 1, data.args().length), // Trimmed command
data.confirm(),
data.whenDone(),
originalCommandMeta
));
});
}
private Optional<CommandExecutionData> prepareFlagArgument(@Nonnull CommandExecutionData data, @Nonnull PlotArea area) {

View File

@@ -415,6 +415,7 @@
"deny.denied_added": "<prefix><dark_aqua>You successfully denied the player from this plot.</dark_aqua>",
"deny.no_enter": "<prefix><red>You are denied from the plot <red><gold><plot></gold><red> and therefore not allowed to enter.</red>",
"deny.you_got_denied": "<prefix><red>You are denied from the plot you were previously on, and got teleported to spawn.</red>",
"deny.cannot_interact": "<prefix><red>You are denied from the plot <red><gold><plot></gold><red> and therefore cannot interact with it.</red>",
"deny.cant_remove_owner": "<prefix><red>You can't remove the plot owner.</red>",
"kick.player_not_in_plot": "<prefix><red>The player <gray><player></gray> is not on this plot.</red>",
"kick.cannot_kick_player": "<prefix><red>You cannot kick the player <gray><player></gray>.</red>",

View File

@@ -20,7 +20,7 @@ plugins {
}
group = "com.intellectualsites.plotsquared"
version = "7.5.6"
version = "7.5.7-SNAPSHOT"
if (!File("$rootDir/.git").exists()) {
logger.lifecycle("""

View File

@@ -8,7 +8,7 @@ gson = "2.10"
guava = "31.1-jre"
snakeyaml = "2.0"
adventure = "4.23.0"
adventure-bukkit = "4.4.1-SNAPSHOT"
adventure-bukkit = "4.4.1"
log4j = "2.19.0"
# Plugins