diff --git a/plugin-message-api/LICENSE b/plugin-message-api/LICENSE deleted file mode 100644 index f6381bb..0000000 --- a/plugin-message-api/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2024-present RedisBungee contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/plugin-message-api/api/build.gradle.kts b/plugin-message-api/api/build.gradle.kts deleted file mode 100644 index f9c4947..0000000 --- a/plugin-message-api/api/build.gradle.kts +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - `java-library` - `maven-publish` - -} - -dependencies { - api(project(":Limework-Plugin-Message-API-Protocol")) - compileOnly(libs.guava) -} - -tasks { - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) // use java 8 for shit servers that still stuck on minecraft 1.8 - } - javadoc { - options.encoding = Charsets.UTF_8.name() - } - processResources { - filteringCharset = Charsets.UTF_8.name() - } -} - -publishing { - publications { - create("maven") { - from(components["java"]) - } - } -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/models/Proxy.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/models/Proxy.java deleted file mode 100644 index 01d0d9e..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/models/Proxy.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.limework.valiobungee.pluginmessage.models; - -public class Proxy { - - private String proxyId; - - private int players; - - public Proxy() { - } - - public Proxy(String proxyId, int players) { - this.proxyId = proxyId; - this.players = players; - } - - public String proxyId() { - return proxyId; - } - - public int players() { - return players; - } -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/ProxyboundHandler.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/ProxyboundHandler.java deleted file mode 100644 index 862a73c..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/ProxyboundHandler.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.limework.valiobungee.pluginmessage.protocol; - -import net.limework.pluginmessageapi.protocol.PluginMessageHandler; -import net.limework.valiobungee.pluginmessage.protocol.messages.proxybound.RequestProxiesListMessage; - -public interface ProxyboundHandler extends PluginMessageHandler { - - void handle(RequestProxiesListMessage message); - -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/ServerboundHandler.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/ServerboundHandler.java deleted file mode 100644 index d8a2adc..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/ServerboundHandler.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.limework.valiobungee.pluginmessage.protocol; - -import net.limework.pluginmessageapi.protocol.PluginMessageHandler; -import net.limework.valiobungee.pluginmessage.protocol.messages.servebound.ProxiesListMessage; - -public interface ServerboundHandler extends PluginMessageHandler { - - void handle(ProxiesListMessage message); - -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/Registry.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/Registry.java deleted file mode 100644 index 031638d..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/Registry.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.limework.valiobungee.pluginmessage.protocol.messages; - -import net.limework.pluginmessageapi.protocol.PluginMessageRegistry; -import net.limework.valiobungee.pluginmessage.protocol.messages.proxybound.RequestProxiesListMessage; -import net.limework.valiobungee.pluginmessage.protocol.messages.servebound.ProxiesListMessage; - -public class Registry { - - private static final PluginMessageRegistry serverbound = new PluginMessageRegistry(); - - private static final PluginMessageRegistry proxybound = new PluginMessageRegistry(); - - static { - registerProxybound(); - registerServerbound(); - } - - private static void registerServerbound() { - serverbound.register(0, ProxiesListMessage.class, ProxiesListMessage::new); - } - - - private static void registerProxybound() { - proxybound.register(0, RequestProxiesListMessage.class, RequestProxiesListMessage::new); - } - - - public static PluginMessageRegistry serverbound() { - return serverbound; - } - - - public static PluginMessageRegistry proxybound() { - return proxybound; - } - - -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/proxybound/RequestMessage.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/proxybound/RequestMessage.java deleted file mode 100644 index 50f75f6..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/proxybound/RequestMessage.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.limework.valiobungee.pluginmessage.protocol.messages.proxybound; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import net.limework.pluginmessageapi.protocol.PluginMessage; - - -public abstract class RequestMessage extends PluginMessage { - - - public RequestMessage() { - - } - - @Override - public void encode(ByteArrayDataOutput out) { - // do nothing - } - - @Override - public void decode(ByteArrayDataInput in) { - // do nothing - } -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/proxybound/RequestProxiesListMessage.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/proxybound/RequestProxiesListMessage.java deleted file mode 100644 index c0c7ff5..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/proxybound/RequestProxiesListMessage.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.limework.valiobungee.pluginmessage.protocol.messages.proxybound; - -import net.limework.pluginmessageapi.protocol.PluginMessageHandler; -import net.limework.valiobungee.pluginmessage.protocol.ProxyboundHandler; - -public class RequestProxiesListMessage extends RequestMessage { - - public RequestProxiesListMessage() { - } - - @Override - public void handle(PluginMessageHandler handler) { - ((ProxyboundHandler) handler).handle(this); - } -} diff --git a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/servebound/ProxiesListMessage.java b/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/servebound/ProxiesListMessage.java deleted file mode 100644 index e2583d1..0000000 --- a/plugin-message-api/api/src/main/java/net/limework/valiobungee/pluginmessage/protocol/messages/servebound/ProxiesListMessage.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.limework.valiobungee.pluginmessage.protocol.messages.servebound; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import net.limework.pluginmessageapi.protocol.PluginMessage; -import net.limework.pluginmessageapi.protocol.PluginMessageHandler; -import net.limework.valiobungee.pluginmessage.models.Proxy; -import net.limework.valiobungee.pluginmessage.protocol.ServerboundHandler; - -public class ProxiesListMessage extends PluginMessage { - - private Proxy[] proxies; - - public ProxiesListMessage() { - - } - - public Proxy[] proxies() { - return proxies; - } - - @Override - public void decode(ByteArrayDataInput in) { - int proxiesNumber = in.readInt(); - this.proxies = new Proxy[proxiesNumber]; - for (int i = 0; i < proxiesNumber; i++) { - String id = in.readUTF(); - int players = in.readInt(); - proxies[i] = new Proxy(id, players); - } - } - - @Override - public void encode(ByteArrayDataOutput out) { - out.writeInt(proxies.length); - for (Proxy proxy : proxies) { - out.writeUTF(proxy.proxyId()); - out.writeInt(proxy.players()); - } - } - - @Override - public void handle(PluginMessageHandler handler) { - ((ServerboundHandler) handler).handle(this); - } -} diff --git a/plugin-message-api/copyright_print_mit.txt b/plugin-message-api/copyright_print_mit.txt deleted file mode 100644 index 58da367..0000000 --- a/plugin-message-api/copyright_print_mit.txt +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2013-present RedisBungee contributors - -All rights reserved. This program and the accompanying materials -are made available under the terms of the MIT License -which accompanies this api, and is available at - -https://opensource.org/license/mit \ No newline at end of file diff --git a/plugin-message-api/protocol/build.gradle.kts b/plugin-message-api/protocol/build.gradle.kts deleted file mode 100644 index 09b1bf9..0000000 --- a/plugin-message-api/protocol/build.gradle.kts +++ /dev/null @@ -1,30 +0,0 @@ -plugins { - `java-library` - `maven-publish` - -} - -dependencies { - compileOnly(libs.guava) -} - -tasks { - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - javadoc { - options.encoding = Charsets.UTF_8.name() - } - processResources { - filteringCharset = Charsets.UTF_8.name() - } -} - -publishing { - publications { - create("maven") { - from(components["java"]) - } - } -} diff --git a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/MessageEncoderDecoder.java b/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/MessageEncoderDecoder.java deleted file mode 100644 index 1ecc3d2..0000000 --- a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/MessageEncoderDecoder.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.limework.pluginmessageapi.protocol; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; - -public class MessageEncoderDecoder { - - private final PluginMessageRegistry registry; - - public MessageEncoderDecoder(PluginMessageRegistry registry) { - this.registry = registry; - } - - public byte[] encode(PluginMessage pluginMessage) { - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - // write packet id - out.write(registry.idByMessage(pluginMessage.getClass())); - pluginMessage.encode(out); - return out.toByteArray(); - } - - public PluginMessage decode(byte[] data) { - ByteArrayDataInput in = ByteStreams.newDataInput(data); - int messageId = in.readInt(); - PluginMessage pluginMessage = registry.messageById(messageId); - pluginMessage.decode(in); - return pluginMessage; - } - -} diff --git a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessage.java b/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessage.java deleted file mode 100644 index 8ebe77e..0000000 --- a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessage.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.limework.pluginmessageapi.protocol; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; - -public abstract class PluginMessage { - - - public abstract void decode(ByteArrayDataInput in); - - public abstract void encode(ByteArrayDataOutput out); - - public abstract void handle(PluginMessageHandler handler); - - -} diff --git a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessageHandler.java b/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessageHandler.java deleted file mode 100644 index 3596564..0000000 --- a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessageHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.limework.pluginmessageapi.protocol; - -public interface PluginMessageHandler { - - - - - -} diff --git a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessageRegistry.java b/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessageRegistry.java deleted file mode 100644 index 1b58fb2..0000000 --- a/plugin-message-api/protocol/src/main/java/net/limework/pluginmessageapi/protocol/PluginMessageRegistry.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.limework.pluginmessageapi.protocol; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; - -public class PluginMessageRegistry { - - private final Map> messageById = new HashMap<>(); - private final Map, Integer> idByMessage = new HashMap<>(); - - - public void register(int id, Class clazz, Supplier messageSupplier) { - messageById.put(id, messageSupplier); - idByMessage.put(clazz, id); - } - - - public PluginMessage messageById(int id) { - if (!messageById.containsKey(id)) { - throw new IllegalArgumentException("plugin Message id " + id + " does not exists in the registry"); - } - return messageById.get(id).get(); - } - - - public int idByMessage(Class clazz) { - if (!idByMessage.containsKey(clazz)) { - throw new IllegalArgumentException("plugin Message clazz " + clazz + " does not exists in the registry"); - } - return idByMessage.get(clazz); - } - -} diff --git a/settings.gradle.kts b/settings.gradle.kts index 5e43083..ad4fec8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,9 +14,6 @@ val projects = arrayOf( ":RedisBungee-Proxy-Bungee" to "proxies/bungeecord", ":RedisBungee-Velocity" to "proxies/velocity/velocity-api", ":RedisBungee-Proxy-Velocity" to "proxies/velocity", - ":Limework-Plugin-Message-API-Protocol" to "plugin-message-api/protocol", - ":RedisBungee-Plugin-Message-API" to "plugin-message-api/api", - ":RedisBungee-Plugin-Message-API-Paper" to "plugin-message-api/api/paper" )