Commit Graph

700 Commits

Author SHA1 Message Date
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
2a86a4cbc5 Updated documentation to 1.6.0 2012-11-13 17:54:42 +01:00
Kristian S. Stangeland
b6478924bb Merge branch 'master' into gh-pages 2012-11-13 17:50:54 +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
5c2e692a90 Merge branch 'master' into gh-pages 2012-11-13 17:46:06 +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