Commit Graph

318 Commits

Author SHA1 Message Date
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
Kristian S. Stangeland
8e70a56768 CGlib must be in the compile scope, otherwise it's not included.
In addition, updated the README with information about Maven.
2012-10-12 00:24:15 +02:00
Kristian S. Stangeland
28fc096740 Bumping to version 1.3.2 2012-10-12 00:04:59 +02:00
Kristian S. Stangeland
129687772f Mark CraftBukkit and cglib as provided.
CraftBukkit, or just Bukkit, will already be a dependecy for any
plugin. CGlib will be provided by ProtocolLib, so that's not needed
either.
2012-10-12 00:04:05 +02:00
Kristian S. Stangeland
768d169f27 Added the same NULL check to the generic Bukkit unwrapper. 2012-10-12 00:01:05 +02:00
Kristian S. Stangeland
57add8e26f Handling the case where someone is writing a NULL element to
a equivalent converter.
2012-10-11 23:57:45 +02:00
Kristian S. Stangeland
8bd7f75a6d Updating POM to use Sonatype Nexus OSS. 2012-10-11 22:30:46 +02:00
Kristian S. Stangeland
3af9196740 Converted ItemDisguise to a maven project. 2012-10-11 09:09:42 +02:00
Kristian S. Stangeland
ff0cd06b2e [maven-release-plugin] prepare release ProtocolLib-1.3.1 2012-10-11 08:03:59 +02:00
Kristian S. Stangeland
97a22a0f6d Revert to SNAPSHOT due to buggy maven. 2012-10-11 08:03:45 +02:00
Kristian S. Stangeland
5a8847a719 Updated POM to use my personal maven repo. 2012-10-11 08:00:00 +02:00
Kristian S. Stangeland
707b4511ce Add repository information to POM. 2012-10-11 02:56:45 +02:00
Kristian S. Stangeland
b4d0c4a36d Prepare POM for possibly being on the public maven repository. 2012-10-11 02:17:45 +02:00
Kristian S. Stangeland
8d3c1de9b9 Adding GPL v2 license information to every file. 2012-10-10 22:18:11 +02:00
Kristian S. Stangeland
dc75f34e11 Add a warning message for lost packets. 2012-10-10 22:12:29 +02:00
Kristian S. Stangeland
5bda655f39 Switching to Maven instead of Ant. 2012-10-10 21:35:55 +02:00
Kristian S. Stangeland
4301dc6525 Add the ability to customize the worker threads. 2012-10-10 07:16:01 +02:00
Kristian S. Stangeland
17b7526fe9 Set the queued index before enqueuing, not after. 2012-10-10 06:00:42 +02:00
Kristian S. Stangeland
cf68d229b0 Honor the sending index when the packet has finished processing. 2012-10-10 05:42:45 +02:00
Kristian S. Stangeland
7ed0bc82dd Make it possible for threads to delay packet transmission.
Threads can now increment a shared counter indicating that a packet
should not be transmitted after the default packet listener 
processing. This can be useful if a packet listener needs information
from additional packets before it can complete.

Packet listeners that whish to use this method begin by calling
incrementPacketDelay(). It is then responsible for calling
signalPacketTransmission() when it's done waiting. All processing
on PacketEvents outside packet listeners must be synchronized
with getProcessingLock().
2012-10-10 04:41:07 +02:00
Kristian S. Stangeland
20792aa09a Reorder injection hooks.
We put the network manager hook to the bottom as it's the least
likely version to be compatible with other plugins.
2012-10-10 02:50:27 +02:00
Kristian S. Stangeland
eb328c41e8 Increase the player listener to MONITOR. 2012-10-10 02:48:24 +02:00
Kristian S. Stangeland
6053b9e64b Added the ability to determine if any client or server packet is valid.
Also, added a warning when a plugin attempts to listen for a packet
ID that doesn't exist in the current Minecraft version.
2012-10-10 02:41:34 +02:00
Kristian S. Stangeland
f8bd36bf3c Added the ability to enumerate IntEnums. 2012-10-09 22:37:33 +02:00
Kristian S. Stangeland
cecab6a169 Unwrap collections in the packet constructor. 2012-10-09 17:41:37 +02:00
Kristian S. Stangeland
2b90acf53e Ensure that non-CraftBukkit item stacks are correctly converted. 2012-10-09 16:48:55 +02:00
Kristian S. Stangeland
5e36547aa2 Give automatically created worker threads sensible names. 2012-10-09 00:07:40 +02:00
Kristian S. Stangeland
12eab67db7 Fixed JavaDoc. 2012-10-05 04:43:41 +02:00
Kristian S. Stangeland
88da4e3272 Bumping to version 1.3.0 2012-10-05 03:50:28 +02:00
Kristian S. Stangeland
0e76d8ea2b Make the proxy creation even more flexible.
Now we even support Orebfuscator without using Spout.
2012-10-05 03:12:35 +02:00
Kristian S. Stangeland
18ef06ea21 Adding "support" for Spout by proxying it's NetServerHandler.
While it may seem better to use a Spout PacketListener, we can't
prevent other spout listeners from stopping the listener
chain. For instance, Orebfuscator does supports Spout, but does this
by cancelling every chunk packet and sending them to be processed and
sent by Orebfuscator only. This can never be made compatible with
other plugins.

So, we choose to add some overhead and inject our proxy onto Spout. 
Fortunately, Spout injects the proxy using a player listener on LOWEST, 
so we get to override Spout again with our HIGHEST. The proxy method
should be generic enough to handle most proxy types.
2012-10-05 01:41:17 +02:00
Kristian S. Stangeland
af3e278e06 Moved all player related injection methods into a separate package.
This should make the code a little bit clearer.
2012-10-04 21:56:39 +02:00
Kristian S. Stangeland
eb12808483 Prevent method #3 from creating uneeded proxy objects.
This would happen if the NetServerHandler is already a proxy, and
the injection method is unable to create an instance of the proxy
type. 

It's best to fail instead of polluting (due to constructors with
side-effects) Minecraft with failed proxy objects.
2012-10-04 17:43:46 +02:00
Kristian S. Stangeland
f0651f7170 Don't blow up the fallback method just because a plugin isn't
compatible.
2012-10-04 09:01:33 +02:00
Kristian S. Stangeland
debf8c4d88 Create the worker ID before it is run.
In addition, we'll prevent reuse of worker objects.
2012-10-04 06:23:27 +02:00