feat: make warmup cancellation conditions configurable, close #564

This commit is contained in:
William committed 2024-03-31 19:37:30 +01:00
1 parent f4437806b6
commit a95c3e03b7
2 files changed
+8 -2

No files matched your search

@@ -137,6 +137,12 @@ public final class Settings {
@Comment("How long a player has to stand still and not take damage for when teleporting (in seconds) ")
private int teleportWarmupTime = 5;
@Comment("Whether the teleport warmup timer should be cancelled if the player takes damage")
private boolean teleportWarmupCancelOnDamage = true;
@Comment("Whether the teleport warmup timer should be cancelled if the player moves")
private boolean teleportWarmupCancelOnMove = true;
@Comment("Where the teleport warmup timer should display (CHAT, ACTION_BAR, TITLE, SUBTITLE or NONE)")
private Locales.DisplaySlot teleportWarmupDisplay = Locales.DisplaySlot.ACTION_BAR;
@@ -141,7 +141,7 @@ public class TimedTeleport extends Teleport implements Runnable, Completable {
}
// Cancel the timed teleport if the player takes damage
if (hasTeleporterTakenDamage()) {
if (hasTeleporterTakenDamage() && plugin.getSettings().getGeneral().isTeleportWarmupCancelOnDamage()) {
plugin.getLocales().getLocale("teleporting_cancelled_damage")
.ifPresent(teleporter::sendMessage);
plugin.getLocales().getLocale("teleporting_action_bar_cancelled")
@@ -152,7 +152,7 @@ public class TimedTeleport extends Teleport implements Runnable, Completable {
}
// Cancel the timed teleport if the player moves
if (hasTeleporterMoved()) {
if (hasTeleporterMoved() && plugin.getSettings().getGeneral().isTeleportWarmupCancelOnMove()) {
plugin.getLocales().getLocale("teleporting_cancelled_movement")
.ifPresent(teleporter::sendMessage);
plugin.getLocales().getLocale("teleporting_action_bar_cancelled")