diff options
3 files changed, 54 insertions, 7 deletions
diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java index 04a159e..e6abf06 100644 --- a/src/main/java/net/elytrium/limboauth/LimboAuth.java +++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java @@ -367,7 +367,8 @@ public class LimboAuth { player.showTitle( Title.title( LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_PREMIUM_TITLE), - LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_PREMIUM_SUBTITLE) + LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_PREMIUM_SUBTITLE), + Settings.IMP.MAIN.PREMIUM_TITLE_SETTINGS.toTimes() ) ); } @@ -379,7 +380,8 @@ public class LimboAuth { player.showTitle( Title.title( LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_FLOODGATE_TITLE), - LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_FLOODGATE_SUBTITLE) + LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_FLOODGATE_SUBTITLE), + Settings.IMP.MAIN.PREMIUM_TITLE_SETTINGS.toTimes() ) ); } diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index 432dc97..5ce38ab 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -19,6 +19,8 @@ package net.elytrium.limboauth; import java.io.File; import net.elytrium.limboauth.config.Config; +import net.kyori.adventure.title.Title; +import net.kyori.adventure.util.Ticks; public class Settings extends Config { @@ -121,6 +123,36 @@ public class Settings extends Config { public int Z = 0; } + @Create + public Settings.MAIN.CRACKED_TITLE_SETTINGS CRACKED_TITLE_SETTINGS; + + public static class CRACKED_TITLE_SETTINGS { + + public int FADE_IN = 10; + public int STAY = 70; + public int FADE_OUT = 20; + public boolean CLEAR_AFTER_LOGIN = false; + + public Title.Times toTimes() { + return Title.Times.of(Ticks.duration(this.FADE_IN), Ticks.duration(this.STAY), Ticks.duration(this.FADE_OUT)); + } + + } + + @Create + public Settings.MAIN.PREMIUM_TITLE_SETTINGS PREMIUM_TITLE_SETTINGS; + + public static class PREMIUM_TITLE_SETTINGS { + + public int FADE_IN = 10; + public int STAY = 70; + public int FADE_OUT = 20; + + public Title.Times toTimes() { + return Title.Times.of(Ticks.duration(this.FADE_IN), Ticks.duration(this.STAY), Ticks.duration(this.FADE_OUT)); + } + } + /* @Create public Settings.MAIN.EVENTS_PRIORITIES EVENTS_PRIORITIES; diff --git a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java index 88f393d..c4c4587 100644 --- a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java +++ b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java @@ -123,7 +123,8 @@ public class AuthSessionHandler implements LimboSessionHandler { this.proxyPlayer.showTitle( Title.title( this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_SUCCESSFUL_TITLE), - this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_SUCCESSFUL_SUBTITLE) + this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_SUCCESSFUL_SUBTITLE), + Settings.IMP.MAIN.CRACKED_TITLE_SETTINGS.toTimes() ) ); } @@ -307,7 +308,8 @@ public class AuthSessionHandler implements LimboSessionHandler { this.proxyPlayer.showTitle( Title.title( this.deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_SUCCESSFUL_TITLE), - this.deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_SUCCESSFUL_SUBTITLE) + this.deserialize(Settings.IMP.MAIN.STRINGS.LOGIN_SUCCESSFUL_SUBTITLE), + Settings.IMP.MAIN.CRACKED_TITLE_SETTINGS.toTimes() ) ); } @@ -315,6 +317,10 @@ public class AuthSessionHandler implements LimboSessionHandler { } private void finishAuth() { + if (Settings.IMP.MAIN.CRACKED_TITLE_SETTINGS.CLEAR_AFTER_LOGIN) { + this.proxyPlayer.clearTitle(); + } + this.plugin.cacheAuthUser(this.proxyPlayer); this.player.disconnect(); } @@ -324,14 +330,20 @@ public class AuthSessionHandler implements LimboSessionHandler { this.proxyPlayer.sendMessage(this.deserialize(Settings.IMP.MAIN.STRINGS.TOTP)); if (sendTitle && !Settings.IMP.MAIN.STRINGS.TOTP_TITLE.isEmpty() && !Settings.IMP.MAIN.STRINGS.TOTP_SUBTITLE.isEmpty()) { this.proxyPlayer.showTitle( - Title.title(this.deserialize(Settings.IMP.MAIN.STRINGS.TOTP_TITLE), this.deserialize(Settings.IMP.MAIN.STRINGS.TOTP_SUBTITLE)) + Title.title( + this.deserialize(Settings.IMP.MAIN.STRINGS.TOTP_TITLE), + this.deserialize(Settings.IMP.MAIN.STRINGS.TOTP_SUBTITLE), + Settings.IMP.MAIN.CRACKED_TITLE_SETTINGS.toTimes()) ); } } else if (this.playerInfo == null) { this.proxyPlayer.sendMessage(this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER)); if (sendTitle && !Settings.IMP.MAIN.STRINGS.REGISTER_TITLE.isEmpty() && !Settings.IMP.MAIN.STRINGS.REGISTER_SUBTITLE.isEmpty()) { this.proxyPlayer.showTitle( - Title.title(this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_TITLE), this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_SUBTITLE)) + Title.title( + this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_TITLE), + this.deserialize(Settings.IMP.MAIN.STRINGS.REGISTER_SUBTITLE), + Settings.IMP.MAIN.CRACKED_TITLE_SETTINGS.toTimes()) ); } } else { @@ -340,7 +352,8 @@ public class AuthSessionHandler implements LimboSessionHandler { this.proxyPlayer.showTitle( Title.title( this.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN_TITLE, this.attempts)), - this.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN_SUBTITLE, this.attempts)) + this.deserialize(MessageFormat.format(Settings.IMP.MAIN.STRINGS.LOGIN_SUBTITLE, this.attempts)), + Settings.IMP.MAIN.PREMIUM_TITLE_SETTINGS.toTimes() ) ); } |