Archiviert
13
0
Commit graph

492 Commits

Autor SHA1 Nachricht Datum
Kristian S. Stangeland
45c28d47c8 Create a new dedicated Minecraft reflection class. 2012-12-05 23:47:55 +01:00
Kristian S. Stangeland
88009292bb Update to the new CraftBukkit snapshot. 2012-12-05 23:47:36 +01:00
Kristian S. Stangeland
25d41ed51c Ensure that fake cancellation packets can be created. 2012-12-05 03:32:13 +01:00
Kristian S. Stangeland
ede60970b9 Ensure that we don't cache wrong methods in the serialization. 2012-12-04 16:21:37 +01:00
Kristian S. Stangeland
86d3461700 Ensure that we don't return enhancer classes as vanilla classes. 2012-12-04 14:59:08 +01:00
Kristian S. Stangeland
733ecdd59b Increment to 1.7.2-SNAPSHOT for development towards the next version. 2012-12-04 14:49:59 +01:00
Kristian S. Stangeland
98edcb1772 Maven crap again. 2012-12-04 00:54:25 +01:00
Kristian S. Stangeland
7062b9327c Fix documentation. 2012-12-04 00:21:14 +01:00
Kristian S. Stangeland
b9abf0b683 Incrementing to 1.7.1 2012-12-04 00:19:55 +01:00
Kristian S. Stangeland
98a9377384 Add a convenience retriever for integer array fields. 2012-12-04 00:18:33 +01:00
Kristian S. Stangeland
300111b850 Make it easy to clone packets. 2012-12-03 17:51:18 +01:00
Kristian S. Stangeland
f4accbfe2d Make it possible to get every player that is tracking a given entity. 2012-12-02 02:49:11 +01:00
Kristian S. Stangeland
2bd06922e0 Ensure that the wrapped watchable object returns wrapped objects.
In addition, made it possible to construct watchable objects directly.
Also fixed a bug preventing data watchers from creating new watchable
objects.
2012-12-01 22:34:46 +01:00
Kristian S. Stangeland
f81e3262d0 Don't spam the console when a player logs out quickly. 2012-12-01 17:24:46 +01:00
Kristian S. Stangeland
beb4bba7fa Switching away from checked exceptions. 2012-11-27 08:00:52 +01:00
Kristian S. Stangeland
03ad9be078 Be careful when registering commands. It shouldn't break the plugin.
Found an error report in the wild suggesting that getCommand() might
occationally fail (if plugin.yml isn't loaded properly, maybe) and
return NULL instead.

Since the commands are only for administrators and plugin authors, 
we'll simply ignore it if this occurs.
2012-11-23 11:42:17 +01:00
Kristian S. Stangeland
d53b6dbee1 Removed the ReadWriteLock as it's superseeded by the BlockingHashMap. 2012-11-23 08:52:02 +01:00
Kristian S. Stangeland
c49b1ddc02 Incremented to 1.7.1-SNAPSHOT for development to the next version. 2012-11-23 08:48:32 +01:00
Kristian S. Stangeland
f5cb7ddc7b Adding a blocking hash map to use while looking up data connections. 2012-11-23 08:48:08 +01:00
Kristian S. Stangeland
a4f79ccb3f Maven crap. 2012-11-21 06:27:18 +01:00
Kristian S. Stangeland
78387a033b Bumping to version 1.7.0 2012-11-21 05:57:07 +01:00
Kristian S. Stangeland
21a1dfcbac Preserve intervals outside the given range to remove. 2012-11-21 05:53:26 +01:00
Kristian S. Stangeland
4b2f69c3c8 Fix removing intervals in the interval tree. 2012-11-21 05:50:23 +01:00
Kristian S. Stangeland
4b19f8498b Allow timeout listeners to cancel expiration. 2012-11-21 03:40:31 +01:00
Kristian S. Stangeland
95fe40aef3 Discurage sending of cancelled packets in ProtocolManager too. 2012-11-21 02:48:14 +01:00
Kristian S. Stangeland
8c4b4fcaa4 Advertise the incrementProcessingDelay() function.
Discurage plugins of re-sending cancelled packets, as it makes it 
impossible for other plugins to take part in the processing.

Assume plugin A delays transmission of packet X by cancelling the event,
and then retransmitting X outside the filters. It is then impossible
for another plugin B to extend the delay without fighting plugin A
for control over the packet, for instance by decreasing the listener
priority and cancelling first.

It is much better for plugin A to call incrementProcessingDelay() in
an asynchronous listener. Then plugin B can do the same, and the
packet will be sent after both plugins has called
signalProcessingDone().
2012-11-21 02:42:18 +01:00
Kristian S. Stangeland
524ef2e6c9 Fix the packet sending procedure. 2012-11-21 02:18:56 +01:00
Kristian S. Stangeland
858f9ee02d Renamed 'synchronizeMain' to 'notThreadSafe'. 2012-11-21 01:42:59 +01:00
Kristian S. Stangeland
0b200472f1 Process asynchronous packets on an async thread.
Bukkit complains if we try to send an async packet on the main thread,
so we will have to add a new background thread that can transmit
packets processed by light-weight packet listeners.

In addition, fixed a bug causing the "uncancel" method in 
PacketInjector from not working properly. That bug is as persistent
as a zombie.
2012-11-21 01:39:43 +01:00
Kristian S. Stangeland
9482818751 Fixed an incorrect null check. 2012-11-21 00:24:19 +01:00
Kristian S. Stangeland
36f867cafa Added synchronous packet processing.
Client packets are typically processed asynchronously (in a client's
reader thread), and should never access the Bukkit API directly,
with a few exceptions. This is problematic if you need to cancel a
packet as a response to the Bukkit API, such as the permission system.

Currently, you will have to either cancel the packet - which is 
discuraged - sync with the main thread and then re-transmit it outside
the filters, or use an asynchronous thread with callSyncMethod and 
wait on the returned future. A better method is needed.

Synchronous processing allows you to run light-weight packet listeners
on the main thread without having to deal with synchronization, 
concurrency or the overhead of an additional thread. It can also
process multiple packets per tick with a configurable timeout.

This, along with 7b9d971238, makes it
easy to delay light-weight packets to be synchronously processed.
2012-11-21 00:15:53 +01:00
Kristian S. Stangeland
dd9cb30d25 Structure compiler shouldn't be public. 2012-11-20 18:47:22 +01:00
Kristian S. Stangeland
53fe3e5b61 Fixed a range of smaller bugs discovered by FindBugs. 2012-11-20 07:10:46 +01:00
Kristian S. Stangeland
a849c38ce6 Implement equals() and hashCode(), since we've implemented compareTo. 2012-11-20 06:59:56 +01:00
Kristian S. Stangeland
d4d763af94 Add a warning message when trying to correct invalid configuration. 2012-11-20 06:53:39 +01:00
Kristian S. Stangeland
dc186df695 Small fix for OpenJDK (FindBugs). 2012-11-20 06:48:05 +01:00
Kristian S. Stangeland
95dbddf9bb Fixed a number of minor bugs. 2012-11-20 06:46:21 +01:00
Kristian S. Stangeland
023c3908ae Fixed error reporter not being assigned properly. 2012-11-20 06:33:54 +01:00
Kristian S. Stangeland
ac993896cc Fixed writing private fields with a compiled structure modifier.
Incredibly hard to track down. Lucked out by randomly removing a
semicolon.
2012-11-20 06:17:52 +01:00
Kristian S. Stangeland
456764468a Always generate classes with legal identifiers.
Certain types, such as ItemStack[], would cause the StructureCompiler
to generate classes with the name CompiledStructure@ParentItemStack[],
which are not legal names.

Instead, we'll replace the brackets with the word Array.

In addition, to accomodate classes with identical names, we'll use
the following naming convention instead:
CompiledStructure$[Canonical name of target]$Canonical name of type],
where the canonical name (net.minecraft.server.ItemStack[]) is 
transformed to a legal name by replacing "." to "_" and "[]" to array.

In our example, that would result in the following class name:
    net_minecraft_server_ItemStackArray
2012-11-20 03:50:44 +01:00
Kristian S. Stangeland
9170e48992 Correct the concurrent initialization pattern. 2012-11-20 03:32:44 +01:00
Kristian S. Stangeland
7b9d971238 Use a separate asynchronous sending queue for every online player.
This ensures that packets intended for player A doesn't have to wait
for the packets of player B to be finished processing.
2012-11-20 03:23:43 +01:00
Kristian S. Stangeland
f8af92eb5b Add the error reporter to the background compiler. 2012-11-20 00:26:16 +01:00
Kristian S. Stangeland
d5aa1cde51 Added the ability to enable or disable the background compiler. 2012-11-19 23:44:13 +01:00
Kristian S. Stangeland
cdc5740f85 Log the plugin version too. 2012-11-19 23:27:04 +01:00
Kristian S. Stangeland
c2209138fe Add the ability to clone a watchable object. 2012-11-19 20:43:13 +01:00
Kristian S. Stangeland
45f5d55b6a Fixed the update feature (hopefully for the last time).
The problem is that ProtocolLib is using a different naming convention 
where each release has a version suffix. So, while we can't use the
update folder to replace the JAR file, it's also not needed since
we can simply add it to the plugins directory directly and remove
the old version on shutdown.
2012-11-17 08:47:25 +01:00
Kristian S. Stangeland
4298ac609d Damn typos. 2012-11-16 04:10:59 +01:00
Kristian S. Stangeland
15ca240bac Fixed a bug that would clear the debug listeners on "add".
This was caused by a bug in the abstract interval tree class that would
clear the entire tree instead of the subtree whenever a new entry was
added.

Never roll your own custom collection implementation ...
2012-11-16 03:57:55 +01:00
Kristian S. Stangeland
a40df621d0 Spelling error. 2012-11-13 18:31:06 +01:00
Kristian S. Stangeland
b84161fde2 Fix documentation. 2012-11-13 17:50:36 +01:00
Kristian S. Stangeland
e28c2331e2 Incrementing to 1.6.1-SNAPSHOT for development to the next version. 2012-11-13 17:50:22 +01:00
Kristian S. Stangeland
c2d79c142f Generated changes. 2012-11-13 17:45:49 +01:00
Kristian S. Stangeland
189497fffa Bumping version to 1.6.0 2012-11-13 17:08:50 +01:00
Kristian S. Stangeland
235e6eeed2 Made it possible to convert between a chunk position and a coordinate. 2012-11-13 16:49:49 +01:00
Kristian S. Stangeland
80b99fccd9 Added some array methods too. 2012-11-13 16:43:52 +01:00
Kristian S. Stangeland
7f5288dea6 Add getIntegers(), getLongs(), ect. to PacketContainer. 2012-11-13 16:23:19 +01:00
Kristian S. Stangeland
528468a342 Fixed a bug preventing the entity modifier from reading entities. 2012-11-13 16:10:56 +01:00
Kristian S. Stangeland
fec2734fe2 Added a couple of useful methods to the wrappers. 2012-11-13 15:11:54 +01:00
Kristian S. Stangeland
ad69b0caac Added the ability to read data watchers and watchable object lists. 2012-11-13 14:34:07 +01:00
Kristian S. Stangeland
a567721114 Add the ability to read and write ChunkPositions. 2012-11-11 07:24:45 +01:00
Kristian S. Stangeland
5bb6f7649a Corrected a bug in a PacketAdapter constructor discovered by Folipurba. 2012-11-11 06:04:08 +01:00
Kristian S. Stangeland
0b292af3b1 Add the ability to write to final fields, even if it is compiled. 2012-11-11 02:09:45 +01:00
Kristian S. Stangeland
76d27017de Allow the structure modifier to read final fields. 2012-11-11 01:22:17 +01:00
Kristian S. Stangeland
addc62457a Handle multiple connection sides properly. 2012-11-11 01:06:11 +01:00
Kristian S. Stangeland
79786b8192 Use a default connection side in the packet command. 2012-11-11 00:57:16 +01:00
Kristian S. Stangeland
da7cd0b10d Reference the correct permissions. 2012-11-10 07:58:44 +01:00
Kristian S. Stangeland
003bc927a4 Set default update rate to 43200 seconds instead. 2012-11-06 18:07:06 +01:00
Kristian S. Stangeland
5e6a6f6a95 Fix the syntax of the packet debug message. 2012-11-05 00:05:16 +01:00
Kristian S. Stangeland
0108c3390e Add exception handlers to all the commands. 2012-11-04 16:14:07 +01:00
Kristian S. Stangeland
5b279660e0 Increment to 1.5.2-SNAPSHOT for development on the next version. 2012-11-04 16:13:47 +01:00
Kristian S. Stangeland
2a5d240df9 Update POM. 2012-11-04 03:39:38 +01:00
Kristian S. Stangeland
a5dbbc6170 Release of 1.5.1 2012-11-04 03:38:00 +01:00
Kristian S. Stangeland
abafb7a6c5 Fix configuration handling. 2012-11-04 03:03:38 +01:00
Kristian S. Stangeland
f5dce019df Save the last update check, even if it was initiated from a command. 2012-11-04 02:30:47 +01:00
Kristian S. Stangeland
64e3ba7f14 Add the ability to disable metrics in the config file. 2012-11-04 02:15:16 +01:00
Kristian S. Stangeland
2f2eb148fa Added a timeout listener. 2012-11-04 01:10:05 +01:00
Kristian S. Stangeland
6c8bda24fd Parse "detailed" as TRUE. 2012-11-04 00:06:44 +01:00
Kristian S. Stangeland
a9fe6afa01 Divide names output into pages instead. 2012-11-03 09:27:20 +01:00
Kristian S. Stangeland
626dea07fa Move range parser out of CommandPacket. Make a common command base. 2012-11-03 08:51:03 +01:00
Kristian S. Stangeland
188f03b39e Fixed the columns slightly. Still needs tweaking. 2012-11-03 07:32:14 +01:00
Kristian S. Stangeland
da0d55fcea Improve the names command. 2012-11-03 07:16:20 +01:00
Kristian S. Stangeland
f2e078ce6a Print strings with quotation marks. 2012-11-03 06:59:47 +01:00
Kristian S. Stangeland
72bfa3da9b Adding the names sub-command. 2012-11-03 06:54:31 +01:00
Kristian S. Stangeland
27104c7350 Accept zero as a packet ID in the packet command. 2012-11-03 06:51:37 +01:00
Kristian S. Stangeland
263d085590 Always create vanilla packets in the packet constructor. 2012-11-03 06:48:58 +01:00
Kristian S. Stangeland
f16581cdf4 Massive update. 2012-11-03 06:41:29 +01:00
Kristian S. Stangeland
413eb283a4 Fix handling of configuration. 2012-11-03 00:54:03 +01:00
Kristian S. Stangeland
7952da99c9 Added configuration and commands.
The two commands added are as follows:
 protocol:
  Reload the configuration, check for updates and download the 
  most recent version.
 packet:
  Add or remove a simple packet inspector. Can even display the 
  content of each packet.
2012-11-03 00:38:57 +01:00
Kristian S. Stangeland
3d0dce7e8d Make the update class easier to work with. 2012-11-02 18:55:23 +01:00
Kristian S. Stangeland
4328072f49 Created a default maven resources folder. 2012-11-02 17:47:33 +01:00
Kristian S. Stangeland
22aab024c2 Add a couple of permissions and commands. 2012-11-02 17:35:41 +01:00
Kristian S. Stangeland
18ec9bc973 Adding h31ix's auto update system. 2012-11-02 17:22:42 +01:00
Kristian S. Stangeland
2c00b570aa Increase default packet timeout to 30 minutes. 2012-11-02 16:58:56 +01:00
Kristian S. Stangeland
5ac15f11dc Drop expired packets in the processing chain. 2012-11-02 01:18:38 +01:00
Kristian S. Stangeland
cda235af7e Increment the default async timeout to 2 minutes. 2012-11-02 01:03:12 +01:00
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
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
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
Kristian S. Stangeland
af2d692c59 Wait and notify on the correct lock. 2012-10-04 06:13:19 +02:00
Kristian S. Stangeland
db8db1fba1 Make it possible to identify the current worker. 2012-10-04 05:14:17 +02:00
Kristian S. Stangeland
e729583d74 Make the manual asynchronous worker closable.
Added a good deal of synchronization to deal with closing a 
specific worker. This overhead can be avoided by simply closing 
any given worker.
2012-10-04 03:20:09 +02:00
Kristian S. Stangeland
8a5e5e849b Attempt to work around existing injected proxies.
This didn't work for Orebfuscator though.
2012-10-04 00:58:05 +02:00
Kristian S. Stangeland
558eab2253 Use an atomic integer instead of a volatile field.
Incrementing and decrementing is not thread-safe on volatile variables.
2012-10-03 23:13:05 +02:00
Kristian S. Stangeland
c6fb01e1e1 Adding the ability to use multiple worker threads. 2012-10-03 23:10:35 +02:00
Kristian S. Stangeland
eb8ac33a3e Removed uncompleted code. 2012-10-02 23:07:03 +02:00
Kristian S. Stangeland
3f1b5d49e9 Ignore offline players when sending overdue packets. 2012-10-02 23:05:31 +02:00
Kristian S. Stangeland
1e1875cbd8 Speed up the proxy object by using a NoOp filter. 2012-10-02 04:36:47 +02:00
Kristian S. Stangeland
48cedd20d4 Add some size methods. 2012-10-02 04:02:54 +02:00
Kristian S. Stangeland
e4e4581717 Bumping to 1.2.2 2012-10-02 03:55:07 +02:00
Kristian S. Stangeland
2fceaa803e Fixed the "moved too quickly" error that would cause players to
fall out into the void on 1.3.2.
2012-10-02 03:54:50 +02:00
Kristian S. Stangeland
0470b2335c Bumping to 1.2.1 2012-10-01 21:47:36 +02:00
Kristian S. Stangeland
fe55bb2e56 Processed packets is now sorted by the sending index. 2012-10-01 21:47:19 +02:00
Kristian S. Stangeland
7b35dd954c Switching to the network server object. 2012-10-01 20:30:56 +02:00
Kristian S. Stangeland
f4f28023fa Always create the NullPacketListener (unless otherwise stated).
This functions like a crude "counter" that automatically unregisters 
the packet injectors when every asynchronous listener has been removed.
2012-10-01 06:04:31 +02:00
Kristian S. Stangeland
961b34da38 Update documentation (may still need some work). 2012-10-01 04:59:27 +02:00
Kristian S. Stangeland
c2b4b5fce3 Ensure that the compiled structures respect the converter field.
In addition, fixed a bug that prevented client listeners from
receiving any packets.
2012-10-01 02:17:13 +02:00
Kristian S. Stangeland
46d9a6e975 Ensure that the structure compiler is thread safe. 2012-10-01 00:57:14 +02:00
Kristian S. Stangeland
e6de9ae705 Remove debug line. 2012-10-01 00:16:34 +02:00
Kristian S. Stangeland
3ad24921d9 Ensure that hook method #3 receieves Packet0KeepAlive. 2012-10-01 00:16:06 +02:00
Kristian S. Stangeland
9770257a74 Bumping to 1.2.0 2012-09-30 04:49:54 +02:00
Kristian S. Stangeland
f312ce278e Increase the maximum. 2012-09-30 04:44:57 +02:00
Kristian S. Stangeland
73005e032b Forgot to release a semaphore lock. 2012-09-30 04:42:58 +02:00
Kristian S. Stangeland
e666d17dc2 Don't try to find the isAsyncPacket method over and over again. 2012-09-30 04:25:56 +02:00
Kristian S. Stangeland
6063f437fd Another diffcult to track down bug. 2012-09-30 04:24:27 +02:00
Kristian S. Stangeland
1c41f83305 Fixed (probably) a problem reported by Milkywayz.
Relevant crash dump:
2012-09-30 03:39:26 +02:00
Kristian S. Stangeland
801bf81f15 Incredibly difficult bug to track down.
Forgot to remove the "override" flag on cancelled packets when
they're sent again.
2012-09-30 03:24:13 +02:00
Kristian S. Stangeland
0cff9d1243 Ensure that asynchronous listeners are run, even if they have no
accompanying synchronous listener.
2012-09-30 00:51:59 +02:00
Kristian S. Stangeland
c77103246e Small bug fixes. 2012-09-30 00:25:04 +02:00
Kristian S. Stangeland
711990fa15 Simplify the act of creating an asynchronous listener. 2012-09-30 00:13:36 +02:00
Kristian S. Stangeland
63197bbbd5 Add the other cases where we need to know if we're on the main thread
or not.
2012-09-29 23:52:28 +02:00
Kristian S. Stangeland
8a26d047b2 Client packets are processed on the server, so they must be
synchronized with the main thread.
2012-09-29 23:48:09 +02:00
Kristian S. Stangeland
d58ff1c4c1 Properly clean up after async listeners. 2012-09-29 23:21:09 +02:00
Kristian S. Stangeland
15b33925c0 Fixed a couple of minor bugs. 2012-09-29 22:25:09 +02:00
Kristian S. Stangeland
721d92bd4f Fixed a minor bug. 2012-09-29 22:20:21 +02:00
Kristian S. Stangeland
b3098bc6ad Pull up the important methods in the asynchronous packet handler. 2012-09-29 22:18:19 +02:00
Kristian S. Stangeland
e86c3d3a6e We have to keep the setAsyncMarker method. 2012-09-29 22:12:30 +02:00
Kristian S. Stangeland
65b5a0e8ec We don't expect consumers to create asynchronous markers, so
don't allow them to set it in the packet event.
2012-09-29 21:42:16 +02:00
Kristian S. Stangeland
a6db5419c0 Detect packet timeout. 2012-09-29 21:29:12 +02:00
Kristian S. Stangeland
4f4202185c Make it even clearer that the listener loop method should be
called from a separate thread.
2012-09-29 21:18:21 +02:00
Kristian S. Stangeland
025e97ca95 Renamed the ListenerToken in the code as well. 2012-09-29 20:34:29 +02:00
Kristian S. Stangeland
880520cd94 Renamed the ListenerToken into a AsyncListenerHandler. 2012-09-29 20:32:18 +02:00
Kristian S. Stangeland
fad6a0a99c Connect the asynchronous listeners to the system. 2012-09-29 20:30:22 +02:00
Kristian S. Stangeland
81321383d5 Renamed the async marker. Added handling of close. 2012-09-29 19:33:22 +02:00
Kristian S. Stangeland
285952b14d Use the normal packet listener instead of an async listener. 2012-09-29 19:13:12 +02:00
Kristian S. Stangeland
6f02e79802 Still a work in progress.
I'm considering removing the async listener and use the packet listener
for both sync and async processing.
2012-09-29 18:05:08 +02:00
Kristian S. Stangeland
23e676533a Beginning to add support for asynchronous packet listeners. 2012-09-29 01:00:12 +02:00
Kristian S. Stangeland
2012698275 Just in case, try to load the generated class first.
We might have generated it from a previous run.
2012-09-27 06:04:29 +02:00
Kristian S. Stangeland
42303ae0fc Use the FieldAccessException instead of InvalidArgumentException.
Otherwise, the CompiledStructureModifier has a leaky abstraction.
2012-09-27 05:42:34 +02:00
Kristian S. Stangeland
0004fb530d Update the package name in the compiler. 2012-09-27 05:28:52 +02:00
Kristian S. Stangeland
ea823e58f7 Move structure modifier compiler to the reflect package. 2012-09-27 05:28:13 +02:00
Kristian S. Stangeland
8293c71a4c Make sure the packet IDs are actually valid. 2012-09-27 05:26:02 +02:00
Kristian S. Stangeland
eb8abd4635 Try to clean up after a failed hook. 2012-09-27 05:22:08 +02:00
Kristian S. Stangeland
240df9dc7a Complicated feature - auto-compilation of structure modifier.
Using ASM we can automatically generate a faster structure modifier
that doesn't use reflection to read or write public fields.

Note that because the compilation itself is a bit slow (10 ms++), 
we have to create a background compilation thread. Future work:
 * Disable the thread if it's idle after 60 seconds.
 * Don't recreate the thread when the server reloads.
2012-09-27 03:24:34 +02:00
Kristian S. Stangeland
90970d1b9b Ensure that server operators are informed about incompatibility. 2012-09-26 06:00:26 +02:00
Kristian S. Stangeland
9efb85e7c3 Handle 1.3 correctly. 2012-09-26 04:06:10 +02:00
Kristian S. Stangeland
22f2f45d1e Added support for a hook method that can intercept map chunk packets. 2012-09-26 03:31:59 +02:00
Kristian S. Stangeland
e04a78fc04 Added yet another player hook method.
This method works by injecting into the NetServerHandler object
of a player. That way, we can also intercept map chunk packets.
2012-09-26 02:26:44 +02:00
Kristian S. Stangeland
9e402a3ab4 Added a "canInject" property in the injectors. 2012-09-26 02:01:44 +02:00
Kristian S. Stangeland
d8b300e3a6 Try to get the local player object if possible. 2012-09-25 23:10:08 +02:00
Kristian S. Stangeland
e0c03186c3 Add support for Java serialization of PacketEvent. It might be useful. 2012-09-25 23:09:02 +02:00
Kristian S. Stangeland
7f69c0204d Added a bit of commentary. 2012-09-25 17:13:23 +02:00
Kristian S. Stangeland
8839c03948 Fixed a number of simple bugs discovered by FindBugs. 2012-09-20 18:35:45 +02:00
Kristian S. Stangeland
3899704774 Merge pull request #1 from mbax/mbax
TagAPI is compatible as of version 1.7
2012-09-19 11:00:18 -07:00
mbax
9ad6dcb41c TagAPI is compatible as of version 1.7 2012-09-19 13:47:38 -04:00
Kristian S. Stangeland
54242debaa Made structure modifiers more overridable. 2012-09-19 19:25:11 +02:00
Kristian S. Stangeland
bc7b395889 Adding desperately needed async/sync documentation. 2012-09-19 03:48:46 +02:00
Kristian S. Stangeland
77376a2fa3 Make the Bukkit unwrapper use the actual return type. 2012-09-18 18:37:11 +02:00
Kristian S. Stangeland
cd9fa1cdf6 Fixing documentation. 2012-09-18 17:20:48 +02:00
Kristian S. Stangeland
ad6fbae5d6 Incrementing to version 1.1.0 2012-09-18 17:17:20 +02:00
Kristian S. Stangeland
8f9939f65c Added the ability to refresh the apperance of entities and players. 2012-09-18 16:30:46 +02:00