SteamWar/BungeeCore
Archiviert
13
2

Show no Chat Reports (Next to chat and Server List for NoChatReportsMod)
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2022-09-18 11:51:36 +02:00
Ursprung 4cfb7830f9
Commit a028db5462
4 geänderte Dateien mit 23 neuen und 27 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,13 @@
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,32 +1,17 @@
/*
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.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);
}