SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'master' into commonDB2

# Conflicts:
#	CommonCore
Dieser Commit ist enthalten in:
Lixfel 2023-02-21 15:58:18 +01:00
Commit 4d535c5550
7 geänderte Dateien mit 109 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -28,7 +28,10 @@ import de.steamwar.bungeecore.listeners.ping.PingListener;
import de.steamwar.bungeecore.network.BungeeNetworkHandler; import de.steamwar.bungeecore.network.BungeeNetworkHandler;
import de.steamwar.bungeecore.network.NetworkReceiver; import de.steamwar.bungeecore.network.NetworkReceiver;
import de.steamwar.bungeecore.network.SWScriptSyntaxForwarder; import de.steamwar.bungeecore.network.SWScriptSyntaxForwarder;
import de.steamwar.bungeecore.sql.*; import de.steamwar.bungeecore.sql.Punishment;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team;
import de.steamwar.bungeecore.sql.UserElo;
import de.steamwar.bungeecore.tablist.TablistManager; import de.steamwar.bungeecore.tablist.TablistManager;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.SWTypeMapperCreator; import de.steamwar.command.SWTypeMapperCreator;
@ -103,6 +106,8 @@ public class BungeeCore extends Plugin {
}); });
BungeeCord.getInstance().getScheduler().schedule(this, TabCompletionCache::invalidateOldEntries, 1, 1, TimeUnit.SECONDS); BungeeCord.getInstance().getScheduler().schedule(this, TabCompletionCache::invalidateOldEntries, 1, 1, TimeUnit.SECONDS);
new NonFabricFabricCheck();
new SWScriptSyntaxForwarder(); new SWScriptSyntaxForwarder();
new ConnectionListener(); new ConnectionListener();
new Forge(); new Forge();

Datei anzeigen

@ -0,0 +1,86 @@
/*
* 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;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.LoginEvent;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.event.EventHandler;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
public class NonFabricFabricCheck extends BasicListener {
private final Set<UUID> usingFabric = new HashSet<>();
private final Set<ProxiedPlayer> checking = new HashSet<>();
{
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), usingFabric::clear, 0, 15, TimeUnit.MINUTES);
}
@EventHandler
public void pluginMessageEvent(PluginMessageEvent e) {
Connection sender = e.getSender();
if(!(sender instanceof ProxiedPlayer))
return;
if(!e.getTag().equals("minecraft:brand"))
return;
if(!new String(e.getData()).equals("vanilla")){
return;
}
ProxiedPlayer p = (ProxiedPlayer) sender;
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
if (!p.isConnected()) return;
if (Storage.fabricCheckedPlayers.containsKey(p)) return;
checking.add(p);
p.sendData("fabric-screen-handler-api-v1:open_screen", new byte[] {0});
BungeeCord.getInstance().getScheduler().schedule(BungeeCore.get(), () -> checking.remove(p), 1, TimeUnit.SECONDS);
}, 30, TimeUnit.SECONDS);
}
@EventHandler
public void onPlayerPreLogin(LoginEvent e) {
if (usingFabric.remove(e.getConnection().getUniqueId())) {
e.getConnection().disconnect(Message.parse("MOD_USE_MODSENDER", Locale.getDefault()));
}
}
@EventHandler
public void onPlayerDisconnect(PlayerDisconnectEvent e) {
if (checking.remove(e.getPlayer())) {
usingFabric.add(e.getPlayer().getUniqueId());
}
}
}

Datei anzeigen

@ -122,12 +122,8 @@ public class Fabric extends BasicListener {
mods.add(Mod.getOrCreate(mod.getAsString(), Mod.Platform.FABRIC)); mods.add(Mod.getOrCreate(mod.getAsString(), Mod.Platform.FABRIC));
} }
if(!neededModsContained(mods)) { boolean neededMods = neededModsContained(mods);
logMessage(user, "Needed mods are not contained", dataString); if(Utils.handleMods(player,mods) && neededMods) {
return;
}
if(Utils.handleMods(player,mods)) {
if (Storage.fabricCheckedPlayers.containsKey(player)) { if (Storage.fabricCheckedPlayers.containsKey(player)) {
long current = Storage.fabricCheckedPlayers.get(player); long current = Storage.fabricCheckedPlayers.get(player);
if (current != dataString.hashCode()) { if (current != dataString.hashCode()) {
@ -139,6 +135,8 @@ public class Fabric extends BasicListener {
Storage.fabricCheckedPlayers.put(player, dataString.hashCode()); Storage.fabricCheckedPlayers.put(player, dataString.hashCode());
} }
Storage.fabricPlayers.remove(player); Storage.fabricPlayers.remove(player);
} else if (!neededMods) {
logMessage(user, "Needed mods are not contained", dataString);
} }
} }

Datei anzeigen

@ -44,13 +44,14 @@ public class ModLoaderBlocker extends BasicListener {
if(!e.getTag().equals("minecraft:brand")) if(!e.getTag().equals("minecraft:brand"))
return; return;
if(new String(e.getData()).contains("fabric")){ String brand = new String(e.getData());
if(brand.contains("fabric") || brand.contains("quilt")){
ProxiedPlayer p = (ProxiedPlayer) sender; ProxiedPlayer p = (ProxiedPlayer) sender;
if (!Storage.fabricCheckedPlayers.containsKey(p) && !Storage.fabricPlayers.contains(p)) { if (!Storage.fabricCheckedPlayers.containsKey(p) && !Storage.fabricPlayers.contains(p)) {
Storage.fabricPlayers.add(p); Storage.fabricPlayers.add(p);
Message.send("MODLOADER_INSTALLED_FABRIC", p, "Fabric"); Message.send("MODLOADER_INSTALLED_FABRIC", p, "Fabric");
} }
}else if(new String(e.getData()).contains("LiteLoader")) { }else if(brand.contains("LiteLoader")) {
ProxiedPlayer p = (ProxiedPlayer) sender; ProxiedPlayer p = (ProxiedPlayer) sender;
if (!Storage.fabricPlayers.contains(p)) { if (!Storage.fabricPlayers.contains(p)) {
Storage.fabricPlayers.add(p); Storage.fabricPlayers.add(p);

Datei anzeigen

@ -26,6 +26,7 @@ import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.chat.ComponentSerializer; import net.md_5.bungee.chat.ComponentSerializer;
import net.md_5.bungee.connection.InitialHandler; import net.md_5.bungee.connection.InitialHandler;
import net.md_5.bungee.connection.LoginResult;
import net.md_5.bungee.protocol.Property; import net.md_5.bungee.protocol.Property;
import java.util.List; import java.util.List;
@ -38,7 +39,11 @@ interface TablistPart {
class Item { class Item {
public static Property[] playerProperties(ProxiedPlayer player) { public static Property[] playerProperties(ProxiedPlayer player) {
return ((InitialHandler) player.getPendingConnection()).getLoginProfile().getProperties(); LoginResult loginResult = ((InitialHandler) player.getPendingConnection()).getLoginProfile();
if(loginResult == null)
return new Property[0];
return loginResult.getProperties();
} }
private final UUID uuid; private final UUID uuid;

Datei anzeigen

@ -116,6 +116,8 @@ MOD_RED_PLUR=Attempted use of mods:\n{0}
MOD_YELLOW_SING=§7Deactivate the mod §e{0}§7 to continue playing on §eSteam§8War§7. MOD_YELLOW_SING=§7Deactivate the mod §e{0}§7 to continue playing on §eSteam§8War§7.
MOD_YELLOW_PLUR=§7Deactivate the mods\n§e{0}\n§7to continue playing on §eSteam§8War§7. MOD_YELLOW_PLUR=§7Deactivate the mods\n§e{0}\n§7to continue playing on §eSteam§8War§7.
MOD_USE_MODSENDER=§cPlease use the §c§lFabricModSender§c (https://steamwar.de/downloads/) or remove the mod that is rebranding your installation.
#Various commands #Various commands
ALERT=§f{0} ALERT=§f{0}
STAT_SERVER=§7Server §e{0}§8: §7Below limit §e{1} §7Server count §e{2} STAT_SERVER=§7Server §e{0}§8: §7Below limit §e{1} §7Server count §e{2}

Datei anzeigen

@ -102,6 +102,8 @@ MOD_RED_PLUR=Versuchte Benutzung der Mods:\n{0}
MOD_YELLOW_SING=§7Deaktiviere den Mod §e{0}§7, um weiter auf §eSteam§8War §7spielen zu können. MOD_YELLOW_SING=§7Deaktiviere den Mod §e{0}§7, um weiter auf §eSteam§8War §7spielen zu können.
MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War §7spielen zu können. MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War §7spielen zu können.
MOD_USE_MODSENDER=§cBitte nutze den §c§lFabricModSender§c (https://steamwar.de/downloads/) oder entfernen den Mod, der die Installation umbenennt.
#Various commands #Various commands
STAT_SERVER=§7Server §e{0}§8: §7Startfähig §e{1} §7Serveranzahl §e{2} STAT_SERVER=§7Server §e{0}§8: §7Startfähig §e{1} §7Serveranzahl §e{2}