diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java b/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java index 44fdc99..4f1609c 100644 --- a/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java +++ b/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java @@ -24,7 +24,6 @@ import net.raphimc.vialoader.impl.platform.ViaBedrockPlatformImpl; import net.raphimc.vialoader.impl.platform.ViaRewindPlatformImpl; import net.raphimc.viaproxy.plugins.PluginManager; import net.raphimc.viaproxy.plugins.events.ProtocolHackInitEvent; -import net.raphimc.viaproxy.protocolhack.impl.ViaProxyVLInjector; import net.raphimc.viaproxy.protocolhack.impl.ViaProxyVLLoader; import net.raphimc.viaproxy.protocolhack.impl.ViaProxyViaLegacyPlatformImpl; import net.raphimc.viaproxy.protocolhack.impl.ViaProxyViaVersionPlatformImpl; @@ -39,7 +38,7 @@ public class ProtocolHack { public static void init() { patchConfigs(); final Supplier[] platformSuppliers = PluginManager.EVENT_MANAGER.call(new ProtocolHackInitEvent(ViaBackwardsPlatformImpl::new, ViaRewindPlatformImpl::new, ViaProxyViaLegacyPlatformImpl::new, ViaAprilFoolsPlatformImpl::new, ViaBedrockPlatformImpl::new)).getPlatformSuppliers().toArray(new Supplier[0]); - ViaLoader.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVLLoader(), new ViaProxyVLInjector(), null, platformSuppliers); + ViaLoader.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVLLoader(), null, null, platformSuppliers); } private static void patchConfigs() { diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyVLInjector.java b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyVLInjector.java deleted file mode 100644 index 6b3dce6..0000000 --- a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyVLInjector.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy - * Copyright (C) 2023 RK_01/RaphiMC and 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 net.raphimc.viaproxy.protocolhack.impl; - -import com.viaversion.viaversion.libs.gson.JsonArray; -import com.viaversion.viaversion.libs.gson.JsonObject; -import net.raphimc.vialoader.impl.viaversion.VLInjector; -import net.raphimc.viaproxy.ViaProxy; -import net.raphimc.viaproxy.plugins.PluginManager; -import net.raphimc.viaproxy.plugins.ViaProxyPlugin; - -public class ViaProxyVLInjector extends VLInjector { - - @Override - public JsonObject getDump() { - final JsonObject root = new JsonObject(); - - root.addProperty("version", ViaProxy.VERSION); - root.addProperty("impl_version", ViaProxy.IMPL_VERSION); - - final JsonArray plugins = new JsonArray(); - for (ViaProxyPlugin plugin : PluginManager.getPlugins()) { - final JsonObject pluginObj = new JsonObject(); - pluginObj.addProperty("name", plugin.getName()); - pluginObj.addProperty("version", plugin.getVersion()); - pluginObj.addProperty("author", plugin.getAuthor()); - plugins.add(pluginObj); - } - root.add("plugins", plugins); - - return root; - } - -} diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java index 6db3ef8..b83feab 100644 --- a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java +++ b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java @@ -17,8 +17,13 @@ */ package net.raphimc.viaproxy.protocolhack.impl; +import com.viaversion.viaversion.libs.gson.JsonArray; +import com.viaversion.viaversion.libs.gson.JsonObject; import net.raphimc.vialoader.impl.platform.ViaVersionPlatformImpl; +import net.raphimc.viaproxy.ViaProxy; import net.raphimc.viaproxy.cli.ConsoleFormatter; +import net.raphimc.viaproxy.plugins.PluginManager; +import net.raphimc.viaproxy.plugins.ViaProxyPlugin; import java.util.UUID; @@ -33,4 +38,24 @@ public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl { super.sendMessage(uuid, ConsoleFormatter.convert(msg)); } + @Override + public JsonObject getDump() { + final JsonObject root = new JsonObject(); + + root.addProperty("version", ViaProxy.VERSION); + root.addProperty("impl_version", ViaProxy.IMPL_VERSION); + + final JsonArray plugins = new JsonArray(); + for (ViaProxyPlugin plugin : PluginManager.getPlugins()) { + final JsonObject pluginObj = new JsonObject(); + pluginObj.addProperty("name", plugin.getName()); + pluginObj.addProperty("version", plugin.getVersion()); + pluginObj.addProperty("author", plugin.getAuthor()); + plugins.add(pluginObj); + } + root.add("plugins", plugins); + + return root; + } + }