%server_players_online_<server>% feature
Some checks failed
Build plugin / Build-latest-jar (push) Failing after 3m49s

This commit is contained in:
XAP3Y 2025-01-16 19:22:24 +01:00
parent 94bcd99fe2
commit f09bd7b6bd
2 changed files with 55 additions and 3 deletions

View File

@ -0,0 +1,32 @@
name: Build plugin
run-name: Build plugin
on: [push]
jobs:
Build-latest-jar:
runs-on: ubuntu-latest
steps:
- name: Build | Prepare packages
run: |
apt update; apt-get install software-properties-common -y
wget -O- https://apt.corretto.aws/corretto.key | apt-key add -
add-apt-repository 'deb https://apt.corretto.aws stable main'
apt-get update; apt-get install -y java-21-amazon-corretto-jdk
- name: Prepare | Setup git
run: |
git config --global user.name "Radim Lipovčan"
git config --global user.email "radim@lipovcan.cz"
- name: Check out repository code
uses: actions/checkout@v4
- name: Build | Gradle build
run: |
ls -lah
chmod +x ./gradlew
./gradlew clean build && ls -lah && ls */ -lah && ls */* -lah&& ls */*/* -lah
- name: Build | publish jar
run: |
curl --insecure --user username:mypass -T target/Velocitab-1.7.3-94bcd99-indev.jar ftp://192.168.10.133:/
- name: Push | Create release
uses: https://git.lipovcan.cz/Upstream/gitea-release-action.git@v1
with:
files: |-
target/*.jar

View File

@ -47,6 +47,24 @@ public enum Placeholder {
.map(RegisteredServer::getPlayersConnected)
.map(players -> Integer.toString(players.size()))
.orElse("")),
SERVER_PLAYERS_ONLINE((param, plugin, player) -> {
if (param.isEmpty()) {
return "0";
}
Collection<RegisteredServer> list = plugin.getPlugin().getServer().getAllServers();
Integer online = 0;
boolean contains = false;
for (RegisteredServer server : list) {
if (server.getServerInfo().getName().equalsIgnoreCase(param)) {
contains = true;
online = server.getPlayersConnected().size();
break;
}
}
if (!contains) return "0";
return Integer.toString(online);
}),
GROUP_PLAYERS_ONLINE((param, plugin, player) -> {
if (param.isEmpty()) {
return Integer.toString(player.getGroup().getPlayers(plugin).size());
@ -79,14 +97,16 @@ public enum Placeholder {
CURRENT_TIME_HOUR((plugin, player) -> DateTimeFormatter.ofPattern("HH").format(LocalDateTime.now())),
CURRENT_TIME_MINUTE((plugin, player) -> DateTimeFormatter.ofPattern("mm").format(LocalDateTime.now())),
CURRENT_TIME_SECOND((plugin, player) -> DateTimeFormatter.ofPattern("ss").format(LocalDateTime.now())),
CURRENT_TIME((param, plugin, player) -> {
if (param.isEmpty()) {
CURRENT_TIME((plugin, player) -> {
return DateTimeFormatter.ofPattern("HH:mm:ss").format(LocalTime.now());
/*if (param.isEmpty()) {
return DateTimeFormatter.ofPattern("HH:mm:ss").format(LocalTime.now());
}
final String countryCode = param.toUpperCase();
final Locale locale = Locale.forLanguageTag(countryCode);
return DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(locale).format(LocalTime.now());
return DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT).withLocale(locale).format(LocalTime.now());*/
}),
USERNAME((plugin, player) -> player.getCustomName().orElse(player.getPlayer().getUsername())),
USERNAME_LOWER((plugin, player) -> player.getCustomName().orElse(player.getPlayer().getUsername()).toLowerCase()),