Kristian S. Stangeland
58e66b80da
Release of 3.3.1
2014-04-18 00:27:41 +02:00
Kristian S. Stangeland
17dda7f032
Better to fail updating the version number than crashing.
...
If we update the number, we have to also use the "empty file" trick
to remove the old file, which will crash ProtocolLib on the first
reload. It takes a second reload for it to function at all.
It's much better to take the hit on the version number, and avoid
this issue altogether. The update method simply wasn't designed for
plugins with version numbers in their file name.
2014-04-18 00:27:25 +02:00
Kristian S. Stangeland
19ea5dfc33
Never downgrade ProtocolLib after an update.
...
Also ensure the version number is incremented after an update.
2014-04-18 00:08:18 +02:00
Kristian S. Stangeland
3bd1361c9a
Add the ability to clonse java.util.Arrays$ArrayList.
2014-04-16 02:45:00 +02:00
Kristian S. Stangeland
486ac2653d
Remove pointless line.
2014-04-16 02:18:43 +02:00
Kristian S. Stangeland
c1890cb256
Interpret the empty string as 0-0-0-0-0 as well.
2014-04-14 17:49:04 +02:00
Kristian S. Stangeland
a65eac6471
Use the newer server ping version (5) in 1.7.8
2014-04-14 14:18:58 +02:00
johni0702
2476ab67a6
Fix NPE in getId()
2014-04-14 09:53:05 +02:00
Kristian S. Stangeland
74947c02af
Incrementing to 3.3.1-SNAPSHOT
2014-04-12 23:57:41 +02:00
Kristian S. Stangeland
e0b0e51342
Updating to 1.7.8
...
This was necessitated by two new NMS changes:
* NBTCompressedStreamTools.a(DataInput, int) now includes an additional
parameter NBTReadLimiter
* GameProfile changed the type of getId() from String to UUID, along
with the constructor (String, String) to (UUID, String).
2014-04-12 23:56:11 +02:00
Kristian S. Stangeland
c84a5d7fa2
Handle the possibility that getSuperclass() returns NULL.
...
Thanks to libraryaddict for discovering this bug.
2014-04-10 20:24:24 +02:00
Kristian S. Stangeland
8cb9e050a5
Don't attempt to register a client packet as a server packet.
...
And vice versa. This is a leftover from the time we used ConnectionSide
and packet IDs.
2014-04-08 02:00:13 +02:00
Kristian S. Stangeland
24de835440
Add the ability to load or save NBT compounds from files.
2014-04-01 23:20:24 +02:00
Kristian S. Stangeland
4f871c64d7
Warn instead of throwing an exception on packet type change.
...
We don't want to crash plugins over this, since it doesn't
automatically cause problems. But it may trip up plugins that
assume the packet types they set when registering a listener is the
only ones they'll ever recieve in the method body, which is not true
if a preceeding packet listener can change a packet to an arbitrary
type.
I'm open for better suggestions here. But for now, I'll just print a
warning and hope people use sendServerPacket() instead.
2014-03-30 00:50:45 +01:00
Kristian S. Stangeland
839c186609
Added a way to compute a "histogram" (ordered by time slices).
...
This allows us to see snapshots of the online statistics algorihm.
2014-03-29 23:29:25 +01:00
Kristian S. Stangeland
300d3c2475
Handle errors in Apache.
2014-03-28 20:50:10 +01:00
Kristian S. Stangeland
485c3856c1
Don't fetch NetworkMarker uncessarily.
2014-03-27 23:23:45 +01:00
Kristian S. Stangeland
3b26940385
Don't poll the current time more than once a second for updates.
2014-03-27 21:00:36 +01:00
Kristian S. Stangeland
3257d6069a
Compare packet type with equals(), just in case.
2014-03-22 23:21:57 +01:00
Kristian S. Stangeland
45e236b54a
Adds some sanity checks in PacketEvent.setPacket().
...
Thanks libraryaddict. :)
2014-03-22 23:20:16 +01:00
Kristian S. Stangeland
7adb6548aa
Ensure output handlers function correctly in 1.7.2
2014-03-21 22:19:24 +01:00
Kristian S. Stangeland
bd3a60b7eb
Don't intercept catastrophic errors such as ThreadDeath and OOM.
...
May fix ticket 206.
2014-03-20 23:26:07 +01:00
Kristian S. Stangeland
d76d4247b0
Ensure Player.getAddress() returns the client's address.
...
I mistakenly returned the server's address instead.
2014-03-16 03:51:44 +01:00
Kristian S. Stangeland
5e0000d139
Properly cancel or modify packets intercepted in the channel thread.
...
This fixes ticket #204 on BukkitDev.
2014-03-15 19:25:40 +01:00
Kristian S. Stangeland
ad060b10af
Fixed a bug introduced in #218 causing packet loops. FIXES 202.
...
In 659f01cc63
, I attempted to
execute packet listeners for receiveClientPacket() on the channel
thread, inadvertently causing them to be executed regardless if
filtered was FALSE, and twice if it is TRUE.
Since asynchronous packet listeners use this feature to take out
packets from the packet stream, they wound up causing an infinite
packet loop. This prevented them from ever being received by the
server.
2014-03-15 03:59:28 +01:00
Kristian S. Stangeland
75a5efcaa1
Add the ability to see registered asynchronous listeners.
2014-03-13 23:55:33 +01:00
Kristian S. Stangeland
f4f8817fd5
Undo mocking when we're done with the test.
2014-03-13 03:34:51 +01:00
Kristian S. Stangeland
38c62c4cfd
Ensure sendServerPacket() works in the channel thread as well.
...
If we're already in the channel event thread, we won't go through
the ChannelProxy code, so, check scheduledProcessing in the write
method as well.
2014-03-13 03:02:41 +01:00
Kristian S. Stangeland
4259a86740
Optimize lookup of getBukkitEntity.
2014-03-03 23:11:05 +01:00
Kristian S. Stangeland
b84aace585
Increment to 3.3.0-SNAPSHOT.
2014-02-23 22:49:46 +01:00
Kristian S. Stangeland
e8c77af92b
Get rid of the other weak maps, and use thread local fields instead.
...
This should improve performance, and prevent the possibility of not
informing plugins of sent packets.
2014-02-23 22:13:46 +01:00
Kristian S. Stangeland
659f01cc63
Remove concurrent "processed" and "ignore" hash maps.
...
We can rely on the fact that channel handlers are processed in a single
thread, and simply enable/disable a flag.
2014-02-23 18:55:41 +01:00
Kristian S. Stangeland
6e0a44f9df
Don't cache the NetHandler when checking if it has changed.
2014-02-21 19:28:07 +01:00
Kristian S. Stangeland
5f66dc6b4a
Update to 3.2.2-SNAPSHOT.
2014-02-21 19:15:31 +01:00
Kristian S. Stangeland
eb7760236f
Don't update the player instances on the LOGIN packet.
...
Instead, always check for the presence of NetServerHandler,
and update then.
2014-02-21 19:14:58 +01:00
Kristian S. Stangeland
eb421dd31e
Don't load converters that belong in 1.7.2.
2014-02-21 19:14:05 +01:00
Kristian S. Stangeland
7503470cb1
No need to throw an exception if the "last updated" file is corrupt.
2014-02-18 21:46:42 +01:00
Kristian S. Stangeland
6443de6257
Properly display blocks using the packet monitoring system.
2014-02-15 12:47:30 +01:00
Kristian S. Stangeland
a8378d4e6f
Regression: Add back support for CraftBukkit 1.1.0
2014-02-11 23:58:57 +01:00
Kristian S. Stangeland
f71ed90b04
Refresh the Netty registry when packet listeners are added. FIXES #40
2014-02-07 19:37:08 +01:00
Kristian S. Stangeland
345cc74b3c
Fixed a bug preventing dual side packets from working in 1.6.4.
...
An example of a dual side packet is Packet101CloseWindow, which is
sent by the server when it forces a inventory window to close, or
by the client to the server when the player voluntarily closes it.
The bug prevented the client-side of a dual side packet from being
recognized in 1.6.4. Thanks to Shevchikden for discovering the bug,
and finding the correct build number where it was introduced.
2014-02-04 22:53:56 +01:00
Kristian S. Stangeland
9ef9475b61
Correct a concurrency bug discovered by mibby. FIXES #39 .
...
It's another lazy initialization problem. I only check a single
field before initializing two related fields, which can cause
problems when two threads execute handleLogin() concurrently.
If thread A detects that PACKET_LOGIN_CLIENT is null, it updates both
it and LOGIN_GAME_PROFILE. However, thread B may only see the
PACKET_LOGIN_CLIENT update, and still believe LOGIN_GAME_PROFILE is
NULL. Hence why it causes a NullPointerException in issue #39 .
2014-02-03 01:38:52 +01:00
Kristian S. Stangeland
ea7b550bda
Use PacketType in PacketContainerTest.
2014-02-02 19:54:49 +01:00
Kristian S. Stangeland
8bd177daf5
Update the integration test for Minecraft 1.7.2.
2014-02-02 19:46:03 +01:00
Kristian S. Stangeland
12286ebaa7
Expose configuration to plugins.
2014-02-02 19:45:30 +01:00
Kristian S. Stangeland
b59f55e2e5
Added support for serializing/deserializing WrappedServerPing to JSON.
2014-02-02 16:50:56 +01:00
Kristian S. Stangeland
96cc518fb0
Throw a more descriptive error of a packet type hasn't got a class.
2014-01-30 02:04:38 +01:00
Kristian S. Stangeland
6e3583b300
Increment to 3.2.1-SNAPSHOT
...
Use Maven resource filtering to automatically update plugin.yml.
2014-01-30 02:03:09 +01:00
Kristian S. Stangeland
cfde9ecce8
Incrementing to 3.2.0
2014-01-29 04:00:40 +01:00
Kristian S. Stangeland
ef4bd2ddcd
Race condition that would occationally skip STATUS packets. Fixes 198
2014-01-29 01:06:05 +01:00
Kristian S. Stangeland
bf8c16e22d
Construct missing packet types. Possible fix for #197 .
2014-01-28 01:38:34 +01:00
Kristian S. Stangeland
5d7895d741
Fixed a VERY long standing bug discovered by libraryaddict.
...
Constructing a WrappedWatchableObject with a
net.minecraft.server.ItemStack would cause ProtocolLib to throw an
IllegalArgumentException, even though WrappedWatchableObject.
setValue(Object) accepts ItemStacks without trouble.
This is because WrappedWatchableObject.getUnwrappedType() didn't handle
ItemStacks at all.
2014-01-23 02:55:47 +01:00
Kristian S. Stangeland
385bae8bda
Increment to 3.1.3-SNAPSHOT
2014-01-20 06:21:51 +01:00
Kristian S. Stangeland
7ae0399721
Lookup packet types by name as well.
2014-01-20 06:21:20 +01:00
Kristian S. Stangeland
5cffccd8ca
Bumping to version 3.1.2
2014-01-19 17:01:45 +01:00
Kristian S. Stangeland
c87c0a9299
Add support for legacy /packet commands.
2014-01-19 00:27:57 +01:00
Kristian S. Stangeland
d70e9d28d4
Properly handle WrappedGameProfile during packet cloning.
2014-01-17 23:58:04 +01:00
Kristian S. Stangeland
90548f1092
Periodically clean up injectors in Spigot 1.6.4 and earlier.
...
This (may) fix a fairly serious memory leak.
2014-01-17 02:51:22 +01:00
Kristian S. Stangeland
eea0d131bb
Updated the timings system to the new PacketType format.
...
Also made PacketType comparable.
2014-01-16 04:04:23 +01:00
Kristian S. Stangeland
0c718f9484
Attempting to correct a memory leak in ticket #189 .
2014-01-13 03:46:06 +01:00
Kristian S. Stangeland
e23129540c
Ensure WrappedGameProfile can handle NULL profiles.
...
We also implement hashCode() ourselves, to avoid Mojang's buggy
version that doesn't handle NULL.
2014-01-11 02:24:56 +01:00
Kristian S. Stangeland
4f95b515ae
Complain about lack of page index to packet page.
2014-01-11 02:13:41 +01:00
Kristian S. Stangeland
a902c1f186
Add support for using multiple lines in WrappedServerPing.
2014-01-09 20:01:37 +01:00
Minecrell
7ed24e72f6
Correctly handle player samples set to null.
2014-01-09 17:25:53 +01:00
Minecrell
2a729cfe2d
Return an empty list instead of null when getting the player sample.
2014-01-09 17:18:34 +01:00
Minecrell
3e7fe52681
Correctly modify player sample with hidden player counts.
...
At the moment the setPlayers() method will throw a NullPointerException
if the player count has been hidden. This will correctly reset the
player counts before setting the player list and return null in the
getter instead of throwing an exception.
2014-01-09 16:45:05 +01:00
Kristian S. Stangeland
31b26fd0c5
Catch more serious errors in the plugin verifier.
...
It doesn't make sense for the caller to handle those.
2014-01-08 14:53:03 +01:00
Kristian S. Stangeland
7e9860f4c0
ProtocolLib is working fine in 1.7.4
2014-01-02 16:01:04 +01:00
Kristian S. Stangeland
a7cac0be7f
Forgot to include the wrapper itself.
2014-01-02 07:23:50 +01:00
Kristian S. Stangeland
c06aeb2836
Add a quick and dirty wrapper for statistics maps.
2014-01-02 07:23:27 +01:00
Kristian S. Stangeland
5c92a46cfa
Correctly clone WrappedServerPing when the player count is hidden.
2014-01-01 17:16:14 +01:00
Minecrell
14c69e294a
Correctly handle wrapped server pings with no favicon.
...
In the current ProtocolLib release (3.1.0) the getFavicon() method will
throw a NullPointerException if the server is not sending a favicon.
This was partly fixed in 3c5482f
but there's still no way of checking if
the server is sending a favicon, without checking if the encoded output
of the CompressedImage.toEncodedText() will return a valid result.
This commit will make the favicon getter and setter in the server ping
correctly handle pings with no favicon, by returning null for
getFavicon() (if no favicon will be displayed) and allowing to hide the
favicon by setting the favicon to null.
2014-01-01 16:29:21 +01:00
Kristian S. Stangeland
a9f1ee48a9
Add the ability to hide the player count and maximum in ServerPing.
2014-01-01 04:21:31 +01:00
Kristian S. Stangeland
3c5482f79b
Optimize CompressedImage slightly, and construct from base64 PNG.
2013-12-31 23:01:17 +01:00
Kristian S. Stangeland
e0fed34fe4
Make it possible to look up the enum name of a PacketType.
2013-12-30 15:25:34 +01:00
Kristian S. Stangeland
58c027f162
Print caught exceptions in debug mode.
2013-12-29 11:58:54 +01:00
Kristian S. Stangeland
32758061a9
Increment to 3.1.1-SNAPSHOT
2013-12-28 14:53:48 +01:00
Kristian S. Stangeland
ce064643ff
Bumping to version 3.1.0
2013-12-27 05:26:48 +01:00
Kristian S. Stangeland
e56c0fec00
A possible fix for a rare but game-breaking deadlock.
...
Calling remove() in the main thread will block the main thread, which
may lead to a deadlock:
http://pastebin.com/L3SBVKzp
ProtocolLib executes this close() method through a PlayerQuitEvent in
the main thread, which has implicitly aquired a lock on
SimplePluginManager (see SimplePluginManager.callEvent(Event)).
Unfortunately, the remove() method will schedule the removal on one of
the Netty worker threads if it's called from a different thread,
blocking until the removal has been confirmed.
This is bad enough (Rule #1 : Don't block the main thread), but the real
trouble starts if the same worker thread happens to be handling a server
ping connection when this removal task is scheduled. In that case, it
may attempt to invoke an asynchronous ServerPingEvent
(see PacketStatusListener) using SimplePluginManager.callEvent(). But,
since this has already been locked by the main thread, we end up with a
deadlock. The main thread is waiting for the worker thread to process
the task, and the worker thread is waiting for the main thread to
finish executing PlayerQuitEvent.
TLDR: Concurrenty is hard.
2013-12-24 02:15:22 +01:00
Kristian S. Stangeland
16dd2d5d1b
Add support for legacy mod packet IDs (such as 211). May fix issue #32
2013-12-22 20:10:51 +01:00
Kristian S. Stangeland
db8d08f602
Add a mechanism for printing debug reports.
2013-12-22 17:31:31 +01:00
Kristian S. Stangeland
d71bea9f8a
Don't pass NULL to ConcurrentHashMap when reading or removing.
...
May fix issue 181 on BukkitDev.
2013-12-22 01:01:35 +01:00
Kristian S. Stangeland
d62955dc71
Moving ItemDisguise to an examples folder.
2013-12-21 19:17:06 +01:00
Kristian S. Stangeland
af58dd8d03
Add the ability to look up PacketType from class.
2013-12-19 04:45:30 +01:00
Kristian S. Stangeland
acea92ef5c
Switch to using PacketType in the built-in commands.
...
The format is now as follows:
/packet add server play 0-255.
It may be possible to look up packet types by name later.
2013-12-19 02:17:06 +01:00
Kristian S. Stangeland
6bd8bd2ca2
Handle plugin reloading properly, uninjecting all player channels.
...
This should prevent any crashes if the plugin is reloaded during
a player login.
2013-12-17 16:45:01 +01:00
Kristian S. Stangeland
5805150d8c
Call the updated player instance in the temporary player.
...
This allows us to provide additional information to our PacketEvent
(mostly OfflinePlayer information), without sacrificing sendMessage()
or getAddress(), which doesn't work in CraftPlayer during login.
2013-12-17 11:53:26 +01:00
Kristian S. Stangeland
9d972b90ac
Update the player instance during PlayerLoginEvent as well.
...
This ensures that we at least have an OfflinePlayer when certain
packets are intercepted, instead of the TemporaryPlayer created
by ProtocolLib.
2013-12-17 11:07:44 +01:00
Kristian S. Stangeland
936e0f0e82
Actually fix the ServerPing wrapper.
2013-12-15 22:54:59 +01:00
Kristian S. Stangeland
aedd97dfef
Ensure ProtocolLib functions in 1.6.4 and below.
2013-12-14 19:17:48 +01:00
Kristian S. Stangeland
96f24167bb
Don't synchronize with the main thread when registering async listeners
2013-12-14 18:08:08 +01:00
Kristian S. Stangeland
88a2385b1e
Set the correct option when calling optionAsync().
2013-12-14 17:49:51 +01:00
Kristian S. Stangeland
f41efdec60
Make it possible to modify the player list in the ping packet.
2013-12-14 17:35:29 +01:00
Kristian S. Stangeland
a6f4aaa09a
Fix a race condition we created while fixing another race condition.
...
They're everywhere.
2013-12-14 16:32:12 +01:00
Kristian S. Stangeland
b52ea72903
Don't override the network manager list unnecessarily.
2013-12-14 05:02:43 +01:00
Kristian S. Stangeland
85d415de7c
Correct a missing noEntryValue in Spigot.
...
Again.
2013-12-14 04:39:12 +01:00
Kristian S. Stangeland
9b349299a0
Significantly reduce the possibility of a race condition.
...
The vanilla server bootstrap (ServerConnectionChannel) is executed
asynchronously when a new channel object has been registered in an event
loop, much before it is ready to accept a new client connection. It is
here the whole channel handler pipeline is set up, along with a
NetworkManager responsible for reading and writing packets.
The trouble starts when the bootstrap class adds the created
NetworkManager to a list (f) of managers in ServerConnection. This list
is regularly inspected by the main thread (in order to process packets
on the main thread) and includes a clean up procedure
(ServerConnection#61) in case it detects a disconnected network manager.
Unfortunately, the network manager IS considered disconnected for a
moment when its added to the list, so the main thread MAY end up
getting to the network manager before Netty has connected the channel.
This is still very rare under normal circumstances, but because
ProtocolLib does a lot of initial processing in the channel handler, the
asynchronous thread gets hold up for a long while the first time a
player connects to the server, allowing the main thread sufficient time
to catch up and evict the network manager.
The partial solution here is to synchronize on the network manager list,
stopping the main thread from processing network managers when we are
preparing our new connection.
But I suspect the best solution would be to correct the root of the
problem, and correct the race condition in the server itself. This
could be done by only adding the network manager when the channel is
active
(see ChannelInboundHandler.channelActive).
2013-12-14 04:05:12 +01:00
Kristian S. Stangeland
c568481da3
Correctly clean up the old injection handler.
2013-12-13 21:34:03 +01:00
Kristian S. Stangeland
74d83b3ed6
Add support for the latest build of Spigot.
...
See commit 8b2b731ea5deda5607058849f2ca9ec2e3bf003f in SpigotMC/
Spigot-Server.
2013-12-13 20:35:00 +01:00
YukonAppleGeek
d166baf721
Fix ConcurrentPlayerMap to use SafeCacheBuilder
2013-12-10 19:18:58 -08:00
Kristian S. Stangeland
922fb94804
Added support for cloing ServerPing packets.
2013-12-11 03:55:25 +01:00
Kristian S. Stangeland
ee53fc0d5f
Starting to add unit tests for PacketType.
2013-12-10 22:57:43 +01:00
Kristian S. Stangeland
17a5b06577
Adding a new ChunkCoordIntPair wrapper.
2013-12-10 22:35:29 +01:00
Kristian S. Stangeland
745a0846ea
Bumping to 3.0.2-SNAPSHOT
2013-12-10 19:43:24 +01:00
Kristian S. Stangeland
726374e7f5
Bumping to 3.0.1
2013-12-10 16:38:33 +01:00
Kristian S. Stangeland
9a07979733
Ensure the new style listener gets the correct GamePhase in 1.6.4.
...
Also adding in a test image for our ServerPing wrapper.
2013-12-10 16:38:23 +01:00
Kristian S. Stangeland
c23e5c98f8
Release of 3.0.0
2013-12-10 16:27:46 +01:00
Kristian S. Stangeland
ab0ef6d37c
A couple of small last minute bug fixes.
2013-12-10 16:27:30 +01:00
Kristian S. Stangeland
9b0d4294cb
Adding a converter for block fields.
2013-12-10 13:21:31 +01:00
Kristian S. Stangeland
c3ae43c75f
Added wrappers for every enum in the packets.
2013-12-10 12:17:15 +01:00
Kristian S. Stangeland
bdc739317b
Added a wrapper for ServerPing fields.
2013-12-09 23:09:08 +01:00
Kristian S. Stangeland
e8759d0b72
Refactor the wrapper classes so they inherit from a common class.
2013-12-09 17:19:07 +01:00
Kristian S. Stangeland
143ed2ff02
Moving accessor methods to a separate "Accessors" factory class.
2013-12-09 12:03:30 +01:00
Kristian S. Stangeland
b70c7fa775
Update the player reference (from TemporaryPlayer) as soon as possible.
2013-12-09 00:02:44 +01:00
Kristian S. Stangeland
154d73ae51
Added the ability to read and modify server-side chat messages.
...
This introduces the new WrappedChatComponent class, which can be
accessed through PacketContainer.getChatComponents().
2013-12-08 23:45:35 +01:00
Kristian S. Stangeland
1aaf272878
Don't attempt to inject closed channels. Fixes issue #23
2013-12-08 19:50:59 +01:00
Kristian S. Stangeland
20524c1c3c
Don't catch any exceptions in the underlying decoder in ProtocolLib.
2013-12-08 19:44:38 +01:00
Kristian S. Stangeland
feae8dd400
Add some debug information to the mssing decoder/encoder exception.
2013-12-08 14:37:50 +01:00
Kristian S. Stangeland
be95fbc430
Only patch the encoder if it was found.
2013-12-08 14:34:55 +01:00
Kristian S. Stangeland
b947ed1193
Synchronize before attempting to modify thread-safe fields.
...
We also re-wrap proxied lists in Collections.synchronizedList(). May
fix ticket #157 on BukkitDev.
2013-12-08 07:47:25 +01:00
Kristian S. Stangeland
a74d2ca8bc
Prevent cancelled packets from been cancelled over and over again.
2013-12-08 00:51:46 +01:00
Kristian S. Stangeland
fa55e2cb27
Remove any references to Guava in Minecraft.
2013-12-07 19:52:02 +01:00
Kristian S. Stangeland
029b19d94c
Run onPacketSending() on the main thread if not otherwise stated.
...
Now onPacketSending() should only be executed on the main thread,
unless the listener has specified ListenerOption.ASYNC. This option
is off by default, however.
This ensures that older plugins that assume onPacketSending() doesn't
crash the server. They SHOULD use the ASYNC option if possible, as
this explicit synchronization will slow down the STATUS
protocol somewhat.
2013-12-07 19:14:03 +01:00
Kristian S. Stangeland
4d11cfa8e8
It is an error to pass an empty type array.
2013-12-07 17:39:06 +01:00
Kristian S. Stangeland
54ef43fae8
Added more constructors to PacketAdapter.
2013-12-07 17:31:27 +01:00
Kristian S. Stangeland
b6625e6e39
Don't extract a NetworkManager from a temporary player. Fixes #155
...
Instead, look up its channel injector directly.
2013-12-07 17:22:50 +01:00
Kristian S. Stangeland
8be221ff2e
Update the plugin version.
2013-12-07 17:04:48 +01:00
Kristian S. Stangeland
e44f02e1fa
Reload the previous value in VolatileField when calling refreshValue()
2013-12-07 00:56:45 +01:00
Kristian S. Stangeland
d83655f2d3
Add the ability to print out every packet listener.
2013-12-07 00:47:13 +01:00
Kristian S. Stangeland
aa3600a337
Don't attempt to add NULL keys to a ConcurrentHashMap. Fixes #21
2013-12-06 23:07:56 +01:00
Kristian S. Stangeland
23ebcb47ab
Align the packet types with spaces only, not TABs and spaces.
2013-12-06 21:17:05 +01:00
Kristian S. Stangeland
ba064f649f
Depreciate everything in PacketTest.
2013-12-06 20:22:05 +01:00
Kristian S. Stangeland
2a0e782725
Merge pull request #19 from DerFlash/testsFix
...
Stay backwards compatible to Java 6 in test classes
2013-12-06 11:16:46 -08:00
Kristian S. Stangeland
e064c1feb4
Adding legacy packets for older versions.
2013-12-06 20:05:46 +01:00
Kristian S. Stangeland
99eda4beca
Don't complain about NULLs in network marker.
2013-12-06 18:10:22 +01:00
Kristian S. Stangeland
d8df5a7667
Revert renaming "AdapterParameteters" to "AdapterParameters".
...
Backwards compatibility is more important than spelling.
2013-12-06 18:09:57 +01:00
Kristian S. Stangeland
6159507bb4
Attempting to add backwards compatibility for NetworkMarker.
2013-12-06 18:02:26 +01:00
DerFlash
253a0cf2a6
Stay backwards compatible to Java 6 (getHostString() is available but protected in Java 6)
...
We could still use this function with Java 6 using reflection, but that would be overkill for tests only ;-)
2013-12-06 08:54:48 +01:00
Kristian S. Stangeland
92c8f21d5e
Merge remote-tracking branch 'origin/master'
2013-12-06 06:09:08 +01:00
Kristian S. Stangeland
3509702204
Wups, nothing to see here.
2013-12-06 06:08:52 +01:00
Kristian S. Stangeland
be2d6b205b
Merge pull request #18 from Devil-Boy/master
...
Fixed two typos in PacketType (didn't merge properly from thesbros)
2013-12-05 21:02:28 -08:00
Kristian S. Stangeland
8eeb8645e7
Notify users of PacketListener about async server events.
2013-12-06 05:56:02 +01:00
Devil Boy
745c4054a3
Just a tiny correction for GameProfile Javadocs
2013-12-05 19:38:29 -08:00
Devil Boy
7f4f2bb724
Fixed two typos in PacketType (didn't merge properly from thesbros)
2013-12-05 19:25:06 -08:00
Kristian S. Stangeland
84ce20f202
Added a GameProfile wrapper class.
...
Easy enough, as we don't have to use reflection.
2013-12-06 02:31:50 +01:00
Kristian S. Stangeland
8e9c9951a9
Clear state related to a packet when its resent.
2013-12-06 02:07:42 +01:00
Kristian S. Stangeland
d746fcbf6c
Merge pull request #17 with spelling corrections from devilboy.
...
Thanks guys. :)
2013-12-06 01:38:34 +01:00
Kristian S. Stangeland
e39310fbcc
Use getProperty() instead of System.lineSeperator(). See pull #12
...
Thanks to DerFlash for notifying me about this issue.
2013-12-06 01:25:33 +01:00
Kristian S. Stangeland
6c3a3e0ba2
Intercept server packets when they're scheduled in the main thread.
...
Note that some server packets, such as LOGIN and STATUS, will still be
run asynchronously.
2013-12-06 01:21:35 +01:00
Kristian S. Stangeland
29d71e05e4
Properly cancel written packets.
2013-12-05 21:27:22 +01:00
Devil Boy
7d8d8ead08
Fixed a few trivial spelling errors
2013-12-05 12:24:31 -08:00
Devil Boy
d42b4de6e9
Merge remote-tracking branch 'thesbros/master'
2013-12-05 12:04:09 -08:00
Devil Boy
a9dbca0bfb
Renamed AdapterParmeteters to AdapterParameters
...
Added a new .param(Plugin, PacketType...) method to replace deprecated
Minor Javadoc edits
2013-12-05 11:55:00 -08:00
Kristian S. Stangeland
be6d4fb720
Precreate the inputBuffers set, avoiding a trivial NPE.
2013-12-05 20:51:28 +01:00
Kristian S. Stangeland
348019c1e1
Look for the correct client or server packet when we have the chance.
...
This should improve backwards compatiblity.
2013-12-05 20:40:45 +01:00
thesbros
9a658065e1
Another
2013-12-05 10:48:42 -08:00
Devil Boy
79c1e81c02
Deprecated a method that was accepting packet IDs
...
Fixed a small typo
2013-12-04 23:56:49 -08:00
Kristian S. Stangeland
8f408c2109
Rename PacketType members to be more like the new classes in Bukkit
2013-12-05 08:21:42 +01:00
Kristian S. Stangeland
f5e519eada
Find the correct send packet method.
2013-12-05 08:08:13 +01:00
Kristian S. Stangeland
7afc930592
Increment to 3.0.0.
...
This is a massive update, so it's warranted. And many plugins will have
to be updated, though mostly because the packets themselves have
changed.
2013-12-05 06:53:20 +01:00
Kristian S. Stangeland
9052de5316
Switch to using PacketType whenever the new code will be running.
...
We don't convert legacy code.
2013-12-05 06:52:20 +01:00
Kristian S. Stangeland
6842166b94
Finalize the Netty injection system.
...
We still have some more debugging and refactoring left, however. In
particular, I have to switch to PacketType in wherever possible.
2013-12-05 03:54:17 +01:00
Kristian S. Stangeland
7b813fa4e6
Undo mocking in MinecraftReflectionTest when we're done.
2013-12-04 19:22:51 +01:00
Kristian S. Stangeland
f94b060591
Ensure StreamSerializer functions correctly in 1.7.2
2013-12-04 19:19:28 +01:00
Kristian S. Stangeland
7055cadaef
Adding a test for checking the fallback methods in MinecraftReflection
2013-12-04 17:48:51 +01:00
Kristian S. Stangeland
398b1bc3be
Add support for serializing and deserializing NBT tags in 1.7.2
2013-12-04 17:48:17 +01:00
Kristian S. Stangeland
65e665aa59
Don't compare NBT names - they are no longer persistant.
2013-12-04 15:55:17 +01:00
Kristian S. Stangeland
c137640fee
Updating ProtocolLib for 1.7.2.
...
Still a work in progress.
2013-12-04 04:17:02 +01:00
Kristian S. Stangeland
28b4874c60
Depreciate the Packets class - it is not safe to rely on integers.
2013-12-01 06:45:59 +01:00
Kristian S. Stangeland
c9fd6b4b93
Avoid item stack IDs if we can.
2013-11-23 05:01:52 +01:00
Kristian S. Stangeland
125bfbad30
TemporaryPlayer doesn't support getName(), so use getAddress() for maps
...
In addition, adding a useful ConcurrentPlayerMap that doesn't store
player instances directly, and can even handle TemporaryPlayers.
2013-11-23 05:00:34 +01:00
Kristian S. Stangeland
00b297475c
Switching to 1.6.4 in the unit tests.
2013-11-19 13:14:47 +01:00
Kristian S. Stangeland
86f04f53b5
Allow packet constructor to properly unwrap other Bukkit wrappers.
2013-11-19 00:50:55 +01:00
Kristian S. Stangeland
ba6c6e5abf
Improve the documentation of getTypeID().
...
It might be confused with getIndex(), so emphasize the fact that it
returns the data type ID of the object, and not its index.
2013-11-18 22:25:05 +01:00
Kristian S. Stangeland
3d6cfbf1e1
Ensure the MinecraftReflection.isCLASS-method return false for NULL.
2013-11-18 17:55:31 +01:00
Kristian S. Stangeland
4be582ef87
Use the MCPC JAR remapper when loading classes. Fixes #11
...
This will allow plugins to use MinecraftReflection.getMinecraftClass()
in both CraftBukkit and MCPC.
2013-11-16 03:04:00 +01:00
Kristian S. Stangeland
8c8ca3746b
Correctly wrap and unwrap ItemStacks in WrappedWatchableObject.
...
This should make it possible to set and retrieve watchable objects
of the type ItemStack.
2013-11-10 20:47:32 +01:00
Kristian S. Stangeland
b6809f6ce6
Correctly remove packet listeners from the sorted lists.
...
Essentially, the SortedCopyOnWriteArray.remove() method would remove
any packet listeners following a match, instead of just the match
itself.
Thanks to Libraryaddict for discovering the bug. :)
2013-11-01 04:45:30 +01:00
Kristian S. Stangeland
c416877f35
Add support for retrieving WorldType in MCPC
2013-11-01 02:09:59 +01:00
Kristian S. Stangeland
47134b43cc
Adding automatic GamePhase detection.
...
This should solve the infamous UNKNOWN ORIGIN problem, especially in
MCPC++.
2013-10-31 01:55:55 +01:00
Kristian S. Stangeland
68c0a3c1dc
Ignore fake players in MCPC++
2013-10-28 19:09:11 +01:00
Kristian S. Stangeland
f3b2b0bf3b
Remove spigot listener when the plugin is disabling.
2013-10-18 03:45:06 +02:00
Kristian S. Stangeland
3ea5b5d62f
Increment to 2.7.4-SNAPSHOT
2013-10-18 03:44:49 +02:00
Kristian S. Stangeland
6a0600cd7f
Update to the latest version of Gravity's Updater class.
2013-10-17 02:14:02 +02:00
Kristian S. Stangeland
42395abe75
Add a small hint for plugin authors to the "unknown origin" error.
2013-10-14 19:09:59 +02:00
Kristian S. Stangeland
73804d45df
Make UnknownHostException more low-key. They are to be expected.
...
Whenever the update procedure is ongoing, and the server temporarily
lost connectivity to the internet (or more likely, dev.bukkit.org is
down), a huge exception log will be printed in the console. See ticket
134 for a real life example.
This is completely out of propotion to the problem at hand (connection
problems), so we will replace the error log with a simple warning
message.
2013-10-11 02:49:07 +02:00
Kristian S. Stangeland
8a4982e169
Add the test plugin to the plugin manager, just in case.
2013-10-07 21:50:07 +02:00
Kristian S. Stangeland
c058498267
Add a timeout to server startup and the ping test.
2013-10-07 05:16:20 +02:00
Kristian S. Stangeland
09cc024a3f
Added a simple integration test to ensure ProtocolLib actually works.
...
We do this by running a CraftBukkit server in target/server, and
copying ProtocolLib to its plugin folder.
2013-10-07 04:29:21 +02:00
Kristian S. Stangeland
47ffa7f62d
Bumping to version 2.7.3
2013-10-06 02:35:07 +02:00
Kristian S. Stangeland
c2abc4277b
Fix a critial bug that prevents PB from loading.
...
This was caused by a previous patch that corrected the version parser
for special Spigot versions with a snapshot protocol enabled.
Unfortunately, this also causes the comparer to fail on normal
version ...
Somehow, that got through testing.
2013-10-06 02:34:33 +02:00
Kristian S. Stangeland
e4c193440e
Correct all JavaDoc problems.
2013-10-05 21:42:19 +02:00
Kristian S. Stangeland
b1b4bc7fb3
Bumping to version 2.7.2
2013-10-05 20:20:43 +02:00
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