Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void login(PlayerLoggedInEvent event)
- {
- EntityPlayer player = event.player;
- NBTTagCompound entityData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
- if (event.player.dimension == 0)
- {
- if (entityData.getBoolean(Infinity.MODID + "." + "RecievedItems") == false)
- {
- if (Tools.hasRelatedName(player))
- {
- player.addChatMessage(
- new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "Thinking of you, wherever you are."));
- player.addChatMessage(
- new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "Welcome to Kingdom Hearts Infinity!"));
- Random r = new Random();
- int i = r.nextInt(3);
- switch (i)
- {
- default:
- player.inventory.addItemStackToInventory(new ItemStack(Content.dream_sword));
- player.addChatMessage(
- new ChatComponentText(EnumChatFormatting.GOLD + "You got a Keychain and the Dream Sword!"));
- break;
- case 1:
- player.inventory.addItemStackToInventory(new ItemStack(Content.dream_rod));
- player.addChatMessage(
- new ChatComponentText(EnumChatFormatting.AQUA + "You got a Keychain and the Dream Rod!"));
- break;
- case 2:
- player.inventory.addItemStackToInventory(new ItemStack(Content.dream_shield));
- player.addChatMessage(
- new ChatComponentText(EnumChatFormatting.RED + "You got a Keychain and the Dream Shield!"));
- break;
- }
- player.inventory.addItemStackToInventory(new ItemStack(Content.keychain));
- entityData.setBoolean(Infinity.MODID + "." + "RecievedItems", true);
- }
- else
- {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.LIGHT_PURPLE + "[" + Infinity.NAME + "]"
- + EnumChatFormatting.RESET + "There's nothing special for you today."));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement