feat: Split configuration for teleport on claim/auto (#3308)

- Fixes #2953
This commit is contained in:
Jordan 2021-11-07 21:29:49 +00:00 committed by GitHub
parent 30d06b7801
commit c1163cdb2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -556,8 +556,10 @@ public class Settings extends Config {
public static boolean ON_DEATH = false;
@Comment("Teleport to your plot on login")
public static boolean ON_LOGIN = false;
@Comment("Teleport to your plot on claim")
@Comment("Teleport to your plot on claim (/plot claim)")
public static boolean ON_CLAIM = true;
@Comment("Teleport to your plot on auto (/plot auto)")
public static boolean ON_AUTO = true;
@Comment({"Add a delay to all teleport commands (in seconds)",
"Assign `plots.teleport.delay.bypass` to bypass the cooldown"})
public static int DELAY = 0;

View File

@ -1708,9 +1708,14 @@ public class Plot {
}
this.getPlotModificationManager().setSign(player.getName());
player.sendMessage(TranslatableCaption.of("working.claimed"), Template.of("plot", this.getId().toString()));
if (teleport && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, auto ? TeleportCause.COMMAND_AUTO : TeleportCause.COMMAND_CLAIM, result -> {
});
if (teleport) {
if (!auto && Settings.Teleport.ON_CLAIM) {
teleportPlayer(player, TeleportCause.COMMAND_CLAIM, result -> {
});
} else if (auto && Settings.Teleport.ON_AUTO) {
teleportPlayer(player, TeleportCause.COMMAND_AUTO, result -> {
});
}
}
PlotArea plotworld = getArea();
if (plotworld.isSchematicOnClaim()) {