diff --git a/README.md b/README.md
index cd69390b53..540fb23f7f 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,11 @@ Most of them are, so get rid of 1.7 fast and move to 1.10.2/1.11.2 modpacks asap
This version is maintained by https://hexagonmc.eu
+<<<<<<< HEAD
###Releases can be downloaded here: [Releases](https://github.com/HexagonMC/BungeeCord/releases)
```
Modules are automatically downloaded from the releases page.
```
+=======
+(c) 2012-2018 SpigotMC Pty. Ltd.
+>>>>>>> 6fadb4250cb7f89feb2a98d9de973f6d627e33ae
diff --git a/api/pom.xml b/api/pom.xml
index 96a4673887..5432a6ebd4 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 11c5b68576..baae54f64b 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,14 +154,6 @@ public static void setInstance(ProxyServer instance)
*/
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
- */
- 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/Title.java b/api/src/main/java/net/md_5/bungee/api/Title.java
index 601518ba5d..4717f40de2 100644
--- a/api/src/main/java/net/md_5/bungee/api/Title.java
+++ b/api/src/main/java/net/md_5/bungee/api/Title.java
@@ -65,7 +65,7 @@ public interface Title
* duration specified in {@link #fadeOut(int)}. The default value for the
* official Minecraft version is 60 (3 seconds).
*
- * @param ticks The amount of ticks (1/20 second) for the fade in effect.
+ * @param ticks The amount of ticks (1/20 second) for the stay effect.
* @return This title configuration.
*/
public Title stay(int ticks);
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 e9f1ff6696..7b7c987f0e 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 a7334c87cd..333d39729e 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 enum MainHand
/**
* 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 06eb6d1af1..b4653403b2 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/plugin/PluginManager.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
index 71a5a15829..096538a7a7 100644
--- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
+++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java
@@ -147,7 +147,7 @@ public boolean dispatchCommand(CommandSender sender, String commandLine, List players = new HashSet<>();
public Collection getPlayers()
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 0de8409018..9ed450b0e1 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 970e309738..92f04c6205 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/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java b/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java
index 7f4ae5ca38..dfdc7bf0b1 100644
--- a/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java
+++ b/chat/src/main/java/net/md_5/bungee/api/chat/ComponentBuilder.java
@@ -166,6 +166,37 @@ public ComponentBuilder append(String text, FormatRetention retention)
return this;
}
+ /**
+ * Allows joining additional components to this builder using the given
+ * {@link Joiner} and {@link FormatRetention#ALL}.
+ *
+ * Simply executes the provided joiner on this instance to facilitate a
+ * chain pattern.
+ *
+ * @param joiner joiner used for operation
+ * @return this ComponentBuilder for chaining
+ */
+ public ComponentBuilder append(Joiner joiner)
+ {
+ return joiner.join( this, FormatRetention.ALL );
+ }
+
+ /**
+ * Allows joining additional components to this builder using the given
+ * {@link Joiner}.
+ *
+ * Simply executes the provided joiner on this instance to facilitate a
+ * chain pattern.
+ *
+ * @param joiner joiner used for operation
+ * @param retention the formatting to retain
+ * @return this ComponentBuilder for chaining
+ */
+ public ComponentBuilder append(Joiner joiner, FormatRetention retention)
+ {
+ return joiner.join( this, retention );
+ }
+
/**
* Sets the color of the current part.
*
@@ -332,4 +363,25 @@ public static enum FormatRetention
*/
ALL
}
+
+ /**
+ * Functional interface to join additional components to a ComponentBuilder.
+ */
+ public interface Joiner
+ {
+
+ /**
+ * Joins additional components to the provided {@link ComponentBuilder}
+ * and then returns it to fulfill a chain pattern.
+ *
+ * Retention may be ignored and is to be understood as an optional
+ * recommendation to the Joiner and not as a guarantee to have a
+ * previous component in builder unmodified.
+ *
+ * @param componentBuilder to which to append additional components
+ * @param retention the formatting to possibly retain
+ * @return input componentBuilder for chaining
+ */
+ ComponentBuilder join(ComponentBuilder componentBuilder, FormatRetention retention);
+ }
}
diff --git a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java
index 53ee9b0daf..16e8d2a462 100644
--- a/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java
+++ b/chat/src/main/java/net/md_5/bungee/api/chat/TranslatableComponent.java
@@ -71,12 +71,12 @@ public TranslatableComponent(String translate, Object... with)
List temp = new ArrayList();
for ( Object w : with )
{
- if ( w instanceof String )
+ if ( w instanceof BaseComponent )
{
- temp.add( new TextComponent( (String) w ) );
+ temp.add( (BaseComponent) w );
} else
{
- temp.add( (BaseComponent) w );
+ temp.add( new TextComponent( String.valueOf( w ) ) );
}
}
setWith( temp );
diff --git a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
index 0837c67299..2391c22f74 100644
--- a/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
+++ b/chat/src/test/java/net/md_5/bungee/api/chat/TranslatableComponentTest.java
@@ -9,7 +9,7 @@ public class TranslatableComponentTest
@Test
public void testMissingPlaceholdersAdded()
{
- TranslatableComponent testComponent = new TranslatableComponent( "Test string with %s placeholders: %s", "2", "aoeu" );
+ TranslatableComponent testComponent = new TranslatableComponent( "Test string with %s placeholders: %s", 2, "aoeu" );
assertEquals( "Test string with 2 placeholders: aoeu", testComponent.toPlainText() );
assertEquals( "§fTest string with §f2§f placeholders: §faoeu", testComponent.toLegacyText() );
}
diff --git a/config/pom.xml b/config/pom.xml
index 255270c629..4bb5af6949 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
@@ -22,7 +22,7 @@
org.yaml
snakeyaml
- 1.19
+ 1.21
compile
diff --git a/event/pom.xml b/event/pom.xml
index 6132e8e9f0..93c4aa3971 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 2fcbbad651..87b839adb4 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 220f042112..44d5b21ebe 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 928f63a816..e320447a21 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 689b83ee59..230af0cc40 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 e50a4becf3..23f9a02b8e 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 daf146dca4..0731bd8e23 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 aff2c070de..107cb0efbd 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 8e82446f7c..809cf79ccb 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/compile-native.sh b/native/compile-native.sh
old mode 100755
new mode 100644
diff --git a/native/pom.xml b/native/pom.xml
index 082f090859..15c0ada28f 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/native/src/main/resources/native-cipher.so b/native/src/main/resources/native-cipher.so
old mode 100755
new mode 100644
diff --git a/native/src/main/resources/native-compress.so b/native/src/main/resources/native-compress.so
old mode 100755
new mode 100644
diff --git a/pom.xml b/pom.xml
index 8fc01dfea0..9dfda69f39 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
@@ -101,7 +101,7 @@
org.projectlombok
lombok
- 1.18.0
+ 1.16.16
provided
diff --git a/protocol/pom.xml b/protocol/pom.xml
index bf4b399a58..ab9868bdf9 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 6f782c8fe3..93f324e29f 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.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 void handle(SetCompression setCompression) throws Exception
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/MinecraftDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
index 9c5d4da17f..ea44573d15 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/MinecraftDecoder.java
@@ -34,7 +34,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) t
if ( in.isReadable() )
{
- throw new BadPacketException( "Did not read all bytes from packet " + packet.getClass() + " " + packetId + " Protocol " + protocol + " Direction " + prot.getDirection().name() );
+ throw new BadPacketException( "Did not read all bytes from packet " + packet.getClass() + " " + packetId + " Protocol " + protocol + " Direction " + prot.getDirection() );
}
} else
{
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 7fd0eb7434..4474975a4a 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.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_CLIENT.registerPacket(
SetCompression.class,
@@ -166,35 +183,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 )
);
}
},
@@ -243,6 +265,10 @@ public enum Protocol
SetCompression.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x03 )
);
+ TO_CLIENT.registerPacket(
+ LoginPayloadRequest.class,
+ map( ProtocolConstants.MINECRAFT_1_13, 0x04 )
+ );
TO_SERVER.registerPacket(
LoginRequest.class,
@@ -252,6 +278,10 @@ public enum Protocol
EncryptionResponse.class,
map( ProtocolConstants.MINECRAFT_1_8, 0x01 )
);
+ TO_SERVER.registerPacket(
+ LoginPayloadResponse.class,
+ map( ProtocolConstants.MINECRAFT_1_13, 0x02 )
+ );
}
};
/*========================================================================*/
@@ -341,7 +371,8 @@ public static class DirectionData
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_8, Arrays.asList(
ProtocolConstants.MINECRAFT_1_7_2,
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,
@@ -441,7 +472,7 @@ final int getId(Class extends DefinedPacket> packet, int version)
{
throw new BadPacketException( "Unsupported protocol version" );
}
- Preconditions.checkArgument( protocolData.packetMap.containsKey( packet ), "Cannot get ID for packet " + packet );
+ Preconditions.checkArgument( protocolData.packetMap.containsKey( packet ), "Cannot get ID for packet %s in phase %s with direction %s", packet, protocolPhase, direction );
return protocolData.packetMap.get( packet );
}
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 4ed107f5c9..14f6c83d7e 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
@@ -18,13 +18,15 @@ 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 = 393;
public static final List SUPPORTED_VERSIONS = Arrays.asList(
"1.7.x",
"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(
@@ -40,7 +42,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 0000000000..a73f1bff08
--- /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 0000000000..962ea3b64a
--- /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 e4c35126c2..b6e71fb64a 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;
@@ -8,6 +9,7 @@
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;
@@ -23,12 +25,37 @@
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 "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;
}
};
//
@@ -43,14 +70,15 @@ public boolean apply(PluginMessage input)
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- tag = readString( buf );
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
{
+ tag = readString( buf );
data = readArrayLegacy( buf );
} else
{
+ 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);
+ Preconditions.checkArgument( buf.readableBytes() < maxSize );
data = new byte[ buf.readableBytes() ];
buf.readBytes( data );
}
@@ -59,12 +87,13 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- writeString( tag, buf );
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
{
+ writeString( tag, buf );
writeArrayLegacy( data, buf, allowExtendedPacket );
} else
{
+ 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 a650b48245..3449f2499e 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 @@
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.
*/
@@ -36,7 +37,13 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 && ( 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 ) );
+ }
}
}
@@ -52,7 +59,13 @@ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protoc
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 && ( 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 );
+ }
}
}
@@ -61,4 +74,21 @@ public void handle(AbstractPacketHandler handler) throws Exception
{
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 5234252aa1..e64f7c416e 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 @@
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,27 +10,46 @@
@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)
{
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 )
+ {
+ transactionId = readVarInt( buf );
+ }
+
cursor = readString( buf );
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 && protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
assumeCommand = buf.readBoolean();
}
-
if ( hasPositon = buf.readBoolean() )
{
position = buf.readLong();
@@ -42,14 +60,20 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13)
+ {
+ writeVarInt( transactionId, buf );
+ }
+
writeString( cursor, buf );
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
+
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 && protocolVersion < ProtocolConstants.MINECRAFT_1_13 )
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
buf.writeBoolean( assumeCommand );
}
-
+
buf.writeBoolean( hasPositon );
if ( hasPositon )
{
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 ebce9a6ae5..e99ceb54b1 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 @@
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;
+ public TabCompleteResponse(int transactionId, int start, int length, List matches)
+ {
+ this.transactionId = transactionId;
+ this.start = start;
+ this.length = length;
+ this.matches = matches;
+ }
+
+ public TabCompleteResponse(List commands)
+ {
+ this.commands = commands;
+ }
+
@Override
- public void read(ByteBuf buf)
+ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- commands = readStringArray( 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)
+ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
- writeStringArray( commands, buf );
+ 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 void handle(AbstractPacketHandler handler) throws Exception
{
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 a5247a8601..7e6929fa85 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,8 +47,11 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
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();
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
{
@@ -57,7 +60,12 @@ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protoco
{
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 )
@@ -79,8 +87,11 @@ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protoc
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 );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
{
@@ -89,7 +100,16 @@ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protoc
{
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 0000000000..00a897a273
--- /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( "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 dcd6e5c4e6..6968ecb2b4 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 b15ee8be6e..6c38fab0ba 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
@@ -138,7 +138,7 @@ public class BungeeCord extends ProxyServer
* Plugin manager.
*/
@Getter
- public final PluginManager pluginManager = new PluginManager( this );
+ public final PluginManager pluginManager;
@Getter
@Setter
private ReconnectHandler reconnectHandler;
@@ -179,12 +179,6 @@ public class BungeeCord extends ProxyServer
{
// TODO: Proper fallback when we interface the manager
- getPluginManager().registerCommand( null, new CommandReload() );
- getPluginManager().registerCommand( null, new CommandEnd() );
- getPluginManager().registerCommand( null, new CommandIP() );
- getPluginManager().registerCommand( null, new CommandBungee() );
- getPluginManager().registerCommand( null, new CommandPerms() );
-
registerChannel( "BungeeCord" );
}
@@ -229,6 +223,13 @@ public BungeeCord() throws IOException
System.setErr( new PrintStream( new LoggingOutputStream( logger, Level.SEVERE ), true ) );
System.setOut( new PrintStream( new LoggingOutputStream( logger, Level.INFO ), true ) );
+ pluginManager = new PluginManager( this );
+ getPluginManager().registerCommand( null, new CommandReload() );
+ getPluginManager().registerCommand( null, new CommandEnd() );
+ getPluginManager().registerCommand( null, new CommandIP() );
+ getPluginManager().registerCommand( null, new CommandBungee() );
+ getPluginManager().registerCommand( null, new CommandPerms() );
+
if ( !Boolean.getBoolean( "net.md_5.bungee.native.disable" ) )
{
if ( EncryptionUtil.nativeFactory.load() )
@@ -254,11 +255,9 @@ public BungeeCord() throws IOException
*
* @throws Exception
*/
- @Override
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
public void start() throws Exception
{
- System.setProperty( "java.net.preferIPv4Stack", "true" ); // Minecraft does not support IPv6
System.setProperty( "io.netty.selectorAutoRebuildThreshold", "0" ); // Seems to cause Bungee to stop accepting connections
if ( System.getProperty( "io.netty.leakDetectionLevel" ) == null )
{
@@ -282,7 +281,7 @@ public void start() throws Exception
registerChannel( ForgeConstants.FML_TAG );
registerChannel( ForgeConstants.FML_HANDSHAKE_TAG );
registerChannel( ForgeConstants.FORGE_REGISTER );
-
+
getLogger().warning( "MinecraftForge support is currently unmaintained and may have unresolved issues. Please use at your own risk." );
}
@@ -388,8 +387,14 @@ public void stop()
}
@Override
- public void stop(final String reason)
+ public synchronized void stop(final String reason)
{
+ if ( !isRunning )
+ {
+ return;
+ }
+ isRunning = false;
+
new Thread( "Shutdown Thread" )
{
@Override
@@ -397,8 +402,6 @@ public void stop(final String reason)
@SuppressWarnings("TooBroadCatch")
public void run()
{
- BungeeCord.this.isRunning = false;
-
stopListeners();
getLogger().info( "Closing pending connections" );
@@ -621,8 +624,13 @@ public Collection getChannels()
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/Metrics.java b/proxy/src/main/java/net/md_5/bungee/Metrics.java
index 95239878de..a7ce8d8247 100644
--- a/proxy/src/main/java/net/md_5/bungee/Metrics.java
+++ b/proxy/src/main/java/net/md_5/bungee/Metrics.java
@@ -21,7 +21,7 @@ public class Metrics extends TimerTask
/**
* The base url of the metrics domain
*/
- private static final String BASE_URL = "http://mcstats.org";
+ private static final String BASE_URL = "https://mcstats.spigotmc.org";
/**
* The url used to report a server's status
*/
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 2747561b7f..ea6aa6a8a1 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 9e41d8fa06..9112b9d107 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -9,6 +9,9 @@
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
+
+import java.util.logging.Level;
+
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ChatColor;
@@ -34,6 +37,7 @@
import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.MinecraftOutput;
+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;
@@ -47,6 +51,7 @@
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
@@ -122,6 +127,15 @@ public void disconnected(ChannelWrapper channel) throws Exception
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
{
@@ -157,13 +171,14 @@ public void handle(SetCompression setCompression) throws Exception
@Override
public void handle(Login login) throws Exception
{
- Preconditions.checkState(thisState == State.LOGIN, "Not expecting LOGIN");
-
- ServerConnection server = new ServerConnection(ch, target);
- ServerConnectedEvent event = new ServerConnectedEvent(user, server);
- bungee.getPluginManager().callEvent(event);
-
- ch.write(BungeeCord.getInstance().registerChannels());
+ Preconditions.checkState( thisState == State.LOGIN, "Not expecting LOGIN" );
+
+ ServerConnection server = new ServerConnection( ch, target );
+ ServerConnectedEvent event = new ServerConnectedEvent( user, server );
+ bungee.getPluginManager().callEvent( event );
+
+ ch.write( BungeeCord.getInstance().registerChannels( user.getPendingConnection().getVersion() ) );
+
Queue packetQueue = target.getPacketQueue();
synchronized (packetQueue)
{
@@ -217,9 +232,9 @@ public void handle(Login login) throws Exception
}
else
{
- ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer();
- DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")", brand );
- user.unsafe().sendPacket( new PluginMessage( "MC|Brand", DefinedPacket.toArray( brand ), handshakeHandler.isServerForge() ) );
+ ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer();
+ DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")", brand );
+ user.unsafe().sendPacket( new PluginMessage( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand", DefinedPacket.toArray( brand ), handshakeHandler.isServerForge() ) );
brand.release();
}
@@ -233,7 +248,7 @@ public void handle(Login login) throws Exception
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 86d0751e6e..b5dbef8c09 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
@@ -31,6 +31,7 @@
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;
@@ -98,8 +99,8 @@ public boolean shouldHandle(PacketWrapper packet) throws Exception
@Override
public void handle(PacketWrapper packet) throws Exception
{
- con.getEntityRewrite().rewriteClientbound(packet.buf, con.getServerEntityId(), con.getClientEntityId());
- con.sendPacket(packet);
+ con.getEntityRewrite().rewriteClientbound( packet.buf, con.getServerEntityId(), con.getClientEntityId(), con.getPendingConnection().getVersion() );
+ con.sendPacket( packet );
}
@Override
@@ -123,7 +124,7 @@ public void handle(ScoreboardObjective objective) throws Exception
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());
@@ -133,7 +134,7 @@ public void handle(ScoreboardObjective objective) throws Exception
if ( oldObjective != null )
{
oldObjective.setValue( objective.getValue() );
- oldObjective.setType( objective.getType() );
+ oldObjective.setType( objective.getType().toString() );
}
break;
default:
@@ -227,8 +228,8 @@ public void handle(PluginMessage pluginMessage) throws Exception
{
throw CancelSendSignal.INSTANCE;
}
-
- if (pluginMessage.getTag().equals("MC|Brand"))
+
+ if ( pluginMessage.getTag().equals( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand" ) )
{
if (con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8)
{
@@ -396,9 +397,22 @@ public void handle(PluginMessage pluginMessage) throws Exception
}
if (subChannel.equals("Message"))
{
- ProxiedPlayer target = bungee.getPlayer(in.readUTF());
- if (target != null)
- target.sendMessage(in.readUTF());
+ String target = in.readUTF();
+ String message = in.readUTF();
+ if ( target.equals( "ALL" ) )
+ {
+ for ( ProxiedPlayer player : bungee.getPlayers() )
+ {
+ player.sendMessage( message );
+ }
+ } else
+ {
+ ProxiedPlayer player = bungee.getPlayer( target );
+ if ( player != null )
+ {
+ player.sendMessage( message );
+ }
+ }
}
if (subChannel.equals("GetServer"))
{
@@ -480,6 +494,12 @@ public void handle(SetCompression setCompression) throws Exception
@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 0e497d9146..1c134a07a8 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.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.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 void exception(Throwable t) throws Exception
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
{
@@ -538,6 +549,12 @@ public void run()
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 ba3260f399..6f60ed5f97 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,11 +13,13 @@
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.ProtocolConstants;
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
@@ -49,6 +51,15 @@ public void exception(Throwable t) throws Exception
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 468e699900..bd942ac4bc 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 UpstreamBridge(ProxyServer bungee, UserConnection con)
BungeeCord.getInstance().addConnection( con );
con.getTabListHandler().onConnect();
- con.unsafe().sendPacket( BungeeCord.getInstance().registerChannels() );
+ con.unsafe().sendPacket( BungeeCord.getInstance().registerChannels( con.getPendingConnection().getVersion() ) );
}
@Override
@@ -112,7 +112,7 @@ public void handle(PacketWrapper packet) throws Exception
{
if ( con.getServer() != null )
{
- con.getEntityRewrite().rewriteServerbound( packet.buf, con.getClientEntityId(), con.getServerEntityId() );
+ con.getEntityRewrite().rewriteServerbound( packet.buf, con.getClientEntityId(), con.getServerEntityId(), con.getPendingConnection().getVersion() );
con.getServer().getCh().write( packet );
}
}
@@ -170,7 +170,12 @@ public void handle(TabCompleteRequest tabComplete) throws Exception
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 dc08926ff8..d3e410600a 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
@@ -51,6 +51,8 @@ public static EntityMap getEntityMap(int version)
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" );
}
@@ -80,11 +82,21 @@ public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
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 );
@@ -115,6 +127,11 @@ protected static void rewriteVarInt(ByteBuf packet, int oldId, int newId, int of
}
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();
@@ -122,6 +139,40 @@ protected static void rewriteMetaVarInt(ByteBuf packet, int oldId, int newId, in
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 );
+ }
+ continue;
+ case 15: // 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, protocolVersion );
+ break;
+ }
+ continue;
+ default:
+ if ( type >= 6 )
+ {
+ type--;
+ }
+ break;
+ }
+ }
switch ( type )
{
@@ -145,24 +196,7 @@ protected static void rewriteMetaVarInt(ByteBuf packet, int oldId, int newId, in
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, protocolVersion );
break;
case 6:
packet.skipBytes( 1 ); // boolean
@@ -208,6 +242,28 @@ protected static void rewriteMetaVarInt(ByteBuf packet, int oldId, int newId, in
packet.readerIndex( readerIndex );
}
+ private static void readSkipSlot(ByteBuf packet, int protocolVersion)
+ {
+ if ( packet.readShort() != -1 )
+ {
+ packet.skipBytes( ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? 1 : 3 ); // byte vs 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 0000000000..3d474dbbc7
--- /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 0000000000..d765be111c
--- /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/proxy/src/main/java/net/md_5/bungee/util/ChatComponentTransformer.java b/proxy/src/main/java/net/md_5/bungee/util/ChatComponentTransformer.java
index 2a711698d0..3457aaa7da 100644
--- a/proxy/src/main/java/net/md_5/bungee/util/ChatComponentTransformer.java
+++ b/proxy/src/main/java/net/md_5/bungee/util/ChatComponentTransformer.java
@@ -51,7 +51,7 @@ public static ChatComponentTransformer getInstance()
*/
public BaseComponent[] transform(ProxiedPlayer player, BaseComponent... component)
{
- if ( component == null || component.length < 1 )
+ if ( component == null || component.length < 1 || ( component.length == 1 && component[0] == null ) )
{
return new BaseComponent[]
{
diff --git a/query/pom.xml b/query/pom.xml
index 9ecb2612b7..fdd44b20e0 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