From 52a30c98ca2c19a8aae0b9c460eb5700d8cff4bd Mon Sep 17 00:00:00 2001 From: William Date: Sat, 20 Aug 2022 18:04:08 +0100 Subject: [PATCH] Remove FAILED_UNSAFE for now --- .../huskhomes/teleport/TeleportManager.java | 17 ++++++++++++----- .../huskhomes/teleport/TeleportResult.java | 9 --------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java index 86c8554c..cb09fcf0 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java @@ -275,9 +275,6 @@ public class TeleportManager { .ifPresent(onlineUser::sendMessage); case FAILED_INVALID_WORLD -> plugin.getLocales().getLocale("error_invalid_on_arrival") .ifPresent(onlineUser::sendMessage); - case FAILED_UNSAFE -> { - //todo - } case FAILED_ILLEGAL_COORDINATES -> plugin.getLocales().getLocale("error_illegal_target_coordinates") .ifPresent(onlineUser::sendMessage); case FAILED_INVALID_SERVER -> plugin.getLocales().getLocale("error_invalid_server") @@ -350,10 +347,20 @@ public class TeleportManager { // Display countdown action bar message if (teleport.timeLeft > 0) { plugin.getLocales().getLocale("teleporting_action_bar_countdown", Integer.toString(teleport.timeLeft)) - .ifPresent(message -> teleport.getPlayer().sendActionBar(message)); + .ifPresent(message -> { + switch (plugin.getSettings().teleportWarmupDisplay) { + case ACTION_BAR -> teleport.getPlayer().sendActionBar(message); + case MESSAGE -> teleport.getPlayer().sendMessage(message); + } + }); } else { plugin.getLocales().getLocale("teleporting_complete") - .ifPresent(message -> teleport.getPlayer().sendActionBar(message)); + .ifPresent(message -> { + switch (plugin.getSettings().teleportWarmupDisplay) { + case ACTION_BAR -> teleport.getPlayer().sendActionBar(message); + case MESSAGE -> teleport.getPlayer().sendMessage(message); + } + }); } // Tick (decrement) the timed teleport timer diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java index 35d6ec28..96bb47e7 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java @@ -32,24 +32,15 @@ public enum TeleportResult { /** * Returns if the {@link Teleport} failed because the server of the target * {@link Position} was invalid or not online - *

*/ FAILED_INVALID_SERVER(false), /** * Returns if the {@link Teleport} failed because the coordinates of the * target {@link Position} were outside the world border limits - *

*/ FAILED_ILLEGAL_COORDINATES(false), - /** - * Returns if the {@link Teleport} failed because the coordinates of the - * target {@link Position} were in an unsafe spot - *

- */ - FAILED_UNSAFE(false), - /** * Returns if the teleport was cancelled, for example if a {@link TimedTeleport} in progress is cancelled */