Blocks out of sync

Discussion in 'Plugin Development' started by ronix, Feb 20, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    ronix

    Floor restoration is making me crazy in SimpleSpleef. I have already posted a bug report to the staff (https://bukkit.atlassian.net/browse/BUKKIT-781), but maybe someone else can give me some insight here, too.


    In my plugin SimpleSpleef I am experiencing a peculiar issue: To restore a spleef arena, I use scheduleSyncRepeatingTask (sync!) from the scheduler. The heartbeat will check the game status to be finished and then run a restoreArena method. This same method may also be called by using an admin command /spla restorearena [name]. Consequently, both actions will call exactly the same piece of code (at least, if the restorer is set to arenahard, but this is more a config thing).

    Now my problem: When the call to the method "restoreArena" is called from the scheduler, some blocks will not recover. When called from the command, all blocks will recover without problem. I have tried quite a lot of things, used vanilla Bukkit, moved the restoreArena to a custom event call, etc. It's always the same problem: Calling from the command works great, calling from the scheduler or within a custom event leaves out blocks.

    After some more analyzing, I found out that the block information in the scheduler/event is out-of-sync with the real situation. I can query the blocks and see that the scheduler thinks that there are blocks where there is actually thin air. Thus it will not change the block data... I have also tried to delay restoration by a few seconds, but the scheduler still is not updated. I tried refreshing chunks, unloading and loading them again, force saving world data, etc. Nothing helped...

    I have looked at the source code of bukkit. The only real difference in bukkit is that commands will be called via b() in MinecraftServer. This happens quite late in method w() of the same class, while scheduler events are called via mainThreadHeartbeat some time before this. Is chunk information somehow updated in between?
     
Thread Status:
Not open for further replies.

Share This Page