mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 22:26:45 +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:
|
plots.worldedit.bypass:
|
||||||
default: false
|
default: false
|
||||||
plots.gamemode.bypass:
|
plots.gamemode.bypass:
|
||||||
default: op
|
default: false
|
||||||
plots.confirm.bypass:
|
plots.confirm.bypass:
|
||||||
default: false
|
default: false
|
||||||
|
plots.flag.notify-enter.bypass:
|
||||||
|
default: false
|
||||||
|
plots.flag.notify-leave.bypass:
|
||||||
|
default: false
|
||||||
|
|
||||||
plots.permpack.basicflags:
|
plots.permpack.basicflags:
|
||||||
default: op
|
default: op
|
||||||
|
@ -107,7 +107,7 @@ public class SimpleBackupManager implements BackupManager {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("backups.backup_automatic_started"),
|
TranslatableCaption.of("backups.backup_automatic_started"),
|
||||||
Template.of("plot", String.valueOf(plot.getId()))
|
Template.of("plot", plot.getId().toString())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
profile.createBackup().whenComplete((backup, throwable) -> {
|
profile.createBackup().whenComplete((backup, throwable) -> {
|
||||||
|
@ -132,7 +132,10 @@ public class Buy extends Command {
|
|||||||
plot.removeFlag(event.getFlag());
|
plot.removeFlag(event.getFlag());
|
||||||
}
|
}
|
||||||
plot.setOwner(player.getUUID());
|
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);
|
whenDone.run(Buy.this, CommandResult.SUCCESS);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
this.econHandler.depositMoney(player, price);
|
this.econHandler.depositMoney(player, price);
|
||||||
|
@ -135,7 +135,7 @@ public class Clear extends Command {
|
|||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("working.clearing_done"),
|
TranslatableCaption.of("working.clearing_done"),
|
||||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
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 org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
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",
|
@CommandDeclaration(command = "debugroadregen",
|
||||||
usage = DebugRoadRegen.USAGE,
|
usage = DebugRoadRegen.USAGE,
|
||||||
@ -110,7 +114,7 @@ public class DebugRoadRegen extends SubCommand {
|
|||||||
;
|
;
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("debugroadregen.regen_done"),
|
TranslatableCaption.of("debugroadregen.regen_done"),
|
||||||
Template.of("value", String.valueOf(plot.getId()))
|
Template.of("value", plot.getId().toString())
|
||||||
);
|
);
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("debugroadregen.regen_all"),
|
TranslatableCaption.of("debugroadregen.regen_all"),
|
||||||
@ -173,4 +177,12 @@ public class DebugRoadRegen extends SubCommand {
|
|||||||
return true;
|
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(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("working.deleting_done"),
|
TranslatableCaption.of("working.deleting_done"),
|
||||||
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
Template.of("amount", String.valueOf(System.currentTimeMillis() - start)),
|
||||||
Template.of("plot", String.valueOf(plot.getId()))
|
Template.of("plot", plot.getId().toString())
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -96,7 +96,10 @@ public class Done extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plot.addRunning();
|
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");
|
final Settings.Auto_Clear doneRequirements = Settings.AUTO_CLEAR.get("done");
|
||||||
if (ExpireManager.IMP == null || doneRequirements == null) {
|
if (ExpireManager.IMP == null || doneRequirements == null) {
|
||||||
finish(plot, player, true);
|
finish(plot, player, true);
|
||||||
|
@ -128,14 +128,14 @@ public class Download extends SubCommand {
|
|||||||
player.sendMessage(TranslatableCaption.of("schematics.mca_file_size"));
|
player.sendMessage(TranslatableCaption.of("schematics.mca_file_size"));
|
||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
this.worldUtil.saveWorld(world);
|
this.worldUtil.saveWorld(world);
|
||||||
this.worldUtil.upload(plot, null, null, new RunnableVal<URL>() {
|
this.worldUtil.upload(plot, null, null, new RunnableVal<>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(URL url) {
|
public void run(URL url) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("web.generating_link_failed"),
|
TranslatableCaption.of("web.generating_link_failed"),
|
||||||
Template.of("plot", String.valueOf(plot.getId()))
|
Template.of("plot", plot.getId().toString())
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ public class Download extends SubCommand {
|
|||||||
sendUsage(player);
|
sendUsage(player);
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ public class Download extends SubCommand {
|
|||||||
schematicHandler
|
schematicHandler
|
||||||
.getCompoundTag(plot)
|
.getCompoundTag(plot)
|
||||||
.whenComplete((compoundTag, throwable) -> {
|
.whenComplete((compoundTag, throwable) -> {
|
||||||
schematicHandler.upload(compoundTag, null, null, new RunnableVal<URL>() {
|
schematicHandler.upload(compoundTag, null, null, new RunnableVal<>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(URL value) {
|
public void run(URL value) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
@ -205,7 +205,7 @@ public class Download extends SubCommand {
|
|||||||
if (throwable != null || !result.isSuccess()) {
|
if (throwable != null || !result.isSuccess()) {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("web.generating_link_failed"),
|
TranslatableCaption.of("web.generating_link_failed"),
|
||||||
Template.of("plot", String.valueOf(plot.getId()))
|
Template.of("plot", plot.getId().toString())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
|
@ -168,7 +168,7 @@ public class Set extends SubCommand {
|
|||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("working.component_complete"),
|
TranslatableCaption.of("working.component_complete"),
|
||||||
Template.of("plot", String.valueOf(plot.getId()))
|
Template.of("plot", plot.getId().toString())
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
if (Settings.QUEUE.NOTIFY_PROGRESS) {
|
||||||
|
@ -142,6 +142,10 @@ public class PlotListener {
|
|||||||
public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
|
public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
|
||||||
if (plot.isDenied(player.getUUID()) && !Permissions
|
if (plot.isDenied(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, "plots.admin.entry.denied")) {
|
.hasPermission(player, "plots.admin.entry.denied")) {
|
||||||
|
player.sendMessage(
|
||||||
|
TranslatableCaption.of("deny.no_enter"),
|
||||||
|
Template.of("plot", plot.toString())
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try (final MetaDataAccess<Plot> lastPlot = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
try (final MetaDataAccess<Plot> lastPlot = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
|
||||||
@ -208,7 +212,7 @@ public class PlotListener {
|
|||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
||||||
Template.of("gamemode", String.valueOf(gameMode)),
|
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(
|
player.sendMessage(
|
||||||
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
TranslatableCaption.of("gamemode.gamemode_was_bypassed"),
|
||||||
Template.of("gamemode", String.valueOf(guestGameMode)),
|
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 (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()) {
|
for (UUID uuid : plot.getOwners()) {
|
||||||
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
|
||||||
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
|
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_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>",
|
"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.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>",
|
"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>",
|
"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>",
|
"trusted.trusted_added": "<prefix><dark_aqua>You successfully trusted a user to the plot.</dark_aqua>",
|
||||||
|
Loading…
Reference in New Issue
Block a user