mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Un-stringify plot id calls
- PlotId#toString() already stringifies IDs, no need to call String.valueOf() - Add tab completion to `/plot debugroadregen` - Add `plots.flag.notify-leave.bypass` permission separating from notify-enter - Add message notifying the player if the attempt to enter a plot they are denied from
This commit is contained in:
parent
2c40648a60
commit
19cea0e129
@ -294,9 +294,13 @@ permissions:
|
||||
plots.worldedit.bypass:
|
||||
default: false
|
||||
plots.gamemode.bypass:
|
||||
default: op
|
||||
default: false
|
||||
plots.confirm.bypass:
|
||||
default: false
|
||||
plots.flag.notify-enter.bypass:
|
||||
default: false
|
||||
plots.flag.notify-leave.bypass:
|
||||
default: false
|
||||
|
||||
plots.permpack.basicflags:
|
||||
default: op
|
||||
|
@ -107,7 +107,7 @@ public class SimpleBackupManager implements BackupManager {
|
||||
if (player != null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("backups.backup_automatic_started"),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
profile.createBackup().whenComplete((backup, throwable) -> {
|
||||
|
@ -132,7 +132,10 @@ public class Buy extends Command {
|
||||
plot.removeFlag(event.getFlag());
|
||||
}
|
||||
plot.setOwner(player.getUUID());
|
||||
player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", String.valueOf(plot.getId())));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.claimed"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
||||
}, () -> {
|
||||
this.econHandler.depositMoney(player, price);
|
||||
|
@ -135,7 +135,7 @@ public class Clear extends Command {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.clearing_done"),
|
||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -39,6 +39,10 @@ import net.kyori.adventure.text.minimessage.Template;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@CommandDeclaration(command = "debugroadregen",
|
||||
usage = DebugRoadRegen.USAGE,
|
||||
@ -110,7 +114,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
;
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regen_done"),
|
||||
Template.of("value", String.valueOf(plot.getId()))
|
||||
Template.of("value", plot.getId().toString())
|
||||
);
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("debugroadregen.regen_all"),
|
||||
@ -173,4 +177,12 @@ public class DebugRoadRegen extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Command> tab(final PlotPlayer<?> player, String[] args, boolean space) {
|
||||
return Stream.of("plot", "region")
|
||||
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
|
||||
.map(value -> new Command(null, false, value, "plots.debugroadregen", RequiredType.NONE, null) {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class Delete extends SubCommand {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.deleting_done"),
|
||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
});
|
||||
if (result) {
|
||||
|
@ -96,7 +96,10 @@ public class Done extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link"), Template.of("plot", String.valueOf(plot.getId())));
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generating_link"),
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
||||
if (ExpireManager.IMP == null || doneRequirements == null) {
|
||||
finish(plot, player, true);
|
||||
|
@ -128,14 +128,14 @@ public class Download extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("schematics.mca_file_size"));
|
||||
plot.addRunning();
|
||||
this.worldUtil.saveWorld(world);
|
||||
this.worldUtil.upload(plot, null, null, new RunnableVal<URL>() {
|
||||
this.worldUtil.upload(plot, null, null, new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(URL url) {
|
||||
plot.removeRunning();
|
||||
if (url == null) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generating_link_failed"),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
return;
|
||||
}
|
||||
@ -146,7 +146,7 @@ public class Download extends SubCommand {
|
||||
sendUsage(player);
|
||||
return false;
|
||||
}
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link"), Template.of("plot", String.valueOf(plot.getId())));
|
||||
player.sendMessage(TranslatableCaption.of("web.generating_link"), Template.of("plot", plot.getId().toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ public class Download extends SubCommand {
|
||||
schematicHandler
|
||||
.getCompoundTag(plot)
|
||||
.whenComplete((compoundTag, throwable) -> {
|
||||
schematicHandler.upload(compoundTag, null, null, new RunnableVal<URL>() {
|
||||
schematicHandler.upload(compoundTag, null, null, new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(URL value) {
|
||||
player.sendMessage(
|
||||
@ -205,7 +205,7 @@ public class Download extends SubCommand {
|
||||
if (throwable != null || !result.isSuccess()) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("web.generating_link_failed"),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
} else {
|
||||
player.sendMessage(
|
||||
|
@ -168,7 +168,7 @@ public class Set extends SubCommand {
|
||||
plot.removeRunning();
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("working.component_complete"),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
});
|
||||
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
||||
|
@ -142,6 +142,10 @@ public class PlotListener {
|
||||
public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
|
||||
if (plot.isDenied(player.getUUID()) && !Permissions
|
||||
.hasPermission(player, "plots.admin.entry.denied")) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("deny.no_enter"),
|
||||
Template.of("plot", plot.toString())
|
||||
);
|
||||
return false;
|
||||
}
|
||||
try (final MetaDataAccess<Plot> lastPlot = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
||||
@ -208,7 +212,7 @@ public class PlotListener {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
||||
Template.of("gamemode", String.valueOf(gameMode)),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -223,7 +227,7 @@ public class PlotListener {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
||||
Template.of("gamemode", String.valueOf(guestGameMode)),
|
||||
Template.of("plot", String.valueOf(plot.getId()))
|
||||
Template.of("plot", plot.getId().toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -379,7 +383,7 @@ public class PlotListener {
|
||||
}
|
||||
|
||||
if (plot.getFlag(NotifyLeaveFlag.class)) {
|
||||
if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
|
||||
if (!Permissions.hasPermission(player, "plots.flag.notify-leave.bypass")) {
|
||||
for (UUID uuid : plot.getOwners()) {
|
||||
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
||||
|
@ -373,7 +373,8 @@
|
||||
"chat.plot_chat_format": "<gray>[<gold>Plot Chat</gold>] [<gold><plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
|
||||
"chat.plot_chat_forced": "<prefix><gray>This world forces everyone to use plot chat.</gray>",
|
||||
"deny.denied_added": "<prefix><dark_aqua>You successfully denied the player from this plot.</dark_aqua>",
|
||||
"deny.you_got_denied": "<prefix><dark_aqua>You are denied from the plot you were previously on, and got teleported to spawn.</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.cant_remove_owner": "<prefix><red>You can't remove the plot owner.</red>",
|
||||
"kick.you_got_kicked": "<prefix><dark_aqua>You got kicked from the plot!</dark_aqua>",
|
||||
"trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>",
|
||||
|
Loading…
Reference in New Issue
Block a user