2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2026-05-03 11:40:29 +00:00

69 Commits

Author SHA1 Message Date
d0ae5d5342 fix 2024-04-26 21:17:38 +04:00
b88202ae38 fix color 2024-04-26 20:36:00 +04:00
3c4e45dfe2 remove debug 2024-04-26 20:10:18 +04:00
abd19c1c3a pageable show command 2024-04-26 20:09:15 +04:00
b406c89406 remove yourkit 2024-04-24 12:17:28 +04:00
91c3845b2e add network id 2024-04-22 16:44:35 +04:00
97e6b5c944 update config / readme 2024-04-21 16:00:03 +04:00
65ac465915 add default values to commands config 2024-04-18 14:23:17 +04:00
32826d843c finsh up command system 2024-04-18 12:48:00 +04:00
78561fa467 improve rb ocmmand 2024-04-15 05:36:52 +04:00
ab441503c7 correctly remove heartbeat on cleanup 2024-04-15 05:23:38 +04:00
51719f13e2 show command 2024-04-15 05:06:36 +04:00
2015d1d0fd remove debug message 2024-04-15 03:36:44 +04:00
70aacc99c0 use continue instead of break 2024-04-15 03:32:30 +04:00
72025bc22c fix wrong use method of inetaddres in player data manager 2024-04-14 13:19:08 +04:00
de65b163e2 finish up the commands 2024-04-14 11:58:04 +04:00
1e7f474a09 adding first batch of commands 2024-04-14 08:40:16 +04:00
19064e0a60 impl: redis clean up task, taken from brains impl. 2024-04-14 08:04:08 +04:00
e76f0d0a00 finish up the version command etc 2024-04-14 07:09:05 +04:00
40c542a50a new command infrastructure 2024-04-14 05:54:08 +04:00
86f64ab019 move all depeneds management into settings.gradle.kts and include acf lib 2024-04-13 23:57:00 +04:00
41b5bde55c insert todo into langauge system 2024-04-13 22:27:26 +04:00
e5b1f9d76e update adventure 2024-04-13 22:22:19 +04:00
ThiagoROX
0b8dc4bde6 provide pt-br translation
Signed-off-by: mohammed jasem alaajel <xrambad@gmail.com>
2024-04-12 22:37:33 +04:00
782f0994c2 [skip ci] Update readme about the transfer packets x3 2024-04-12 22:37:33 +04:00
ca8377ad4c [skip ci] Update readme about the transfer packets 2024-04-12 22:37:33 +04:00
69c3e30344 [skip ci] Update readme about the transfer packets 2024-04-12 22:37:33 +04:00
b3eacbd1c4 typo in redis minimal version 2024-04-12 22:37:33 +04:00
72b2d46dcd update redis wrong version message 2024-04-12 22:37:33 +04:00
44175e8a68 fix redis version detection 2024-04-12 22:37:33 +04:00
6c27228920 fix for lang too 2024-04-12 22:37:33 +04:00
2eb7f3cf9d Fix wrong config version 2024-04-12 22:37:33 +04:00
1c36aa5418 remove lang system for commands
commands will be included in seperate plugins for each platforms.
NOTE: because of this commands `Modules` will be used as example to access
the API
2024-04-12 22:37:33 +04:00
c56a64bbc2 update depends & Gradle 2024-04-12 22:37:33 +04:00
2429cc63d5 load common command messages 2024-04-12 22:37:33 +04:00
46d53fc018 config changes 2024-04-12 22:37:33 +04:00
d70a5de829 Only allow 6.2 or above of redis versions 2024-04-12 22:37:33 +04:00
a6c6916103 remove arabic for now, and finish up the lang file 2024-04-12 22:37:33 +04:00
fa7ca2dacb checkstyle 2024-04-12 22:37:33 +04:00
da255860bd remove debug message 2024-04-12 22:37:33 +04:00
983693b929 Language system implementation, commands still not translatable yet, finish up configs system 2024-04-12 22:37:33 +04:00
32b5e829ba gradle update 2024-04-12 22:37:33 +04:00
383e647c87 split some functions from config loader to be common 2024-04-12 22:37:33 +04:00
9b54ca93db remove old commands system, rename register leagacy command to register commands. 2024-04-12 22:37:33 +04:00
eed91dd73d fix some issues on lang file 2024-04-12 22:37:33 +04:00
b76709c291 change %s to it placeholders 2024-04-12 22:37:33 +04:00
4f6529b295 provide arabic translation 2024-04-12 22:37:33 +04:00
97cdf31cfc provide better info from the wiki 2024-04-12 22:37:33 +04:00
5ea8932ac4 lang file changes 2024-04-12 22:37:33 +04:00
20932d894b addtional stuff for lang config file 2024-04-12 22:37:33 +04:00
6bcba06f7a ignore bungeecord commands override on velocity 2024-04-12 22:37:33 +04:00
76c362cf66 log version / build date 2024-04-12 22:37:33 +04:00
b7433bc9a3 Remove unnecessary public in some methods in plugin interface 2024-04-12 22:37:33 +04:00
7ba54ebfe2 include build date 2024-04-12 22:37:33 +04:00
dd38532501 config log changes, introduction of new env REDISBUNGEE_PROXY_ID 2024-04-12 22:37:33 +04:00
7183e809d0 bungeecord version 2024-04-12 22:37:33 +04:00
d1d848fa8c remove tests as its no longer used 2024-04-12 22:37:33 +04:00
e70a6e305c implement last server connect on join, closes #84 2024-04-12 22:37:33 +04:00
e897a60976 remove all old messages code, new lang file 2024-04-12 22:37:33 +04:00
f6e1ca65bf make varable for depeneds, remove javadocs for adventure from implementations javadocs 2024-04-12 22:37:33 +04:00
11a0d84368 remove weird javadocs 2024-04-12 22:37:33 +04:00
a0fdd6d997 welcome adventure api
MiniMessage is now used for Messages.yml

fix bug when from is null when server change
2024-04-12 22:37:33 +04:00
3c4f0d8c93 oops forgotten to change something for kick when online 2024-04-12 22:37:33 +04:00
6d40c1902a change false to true as default for kick-when-online option 2024-04-12 22:37:33 +04:00
a2f1ec22c6 remove autoclosable interface from proxy data manager 2024-04-12 22:37:33 +04:00
16576ab4c2 new config options: handle-motd, reconnect to last server 2024-04-12 22:37:33 +04:00
f96c5759a2 config changes
jedispool is now disabled by default, some minor config changes
2024-04-12 22:37:33 +04:00
8aaae6702e new data system 2024-04-12 22:37:02 +04:00
006066f66c prepare for 0.12.0 2024-04-12 22:36:07 +04:00
8 changed files with 34 additions and 33 deletions

View File

@@ -35,6 +35,7 @@ blossom {
commit = "$commitStdout".replace("\n", "") // for some reason it adds new line so remove it. commit = "$commitStdout".replace("\n", "") // for some reason it adds new line so remove it.
commitStdout.close() commitStdout.close()
replaceToken("@git_commit@", commit) replaceToken("@git_commit@", commit)
replaceToken("@build_date@", "${Instant.now().epochSecond}")
} }

View File

@@ -15,6 +15,7 @@ public class Constants {
public final static String VERSION = "@version@"; public final static String VERSION = "@version@";
public final static String GIT_COMMIT = "@git_commit@"; public final static String GIT_COMMIT = "@git_commit@";
public final static long BUILD_DATE = Long.parseLong("@build_date@");
public static String getGithubCommitLink() { public static String getGithubCommitLink() {
return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT; return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT;

View File

@@ -12,6 +12,7 @@ package com.imaginarycode.minecraft.redisbungee.api.config.loaders;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;

View File

@@ -56,7 +56,7 @@ network-id: "main"
# You can set Environment variable 'REDISBUNGEE_PROXY_ID' to override # You can set Environment variable 'REDISBUNGEE_PROXY_ID' to override
proxy-id: "proxy-1" proxy-id: "proxy-1"
# since RedisBungee Internally now uses UnifiedJedis instead of Jedis, JedisPool. # since RedisBungee Internally now uses JedisPooled instead of Jedis, JedisPool.
# which will break compatibility with old plugins that uses RedisBungee JedisPool # which will break compatibility with old plugins that uses RedisBungee JedisPool
# so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons. # so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons.
# disabled by default # disabled by default

View File

@@ -197,6 +197,7 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
public void initialize() { public void initialize() {
logInfo("Initializing RedisBungee....."); logInfo("Initializing RedisBungee.....");
logInfo("Version: {}", Constants.VERSION); logInfo("Version: {}", Constants.VERSION);
logInfo("Build date: {}", Date.from(Instant.ofEpochSecond(Constants.BUILD_DATE)));
ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory(); ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory();
ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory); ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory);
try { try {

View File

@@ -11,7 +11,6 @@
package com.imaginarycode.minecraft.redisbungee.commands; package com.imaginarycode.minecraft.redisbungee.commands;
import co.aikar.commands.CommandIssuer; import co.aikar.commands.CommandIssuer;
import co.aikar.commands.RegisteredCommand;
import co.aikar.commands.annotation.*; import co.aikar.commands.annotation.*;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import com.imaginarycode.minecraft.redisbungee.Constants; import com.imaginarycode.minecraft.redisbungee.Constants;
@@ -27,12 +26,12 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@CommandAlias("rb|redisbungee") @CommandAlias("rb|redisbungee")
@CommandPermission("redisbungee.command.use") @CommandPermission("redisbungee.command.use")
@Description("Main command")
public class CommandRedisBungee extends AdventureBaseCommand { public class CommandRedisBungee extends AdventureBaseCommand {
private final RedisBungeePlugin<?> plugin; private final RedisBungeePlugin<?> plugin;
@@ -43,12 +42,12 @@ public class CommandRedisBungee extends AdventureBaseCommand {
@Default @Default
@Subcommand("info|version|git") @Subcommand("info|version|git")
@Description("information about current redisbungee build")
public void info(CommandIssuer issuer) { public void info(CommandIssuer issuer) {
final String message = """ final String message = """
<color:aqua>This proxy is running RedisBungee Limework's fork <color:aqua>This proxy is running RedisBungee Limework's fork
<color:gold>======================================== <color:gold>========================================
<color:aqua>RedisBungee version: <color:green><version> <color:aqua>RedisBungee version: <color:green><version>
<color:aqua>Build date: <color:green><build-date>
<color:aqua>Commit: <color:green><commit> <color:aqua>Commit: <color:green><commit>
<color:gold>======================================== <color:gold>========================================
<color:gold>run /rb help for more commands"""; <color:gold>run /rb help for more commands""";
@@ -58,6 +57,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
.deserialize( .deserialize(
message, message,
Placeholder.component("version", Component.text(Constants.VERSION)), Placeholder.component("version", Component.text(Constants.VERSION)),
Placeholder.component("build-date", Component.text( new Date(Constants.BUILD_DATE * 1000).toString() )),
Placeholder.component( Placeholder.component(
"commit", "commit",
Component.text(Constants.GIT_COMMIT.substring(0, 8)) Component.text(Constants.GIT_COMMIT.substring(0, 8))
@@ -67,29 +67,19 @@ public class CommandRedisBungee extends AdventureBaseCommand {
} }
// <color:aqua>......: <color:green>...... // <color:aqua>......: <color:green>......
@HelpCommand @HelpCommand
@Description("shows the help page")
public void help(CommandIssuer issuer) { public void help(CommandIssuer issuer) {
final String barFormat = "<color:gold>========================================"; final String message = """
final String commandFormat = "<color:aqua>/rb <sub-command>: <color:green><description>"; <color:gold>========================================
<color:aqua>/rb info: <color:green>shows info of this version.
TextComponent.Builder message = Component.text(); <color:aqua>/rb help: <color:green>shows this page.
message.append(MiniMessage.miniMessage().deserialize(barFormat)); <color:aqua>/rb clean: <color:green>cleans up the uuid cache
<color:red><bold>WARNING...</bold> <color:white>command above could cause performance issues
getSubCommands().forEach((subCommand, registeredCommand) -> { <color:aqua>/rb show: <color:green>shows list of proxies with player count
String[] split = registeredCommand.getCommand().split(" "); <color:gold>========================================
if (split.length > 1 && subCommand.equalsIgnoreCase(split[1])) { <color:gold>run /rb help for more commands""";
message.appendNewline().append(MiniMessage.miniMessage().deserialize(commandFormat, Placeholder.component("sub-command", Component.text(subCommand)), sendMessage(issuer, MiniMessage.miniMessage().deserialize(message));
Placeholder.component("description", MiniMessage.miniMessage().deserialize(registeredCommand.getHelpText()))
));
}
});
message.appendNewline().append(MiniMessage.miniMessage().deserialize(barFormat));
sendMessage(issuer, message.build());
} }
@Subcommand("clean") @Subcommand("clean")
@Description("cleans up the uuid cache<color:red> <bold>WARNING...</bold> <color:white>command above could cause performance issues")
@Private @Private
public void cleanUp(CommandIssuer issuer) { public void cleanUp(CommandIssuer issuer) {
if (StopperUUIDCleanupTask.isRunning) { if (StopperUUIDCleanupTask.isRunning) {
@@ -109,7 +99,6 @@ public class CommandRedisBungee extends AdventureBaseCommand {
} }
@Subcommand("show") @Subcommand("show")
@Description("Shows proxies in this network")
public void showProxies(CommandIssuer issuer, String[] args) { public void showProxies(CommandIssuer issuer, String[] args) {
final String closer = "<color:gold>========================================"; final String closer = "<color:gold>========================================";
final String pageTop = "<color:yellow>Page: <color:green><current>/<max> <color:yellow>Network ID: <color:green><network> <color:yellow>Proxies online: <color:green><proxies>"; final String pageTop = "<color:yellow>Page: <color:green><current>/<max> <color:yellow>Network ID: <color:green><network> <color:yellow>Proxies online: <color:green><proxies>";
@@ -134,6 +123,15 @@ public class CommandRedisBungee extends AdventureBaseCommand {
} else currentPage = 1; } else currentPage = 1;
var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet()); var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet());
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
data.addAll(data);
// there is no way this runs because there is always an heartbeat. // there is no way this runs because there is always an heartbeat.
// if not could be some shenanigans done by devs :P // if not could be some shenanigans done by devs :P
if (data.isEmpty()) { if (data.isEmpty()) {
@@ -141,7 +139,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
return; return;
} }
// compute the total pages // compute the total pages
int maxPages = (int) Math.ceil(data.size() / (double) pageSize); int maxPages = data.size() < pageSize ? 1 : data.size() / pageSize ;
if (currentPage > maxPages) currentPage = maxPages; if (currentPage > maxPages) currentPage = maxPages;
var subList = subListProxies(data, currentPage, pageSize); var subList = subListProxies(data, currentPage, pageSize);
TextComponent.Builder builder = Component.text(); TextComponent.Builder builder = Component.text();
@@ -171,19 +169,17 @@ public class CommandRedisBungee extends AdventureBaseCommand {
} }
if (currentPage > 1) { if (currentPage > 1) {
builder.append(MiniMessage.miniMessage().deserialize(previousPage) builder.append(MiniMessage.miniMessage().deserialize(previousPage)
.color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage - 1)))); .clickEvent(ClickEvent.runCommand("/rb show " + (currentPage - 1))));
} else {
builder.append(MiniMessage.miniMessage().deserialize(previousPage).color(NamedTextColor.GRAY));
} }
if (subList.size() == pageSize && !subListProxies(data, currentPage + 1, pageSize).isEmpty()) { if (subList.size() == pageSize && !subListProxies(data, currentPage + 1, pageSize).isEmpty()) {
builder.append(MiniMessage.miniMessage().deserialize(nextPage) builder.append(MiniMessage.miniMessage().deserialize(nextPage)
.color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1)))); .clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1))));
} else {
builder.append(MiniMessage.miniMessage().deserialize(nextPage).color(NamedTextColor.GRAY));
} }
builder.appendNewline(); builder.appendNewline();
builder.append(MiniMessage.miniMessage().deserialize(closer)); builder.append(MiniMessage.miniMessage().deserialize(closer));
sendMessage(issuer, builder.build()); sendMessage(issuer, builder.build());
} }
} }

View File

@@ -102,6 +102,7 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
this.logger = logger; this.logger = logger;
this.dataFolder = dataDirectory; this.dataFolder = dataDirectory;
logInfo("Version: {}", Constants.VERSION); logInfo("Version: {}", Constants.VERSION);
logInfo("Build date: {}", Date.from(Instant.ofEpochSecond(Constants.BUILD_DATE)));
try { try {
loadConfig(this, dataDirectory); loadConfig(this, dataDirectory);
loadLangConfig(this, dataDirectory); loadLangConfig(this, dataDirectory);

View File

@@ -1,2 +1,2 @@
group=com.imaginarycode.minecraft group=com.imaginarycode.minecraft
version=0.12.0 version=0.12.0-SNAPSHOT