2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 10:38:01 +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:

View File

@ -5,14 +5,14 @@ plugins {
}
dependencies {
compileOnly(project(":Limework-Plugin-Message-API-Protocol"))
api(project(":Limework-Plugin-Message-API-Protocol"))
compileOnly(libs.guava)
}
tasks {
compileJava {
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 {
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.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.valiobungee.pluginmessage.protocol.messages.servebound.ProxiesListMessage;
public class ServerboundHandler implements PluginMessageHandler {
public void handle(ProxiesListMessage message) {
}
public interface ServerboundHandler extends PluginMessageHandler {
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

@ -4,6 +4,10 @@ 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);

View File

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

View File

@ -11,7 +11,7 @@ dependencies {
tasks {
compileJava {
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 {
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"
include(":RedisBungee-API")
project(":RedisBungee-API").projectDir = file("api")
include(":RedisBungee-Commands")
project(":RedisBungee-Commands").projectDir = file("commands")
include(":RedisBungee-Velocity")
project(":RedisBungee-Velocity").projectDir = file("proxies/velocity")
include(":RedisBungee-Bungee")
project(":RedisBungee-Bungee").projectDir = file("proxies/bungeecord/bungeecord-api")
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")
val projects = arrayOf(
":RedisBungee-API" to "api",
":RedisBungee-Commands" to "commands",
":RedisBungee-Velocity" to "proxies/velocity",
":RedisBungee-Bungee" to "proxies/bungeecord/bungeecord-api",
":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"
)
projects.forEach { (projectName, filePath) ->
include(projectName)
project(projectName).projectDir = file(filePath)
}
dependencyResolutionManagement {
repositories {