SteamWar/BungeeCore
Archiviert
13
2

Extending AntiWDL capabilities

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-12-19 12:21:26 +01:00
Ursprung adf0d6b716
Commit 49ed45a346
2 geänderte Dateien mit 35 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.bungeecore.listeners.*;
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
import de.steamwar.bungeecore.listeners.mods.Forge; import de.steamwar.bungeecore.listeners.mods.Forge;
import de.steamwar.bungeecore.listeners.mods.LabyMod; import de.steamwar.bungeecore.listeners.mods.LabyMod;
import de.steamwar.bungeecore.listeners.mods.WorldDownloader;
import de.steamwar.bungeecore.sql.SQL; import de.steamwar.bungeecore.sql.SQL;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.Team;
@ -85,6 +86,7 @@ public class BungeeCore extends Plugin {
new BanListener(); new BanListener();
new CheckListener(); new CheckListener();
new ModLoaderBlocker(); new ModLoaderBlocker();
new WorldDownloader();
commands.put("/b", null); commands.put("/b", null);
commands.put("/gs", null); commands.put("/gs", null);

Datei anzeigen

@ -0,0 +1,33 @@
package de.steamwar.bungeecore.listeners.mods;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import de.steamwar.bungeecore.listeners.BasicListener;
import de.steamwar.bungeecore.sql.Mod;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.event.EventHandler;
import java.util.Collections;
import java.util.Set;
public class WorldDownloader extends BasicListener {
private static final Set<String> wdlTags = Collections.unmodifiableSet(
Sets.newHashSet("WDL|INIT", "wdl:init", "WDL|REQUEST", "wdl:request")
);
@EventHandler
public void onPluginMessageEvent(PluginMessageEvent event){
if(!wdlTags.contains(event.getTag()))
return;
Connection sender = event.getSender();
if(!(sender instanceof ProxiedPlayer))
return;
event.setCancelled(true);
Utils.handleMods((ProxiedPlayer) sender, Lists.newArrayList(Mod.get("wdl", Mod.Platform.FORGE)));
}
}