forked from Upstream/Velocitab
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
95bc4669a8
@ -1,7 +1,7 @@
|
|||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.0'
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||||
id 'org.ajoberstar.grgit' version '5.0.0'
|
id 'org.ajoberstar.grgit' version '5.0.0'
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
@ -24,12 +24,12 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.velocitypowered:velocity-api:3.1.1'
|
compileOnly 'com.velocitypowered:velocity-api:3.1.1'
|
||||||
compileOnly 'net.luckperms:api:5.4'
|
compileOnly 'net.luckperms:api:5.4'
|
||||||
compileOnly 'dev.simplix:protocolize-api:2.2.5'
|
compileOnly 'dev.simplix:protocolize-api:2.2.6'
|
||||||
compileOnly 'io.netty:netty-codec-http:4.1.89.Final'
|
compileOnly 'io.netty:netty-codec-http:4.1.90.Final'
|
||||||
compileOnly 'io.github.miniplaceholders:miniplaceholders-api:2.0.0'
|
compileOnly 'io.github.miniplaceholders:miniplaceholders-api:2.0.0'
|
||||||
compileOnly 'net.william278:PAPIProxyBridge:1.0'
|
compileOnly 'net.william278:PAPIProxyBridge:1.0'
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.26'
|
compileOnly 'org.projectlombok:lombok:1.18.26'
|
||||||
compileOnly 'net.kyori:adventure-text-minimessage:4.12.0'
|
compileOnly 'net.kyori:adventure-text-minimessage:4.13.0'
|
||||||
|
|
||||||
implementation 'org.apache.commons:commons-text:1.10.0'
|
implementation 'org.apache.commons:commons-text:1.10.0'
|
||||||
implementation 'net.william278:Annotaml:2.0.1'
|
implementation 'net.william278:Annotaml:2.0.1'
|
||||||
|
@ -3,5 +3,5 @@ javaVersion=16
|
|||||||
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
|
||||||
plugin_version=1.2.1
|
plugin_version=1.2.3
|
||||||
plugin_archive=velocitab
|
plugin_archive=velocitab
|
@ -21,10 +21,12 @@ import java.util.Map;
|
|||||||
public class Settings {
|
public class Settings {
|
||||||
|
|
||||||
@YamlKey("headers")
|
@YamlKey("headers")
|
||||||
private Map<String, String> headers = Map.of("default", "&rainbow&Running Velocitab by William278");
|
@YamlComment("Header(s) to display above the TAB list for each server group.\nList multiple headers and set update_rate to the number of ticks between frames for basic animations")
|
||||||
|
private Map<String, List<String>> headers = Map.of("default", List.of("&rainbow&Running Velocitab by William278"));
|
||||||
|
|
||||||
@YamlKey("footers")
|
@YamlKey("footers")
|
||||||
private Map<String, String> footers = Map.of("default", "[There are currently %players_online%/%max_players_online% players online](gray)");
|
@YamlComment("Footer(s) to display below the TAB list for each server group, same as headers.")
|
||||||
|
private Map<String, List<String>> footers = Map.of("default", List.of("[There are currently %players_online%/%max_players_online% players online](gray)"));
|
||||||
|
|
||||||
@YamlKey("formats")
|
@YamlKey("formats")
|
||||||
private Map<String, String> formats = Map.of("default", "&7[%server%] &f%prefix%%username%");
|
private Map<String, String> formats = Map.of("default", "&7[%server%] &f%prefix%%username%");
|
||||||
@ -83,15 +85,23 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getHeader(@NotNull String serverGroup) {
|
public String getHeader(@NotNull String serverGroup, @NotNull int index) {
|
||||||
return StringEscapeUtils.unescapeJava(
|
return StringEscapeUtils.unescapeJava(
|
||||||
headers.getOrDefault(serverGroup, ""));
|
headers.getOrDefault(serverGroup, List.of("")).get(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getFooter(@NotNull String serverGroup) {
|
public String getFooter(@NotNull String serverGroup, @NotNull int index) {
|
||||||
return StringEscapeUtils.unescapeJava(
|
return StringEscapeUtils.unescapeJava(
|
||||||
footers.getOrDefault(serverGroup, ""));
|
footers.getOrDefault(serverGroup, List.of("")).get(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeaderListSize(@NotNull String serverGroup) {
|
||||||
|
return headers.getOrDefault(serverGroup, List.of("")).size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFooterListSize(@NotNull String serverGroup) {
|
||||||
|
return footers.getOrDefault(serverGroup, List.of("")).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -34,7 +34,8 @@ public class UpdateTeamsPacket extends AbstractPacket {
|
|||||||
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_15, MINECRAFT_1_16_5, 0x4C),
|
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_15, MINECRAFT_1_16_5, 0x4C),
|
||||||
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_17, MINECRAFT_1_19, 0x55),
|
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_17, MINECRAFT_1_19, 0x55),
|
||||||
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_19_1, MINECRAFT_1_19_2, 0x58),
|
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_19_1, MINECRAFT_1_19_2, 0x58),
|
||||||
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_19_3, MINECRAFT_LATEST, 0x56)
|
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_19_3, MINECRAFT_1_19_3, 0x56),
|
||||||
|
AbstractProtocolMapping.rangedIdMapping(MINECRAFT_1_19_4, MINECRAFT_LATEST, 0x5A)
|
||||||
);
|
);
|
||||||
|
|
||||||
private String teamName;
|
private String teamName;
|
||||||
|
@ -26,6 +26,8 @@ public class PlayerTabList {
|
|||||||
private final Velocitab plugin;
|
private final Velocitab plugin;
|
||||||
private final ConcurrentLinkedQueue<TabPlayer> players;
|
private final ConcurrentLinkedQueue<TabPlayer> players;
|
||||||
private final ConcurrentLinkedQueue<String> fallbackServers;
|
private final ConcurrentLinkedQueue<String> fallbackServers;
|
||||||
|
private int headerIndex = 0;
|
||||||
|
private int footerIndex = 0;
|
||||||
|
|
||||||
public PlayerTabList(@NotNull Velocitab plugin) {
|
public PlayerTabList(@NotNull Velocitab plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -162,16 +164,26 @@ public class PlayerTabList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Component> getHeader(@NotNull TabPlayer player) {
|
public CompletableFuture<Component> getHeader(@NotNull TabPlayer player) {
|
||||||
return Placeholder.replace(plugin.getSettings().getHeader(
|
if (headerIndex >= plugin.getSettings().getHeaderListSize(plugin.getSettings().getServerGroup(player.getServerName()))){
|
||||||
plugin.getSettings().getServerGroup(player.getServerName())), plugin, player)
|
headerIndex = 0;
|
||||||
|
}
|
||||||
|
CompletableFuture<Component> headerComponent = Placeholder.replace(plugin.getSettings().getHeader(
|
||||||
|
plugin.getSettings().getServerGroup(player.getServerName()), headerIndex), plugin, player)
|
||||||
.thenApply(header -> plugin.getFormatter().format(header, player, plugin));
|
.thenApply(header -> plugin.getFormatter().format(header, player, plugin));
|
||||||
|
headerIndex++;
|
||||||
|
return headerComponent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Component> getFooter(@NotNull TabPlayer player) {
|
public CompletableFuture<Component> getFooter(@NotNull TabPlayer player) {
|
||||||
return Placeholder.replace(plugin.getSettings().getFooter(
|
if (footerIndex >= plugin.getSettings().getFooterListSize(plugin.getSettings().getServerGroup(player.getServerName()))){
|
||||||
plugin.getSettings().getServerGroup(player.getServerName())), plugin, player)
|
footerIndex = 0;
|
||||||
|
}
|
||||||
|
CompletableFuture<Component> footerComponent = Placeholder.replace(plugin.getSettings().getFooter(
|
||||||
|
plugin.getSettings().getServerGroup(player.getServerName()), footerIndex), plugin, player)
|
||||||
.thenApply(footer -> plugin.getFormatter().format(footer, player, plugin));
|
.thenApply(footer -> plugin.getFormatter().format(footer, player, plugin));
|
||||||
|
footerIndex++;
|
||||||
|
return footerComponent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user