Archiviert
13
0
Commit graph

758 Commits

Autor SHA1 Nachricht Datum
Kristian S. Stangeland
a63e03bf16 Version 1.6.4 is working fine. 2013-10-05 20:20:08 +02:00
Kristian S. Stangeland
b53908ef0f These fields will be updated and read from different threads.
Mark them as volatile just in case.
2013-09-30 19:27:22 +02:00
Kristian S. Stangeland
75f6cff5a5 Experimental: Correct a possible race condition with Spigot. 2013-09-28 17:22:06 +02:00
Kristian S. Stangeland
1b1f36c5d6 Attempt to handle snapshot versions by assuming Minecraft version.
The snapshot version contains a release date, so we'll simply compare
that against a known release date of a Minecraft version. It it's 
later, we know it is at least a minor version above, and vice versa.
2013-09-28 16:25:30 +02:00
Kristian S. Stangeland
2001c15132 Add the ability to track the amount of time spent by each plugin.
ProtocolLib can now keep track of the amount of time spent by each 
listener (for each packet), generated as a report file. This is 
done in the new "protocol timings" command.
2013-09-20 22:35:59 +02:00
Kristian S. Stangeland
4e2af45428 More descriptive error message when an entities tracker is not found. 2013-09-15 20:42:07 +02:00
Kristian S. Stangeland
bed74f6ab6 Cleanup proxy packet injector in Spigot too. FIXES 127 2013-09-13 09:35:53 +02:00
Kristian S. Stangeland
57ad8d8aaa Lets preserve the injection time, just in case. 2013-09-10 02:15:16 +02:00
Kristian S. Stangeland
dc8b23d48b Intercept packets sent during the handling of PlayerLoginEvent. 2013-09-10 01:48:38 +02:00
Kristian S. Stangeland
4392eb9ea0 Don't choke on exceptions during error filtering. Pointless. 2013-09-05 04:07:05 +02:00
Kristian S. Stangeland
9442e2c36f Report using the correct sender in the update methods. 2013-09-05 04:03:01 +02:00
Kristian S. Stangeland
db2efbe089 Relax expected Minecraft version format. Partially fixes ticket 124 2013-09-02 16:14:11 +02:00
Kristian S. Stangeland
d810d17abb Increment to 2.7.1-SNAPSHOT for development towards the next version. 2013-09-02 16:04:55 +02:00
Kristian S. Stangeland
37766d3ecf Added some missing features to 2.7.0.
Note that this supercedes the previous increment commit.
2013-09-02 02:42:18 +02:00
Kristian S. Stangeland
1b5463651f Increment to 2.7.0 2013-09-02 02:00:14 +02:00
Kristian S. Stangeland
fba2b7a6b3 Add the ability to broadcast a packet to every player or nearby players
This is just a convenience method.
2013-09-01 18:47:24 +02:00
Kristian S. Stangeland
8295b951d9 Don't throw an exception the first time we initialize IntHashMap. 2013-08-29 23:57:20 +02:00
Kristian S. Stangeland
fc01a61290 Call the correct get-method (not remove) in IntHashMap. Fixes #7
As it happens, there are two very similar methods in IntHashMap:
  Object get(int key);
  Object remove(int key);
  
I called the latter by mistake. Now, I distinguish between the two 
by performing a removal test.
2013-08-29 01:33:43 +02:00
Kristian S. Stangeland
3f8a48732e Don't assume the InputStream is an DataInputStream in Spigot's case. 2013-08-27 23:23:30 +02:00
Kristian S. Stangeland
be9bbc924e Experimental fix for issue #7 on Github.
Attempt to detect the correct "get" method in a IntHashMap.
2013-08-27 22:09:06 +02:00
Kristian S. Stangeland
3923e05178 Asynchronous client packets are handled twice. FIXES 118
This causes wierd artifacts such as double placing of half-slabs and so
on, as Minecraft will process the packets again (except chat packets). 
We correct this by uncancelling the asynchronous packet, and then 
cancelling it again.
2013-08-15 01:04:56 +02:00
Kristian S. Stangeland
ccc123b26f Added missing server packet WORLD_PARTICLES. 2013-08-09 23:15:33 +02:00
Kristian S. Stangeland
ba692d5b7d Display whether or not a packet has been cloned in the packet command. 2013-08-07 00:33:57 +02:00
Kristian S. Stangeland
b27922dd3d Correctly clone enum set. 2013-08-07 00:33:23 +02:00
Kristian S. Stangeland
18f5998f8a Correctly clone packet listeners. 2013-08-06 20:41:25 +02:00
Kristian S. Stangeland
65f1371cf4 Don't create a network marker unnecessarily. 2013-08-06 19:44:38 +02:00
Kristian S. Stangeland
50c2931484 ItemStacks that represents AIR cannot store NMS tags. Use exceptions. 2013-08-06 19:27:58 +02:00
Kristian S. Stangeland
6d152707cf Increment to 2.6.1-SNAPSHOT for development towards the next version. 2013-08-01 00:49:15 +02:00
Kristian S. Stangeland
8e136579b3 Increment to 2.6.0.
This is due to the inclusion of a new attribute API.
2013-07-31 23:21:44 +02:00
Kristian S. Stangeland
6fba5cb020 Don't reset the ReportType static fields. This is pointless.
This may prevent certain problems on MCPC+.
2013-07-31 05:21:16 +02:00
Kristian S. Stangeland
988026611c Added support for modifying attributes in UPDATE_ATTRIBUTES.
This contains a fully-fledged API for reading and modifying Attribute-
Snapshot and AttributeModifier. Keep in mind that these objects are 
immutable, so modification must be made through object builders.

The packets are also shared, so packet cloning might be necessary if 
attributes should differ per player.
2013-07-28 02:02:27 +02:00
Kristian S. Stangeland
7170bfcadc Only add the WorldType converter if it exists in that Minecraft version 2013-07-26 18:42:06 +02:00
Kristian S. Stangeland
5c2fc8684e Use the object wrappers when printing custom Minecraft objects. 2013-07-26 17:30:47 +02:00
Kristian S. Stangeland
34f5278605 Improve support for the toString() method in wrapped objects. 2013-07-26 05:04:59 +02:00
Kristian S. Stangeland
5584357fee Pass on the "filtered" parameter in sendServerPacket. FIXES Ticket-111
Looks like our good ol' friend copy-paste betrayed us yet again. I need 
more unit tests.
2013-07-26 03:55:36 +02:00
Kristian S. Stangeland
260f108749 Don't complain about plugins that does their own dependency management
Let me know if I should add your plugin to the exception list.
2013-07-25 12:51:41 +02:00
Kristian S. Stangeland
3b76fe3d99 Increment to 2.5.1-SNAPSHOT for development towards the next version. 2013-07-22 17:24:16 +02:00
Kristian S. Stangeland
d116be6fd4 Bumping to version 2.5.0. 2013-07-22 16:46:19 +02:00
Kristian S. Stangeland
51879afe07 Updating Eclipse settings. 2013-07-22 16:45:11 +02:00
Kristian S. Stangeland
d70f102655 Add a getEntityModifier() overload that makes it easier to use.
Most people use it to retrieve the entity referenced in a certain
packet, which will always be in the world of the receiving player. This
method makes the same assumption.
2013-07-21 03:23:29 +02:00
Kristian S. Stangeland
5f54b95998 Fix getEntityModifier() for MPCP 1.6.2. 2013-07-21 03:20:13 +02:00
Kristian S. Stangeland
6054d559e1 Add support for the new JSON chat message format. FIXES Ticket-109
In addition, the PacketConstructor can now handle non-wrapped objects,
along with Class types instead of instances in withPacket().
2013-07-19 23:43:39 +02:00
Kristian S. Stangeland
0b56df20d5 Add a getMinecraftVersion() method to the ProtocolManager.
This can be useful if you want to implement different read/write 
methods for each version of Minecraft.
2013-07-19 21:22:34 +02:00
Kristian S. Stangeland
458a92c34a Added missing open tile entity packet. 2013-07-19 20:03:00 +02:00
Kristian S. Stangeland
51c645928f Make it possible to specify optionIntercept() when using BOTH. 2013-07-19 19:47:22 +02:00
Kristian S. Stangeland
7b9a5e9db4 Make the clientSide/serverSide builder options additative. 2013-07-19 19:41:38 +02:00
Kristian S. Stangeland
2756b80ac0 Add a more beatiful builder pattern to PacketAdapter.
We can't use a traditional builder pattern though, as it's commonly 
used for constructing inner anonymous classes. But we can do the next 
best thing and create a builder for the parameters themselves.

Here's what the new syntax looks like:
  new PacketAdapter(params(this, 1, 2, 3).clientSide()) {
      @Override
      public void onPacketReceiving(PacketEvent event) {
          // Your code here
      }
  };
  
Where "this" referes to your plugin.
2013-07-19 03:46:51 +02:00
Kristian S. Stangeland
62094492a9 Make it possible to intercept and expand upon the unknown origin error.
We add another configuration option that enables stack traces of 
warnings.
2013-07-19 02:27:13 +02:00
Kristian S. Stangeland
92781be618 Add support for SportBukkit. FIXES Ticket-107 2013-07-18 22:36:01 +02:00
Kristian S. Stangeland
ce2079b0bc Bumping to 2.5.0-SNAPSHOT. 2013-07-17 23:03:16 +02:00
Kristian S. Stangeland
1e4a03b056 Minecraft 1.6.2 seems to work fine. 2013-07-17 23:02:45 +02:00
Kristian S. Stangeland
7f69c41bf6 Don't pass our CaptureInputStream to the "get player identity" function 2013-07-17 23:02:16 +02:00
Kristian S. Stangeland
a31dc6fdcb Handle NULL results from the deserialization methods. 2013-07-17 21:31:44 +02:00
Kristian S. Stangeland
9448e06ad8 Add the ability to store an NBT compound in a given ItemStack. 2013-07-17 20:59:09 +02:00
Kristian S. Stangeland
aa9d84c639 Added the ability to serialize and deserialize NbtCompounds. 2013-07-17 20:31:25 +02:00
Kristian S. Stangeland
b0cec61d66 Added more utility methods to the stream serializer class.
It now supports the default Minecraft string encodign (UTF-16).
2013-07-17 20:07:02 +02:00
Kristian S. Stangeland
9f0d3a5054 Added the ability to retrieve the input buffer as a stream. 2013-07-17 19:49:00 +02:00
Kristian S. Stangeland
fefad5d806 Cleanup the write-packet method interceptor. 2013-07-17 19:40:48 +02:00
Kristian S. Stangeland
35d5912275 Rename to SerializableCloner. 2013-07-17 15:49:35 +02:00
Kristian S. Stangeland
e7aa1ca98c Merge branch 'master' of https://github.com/aadnk/ProtocolLib.git 2013-07-17 07:28:36 +02:00
Kristian S. Stangeland
6554a34752 Ensure that the new read packet feature is supported in Spigot. 2013-07-17 07:27:03 +02:00
Kristian S. Stangeland
6527c0a7f5 Added the ability to intercept serialized input packets on CraftBukkit.
Spigot will be added later.
2013-07-17 06:46:34 +02:00
Kristian S. Stangeland
8f30199a22 Adding a packet handler adapter, for symmetri with PacketAdapter. 2013-07-17 05:52:20 +02:00
Kristian S. Stangeland
e25ab31316 Generate a new class for each packet type, as getID is final.
We can't override the getID method in Packet, as it is marked as final.
Instead, we'll just generate a seperate class for each packet ID that 
needs to be intercepted.

We can't inherit from the packet ID of any particular class, as it 
may get recognized and modified by the sendPacket() method. This could
be a problem if this recogition is necessary, but we'll come back to 
this later.
2013-07-17 05:48:34 +02:00
Kristian S. Stangeland
051a4eda87 Add the ability to intercept the write method of packets.
This is done by constructing a proxy around the class after every
event handler has been invoked, intercepting the write method. Each 
PacketOutputHandler registered by the packet event listeners is 
invoked in turn, modifying a byte array of the data that will be 
written to the network stream.

The byte array is initially filled with the serialized version of the 
packet in the packet event.
2013-07-17 03:52:27 +02:00
Kristian S. Stangeland
45f36f9ad6 Use reflection to clone certain packets (44 - update attributes).
These packets contain objects (AttributeSnapshot and 
AttributeModifiable) isn't supported by the current cloning system.
2013-07-11 21:51:51 +02:00
Kristian S. Stangeland
cd0f8a6fa5 Merge branch '1.6.2' 2013-07-11 00:12:45 +02:00
Kristian S. Stangeland
f2125623f6 Correct the fallback method for retrieving WatchableObjects. 2013-07-11 00:04:42 +02:00
Kristian S. Stangeland
1000378b78 Update packet container serialization for Minecraft 1.6.2. 2013-07-10 23:41:49 +02:00
Kristian S. Stangeland
c590e4a825 Update the stream serializer for Minecraft 1.6.2 2013-07-10 23:33:25 +02:00
Kristian S. Stangeland
a4eb219a9a Update unit tests to CraftBukkit 1.6.2 2013-07-10 22:45:20 +02:00
Kristian S. Stangeland
6fe7fe46f3 Use a builder pattern instead of a constructor with 8 parameters.
Also make use of the fact that Spigot may have initialized its 
server connection (in the latest version).
2013-07-07 14:03:07 +02:00
Kristian S. Stangeland
fb7f80b646 Fix typo before it's too late. 2013-07-07 11:26:10 +02:00
Kristian S. Stangeland
00ff832e07 Adding the two new packets for 1.6.1. 2013-07-06 16:32:42 +02:00
Kristian S. Stangeland
47a5382709 Properly handle reloads on Spigot.
The code is getting uglier and uglier ...
2013-07-06 08:06:29 +02:00
Kristian S. Stangeland
a4f81e5e9f Update asynchronous manager and handle static senders in reports. 2013-07-06 07:51:02 +02:00
Kristian S. Stangeland
6847283fb3 Added the Comphenix Maven repository. 2013-07-06 00:25:59 +02:00
Kristian S. Stangeland
5e35f46b96 Added support for Spigot with Netty disabled.
I've also added BukkitExecutors to ProtocolLib, which any plugin that
depend on ProtocolLib may now use.
2013-07-06 00:24:11 +02:00
Kristian S. Stangeland
81e158d74a Increment to 2.4.8-SNAPSHOT for development towards the next version. 2013-07-05 06:23:40 +02:00
Kristian S. Stangeland
1159b4541e Increment to 2.4.7 for Minecraft 1.6.1 support. 2013-07-05 06:14:57 +02:00
Kristian S. Stangeland
49eb39e45f Improve packet class lookup performance by mainaining a inverse map. 2013-07-04 01:12:39 +02:00
Kristian S. Stangeland
0ec2a705da Mark 1.6.1 as tested. Things seems to work now. 2013-07-02 17:42:51 +02:00
Kristian S. Stangeland
5e5243e3fb Update ProtocolLib for 1.6.1.
A lot of methods changed from accepting DataInputStream to DataInput, 
which messed with the part that dynamically finds the "readPacket" 
method. Changed to accepting any method whose signature contains a 
parameter derived from DataInput.
2013-07-02 17:41:43 +02:00
Kristian S. Stangeland
0b3fe5470a Added a plugin verifier test.
Attempting to solve a problem discovered by Silthus, but I need
more information.
2013-06-27 03:05:53 +02:00
Kristian S. Stangeland
ef4476a72e Print a warning message instead of crashing.
We shouldn't prevent a plugin from adding packet listeners just because
the plugin verifier failed.
2013-06-23 21:56:53 +02:00
Kristian S. Stangeland
8d0e8139de Add support for the Lilypad Bukkit Connector. FIXES Ticket-101 2013-06-23 21:38:35 +02:00
Kristian S. Stangeland
256581d4ed Incrementing to 2.4.6-SNAPSHOT 2013-06-23 21:35:00 +02:00
Kristian S. Stangeland
56b81281a8 Merge branch 'master' into gh-pages 2013-06-21 01:12:07 +02:00
Kristian S. Stangeland
f7aa146a94 Increment to 2.4.5 2013-06-21 00:46:16 +02:00
Kristian S. Stangeland
a797dba594 Fixed a memory leak on Spigot that would retain unloaded worlds. 2013-06-20 01:06:50 +02:00
Kristian S. Stangeland
2cce1bca0a Certain packets must be cloned. Document this. 2013-06-19 23:19:46 +02:00
Kristian S. Stangeland
8f2935e241 Minimize the number of unnecessary references. 2013-06-19 02:07:12 +02:00
Kristian S. Stangeland
e7954a0f79 Load JavaScript engine on demand. 2013-06-17 13:16:29 +02:00
Kristian S. Stangeland
169842f265 Ignore logged out players. 2013-06-14 03:52:31 +02:00
Kristian S. Stangeland
627c500de1 Added some debug information when a network manager lacks an address. 2013-06-01 01:32:24 +02:00
Kristian S. Stangeland
aa5e1beb7f Added the ability to suppress arbitrary warnings and errors. 2013-06-01 00:17:08 +02:00
Kristian S. Stangeland
77346f8438 Fixed incorrect detection of "custom" net handlers.
This should ensure that users on MCPC no longer recieves the 
REPORT_DETECTED_CUSTOM_SERVER_HANDLER warning just for using MCPC.
2013-05-31 22:57:00 +02:00
Kristian S. Stangeland
bbe766cf23 Bumping to 2.4.4-SNAPSHOT for development towards the next version 2013-05-31 22:51:36 +02:00
Kristian S. Stangeland
7e20abdd37 Merge branch 'master' into gh-pages
Conflicts:
	ItemDisguise/.settings/org.eclipse.core.resources.prefs
2013-05-14 01:24:47 +02:00
Kristian S. Stangeland
b613e8f01e Bumping to 2.4.3 2013-05-14 01:17:03 +02:00
Kristian S. Stangeland
02b5dec304 Permit cross edges when validating dependencies. FIXES 91. 2013-05-13 03:49:48 +02:00
Kristian S. Stangeland
6af440789c Invert the actual packet instance instead of a new instance.
In NetworkFieldInjector, we use a "inverted" packet class to undo the 
data received counter when a packet has been cancelled. 

Previously, we would generate a proxy class that inherits from the 
class of the packet (Packet3Chat, etc.) along with its size() method 
(which is called and added to the counter, cancelling the other packet),
but this doesn't work for packets that are dynamically sized such as
Packet255KickDisconnect. Instead, we now pass the actual instance to
 the proxy class through a weak hash map.
2013-05-07 23:11:41 +02:00
Kristian S. Stangeland
a2b04e055a Make it possible to cancel packets for asynchronous processing. 2013-05-06 18:57:19 +02:00
Kristian S. Stangeland
8d814d2d9c Implement "isOnline" for temporary players.
This corrects the issue seen on http://pastebin.com/C4D8jsja
2013-05-06 18:37:08 +02:00
Kristian S. Stangeland
0fc6396974 ProtocolLib seems to work fine for 1.5.2 too. 2013-05-05 23:55:02 +02:00
Kristian S. Stangeland
c813811721 No point verifying the load order for ProtocolLib.
Also removed a debug message.
2013-04-30 03:17:59 +02:00
Kristian S. Stangeland
8970cd915a Move the last update time stamp to a separate file. FIXES TICKET 86. 2013-04-29 16:39:37 +02:00
Kristian S. Stangeland
8964246e22 Makes more sense to put this in the reflect lookup. 2013-04-28 17:27:58 +02:00
Kristian
bec05967d3 Mark field as volatile. 2013-04-27 02:48:39 +02:00
Kristian
cecf80250c Don't print pointless warnings on Spigot. 2013-04-27 02:24:49 +02:00
Kristian
93da193428 Improve JavaDoc. 2013-04-27 01:03:20 +02:00
Kristian
40a3abf5b9 Refactor the report system. Allow identification of report messages.
All warnings and error messages will now be identified using fields in 
the sender classes, to avoid depending on the format of the error or 
warning messages directly. This decoupling will make it possible to 
filter out certain irrelevant messages.
2013-04-26 20:59:28 +02:00
Kristian S. Stangeland
7e18207a2b Load at startup to stay compatible with startup plugins.
Earlier versions of ProtocolLib would in fact load at startup, but due
to an experimental change (ffd920e5b2) -
where ProtocolLib injected code into DedicatedServerConnectionThread in
order to intercept pending connections - the load order had to be
set to world.

This injection was later removed, but the load order was never 
reinstated. This causes problems with plugins that load on startup, 
but also depend on ProtocolLib as load order trumpts dependency.

This change reintroduces startup load order.
2013-04-20 19:26:54 +02:00
Kristian S. Stangeland
b451a5a672 Adding a plugin verification system detecting common programmer errors
Initially we will detect plugins that attempt to register a listener in 
ProtocolLib without setting "depend" or "soft-depend".
2013-04-19 21:34:34 +02:00
Kristian S. Stangeland
5ca29ef5ce Leave ThreadDead alone!
The original intent of catching throwable is to "sandbox" arbitrary
plugin logic and prevent it from ever accidentally killing threads on
the server. A LinkageError due to a missing or old dependency shouldn't
bring down the server, so we secure it by catching all exceptions around
plugin event handlers.

Trouble is, this also catches exceptions such as OutOfMemoryError or
ThreadDead, which assuredly should NOT be caught. The latter case has
even occured in the wild as seen by ticket 45 of TagAPI on BukkitDev.
Minecraft may terminate the reader and writer thread by calling stop(),
and this could occur within the event handler in a plugin. So we should
let ThreadDead go and propagate it to the appropriate handler in
Minecraft.
2013-04-14 03:53:27 +02:00
Kristian S. Stangeland
37dd46432a Ignore these errors again. 2013-04-13 15:27:31 +02:00
Kristian S. Stangeland
cd78e311d5 Looks like Rhino is not guaranteed after all. Add some checks. 2013-04-13 14:20:35 +02:00
Kristian S. Stangeland
8a5ebb88e0 Added the ability to recover from engine incompatibilities. 2013-04-12 17:12:42 +02:00
Kristian S. Stangeland
2411d29822 Correctly reference v1_5_R2. 2013-04-12 05:09:05 +02:00
Kristian S. Stangeland
8e11a40662 Update unit test to 1.5.1 2013-04-11 22:51:44 +02:00
Kristian S. Stangeland
bda4474d62 Update packets to 1.5.1 2013-04-11 22:51:34 +02:00
Kristian S. Stangeland
95603d3fa2 Increment to 2.4.2-SNAPSHOT 2013-04-11 22:51:20 +02:00
Kristian S. Stangeland
e7be3be17f Increment to 2.4.1 2013-04-09 16:49:17 +02:00
Kristian S. Stangeland
72172805ba Exploit the internal JavaScript parser to determine if the exp is done.
The original code attempted to parse the JavaScript as it went along, 
counting open and close brackets. Unfortunately, this doesn't
take comments and string literals into consideration, so it would very
likely have failed with more complicated filters.

Instead, we'll let the JavaScript compiler handle all the complexity 
and simply see if the code compiles. If it doesn't, but the error 
occured in the last line, we assume it can be recovered by adding a 
new line.
2013-04-09 16:48:26 +02:00
Kristian S. Stangeland
da7a58fb43 Incrementing to 2.4.0.
This is due to the non-breaking API changes
in 505226f8ad
2013-04-09 15:11:43 +02:00
Kristian S. Stangeland
82bb7a7c43 Adding support for Spigot MCPC 1.2.5.
Very buggy indeed.
2013-04-08 21:53:54 +02:00
Kristian S. Stangeland
505226f8ad Added the ability to match derived classes and interfaces. 2013-04-08 17:57:56 +02:00
Kristian
867afe29f7 Minecraft 1.5.1 seems to work fine. 2013-04-07 15:57:38 +02:00
Kristian
3ee38d7b6d Arbitrary code execution is very dangerous. Limit to debug mode.
The filter command allows users with sufficient permission (or OPs) to
execute arbitrary JavaScript (no sandboxing). This is fine for a
debug and testing, but could potentially be exploited in a
production environment. 

Instead, we disable this command by default and force users to enable it
specifically in the configuration file (not through commands). If
someone has access to the config.yml file, they probably also have
access to the plugins/ folder and thus the ability to install plugins
with arbitrary code execution as well.
2013-04-07 15:57:01 +02:00
Kristian
15980d70fb Added a simple filter system that utilizes JavaScript (Rhino)
This makes it possible to filter packet events with arbitrary code.
2013-04-07 15:33:19 +02:00
Kristian S. Stangeland
5720994a31 Merge remote-tracking branch 'origin/master' 2013-04-02 14:30:14 +02:00
Kristian S. Stangeland
22beae23e0 Retrieve the correct Nbt base class 2013-04-02 14:28:34 +02:00
Kristian S. Stangeland
fb441b4910 Retrieve the correct Minecraft superclass 2013-04-02 14:12:36 +02:00
Kristian S. Stangeland
9a34036d14 Improve Minecraft class detection 2013-04-02 13:55:18 +02:00
Kristian Stangeland
27da638a91 Update the player instance on login (LOWEST), not HIGHEST.
Should ensure that packet listeners recieve the most up-to-date player
instance, regardless of whether or not the main thread is blocked in the
player listener. No more temporary players.
2013-03-28 22:27:58 -04:00
Kristian Stangeland
b3322b35c1 Prevent ConcurrentModifcationExceptions.
See http://pastebin.com/UBvGSFs9/
2013-03-28 21:58:06 -04:00
Kristian S. Stangeland
a43428c2c4 No need to create the dependency reduced POM 2013-03-23 15:45:57 +01:00
Kristian S. Stangeland
d643690eef Added a small patch for Libigot. 2013-03-21 02:10:30 +01:00
Kristian S. Stangeland
310fd18e89 Ignore players that have logged out and have not been injected. 2013-03-17 23:55:08 +01:00
Kristian S. Stangeland
da0bcaa482 Seems to pass all the preliminary tests. 2013-03-13 23:59:13 +01:00
Kristian S. Stangeland
ed9b61fd11 Use an atomic reference array instead of ConcurrentHashMap for listeners 2013-03-12 02:33:35 +01:00
Kristian S. Stangeland
e3cfa45607 Ensure that monitor listeners cannot modify a packet event. 2013-03-12 02:02:36 +01:00
Kristian S. Stangeland
1bd0db20ce Invoke MONITOR listeners, even if we are bypassing normal listeners. 2013-03-12 01:16:07 +01:00
Kristian S. Stangeland
3c97cffc09 After Minecraft 1.4.4, CraftBukkit no longer redirects MAP_CHUNK.
We can therefore relax the requirements in NetworkFieldInjector and
NetworkObjectInjetor.
2013-03-12 00:52:09 +01:00
Kristian S. Stangeland
a798147e71 Correctly override SpoutPlugin's sendPacket method. 2013-03-10 18:52:41 +01:00
Kristian S. Stangeland
ef334aff50 Merge branch 'master' into gh-pages 2013-03-05 16:59:29 +01:00
Kristian S. Stangeland
4406cdb571 Increment to version 2.3.0 2013-03-05 16:51:08 +01:00
Kristian S. Stangeland
9a16143c89 Small documentation fix. 2013-03-05 16:50:59 +01:00
Kristian S. Stangeland
9f6b4b60e3 Don't overwrite an existing player injector in net login. 2013-03-04 16:54:54 +01:00
Kristian S. Stangeland
b1b6e9ec20 In blocking hash map, don't remove locks if the value has been replaced 2013-03-04 13:29:46 +01:00
Kristian S. Stangeland
6019ab177c Create a dummy injector if we haven't yet injected the player. 2013-03-04 00:44:09 +01:00
Kristian S. Stangeland
d387b2d792 Improve client packet interception by about 37%. 2013-03-03 14:49:20 +01:00
Kristian S. Stangeland
2985dc9cf8 Be less picky over what packets to subclass. FIXES Ticket-49 2013-02-28 22:30:37 +01:00
Kristian S. Stangeland
8388a77f0b Catch ConnectExceptions - they are not serious. 2013-02-28 22:07:53 +01:00
Kristian S. Stangeland
2e0acd3a78 Increment version to 2.2.4-SNAPSHOT 2013-02-28 02:15:22 +01:00
Kristian S. Stangeland
d60ab3e953 Identify player connections by socket address.
It's the only thing that will not not be removed when a
network manager closes, making it relatively safe to block on.
2013-02-28 01:39:49 +01:00
Kristian S. Stangeland
fbfbd28bea We might revert this some other time, if we need to support other JVMs 2013-02-27 01:15:06 +01:00
Kristian S. Stangeland
c7737ca96e It's an injector container. 2013-02-27 01:10:21 +01:00
Kristian S. Stangeland
c32d225ef3 Use socket as key instead of input stream. 2013-02-27 01:09:22 +01:00
Kristian S. Stangeland
56807cbd3a Don't throw a NullPointerException if the injection fails. 2013-02-26 19:14:40 +01:00
Kristian S. Stangeland
3357fd6c9c Fix NPE in CleanupStaticMembers.
Determine if this is really necessary. No point cleanup up after
yourself in a sewer.
2013-02-26 13:37:33 +01:00
Kristian S. Stangeland
7968f1ce4f Incremented to 2.2.3-SNAPSHOT 2013-02-26 01:24:20 +01:00
Kristian S. Stangeland
575248063d Attempt to correct a NPE due to a NULL socket. 2013-02-26 01:23:54 +01:00
Kristian S. Stangeland
2cf265f8e8 Switch to a better InputStream -> Socket lookup for normal JVM. 2013-02-25 22:12:18 +01:00
Kristian S. Stangeland
9195e677ab Essentially, it's a lookup for a player's input stream.
Or: InputStream -> PlayerInjector -> Player.
2013-02-25 20:32:27 +01:00
Kristian S. Stangeland
8c2f6bddd8 Moved classes that inject into the server thread to a separate package 2013-02-25 20:28:57 +01:00
Kristian S. Stangeland
89d2604ce2 We cannot support plugin reloaders (PlugMan, PluginManagers).
This is because multiple plugins depend on us, and are not properly 
notified after ProtocolLib has been reloaded.

The only possible solution is to reload every dependent plugin after 
ProtocolLib has been reloaded, but unfortunately, I ran into
LinkageErrors when I tried it. So it's probably not possible with the
current architecture to support reloaders.

Instead, we'll simply print a BIG BOLD warning telling any users of
these plugins that ProtocolLib cannot be reloaded except through the
built in "/reload" command.
2013-02-25 14:38:53 +01:00
Kristian S. Stangeland
df4542017a Increment to 2.2.2-SNAPSHOT 2013-02-25 02:00:15 +01:00
Kristian S. Stangeland
ffd920e5b2 Experimental: InputStream -> Socket lookup by intercepting accept().
Previously, we have used a BlockingHashMap to simply lock the packet
read thread until we have had a chance to intercept the
NetLoginHandler/PendingConnection and store InputStream ->
PlayerInjector -> TemporaryPlayer. 

Problem is, this could potentially cause problems if, for some reason, a
packet is intercepted after the player has logged out and the player
injector has been removed from the lookup map. In that case, the read
thread would wait until it reaches the default timeout of 2 seconds.
Locking threads is fairly inefficient in general, and waiting for the
server connection thread to update the NetLoginHandler list could take a
while.

Instead, ProtocolLib will now intercept any Socket accepted in the
server's main ServerSocket, and record any calls to getInputStream().
That way, we can get a InputStream -> Socket mapping before the server
thread ever creates the read and write threads in NetLoginHandler ->
NetworkManager.

Unfortunately, it's not trivial to swap out the ServerSocket in the
DedicatedServerConnectionThread - we actually have to trigger the
accept() thread and move through a cycle of the loop before our custom 
ServerSocket is used. To do this, we will actually connect to the server
and read its MOTD manually, hopefully getting to it before any other
players. 

This creates a slight overhead of a couple of threads per server start,
but it's probably much better than locking the read thread. More testing
is needed though before this can be confirmed.
2013-02-25 01:59:48 +01:00
Kristian S. Stangeland
9b0fe540c2 Fixed a couple of bugs discovered by FindBugs. 2013-02-19 17:25:59 +01:00
Kristian S. Stangeland
bf443be0d3 Add the ability to read arbitrary objects.
Perhaps NbtBase shouldn't have implemented getValue() after all - it
would have been better to have a shared base interface with getName()
and getType(), and only let the primitive elements implement getValue().

Too late to change it now though.
2013-02-18 15:49:30 +01:00
Kristian S. Stangeland
61ae40b936 NbtCompound can now accepts arbitrary primitive, list or map objects. 2013-02-18 13:27:41 +01:00
Kristian S. Stangeland
e919056f9b Provide a remove method in NbtCompound. Discourage getValue().
Added a missing remove method in NbtCompound. In addition, the
getValue() method in NbtCompount has been depreciated. It is far better
to use the put and get methods in NbtCompound instead.
2013-02-17 02:32:14 +01:00
Kristian S. Stangeland
8c0a671078 Correctly print the content of map objects in packets. 2013-02-16 12:33:14 +01:00
Kristian S. Stangeland
3ae10d9123 Retry again if the hack isn't ready. 2013-02-14 20:14:34 +01:00
Kristian S. Stangeland
b8b39b4785 Set a maximum perm gen space usage for our background compiler. 2013-02-10 15:23:12 +01:00
Kristian S. Stangeland
0a3c1b13ed Add the ability to load from the default package as well. 2013-02-09 23:22:33 +01:00
Kristian S. Stangeland
02d0a9afd5 Add some debug information to a OutOfMemory exception. 2013-02-09 16:50:42 +01:00
Kristian S. Stangeland
dd3cd6c768 Fix an NPE reported in ticket-38. 2013-02-09 13:19:36 +01:00
Kristian S. Stangeland
bc1955bff3 Don't attempt to clean up static members during an update. 2013-02-07 20:07:33 +01:00
Kristian S. Stangeland
32282bbe9f Fixed a bug overwriting the NetLoginHandler class with NetServerHandler 2013-02-07 00:23:22 +01:00
Kristian S. Stangeland
351dc7f3df Ensure that ProtocolLib discoveres mod-specific packets. 2013-02-06 22:40:17 +01:00
Kristian S. Stangeland
224b5d7f3e Increment to 2.2.1-SNAPSHOT for development towards the next version 2013-02-06 22:09:37 +01:00
Kristian S. Stangeland
52adb8b9fd Merge branch 'master' into gh-pages 2013-02-05 23:32:34 +01:00
Kristian S. Stangeland
75eac1c9aa Improve documentation. 2013-02-05 23:28:27 +01:00
Kristian S. Stangeland
28b213a419 Ensure that the dummy objects are all package private. 2013-02-05 23:28:11 +01:00
Kristian S. Stangeland
fc44ff9fba Merge branch 'master' into gh-pages 2013-02-05 22:16:42 +01:00
Kristian S. Stangeland
cf52d6ddb4 Bumping to version 2.2.0.
- Adding support for Spigot
- Adding support for MCPC
- Range of bug fixes
2013-02-05 22:10:34 +01:00
Kristian S. Stangeland
f3ad0d86fe Increment to pre-release version 2.1.2-SNAPSHOT 2013-02-05 17:53:27 +01:00
Kristian S. Stangeland
bdcd7f1f54 Ensure that ProtocolLib works with VanishNoPacket and Spigot 2013-02-05 16:06:49 +01:00
Kristian S. Stangeland
901ab1fdda Add support for the Netty Spigot build.
This required extensive reworking of the inner packet injection system
in ProtocolLib. 

I've also fixed a minior bug in the fuzzy member contract class.
2013-02-05 07:00:49 +01:00
Kristian S. Stangeland
e8112dba0e Made IntegerSet accessible. Encapsulating the injection handler. 2013-02-05 01:37:41 +01:00
Kristian S. Stangeland
4685a06d27 Made the constructors for the different injectors more generic.
We now use builders. This should make it simpler to introduce Netty
Spigot support.
2013-02-04 22:42:07 +01:00
Kristian S. Stangeland
7abfd2148e Make it possible to specify a custom incoming packet interceptor. 2013-02-03 20:27:47 +01:00
Kristian S. Stangeland
6cf3307a3b Moved packet-related classes to a seperate package.
This is backwards compatible because they were all package private.
2013-02-03 19:24:39 +01:00
Kristian S. Stangeland
3219deed79 Use isMinecraftClass to check for NMS classes. 2013-02-03 19:07:12 +01:00
Kristian S. Stangeland
eaf7ea9618 Add an equality and hashCode() method to all the matchers. 2013-02-03 04:47:02 +01:00
Kristian S. Stangeland
75f05732bb Improve the toString()-functionality of each fuzzy contract. 2013-02-03 04:08:30 +01:00
Kristian S. Stangeland
58969b26f6 Add getters and setters for each of the fuzzy contracts. 2013-02-03 03:13:10 +01:00
Kristian S. Stangeland
d583f7ccc3 Moving fuzzy reflection "framework" to a seperate package. 2013-02-03 02:07:23 +01:00