Archiviert
1
0

Add SWScriptSyntaxForwarder

Dieser Commit ist enthalten in:
yoyosource 2022-12-25 11:53:41 +01:00
Ursprung 77811f7160
Commit 59854ef3f0
2 geänderte Dateien mit 51 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -27,6 +27,7 @@ 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.network.SWScriptSyntaxForwarder;
import de.steamwar.bungeecore.sql.*;
import de.steamwar.bungeecore.tablist.TablistManager;
import de.steamwar.command.SWCommandUtils;
@ -79,6 +80,7 @@ public class BungeeCore extends Plugin {
getProxy().registerChannel("sw:bridge");
getProxy().registerChannel("fabricmodsender:mods");
getProxy().registerChannel("nochatreports:sync");
getProxy().registerChannel("sw:script_syntax");
setInstance(this);
MAIN_SERVER = ProxyServer.getInstance().getConfig().getListeners().stream().anyMatch(info -> ((InetSocketAddress) info.getSocketAddress()).getPort() == 25565);
@ -99,6 +101,7 @@ public class BungeeCore extends Plugin {
});
BungeeCord.getInstance().getScheduler().schedule(this, TabCompletionCache::invalidateOldEntries, 1, 1, TimeUnit.SECONDS);
new SWScriptSyntaxForwarder();
new ConnectionListener();
new Forge();
new Forge12();

Datei anzeigen

@ -0,0 +1,48 @@
/*
* 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.network;
import de.steamwar.bungeecore.commands.TeamCommand;
import de.steamwar.bungeecore.listeners.BasicListener;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority;
import java.net.InetSocketAddress;
public class SWScriptSyntaxForwarder extends BasicListener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPluginMessage(PluginMessageEvent event) {
if (!event.getTag().equals("sw:script_syntax")) {
return;
}
event.setCancelled(true);
if (!(event.getSender() instanceof Server)) {
return;
}
if (!TeamCommand.isLocalhost(((InetSocketAddress) event.getSender().getSocketAddress()).getAddress())) {
return;
}
((ProxiedPlayer) event.getReceiver()).sendData("sw:script_syntax", event.getData());
}
}