Many people here have probably seen servers with my old "EventManager" code.
Unfortunately there are several issues with the event manager:
- Jagex has confirmed that all events run in a 600 millisecond cycle. The event manager does not enforce this and in fact events can be executed "out of phase" depending on how fast the server is. Therefore when using the event manager it is hard to keep the events timed perfectly.
- In most cases people did not ensure the code they executed within the events was thread-safe. This was necessary because the events were called from a different thread from the main game logic processing thread. Failing to use concurrent data structures or synchronization led to issues such as corrupting packets (causing client disconnection) or other strange things.
- The timing code could sometimes drift by several milliseconds due to use of the systemCurrentTimeMillis() method, which on some operating systems is only accurate to 10 milliseconds or so.
- The whole "EventContainer" concept was borked and an abstract class should have been used instead.
Therefore I have decided that the community really needs a better replacement which fixes all of these issues. So I decided to write this tutorial. I'm not going to explain why using the process() method is bad, if you want to find out then read the previous tutorial.