Food regen bug when using World.setDifficulty() in onEnable()

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major
    • Spigot 1.8.3
    • Affects Version/s: None
    • Environment:

      Craftbukkit 1.8 (version git-Bukkit-33d5de3) on Windows 7
      Minecraft 1.8.1 with Optifine on Windows 7

      Hi there,

      I found a bug on visual food regen if we use World.setDifficulty() in a plugin onEnable(): the food visually keeps onEnable() difficulty even if we change it after (like using /difficulty or later World.setDifficulty).
      It's really visible if we set difficulty to Peaceful at launch: food always regen visually, restoring "real" level when decreasing, then increase again.

      What's the problem in a nutshell?

      I have made a test plugin like this, and it makes this:
      <iframe width="560" height="315" src="https://www.youtube.com/embed/YyZgqpDTKow" frameborder="0" allowfullscreen></iframe>

      How to reproduice?

      1. Create a plugin that set default World difficulty to peaceful
      2. Run craftbukkit/spigot 1.8 with that plugin
      3. Change difficulty to normal in game
      4. Decrease your food level (/effect <nick> minecraft:hunger 5 20 do the job)
      5. Your food level will increase, like if you were in peaceful
      6. Move to make a food update, the real level will be set

            Assignee:
            Thinkofname
            Reporter:
            Cyril Glapa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: