Skip to content

Commit

Permalink
feat: make warmup cancellation conditions configurable, close #564
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Mar 31, 2024
1 parent f443780 commit a95c3e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ public static class GeneralSettings {
@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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private boolean tickAndGetIfDone() {
}

// 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")
Expand All @@ -152,7 +152,7 @@ private boolean tickAndGetIfDone() {
}

// 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")
Expand Down

0 comments on commit a95c3e0

Please sign in to comment.