[SPIGOT-631] Food regen bug when using World.setDifficulty() in onEnable() Created: 01/Mar/15  Updated: 27/May/15  Resolved: 01/Mar/15

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: Spigot 1.8.3

Type: Bug Priority: Major
Reporter: Cyril Glapa Assignee: Thinkofname
Resolution: Fixed Votes: 0
Labels: 1.8, Craftbukkit, bug
Environment:

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



 Description   

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


 Comments   
Comment by Cyril Glapa [ 01/Mar/15 ]

Wow, that was quick! Thanks <3

Comment by Thinkofname [ 01/Mar/15 ]

Fixed in 1.8.3 Thanks

Generated at Thu Apr 03 13:32:37 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.