Commit Graph

1630 Commits

Author SHA1 Message Date
Kristian S. Stangeland
6b5ecd7309 Improve the functionality of wrapped DataWatcher and WatchableObject. 2012-12-08 14:22:07 +01:00
Kristian S. Stangeland
af546e7f1d Ignore depcreciation - we're using the method correctly. 2012-12-06 04:04:07 +01:00
Kristian S. Stangeland
6530db23b7 Last commit contains breaking API changes, so increment version. 2012-12-06 03:54:25 +01:00
Kristian S. Stangeland
0745fba881 Massive update that ensures ProtocolLib is compatible with 1.4.5-R3.0
Due to 8f12382e8efc8c39a919af9180dd884caf3720ff, CraftBukkit has
now moved the net.minecraft.server package and org.bukkit.craftbukkit
to versioned package names, breaking all plugins that rely on these
directly.

ProtocolLib was never intended to be updated specifcally for new
versions of Minecraft (hence the index-based system of accessing
packets instead of making wrapper classes), so we will use reflection
to "ignore" this hack entirely. Luckily, ProtocolLib was initially 
designed for this in mind, so we don't have to refactor it entirely.
2012-12-06 03:37:20 +01:00
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
e0455b76b8 Updated to 1.7.1 - removed test classes. 2012-12-04 01:02:05 +01:00
Kristian S. Stangeland
cc88232c8e Updated documentation for 1.7.1 2012-12-04 00:58:16 +01:00
Kristian S. Stangeland
0129a0575c Merge branch 'master' into gh-pages 2012-12-04 00:54:36 +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
a2b61ea880 Updated documentation for 1.7.0 2012-11-21 06:29:29 +01:00
Kristian S. Stangeland
1d1f96cda4 Merge branch 'master' into gh-pages 2012-11-21 06:27:32 +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