SteamWar/BungeeCore
Archiviert
13
2

1.19.1 Support, API update
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-08-04 17:01:40 +02:00
Ursprung 32bd46c97d
Commit a2f6a2c6ae
7 geänderte Dateien mit 40 neuen und 56 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 21e77c55f023261d3a63d5c6200d28b2f6f6fc4c
Subproject commit 47bd9af03eb987f94777f3b13f6ae6c30f153393

Datei anzeigen

@ -48,6 +48,7 @@ import net.md_5.bungee.config.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@ -57,6 +58,8 @@ import java.util.logging.Level;
public class BungeeCore extends Plugin {
public static boolean MAIN_SERVER;
public static String CHAT_PREFIX;
public static String WORLD_FOLDER;
public static String BAUWELT_PROTOTYP;
@ -75,6 +78,15 @@ public class BungeeCore extends Plugin {
@Override
public void onEnable(){
getProxy().registerChannel("sw:bridge");
getProxy().registerChannel("fabricmodsender:mods");
setInstance(this);
MAIN_SERVER = ProxyServer.getInstance().getConfig().getListeners().stream().anyMatch(info -> ((InetSocketAddress) info.getSocketAddress()).getPort() == 25565);
loadConfig();
errorLogger = new ErrorLogger();
SWCommandUtils.init((SWTypeMapperCreator<TypeMapper<Object>, CommandSender, Object>) (mapper, tabCompleter) -> new TypeMapper<Object>() {
@Override
public Object map(CommandSender commandSender, String[] previousArguments, String s) {
@ -88,13 +100,6 @@ public class BungeeCore extends Plugin {
});
BungeeCord.getInstance().getScheduler().schedule(this, TabCompletionCache::invalidateOldEntries, 1, 1, TimeUnit.SECONDS);
getProxy().registerChannel("sw:bridge");
getProxy().registerChannel("fabricmodsender:mods");
setInstance(this);
loadConfig();
errorLogger = new ErrorLogger();
new ConnectionListener();
new Forge();
new Forge12();
@ -305,10 +310,6 @@ public class BungeeCore extends Plugin {
Persistent.setChatPrefix(CHAT_PREFIX);
Persistent.setLobbyServer(LOBBY_SERVER);
if (config.contains("discord")) {
SteamwarDiscordBotConfig.loadConfig(config.getSection("discord"));
}
final Configuration servers = config.getSection("servers");
for(final String serverName : servers.getKeys()){
final Configuration server = servers.getSection(serverName);
@ -325,6 +326,15 @@ public class BungeeCore extends Plugin {
ModLoaderBlocker.addServer(serverName);
}
}
File discordFile = new File(System.getProperty("user.home"), "discord.yml");
if(discordFile.exists()) {
try {
SteamwarDiscordBotConfig.loadConfig(ConfigurationProvider.getProvider(YamlConfiguration.class).load(discordFile));
} catch (IOException e) {
get().getLogger().log(Level.SEVERE, "Could not load discord bot configuration", e);
}
}
}
private static void setInstance(BungeeCore core){

Datei anzeigen

@ -4,7 +4,6 @@ import de.steamwar.bungeecore.sql.EventFight;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team;
import de.steamwar.bungeecore.sql.Tutorial;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.io.File;
@ -17,11 +16,10 @@ import java.util.stream.Collectors;
public class ServerStarter {
private static final boolean MAIN_SERVER = ProxyServer.getInstance().getConfig().getListeners().stream().anyMatch(info -> ((InetSocketAddress) info.getSocketAddress()).getPort() == 25565);
private static final Portrange BAU_PORTS = MAIN_SERVER ? new Portrange(10100, 20000) : new Portrange(2100, 2200);
private static final Portrange ARENA_PORTS = MAIN_SERVER ? new Portrange(3000, 3100) : (BungeeCore.EVENT_MODE ? new Portrange(4000, 5000) : BAU_PORTS);
private static final Portrange BAU_PORTS = BungeeCore.MAIN_SERVER ? new Portrange(10100, 20000) : new Portrange(2100, 2200);
private static final Portrange ARENA_PORTS = BungeeCore.MAIN_SERVER ? new Portrange(3000, 3100) : (BungeeCore.EVENT_MODE ? new Portrange(4000, 5000) : BAU_PORTS);
private static final String BACKBONE = "/home/minecraft/";
private static final String BACKBONE = System.getProperty("user.home") + "/";
private static final String SERVER_PATH = BACKBONE + "server/";
private static final String EVENT_PATH = BACKBONE + "event/";
public static final String TEMP_WORLD_PATH = BACKBONE + "arenaserver/";

Datei anzeigen

@ -56,14 +56,10 @@ public class TpCommand extends BasicCommand {
boolean onTeamServer = Storage.teamServers.containsValue(player.getServer().getInfo());
//Give control of teleport command to server
if (server == player.getServer().getInfo() || onTeamServer) {
if (server == player.getServer().getInfo() || onTeamServer || server == null) {
Chat19.chat(player, "/tp " + String.join(" ", args));
return;
}
if(server == null) {
sender.system("JOINME_PLAYER_OFFLINE");
return;
}
teleport(player, server);
}

Datei anzeigen

@ -44,7 +44,7 @@ public class Statement implements AutoCloseable {
private static final String PASSWORD;
static {
File file = new File(BungeeCore.get().getDataFolder(), "MySQL.yml");
File file = new File(System.getProperty("user.home"), "MySQL.yml");
Configuration config;
try {
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);

Datei anzeigen

@ -205,6 +205,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
for (PlayerListItem.Item item : list.getItems()) {
item.setPing(1);
item.setDisplayName(ComponentSerializer.toString(TextComponent.fromLegacyText("")));
item.setPublicKey(null);
if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)
item.setGamemode(1);

Datei anzeigen

@ -19,47 +19,26 @@
package de.steamwar.bungeecore.util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.md_5.bungee.ServerConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.packet.Chat;
import net.md_5.bungee.protocol.ChatChain;
import net.md_5.bungee.protocol.packet.ClientChat;
import net.md_5.bungee.protocol.packet.ClientCommand;
public class Chat19 extends Chat {
import java.util.Collections;
public class Chat19 {
private Chat19(){}
public static void chat(ProxiedPlayer p, String message) {
if(p.getPendingConnection().getVersion() >= 759) {
boolean command = message.startsWith("/");
Chat19 packet = new Chat19(command ? message.substring(1) : message);
ByteBuf buf = Unpooled.buffer();
writeVarInt(command ? 0x03 : 0x04, buf);
packet.write(buf, ProtocolConstants.Direction.TO_SERVER, p.getPendingConnection().getVersion());
((ServerConnection) p.getServer()).getCh().write(new PacketWrapper(packet, buf));
if(message.startsWith("/")) {
((ServerConnection) p.getServer()).getCh().write(new ClientCommand(message.substring(1), System.currentTimeMillis(), 0, Collections.emptyMap(), false, new ChatChain(Collections.emptyList(), null)));
} else {
((ServerConnection) p.getServer()).getCh().write(new ClientChat(message, System.currentTimeMillis(), 0, new byte[0], false, new ChatChain(Collections.emptyList(), null)));
}
} else {
p.chat(message);
}
}
private final long salt = 0L;
private final byte[] signature = new byte[0];
private final boolean signedPreview = false;
public Chat19 (String message) {
super(message);
}
@Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
if (direction == ProtocolConstants.Direction.TO_CLIENT || protocolVersion != 759)
throw new UnsupportedOperationException();
writeString(getMessage(), buf);
buf.writeLong(System.currentTimeMillis());
buf.writeLong(salt);
writeArray(signature, buf);
buf.writeBoolean(signedPreview);
}
}