Commit Graph

502 Commits

Author SHA1 Message Date
Kristian S. Stangeland
51184dd209 Ensure getEntityModifier is thread safe. FIXES Ticket-6.
Don't use the world's getPlayers-method, as it's enumerating a
collection that's not thread safe. This is important as
getEntityModifier may be called by a client packet listener (which is
async).
2012-11-02 00:35:35 +01:00
Kristian S. Stangeland
aa9616d6b0 Don't check for closed sockets. If it talks like a duck, ect. 2012-10-31 00:52:02 +01:00
Kristian S. Stangeland
ae08abe821 Remove PrimitiveUtils - it's already present in Bukkit's Guava library. 2012-10-29 22:15:25 +01:00
Kristian S. Stangeland
d54cc35445 Updated to 1.5.1-SNAPSHOT for development of the next version. 2012-10-29 22:05:55 +01:00
Kristian S. Stangeland
0dc2bfef0c Handle exceptions in injected code.
This is very important, otherwise the server may crash unnecessarily.
2012-10-29 17:20:04 +01:00
Kristian S. Stangeland
f9c0f212c1 Put UnsupportedListener at the package level. 2012-10-29 16:57:07 +01:00
Kristian S. Stangeland
cbf4def71b Prevented map chunk listeners from crashing the server.
If the NetServerHandler injector fails and we revert to the network
field injector instead, any map chunk listener will crash the server
due to complications with Bukkit's ChunkCompressionThread. 

We avoid this by disabling map chunk listening entirely.
2012-10-29 16:54:53 +01:00
Kristian S. Stangeland
8636215b98 Add a couple of extra error handlers. 2012-10-29 04:21:12 +01:00
Kristian S. Stangeland
2239c1ea32 Add a better error reporter. 2012-10-29 04:17:53 +01:00
Kristian S. Stangeland
5e036185b8 Removed DEBUG message. 2012-10-29 02:39:05 +01:00
Kristian S. Stangeland
03da0e1974 Increment to 1.5.0 Release 2012-10-29 02:37:10 +01:00
Kristian S. Stangeland
dfba924561 Clean up every static field, preempting potential ClassLoader leaks.
Note that this method is using some fairly ugly hacks and must be 
maintained/updated manually whenever a new class is added or removed.
2012-10-29 02:25:29 +01:00
Kristian S. Stangeland
bdc41221db Fixed a serious misuse causing the creation of too many new classes.
The different injectors using CGLib was using a custom CallbackFilter
to optimize the resulting generated class. Unfortunately, the custom
filter didn't properly implement equals() and hashCode(), and so every
time a player logged, a new injector class had to be generated. 

This was fixed by making the injectors share a single CallbackFilter.

In addition, I've begun adding cleanup code that will reset all static
fields once the plugin has unloaded.
2012-10-29 01:42:22 +01:00
Kristian S. Stangeland
eaf0b73c00 Increment version to 1.4.4-SNAPSHOT (skipping release of 1.4.3) 2012-10-28 06:10:31 +01:00
Kristian S. Stangeland
cb2c7b4e0a Use a class cache when constructing the packet interceptor. 2012-10-28 06:09:29 +01:00
Kristian S. Stangeland
4e9b5009c8 Don't print messages to the console without a plugin prefix.
It's bad practice.
2012-10-23 00:54:41 +02:00
Kristian S. Stangeland
7536815e58 Set as SNAPSHOT in the plugin-file as well. 2012-10-23 00:41:53 +02:00
Kristian S. Stangeland
96ad954cf7 Prevent the PlayerQuitEvent from being fired twice. FIXES Ticket-2. 2012-10-23 00:37:35 +02:00
Kristian S. Stangeland
0aac8ebf0a Increment to 1.4.3 snapshot. 2012-10-21 22:40:26 +02:00
Kristian S. Stangeland
a60dc3d778 Make the client packet reader thread-safe. 2012-10-21 22:39:56 +02:00
Kristian S. Stangeland
01c481dc93 Release of 1.4.2 2012-10-21 20:42:29 +02:00
Kristian S. Stangeland
a51ad1f50f Properly remove previous hook, even if socket is NULL. FIXES Ticket-1. 2012-10-21 20:31:20 +02:00
Kristian S. Stangeland
c08106a923 Increment to 1.4.2 snapshot. 2012-10-21 16:33:52 +02:00
Kristian S. Stangeland
63c468eff0 Packet constructor can now handle primitive parameter types. 2012-10-21 16:33:41 +02:00
Kristian S. Stangeland
43c0b5d8f1 Don't save NULL injectors in a ConcurrentHashMap. 2012-10-21 12:11:59 +02:00
Kristian S. Stangeland
331fc94190 Sending or receiving packets now work without listeners. 2012-10-19 16:27:49 +02:00
Kristian S. Stangeland
caed0dcb11 Removed the spammy "Entity does not exist" error. 2012-10-19 00:54:03 +02:00
Kristian S. Stangeland
90f2caa5e8 Incremented to 1.4.1 2012-10-17 09:54:28 +02:00
Kristian S. Stangeland
69a5675161 Fixed a bug causing a StackOverflowException on packet construction. 2012-10-17 09:53:59 +02:00
Kristian S. Stangeland
d5028b584d Put the provided CGLib dependency in the com.comphenix namespace. 2012-10-17 06:57:05 +02:00
Kristian S. Stangeland
2b6a4570ab Added a couple of extra constructors. 2012-10-17 05:58:47 +02:00
Kristian S. Stangeland
4717cca2ec Increment to 1.4.0. 2012-10-17 05:32:46 +02:00
Kristian S. Stangeland
dd5303ea88 Use a boolean lookup table instead of a ConcurrentHashMap. 2012-10-17 04:13:25 +02:00
Kristian S. Stangeland
fee9a32e4b Store a current player injection hook for each game phase.
That way, one failing the other won't cause any problems.
2012-10-17 03:33:49 +02:00
Kristian S. Stangeland
3a8a4d15cf Fixed a couple of small bugs. 2012-10-17 01:19:06 +02:00
Kristian S. Stangeland
4cd5d04cae Wait 5 seconds before unhooking every player in the server. 2012-10-17 00:46:51 +02:00
Kristian S. Stangeland
476a918794 Dynamically add or remove injected hooks depending on the listeners.
This occurs whenever a listener is added or removed. A listener can
now specify whether or not it's listening for packets sent BEFORE
a player has logged in (every packet upto Packet1Login and a few more),
or AFTER. By default, listeners only receive notifcation of packets
sent and received after. 

ProtocolLib will now only hook NetLoginHandler if there's a login 
listener, and vice versa. Thus, the new login feature will only
tax the server if another plugin is using it. In addition, ProtocolLib
will not consume any resources when it's not serving any listeners.
2012-10-16 22:24:30 +02:00
Kristian S. Stangeland
ecdc9b4b6c Let's be generous and clean up the injection before the other plugins. 2012-10-16 17:01:34 +02:00
Kristian S. Stangeland
94efb38324 Retrieve the updated player entity as fast as we can. 2012-10-16 16:42:27 +02:00
Kristian S. Stangeland
09348343dd NetLoginInjector should not be public. 2012-10-16 08:01:04 +02:00
Kristian S. Stangeland
d88f507337 Removed debug listener. 2012-10-16 07:59:03 +02:00
Kristian S. Stangeland
b52670c4b3 Switching to overriding an ArrayList directly.
This makes the injection code compatible with earlier versions of
Minecraft (even 1.0.0).
2012-10-16 07:58:30 +02:00
Kristian S. Stangeland
93468b53b3 Massive update that adds support for intercepting packets during login.
This is achieved by injecting the NetLoginHandler when it's added
to the DedicatedServerConnectionThread's list of current login handlers.

PacketEvents during this phase uses "fake" Player objects that only
support a subset of methods. Consumers can expect the following methods
to be functional:
 * getPlayer()
 * getAddress()
 * getServer()
 * chat(String)
 * sendMessage(String)
 * sendMessage(String[])
 * kickPlayer(String)

A "fake" Player object can be converted to its real counterpart by
calling getPlayer().
2012-10-16 07:28:54 +02:00
Kristian S. Stangeland
9b4b161602 First test of the pre-login injector. 2012-10-15 00:31:55 +02:00
Kristian S. Stangeland
39805c5502 Incremented version to 1.3.3 2012-10-13 22:19:07 +02:00
Kristian S. Stangeland
98ae5c6e29 Added a monitor every packet listener. 2012-10-13 22:19:01 +02:00
Kristian S. Stangeland
a173824b3f Switching to the public repository group. 2012-10-13 18:07:02 +02:00
Kristian S. Stangeland
51c5a23c83 Switching to the "repo" virtual website instead. 2012-10-13 17:19:45 +02:00
Kristian S. Stangeland
61cd8a3ae4 Using a self-hosted repository for now. 2012-10-12 04:09:38 +02:00
Kristian S. Stangeland
fe3a69bd3d Switching from UTF-8 to cp1252. 2012-10-12 00:49:47 +02:00