Compare commits

..

34 Commits

Author SHA1 Message Date
0106df2fba new event TabCompleteRequestEvent and deprecate TabCompleteEvent 2023-06-08 10:41:50 +02:00
a12f99d4b7 Add CommandsDeclareEvent to declare commands with brigadier API 2023-06-08 10:41:50 +02:00
b50cfdd435 Server branding now includes the backend server name 2023-06-08 10:41:50 +02:00
20d6422042 Multi-session with same Minecraft account with specific permission
Players with permission bungeecord.multiple_connect can have multiple connections with the same Minecraft account.
The UUID and player name is altered to avoid collision with other player:
UUID : xxxxxxxx-xxxx-VIxx-xxxx-xxxxxxxxxxxx
- The UUID version (V above) is now the provided version + 8 (for online player, it is 4, so it becomes C).
- The I digit will follow the index of the duplicated player : first duplicated player is 1, second one is 2.
- The name of the player will be the real player name, followed by the character "." (dot) followed by the duplication index.

Bedrock accounts connected using the Floodgate plugin will not be able to connect multiple times due to the risk of xUID collision.
2023-06-08 10:41:50 +02:00
2367e2240a Change projet configuration and POM for Pandacube 2023-06-08 10:41:50 +02:00
8227f8c052 Remove modules and startup delay
We don’t need them for Pandacube
2023-06-08 10:41:44 +02:00
md_5
68200133b6
Minecraft 1.20 support 2023-06-08 01:30:00 +10:00
dependabot[bot]
188d502c59
#3469: Bump netty-bom from 4.1.92.Final to 4.1.93.Final
Bumps [netty-bom](https://github.com/netty/netty) from 4.1.92.Final to 4.1.93.Final.
- [Commits](https://github.com/netty/netty/compare/netty-4.1.92.Final...netty-4.1.93.Final)

---
updated-dependencies:
- dependency-name: io.netty:netty-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-26 18:45:35 +10:00
dependabot[bot]
84ac683c1d
#3468: Bump lombok from 1.18.26 to 1.18.28
Bumps [lombok](https://github.com/projectlombok/lombok) from 1.18.26 to 1.18.28.
- [Release notes](https://github.com/projectlombok/lombok/releases)
- [Changelog](https://github.com/projectlombok/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/projectlombok/lombok/compare/v1.18.26...v1.18.28)

---
updated-dependencies:
- dependency-name: org.projectlombok:lombok
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-26 18:45:21 +10:00
dependabot[bot]
b418c94215
#3467: Bump maven-source-plugin from 3.2.1 to 3.3.0
Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.2.1 to 3.3.0.
- [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.2.1...maven-source-plugin-3.3.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-source-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-24 07:38:43 +10:00
dependabot[bot]
38e593a698
#3466: Bump maven-checkstyle-plugin from 3.2.2 to 3.3.0
Bumps [maven-checkstyle-plugin](https://github.com/apache/maven-checkstyle-plugin) from 3.2.2 to 3.3.0.
- [Commits](https://github.com/apache/maven-checkstyle-plugin/compare/maven-checkstyle-plugin-3.2.2...maven-checkstyle-plugin-3.3.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-checkstyle-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-24 07:38:27 +10:00
Janmm14
38028e8e90
#3455: Don't lock connections for offline uuid lookup when given uuid is not offline mode 2023-05-20 11:27:59 +10:00
md_5
3db27052a1
Bump maven-resolver dependencies 2023-05-20 11:13:38 +10:00
dependabot[bot]
e24f9223df
#3464: Bump maven-gpg-plugin from 3.0.1 to 3.1.0
Bumps [maven-gpg-plugin](https://github.com/apache/maven-gpg-plugin) from 3.0.1 to 3.1.0.
- [Commits](https://github.com/apache/maven-gpg-plugin/compare/maven-gpg-plugin-3.0.1...maven-gpg-plugin-3.1.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-gpg-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-20 11:09:14 +10:00
dependabot[bot]
9e5ed82c99
#3461: Bump netty-bom from 4.1.91.Final to 4.1.92.Final
Bumps [netty-bom](https://github.com/netty/netty) from 4.1.91.Final to 4.1.92.Final.
- [Release notes](https://github.com/netty/netty/releases)
- [Commits](https://github.com/netty/netty/compare/netty-4.1.91.Final...netty-4.1.92.Final)

---
updated-dependencies:
- dependency-name: io.netty:netty-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-30 12:43:52 +10:00
dependabot[bot]
606fa278c4
#3460: Bump maven-checkstyle-plugin from 3.2.1 to 3.2.2
Bumps [maven-checkstyle-plugin](https://github.com/apache/maven-checkstyle-plugin) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/apache/maven-checkstyle-plugin/releases)
- [Commits](https://github.com/apache/maven-checkstyle-plugin/compare/maven-checkstyle-plugin-3.2.1...maven-checkstyle-plugin-3.2.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-checkstyle-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-21 18:02:56 +10:00
md_5
7dd549ff1e
Add maven-enforcer-plugin for dependency convergence 2023-04-20 07:41:22 +10:00
md_5
3c12b04c98
Update dependabot.yml 2023-04-20 07:35:29 +10:00
dependabot[bot]
5545850f9d
#3459: Bump mysql-connector-j from 8.0.32 to 8.0.33
Bumps [mysql-connector-j](https://github.com/mysql/mysql-connector-j) from 8.0.32 to 8.0.33.
- [Release notes](https://github.com/mysql/mysql-connector-j/releases)
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.32...8.0.33)

---
updated-dependencies:
- dependency-name: com.mysql:mysql-connector-j
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-20 07:26:54 +10:00
dependabot[bot]
2f909b44d7
#3458: Bump maven-resolver-transport-http from 1.9.7 to 1.9.8
Bumps [maven-resolver-transport-http](https://github.com/apache/maven-resolver) from 1.9.7 to 1.9.8.
- [Release notes](https://github.com/apache/maven-resolver/releases)
- [Commits](https://github.com/apache/maven-resolver/compare/maven-resolver-1.9.7...maven-resolver-1.9.8)

---
updated-dependencies:
- dependency-name: org.apache.maven.resolver:maven-resolver-transport-http
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-20 07:26:41 +10:00
dependabot[bot]
ff155ebbb4
#3457: Bump maven-resolver-connector-basic from 1.9.7 to 1.9.8
Bumps [maven-resolver-connector-basic](https://github.com/apache/maven-resolver) from 1.9.7 to 1.9.8.
- [Release notes](https://github.com/apache/maven-resolver/releases)
- [Commits](https://github.com/apache/maven-resolver/compare/maven-resolver-1.9.7...maven-resolver-1.9.8)

---
updated-dependencies:
- dependency-name: org.apache.maven.resolver:maven-resolver-connector-basic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-20 07:26:26 +10:00
md_5
a0a4fa0e56
Add profile for Java 20 compilation of bootstrap 2023-04-07 09:55:01 +10:00
dependabot[bot]
1b76a26691
#3456: Bump netty-bom from 4.1.90.Final to 4.1.91.Final
Bumps [netty-bom](https://github.com/netty/netty) from 4.1.90.Final to 4.1.91.Final.
- [Release notes](https://github.com/netty/netty/releases)
- [Commits](https://github.com/netty/netty/compare/netty-4.1.90.Final...netty-4.1.91.Final)

---
updated-dependencies:
- dependency-name: io.netty:netty-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-07 09:01:03 +10:00
md_5
bd7bd2739a
Update Github actions to ubuntu-22.04 2023-04-04 07:20:07 +10:00
md_5
a7ad407f4b
Update dependencies 2023-04-02 14:08:27 +10:00
dependabot[bot]
931ff0fde6
#3452: Bump animal-sniffer-maven-plugin from 1.22 to 1.23
Bumps [animal-sniffer-maven-plugin](https://github.com/mojohaus/animal-sniffer) from 1.22 to 1.23.
- [Release notes](https://github.com/mojohaus/animal-sniffer/releases)
- [Commits](https://github.com/mojohaus/animal-sniffer/compare/animal-sniffer-parent-1.22...1.23)

---
updated-dependencies:
- dependency-name: org.codehaus.mojo:animal-sniffer-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-02 12:59:50 +10:00
md_5
dfd847f705
Update native libraries 2023-03-25 11:14:25 +11:00
md_5
a1fee720b9
Deprecate string join 2023-03-25 11:00:30 +11:00
md_5
963854f8d5
Remove use of internal gson API 2023-03-25 11:00:30 +11:00
Janmm14
2ef5e7004b
#3451: Improve length field prepending on bungee -> server connection
Use alternative implementation of Varint21LengthFieldPrepender on bungee -> server connection for improved speed - it uses separate buffer to prepend the length to avoid copying large data buffer.
Not applied bungee -> client because encrypting 1-5 bytes of length separately through expensive jni call could make it not worth (not measured).
2023-03-25 11:00:30 +11:00
Janmm14
2e6f0dd442
#3450: Use readRetainedSlice method instead of slice+retain+skip 2023-03-23 20:57:53 +11:00
Outfluencer
7790783949
#3436, #3441: Check if server icon image is null 2023-03-15 18:44:36 +11:00
md_5
f4534c8273
#3446: Fix < 1.19 support 2023-03-15 18:41:25 +11:00
md_5
76673f02a4
Apply dependabot configuration 2023-03-15 18:18:15 +11:00
33 changed files with 382 additions and 231 deletions

27
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,27 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 50
ignore:
# Synchronised with Minecraft
- dependency-name: "com.google.code.gson:gson"
# 9.x has performance issues (see, eg, checkstyle/checkstyle#10934) and 10.x is incompatible
- dependency-name: "com.puppycrawl.tools:checkstyle"
# Newer versions have issues, see #1909 and #2050
- dependency-name: "jline:jline"
# Needs to be synchronised with maven-resolver-provider dependencies
- dependency-name: "org.apache.maven.resolver:maven-resolver-connector-basic"
- dependency-name: "org.apache.maven.resolver:maven-resolver-transport-http"
# Used with maven-resolver dependencies; 2.0 update breaks other providers
- dependency-name: "org.slf4j:slf4j-api"
update-types: ["version-update:semver-major"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 50

View File

@ -4,7 +4,7 @@ on: [push, pull_request]
jobs: jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-api</artifactId> <artifactId>bungeecord-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-API</name> <name>BungeeCord-API</name>
@ -45,34 +45,33 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId> <artifactId>netty-transport-native-unix-common</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId> <artifactId>maven-resolver-provider</artifactId>
<version>3.8.5</version> <version>3.9.2</version>
<!-- not part of the API proper --> <!-- not part of the API proper -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.resolver</groupId> <groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId> <artifactId>maven-resolver-connector-basic</artifactId>
<version>1.7.3</version> <version>1.9.10</version>
<!-- not part of the API proper --> <!-- not part of the API proper -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.resolver</groupId> <groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId> <artifactId>maven-resolver-transport-http</artifactId>
<version>1.7.3</version> <version>1.9.10</version>
<!-- not part of the API proper --> <!-- not part of the API proper -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<version>1.33</version> <version>2.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -113,6 +113,16 @@ public class Util
return format( objects, ", " ); return format( objects, ", " );
} }
/**
* Returns a string of objects, each separated by a separator.
*
* @param objects the objects to join
* @param separators the separator
* @return joined string
* @see String#join(java.lang.CharSequence, java.lang.Iterable)
* @deprecated use {@link String} join methods
*/
@Deprecated
public static String format(Iterable<?> objects, String separators) public static String format(Iterable<?> objects, String separators)
{ {
return Joiner.on( separators ).join( objects ); return Joiner.on( separators ).join( objects );

View File

@ -1,9 +1,10 @@
package net.md_5.bungee.api; package net.md_5.bungee.api;
import com.google.common.base.Preconditions;
import com.google.common.io.BaseEncoding; import com.google.common.io.BaseEncoding;
import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapter;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter; import com.google.gson.stream.JsonWriter;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -26,13 +27,26 @@ public class Favicon
@Override @Override
public void write(JsonWriter out, Favicon value) throws IOException public void write(JsonWriter out, Favicon value) throws IOException
{ {
TypeAdapters.STRING.write( out, value == null ? null : value.getEncoded() ); if ( value == null )
{
out.nullValue();
} else
{
out.value( value.getEncoded() );
}
} }
@Override @Override
public Favicon read(JsonReader in) throws IOException public Favicon read(JsonReader in) throws IOException
{ {
String enc = TypeAdapters.STRING.read( in ); JsonToken peek = in.peek();
if ( peek == JsonToken.NULL )
{
in.nextNull();
return null;
}
String enc = in.nextString();
return enc == null ? null : create( enc ); return enc == null ? null : create( enc );
} }
}; };
@ -59,6 +73,7 @@ public class Favicon
*/ */
public static Favicon create(BufferedImage image) public static Favicon create(BufferedImage image)
{ {
Preconditions.checkArgument( image != null, "image is null" );
// check size // check size
if ( image.getWidth() != 64 || image.getHeight() != 64 ) if ( image.getWidth() != 64 || image.getHeight() != 64 )
{ {

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-bootstrap</artifactId> <artifactId>bungeecord-bootstrap</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Bootstrap</name> <name>BungeeCord-Bootstrap</name>
@ -96,5 +96,14 @@
<maven.compiler.release>7</maven.compiler.release> <maven.compiler.release>7</maven.compiler.release>
</properties> </properties>
</profile> </profile>
<profile>
<id>jdk-20-release</id>
<activation>
<jdk>[20,)</jdk>
</activation>
<properties>
<maven.compiler.release>8</maven.compiler.release>
</properties>
</profile>
</profiles> </profiles>
</project> </project>

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-chat</artifactId> <artifactId>bungeecord-chat</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Chat</name> <name>BungeeCord-Chat</name>

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-config</artifactId> <artifactId>bungeecord-config</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Config</name> <name>BungeeCord-Config</name>
@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<version>1.33</version> <version>2.0</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-event</artifactId> <artifactId>bungeecord-event</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Event</name> <name>BungeeCord-Event</name>

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-log</artifactId> <artifactId>bungeecord-log</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Log</name> <name>BungeeCord-Log</name>

@ -1 +1 @@
Subproject commit 8df2f8e7b9c7bb9390ac74bb7bace27edca81a2b Subproject commit 8c89224991adff88d53cd380f42a2baa36f91454

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-native</artifactId> <artifactId>bungeecord-native</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Native</name> <name>BungeeCord-Native</name>
@ -21,7 +21,6 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId> <artifactId>netty-transport</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

@ -1 +1 @@
Subproject commit 959b4ea305821e753385e873ec4edfaa9a5d49b7 Subproject commit 4e4e4c4fbdad9dd034d8f05e2312bf845f0d4d15

49
pom.xml
View File

@ -5,7 +5,7 @@
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>BungeeCord-Parent</name> <name>BungeeCord-Parent</name>
@ -71,13 +71,23 @@
<properties> <properties>
<build.number>unknown</build.number> <build.number>unknown</build.number>
<lombok.version>1.18.26</lombok.version> <lombok.version>1.18.28</lombok.version>
<netty.version>4.1.85.Final</netty.version>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>4.1.93.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -131,7 +141,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.1</version> <version>3.3.0</version>
<executions> <executions>
<execution> <execution>
<phase>process-classes</phase> <phase>process-classes</phase>
@ -156,7 +166,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId> <artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.22</version> <version>1.23</version>
<executions> <executions>
<execution> <execution>
<phase>process-classes</phase> <phase>process-classes</phase>
@ -173,6 +183,31 @@
</signature> </signature>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<dependencyConvergence>
<excludes>
<!-- org.apache.maven:maven-resolver-provider is inconsistent -->
<exclude>org.apache.commons:commons-lang3</exclude>
<!-- org.apache.maven:maven-resolver-transport-http is inconsistent -->
<exclude>org.apache.httpcomponents:httpcore</exclude>
</excludes>
</dependencyConvergence>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
@ -231,7 +266,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version> <version>3.3.0</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -307,7 +342,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version> <version>3.1.0</version>
<executions> <executions>
<execution> <execution>
<phase>verify</phase> <phase>verify</phase>

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-protocol</artifactId> <artifactId>bungeecord-protocol</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Protocol</name> <name>BungeeCord-Protocol</name>
@ -48,7 +48,6 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId> <artifactId>netty-codec</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -42,6 +42,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_19_1 = 760; public static final int MINECRAFT_1_19_1 = 760;
public static final int MINECRAFT_1_19_3 = 761; public static final int MINECRAFT_1_19_3 = 761;
public static final int MINECRAFT_1_19_4 = 762; public static final int MINECRAFT_1_19_4 = 762;
public static final int MINECRAFT_1_20 = 763;
public static final List<String> SUPPORTED_VERSIONS; public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS; public static final List<Integer> SUPPORTED_VERSION_IDS;
@ -59,7 +60,8 @@ public class ProtocolConstants
"1.16.x", "1.16.x",
"1.17.x", "1.17.x",
"1.18.x", "1.18.x",
"1.19.x" "1.19.x",
"1.20.x"
); );
ImmutableList.Builder<Integer> supportedVersionIds = ImmutableList.<Integer>builder().add( ImmutableList.Builder<Integer> supportedVersionIds = ImmutableList.<Integer>builder().add(
ProtocolConstants.MINECRAFT_1_8, ProtocolConstants.MINECRAFT_1_8,
@ -96,13 +98,14 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_19, ProtocolConstants.MINECRAFT_1_19,
ProtocolConstants.MINECRAFT_1_19_1, ProtocolConstants.MINECRAFT_1_19_1,
ProtocolConstants.MINECRAFT_1_19_3, ProtocolConstants.MINECRAFT_1_19_3,
ProtocolConstants.MINECRAFT_1_19_4 ProtocolConstants.MINECRAFT_1_19_4,
ProtocolConstants.MINECRAFT_1_20
); );
if ( SNAPSHOT_SUPPORT ) if ( SNAPSHOT_SUPPORT )
{ {
// supportedVersions.add( "1.19.x" ); // supportedVersions.add( "1.20.x" );
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_19 ); // supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_20 );
} }
SUPPORTED_VERSIONS = supportedVersions.build(); SUPPORTED_VERSIONS = supportedVersions.build();

View File

@ -53,8 +53,7 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
{ {
if ( in.hasMemoryAddress() ) if ( in.hasMemoryAddress() )
{ {
out.add( in.slice( in.readerIndex(), length ).retain() ); out.add( in.readRetainedSlice( length ) );
in.skipBytes( length );
} else } else
{ {
if ( !DIRECT_WARNING ) if ( !DIRECT_WARNING )

View File

@ -0,0 +1,25 @@
package net.md_5.bungee.protocol;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import java.util.List;
/**
* Prepend length of the message as a Varint21 using an extra buffer for the length, avoiding copying packet data
*/
@ChannelHandler.Sharable
public class Varint21LengthFieldExtraBufPrepender extends MessageToMessageEncoder<ByteBuf>
{
@Override
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception
{
int bodyLen = msg.readableBytes();
ByteBuf lenBuf = ctx.alloc().ioBuffer( Varint21LengthFieldPrepender.varintSize( bodyLen ) );
DefinedPacket.writeVarInt( bodyLen, lenBuf );
out.add( lenBuf );
out.add( msg.retain() );
}
}

View File

@ -5,6 +5,9 @@ import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder; import io.netty.handler.codec.MessageToByteEncoder;
/**
* Prepend length of the message as a Varint21 by writing length and data to a new buffer
*/
@ChannelHandler.Sharable @ChannelHandler.Sharable
public class Varint21LengthFieldPrepender extends MessageToByteEncoder<ByteBuf> public class Varint21LengthFieldPrepender extends MessageToByteEncoder<ByteBuf>
{ {
@ -20,7 +23,7 @@ public class Varint21LengthFieldPrepender extends MessageToByteEncoder<ByteBuf>
out.writeBytes( msg ); out.writeBytes( msg );
} }
private static int varintSize(int paramInt) static int varintSize(int paramInt)
{ {
if ( ( paramInt & 0xFFFFFF80 ) == 0 ) if ( ( paramInt & 0xFFFFFF80 ) == 0 )
{ {

View File

@ -651,176 +651,167 @@ public class Commands extends DefinedPacket
register( "minecraft:item_enchantment", VOID ); register( "minecraft:item_enchantment", VOID );
register( "minecraft:entity_summon", VOID ); register( "minecraft:entity_summon", VOID );
register( "minecraft:dimension", VOID ); register( "minecraft:dimension", VOID );
register( "minecraft:time_legacy", VOID ); // 1.14 register( "minecraft:time", VOID ); // 1.14
register( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2 register( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2
register( "minecraft:resource", RAW_STRING ); // 1.18.2 register( "minecraft:resource", RAW_STRING ); // 1.18.2
register( "minecraft:template_mirror", VOID ); // 1.19
register( "minecraft:template_rotation", VOID ); // 1.19
register( "minecraft:uuid", VOID ); // 1.16 register( "minecraft:uuid", VOID ); // 1.16
register( "minecraft:gamemode", VOID ); // 1.19.3
register( "minecraft:resource_or_tag_key", RAW_STRING ); // 1.19.3
register( "minecraft:resource_key", RAW_STRING ); // 1.19.3
register( "minecraft:heightmap", VOID ); // 1.19.4
register( "minecraft:time", INTEGER ); // 1.19.4
register( "minecraft:nbt", VOID ); // 1.13 // removed register( "minecraft:nbt", VOID ); // 1.13 // removed
IDS_1_19 = new ArgumentSerializer[] IDS_1_19 = new ArgumentSerializer[]
{ {
get( "brigadier:bool" ), get( "brigadier:bool", VOID ),
get( "brigadier:float" ), get( "brigadier:float", FLOAT_RANGE ),
get( "brigadier:double" ), get( "brigadier:double", DOUBLE_RANGE ),
get( "brigadier:integer" ), get( "brigadier:integer", INTEGER_RANGE ),
get( "brigadier:long" ), get( "brigadier:long", LONG_RANGE ),
get( "brigadier:string" ), get( "brigadier:string", STRING ),
get( "minecraft:entity" ), get( "minecraft:entity", BYTE ),
get( "minecraft:game_profile" ), get( "minecraft:game_profile", VOID ),
get( "minecraft:block_pos" ), get( "minecraft:block_pos", VOID ),
get( "minecraft:column_pos" ), get( "minecraft:column_pos", VOID ),
get( "minecraft:vec3" ), get( "minecraft:vec3", VOID ),
get( "minecraft:vec2" ), get( "minecraft:vec2", VOID ),
get( "minecraft:block_state" ), get( "minecraft:block_state", VOID ),
get( "minecraft:block_predicate" ), get( "minecraft:block_predicate", VOID ),
get( "minecraft:item_stack" ), get( "minecraft:item_stack", VOID ),
get( "minecraft:item_predicate" ), get( "minecraft:item_predicate", VOID ),
get( "minecraft:color" ), get( "minecraft:color", VOID ),
get( "minecraft:component" ), get( "minecraft:component", VOID ),
get( "minecraft:message" ), get( "minecraft:message", VOID ),
get( "minecraft:nbt_compound_tag" ), get( "minecraft:nbt_compound_tag", VOID ),
get( "minecraft:nbt_tag" ), get( "minecraft:nbt_tag", VOID ),
get( "minecraft:nbt_path" ), get( "minecraft:nbt_path", VOID ),
get( "minecraft:objective" ), get( "minecraft:objective", VOID ),
get( "minecraft:objective_criteria" ), get( "minecraft:objective_criteria", VOID ),
get( "minecraft:operation" ), get( "minecraft:operation", VOID ),
get( "minecraft:particle" ), get( "minecraft:particle", VOID ),
get( "minecraft:angle" ), get( "minecraft:angle", VOID ),
get( "minecraft:rotation" ), get( "minecraft:rotation", VOID ),
get( "minecraft:scoreboard_slot" ), get( "minecraft:scoreboard_slot", VOID ),
get( "minecraft:score_holder" ), get( "minecraft:score_holder", BYTE ),
get( "minecraft:swizzle" ), get( "minecraft:swizzle", VOID ),
get( "minecraft:team" ), get( "minecraft:team", VOID ),
get( "minecraft:item_slot" ), get( "minecraft:item_slot", VOID ),
get( "minecraft:resource_location" ), get( "minecraft:resource_location", VOID ),
get( "minecraft:mob_effect" ), get( "minecraft:mob_effect", VOID ),
get( "minecraft:function" ), get( "minecraft:function", VOID ),
get( "minecraft:entity_anchor" ), get( "minecraft:entity_anchor", VOID ),
get( "minecraft:int_range" ), get( "minecraft:int_range", VOID ),
get( "minecraft:float_range" ), get( "minecraft:float_range", VOID ),
get( "minecraft:item_enchantment" ), get( "minecraft:item_enchantment", VOID ),
get( "minecraft:entity_summon" ), get( "minecraft:entity_summon", VOID ),
get( "minecraft:dimension" ), get( "minecraft:dimension", VOID ),
get( "minecraft:time_legacy" ), get( "minecraft:time", VOID ),
get( "minecraft:resource_or_tag" ), get( "minecraft:resource_or_tag", RAW_STRING ),
get( "minecraft:resource" ), get( "minecraft:resource", RAW_STRING ),
get( "minecraft:template_mirror" ), get( "minecraft:template_mirror", VOID ),
get( "minecraft:template_rotation" ), get( "minecraft:template_rotation", VOID ),
get( "minecraft:uuid" ) get( "minecraft:uuid", VOID ),
}; };
IDS_1_19_3 = new ArgumentSerializer[] IDS_1_19_3 = new ArgumentSerializer[]
{ {
get( "brigadier:bool" ), get( "brigadier:bool", VOID ),
get( "brigadier:float" ), get( "brigadier:float", FLOAT_RANGE ),
get( "brigadier:double" ), get( "brigadier:double", DOUBLE_RANGE ),
get( "brigadier:integer" ), get( "brigadier:integer", INTEGER_RANGE ),
get( "brigadier:long" ), get( "brigadier:long", LONG_RANGE ),
get( "brigadier:string" ), get( "brigadier:string", STRING ),
get( "minecraft:entity" ), get( "minecraft:entity", BYTE ),
get( "minecraft:game_profile" ), get( "minecraft:game_profile", VOID ),
get( "minecraft:block_pos" ), get( "minecraft:block_pos", VOID ),
get( "minecraft:column_pos" ), get( "minecraft:column_pos", VOID ),
get( "minecraft:vec3" ), get( "minecraft:vec3", VOID ),
get( "minecraft:vec2" ), get( "minecraft:vec2", VOID ),
get( "minecraft:block_state" ), get( "minecraft:block_state", VOID ),
get( "minecraft:block_predicate" ), get( "minecraft:block_predicate", VOID ),
get( "minecraft:item_stack" ), get( "minecraft:item_stack", VOID ),
get( "minecraft:item_predicate" ), get( "minecraft:item_predicate", VOID ),
get( "minecraft:color" ), get( "minecraft:color", VOID ),
get( "minecraft:component" ), get( "minecraft:component", VOID ),
get( "minecraft:message" ), get( "minecraft:message", VOID ),
get( "minecraft:nbt_compound_tag" ), get( "minecraft:nbt_compound_tag", VOID ),
get( "minecraft:nbt_tag" ), get( "minecraft:nbt_tag", VOID ),
get( "minecraft:nbt_path" ), get( "minecraft:nbt_path", VOID ),
get( "minecraft:objective" ), get( "minecraft:objective", VOID ),
get( "minecraft:objective_criteria" ), get( "minecraft:objective_criteria", VOID ),
get( "minecraft:operation" ), get( "minecraft:operation", VOID ),
get( "minecraft:particle" ), get( "minecraft:particle", VOID ),
get( "minecraft:angle" ), get( "minecraft:angle", VOID ),
get( "minecraft:rotation" ), get( "minecraft:rotation", VOID ),
get( "minecraft:scoreboard_slot" ), get( "minecraft:scoreboard_slot", VOID ),
get( "minecraft:score_holder" ), get( "minecraft:score_holder", BYTE ),
get( "minecraft:swizzle" ), get( "minecraft:swizzle", VOID ),
get( "minecraft:team" ), get( "minecraft:team", VOID ),
get( "minecraft:item_slot" ), get( "minecraft:item_slot", VOID ),
get( "minecraft:resource_location" ), get( "minecraft:resource_location", VOID ),
get( "minecraft:function" ), get( "minecraft:function", VOID ),
get( "minecraft:entity_anchor" ), get( "minecraft:entity_anchor", VOID ),
get( "minecraft:int_range" ), get( "minecraft:int_range", VOID ),
get( "minecraft:float_range" ), get( "minecraft:float_range", VOID ),
get( "minecraft:dimension" ), get( "minecraft:dimension", VOID ),
get( "minecraft:gamemode" ), get( "minecraft:gamemode", VOID ),
get( "minecraft:time_legacy" ), get( "minecraft:time", VOID ),
get( "minecraft:resource_or_tag" ), get( "minecraft:resource_or_tag", RAW_STRING ),
get( "minecraft:resource_or_tag_key" ), get( "minecraft:resource_or_tag_key", RAW_STRING ),
get( "minecraft:resource" ), get( "minecraft:resource", RAW_STRING ),
get( "minecraft:resource_key" ), get( "minecraft:resource_key", RAW_STRING ),
get( "minecraft:template_mirror" ), get( "minecraft:template_mirror", VOID ),
get( "minecraft:template_rotation" ), get( "minecraft:template_rotation", VOID ),
get( "minecraft:uuid" ) get( "minecraft:uuid", VOID )
}; };
IDS_1_19_4 = new ArgumentSerializer[] IDS_1_19_4 = new ArgumentSerializer[]
{ {
get( "brigadier:bool" ), get( "brigadier:bool", VOID ),
get( "brigadier:float" ), get( "brigadier:float", FLOAT_RANGE ),
get( "brigadier:double" ), get( "brigadier:double", DOUBLE_RANGE ),
get( "brigadier:integer" ), get( "brigadier:integer", INTEGER_RANGE ),
get( "brigadier:long" ), get( "brigadier:long", LONG_RANGE ),
get( "brigadier:string" ), get( "brigadier:string", STRING ),
get( "minecraft:entity" ), get( "minecraft:entity", BYTE ),
get( "minecraft:game_profile" ), get( "minecraft:game_profile", VOID ),
get( "minecraft:block_pos" ), get( "minecraft:block_pos", VOID ),
get( "minecraft:column_pos" ), get( "minecraft:column_pos", VOID ),
get( "minecraft:vec3" ), get( "minecraft:vec3", VOID ),
get( "minecraft:vec2" ), get( "minecraft:vec2", VOID ),
get( "minecraft:block_state" ), get( "minecraft:block_state", VOID ),
get( "minecraft:block_predicate" ), get( "minecraft:block_predicate", VOID ),
get( "minecraft:item_stack" ), get( "minecraft:item_stack", VOID ),
get( "minecraft:item_predicate" ), get( "minecraft:item_predicate", VOID ),
get( "minecraft:color" ), get( "minecraft:color", VOID ),
get( "minecraft:component" ), get( "minecraft:component", VOID ),
get( "minecraft:message" ), get( "minecraft:message", VOID ),
get( "minecraft:nbt_compound_tag" ), get( "minecraft:nbt_compound_tag", VOID ),
get( "minecraft:nbt_tag" ), get( "minecraft:nbt_tag", VOID ),
get( "minecraft:nbt_path" ), get( "minecraft:nbt_path", VOID ),
get( "minecraft:objective" ), get( "minecraft:objective", VOID ),
get( "minecraft:objective_criteria" ), get( "minecraft:objective_criteria", VOID ),
get( "minecraft:operation" ), get( "minecraft:operation", VOID ),
get( "minecraft:particle" ), get( "minecraft:particle", VOID ),
get( "minecraft:angle" ), get( "minecraft:angle", VOID ),
get( "minecraft:rotation" ), get( "minecraft:rotation", VOID ),
get( "minecraft:scoreboard_slot" ), get( "minecraft:scoreboard_slot", VOID ),
get( "minecraft:score_holder" ), get( "minecraft:score_holder", BYTE ),
get( "minecraft:swizzle" ), get( "minecraft:swizzle", VOID ),
get( "minecraft:team" ), get( "minecraft:team", VOID ),
get( "minecraft:item_slot" ), get( "minecraft:item_slot", VOID ),
get( "minecraft:resource_location" ), get( "minecraft:resource_location", VOID ),
get( "minecraft:function" ), get( "minecraft:function", VOID ),
get( "minecraft:entity_anchor" ), get( "minecraft:entity_anchor", VOID ),
get( "minecraft:int_range" ), get( "minecraft:int_range", VOID ),
get( "minecraft:float_range" ), get( "minecraft:float_range", VOID ),
get( "minecraft:dimension" ), get( "minecraft:dimension", VOID ),
get( "minecraft:gamemode" ), get( "minecraft:gamemode", VOID ),
get( "minecraft:time" ), get( "minecraft:time", INTEGER ),
get( "minecraft:resource_or_tag" ), get( "minecraft:resource_or_tag", RAW_STRING ),
get( "minecraft:resource_or_tag_key" ), get( "minecraft:resource_or_tag_key", RAW_STRING ),
get( "minecraft:resource" ), get( "minecraft:resource", RAW_STRING ),
get( "minecraft:resource_key" ), get( "minecraft:resource_key", RAW_STRING ),
get( "minecraft:template_mirror" ), get( "minecraft:template_mirror", VOID ),
get( "minecraft:template_rotation" ), get( "minecraft:template_rotation", VOID ),
get( "minecraft:uuid" ), get( "minecraft:uuid", VOID ),
get( "minecraft:heightmap" ) get( "minecraft:heightmap", VOID )
}; };
} }
@ -829,9 +820,9 @@ public class Commands extends DefinedPacket
PROVIDERS.put( name, serializer ); PROVIDERS.put( name, serializer );
} }
private static ArgumentSerializer get(String name) private static ArgumentSerializer get(String name, ArgumentSerializer serializer)
{ {
return PROVIDERS.get( name ); return serializer;
} }
/** /**

View File

@ -39,6 +39,7 @@ public class Login extends DefinedPacket
private boolean debug; private boolean debug;
private boolean flat; private boolean flat;
private Location deathLocation; private Location deathLocation;
private int portalCooldown;
@Override @Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
@ -127,6 +128,10 @@ public class Login extends DefinedPacket
deathLocation = new Location( readString( buf ), buf.readLong() ); deathLocation = new Location( readString( buf ), buf.readLong() );
} }
} }
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
portalCooldown = readVarInt( buf );
}
} }
@Override @Override
@ -220,6 +225,10 @@ public class Login extends DefinedPacket
buf.writeBoolean( false ); buf.writeBoolean( false );
} }
} }
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
writeVarInt( portalCooldown, buf );
}
} }
@Override @Override

View File

@ -29,6 +29,7 @@ public class Respawn extends DefinedPacket
private boolean flat; private boolean flat;
private boolean copyMeta; private boolean copyMeta;
private Location deathLocation; private Location deathLocation;
private int portalCooldown;
@Override @Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
@ -73,6 +74,10 @@ public class Respawn extends DefinedPacket
deathLocation = new Location( readString( buf ), buf.readLong() ); deathLocation = new Location( readString( buf ), buf.readLong() );
} }
} }
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
portalCooldown = readVarInt( buf );
}
} }
@Override @Override
@ -123,6 +128,10 @@ public class Respawn extends DefinedPacket
buf.writeBoolean( false ); buf.writeBoolean( false );
} }
} }
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20 )
{
writeVarInt( portalCooldown, buf );
}
} }
@Override @Override

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-proxy</artifactId> <artifactId>bungeecord-proxy</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Proxy</name> <name>BungeeCord-Proxy</name>
@ -26,32 +26,27 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec-haproxy</artifactId> <artifactId>netty-codec-haproxy</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId> <artifactId>netty-codec-http</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId> <artifactId>netty-handler</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId> <artifactId>netty-transport-native-epoll</artifactId>
<version>${netty.version}</version>
<classifier>linux-x86_64</classifier> <classifier>linux-x86_64</classifier>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId> <artifactId>netty-transport-native-epoll</artifactId>
<version>${netty.version}</version>
<classifier>linux-aarch_64</classifier> <classifier>linux-aarch_64</classifier>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -100,26 +95,26 @@
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId> <artifactId>mysql-connector-j</artifactId>
<version>8.0.32</version> <version>8.0.33</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- add these back in as they are not exposed by the API --> <!-- add these back in as they are not exposed by the API -->
<dependency> <dependency>
<groupId>org.apache.maven</groupId> <groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId> <artifactId>maven-resolver-provider</artifactId>
<version>3.8.5</version> <version>3.9.2</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.resolver</groupId> <groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId> <artifactId>maven-resolver-connector-basic</artifactId>
<version>1.7.3</version> <version>1.9.10</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.resolver</groupId> <groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId> <artifactId>maven-resolver-transport-http</artifactId>
<version>1.7.3</version> <version>1.9.10</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -619,12 +619,16 @@ public class BungeeCord extends ProxyServer
} }
} }
public UserConnection getPlayerByOfflineUUID(UUID name) public UserConnection getPlayerByOfflineUUID(UUID uuid)
{ {
if ( uuid.version() != 3 )
{
return null;
}
connectionLock.readLock().lock(); connectionLock.readLock().lock();
try try
{ {
return connectionsByOfflineUUID.get( name ); return connectionsByOfflineUUID.get( uuid );
} finally } finally
{ {
connectionLock.readLock().unlock(); connectionLock.readLock().unlock();
@ -681,10 +685,10 @@ public class BungeeCord extends ProxyServer
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) 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( "minecraft:register", String.join( "\00", Iterables.transform( pluginChannels, PluginMessage.MODERNISE ) ).getBytes( Charsets.UTF_8 ), false );
} }
return new PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes( Charsets.UTF_8 ), false ); return new PluginMessage( "REGISTER", String.join( "\00", pluginChannels ).getBytes( Charsets.UTF_8 ), false );
} }
@Override @Override
@ -745,12 +749,17 @@ public class BungeeCord extends ProxyServer
public void addConnection(UserConnection con) public void addConnection(UserConnection con)
{ {
UUID offlineId = con.getPendingConnection().getOfflineId();
if ( offlineId != null && offlineId.version() != 3 )
{
throw new IllegalArgumentException( "Offline UUID must be a name-based UUID" );
}
connectionLock.writeLock().lock(); connectionLock.writeLock().lock();
try try
{ {
connections.put( con.getName(), con ); connections.put( con.getName(), con );
connectionsByUUID.put( con.getUniqueId(), con ); connectionsByUUID.put( con.getUniqueId(), con );
connectionsByOfflineUUID.put( con.getPendingConnection().getOfflineId(), con ); connectionsByOfflineUUID.put( offlineId, con );
} finally } finally
{ {
connectionLock.writeLock().unlock(); connectionLock.writeLock().unlock();

View File

@ -182,7 +182,7 @@ public class BungeeServerInfo implements ServerInfo
new Bootstrap() new Bootstrap()
.channel( PipelineUtils.getChannel( socketAddress ) ) .channel( PipelineUtils.getChannel( socketAddress ) )
.group( BungeeCord.getInstance().eventLoops ) .group( BungeeCord.getInstance().eventLoops )
.handler( PipelineUtils.BASE ) .handler( PipelineUtils.BASE_SERVERSIDE )
.option( ChannelOption.CONNECT_TIMEOUT_MILLIS, BungeeCord.getInstance().getConfig().getRemotePingTimeout() ) .option( ChannelOption.CONNECT_TIMEOUT_MILLIS, BungeeCord.getInstance().getConfig().getRemotePingTimeout() )
.remoteAddress( socketAddress ) .remoteAddress( socketAddress )
.connect() .connect()

View File

@ -225,7 +225,8 @@ public class ServerConnector extends PacketHandler
// Set tab list size, TODO: what shall we do about packet mutability // Set tab list size, TODO: what shall we do about packet mutability
Login modLogin = new Login( login.getEntityId(), login.isHardcore(), login.getGameMode(), login.getPreviousGameMode(), login.getWorldNames(), login.getDimensions(), login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), Login modLogin = new Login( login.getEntityId(), login.isHardcore(), login.getGameMode(), login.getPreviousGameMode(), login.getWorldNames(), login.getDimensions(), login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(),
(byte) user.getPendingConnection().getListener().getTabListSize(), login.getLevelType(), login.getViewDistance(), login.getSimulationDistance(), login.isReducedDebugInfo(), login.isNormalRespawn(), login.isDebug(), login.isFlat(), login.getDeathLocation() ); (byte) user.getPendingConnection().getListener().getTabListSize(), login.getLevelType(), login.getViewDistance(), login.getSimulationDistance(), login.isReducedDebugInfo(), login.isNormalRespawn(), login.isDebug(), login.isFlat(), login.getDeathLocation(),
login.getPortalCooldown() );
user.unsafe().sendPacket( modLogin ); user.unsafe().sendPacket( modLogin );
@ -243,7 +244,8 @@ public class ServerConnector extends PacketHandler
} }
user.getSentBossBars().clear(); user.getSentBossBars().clear();
user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false, login.getDeathLocation() ) ); user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false, login.getDeathLocation(),
login.getPortalCooldown() ) );
user.getServer().disconnect( "Quitting" ); user.getServer().disconnect( "Quitting" );
} else } else
{ {
@ -292,11 +294,13 @@ public class ServerConnector extends PacketHandler
user.setDimensionChange( true ); user.setDimensionChange( true );
if ( login.getDimension() == user.getDimension() ) if ( login.getDimension() == user.getDimension() )
{ {
user.unsafe().sendPacket( new Respawn( (Integer) login.getDimension() >= 0 ? -1 : 0, login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false, login.getDeathLocation() ) ); user.unsafe().sendPacket( new Respawn( (Integer) login.getDimension() >= 0 ? -1 : 0, login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(),
false, login.getDeathLocation(), login.getPortalCooldown() ) );
} }
user.setServerEntityId( login.getEntityId() ); user.setServerEntityId( login.getEntityId() );
user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(), false, login.getDeathLocation() ) ); user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getWorldName(), login.getSeed(), login.getDifficulty(), login.getGameMode(), login.getPreviousGameMode(), login.getLevelType(), login.isDebug(), login.isFlat(),
false, login.getDeathLocation(), login.getPortalCooldown() ) );
if ( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_14 ) if ( user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_14 )
{ {
user.unsafe().sendPacket( new ViewDistance( login.getViewDistance() ) ); user.unsafe().sendPacket( new ViewDistance( login.getViewDistance() ) );

View File

@ -320,7 +320,7 @@ public final class UserConnection implements ProxiedPlayer
@Override @Override
protected void initChannel(Channel ch) throws Exception protected void initChannel(Channel ch) throws Exception
{ {
PipelineUtils.BASE.initChannel( ch ); PipelineUtils.BASE_SERVERSIDE.initChannel( ch );
ch.pipeline().addAfter( PipelineUtils.FRAME_DECODER, PipelineUtils.PACKET_DECODER, new MinecraftDecoder( Protocol.HANDSHAKE, false, getPendingConnection().getVersion() ) ); ch.pipeline().addAfter( PipelineUtils.FRAME_DECODER, PipelineUtils.PACKET_DECODER, new MinecraftDecoder( Protocol.HANDSHAKE, false, getPendingConnection().getVersion() ) );
ch.pipeline().addAfter( PipelineUtils.FRAME_PREPENDER, PipelineUtils.PACKET_ENCODER, new MinecraftEncoder( Protocol.HANDSHAKE, false, getPendingConnection().getVersion() ) ); ch.pipeline().addAfter( PipelineUtils.FRAME_PREPENDER, PipelineUtils.PACKET_ENCODER, new MinecraftEncoder( Protocol.HANDSHAKE, false, getPendingConnection().getVersion() ) );
ch.pipeline().get( HandlerBoss.class ).setHandler( new ServerConnector( bungee, UserConnection.this, target ) ); ch.pipeline().get( HandlerBoss.class ).setHandler( new ServerConnector( bungee, UserConnection.this, target ) );

View File

@ -80,6 +80,7 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_19_3: case ProtocolConstants.MINECRAFT_1_19_3:
return EntityMap_1_16_2.INSTANCE_1_19_1; return EntityMap_1_16_2.INSTANCE_1_19_1;
case ProtocolConstants.MINECRAFT_1_19_4: case ProtocolConstants.MINECRAFT_1_19_4:
case ProtocolConstants.MINECRAFT_1_20:
return EntityMap_1_16_2.INSTANCE_1_19_4; return EntityMap_1_16_2.INSTANCE_1_19_4;
} }
throw new RuntimeException( "Version " + version + " has no entity map" ); throw new RuntimeException( "Version " + version + " has no entity map" );

View File

@ -30,6 +30,8 @@ import java.net.SocketAddress;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.Util; import net.md_5.bungee.Util;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -42,6 +44,7 @@ import net.md_5.bungee.protocol.MinecraftDecoder;
import net.md_5.bungee.protocol.MinecraftEncoder; import net.md_5.bungee.protocol.MinecraftEncoder;
import net.md_5.bungee.protocol.Protocol; import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.Varint21FrameDecoder; import net.md_5.bungee.protocol.Varint21FrameDecoder;
import net.md_5.bungee.protocol.Varint21LengthFieldExtraBufPrepender;
import net.md_5.bungee.protocol.Varint21LengthFieldPrepender; import net.md_5.bungee.protocol.Varint21LengthFieldPrepender;
public class PipelineUtils public class PipelineUtils
@ -82,9 +85,11 @@ public class PipelineUtils
} }
} }
}; };
public static final Base BASE = new Base(); public static final Base BASE = new Base( false );
public static final Base BASE_SERVERSIDE = new Base( true );
private static final KickStringWriter legacyKicker = new KickStringWriter(); private static final KickStringWriter legacyKicker = new KickStringWriter();
private static final Varint21LengthFieldPrepender framePrepender = new Varint21LengthFieldPrepender(); private static final Varint21LengthFieldPrepender framePrepender = new Varint21LengthFieldPrepender();
private static final Varint21LengthFieldExtraBufPrepender serverFramePrepender = new Varint21LengthFieldExtraBufPrepender();
public static final String TIMEOUT_HANDLER = "timeout"; public static final String TIMEOUT_HANDLER = "timeout";
public static final String PACKET_DECODER = "packet-decoder"; public static final String PACKET_DECODER = "packet-decoder";
public static final String PACKET_ENCODER = "packet-encoder"; public static final String PACKET_ENCODER = "packet-encoder";
@ -152,9 +157,13 @@ public class PipelineUtils
private static final int HIGH_MARK = Integer.getInteger( "net.md_5.bungee.high_mark", 2 << 20 ); // 2 mb private static final int HIGH_MARK = Integer.getInteger( "net.md_5.bungee.high_mark", 2 << 20 ); // 2 mb
private static final WriteBufferWaterMark MARK = new WriteBufferWaterMark( LOW_MARK, HIGH_MARK ); private static final WriteBufferWaterMark MARK = new WriteBufferWaterMark( LOW_MARK, HIGH_MARK );
@NoArgsConstructor // for backwards compatibility
@AllArgsConstructor
public static final class Base extends ChannelInitializer<Channel> public static final class Base extends ChannelInitializer<Channel>
{ {
private boolean toServer = false;
@Override @Override
public void initChannel(Channel ch) throws Exception public void initChannel(Channel ch) throws Exception
{ {
@ -170,7 +179,9 @@ public class PipelineUtils
ch.pipeline().addLast( FRAME_DECODER, new Varint21FrameDecoder() ); ch.pipeline().addLast( FRAME_DECODER, new Varint21FrameDecoder() );
ch.pipeline().addLast( TIMEOUT_HANDLER, new ReadTimeoutHandler( BungeeCord.getInstance().config.getTimeout(), TimeUnit.MILLISECONDS ) ); ch.pipeline().addLast( TIMEOUT_HANDLER, new ReadTimeoutHandler( BungeeCord.getInstance().config.getTimeout(), TimeUnit.MILLISECONDS ) );
ch.pipeline().addLast( FRAME_PREPENDER, framePrepender ); // No encryption bungee -> server, therefore use extra buffer to avoid copying everything for length prepending
// Not used bungee -> client as header would need to be encrypted separately through expensive JNI call
ch.pipeline().addLast( FRAME_PREPENDER, ( toServer ) ? serverFramePrepender : framePrepender );
ch.pipeline().addLast( BOSS_HANDLER, new HandlerBoss() ); ch.pipeline().addLast( BOSS_HANDLER, new HandlerBoss() );
} }

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-query</artifactId> <artifactId>bungeecord-query</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Query</name> <name>BungeeCord-Query</name>
@ -21,7 +21,6 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId> <artifactId>netty-transport</artifactId>
<version>${netty.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-slf4j</artifactId> <artifactId>bungeecord-slf4j</artifactId>
<version>1.19-R0.1-SNAPSHOT</version> <version>1.20-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-SLF4J</name> <name>BungeeCord-SLF4J</name>
@ -27,7 +27,7 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>1.7.32</version> <version>1.7.36</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>