2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 18:48:02 +00:00

reduce code used in settings.gradle.kts, changes to plugin message

This commit is contained in:
mohammed jasem alaajel 2024-05-16 18:38:41 +04:00 committed by Mohammed Alteneiji
parent 0c153b99ff
commit 8536b70de7
Signed by: ham1255
GPG Key ID: EF343502046229F4
13 changed files with 69 additions and 81 deletions

View File

View File

@ -1,4 +1,4 @@
Copyright 2024 <COPYRIGHT HOLDER> 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: 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:

View File

@ -5,14 +5,14 @@ plugins {
} }
dependencies { dependencies {
compileOnly(project(":Limework-Plugin-Message-API-Protocol")) api(project(":Limework-Plugin-Message-API-Protocol"))
compileOnly(libs.guava) compileOnly(libs.guava)
} }
tasks { tasks {
compileJava { compileJava {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(8) // use java 8 for shit servers that still stuck on 1.8 options.release.set(17) // use java 8 for shit servers that still stuck on minecraft 1.8
} }
javadoc { javadoc {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()

View File

@ -3,9 +3,8 @@ package net.limework.valiobungee.pluginmessage.protocol;
import net.limework.pluginmessageapi.protocol.PluginMessageHandler; import net.limework.pluginmessageapi.protocol.PluginMessageHandler;
import net.limework.valiobungee.pluginmessage.protocol.messages.proxybound.RequestProxiesListMessage; import net.limework.valiobungee.pluginmessage.protocol.messages.proxybound.RequestProxiesListMessage;
public class ProxyboundHandler implements PluginMessageHandler { public interface ProxyboundHandler extends PluginMessageHandler {
public void handle(RequestProxiesListMessage message) { void handle(RequestProxiesListMessage message);
}
} }

View File

@ -3,11 +3,8 @@ package net.limework.valiobungee.pluginmessage.protocol;
import net.limework.pluginmessageapi.protocol.PluginMessageHandler; import net.limework.pluginmessageapi.protocol.PluginMessageHandler;
import net.limework.valiobungee.pluginmessage.protocol.messages.servebound.ProxiesListMessage; import net.limework.valiobungee.pluginmessage.protocol.messages.servebound.ProxiesListMessage;
public class ServerboundHandler implements PluginMessageHandler { public interface ServerboundHandler extends PluginMessageHandler {
public void handle(ProxiesListMessage message) {
}
void handle(ProxiesListMessage message);
} }

View File

@ -0,0 +1,38 @@
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;
}
}

View File

@ -3,7 +3,11 @@ package net.limework.valiobungee.pluginmessage.protocol.messages.proxybound;
import net.limework.pluginmessageapi.protocol.PluginMessageHandler; import net.limework.pluginmessageapi.protocol.PluginMessageHandler;
import net.limework.valiobungee.pluginmessage.protocol.ProxyboundHandler; import net.limework.valiobungee.pluginmessage.protocol.ProxyboundHandler;
public class RequestProxiesListMessage extends RequestMessage{ public class RequestProxiesListMessage extends RequestMessage {
public RequestProxiesListMessage() {
}
@Override @Override
public void handle(PluginMessageHandler handler) { public void handle(PluginMessageHandler handler) {
((ProxyboundHandler) handler).handle(this); ((ProxyboundHandler) handler).handle(this);

View File

@ -11,8 +11,8 @@ public class ProxiesListMessage extends PluginMessage {
private Proxy[] proxies; private Proxy[] proxies;
public ProxiesListMessage(Proxy[] proxies) { public ProxiesListMessage() {
this.proxies = proxies;
} }
public Proxy[] proxies() { public Proxy[] proxies() {

View File

@ -11,7 +11,7 @@ dependencies {
tasks { tasks {
compileJava { compileJava {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(8) // use java 8 for shit servers that still stuck on 1.8 options.release.set(17)
} }
javadoc { javadoc {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()

View File

@ -1,41 +0,0 @@
package net.limework.pluginmessageapi.protocol.messages;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import net.limework.pluginmessageapi.protocol.PluginMessageHandler;
import net.limework.pluginmessageapi.protocol.PluginMessage;
// example plugin message class
public class HelloMessage extends PluginMessage {
private String helloWorld;
private static final String DEFAULT_MESSAGE = "hello from Limework!";
public HelloMessage(String helloWorld) {
this.helloWorld = helloWorld != null ? helloWorld : DEFAULT_MESSAGE;
}
@Override
public void decode(ByteArrayDataInput in) {
this.helloWorld = in.readUTF();
}
@Override
public void encode(ByteArrayDataOutput out) {
out.writeUTF(this.helloWorld);
}
@Override
public void handle(PluginMessageHandler messageHandler) {
// messageHandler.handle(this);
}
public void setHelloWorldMessage(String helloWorld) {
this.helloWorld = helloWorld != null ? helloWorld : DEFAULT_MESSAGE;
}
public String helloWorld() {
return helloWorld;
}
}

View File

@ -6,33 +6,24 @@ pluginManagement {
rootProject.name = "ValioBungee" rootProject.name = "ValioBungee"
include(":RedisBungee-API") val projects = arrayOf(
project(":RedisBungee-API").projectDir = file("api") ":RedisBungee-API" to "api",
":RedisBungee-Commands" to "commands",
include(":RedisBungee-Commands") ":RedisBungee-Velocity" to "proxies/velocity",
project(":RedisBungee-Commands").projectDir = file("commands") ":RedisBungee-Bungee" to "proxies/bungeecord/bungeecord-api",
":RedisBungee-Proxy-Bungee" to "proxies/bungeecord",
include(":RedisBungee-Velocity") ":RedisBungee-Velocity" to "proxies/velocity/velocity-api",
project(":RedisBungee-Velocity").projectDir = file("proxies/velocity") ":RedisBungee-Proxy-Velocity" to "proxies/velocity",
":Limework-Plugin-Message-API-Protocol" to "plugin-message-api/protocol",
include(":RedisBungee-Bungee") ":RedisBungee-Plugin-Message-API" to "plugin-message-api/api",
project(":RedisBungee-Bungee").projectDir = file("proxies/bungeecord/bungeecord-api") ":RedisBungee-Plugin-Message-API-Paper" to "plugin-message-api/api/paper"
)
include(":RedisBungee-Proxy-Bungee")
project(":RedisBungee-Proxy-Bungee").projectDir = file("proxies/bungeecord")
include(":RedisBungee-Velocity")
project(":RedisBungee-Velocity").projectDir = file("proxies/velocity/velocity-api")
include(":RedisBungee-Proxy-Velocity")
project(":RedisBungee-Proxy-Velocity").projectDir = file("proxies/velocity")
include(":Limework-Plugin-Message-API-Protocol")
project(":Limework-Plugin-Message-API-Protocol").projectDir = file("plugin-message-api/protocol")
include(":RedisBungee-Plugin-Message-API")
project(":RedisBungee-Plugin-Message-API").projectDir = file("plugin-message-api/redisbungee")
projects.forEach { (projectName, filePath) ->
include(projectName)
project(projectName).projectDir = file(filePath)
}
dependencyResolutionManagement { dependencyResolutionManagement {
repositories { repositories {