mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +01:00
Make titles duration configurable
This commit is contained in:
parent
469d6ab907
commit
bf7b75b619
@ -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> AUTO_CLEAR = null;
|
||||
|
@ -795,7 +795,7 @@ public abstract class PlotPlayer<P> 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<P> 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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user