SteamWar/BungeeCore
Archiviert
13
2

Merge pull request 'Show no Chat Reports' (#436) from show_no_chat_reports into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #436
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2022-09-19 10:53:31 +02:00
Commit 1e0eb5c039
4 geänderte Dateien mit 44 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.bungeecore.commands.*;
import de.steamwar.bungeecore.listeners.*;
import de.steamwar.bungeecore.listeners.mods.*;
import de.steamwar.bungeecore.listeners.ping.PingListener;
import de.steamwar.bungeecore.network.BungeeNetworkHandler;
import de.steamwar.bungeecore.network.NetworkReceiver;
import de.steamwar.bungeecore.sql.*;
@ -77,6 +78,7 @@ public class BungeeCore extends Plugin {
public void onEnable(){
getProxy().registerChannel("sw:bridge");
getProxy().registerChannel("fabricmodsender:mods");
getProxy().registerChannel("nochatreports:sync");
setInstance(this);
MAIN_SERVER = ProxyServer.getInstance().getConfig().getListeners().stream().anyMatch(info -> ((InetSocketAddress) info.getSocketAddress()).getPort() == 25565);
@ -110,6 +112,7 @@ public class BungeeCore extends Plugin {
new BrandListener();
new Fabric();
new SubserverProtocolFixer();
new PingListener();
local = new Node.LocalNode();
//new Node.RemoteNode("lx");

Datei anzeigen

@ -55,11 +55,6 @@ public class Forge extends BasicListener {
initialHandlerCh.setAccessible(true);
}
@EventHandler
public void onServerPing(ProxyPingEvent event) {
event.setResponse(new FMLPing(event.getResponse(), event.getConnection().getVersion()));
}
public static void onServerConnected(LoginEvent event) {
if(event.getConnection().getVersion() < 341) { //1.13+
event.completeIntent(BungeeCore.get());

Datei anzeigen

@ -0,0 +1,32 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2022 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.ping;
import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.event.EventHandler;
public class PingListener extends BasicListener {
@EventHandler
public void onPing(ProxyPingEvent event) {
event.setResponse(new SteamWarServerPing(event.getResponse(), event.getConnection().getVersion()));
}
}

Datei anzeigen

@ -1,7 +1,7 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2020 SteamWar.de-Serverteam
Copyright (C) 2022 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
@ -16,17 +16,21 @@
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.mods;
package de.steamwar.bungeecore.listeners.ping;
import net.md_5.bungee.api.ServerPing;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class FMLPing extends ServerPing {
public class SteamWarServerPing extends ServerPing {
private final boolean preventsChatReports = true;
private final ForgeData forgeData;
public FMLPing(ServerPing existing, int version) {
public SteamWarServerPing(ServerPing existing, int version) {
super(existing.getVersion(), existing.getPlayers(), existing.getDescriptionComponent(), existing.getFaviconObject());
forgeData = new ForgeData(version);
}