Compare commits
6 Commits
bb4de2e30e
...
6019f9de6f
Author | SHA1 | Date | |
---|---|---|---|
6019f9de6f | |||
0220b4512f | |||
151b22c95b | |||
77be5eee80 | |||
b90791d41f | |||
a842899898 |
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-API</name>
|
<name>BungeeCord-API</name>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-bootstrap</artifactId>
|
<artifactId>bungeecord-bootstrap</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Bootstrap</name>
|
<name>BungeeCord-Bootstrap</name>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Chat</name>
|
<name>BungeeCord-Chat</name>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-config</artifactId>
|
<artifactId>bungeecord-config</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Config</name>
|
<name>BungeeCord-Config</name>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-event</artifactId>
|
<artifactId>bungeecord-event</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Event</name>
|
<name>BungeeCord-Event</name>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-log</artifactId>
|
<artifactId>bungeecord-log</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Log</name>
|
<name>BungeeCord-Log</name>
|
||||||
|
@ -8,20 +8,7 @@ echo "Compiling mbedtls"
|
|||||||
echo "Compiling zlib"
|
echo "Compiling zlib"
|
||||||
(cd zlib && CFLAGS=-fPIC ./configure --static && make)
|
(cd zlib && CFLAGS=-fPIC ./configure --static && make)
|
||||||
|
|
||||||
CC="gcc"
|
CXX="g++ -shared -fPIC -O3 -Wall -Werror -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/"
|
||||||
CFLAGS="-c -fPIC -O3 -Wall -Werror -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/"
|
|
||||||
LDFLAGS="-shared"
|
|
||||||
|
|
||||||
echo "Compiling bungee"
|
$CXX -Imbedtls/include src/main/c/NativeCipherImpl.cpp -o src/main/resources/native-cipher.so mbedtls/library/libmbedcrypto.a
|
||||||
$CC $CFLAGS -o shared.o src/main/c/shared.c
|
$CXX -Izlib src/main/c/NativeCompressImpl.cpp -o src/main/resources/native-compress.so zlib/libz.a
|
||||||
$CC $CFLAGS -Imbedtls/include -o NativeCipherImpl.o src/main/c/NativeCipherImpl.c
|
|
||||||
$CC $CFLAGS -Izlib -o NativeCompressImpl.o src/main/c/NativeCompressImpl.c
|
|
||||||
|
|
||||||
echo "Linking native-cipher.so"
|
|
||||||
$CC $LDFLAGS -o src/main/resources/native-cipher.so shared.o NativeCipherImpl.o mbedtls/library/libmbedcrypto.a
|
|
||||||
|
|
||||||
echo "Linking native-compress.so"
|
|
||||||
$CC $LDFLAGS -o src/main/resources/native-compress.so shared.o NativeCompressImpl.o zlib/libz.a
|
|
||||||
|
|
||||||
echo "Cleaning up"
|
|
||||||
rm shared.o NativeCipherImpl.o NativeCompressImpl.o
|
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-native</artifactId>
|
<artifactId>bungeecord-native</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Native</name>
|
<name>BungeeCord-Native</name>
|
||||||
|
@ -2,33 +2,31 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mbedtls/aes.h>
|
#include <mbedtls/aes.h>
|
||||||
#include "shared.h"
|
|
||||||
#include "net_md_5_bungee_jni_cipher_NativeCipherImpl.h"
|
#include "net_md_5_bungee_jni_cipher_NativeCipherImpl.h"
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
typedef struct crypto_context {
|
struct crypto_context {
|
||||||
int mode;
|
int mode;
|
||||||
mbedtls_aes_context cipher;
|
mbedtls_aes_context cipher;
|
||||||
byte key[];
|
byte *key;
|
||||||
} crypto_context;
|
};
|
||||||
|
|
||||||
jlong JNICALL Java_net_md_15_bungee_jni_cipher_NativeCipherImpl_init(JNIEnv* env, jobject obj, jboolean forEncryption, jbyteArray key) {
|
jlong JNICALL Java_net_md_15_bungee_jni_cipher_NativeCipherImpl_init(JNIEnv* env, jobject obj, jboolean forEncryption, jbyteArray key) {
|
||||||
jsize keyLen = (*env)->GetArrayLength(env, key);
|
jsize keyLen = env->GetArrayLength(key);
|
||||||
|
jbyte *keyBytes = env->GetByteArrayElements(key, NULL);
|
||||||
crypto_context *crypto = (crypto_context*) malloc(sizeof (crypto_context) + (size_t) keyLen);
|
|
||||||
if (!crypto) {
|
|
||||||
throwOutOfMemoryError(env, "Failed to malloc new crypto_context");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*env)->GetByteArrayRegion(env, key, 0, keyLen, (jbyte*) &crypto->key);
|
|
||||||
|
|
||||||
|
crypto_context *crypto = (crypto_context*) malloc(sizeof (crypto_context));
|
||||||
mbedtls_aes_init(&crypto->cipher);
|
mbedtls_aes_init(&crypto->cipher);
|
||||||
mbedtls_aes_setkey_enc(&crypto->cipher, (byte*) &crypto->key, keyLen * 8);
|
|
||||||
|
mbedtls_aes_setkey_enc(&crypto->cipher, (byte*) keyBytes, keyLen * 8);
|
||||||
|
|
||||||
|
crypto->key = (byte*) malloc(keyLen);
|
||||||
|
memcpy(crypto->key, keyBytes, keyLen);
|
||||||
|
|
||||||
crypto->mode = (forEncryption) ? MBEDTLS_AES_ENCRYPT : MBEDTLS_AES_DECRYPT;
|
crypto->mode = (forEncryption) ? MBEDTLS_AES_ENCRYPT : MBEDTLS_AES_DECRYPT;
|
||||||
|
|
||||||
|
env->ReleaseByteArrayElements(key, keyBytes, JNI_ABORT);
|
||||||
return (jlong) crypto;
|
return (jlong) crypto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,6 +34,7 @@ void Java_net_md_15_bungee_jni_cipher_NativeCipherImpl_free(JNIEnv* env, jobject
|
|||||||
crypto_context *crypto = (crypto_context*) ctx;
|
crypto_context *crypto = (crypto_context*) ctx;
|
||||||
|
|
||||||
mbedtls_aes_free(&crypto->cipher);
|
mbedtls_aes_free(&crypto->cipher);
|
||||||
|
free(crypto->key);
|
||||||
free(crypto);
|
free(crypto);
|
||||||
}
|
}
|
||||||
|
|
@ -2,28 +2,28 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include "shared.h"
|
|
||||||
#include "net_md_5_bungee_jni_zlib_NativeCompressImpl.h"
|
#include "net_md_5_bungee_jni_zlib_NativeCompressImpl.h"
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
static jclass classID;
|
|
||||||
static jfieldID consumedID;
|
static jfieldID consumedID;
|
||||||
static jfieldID finishedID;
|
static jfieldID finishedID;
|
||||||
static jmethodID makeExceptionID;
|
|
||||||
|
|
||||||
void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_initFields(JNIEnv* env, jclass clazz) {
|
void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_initFields(JNIEnv* env, jclass clazz) {
|
||||||
classID = clazz;
|
// We trust that these fields will be there
|
||||||
// We trust that these will be there
|
consumedID = env->GetFieldID(clazz, "consumed", "I");
|
||||||
consumedID = (*env)->GetFieldID(env, clazz, "consumed", "I");
|
finishedID = env->GetFieldID(clazz, "finished", "Z");
|
||||||
finishedID = (*env)->GetFieldID(env, clazz, "finished", "Z");
|
|
||||||
makeExceptionID = (*env)->GetMethodID(env, clazz, "makeException", "(Ljava/lang/String;I)Lnet/md_5/bungee/jni/NativeCodeException;");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jint throwException(JNIEnv *env, const char* message, int err) {
|
jint throwException(JNIEnv *env, const char* message, int err) {
|
||||||
jstring jMessage = (*env)->NewStringUTF(env, message);
|
// These can't be static for some unknown reason
|
||||||
jthrowable throwable = (jthrowable) (*env)->CallStaticObjectMethod(env, classID, makeExceptionID, jMessage, err);
|
jclass exceptionClass = env->FindClass("net/md_5/bungee/jni/NativeCodeException");
|
||||||
return (*env)->Throw(env, throwable);
|
jmethodID exceptionInitID = env->GetMethodID(exceptionClass, "<init>", "(Ljava/lang/String;I)V");
|
||||||
|
|
||||||
|
jstring jMessage = env->NewStringUTF(message);
|
||||||
|
|
||||||
|
jthrowable throwable = (jthrowable) env->NewObject(exceptionClass, exceptionInitID, jMessage, err);
|
||||||
|
return env->Throw(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_reset(JNIEnv* env, jobject obj, jlong ctx, jboolean compress) {
|
void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_reset(JNIEnv* env, jobject obj, jlong ctx, jboolean compress) {
|
||||||
@ -48,17 +48,10 @@ void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_end(JNIEnv* env,
|
|||||||
|
|
||||||
jlong JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_init(JNIEnv* env, jobject obj, jboolean compress, jint level) {
|
jlong JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_init(JNIEnv* env, jobject obj, jboolean compress, jint level) {
|
||||||
z_stream* stream = (z_stream*) calloc(1, sizeof (z_stream));
|
z_stream* stream = (z_stream*) calloc(1, sizeof (z_stream));
|
||||||
if (!stream) {
|
|
||||||
throwOutOfMemoryError(env, "Failed to calloc new z_stream");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ret = (compress) ? deflateInit(stream, level) : inflateInit(stream);
|
int ret = (compress) ? deflateInit(stream, level) : inflateInit(stream);
|
||||||
|
|
||||||
if (ret != Z_OK) {
|
if (ret != Z_OK) {
|
||||||
free(stream);
|
|
||||||
throwException(env, "Could not init z_stream", ret);
|
throwException(env, "Could not init z_stream", ret);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (jlong) stream;
|
return (jlong) stream;
|
||||||
@ -77,16 +70,15 @@ jint JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_process(JNIEnv* e
|
|||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case Z_STREAM_END:
|
case Z_STREAM_END:
|
||||||
(*env)->SetBooleanField(env, obj, finishedID, JNI_TRUE);
|
env->SetBooleanField(obj, finishedID, true);
|
||||||
break;
|
break;
|
||||||
case Z_OK:
|
case Z_OK:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throwException(env, "Unknown z_stream return code", ret);
|
throwException(env, "Unknown z_stream return code", ret);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->SetIntField(env, obj, consumedID, inLength - stream->avail_in);
|
env->SetIntField(obj, consumedID, inLength - stream->avail_in);
|
||||||
|
|
||||||
return outLength - stream->avail_out;
|
return outLength - stream->avail_out;
|
||||||
}
|
}
|
@ -1,15 +0,0 @@
|
|||||||
#include "shared.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void throwOutOfMemoryError(JNIEnv* env, const char* msg) {
|
|
||||||
jclass exceptionClass = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
|
|
||||||
if (!exceptionClass) {
|
|
||||||
// If the proxy ran out of memory, loading this class may fail
|
|
||||||
fprintf(stderr, "OUT OF MEMORY: %s\n", msg);
|
|
||||||
fprintf(stderr, "Could not load class java.lang.OutOfMemoryError!\n");
|
|
||||||
exit(-1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(*env)->ThrowNew(env, exceptionClass, msg);
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
// This header contains functions to be shared between both native libraries
|
|
||||||
|
|
||||||
#include <jni.h>
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_SHARED_H
|
|
||||||
#define _INCLUDE_SHARED_H
|
|
||||||
|
|
||||||
void throwOutOfMemoryError(JNIEnv* env, const char* msg);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||||||
package net.md_5.bungee.jni;
|
package net.md_5.bungee.jni;
|
||||||
|
|
||||||
public class NativeCodeException extends RuntimeException
|
public class NativeCodeException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
public NativeCodeException(String message, int reason)
|
public NativeCodeException(String message, int reason)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package net.md_5.bungee.jni.zlib;
|
package net.md_5.bungee.jni.zlib;
|
||||||
|
|
||||||
import net.md_5.bungee.jni.NativeCodeException;
|
|
||||||
|
|
||||||
public class NativeCompressImpl
|
public class NativeCompressImpl
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -22,9 +20,4 @@ public class NativeCompressImpl
|
|||||||
native long init(boolean compress, int compressionLevel);
|
native long init(boolean compress, int compressionLevel);
|
||||||
|
|
||||||
native int process(long ctx, long in, int inLength, long out, int outLength, boolean compress);
|
native int process(long ctx, long in, int inLength, long out, int outLength, boolean compress);
|
||||||
|
|
||||||
NativeCodeException makeException(String message, int err)
|
|
||||||
{
|
|
||||||
return new NativeCodeException( message, err );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import com.google.common.base.Preconditions;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.util.zip.DataFormatException;
|
import java.util.zip.DataFormatException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.md_5.bungee.jni.NativeCodeException;
|
|
||||||
|
|
||||||
public class NativeZlib implements BungeeZlib
|
public class NativeZlib implements BungeeZlib
|
||||||
{
|
{
|
||||||
@ -49,14 +48,7 @@ public class NativeZlib implements BungeeZlib
|
|||||||
{
|
{
|
||||||
out.ensureWritable( 8192 );
|
out.ensureWritable( 8192 );
|
||||||
|
|
||||||
int processed;
|
int processed = nativeCompress.process( ctx, in.memoryAddress() + in.readerIndex(), in.readableBytes(), out.memoryAddress() + out.writerIndex(), out.writableBytes(), compress );
|
||||||
try
|
|
||||||
{
|
|
||||||
processed = nativeCompress.process( ctx, in.memoryAddress() + in.readerIndex(), in.readableBytes(), out.memoryAddress() + out.writerIndex(), out.writableBytes(), compress );
|
|
||||||
} catch ( NativeCodeException exception )
|
|
||||||
{
|
|
||||||
throw (DataFormatException) new DataFormatException( "Failed to decompress via Zlib!" ).initCause( exception );
|
|
||||||
}
|
|
||||||
|
|
||||||
in.readerIndex( in.readerIndex() + nativeCompress.consumed );
|
in.readerIndex( in.readerIndex() + nativeCompress.consumed );
|
||||||
out.writerIndex( out.writerIndex() + processed );
|
out.writerIndex( out.writerIndex() + processed );
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -28,17 +28,6 @@ public class NativeZlibTest
|
|||||||
test( new JavaZlib() );
|
test( new JavaZlib() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testException() throws DataFormatException
|
|
||||||
{
|
|
||||||
if ( NativeCode.isSupported() )
|
|
||||||
{
|
|
||||||
assertTrue( factory.load(), "Native code failed to load!" );
|
|
||||||
testExceptionImpl( factory.newInstance() );
|
|
||||||
}
|
|
||||||
testExceptionImpl( new JavaZlib() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void test(BungeeZlib zlib) throws DataFormatException
|
private void test(BungeeZlib zlib) throws DataFormatException
|
||||||
{
|
{
|
||||||
System.out.println( "Testing: " + zlib );
|
System.out.println( "Testing: " + zlib );
|
||||||
@ -77,22 +66,4 @@ public class NativeZlibTest
|
|||||||
|
|
||||||
assertTrue( Arrays.equals( dataBuf, check ), "Results do not match" );
|
assertTrue( Arrays.equals( dataBuf, check ), "Results do not match" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testExceptionImpl(BungeeZlib zlib) throws DataFormatException
|
|
||||||
{
|
|
||||||
System.out.println( "Testing Exception: " + zlib );
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
|
|
||||||
byte[] dataBuf = new byte[ 1 << 12 ]; // 4096 random bytes
|
|
||||||
new Random().nextBytes( dataBuf );
|
|
||||||
|
|
||||||
zlib.init( false, 0 );
|
|
||||||
|
|
||||||
ByteBuf originalBuf = Unpooled.directBuffer();
|
|
||||||
originalBuf.writeBytes( dataBuf );
|
|
||||||
|
|
||||||
ByteBuf decompressed = Unpooled.directBuffer();
|
|
||||||
|
|
||||||
assertThrows( DataFormatException.class, () -> zlib.process( originalBuf, decompressed ), "Decompressing random bytes did not result in a DataFormatException!" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>fr.pandacube.bungeecord</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Parent</name>
|
<name>BungeeCord-Parent</name>
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-bom</artifactId>
|
<artifactId>netty-bom</artifactId>
|
||||||
<version>4.1.110.Final</version>
|
<version>4.1.109.Final</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-protocol</artifactId>
|
<artifactId>bungeecord-protocol</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Protocol</name>
|
<name>BungeeCord-Protocol</name>
|
||||||
|
@ -10,7 +10,6 @@ import net.md_5.bungee.protocol.packet.ClientStatus;
|
|||||||
import net.md_5.bungee.protocol.packet.Commands;
|
import net.md_5.bungee.protocol.packet.Commands;
|
||||||
import net.md_5.bungee.protocol.packet.CookieRequest;
|
import net.md_5.bungee.protocol.packet.CookieRequest;
|
||||||
import net.md_5.bungee.protocol.packet.CookieResponse;
|
import net.md_5.bungee.protocol.packet.CookieResponse;
|
||||||
import net.md_5.bungee.protocol.packet.DisconnectReportDetails;
|
|
||||||
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||||
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
||||||
import net.md_5.bungee.protocol.packet.EntityStatus;
|
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||||
@ -39,7 +38,6 @@ import net.md_5.bungee.protocol.packet.ScoreboardObjective;
|
|||||||
import net.md_5.bungee.protocol.packet.ScoreboardScore;
|
import net.md_5.bungee.protocol.packet.ScoreboardScore;
|
||||||
import net.md_5.bungee.protocol.packet.ScoreboardScoreReset;
|
import net.md_5.bungee.protocol.packet.ScoreboardScoreReset;
|
||||||
import net.md_5.bungee.protocol.packet.ServerData;
|
import net.md_5.bungee.protocol.packet.ServerData;
|
||||||
import net.md_5.bungee.protocol.packet.ServerLinks;
|
|
||||||
import net.md_5.bungee.protocol.packet.SetCompression;
|
import net.md_5.bungee.protocol.packet.SetCompression;
|
||||||
import net.md_5.bungee.protocol.packet.StartConfiguration;
|
import net.md_5.bungee.protocol.packet.StartConfiguration;
|
||||||
import net.md_5.bungee.protocol.packet.StatusRequest;
|
import net.md_5.bungee.protocol.packet.StatusRequest;
|
||||||
@ -270,12 +268,4 @@ public abstract class AbstractPacketHandler
|
|||||||
public void handle(CookieResponse cookieResponse) throws Exception
|
public void handle(CookieResponse cookieResponse) throws Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handle(DisconnectReportDetails disconnectReportDetails) throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(ServerLinks serverLinks) throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import net.md_5.bungee.protocol.packet.ClientSettings;
|
|||||||
import net.md_5.bungee.protocol.packet.Commands;
|
import net.md_5.bungee.protocol.packet.Commands;
|
||||||
import net.md_5.bungee.protocol.packet.CookieRequest;
|
import net.md_5.bungee.protocol.packet.CookieRequest;
|
||||||
import net.md_5.bungee.protocol.packet.CookieResponse;
|
import net.md_5.bungee.protocol.packet.CookieResponse;
|
||||||
import net.md_5.bungee.protocol.packet.DisconnectReportDetails;
|
|
||||||
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
import net.md_5.bungee.protocol.packet.EncryptionRequest;
|
||||||
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
import net.md_5.bungee.protocol.packet.EncryptionResponse;
|
||||||
import net.md_5.bungee.protocol.packet.EntityStatus;
|
import net.md_5.bungee.protocol.packet.EntityStatus;
|
||||||
@ -45,7 +44,6 @@ import net.md_5.bungee.protocol.packet.ScoreboardObjective;
|
|||||||
import net.md_5.bungee.protocol.packet.ScoreboardScore;
|
import net.md_5.bungee.protocol.packet.ScoreboardScore;
|
||||||
import net.md_5.bungee.protocol.packet.ScoreboardScoreReset;
|
import net.md_5.bungee.protocol.packet.ScoreboardScoreReset;
|
||||||
import net.md_5.bungee.protocol.packet.ServerData;
|
import net.md_5.bungee.protocol.packet.ServerData;
|
||||||
import net.md_5.bungee.protocol.packet.ServerLinks;
|
|
||||||
import net.md_5.bungee.protocol.packet.SetCompression;
|
import net.md_5.bungee.protocol.packet.SetCompression;
|
||||||
import net.md_5.bungee.protocol.packet.StartConfiguration;
|
import net.md_5.bungee.protocol.packet.StartConfiguration;
|
||||||
import net.md_5.bungee.protocol.packet.StatusRequest;
|
import net.md_5.bungee.protocol.packet.StatusRequest;
|
||||||
@ -498,16 +496,6 @@ public enum Protocol
|
|||||||
Transfer::new,
|
Transfer::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x73 )
|
map( ProtocolConstants.MINECRAFT_1_20_5, 0x73 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
|
||||||
DisconnectReportDetails.class,
|
|
||||||
DisconnectReportDetails::new,
|
|
||||||
map( ProtocolConstants.MINECRAFT_1_21, 0x7A )
|
|
||||||
);
|
|
||||||
TO_CLIENT.registerPacket(
|
|
||||||
ServerLinks.class,
|
|
||||||
ServerLinks::new,
|
|
||||||
map( ProtocolConstants.MINECRAFT_1_21, 0x7B )
|
|
||||||
);
|
|
||||||
|
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
KeepAlive.class,
|
KeepAlive.class,
|
||||||
@ -754,16 +742,6 @@ public enum Protocol
|
|||||||
Transfer::new,
|
Transfer::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0B )
|
map( ProtocolConstants.MINECRAFT_1_20_5, 0x0B )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
|
||||||
DisconnectReportDetails.class,
|
|
||||||
DisconnectReportDetails::new,
|
|
||||||
map( ProtocolConstants.MINECRAFT_1_21, 0x0F )
|
|
||||||
);
|
|
||||||
TO_CLIENT.registerPacket(
|
|
||||||
ServerLinks.class,
|
|
||||||
ServerLinks::new,
|
|
||||||
map( ProtocolConstants.MINECRAFT_1_21, 0x10 )
|
|
||||||
);
|
|
||||||
|
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
ClientSettings.class,
|
ClientSettings.class,
|
||||||
|
@ -46,7 +46,6 @@ public class ProtocolConstants
|
|||||||
public static final int MINECRAFT_1_20_2 = 764;
|
public static final int MINECRAFT_1_20_2 = 764;
|
||||||
public static final int MINECRAFT_1_20_3 = 765;
|
public static final int MINECRAFT_1_20_3 = 765;
|
||||||
public static final int MINECRAFT_1_20_5 = 766;
|
public static final int MINECRAFT_1_20_5 = 766;
|
||||||
public static final int MINECRAFT_1_21 = 767;
|
|
||||||
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;
|
||||||
|
|
||||||
@ -65,8 +64,7 @@ public class ProtocolConstants
|
|||||||
"1.17.x",
|
"1.17.x",
|
||||||
"1.18.x",
|
"1.18.x",
|
||||||
"1.19.x",
|
"1.19.x",
|
||||||
"1.20.x",
|
"1.20.x"
|
||||||
"1.21.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,
|
||||||
@ -107,14 +105,13 @@ public class ProtocolConstants
|
|||||||
ProtocolConstants.MINECRAFT_1_20,
|
ProtocolConstants.MINECRAFT_1_20,
|
||||||
ProtocolConstants.MINECRAFT_1_20_2,
|
ProtocolConstants.MINECRAFT_1_20_2,
|
||||||
ProtocolConstants.MINECRAFT_1_20_3,
|
ProtocolConstants.MINECRAFT_1_20_3,
|
||||||
ProtocolConstants.MINECRAFT_1_20_5,
|
ProtocolConstants.MINECRAFT_1_20_5
|
||||||
ProtocolConstants.MINECRAFT_1_21
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( SNAPSHOT_SUPPORT )
|
if ( SNAPSHOT_SUPPORT )
|
||||||
{
|
{
|
||||||
// supportedVersions.add( "1.21.x" );
|
// supportedVersions.add( "1.20.x" );
|
||||||
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_21 );
|
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_20_5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
SUPPORTED_VERSIONS = supportedVersions.build();
|
SUPPORTED_VERSIONS = supportedVersions.build();
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
package net.md_5.bungee.protocol.packet;
|
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
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.DefinedPacket;
|
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class DisconnectReportDetails extends DefinedPacket
|
|
||||||
{
|
|
||||||
|
|
||||||
private Map<String, String> details;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
|
||||||
{
|
|
||||||
int len = readVarInt( buf );
|
|
||||||
Preconditions.checkArgument( len <= 32, "Too many details" );
|
|
||||||
|
|
||||||
details = new HashMap<>();
|
|
||||||
for ( int i = 0; i < len; i++ )
|
|
||||||
{
|
|
||||||
details.put( readString( buf, 128 ), readString( buf, 4096 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
|
||||||
{
|
|
||||||
Preconditions.checkArgument( details.size() <= 32, "Too many details" );
|
|
||||||
writeVarInt( details.size(), buf );
|
|
||||||
|
|
||||||
for ( Map.Entry<String, String> detail : details.entrySet() )
|
|
||||||
{
|
|
||||||
writeString( detail.getKey(), buf, 128 );
|
|
||||||
writeString( detail.getValue(), buf, 4096 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(AbstractPacketHandler handler) throws Exception
|
|
||||||
{
|
|
||||||
handler.handle( this );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
package net.md_5.bungee.protocol.packet;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
|
||||||
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
|
||||||
import net.md_5.bungee.protocol.DefinedPacket;
|
|
||||||
import net.md_5.bungee.protocol.Either;
|
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
public class ServerLinks extends DefinedPacket
|
|
||||||
{
|
|
||||||
|
|
||||||
private Link[] links;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
|
||||||
{
|
|
||||||
int len = readVarInt( buf );
|
|
||||||
links = new Link[ len ];
|
|
||||||
for ( int i = 0; i < len; i++ )
|
|
||||||
{
|
|
||||||
Either<LinkType, BaseComponent> type;
|
|
||||||
if ( buf.readBoolean() )
|
|
||||||
{
|
|
||||||
type = Either.left( LinkType.values()[readVarInt( buf )] );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
type = Either.right( readBaseComponent( buf, protocolVersion ) );
|
|
||||||
}
|
|
||||||
String url = readString( buf );
|
|
||||||
|
|
||||||
links[i] = new Link( type, url );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
|
||||||
{
|
|
||||||
writeVarInt( links.length, buf );
|
|
||||||
for ( Link link : links )
|
|
||||||
{
|
|
||||||
Either<LinkType, BaseComponent> type = link.getType();
|
|
||||||
if ( type.isLeft() )
|
|
||||||
{
|
|
||||||
buf.writeBoolean( true );
|
|
||||||
writeVarInt( type.getLeft().ordinal(), buf );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
buf.writeBoolean( false );
|
|
||||||
writeBaseComponent( type.getRight(), buf, protocolVersion );
|
|
||||||
}
|
|
||||||
writeString( link.getUrl(), buf );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(AbstractPacketHandler handler) throws Exception
|
|
||||||
{
|
|
||||||
handler.handle( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum LinkType
|
|
||||||
{
|
|
||||||
|
|
||||||
REPORT_BUG,
|
|
||||||
COMMUNITY_GUIDELINES,
|
|
||||||
SUPPORT,
|
|
||||||
STATUS,
|
|
||||||
FEEDBACK,
|
|
||||||
COMMUNITY,
|
|
||||||
WEBSITE,
|
|
||||||
FORUMS,
|
|
||||||
NEWS,
|
|
||||||
ANNOUNCEMENTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class Link
|
|
||||||
{
|
|
||||||
|
|
||||||
private final Either<LinkType, BaseComponent> type;
|
|
||||||
private final String url;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-proxy</artifactId>
|
<artifactId>bungeecord-proxy</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Proxy</name>
|
<name>BungeeCord-Proxy</name>
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<version>8.4.0</version>
|
<version>8.3.0</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 -->
|
||||||
|
@ -108,7 +108,7 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
{
|
{
|
||||||
server.setObsolete( true );
|
server.setObsolete( true );
|
||||||
con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
|
con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
|
||||||
con.sendMessage( bungee.getTranslation( "server_went_down", def.getName() ) );
|
con.sendMessage( bungee.getTranslation( "server_went_down" ) );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
con.disconnect( Util.exception( t ) );
|
con.disconnect( Util.exception( t ) );
|
||||||
@ -125,25 +125,13 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
bungee.getReconnectHandler().setServer( con );
|
bungee.getReconnectHandler().setServer( con );
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
|
if ( !server.isObsolete() )
|
||||||
bungee.getPluginManager().callEvent( serverDisconnectEvent );
|
|
||||||
|
|
||||||
if ( server.isObsolete() )
|
|
||||||
{
|
|
||||||
// do not perform any actions if the user has already moved
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerInfo def = con.updateAndGetNextServer( server.getInfo() );
|
|
||||||
if ( def != null )
|
|
||||||
{
|
|
||||||
server.setObsolete( true );
|
|
||||||
con.connectNow( def, ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT );
|
|
||||||
con.sendMessage( bungee.getTranslation( "server_went_down", def.getName() ) );
|
|
||||||
} else
|
|
||||||
{
|
{
|
||||||
con.disconnect( bungee.getTranslation( "lost_connection" ) );
|
con.disconnect( bungee.getTranslation( "lost_connection" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ServerDisconnectEvent serverDisconnectEvent = new ServerDisconnectEvent( con, server.getInfo() );
|
||||||
|
bungee.getPluginManager().callEvent( serverDisconnectEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,7 +87,6 @@ public abstract class EntityMap
|
|||||||
case ProtocolConstants.MINECRAFT_1_20_3:
|
case ProtocolConstants.MINECRAFT_1_20_3:
|
||||||
return EntityMap_1_16_2.INSTANCE_1_20_3;
|
return EntityMap_1_16_2.INSTANCE_1_20_3;
|
||||||
case ProtocolConstants.MINECRAFT_1_20_5:
|
case ProtocolConstants.MINECRAFT_1_20_5:
|
||||||
case ProtocolConstants.MINECRAFT_1_21:
|
|
||||||
return EntityMap_1_16_2.INSTANCE_1_20_5;
|
return EntityMap_1_16_2.INSTANCE_1_20_5;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
|
@ -30,7 +30,6 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
|
|
||||||
private ChannelWrapper channel;
|
private ChannelWrapper channel;
|
||||||
private PacketHandler handler;
|
private PacketHandler handler;
|
||||||
private boolean healthCheck;
|
|
||||||
|
|
||||||
public void setHandler(PacketHandler handler)
|
public void setHandler(PacketHandler handler)
|
||||||
{
|
{
|
||||||
@ -97,7 +96,7 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
channel.setRemoteAddress( newAddress );
|
channel.setRemoteAddress( newAddress );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
healthCheck = true;
|
channel.close();
|
||||||
}
|
}
|
||||||
} finally
|
} finally
|
||||||
{
|
{
|
||||||
@ -147,7 +146,7 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
|
|||||||
{
|
{
|
||||||
if ( ctx.channel().isActive() )
|
if ( ctx.channel().isActive() )
|
||||||
{
|
{
|
||||||
boolean logExceptions = !( handler instanceof PingHandler ) && !healthCheck;
|
boolean logExceptions = !( handler instanceof PingHandler );
|
||||||
|
|
||||||
if ( logExceptions )
|
if ( logExceptions )
|
||||||
{
|
{
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-query</artifactId>
|
<artifactId>bungeecord-query</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Query</name>
|
<name>BungeeCord-Query</name>
|
||||||
|
@ -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.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bungeecord-slf4j</artifactId>
|
<artifactId>bungeecord-slf4j</artifactId>
|
||||||
<version>1.21-R0.1-SNAPSHOT</version>
|
<version>1.20-R0.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-SLF4J</name>
|
<name>BungeeCord-SLF4J</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user