SoggyMustache

Untitled

Apr 13th, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. package tk.soggymustache.transportation.handler;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.entity.player.EntityPlayer;
  6. import net.minecraft.util.text.TextComponentString;
  7. import net.minecraft.util.text.event.ClickEvent;
  8. import net.minecraft.util.text.event.HoverEvent;
  9. import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
  10. import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
  11.  
  12. public class LogHandlerTran
  13. {
  14. private final String PREFIX = "-> ";
  15.  
  16. @SubscribeEvent
  17. public void onPlayerLogin(PlayerLoggedInEvent e)
  18. {
  19. System.out.println("Hi");
  20. EntityPlayer player = (EntityPlayer) e.player;
  21. if (ConfigurationHandler.canDisplay)
  22. {
  23. if (!player.worldObj.isRemote)
  24. {
  25. TextComponentString prefix = new TextComponentString("Thank you for downloading SoggyMustache's Transportation Mod");
  26. player.addChatMessage(prefix);
  27.  
  28. TextComponentString url;
  29. Random rand = new Random();
  30. int sel = rand.nextInt(3);
  31. switch(sel)
  32. {
  33. case 1:
  34. player.addChatMessage(new TextComponentString(PREFIX + "Make sure you get all the new updates at soggymustache.tk"));
  35. url = new TextComponentString(PREFIX + "soggymustache.tk");
  36. url.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://soggymustache.tk"));
  37. url.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Open URL")));
  38. player.addChatMessage(url);
  39. break;
  40. case 2:
  41. player.addChatMessage(new TextComponentString(PREFIX + "Check out SoggyMustache's website for more mods"));
  42. url = new TextComponentString(PREFIX +"soggymustache.tk");
  43. url.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "http://soggymustache.tk"));
  44. url.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString("Open URL")));
  45. player.addChatMessage(url);
  46. break;
  47. }
  48. //ConfigurationHandler.hasDisplayedOnce = true;
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment