diff --git a/src/main/java/com/dreammaster/loginhandler/LoginHandler.java b/src/main/java/com/dreammaster/loginhandler/LoginHandler.java index e10684c08..ba12f8dd6 100644 --- a/src/main/java/com/dreammaster/loginhandler/LoginHandler.java +++ b/src/main/java/com/dreammaster/loginhandler/LoginHandler.java @@ -3,27 +3,50 @@ import static com.dreammaster.config.CoreModConfig.ModPackVersion; import static net.minecraft.util.EnumChatFormatting.*; -import java.util.Arrays; - +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.StatCollector; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; public class LoginHandler { - private static final String[] LOGIN_TEXT = { - GOLD.toString() + STRIKETHROUGH + "-----------------------------------------------------", - BOLD + "Welcome to Gregtech: New Horizons " + GREEN + ModPackVersion, - BLUE + "The Quest Book has a shortcut key, check your keybindings", BLUE + "to remove conflicts.", - DARK_GREEN + "GTNH WIKI link https://gtnh.miraheze.org/wiki/", GREEN + "Please report bugs here:", - GOLD + "https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/", - BLUE + "Visit our discord at https://discord.gg/gtnh", - GOLD.toString() + STRIKETHROUGH + "-----------------------------------------------------" }; - - @SuppressWarnings("unused") + // spotless:off @SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { - Arrays.stream(LOGIN_TEXT).map(ChatComponentText::new).forEach(event.player::addChatMessage); + final String WIKI_LINK = "https://gtnh.miraheze.org/wiki/"; + final String ISSUE_TRACKER_LINK = "https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues"; + final String DISCORD_LINK = "https://discord.gg/gtnh"; + final String WELCOME = StatCollector.translateToLocal("dreamcraft.welcome.welcome"); + final String QUESTBOOK = StatCollector.translateToLocal("dreamcraft.welcome.questbook"); + final String GTNH_WIKI = StatCollector.translateToLocal("dreamcraft.welcome.gtnh_wiki"); + final String CLICK_WIKI = StatCollector.translateToLocal("dreamcraft.welcome.click_wiki"); + final String REPORT_BUG = StatCollector.translateToLocal("dreamcraft.welcome.report_bug"); + final String CLICK_GITHUB = StatCollector.translateToLocal("dreamcraft.welcome.click_github"); + final String VISIT_DISCORD = StatCollector.translateToLocal("dreamcraft.welcome.visitdiscord"); + final String CLICK_DISCORD = StatCollector.translateToLocal("dreamcraft.welcome.click_discord"); + event.player.addChatMessage(new ChatComponentText(GOLD.toString() + STRIKETHROUGH + "-----------------------------------------------------")); + event.player.addChatMessage(new ChatComponentText(BOLD + WELCOME + " " + GREEN + ModPackVersion)); + event.player.addChatMessage(new ChatComponentText(BLUE + QUESTBOOK)); + event.player.addChatMessage(new ChatComponentText(DARK_GREEN + GTNH_WIKI + " ") + .appendSibling(new ChatComponentText(DARK_GREEN + WIKI_LINK) + .setChatStyle(new ChatStyle() + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(YELLOW + CLICK_WIKI))) + .setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, WIKI_LINK))))); + event.player.addChatMessage(new ChatComponentText(GREEN + REPORT_BUG)); + event.player.addChatMessage(new ChatComponentText(GOLD + ISSUE_TRACKER_LINK) + .setChatStyle(new ChatStyle() + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(YELLOW + CLICK_GITHUB))) + .setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, ISSUE_TRACKER_LINK)))); + event.player.addChatMessage(new ChatComponentText(BLUE + VISIT_DISCORD + " ") + .appendSibling(new ChatComponentText(BLUE + DISCORD_LINK) + .setChatStyle(new ChatStyle() + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(YELLOW + CLICK_DISCORD))) + .setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, DISCORD_LINK))))); + event.player.addChatMessage(new ChatComponentText(GOLD.toString() + STRIKETHROUGH + "-----------------------------------------------------")); } + // spotless:on } diff --git a/src/main/resources/assets/dreamcraft/lang/en_US.lang b/src/main/resources/assets/dreamcraft/lang/en_US.lang index 1ac98a914..5d4f6e3ec 100644 --- a/src/main/resources/assets/dreamcraft/lang/en_US.lang +++ b/src/main/resources/assets/dreamcraft/lang/en_US.lang @@ -1740,3 +1740,12 @@ item.tconstruct.manual.weaponry.bolts=\n\nBolts:\nCrafting bolts is a delicate p dreamcraft.mobsinfocompat.limitedropcount=Drops only %s times per person dreamcraft.gui.quitmessage=Are you sure you want to exit the game ? + +dreamcraft.welcome.welcome=Welcome to Gregtech: New Horizons +dreamcraft.welcome.questbook=The Quest Book has a shortcut key, check your keybindings. +dreamcraft.welcome.gtnh_wiki=GTNH WIKI link : +dreamcraft.welcome.click_wiki=Click to open the wiki! +dreamcraft.welcome.report_bug=Please report bugs on Github : +dreamcraft.welcome.click_github=Click to open the Github! +dreamcraft.welcome.visitdiscord=Visit our discord at +dreamcraft.welcome.click_discord=Click to open discord! \ No newline at end of file