Merge pull request 'Extending AntiWDL capabilities' (#162) from wdl into master
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
39d81f7e86
@ -25,6 +25,7 @@ import de.steamwar.bungeecore.listeners.*;
|
||||
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
|
||||
import de.steamwar.bungeecore.listeners.mods.Forge;
|
||||
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.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.Team;
|
||||
@ -85,6 +86,7 @@ public class BungeeCore extends Plugin {
|
||||
new BanListener();
|
||||
new CheckListener();
|
||||
new ModLoaderBlocker();
|
||||
new WorldDownloader();
|
||||
|
||||
commands.put("/b", null);
|
||||
commands.put("/gs", null);
|
||||
|
33
src/de/steamwar/bungeecore/listeners/mods/WorldDownloader.java
Normale Datei
33
src/de/steamwar/bungeecore/listeners/mods/WorldDownloader.java
Normale Datei
@ -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)));
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren