SteamWar/BungeeCore
Archiviert
13
2

Add SubserverProtocolFixer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-04-22 15:55:34 +02:00
Ursprung 75a6114447
Commit b8a3512643
3 geänderte Dateien mit 65 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -85,6 +85,7 @@ public class BungeeCore extends Plugin {
new WorldDownloader();
new BrandListener();
new Fabric();
new SubserverProtocolFixer();
new Node.LocalNode();
//new Node.RemoteNode("lx");

Datei anzeigen

@ -0,0 +1,63 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bungeecore.listeners;
import io.github.waterfallmc.waterfall.utils.UUIDUtils;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.connection.InitialHandler;
import net.md_5.bungee.connection.LoginResult;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.util.AddressUtil;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
public class SubserverProtocolFixer extends BasicListener {
private final InetSocketAddress inetSocketAddress = new InetSocketAddress("127.127.127.127", 25565);
private Field field;
{
try {
field = InitialHandler.class.getDeclaredField("extraDataInHandshake");
field.setAccessible(true);
} catch (Exception e) {
BungeeCord.getInstance().stop();
}
}
@EventHandler
public void loginEvent(LoginEvent e) {
System.out.println(e);
InitialHandler initialHandler = ((InitialHandler) e.getConnection());
LoginResult.Property[] properties = initialHandler.getLoginProfile().getProperties();
try {
String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString());
if (properties.length > 0) {
extraData += "\00" + BungeeCord.getInstance().gson.toJson(properties);
}
field.set(initialHandler, extraData);
} catch (Exception ex) {
BungeeCord.getInstance().stop();
}
}
}

Datei anzeigen

@ -467,6 +467,7 @@ TEAM_SERVER_USAGE=§8/§7team server §8[§eIP/Address§8] §8(§7Port§8) §8-
TEAM_SERVER_SET=§7Du hast die Teamserveradresse geändert§8!
TEAM_SERVER_PORT_INVALID=§cDer Port muss eine Zahl sein.
TEAM_NO_ADDRESS=§cTeamserveradresse nicht gesetzt.
TEAM_TP_NO_TEAM=§cUnbekanntes Team.
#TpCommand
TP_USAGE=§8/§7tp §8[§eSpieler§8]