From c1163cdb2e33e488aa322987e3c1801441882969 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 7 Nov 2021 21:29:49 +0000 Subject: [PATCH] feat: Split configuration for teleport on claim/auto (#3308) - Fixes #2953 --- .../com/plotsquared/core/configuration/Settings.java | 4 +++- .../src/main/java/com/plotsquared/core/plot/Plot.java | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 5185f23fe..ebbbb3a14 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -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; diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 9982681be..19f220955 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -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()) {