Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tk.soggymustache.transportation.handler;
- import java.util.Random;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.util.text.TextComponentString;
- import net.minecraft.util.text.event.ClickEvent;
- import net.minecraft.util.text.event.HoverEvent;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
- public class LogHandlerTran
- {
- private final String PREFIX = "-> ";
- @SubscribeEvent
- public void onPlayerLogin(PlayerLoggedInEvent e)
- {
- System.out.println("Hi");
- EntityPlayer player = (EntityPlayer) e.player;
- if (ConfigurationHandler.canDisplay)
- {
- if (!player.worldObj.isRemote)
- {
- TextComponentString prefix = new TextComponentString("Thank you for downloading SoggyMustache's Transportation Mod");
- player.addChatMessage(prefix);
- TextComponentString url;
- Random rand = new Random();
- int sel = rand.nextInt(3);
- switch(sel)
- {
- case 1:
- player.addChatMessage(new TextComponentString(PREFIX + "Make sure you get all the new updates at soggymustache.tk"));
- url = new TextComponentString(PREFIX + "soggymustache.tk");
- url.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://soggymustache.tk"));
- url.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Open URL")));
- player.addChatMessage(url);
- break;
- case 2:
- player.addChatMessage(new TextComponentString(PREFIX + "Check out SoggyMustache's website for more mods"));
- url = new TextComponentString(PREFIX +"soggymustache.tk");
- url.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://soggymustache.tk"));
- url.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Open URL")));
- player.addChatMessage(url);
- break;
- }
- //ConfigurationHandler.hasDisplayedOnce = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment