Posted August 7, 20214 yr Hi i am trying to give players a lore book the first time they log in so far i have this: @SubscribeEvent public void onPlayerJoin(EntityJoinWorldEvent e) { if (e.getEntity() instanceof PlayerEntity) { PlayerEntity pe = (PlayerEntity) e.getEntity(); if (!pe.getPersistentData().getBoolean("hasLoggedIn")) { pe.addItemStackToInventory(new ItemStack(RegistryHandler.BOOK.get())); pe.getPersistentData().putBoolean("hasLoggedIn", true); } } } this does give the item on log in and also only works once but it also gives the player the item when they respawn I don't want this how do I fix it.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.