geforkt von SteamWar/BungeeCore
Fabric Mod Sender Integration. Mod itself is not final
Dieser Commit ist enthalten in:
Ursprung
c8642b7978
Commit
24075306fd
@ -70,6 +70,7 @@ public class BungeeCore extends Plugin {
|
||||
@Override
|
||||
public void onEnable(){
|
||||
getProxy().registerChannel("sw:bridge");
|
||||
getProxy().registerChannel("fabricmodsender:mods");
|
||||
|
||||
setInstance(this);
|
||||
loadConfig();
|
||||
@ -86,6 +87,7 @@ public class BungeeCore extends Plugin {
|
||||
new ModLoaderBlocker();
|
||||
new WorldDownloader();
|
||||
new BrandListener();
|
||||
new Fabric();
|
||||
|
||||
new Node.LocalNode();
|
||||
//new Node.RemoteNode("lx");
|
||||
|
45
src/de/steamwar/bungeecore/listeners/mods/Fabric.java
Normale Datei
45
src/de/steamwar/bungeecore/listeners/mods/Fabric.java
Normale Datei
@ -0,0 +1,45 @@
|
||||
package de.steamwar.bungeecore.listeners.mods;
|
||||
|
||||
import de.steamwar.bungeecore.listeners.BasicListener;
|
||||
import de.steamwar.bungeecore.sql.Mod;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Fabric extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
public void onPluginMessageEvent(PluginMessageEvent e){
|
||||
if(!e.getTag().equals("fabricmodsender:mods"))
|
||||
return;
|
||||
|
||||
String dataString = new String(e.getData()).substring(2);
|
||||
dataString = StringUtils.chop(dataString);
|
||||
char x = 34;
|
||||
dataString = dataString.replace(x, ' ');
|
||||
dataString = dataString.replaceAll("\\s+","");
|
||||
|
||||
String[] parts = dataString.split(",");
|
||||
|
||||
List<Mod> mods = new ArrayList<>();
|
||||
|
||||
for(String mod : parts) {
|
||||
mods.add(Mod.get(mod, Mod.Platform.FABRIC));
|
||||
}
|
||||
|
||||
if (e.getSender() instanceof ProxiedPlayer) {
|
||||
ProxiedPlayer player = (ProxiedPlayer) e.getSender();
|
||||
|
||||
if(!Utils.handleMods(player, mods))
|
||||
player.disconnect("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -61,7 +61,8 @@ public class Mod {
|
||||
|
||||
public enum Platform{
|
||||
FORGE(0),
|
||||
LABYMOD(1);
|
||||
LABYMOD(1),
|
||||
FABRIC(2);
|
||||
|
||||
Platform(int value){
|
||||
this.value = value;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren