From bf7b75b61948283b36b62cc3f011a6c4774ddbca Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Mon, 7 Dec 2020 21:23:38 +0100 Subject: [PATCH] Make titles duration configurable --- .../java/com/plotsquared/core/configuration/Settings.java | 3 +++ .../main/java/com/plotsquared/core/player/PlotPlayer.java | 8 ++++---- 2 files changed, 7 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 39acd7061..1baebf7a0 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -49,6 +49,9 @@ public class Settings extends Config { "For a single plot set `/plot flag set titles false` to disable it.", "For just you run `/plot toggle titles` to disable it.", "For all plots: Add `titles: false` in the worlds.yml flags block to disable it."}) public static boolean TITLES = true; + @Comment("Plot titles fading in (duration in ticks)") public static int TITLES_FADE_IN = 10; + @Comment("Plot titles being staying visible (duration in ticks)") public static int TITLES_STAY = 50; + @Comment("Plot titles fading out (duration in ticks)") public static int TITLES_FADE_OUT = 20; @Create // This value will be generated automatically public static ConfigBlock AUTO_CLEAR = null; diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index e0f438b02..88cb223cd 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -795,7 +795,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, */ public void sendTitle(@Nonnull final Caption title, @Nonnull final Caption subtitle, @Nonnull final Template... replacements) { - sendTitle(title, subtitle, 10, 50, 20, replacements); + sendTitle(title, subtitle, Settings.TITLES_FADE_IN, Settings.TITLES_STAY, Settings.TITLES_FADE_OUT, replacements); } /** @@ -814,9 +814,9 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, final Component titleComponent = MiniMessage.get().parse(title.getComponent(this), replacements); final Component subtitleComponent = MiniMessage.get().parse(subtitle.getComponent(this), replacements); - final Title.Times times = Title.Times.of(Duration.of(fadeIn * 50, ChronoUnit.MILLIS), - Duration.of(stay * 50, ChronoUnit.MILLIS), - Duration.of(fadeOut * 50, ChronoUnit.MILLIS)); + final Title.Times times = Title.Times.of(Duration.of(Settings.TITLES_FADE_IN * 50L, ChronoUnit.MILLIS), + Duration.of(Settings.TITLES_STAY * 50L, ChronoUnit.MILLIS), + Duration.of(Settings.TITLES_FADE_OUT * 50L, ChronoUnit.MILLIS)); getAudience().showTitle(Title .title(titleComponent, subtitleComponent, times)); }