Archiviert
1
0

Fabric Mod Sender Integration. Mod itself is not final

Dieser Commit ist enthalten in:
zOnlyKroks 2022-03-11 19:21:29 +01:00
Ursprung c8642b7978
Commit 24075306fd
3 geänderte Dateien mit 49 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -70,6 +70,7 @@ public class BungeeCore extends Plugin {
@Override @Override
public void onEnable(){ public void onEnable(){
getProxy().registerChannel("sw:bridge"); getProxy().registerChannel("sw:bridge");
getProxy().registerChannel("fabricmodsender:mods");
setInstance(this); setInstance(this);
loadConfig(); loadConfig();
@ -86,6 +87,7 @@ public class BungeeCore extends Plugin {
new ModLoaderBlocker(); new ModLoaderBlocker();
new WorldDownloader(); new WorldDownloader();
new BrandListener(); new BrandListener();
new Fabric();
new Node.LocalNode(); new Node.LocalNode();
//new Node.RemoteNode("lx"); //new Node.RemoteNode("lx");

Datei anzeigen

@ -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("");
}
}
}

Datei anzeigen

@ -61,7 +61,8 @@ public class Mod {
public enum Platform{ public enum Platform{
FORGE(0), FORGE(0),
LABYMOD(1); LABYMOD(1),
FABRIC(2);
Platform(int value){ Platform(int value){
this.value = value; this.value = value;