Compare commits
6 Commits
d0ae5d5342
...
1decbd6c7b
Author | SHA1 | Date |
---|---|---|
mohammed jasem alaajel | 1decbd6c7b | |
mohammed jasem alaajel | de3ce79a0e | |
mohammed jasem alaajel | 089c5d8e5f | |
mohammed jasem alaajel | 294a8a5031 | |
mohammed jasem alaajel | e8bacfe0f5 | |
mohammed jasem alaajel | dc56a419e7 |
|
@ -35,7 +35,6 @@ blossom {
|
|||
commit = "$commitStdout".replace("\n", "") // for some reason it adds new line so remove it.
|
||||
commitStdout.close()
|
||||
replaceToken("@git_commit@", commit)
|
||||
replaceToken("@build_date@", "${Instant.now().epochSecond}")
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ public class Constants {
|
|||
|
||||
public final static String VERSION = "@version@";
|
||||
public final static String GIT_COMMIT = "@git_commit@";
|
||||
public final static long BUILD_DATE = Long.parseLong("@build_date@");
|
||||
|
||||
public static String getGithubCommitLink() {
|
||||
return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT;
|
||||
|
|
|
@ -12,7 +12,6 @@ package com.imaginarycode.minecraft.redisbungee.api.config.loaders;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
|
|
|
@ -56,7 +56,7 @@ network-id: "main"
|
|||
# You can set Environment variable 'REDISBUNGEE_PROXY_ID' to override
|
||||
proxy-id: "proxy-1"
|
||||
|
||||
# since RedisBungee Internally now uses JedisPooled instead of Jedis, JedisPool.
|
||||
# since RedisBungee Internally now uses UnifiedJedis instead of Jedis, 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.
|
||||
# disabled by default
|
||||
|
|
|
@ -197,7 +197,6 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
|
|||
public void initialize() {
|
||||
logInfo("Initializing RedisBungee.....");
|
||||
logInfo("Version: {}", Constants.VERSION);
|
||||
logInfo("Build date: {}", Date.from(Instant.ofEpochSecond(Constants.BUILD_DATE)));
|
||||
ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory();
|
||||
ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory);
|
||||
try {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package com.imaginarycode.minecraft.redisbungee.commands;
|
||||
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import co.aikar.commands.RegisteredCommand;
|
||||
import co.aikar.commands.annotation.*;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.imaginarycode.minecraft.redisbungee.Constants;
|
||||
|
@ -26,12 +27,12 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
|||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@CommandAlias("rb|redisbungee")
|
||||
@CommandPermission("redisbungee.command.use")
|
||||
@Description("Main command")
|
||||
public class CommandRedisBungee extends AdventureBaseCommand {
|
||||
|
||||
private final RedisBungeePlugin<?> plugin;
|
||||
|
@ -42,12 +43,12 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
|
||||
@Default
|
||||
@Subcommand("info|version|git")
|
||||
@Description("information about current redisbungee build")
|
||||
public void info(CommandIssuer issuer) {
|
||||
final String message = """
|
||||
<color:aqua>This proxy is running RedisBungee Limework's fork
|
||||
<color:gold>========================================
|
||||
<color:aqua>RedisBungee version: <color:green><version>
|
||||
<color:aqua>Build date: <color:green><build-date>
|
||||
<color:aqua>Commit: <color:green><commit>
|
||||
<color:gold>========================================
|
||||
<color:gold>run /rb help for more commands""";
|
||||
|
@ -57,7 +58,6 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
.deserialize(
|
||||
message,
|
||||
Placeholder.component("version", Component.text(Constants.VERSION)),
|
||||
Placeholder.component("build-date", Component.text( new Date(Constants.BUILD_DATE * 1000).toString() )),
|
||||
Placeholder.component(
|
||||
"commit",
|
||||
Component.text(Constants.GIT_COMMIT.substring(0, 8))
|
||||
|
@ -67,19 +67,29 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
}
|
||||
// <color:aqua>......: <color:green>......
|
||||
@HelpCommand
|
||||
@Description("shows the help page")
|
||||
public void help(CommandIssuer issuer) {
|
||||
final String message = """
|
||||
<color:gold>========================================
|
||||
<color:aqua>/rb info: <color:green>shows info of this version.
|
||||
<color:aqua>/rb help: <color:green>shows this page.
|
||||
<color:aqua>/rb clean: <color:green>cleans up the uuid cache
|
||||
<color:red><bold>WARNING...</bold> <color:white>command above could cause performance issues
|
||||
<color:aqua>/rb show: <color:green>shows list of proxies with player count
|
||||
<color:gold>========================================
|
||||
<color:gold>run /rb help for more commands""";
|
||||
sendMessage(issuer, MiniMessage.miniMessage().deserialize(message));
|
||||
final String barFormat = "<color:gold>========================================";
|
||||
final String commandFormat = "<color:aqua>/rb <sub-command>: <color:green><description>";
|
||||
|
||||
TextComponent.Builder message = Component.text();
|
||||
message.append(MiniMessage.miniMessage().deserialize(barFormat));
|
||||
|
||||
getSubCommands().forEach((subCommand, registeredCommand) -> {
|
||||
String[] split = registeredCommand.getCommand().split(" ");
|
||||
if (split.length > 1 && subCommand.equalsIgnoreCase(split[1])) {
|
||||
message.appendNewline().append(MiniMessage.miniMessage().deserialize(commandFormat, Placeholder.component("sub-command", Component.text(subCommand)),
|
||||
Placeholder.component("description", MiniMessage.miniMessage().deserialize(registeredCommand.getHelpText()))
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
message.appendNewline().append(MiniMessage.miniMessage().deserialize(barFormat));
|
||||
|
||||
sendMessage(issuer, message.build());
|
||||
}
|
||||
@Subcommand("clean")
|
||||
@Description("cleans up the uuid cache<color:red> <bold>WARNING...</bold> <color:white>command above could cause performance issues")
|
||||
@Private
|
||||
public void cleanUp(CommandIssuer issuer) {
|
||||
if (StopperUUIDCleanupTask.isRunning) {
|
||||
|
@ -99,6 +109,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
|
||||
}
|
||||
@Subcommand("show")
|
||||
@Description("Shows proxies in this network")
|
||||
public void showProxies(CommandIssuer issuer, String[] args) {
|
||||
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>";
|
||||
|
@ -123,15 +134,6 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
} else currentPage = 1;
|
||||
|
||||
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.
|
||||
// if not could be some shenanigans done by devs :P
|
||||
if (data.isEmpty()) {
|
||||
|
@ -139,7 +141,7 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
return;
|
||||
}
|
||||
// compute the total pages
|
||||
int maxPages = data.size() < pageSize ? 1 : data.size() / pageSize ;
|
||||
int maxPages = (int) Math.ceil(data.size() / (double) pageSize);
|
||||
if (currentPage > maxPages) currentPage = maxPages;
|
||||
var subList = subListProxies(data, currentPage, pageSize);
|
||||
TextComponent.Builder builder = Component.text();
|
||||
|
@ -169,17 +171,19 @@ public class CommandRedisBungee extends AdventureBaseCommand {
|
|||
}
|
||||
if (currentPage > 1) {
|
||||
builder.append(MiniMessage.miniMessage().deserialize(previousPage)
|
||||
.clickEvent(ClickEvent.runCommand("/rb show " + (currentPage - 1))));
|
||||
.color(NamedTextColor.WHITE).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()) {
|
||||
builder.append(MiniMessage.miniMessage().deserialize(nextPage)
|
||||
.clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1))));
|
||||
.color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1))));
|
||||
} else {
|
||||
builder.append(MiniMessage.miniMessage().deserialize(nextPage).color(NamedTextColor.GRAY));
|
||||
}
|
||||
builder.appendNewline();
|
||||
builder.append(MiniMessage.miniMessage().deserialize(closer));
|
||||
sendMessage(issuer, builder.build());
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
|
|||
this.logger = logger;
|
||||
this.dataFolder = dataDirectory;
|
||||
logInfo("Version: {}", Constants.VERSION);
|
||||
logInfo("Build date: {}", Date.from(Instant.ofEpochSecond(Constants.BUILD_DATE)));
|
||||
try {
|
||||
loadConfig(this, dataDirectory);
|
||||
loadLangConfig(this, dataDirectory);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
group=com.imaginarycode.minecraft
|
||||
version=0.12.0-SNAPSHOT
|
||||
version=0.12.0
|
||||
|
|
Loading…
Reference in New Issue