diff --git a/ambassador-bungeecord/build.gradle.kts b/ambassador-bungeecord/build.gradle.kts
index 154d891..220996f 100644
--- a/ambassador-bungeecord/build.gradle.kts
+++ b/ambassador-bungeecord/build.gradle.kts
@@ -4,4 +4,14 @@ plugins {
}
group = "org.adde0109"
-version = "1.1.7-alpha-bungeecord"
\ No newline at end of file
+version = "1.1.7-alpha-bungeecord"
+
+repositories {
+ mavenCentral()
+ maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } // This lets gradle find the BungeeCord files online
+}
+
+dependencies {
+ compileOnly("net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT")
+ implementation("org.javassist:javassist:3.29.2-GA")
+}
\ No newline at end of file
diff --git a/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/AmbassadorPlugin.java b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/AmbassadorPlugin.java
new file mode 100644
index 0000000..f090fea
--- /dev/null
+++ b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/AmbassadorPlugin.java
@@ -0,0 +1,15 @@
+package org.adde0109.ambassador;
+
+import net.md_5.bungee.api.plugin.Plugin;
+import org.adde0109.ambassador.forgeCommandArgument.Injector;
+
+public class AmbassadorPlugin extends Plugin {
+ @Override
+ public void onEnable() {
+ // You should not put an enable message in your plugin.
+ // BungeeCord already does so
+ getLogger().info("Yay! It loads!");
+ Injector.inject();
+ }
+ }
+
diff --git a/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/EnumArgumentProperty.java b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/EnumArgumentProperty.java
new file mode 100644
index 0000000..73cb992
--- /dev/null
+++ b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/EnumArgumentProperty.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 Velocity Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.adde0109.ambassador.forgeCommandArgument;
+
+import com.mojang.brigadier.StringReader;
+import com.mojang.brigadier.arguments.ArgumentType;
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
+
+public class EnumArgumentProperty {
+
+ private final String className;
+
+ public EnumArgumentProperty(String className) {
+ this.className = className;
+ }
+
+ public String getClassName() {
+ return this.className;
+ }
+
+ public String parse(StringReader reader) throws CommandSyntaxException {
+ return reader.readUnquotedString();
+ }
+}
diff --git a/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/EnumArgumentPropertySerializer.java b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/EnumArgumentPropertySerializer.java
new file mode 100644
index 0000000..817e1d8
--- /dev/null
+++ b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/EnumArgumentPropertySerializer.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2018 Velocity Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package org.adde0109.ambassador.forgeCommandArgument;
+
+import io.netty.buffer.ByteBuf;
+import net.md_5.bungee.protocol.DefinedPacket;
+
+
+import javax.annotation.Nullable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+
+/**
+ * An argument property serializer that will serialize and deserialize nothing.
+ */
+public class EnumArgumentPropertySerializer {
+
+ public static final EnumArgumentPropertySerializer ENUM;
+
+ static {
+ try {
+ ENUM = new EnumArgumentPropertySerializer();
+ } catch (InvocationTargetException | InstantiationException | IllegalAccessException | ClassNotFoundException |
+ NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ EnumArgumentPropertySerializer() throws InvocationTargetException, InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException {
+ Constructor constructor = EnumArgumentPropertySerializer.class.getSuperclass().getDeclaredConstructor(Class.forName("net.md_5.bungee.protocol.packet.Commands$1"));
+ constructor.setAccessible(true);
+ constructor.newInstance(this);
+ }
+
+
+
+ protected Object read(ByteBuf buf) {
+ return new EnumArgumentProperty(DefinedPacket.readString(buf));
+ }
+
+ protected void write(ByteBuf buf, Object t) {
+ DefinedPacket.writeString(((EnumArgumentProperty) t).getClassName(),buf);
+ }
+}
\ No newline at end of file
diff --git a/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/Injector.java b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/Injector.java
new file mode 100644
index 0000000..5078e64
--- /dev/null
+++ b/ambassador-bungeecord/src/main/java/org/adde0109/ambassador/forgeCommandArgument/Injector.java
@@ -0,0 +1,52 @@
+package org.adde0109.ambassador.forgeCommandArgument;
+
+import javassist.*;
+import javassist.bytecode.ClassFile;
+import javassist.expr.MethodCall;
+import net.md_5.bungee.protocol.Protocol;
+import net.md_5.bungee.protocol.packet.Commands;
+import org.adde0109.ambassador.forgeCommandArgument.EnumArgumentPropertySerializer;
+import org.checkerframework.checker.units.qual.C;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+public class Injector{
+
+
+
+ static public void inject() {
+ try {
+ Class> argumentRegistryClass = Class.forName("net.md_5.bungee.protocol.packet.Commands$ArgumentRegistry");
+ Class> networkNodeClass = Class.forName("net.md_5.bungee.protocol.packet.Commands$NetworkNode");
+ Class> argumentSerializerClass = Class.forName("net.md_5.bungee.protocol.packet.Commands$ArgumentRegistry$ArgumentSerializer");
+
+ ClassPool.getDefault().insertClassPath(new ClassClassPath(EnumArgumentPropertySerializer.class));
+ ClassPool.getDefault().insertClassPath(new ClassClassPath(EnumArgumentProperty.class));
+ CtClass cc = ClassPool.getDefault().get("org.adde0109.ambassador.forgeCommandArgument.EnumArgumentPropertySerializer");
+ CtClass scc = ClassPool.getDefault().get("net.md_5.bungee.protocol.packet.Commands$ArgumentRegistry$ArgumentSerializer");
+ CtClass newcc = scc.getDeclaringClass().makeNestedClass("EnumArgumentPropertySerializer",true);
+ newcc.addMethod(new CtMethod(cc.getDeclaredMethod("read"), newcc, null));
+ newcc.addMethod(new CtMethod(cc.getDeclaredMethod("write"), newcc, null));
+ newcc.setSuperclass(scc);
+
+ //CtConstructor ctconstructor = new CtConstructor(cc.getDeclaredConstructor(null),newcc,null);
+ //newcc.addConstructor(ctconstructor);
+ Class> loaded= newcc.toClass(argumentSerializerClass);
+
+ Method method = argumentRegistryClass.getDeclaredMethod("register",String.class,argumentSerializerClass);
+ //Constructor> superconstructor = argumentSerializerClass.getDeclaredConstructors()[0];
+ //method.setAccessible(true);
+ //Constructor> constructor = loaded.getDeclaredConstructor();
+ //constructor.setAccessible(true);
+ //method.invoke(null,"forge:enum", constructor.newInstance());
+
+ CtClass dcc = scc.getDeclaringClass();
+ dcc.getClassInitializer().insertAfter("$class.getDeclaredMethod(\"register\",String.class,Class.forName(\"net.md_5.bungee.protocol.packet.Commands$ArgumentRegistry$ArgumentSerializer\"));");
+ dcc.toClass(networkNodeClass);
+ MethodCall
+ } catch (ReflectiveOperationException | NotFoundException | CannotCompileException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/ambassador-bungeecord/src/main/resources/plugin.yml b/ambassador-bungeecord/src/main/resources/plugin.yml
new file mode 100644
index 0000000..27e2d55
--- /dev/null
+++ b/ambassador-bungeecord/src/main/resources/plugin.yml
@@ -0,0 +1,4 @@
+name: Ambassador
+main: org.adde0109.ambassador.AmbassadorPlugin
+version: 0.0.0-Bungeecord
+author: adde0109
\ No newline at end of file