Player.openInventory() in onJoin event throws an error

Discussion in 'Plugin Development' started by GreenKitten1000, Nov 23, 2020.

  1. Offline

    GreenKitten1000

    Hello,

    I am needing help opening a player inventory in the on join event.

    Code (Text):
    Code:
    @EventHandler
    public void playerJoin(PlayerJoinEvent event) {
    System.out.print("Event was fired");
    Inventory inv = Bukkit.createInventory(null, 9, "Select class");
    event.getPlayer().openInventory(inv);
    }
    My Minecraft server gives error messages when I want to start it.
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    Newdel

    Try delaying it for 1 sec or so after join
     
  4. Offline

    Dai_Kunai

    What he said ^^^
    I believe the player isn't fully loaded in or something like that; not sure exactly but.
     

Share This Page