Commit Graph

471 Commits

Author SHA1 Message Date
Kristian S. Stangeland
4505e31965 Prevented concurrency issues.
The SortedCopyOnWriteArray didn't wrap the iterator() in a
unmodifiable iterator. In addition, ConcurrentListenerMultimap
incorrectly used the iterator to remove objects from this Array. 

Added a "remove(T value)" method that is thread-safe.
2012-09-14 22:33:15 +02:00
Kristian S. Stangeland
88dcf0cb32 Improved API and performance.
API changes:
 * The PacketListener now uses a "ListeningWhitelist" class 
   to report which packet ids it wishes to listen in on for
   either the client or the server. This makes it possible to 
   use your plugin class as the listener more easily.
   
 * Added a priority system similar to Bukkit events.
   
Performance changes:
 * Create and maintain a separate list of listeners for each packet
   ID. This uses slightly more memory, but is far more efficient. 
   Especially in light of the priority system.

In addition, the listener lists are (hopefully) concurrent. They're
optimized for read-access, however. Adding or removing a listener
is a O(n) operation.
2012-09-14 19:12:08 +02:00
Kristian S. Stangeland
bb8bec907c Added a priorty to every listener. Improved performance. 2012-09-14 12:41:57 +02:00
Kristian S. Stangeland
45169905fe Fix documentation. 2012-09-13 21:15:30 +02:00
Kristian S. Stangeland
783281ca2c Made "metrics" invisible. No point polluting the namespace. 2012-09-13 21:08:31 +02:00
Kristian S. Stangeland
0d35ab6038 Adding the license information. Using GPL2 as of now.
While libraries are sometimes licensed under LGPL, or even less
restrictive licenses, in this particular case it doesn't really
make sense to encourage direct copying. The problem is that 
competing libraries would conflict with each other. It's better
to feed improvements back into a single project.

Though, it's of course possible to fork this project. You can change
the internal classes - for instance, improving or changing the hook
points - without worriying about the public API.
2012-09-13 21:04:46 +02:00
Kristian S. Stangeland
8bb397b90e Adding the ItemDisguise example program. 2012-09-13 20:47:21 +02:00
Kristian S. Stangeland
0653dc8c15 Made the "getPlugin" method mandatory for all listeners.
It's pretty useful for the data collector, as well as the utility
method "removePacketListeners".
2012-09-13 17:29:37 +02:00
Kristian S. Stangeland
ed5ce19795 Added a plugin users report to metrics. 2012-09-13 17:06:48 +02:00
Kristian S. Stangeland
83f313ce89 Switching to Metrics full. 2012-09-13 16:46:11 +02:00
Kristian S. Stangeland
c02ffb569d Adding metrics (lite). 2012-09-13 16:08:55 +02:00
Kristian S. Stangeland
1710ef343b Syncronize before hacking into the packet list. In addition,
copy over any unprocessed packets into the new list.

When we're done, we'll also clean up properly by copying over 
any remaining packets.
2012-09-13 16:08:41 +02:00
Kristian S. Stangeland
5a6f3be219 Fix the server packet cancelling feature. 2012-09-13 14:56:14 +02:00
Kristian S. Stangeland
16d231f778 Fixed test case. 2012-09-13 14:43:15 +02:00
Kristian S. Stangeland
0d531ecc4b Added a custom exception. Simplified the event API. 2012-09-13 14:42:37 +02:00
Kristian S. Stangeland
353302fe5f Changed the API slightly. Added WorldType to PacketContainer. 2012-09-13 14:25:01 +02:00
Kristian S. Stangeland
035277bdeb Added support for at least Beta 1.8.
This involved a bunch of reflection magic, along with the removal
of every Apache Commons reference, in addition to every internal
Guava class.
2012-09-13 13:57:22 +02:00
Kristian S. Stangeland
f372b247f9 Add support for 1.3.2 2012-09-13 11:34:47 +02:00
Kristian S. Stangeland
4307cb9104 Added the default instance class. 2012-09-13 11:01:32 +02:00
Kristian S. Stangeland
da694ca5ed Added support for default values in packets. 2012-09-13 11:01:08 +02:00
Kristian S. Stangeland
c65f6b006f Initial commit. 2012-09-12 19:04:53 +02:00