diff --git a/build.gradle.kts b/build.gradle.kts index 31aaa46..2427316 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -48,7 +48,7 @@ val topLevelDomain = "net" val projectNameString = rootProject.name group = topLevelDomain + groupStringSeparator + mainProjectAuthor.lowercase() + groupStringSeparator + snakecase(projectNameString) -version = "0.0.9" +version = "0.0.10" val buildDirectoryString = buildDir.toString() diff --git a/src/main/java/net/slqmy/title_plugin/TitlePlugin.java b/src/main/java/net/slqmy/title_plugin/TitlePlugin.java index cc58cde..4f061f4 100644 --- a/src/main/java/net/slqmy/title_plugin/TitlePlugin.java +++ b/src/main/java/net/slqmy/title_plugin/TitlePlugin.java @@ -35,6 +35,9 @@ public final class TitlePlugin extends JavaPlugin implements Listener { private List changingSubtitleComponents; private long secondsBeforeChanging; + private long firstSubtitleFadeInTime; + private long lastSubtitleFadeOutTime; + private long fadeInTime; private long stayTime; private long fadeOutTime; @@ -53,6 +56,9 @@ public void onEnable() { .map((string) -> Component.text(ChatColor.translateAlternateColorCodes('&', string))).toList(); secondsBeforeChanging = configuration.getLong("seconds-before-changing", 5L); + firstSubtitleFadeInTime = configuration.getLong("first-subtitle-fade-in-time", 0L); + lastSubtitleFadeOutTime = configuration.getLong("last-subtitle-fade-out-time", 0L); + fadeInTime = configuration.getLong("fade-in-time", 0L); stayTime = configuration.getLong("stay-time", 10L); fadeOutTime = configuration.getLong("fade-out-time", 0L); @@ -116,7 +122,7 @@ public void run() { player.sendTitlePart(TitlePart.TITLE, titleComponent); player.sendTitlePart(TitlePart.SUBTITLE, changingSubtitleComponents.get(subtitleIndex)); - player.sendTitlePart(TitlePart.TIMES, Title.Times.times(Duration.ofSeconds(fadeInTime), Duration.ofSeconds(stayTime), Duration.ofSeconds(fadeOutTime))); + player.sendTitlePart(TitlePart.TIMES, Title.Times.times(Duration.ofSeconds(subtitleIndex == 0 ? firstSubtitleFadeInTime : fadeInTime), Duration.ofSeconds(stayTime), Duration.ofSeconds(subtitleIndex == changingSubtitleComponents.size() - 1 ? lastSubtitleFadeOutTime : fadeOutTime))); subtitleIndex++; if (subtitleIndex == changingSubtitleComponents.size()) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dbafd47..b18ae0a 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,6 +1,12 @@ # This is the title that will be displayed once a player joins. title: "&aTitle" +# The amount of time that the very first subtitle will fade in for. +first-subtitle-fade-in-time: 1 + +# The amount of time that the very last subtitle will fade out for. +last-subtitle-fade-out-time: 1 + # The subtitles that will be displayed periodically as defined with 'seconds-before-changing'. subtitle: - "&aSubtitle 1"