Solved getItemInHand

Discussion in 'Spigot Plugin Development' started by Nik3214, Mar 1, 2020.

Thread Status:
Not open for further replies.
  1. Hi, how can I correct this line for 1.15.2?
    The problem is getItemInHand
    Code (Text):
    stats.setTrackLvl((int)((stats.getTrackLvl() + xrayBlock.analyzeParkour()) * stats.getTimeMultiplicator(block.getType()) * stats.getPickaxeMultplicator(e.getPlayer().getItemInHand())));
     
  2. Use e.getPlayer().getInventory().getItemInMainHand();
    Your syntax is deprecated since a player has two hands.
     
    • Like Like x 1
  3. cool. whats wrong with it?

    imma guess it gives you a warning cuz youre not suppose to use that method anymore. maybe you should look up why.
    here, ill do it for you
    https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/HumanEntity.html#getItemInHand--
    incase youre not fully capable of understanding what you read here, let me point this out:
    Code (Text):
    Deprecated. Humans may now dual wield in their off hand, use explicit methods in PlayerInventory.
    so basically u gotta use the methods you find in playerinventory, specifically #getItemInMainHand
     
Thread Status:
Not open for further replies.