Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-271

Player Enchanting Exp Issue

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • None

      Hey guys,

      I had made an XpFly plugin that has been facing a bug in BUKKIT for a while now. When a player enchants something on an enchanting table, the user gets their enchanted item and their levels deducted, however the value Player.getTotalExperience() reflects the total experience BEFORE the enchantment.

      As an example:

      A player "John" has 30 exp levels and wants to enchant his wooden axe. John does so by putting it in the enchantment table and spends 3 exp levels and 2 lapis lazuli doing so. On the level bar GUI, John's exp level is now 27. John then decides he wants to fly using XpFly. He types "/xpfly", and his exp level starts decreasing from 30 (and his levels on the GUI change back to 30 as well).

      I've checked my code over and over and included extra safeguards to ensure I'm not missing anything when updating the player's exp. Here is my method which does so:

      http://pastebin.com/pPfBLrdY

      The method takes a total exp count as an argument as well as a value (in exp, not levels) for the exp to be assigned to the player. An example call would be the following:

      http://pastebin.com/EqsHnLcn

      Thank you for your time, and am eagerly looking forward to your response!

            Thinkofdeath Thinkofname
            Ryan6578 Ryan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: