diff --git a/README.md b/README.md
index 331a44890..8bb27482e 100644
--- a/README.md
+++ b/README.md
@@ -17,4 +17,4 @@ Binaries
--------
Precompiled binaries are available for end users on [Jenkins](https://www.spigotmc.org/go/bungeecord-dl).
-(c) 2012-2017 SpigotMC Pty. Ltd.
+(c) 2012-2018 SpigotMC Pty. Ltd.
diff --git a/api/pom.xml b/api/pom.xml
index 96a467388..5432a6ebd 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-api
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-API
diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java
index ccc8153fe..baae54f64 100644
--- a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java
+++ b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java
@@ -154,16 +154,6 @@ public abstract class ProxyServer
*/
public abstract void stop(String reason);
- /**
- * Start this instance so that it may accept connections.
- *
- * @throws Exception any exception thrown during startup causing the
- * instance to fail to boot
- * @deprecated not API, will be removed in a future version
- */
- @Deprecated
- public abstract void start() throws Exception;
-
/**
* Register a channel for use with plugin messages. This is required by some
* server / client implementations.
diff --git a/api/src/main/java/net/md_5/bungee/api/config/ServerInfo.java b/api/src/main/java/net/md_5/bungee/api/config/ServerInfo.java
index e9f1ff669..7b7c987f0 100644
--- a/api/src/main/java/net/md_5/bungee/api/config/ServerInfo.java
+++ b/api/src/main/java/net/md_5/bungee/api/config/ServerInfo.java
@@ -56,6 +56,10 @@ public interface ServerInfo
* Send data by any available means to this server. This data may be queued
* and there is no guarantee of its timely arrival.
*
+ * In recent Minecraft versions channel names must contain a colon separator
+ * and consist of [a-z0-9/._-]. This will be enforced in a future version.
+ * The "BungeeCord" channel is an exception and may only take this form.
+ *
* @param channel the channel to send this data via
* @param data the data to send
*/
@@ -64,6 +68,10 @@ public interface ServerInfo
/**
* Send data by any available means to this server.
*
+ * In recent Minecraft versions channel names must contain a colon separator
+ * and consist of [a-z0-9/._-]. This will be enforced in a future version.
+ * The "BungeeCord" channel is an exception and may only take this form.
+ *
* @param channel the channel to send this data via
* @param data the data to send
* @param queue hold the message for later sending if it cannot be sent
diff --git a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java
index a7334c87c..333d39729 100644
--- a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java
+++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java
@@ -140,6 +140,10 @@ public interface ProxiedPlayer extends Connection, CommandSender
/**
* Send a plugin message to this player.
*
+ * In recent Minecraft versions channel names must contain a colon separator
+ * and consist of [a-z0-9/._-]. This will be enforced in a future version.
+ * The "BungeeCord" channel is an exception and may only take this form.
+ *
* @param channel the channel to send this data via
* @param data the data to send
*/
diff --git a/api/src/main/java/net/md_5/bungee/api/connection/Server.java b/api/src/main/java/net/md_5/bungee/api/connection/Server.java
index 06eb6d1af..b4653403b 100644
--- a/api/src/main/java/net/md_5/bungee/api/connection/Server.java
+++ b/api/src/main/java/net/md_5/bungee/api/connection/Server.java
@@ -18,6 +18,10 @@ public interface Server extends Connection
/**
* Send data by any available means to this server.
*
+ * In recent Minecraft versions channel names must contain a colon separator
+ * and consist of [a-z0-9/._-]. This will be enforced in a future version.
+ * The "BungeeCord" channel is an exception and may only take this form.
+ *
* @param channel the channel to send this data via
* @param data the data to send
*/
diff --git a/api/src/main/java/net/md_5/bungee/api/score/Team.java b/api/src/main/java/net/md_5/bungee/api/score/Team.java
index 416603712..849ba1cf9 100644
--- a/api/src/main/java/net/md_5/bungee/api/score/Team.java
+++ b/api/src/main/java/net/md_5/bungee/api/score/Team.java
@@ -19,7 +19,7 @@ public class Team
private byte friendlyFire;
private String nameTagVisibility;
private String collisionRule;
- private byte color;
+ private int color;
private Set players = new HashSet<>();
public Collection getPlayers()
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 9b5c98f7d..615ac3f5c 100644
--- a/bootstrap/pom.xml
+++ b/bootstrap/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-bootstrap
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Bootstrap
diff --git a/chat/pom.xml b/chat/pom.xml
index 970e30973..92f04c620 100644
--- a/chat/pom.xml
+++ b/chat/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-chat
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Chat
diff --git a/config/pom.xml b/config/pom.xml
index 255270c62..7241c6bac 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-config
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Config
diff --git a/event/pom.xml b/event/pom.xml
index 6132e8e9f..93c4aa397 100644
--- a/event/pom.xml
+++ b/event/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-event
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Event
diff --git a/log/pom.xml b/log/pom.xml
index 2fcbbad65..87b839adb 100644
--- a/log/pom.xml
+++ b/log/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-log
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Log
diff --git a/module/cmd-alert/pom.xml b/module/cmd-alert/pom.xml
index 220f04211..44d5b21eb 100644
--- a/module/cmd-alert/pom.xml
+++ b/module/cmd-alert/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-alert
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
cmd_alert
diff --git a/module/cmd-find/pom.xml b/module/cmd-find/pom.xml
index 928f63a81..e320447a2 100644
--- a/module/cmd-find/pom.xml
+++ b/module/cmd-find/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-find
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
cmd_find
diff --git a/module/cmd-list/pom.xml b/module/cmd-list/pom.xml
index 689b83ee5..230af0cc4 100644
--- a/module/cmd-list/pom.xml
+++ b/module/cmd-list/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-list
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
cmd_list
diff --git a/module/cmd-send/pom.xml b/module/cmd-send/pom.xml
index e50a4becf..23f9a02b8 100644
--- a/module/cmd-send/pom.xml
+++ b/module/cmd-send/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-send
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
cmd_send
diff --git a/module/cmd-server/pom.xml b/module/cmd-server/pom.xml
index daf146dca..0731bd8e2 100644
--- a/module/cmd-server/pom.xml
+++ b/module/cmd-server/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-server
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
cmd_server
diff --git a/module/pom.xml b/module/pom.xml
index aff2c070d..107cb0efb 100644
--- a/module/pom.xml
+++ b/module/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
pom
BungeeCord Modules
diff --git a/module/reconnect-yaml/pom.xml b/module/reconnect-yaml/pom.xml
index 8e82446f7..809cf79cc 100644
--- a/module/reconnect-yaml/pom.xml
+++ b/module/reconnect-yaml/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-reconnect-yaml
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
reconnect_yaml
diff --git a/native/pom.xml b/native/pom.xml
index 082f09085..15c0ada28 100644
--- a/native/pom.xml
+++ b/native/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-native
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Native
diff --git a/pom.xml b/pom.xml
index e7cec244e..9cad53d8c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
pom
BungeeCord-Parent
diff --git a/protocol/pom.xml b/protocol/pom.xml
index bf4b399a5..ab9868bdf 100644
--- a/protocol/pom.xml
+++ b/protocol/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-protocol
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Protocol
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
index 6f782c8fe..93f324e29 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java
@@ -22,6 +22,8 @@ import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.EncryptionResponse;
import net.md_5.bungee.protocol.packet.LegacyHandshake;
import net.md_5.bungee.protocol.packet.LegacyPing;
+import net.md_5.bungee.protocol.packet.LoginPayloadRequest;
+import net.md_5.bungee.protocol.packet.LoginPayloadResponse;
import net.md_5.bungee.protocol.packet.LoginRequest;
import net.md_5.bungee.protocol.packet.LoginSuccess;
import net.md_5.bungee.protocol.packet.PingPacket;
@@ -148,4 +150,12 @@ public abstract class AbstractPacketHandler
public void handle(BossBar bossBar) throws Exception
{
}
+
+ public void handle(LoginPayloadRequest request) throws Exception
+ {
+ }
+
+ public void handle(LoginPayloadResponse response) throws Exception
+ {
+ }
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
index cd065631c..76c2bea01 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
@@ -20,6 +20,8 @@ import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.KeepAlive;
import net.md_5.bungee.protocol.packet.Kick;
import net.md_5.bungee.protocol.packet.Login;
+import net.md_5.bungee.protocol.packet.LoginPayloadRequest;
+import net.md_5.bungee.protocol.packet.LoginPayloadResponse;
import net.md_5.bungee.protocol.packet.LoginRequest;
import net.md_5.bungee.protocol.packet.LoginSuccess;
import net.md_5.bungee.protocol.packet.PingPacket;
@@ -61,90 +63,104 @@ public enum Protocol
KeepAlive.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1F ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x1F )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x1F ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x21 )
);
TO_CLIENT.registerPacket(
Login.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x23 ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x23 )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x23 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x25 )
);
TO_CLIENT.registerPacket(
Chat.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x02 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0F ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x0F )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x0F ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x0E )
);
TO_CLIENT.registerPacket(
Respawn.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x07 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x33 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x34 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x35 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x35 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x38 )
);
TO_CLIENT.registerPacket(
BossBar.class,
map( ProtocolConstants.MINECRAFT_1_9, 0x0C ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x0C )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x0C ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x0C )
);
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
map( ProtocolConstants.MINECRAFT_1_8, 0x38 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x2D ),
map( ProtocolConstants.MINECRAFT_1_12, 0x2D ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x2E )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x2E ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x30 )
);
TO_CLIENT.registerPacket(
TabCompleteResponse.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x3A ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0E ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x0E )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x0E ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x10 )
);
TO_CLIENT.registerPacket(
ScoreboardObjective.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x3B ),
map( ProtocolConstants.MINECRAFT_1_9, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_12, 0x41 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x42 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x42 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x45 )
);
TO_CLIENT.registerPacket(
ScoreboardScore.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x3C ),
map( ProtocolConstants.MINECRAFT_1_9, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x44 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x45 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x45 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x48 )
);
TO_CLIENT.registerPacket(
ScoreboardDisplay.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_9, 0x38 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x3A ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x3B )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x3B ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x3E )
);
TO_CLIENT.registerPacket(
Team.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x3E ),
map( ProtocolConstants.MINECRAFT_1_9, 0x41 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x43 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x44 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x44 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x47 )
);
TO_CLIENT.registerPacket(
PluginMessage.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_9, 0x18 ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x18 )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x18 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x19 )
);
TO_CLIENT.registerPacket(
Kick.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x40 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x1A ),
- map( ProtocolConstants.MINECRAFT_1_12, 0x1A )
+ map( ProtocolConstants.MINECRAFT_1_12, 0x1A ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x1B )
);
TO_CLIENT.registerPacket(
Title.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x45 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x47 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x48 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x48 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x4B )
);
TO_CLIENT.registerPacket(
PlayerListHeaderFooter.class,
@@ -152,7 +168,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_9, 0x48 ),
map( ProtocolConstants.MINECRAFT_1_9_4, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x49 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x4A )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x4A ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x4E )
);
TO_SERVER.registerPacket(
@@ -160,35 +177,40 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0B ),
map( ProtocolConstants.MINECRAFT_1_12, 0x0C ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x0B )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x0B ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x0E )
);
TO_SERVER.registerPacket(
Chat.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x02 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x03 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x02 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x02 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x02 )
);
TO_SERVER.registerPacket(
TabCompleteRequest.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x14 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x01 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x02 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x01 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x01 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x05 )
);
TO_SERVER.registerPacket(
ClientSettings.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x04 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x05 ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x04 )
);
TO_SERVER.registerPacket(
PluginMessage.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x09 ),
map( ProtocolConstants.MINECRAFT_1_12, 0x0A ),
- map( ProtocolConstants.MINECRAFT_1_12_1, 0x09 )
+ map( ProtocolConstants.MINECRAFT_1_12_1, 0x09 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x0A )
);
}
},
@@ -221,30 +243,44 @@ public enum Protocol
{
{
+ TO_CLIENT.registerPacket(
+ LoginPayloadRequest.class,
+ map( ProtocolConstants.MINECRAFT_1_13, 0x00 )
+ );
TO_CLIENT.registerPacket(
Kick.class,
- map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
+ map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x01 )
);
TO_CLIENT.registerPacket(
EncryptionRequest.class,
- map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
+ map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x02 )
);
TO_CLIENT.registerPacket(
LoginSuccess.class,
- map( ProtocolConstants.MINECRAFT_1_8, 0x02 )
+ map( ProtocolConstants.MINECRAFT_1_8, 0x02 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x03 )
);
TO_CLIENT.registerPacket(
SetCompression.class,
- map( ProtocolConstants.MINECRAFT_1_8, 0x03 )
+ map( ProtocolConstants.MINECRAFT_1_8, 0x03 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x04 )
);
+ TO_SERVER.registerPacket(
+ LoginPayloadResponse.class,
+ map( ProtocolConstants.MINECRAFT_1_13, 0x00 )
+ );
TO_SERVER.registerPacket(
LoginRequest.class,
- map( ProtocolConstants.MINECRAFT_1_8, 0x00 )
+ map( ProtocolConstants.MINECRAFT_1_8, 0x00 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x01 )
);
TO_SERVER.registerPacket(
EncryptionResponse.class,
- map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
+ map( ProtocolConstants.MINECRAFT_1_8, 0x01 ),
+ map( ProtocolConstants.MINECRAFT_1_13, 0x02 )
);
}
};
@@ -327,7 +363,8 @@ public enum Protocol
{
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_8, Arrays.asList(
ProtocolConstants.MINECRAFT_1_9,
- ProtocolConstants.MINECRAFT_1_12
+ ProtocolConstants.MINECRAFT_1_12,
+ ProtocolConstants.MINECRAFT_1_13
) );
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_9, Arrays.asList(
ProtocolConstants.MINECRAFT_1_9_1,
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java
index ac9adf332..bba6cb2df 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java
@@ -17,12 +17,14 @@ public class ProtocolConstants
public static final int MINECRAFT_1_12 = 335;
public static final int MINECRAFT_1_12_1 = 338;
public static final int MINECRAFT_1_12_2 = 340;
+ public static final int MINECRAFT_1_13 = 389;
public static final List SUPPORTED_VERSIONS = Arrays.asList(
"1.8.x",
"1.9.x",
"1.10.x",
"1.11.x",
- "1.12.x"
+ "1.12.x",
+ "1.13.x"
);
public static final List SUPPORTED_VERSION_IDS = Arrays.asList( ProtocolConstants.MINECRAFT_1_8,
ProtocolConstants.MINECRAFT_1_9,
@@ -34,7 +36,8 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_11_1,
ProtocolConstants.MINECRAFT_1_12,
ProtocolConstants.MINECRAFT_1_12_1,
- ProtocolConstants.MINECRAFT_1_12_2
+ ProtocolConstants.MINECRAFT_1_12_2,
+ ProtocolConstants.MINECRAFT_1_13
);
public enum Direction
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginPayloadRequest.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginPayloadRequest.java
new file mode 100644
index 000000000..a73f1bff0
--- /dev/null
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginPayloadRequest.java
@@ -0,0 +1,51 @@
+package net.md_5.bungee.protocol.packet;
+
+import net.md_5.bungee.protocol.DefinedPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import net.md_5.bungee.protocol.AbstractPacketHandler;
+import net.md_5.bungee.protocol.OverflowPacketException;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+public class LoginPayloadRequest extends DefinedPacket
+{
+
+ private int id;
+ private String channel;
+ private byte[] data;
+
+ @Override
+ public void read(ByteBuf buf)
+ {
+ id = readVarInt( buf );
+ channel = readString( buf );
+
+ int len = buf.readableBytes();
+ if ( len > 1048576 )
+ {
+ throw new OverflowPacketException( "Payload may not be larger than 1048576 bytes" );
+ }
+ data = new byte[ len ];
+ buf.readBytes( data );
+ }
+
+ @Override
+ public void write(ByteBuf buf)
+ {
+ writeVarInt( id, buf );
+ writeString( channel, buf );
+ buf.writeBytes( data );
+ }
+
+ @Override
+ public void handle(AbstractPacketHandler handler) throws Exception
+ {
+ handler.handle( this );
+ }
+}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginPayloadResponse.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginPayloadResponse.java
new file mode 100644
index 000000000..962ea3b64
--- /dev/null
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginPayloadResponse.java
@@ -0,0 +1,58 @@
+package net.md_5.bungee.protocol.packet;
+
+import net.md_5.bungee.protocol.DefinedPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import net.md_5.bungee.protocol.AbstractPacketHandler;
+import net.md_5.bungee.protocol.OverflowPacketException;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+public class LoginPayloadResponse extends DefinedPacket
+{
+
+ private int id;
+ private byte[] data;
+
+ @Override
+ public void read(ByteBuf buf)
+ {
+ id = readVarInt( buf );
+
+ if ( buf.readBoolean() )
+ {
+ int len = buf.readableBytes();
+ if ( len > 1048576 )
+ {
+ throw new OverflowPacketException( "Payload may not be larger than 1048576 bytes" );
+ }
+ data = new byte[ len ];
+ buf.readBytes( data );
+ }
+ }
+
+ @Override
+ public void write(ByteBuf buf)
+ {
+ writeVarInt( id, buf );
+ if ( data != null )
+ {
+ buf.writeBoolean( true );
+ buf.writeBytes( data );
+ } else
+ {
+ buf.writeBoolean( false );
+ }
+ }
+
+ @Override
+ public void handle(AbstractPacketHandler handler) throws Exception
+ {
+ handler.handle( this );
+ }
+}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java
index d578402bd..8d4eacbc5 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java
@@ -1,5 +1,6 @@
package net.md_5.bungee.protocol.packet;
+import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import net.md_5.bungee.protocol.DefinedPacket;
@@ -7,6 +8,7 @@ import io.netty.buffer.ByteBuf;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
+import java.util.Locale;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -21,12 +23,37 @@ import net.md_5.bungee.protocol.ProtocolConstants;
public class PluginMessage extends DefinedPacket
{
+ public static final Function MODERNISE = new Function()
+ {
+ @Override
+ public String apply(String tag)
+ {
+ // Transform as per Bukkit
+ if ( tag.equals( "BungeeCord" ) )
+ {
+ return "bungeecord:main";
+ }
+ if ( tag.equals( "bungeecord:main" ) )
+ {
+ return "BungeeCord";
+ }
+
+ // Code that gets to here is UNLIKELY to be viable on the Bukkit side of side things,
+ // but we keep it anyway. It will eventually be enforced API side.
+ if ( tag.indexOf( ':' ) != -1 )
+ {
+ return tag;
+ }
+
+ return "bungeecord:legacy/" + tag.toLowerCase( Locale.ROOT );
+ }
+ };
public static final Predicate SHOULD_RELAY = new Predicate()
{
@Override
public boolean apply(PluginMessage input)
{
- return ( input.getTag().equals( "REGISTER" ) || input.getTag().equals( "MC|Brand" ) ) && input.getData().length < Byte.MAX_VALUE;
+ return ( input.getTag().equals( "REGISTER" ) || input.getTag().equals( "minecraft:register" ) || input.getTag().equals( "MC|Brand" ) || input.getTag().equals( "minecraft:brand" ) ) && input.getData().length < Byte.MAX_VALUE;
}
};
//
@@ -41,7 +68,7 @@ public class PluginMessage extends DefinedPacket
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- tag = readString( buf );
+ tag = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? MODERNISE.apply( readString( buf ) ) : readString( buf );
int maxSize = direction == ProtocolConstants.Direction.TO_SERVER ? Short.MAX_VALUE : 0x100000;
Preconditions.checkArgument( buf.readableBytes() < maxSize );
data = new byte[ buf.readableBytes() ];
@@ -51,7 +78,7 @@ public class PluginMessage extends DefinedPacket
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- writeString( tag, buf );
+ writeString( ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? MODERNISE.apply( tag ) : tag, buf );
buf.writeBytes( data );
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java
index ef9b8cf68..6279d9f35 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java
@@ -2,6 +2,7 @@ package net.md_5.bungee.protocol.packet;
import net.md_5.bungee.protocol.DefinedPacket;
import io.netty.buffer.ByteBuf;
+import java.util.Locale;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -18,7 +19,7 @@ public class ScoreboardObjective extends DefinedPacket
private String name;
private String value;
- private String type;
+ private HealthDisplay type;
/**
* 0 to create, 1 to remove, 2 to update display text.
*/
@@ -32,7 +33,13 @@ public class ScoreboardObjective extends DefinedPacket
if ( action == 0 || action == 2 )
{
value = readString( buf );
- type = readString( buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ type = HealthDisplay.values()[readVarInt( buf )];
+ } else
+ {
+ type = HealthDisplay.fromString( readString( buf ) );
+ }
}
}
@@ -44,7 +51,13 @@ public class ScoreboardObjective extends DefinedPacket
if ( action == 0 || action == 2 )
{
writeString( value, buf );
- writeString( type, buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ writeVarInt( type.ordinal(), buf );
+ } else
+ {
+ writeString( type.toString(), buf );
+ }
}
}
@@ -53,4 +66,21 @@ public class ScoreboardObjective extends DefinedPacket
{
handler.handle( this );
}
+
+ public enum HealthDisplay
+ {
+
+ INTEGER, HEARTS;
+
+ @Override
+ public String toString()
+ {
+ return super.toString().toLowerCase( Locale.ROOT );
+ }
+
+ public static HealthDisplay fromString(String s)
+ {
+ return valueOf( s.toUpperCase( Locale.ROOT ) );
+ }
+ }
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java
index e3bcbc330..f9eaa7ce8 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java
@@ -2,7 +2,6 @@ package net.md_5.bungee.protocol.packet;
import net.md_5.bungee.protocol.DefinedPacket;
import io.netty.buffer.ByteBuf;
-import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@@ -11,44 +10,74 @@ import net.md_5.bungee.protocol.ProtocolConstants;
@Data
@NoArgsConstructor
-@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class TabCompleteRequest extends DefinedPacket
{
+ private int transactionId;
private String cursor;
private boolean assumeCommand;
private boolean hasPositon;
private long position;
+ public TabCompleteRequest(int transactionId, String cursor)
+ {
+ this.transactionId = transactionId;
+ this.cursor = cursor;
+ }
+
+ public TabCompleteRequest(String cursor, boolean assumeCommand, boolean hasPosition, long position)
+ {
+ this.cursor = cursor;
+ this.assumeCommand = assumeCommand;
+ this.hasPositon = hasPosition;
+ this.position = position;
+ }
+
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- cursor = readString( buf );
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
{
- assumeCommand = buf.readBoolean();
+ transactionId = readVarInt( buf );
}
+ cursor = readString( buf );
- if ( hasPositon = buf.readBoolean() )
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
{
- position = buf.readLong();
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ {
+ assumeCommand = buf.readBoolean();
+ }
+
+ if ( hasPositon = buf.readBoolean() )
+ {
+ position = buf.readLong();
+ }
}
}
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- writeString( cursor, buf );
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
{
- buf.writeBoolean( assumeCommand );
+ writeVarInt( transactionId, buf );
}
+ writeString( cursor, buf );
- buf.writeBoolean( hasPositon );
- if ( hasPositon )
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
{
- buf.writeLong( position );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ {
+ buf.writeBoolean( assumeCommand );
+ }
+
+ buf.writeBoolean( hasPositon );
+ if ( hasPositon )
+ {
+ buf.writeLong( position );
+ }
}
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteResponse.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteResponse.java
index ebce9a6ae..e99ceb54b 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteResponse.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteResponse.java
@@ -2,32 +2,88 @@ package net.md_5.bungee.protocol.packet;
import net.md_5.bungee.protocol.DefinedPacket;
import io.netty.buffer.ByteBuf;
+import java.util.LinkedList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler;
+import net.md_5.bungee.protocol.ProtocolConstants;
@Data
@NoArgsConstructor
-@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class TabCompleteResponse extends DefinedPacket
{
+ private int transactionId;
+ private int start;
+ private int length;
+ private List matches;
private List commands;
- @Override
- public void read(ByteBuf buf)
+ public TabCompleteResponse(int transactionId, int start, int length, List matches)
{
- commands = readStringArray( buf );
+ this.transactionId = transactionId;
+ this.start = start;
+ this.length = length;
+ this.matches = matches;
+ }
+
+ public TabCompleteResponse(List commands)
+ {
+ this.commands = commands;
}
@Override
- public void write(ByteBuf buf)
+ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- writeStringArray( commands, buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ transactionId = readVarInt( buf );
+ start = readVarInt( buf );
+ length = readVarInt( buf );
+
+ int cnt = readVarInt( buf );
+ matches = new LinkedList<>();
+ for ( int i = 0; i < cnt; i++ )
+ {
+ String match = readString( buf );
+ String tooltip = buf.readBoolean() ? readString( buf ) : null;
+
+ matches.add( new CommandMatch( match, tooltip ) );
+ }
+ }
+
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
+ {
+ commands = readStringArray( buf );
+ }
+ }
+
+ @Override
+ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
+ {
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ writeVarInt( transactionId, buf );
+ writeVarInt( start, buf );
+ writeVarInt( length, buf );
+
+ writeVarInt( matches.size(), buf );
+ for ( CommandMatch match : matches )
+ {
+ writeString( match.match, buf );
+ buf.writeBoolean( match.tooltip != null );
+ writeString( match.tooltip, buf );
+ }
+ }
+
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
+ {
+ writeStringArray( commands, buf );
+ }
}
@Override
@@ -35,4 +91,14 @@ public class TabCompleteResponse extends DefinedPacket
{
handler.handle( this );
}
+
+ @Data
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public static class CommandMatch
+ {
+
+ private String match;
+ private String tooltip;
+ }
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java
index b47057995..f93508d90 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java
@@ -26,7 +26,7 @@ public class Team extends DefinedPacket
private String suffix;
private String nameTagVisibility;
private String collisionRule;
- private byte color;
+ private int color;
private byte friendlyFire;
private String[] players;
@@ -47,15 +47,23 @@ public class Team extends DefinedPacket
if ( mode == 0 || mode == 2 )
{
displayName = readString( buf );
- prefix = readString( buf );
- suffix = readString( buf );
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
+ {
+ prefix = readString( buf );
+ suffix = readString( buf );
+ }
friendlyFire = buf.readByte();
nameTagVisibility = readString( buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
collisionRule = readString( buf );
}
- color = buf.readByte();
+ color = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? readVarInt( buf ) : buf.readByte();
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ prefix = readString( buf );
+ suffix = readString( buf );
+ }
}
if ( mode == 0 || mode == 3 || mode == 4 )
{
@@ -76,15 +84,27 @@ public class Team extends DefinedPacket
if ( mode == 0 || mode == 2 )
{
writeString( displayName, buf );
- writeString( prefix, buf );
- writeString( suffix, buf );
+ if ( protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
+ {
+ writeString( prefix, buf );
+ writeString( suffix, buf );
+ }
buf.writeByte( friendlyFire );
writeString( nameTagVisibility, buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
writeString( collisionRule, buf );
}
- buf.writeByte( color );
+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ writeVarInt( color, buf );
+ writeString( prefix, buf );
+ writeString( suffix, buf );
+ } else
+ {
+ buf.writeByte( color );
+ }
}
if ( mode == 0 || mode == 3 || mode == 4 )
{
diff --git a/protocol/src/test/java/net/md_5/bungee/protocol/packet/PluginMessageTest.java b/protocol/src/test/java/net/md_5/bungee/protocol/packet/PluginMessageTest.java
new file mode 100644
index 000000000..754421693
--- /dev/null
+++ b/protocol/src/test/java/net/md_5/bungee/protocol/packet/PluginMessageTest.java
@@ -0,0 +1,17 @@
+package net.md_5.bungee.protocol.packet;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class PluginMessageTest
+{
+
+ @Test
+ public void testModerniseChannel()
+ {
+ Assert.assertEquals( "bungeecord:main", PluginMessage.MODERNISE.apply( "BungeeCord" ) );
+ Assert.assertEquals( "BungeeCord", PluginMessage.MODERNISE.apply( "bungeecord:main" ) );
+ Assert.assertEquals( "bungeecord:legacy/foo", PluginMessage.MODERNISE.apply( "FoO" ) );
+ Assert.assertEquals( "foo:bar", PluginMessage.MODERNISE.apply( "foo:bar" ) );
+ }
+}
diff --git a/proxy/pom.xml b/proxy/pom.xml
index dcd6e5c4e..6968ecb2b 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-proxy
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Proxy
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
index 2555348f0..8d6fc41e5 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -246,7 +246,6 @@ public class BungeeCord extends ProxyServer
*
* @throws Exception
*/
- @Override
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
public void start() throws Exception
{
@@ -616,8 +615,13 @@ public class BungeeCord extends ProxyServer
return Collections.unmodifiableCollection( pluginChannels );
}
- public PluginMessage registerChannels()
+ public PluginMessage registerChannels(int protocolVersion)
{
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ return new PluginMessage( "minecraft:register", Util.format( Iterables.transform( pluginChannels, PluginMessage.MODERNISE ), "\00" ).getBytes( Charsets.UTF_8 ), false );
+ }
+
return new PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes( Charsets.UTF_8 ), false );
}
diff --git a/proxy/src/main/java/net/md_5/bungee/PacketConstants.java b/proxy/src/main/java/net/md_5/bungee/PacketConstants.java
index 2747561b7..ea6aa6a8a 100644
--- a/proxy/src/main/java/net/md_5/bungee/PacketConstants.java
+++ b/proxy/src/main/java/net/md_5/bungee/PacketConstants.java
@@ -14,5 +14,4 @@ public class PacketConstants
{
0, 0, 0, 0, 0, 2
}, false );
- public static final PluginMessage I_AM_BUNGEE = new PluginMessage( "BungeeCord", new byte[ 0 ], false );
}
diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
index b34247ce4..d81cda980 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -6,6 +6,7 @@ import io.netty.buffer.ByteBufAllocator;
import java.util.Queue;
import java.util.Set;
import java.util.UUID;
+import java.util.logging.Level;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ChatColor;
@@ -30,7 +31,9 @@ import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.netty.HandlerBoss;
import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
+import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.Protocol;
+import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.Kick;
@@ -42,6 +45,7 @@ import net.md_5.bungee.protocol.packet.Respawn;
import net.md_5.bungee.protocol.packet.ScoreboardObjective;
import net.md_5.bungee.protocol.packet.ScoreboardScore;
import net.md_5.bungee.protocol.packet.SetCompression;
+import net.md_5.bungee.util.BufUtil;
@RequiredArgsConstructor
public class ServerConnector extends PacketHandler
@@ -118,6 +122,15 @@ public class ServerConnector extends PacketHandler
user.getPendingConnects().remove( target );
}
+ @Override
+ public void handle(PacketWrapper packet) throws Exception
+ {
+ if ( packet.packet == null )
+ {
+ throw new IllegalArgumentException( "Unexpected packet received during server login process!\n" + BufUtil.dump( packet.buf, 64 ) );
+ }
+ }
+
@Override
public void handle(LoginSuccess loginSuccess) throws Exception
{
@@ -162,7 +175,7 @@ public class ServerConnector extends PacketHandler
ServerConnectedEvent event = new ServerConnectedEvent( user, server );
bungee.getPluginManager().callEvent( event );
- ch.write( BungeeCord.getInstance().registerChannels() );
+ ch.write( BungeeCord.getInstance().registerChannels( user.getPendingConnection().getVersion() ) );
Queue packetQueue = target.getPacketQueue();
synchronized ( packetQueue )
{
@@ -201,7 +214,7 @@ public class ServerConnector extends PacketHandler
ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer();
DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")", brand );
- user.unsafe().sendPacket( new PluginMessage( "MC|Brand", DefinedPacket.toArray( brand ), handshakeHandler.isServerForge() ) );
+ user.unsafe().sendPacket( new PluginMessage( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand", DefinedPacket.toArray( brand ), handshakeHandler.isServerForge() ) );
brand.release();
user.setDimension( login.getDimension() );
@@ -213,7 +226,7 @@ public class ServerConnector extends PacketHandler
Scoreboard serverScoreboard = user.getServerSentScoreboard();
for ( Objective objective : serverScoreboard.getObjectives() )
{
- user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), objective.getType(), (byte) 1 ) );
+ user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), ScoreboardObjective.HealthDisplay.fromString( objective.getType() ), (byte) 1 ) );
}
for ( Score score : serverScoreboard.getScores() )
{
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 931f3f30d..842425bb3 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -30,6 +30,7 @@ import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.PacketWrapper;
+import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.BossBar;
import net.md_5.bungee.protocol.packet.KeepAlive;
import net.md_5.bungee.protocol.packet.PlayerListItem;
@@ -125,7 +126,7 @@ public class DownstreamBridge extends PacketHandler
switch ( objective.getAction() )
{
case 0:
- serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue(), objective.getType() ) );
+ serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue(), objective.getType().toString() ) );
break;
case 1:
serverScoreboard.removeObjective( objective.getName() );
@@ -135,7 +136,7 @@ public class DownstreamBridge extends PacketHandler
if ( oldObjective != null )
{
oldObjective.setValue( objective.getValue() );
- oldObjective.setType( objective.getType() );
+ oldObjective.setType( objective.getType().toString() );
}
break;
default:
@@ -231,7 +232,7 @@ public class DownstreamBridge extends PacketHandler
throw CancelSendSignal.INSTANCE;
}
- if ( pluginMessage.getTag().equals( "MC|Brand" ) )
+ if ( pluginMessage.getTag().equals( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand" ) )
{
ByteBuf brand = Unpooled.wrappedBuffer( pluginMessage.getData() );
String serverBrand = DefinedPacket.readString( brand );
@@ -476,6 +477,12 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(TabCompleteResponse tabCompleteResponse) throws Exception
{
+ if ( tabCompleteResponse.getCommands() == null )
+ {
+ // Passthrough on 1.13 style command responses - unclear of a sane way to process them at the moment, contributions welcome
+ return;
+ }
+
TabCompleteResponseEvent tabCompleteResponseEvent = new TabCompleteResponseEvent( server, con, tabCompleteResponse.getCommands() );
if ( !bungee.getPluginManager().callEvent( tabCompleteResponseEvent ).isCancelled() )
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
index 1c65e0020..e5d361e3c 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
@@ -57,6 +57,7 @@ import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.Kick;
import net.md_5.bungee.protocol.packet.LegacyHandshake;
import net.md_5.bungee.protocol.packet.LegacyPing;
+import net.md_5.bungee.protocol.packet.LoginPayloadResponse;
import net.md_5.bungee.protocol.packet.LoginRequest;
import net.md_5.bungee.protocol.packet.LoginSuccess;
import net.md_5.bungee.protocol.packet.PingPacket;
@@ -64,6 +65,7 @@ import net.md_5.bungee.protocol.packet.PluginMessage;
import net.md_5.bungee.protocol.packet.StatusRequest;
import net.md_5.bungee.protocol.packet.StatusResponse;
import net.md_5.bungee.util.BoundedArrayList;
+import net.md_5.bungee.util.BufUtil;
@RequiredArgsConstructor
public class InitialHandler extends PacketHandler implements PendingConnection
@@ -129,6 +131,15 @@ public class InitialHandler extends PacketHandler implements PendingConnection
disconnect( ChatColor.RED + Util.exception( t ) );
}
+ @Override
+ public void handle(PacketWrapper packet) throws Exception
+ {
+ if ( packet.packet == null )
+ {
+ throw new IllegalArgumentException( "Unexpected packet received during login process!\n" + BufUtil.dump( packet.buf, 64 ) );
+ }
+ }
+
@Override
public void handle(PluginMessage pluginMessage) throws Exception
{
@@ -532,6 +543,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
bungee.getPluginManager().callEvent( new LoginEvent( InitialHandler.this, complete ) );
}
+ @Override
+ public void handle(LoginPayloadResponse response) throws Exception
+ {
+ disconnect( "Unexpected custom LoginPayloadResponse" );
+ }
+
@Override
public void disconnect(String reason)
{
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java
index 3cd5cf696..76f496ce2 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java
@@ -13,10 +13,12 @@ import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.netty.PipelineUtils;
import net.md_5.bungee.protocol.MinecraftDecoder;
import net.md_5.bungee.protocol.MinecraftEncoder;
+import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.packet.Handshake;
import net.md_5.bungee.protocol.packet.StatusRequest;
import net.md_5.bungee.protocol.packet.StatusResponse;
+import net.md_5.bungee.util.BufUtil;
@RequiredArgsConstructor
public class PingHandler extends PacketHandler
@@ -48,6 +50,15 @@ public class PingHandler extends PacketHandler
callback.done( null, t );
}
+ @Override
+ public void handle(PacketWrapper packet) throws Exception
+ {
+ if ( packet.packet == null )
+ {
+ throw new IllegalArgumentException( "Unexpected packet received during ping process!\n" + BufUtil.dump( packet.buf, 64 ) );
+ }
+ }
+
@Override
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public void handle(StatusResponse statusResponse) throws Exception
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
index 92d22502f..99933dc87 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java
@@ -40,7 +40,7 @@ public class UpstreamBridge extends PacketHandler
BungeeCord.getInstance().addConnection( con );
con.getTabListHandler().onConnect();
- con.unsafe().sendPacket( BungeeCord.getInstance().registerChannels() );
+ con.unsafe().sendPacket( BungeeCord.getInstance().registerChannels( con.getPendingConnection().getVersion() ) );
}
@Override
@@ -167,7 +167,12 @@ public class UpstreamBridge extends PacketHandler
List results = tabCompleteEvent.getSuggestions();
if ( !results.isEmpty() )
{
- con.unsafe().sendPacket( new TabCompleteResponse( results ) );
+ // Unclear how to handle 1.13 commands at this point. Because we don't inject into the command packets we are unlikely to get this far unless
+ // Bungee plugins are adding results for commands they don't own anyway
+ if ( con.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_13 )
+ {
+ con.unsafe().sendPacket( new TabCompleteResponse( results ) );
+ }
throw CancelSendSignal.INSTANCE;
}
}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
index 847a3ecac..cae566f5e 100644
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java
@@ -47,6 +47,8 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_12_1:
case ProtocolConstants.MINECRAFT_1_12_2:
return EntityMap_1_12_1.INSTANCE;
+ case ProtocolConstants.MINECRAFT_1_13:
+ return EntityMap_1_13.INSTANCE;
}
throw new RuntimeException( "Version " + version + " has no entity map" );
}
@@ -76,11 +78,21 @@ public abstract class EntityMap
rewrite( packet, oldId, newId, serverboundInts, serverboundVarInts );
}
+ public void rewriteServerbound(ByteBuf packet, int oldId, int newId, int protocolVersion)
+ {
+ rewriteServerbound( packet, oldId, newId );
+ }
+
public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
{
rewrite( packet, oldId, newId, clientboundInts, clientboundVarInts );
}
+ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protocolVersion)
+ {
+ rewriteClientbound( packet, oldId, newId );
+ }
+
protected static void rewriteInt(ByteBuf packet, int oldId, int newId, int offset)
{
int readId = packet.getInt( offset );
@@ -111,6 +123,11 @@ public abstract class EntityMap
}
protected static void rewriteMetaVarInt(ByteBuf packet, int oldId, int newId, int metaIndex)
+ {
+ rewriteMetaVarInt( packet, oldId, newId, metaIndex, -1 );
+ }
+
+ protected static void rewriteMetaVarInt(ByteBuf packet, int oldId, int newId, int metaIndex, int protocolVersion)
{
int readerIndex = packet.readerIndex();
@@ -118,6 +135,37 @@ public abstract class EntityMap
while ( ( index = packet.readUnsignedByte() ) != 0xFF )
{
int type = DefinedPacket.readVarInt( packet );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ switch ( type )
+ {
+ case 5: // optional chat
+ if ( packet.readBoolean() )
+ {
+ DefinedPacket.readString( packet );
+ }
+ break;
+ case 14: // particle
+ int particleId = DefinedPacket.readVarInt( packet );
+ switch ( particleId )
+ {
+ case 3:
+ case 20:
+ DefinedPacket.readVarInt( packet ); // block state
+ break;
+ case 11: // dust
+ packet.skipBytes( 16 ); // float, float, float, flat
+ break;
+ case 27: // item
+ readSkipSlot( packet );
+ break;
+ }
+ break;
+ default:
+ type--;
+ break;
+ }
+ }
switch ( type )
{
@@ -141,24 +189,7 @@ public abstract class EntityMap
DefinedPacket.readString( packet );
break;
case 5:
- if ( packet.readShort() != -1 )
- {
- packet.skipBytes( 3 ); // byte, short
-
- int position = packet.readerIndex();
- if ( packet.readByte() != 0 )
- {
- packet.readerIndex( position );
-
- try
- {
- new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
- } catch ( IOException ex )
- {
- throw Throwables.propagate( ex );
- }
- }
- }
+ readSkipSlot( packet );
break;
case 6:
packet.skipBytes( 1 ); // boolean
@@ -204,6 +235,28 @@ public abstract class EntityMap
packet.readerIndex( readerIndex );
}
+ private static void readSkipSlot(ByteBuf packet)
+ {
+ if ( packet.readShort() != -1 )
+ {
+ packet.skipBytes( 3 ); // byte, short
+
+ int position = packet.readerIndex();
+ if ( packet.readByte() != 0 )
+ {
+ packet.readerIndex( position );
+
+ try
+ {
+ new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag();
+ } catch ( IOException ex )
+ {
+ throw Throwables.propagate( ex );
+ }
+ }
+ }
+ }
+
// Handles simple packets
private static void rewrite(ByteBuf packet, int oldId, int newId, boolean[] ints, boolean[] varints)
{
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java
new file mode 100644
index 000000000..3d474dbbc
--- /dev/null
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_13.java
@@ -0,0 +1,183 @@
+package net.md_5.bungee.entitymap;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import io.netty.buffer.ByteBuf;
+import net.md_5.bungee.BungeeCord;
+import net.md_5.bungee.UserConnection;
+import net.md_5.bungee.api.connection.ProxiedPlayer;
+import net.md_5.bungee.protocol.DefinedPacket;
+import net.md_5.bungee.protocol.ProtocolConstants;
+
+import java.util.UUID;
+
+class EntityMap_1_13 extends EntityMap
+{
+
+ static final EntityMap_1_13 INSTANCE = new EntityMap_1_13();
+
+ EntityMap_1_13()
+ {
+ addRewrite( 0x00, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Object : PacketPlayOutSpawnEntity
+ addRewrite( 0x01, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Experience Orb : PacketPlayOutSpawnEntityExperienceOrb
+ addRewrite( 0x03, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Mob : PacketPlayOutSpawnEntityLiving
+ addRewrite( 0x04, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Painting : PacketPlayOutSpawnEntityPainting
+ addRewrite( 0x05, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Player : PacketPlayOutNamedEntitySpawn
+ addRewrite( 0x06, ProtocolConstants.Direction.TO_CLIENT, true ); // Animation : PacketPlayOutAnimation
+ addRewrite( 0x08, ProtocolConstants.Direction.TO_CLIENT, true ); // Block Break Animation : PacketPlayOutBlockBreakAnimation
+ addRewrite( 0x1C, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Status : PacketPlayOutEntityStatus
+ addRewrite( 0x27, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity : PacketPlayOutEntity
+ addRewrite( 0x28, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Relative Move : PacketPlayOutRelEntityMove
+ addRewrite( 0x29, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look and Relative Move : PacketPlayOutRelEntityMoveLook
+ addRewrite( 0x2A, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look : PacketPlayOutEntityLook
+ addRewrite( 0x33, ProtocolConstants.Direction.TO_CLIENT, true ); // Use bed : PacketPlayOutBed
+ addRewrite( 0x36, ProtocolConstants.Direction.TO_CLIENT, true ); // Remove Entity Effect : PacketPlayOutRemoveEntityEffect
+ addRewrite( 0x39, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Head Look : PacketPlayOutEntityHeadRotation
+ addRewrite( 0x3C, ProtocolConstants.Direction.TO_CLIENT, true ); // Camera : PacketPlayOutCamera
+ addRewrite( 0x3F, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Metadata : PacketPlayOutEntityMetadata
+ addRewrite( 0x40, ProtocolConstants.Direction.TO_CLIENT, false ); // Attach Entity : PacketPlayOutAttachEntity
+ addRewrite( 0x41, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Velocity : PacketPlayOutEntityVelocity
+ addRewrite( 0x42, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Equipment : PacketPlayOutEntityEquipment
+ addRewrite( 0x46, ProtocolConstants.Direction.TO_CLIENT, true ); // Set Passengers : PacketPlayOutMount
+ addRewrite( 0x4F, ProtocolConstants.Direction.TO_CLIENT, true ); // Collect Item : PacketPlayOutCollect
+ addRewrite( 0x50, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Teleport : PacketPlayOutEntityTeleport
+ addRewrite( 0x52, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Properties : PacketPlayOutUpdateAttributes
+ addRewrite( 0x53, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Effect : PacketPlayOutEntityEffect
+
+ addRewrite( 0x0D, ProtocolConstants.Direction.TO_SERVER, true ); // Use Entity : PacketPlayInUseEntity
+ addRewrite( 0x19, ProtocolConstants.Direction.TO_SERVER, true ); // Entity Action : PacketPlayInEntityAction
+ }
+
+ @Override
+ @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
+ public void rewriteClientbound(ByteBuf packet, int oldId, int newId, int protocolVersion)
+ {
+ super.rewriteClientbound( packet, oldId, newId );
+
+ // Special cases
+ int readerIndex = packet.readerIndex();
+ int packetId = DefinedPacket.readVarInt( packet );
+ int packetIdLength = packet.readerIndex() - readerIndex;
+ int jumpIndex = packet.readerIndex();
+ switch ( packetId )
+ {
+ case 0x40 /* Attach Entity : PacketPlayOutAttachEntity */:
+ rewriteInt( packet, oldId, newId, readerIndex + packetIdLength + 4 );
+ break;
+ case 0x4F /* Collect Item : PacketPlayOutCollect */:
+ DefinedPacket.readVarInt( packet );
+ rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
+ break;
+ case 0x46 /* Set Passengers : PacketPlayOutMount */:
+ DefinedPacket.readVarInt( packet );
+ jumpIndex = packet.readerIndex();
+ // Fall through on purpose to int array of IDs
+ case 0x35 /* Destroy Entities : PacketPlayOutEntityDestroy */:
+ int count = DefinedPacket.readVarInt( packet );
+ int[] ids = new int[ count ];
+ for ( int i = 0; i < count; i++ )
+ {
+ ids[i] = DefinedPacket.readVarInt( packet );
+ }
+ packet.readerIndex( jumpIndex );
+ packet.writerIndex( jumpIndex );
+ DefinedPacket.writeVarInt( count, packet );
+ for ( int id : ids )
+ {
+ if ( id == oldId )
+ {
+ id = newId;
+ } else if ( id == newId )
+ {
+ id = oldId;
+ }
+ DefinedPacket.writeVarInt( id, packet );
+ }
+ break;
+ case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */:
+ DefinedPacket.readVarInt( packet );
+ DefinedPacket.readUUID( packet );
+ int type = packet.readUnsignedByte();
+
+ if ( type == 60 || type == 90 || type == 91 )
+ {
+ if ( type == 60 || type == 91 )
+ {
+ oldId = oldId + 1;
+ newId = newId + 1;
+ }
+
+ packet.skipBytes( 26 ); // double, double, double, byte, byte
+ int position = packet.readerIndex();
+ int readId = packet.readInt();
+ if ( readId == oldId )
+ {
+ packet.setInt( position, newId );
+ } else if ( readId == newId )
+ {
+ packet.setInt( position, oldId );
+ }
+ }
+ break;
+ case 0x05 /* Spawn Player : PacketPlayOutNamedEntitySpawn */:
+ DefinedPacket.readVarInt( packet ); // Entity ID
+ int idLength = packet.readerIndex() - readerIndex - packetIdLength;
+ UUID uuid = DefinedPacket.readUUID( packet );
+ ProxiedPlayer player;
+ if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null )
+ {
+ int previous = packet.writerIndex();
+ packet.readerIndex( readerIndex );
+ packet.writerIndex( readerIndex + packetIdLength + idLength );
+ DefinedPacket.writeUUID( player.getUniqueId(), packet );
+ packet.writerIndex( previous );
+ }
+ break;
+ case 0x2F /* Combat Event : PacketPlayOutCombatEvent */:
+ int event = packet.readUnsignedByte();
+ if ( event == 1 /* End Combat*/ )
+ {
+ DefinedPacket.readVarInt( packet );
+ rewriteInt( packet, oldId, newId, packet.readerIndex() );
+ } else if ( event == 2 /* Entity Dead */ )
+ {
+ int position = packet.readerIndex();
+ rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
+ packet.readerIndex( position );
+ DefinedPacket.readVarInt( packet );
+ rewriteInt( packet, oldId, newId, packet.readerIndex() );
+ }
+ break;
+ case 0x3F /* EntityMetadata : PacketPlayOutEntityMetadata */:
+ DefinedPacket.readVarInt( packet ); // Entity ID
+ rewriteMetaVarInt( packet, oldId + 1, newId + 1, 6, protocolVersion ); // fishing hook
+ rewriteMetaVarInt( packet, oldId, newId, 7, protocolVersion ); // fireworks (et al)
+ break;
+ }
+ packet.readerIndex( readerIndex );
+ }
+
+ @Override
+ public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
+ {
+ super.rewriteServerbound( packet, oldId, newId );
+ // Special cases
+ int readerIndex = packet.readerIndex();
+ int packetId = DefinedPacket.readVarInt( packet );
+ int packetIdLength = packet.readerIndex() - readerIndex;
+
+ if ( packetId == 0x28 /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() )
+ {
+ UUID uuid = DefinedPacket.readUUID( packet );
+ ProxiedPlayer player;
+ if ( ( player = BungeeCord.getInstance().getPlayer( uuid ) ) != null )
+ {
+ int previous = packet.writerIndex();
+ packet.readerIndex( readerIndex );
+ packet.writerIndex( readerIndex + packetIdLength );
+ DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet );
+ packet.writerIndex( previous );
+ }
+ }
+ packet.readerIndex( readerIndex );
+ }
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/util/BufUtil.java b/proxy/src/main/java/net/md_5/bungee/util/BufUtil.java
new file mode 100644
index 000000000..d765be111
--- /dev/null
+++ b/proxy/src/main/java/net/md_5/bungee/util/BufUtil.java
@@ -0,0 +1,15 @@
+package net.md_5.bungee.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+public class BufUtil
+{
+
+ public static String dump(ByteBuf buf, int maxLen)
+ {
+ return ByteBufUtil.hexDump( buf, 0, Math.min( buf.writerIndex(), maxLen ) );
+ }
+}
diff --git a/query/pom.xml b/query/pom.xml
index 9ecb2612b..fdd44b20e 100644
--- a/query/pom.xml
+++ b/query/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
../pom.xml
net.md-5
bungeecord-query
- 1.12-SNAPSHOT
+ 1.13-SNAPSHOT
jar
BungeeCord-Query