Compare commits
3 Commits
5cd8dff8bf
...
Bungee1.21
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ed0f88702 | |||
| affad49bf5 | |||
| 8d95dad33b |
16
build.gradle
16
build.gradle
@@ -5,8 +5,8 @@ plugins {
|
|||||||
group = 'de.steamwar'
|
group = 'de.steamwar'
|
||||||
version = ''
|
version = ''
|
||||||
|
|
||||||
sourceCompatibility = 11
|
sourceCompatibility = 8
|
||||||
targetCompatibility = 11
|
targetCompatibility = 8
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
@@ -25,9 +25,9 @@ compileJava.options.encoding = 'UTF-8'
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
maven {
|
maven { url = 'https://nexus.codecrafter47.de/content/repositories/public' }
|
||||||
url = 'https://nexus.codecrafter47.de/content/repositories/public'
|
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
|
||||||
}
|
maven { url = 'https://repo.minebench.de' }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -36,6 +36,8 @@ dependencies {
|
|||||||
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
|
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||||
|
|
||||||
implementation files("${projectDir}/lib/BungeeCord.jar")
|
compileOnly 'net.md-5:bungeecord-api:1.21-R0.1-SNAPSHOT'
|
||||||
implementation 'codecrafter47.bungeetablistplus:bungeetablistplus-api-bungee:3.5.2'
|
compileOnly 'net.md-5:bungeecord-proxy:1.21-R0.1-SNAPSHOT'
|
||||||
|
// compileOnly 'codecrafter47.bungeetablistplus:bungeetablistplus-api-bungee:3.5.2'
|
||||||
|
implementation 'it.unimi.dsi:fastutil-core:8.5.15'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
rootProject.name = 'SteamWarTeamserver'
|
rootProject.name = 'SteamWarTeamserverIntegration'
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
name: SteamWarBungeeTeamserver
|
name: SteamWarTeamserverIntegration
|
||||||
version: 1.0.0
|
version: '1.0.0'
|
||||||
main: de.steamwar.SteamWarBungeeTeamserver
|
main: de.steamwar.SteamWarBungeeTeamserver
|
||||||
|
|
||||||
softDepends:
|
|
||||||
- BungeeTabListPlus
|
|
||||||
@@ -20,8 +20,9 @@
|
|||||||
package de.steamwar.listener;
|
package de.steamwar.listener;
|
||||||
|
|
||||||
import de.steamwar.ConfigSystem;
|
import de.steamwar.ConfigSystem;
|
||||||
import de.steamwar.utils.BungeeTabListPlusFixer;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
@@ -31,15 +32,14 @@ import net.md_5.bungee.connection.InitialHandler;
|
|||||||
import net.md_5.bungee.connection.LoginResult;
|
import net.md_5.bungee.connection.LoginResult;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.md_5.bungee.netty.ChannelWrapper;
|
import net.md_5.bungee.netty.ChannelWrapper;
|
||||||
|
import net.md_5.bungee.protocol.DefinedPacket;
|
||||||
import net.md_5.bungee.protocol.Protocol;
|
import net.md_5.bungee.protocol.Protocol;
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
import net.md_5.bungee.protocol.packet.Handshake;
|
import net.md_5.bungee.protocol.packet.Handshake;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -61,31 +61,33 @@ public class SteamwarConnectionListener implements Listener {
|
|||||||
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
Protocol.DirectionData directionData = Protocol.HANDSHAKE.TO_SERVER;
|
||||||
|
Field directionDataProtocols = Protocol.DirectionData.class.getDeclaredField("protocols");
|
||||||
|
directionDataProtocols.setAccessible(true);
|
||||||
|
Int2ObjectMap protocols = (Int2ObjectMap) directionDataProtocols.get(directionData);
|
||||||
|
|
||||||
|
Class<?> protocolDataClass = Class.forName("net.md_5.bungee.protocol.Protocol$ProtocolData");
|
||||||
|
Field protocolDataPacketMap = protocolDataClass.getDeclaredField("packetMap");
|
||||||
|
protocolDataPacketMap.setAccessible(true);
|
||||||
|
Field protocolDataPacketConstructors = protocolDataClass.getDeclaredField("packetConstructors");
|
||||||
|
protocolDataPacketConstructors.setAccessible(true);
|
||||||
|
|
||||||
Method mapMethod = Protocol.class.getDeclaredMethod("map", int.class, int.class);
|
Method mapMethod = Protocol.class.getDeclaredMethod("map", int.class, int.class);
|
||||||
mapMethod.setAccessible(true);
|
mapMethod.setAccessible(true);
|
||||||
Object protocolMapping = mapMethod.invoke(null, ProtocolConstants.MINECRAFT_1_8, 0x00);
|
Object protocolMapping = mapMethod.invoke(null, ProtocolConstants.MINECRAFT_1_8, 0x00);
|
||||||
Class<?> directionDataClazz = Class.forName("net.md_5.bungee.protocol.Protocol$DirectionData");
|
Field protocolMappingPacketId = protocolMapping.getClass().getDeclaredField("packetID");
|
||||||
Class<?> protocolMappingClazz = Class.forName("net.md_5.bungee.protocol.Protocol$ProtocolMapping");
|
protocolMappingPacketId.setAccessible(true);
|
||||||
Field field = Protocol.class.getDeclaredField("TO_SERVER");
|
int packetID = protocolMappingPacketId.getInt(protocolMapping);
|
||||||
field.setAccessible(true);
|
|
||||||
Object o = field.get(Protocol.HANDSHAKE);
|
for (int version : ProtocolConstants.SUPPORTED_VERSION_IDS) {
|
||||||
Method method = Arrays.stream(directionDataClazz.getDeclaredMethods())
|
Object protocolData = protocols.get(version);
|
||||||
.filter(m -> m.getName().equals("registerPacket"))
|
|
||||||
.filter(m -> m.getParameterCount() == 3)
|
Object2IntMap<Class<? extends DefinedPacket>> packetMap = (Object2IntMap<Class<? extends DefinedPacket>>) protocolDataPacketMap.get(protocolData);
|
||||||
.filter(m -> m.getParameterTypes()[0] == Class.class)
|
Supplier<? extends DefinedPacket>[] packetConstructors = (Supplier<? extends DefinedPacket>[]) protocolDataPacketConstructors.get(protocolData);
|
||||||
.filter(m -> m.getParameterTypes()[1] == Supplier.class)
|
|
||||||
.filter(m -> m.getParameterTypes()[2].isArray())
|
packetMap.put(Handshake.class, packetID);
|
||||||
.findFirst()
|
packetConstructors[packetID] = SteamwarHandshake::new;
|
||||||
.orElseThrow(() -> new RuntimeException("Could not find registerPacket method"));
|
}
|
||||||
method.setAccessible(true);
|
|
||||||
Object protocolMappingArray = Array.newInstance(protocolMappingClazz, 1);
|
|
||||||
Array.set(protocolMappingArray, 0, protocolMapping);
|
|
||||||
method.invoke(o, Handshake.class, new Supplier<Handshake>() {
|
|
||||||
@Override
|
|
||||||
public Handshake get() {
|
|
||||||
return new SteamwarHandshake();
|
|
||||||
}
|
|
||||||
}, protocolMappingArray);
|
|
||||||
|
|
||||||
chField = InitialHandler.class.getDeclaredField("ch");
|
chField = InitialHandler.class.getDeclaredField("ch");
|
||||||
chField.setAccessible(true);
|
chField.setAccessible(true);
|
||||||
@@ -102,7 +104,7 @@ public class SteamwarConnectionListener implements Listener {
|
|||||||
if (!ConfigSystem.isEnabled()) return;
|
if (!ConfigSystem.isEnabled()) return;
|
||||||
|
|
||||||
String address = preLoginEvent.getConnection().getSocketAddress().toString();
|
String address = preLoginEvent.getConnection().getSocketAddress().toString();
|
||||||
if (address.startsWith("/78.31.71.136:")) {
|
if (address.startsWith("/178.63.72.88:")) {
|
||||||
InitialHandler initialHandler = (InitialHandler) preLoginEvent.getConnection();
|
InitialHandler initialHandler = (InitialHandler) preLoginEvent.getConnection();
|
||||||
String extraData = initialHandler.getExtraDataInHandshake();
|
String extraData = initialHandler.getExtraDataInHandshake();
|
||||||
String[] split = extraData.split("\0");
|
String[] split = extraData.split("\0");
|
||||||
@@ -158,8 +160,10 @@ public class SteamwarConnectionListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (BungeeCord.getInstance().getPluginManager().getPlugin("BungeeTabListPlus") != null) {
|
if (BungeeCord.getInstance().getPluginManager().getPlugin("BungeeTabListPlus") != null) {
|
||||||
BungeeTabListPlusFixer.remove(postLoginEvent.getPlayer());
|
BungeeTabListPlusFixer.remove(postLoginEvent.getPlayer());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,2 @@
|
|||||||
build:
|
build:
|
||||||
- "ln -s /home/gitea/lib"
|
- "./gradlew build --no-deamon"
|
||||||
- "cp ~/gradle.properties ."
|
|
||||||
- "chmod u+x build.gradle"
|
|
||||||
- "./gradlew build"
|
|
||||||
|
|
||||||
artifacts:
|
|
||||||
"/binarys/SteamWarTeamserver.jar": "build/libs/SteamWarTeamserver.jar"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user