Advertisement
Guest User

Untitled

a guest
Jan 29th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.84 KB | None | 0 0
  1.     @SubscribeEvent
  2.     public void login(PlayerLoggedInEvent event)
  3.     {
  4.         EntityPlayer player = event.player;
  5.         NBTTagCompound entityData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
  6.  
  7.         if (event.player.dimension == 0)
  8.         {
  9.             if (entityData.getBoolean(Infinity.MODID + "." + "RecievedItems") == false)
  10.             {
  11.                 if (Tools.hasRelatedName(player))
  12.                 {
  13.                     player.addChatMessage(
  14.                             new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "Thinking of you, wherever you are."));
  15.                     player.addChatMessage(
  16.                             new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "Welcome to Kingdom Hearts Infinity!"));
  17.  
  18.                     Random r = new Random();
  19.                     int i = r.nextInt(3);
  20.  
  21.                     switch (i)
  22.                     {
  23.                         default:
  24.                             player.inventory.addItemStackToInventory(new ItemStack(Content.dream_sword));
  25.                             player.addChatMessage(
  26.                                     new ChatComponentText(EnumChatFormatting.GOLD + "You got a Keychain and the Dream Sword!"));
  27.                             break;
  28.                         case 1:
  29.                             player.inventory.addItemStackToInventory(new ItemStack(Content.dream_rod));
  30.                             player.addChatMessage(
  31.                                     new ChatComponentText(EnumChatFormatting.AQUA + "You got a Keychain and the Dream Rod!"));
  32.                             break;
  33.                         case 2:
  34.                             player.inventory.addItemStackToInventory(new ItemStack(Content.dream_shield));
  35.                             player.addChatMessage(
  36.                                     new ChatComponentText(EnumChatFormatting.RED + "You got a Keychain and the Dream Shield!"));
  37.                             break;
  38.                     }
  39.                     player.inventory.addItemStackToInventory(new ItemStack(Content.keychain));
  40.  
  41.                     entityData.setBoolean(Infinity.MODID + "." + "RecievedItems", true);
  42.                 }
  43.                 else
  44.                 {
  45.                     player.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "[" + Infinity.NAME + "]"
  46.                             + EnumChatFormatting.RESET + "There's nothing special for you today."));
  47.                 }
  48.             }
  49.         }
  50.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement