mirror of
https://codeberg.org/Andre601/AdvancedServerList.git
synced 2026-11-08 10:15:26 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a28e62f53c | ||
|
|
e82df2d1f7 | ||
|
|
16a2b05b2b | ||
|
|
5df3d6dd48 | ||
|
|
91a6149dac | ||
|
|
3f224504a1 | ||
|
|
437e155a46 | ||
|
|
8275069315 | ||
|
|
bd564a8638 | ||
|
|
591279f70b | ||
|
|
80e84aa41b | ||
|
|
9024c4dc71 | ||
|
|
bb0f389016 | ||
|
|
f8f8a45b1a | ||
|
|
0bae24bb66 | ||
|
|
2158caebe6 | ||
|
|
f9ea253da3 | ||
|
|
7c53ddf4f4 | ||
|
|
8bcc88d620 | ||
|
|
78b687587d | ||
|
|
168fe364b0 | ||
|
|
cd3f54dba6 | ||
|
|
79f15b2467 | ||
|
|
ade8ad5a33 | ||
|
|
6e343f1516 | ||
|
|
fee436fda6 | ||
|
|
27d4f5acd0 | ||
|
|
e18c70d446 | ||
|
|
0ca3ec62a9 | ||
|
|
461ae5d0aa | ||
|
|
5696a9417b | ||
|
|
0705101cd6 | ||
|
|
69ad3554cf | ||
|
|
7f1de13dcc | ||
|
|
c3e16eec31 | ||
|
|
207970a90b | ||
|
|
2628dbab56 | ||
|
|
3da9f8b400 | ||
|
|
ffd0a8c364 | ||
|
|
d9a7b244f9 | ||
|
|
f1fb5ef6ea | ||
|
|
d3406aad1c | ||
|
|
650bcc3235 | ||
|
|
0cd91c63bb | ||
|
|
e95a4634ec | ||
|
|
d0293ae15e | ||
|
|
f5c6185b96 | ||
|
|
61981db3cc | ||
|
|
52804adfdf | ||
|
|
4b185be8a4 | ||
|
|
46ac4ef5c1 | ||
|
|
00e2a8ebee | ||
|
|
c523da7477 | ||
|
|
01e586fa5e | ||
|
|
9322819538 | ||
|
|
7ef4a9a61b | ||
|
|
af2da61500 | ||
|
|
23d0626250 | ||
|
|
74dfdb3022 | ||
|
|
4a589619bd | ||
|
|
9bdd519246 | ||
|
|
cf4e08fe3e | ||
|
|
70bbb15c60 | ||
|
|
ee8e00f3a2 | ||
|
|
0280668f9b | ||
|
|
e959f478a0 | ||
|
|
f024b2c763 | ||
|
|
c0665b450e | ||
|
|
e50ed552b9 | ||
|
|
1601e41e9c | ||
|
|
f8b80f9e14 | ||
|
|
22bfe2be00 | ||
|
|
7e9c6b909c | ||
|
|
93ecdd736f | ||
|
|
abfbaf4498 | ||
|
|
ce3b80b05c | ||
|
|
9e3a77ad7d | ||
|
|
cdc2115cb3 | ||
|
|
5173f61c6c | ||
|
|
8b12cb2402 | ||
|
|
3ab48396af | ||
|
|
00b34c8b47 | ||
|
|
b06274638e | ||
|
|
cd3b2fe0b4 | ||
|
|
51d8ae6c42 | ||
|
|
1545be4709 | ||
|
|
7693e72728 | ||
|
|
b879110379 | ||
|
|
80900089bb | ||
|
|
df776f4e1c | ||
|
|
72afff8315 | ||
|
|
307384d1e1 | ||
|
|
84f31fad53 | ||
|
|
fe0774303a | ||
|
|
563173679b | ||
|
|
6e96e06109 | ||
|
|
dae25fd00a | ||
|
|
d2ca0cfae5 | ||
|
|
afaae368ac | ||
|
|
522ce7f932 | ||
|
|
3f3d460f2f | ||
|
|
3a03899688 | ||
|
|
e6d4264525 | ||
|
|
61466074fd | ||
|
|
4516157ddf | ||
|
|
82c65bf13c | ||
|
|
3c6e73671d | ||
|
|
c91a2c0d4e | ||
|
|
66b10656c3 | ||
|
|
b82a0ff0d9 | ||
|
|
2e02af5a67 | ||
|
|
5626b38390 | ||
|
|
415456447c | ||
|
|
c555a3c648 | ||
|
|
9ec0c1c4ce | ||
|
|
d3eb43db39 | ||
|
|
b4b4f6a9fc | ||
|
|
3217eee02b | ||
|
|
ea68fca70b | ||
|
|
a8ceb88b67 | ||
|
|
19d6ce28c4 | ||
|
|
05e61794a1 | ||
|
|
46e062eb8f | ||
|
|
2196456dd4 | ||
|
|
bfd1e2e2ad | ||
|
|
21af6df510 | ||
|
|
713062d1b4 | ||
|
|
673a134ab1 | ||
|
|
c777772a90 | ||
|
|
a43a9f8f19 | ||
|
|
d4a416f85e | ||
|
|
bc26ceae55 | ||
|
|
3d19a6688c | ||
|
|
03a8258ddc | ||
|
|
6df5015b0d | ||
|
|
f1f8aaaad2 | ||
|
|
151f5494fc | ||
|
|
f997fa0a89 | ||
|
|
2f1549eb8a | ||
|
|
77dba75c17 | ||
|
|
dfa72cb852 | ||
|
|
dc0cf6ebfc | ||
|
|
2c520e53c0 | ||
|
|
356cca9ba0 | ||
|
|
4e7b17a601 | ||
|
|
db06de243f |
No files matched your search
@@ -18,13 +18,13 @@ jobs:
|
||||
runs-on: codeberg-tiny
|
||||
steps:
|
||||
- name: "Checkout Source Repository"
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
uses: https://code.forgejo.org/actions/checkout@v6
|
||||
with:
|
||||
token: "${{ secrets.BOT_TOKEN }}"
|
||||
- name: "Checkout Target Repository"
|
||||
run: "git clone -b pages https://codeberg.org/Andre601/asl-docs site"
|
||||
- name: "Setup Python 3.x"
|
||||
uses: https://code.forgejo.org/actions/setup-python@v5
|
||||
uses: https://code.forgejo.org/actions/setup-python@v6
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: "Install Dependencies"
|
||||
|
||||
@@ -28,13 +28,13 @@ jobs:
|
||||
#
|
||||
- name: "Find Comment"
|
||||
id: find-comment
|
||||
uses: https://github.com/peter-evans/find-comment@v3
|
||||
uses: https://github.com/peter-evans/find-comment@v4
|
||||
with:
|
||||
issue-number: "${{ github.event.pull_request.number }}"
|
||||
comment-author: "Andre_601-Bot"
|
||||
- name: "Create or update Comment"
|
||||
id: comment
|
||||
uses: https://github.com/peter-evans/create-or-update-comment@v4
|
||||
uses: https://github.com/peter-evans/create-or-update-comment@v5
|
||||
with:
|
||||
body: |-
|
||||
## Pull request Preview
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
# Build website and push.
|
||||
#
|
||||
- name: "Checkout Source Repository"
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
uses: https://code.forgejo.org/actions/checkout@v6
|
||||
with:
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
fetch-depth: 0
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
cd site
|
||||
git switch ${{ env.BRANCH_NAME }} 2>/dev/null || git switch -c ${{ env.BRANCH_NAME }}
|
||||
- name: "Setup Python 3.x"
|
||||
uses: https://code.forgejo.org/actions/setup-python@v5
|
||||
uses: https://code.forgejo.org/actions/setup-python@v6
|
||||
with:
|
||||
python-version: 3.x
|
||||
- name: "Install Dependencies"
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
# Update comment on success or failure.
|
||||
#
|
||||
- name: "Comment Success"
|
||||
uses: https://github.com/peter-evans/create-or-update-comment@v4
|
||||
uses: https://github.com/peter-evans/create-or-update-comment@v5
|
||||
with:
|
||||
body: |-
|
||||
## Pull request Preview
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
edit-mode: replace
|
||||
- name: "Comment Failure"
|
||||
if: ${{ failure() }}
|
||||
uses: https://github.com/peter-evans/create-or-update-comment@v4
|
||||
uses: https://github.com/peter-evans/create-or-update-comment@v5
|
||||
with:
|
||||
body: |-
|
||||
## Pull request Preview
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
| Name | Link |
|
||||
|---------|-------------------------------------------|
|
||||
| Commit | ${{ github.event.pull_request.head.sha }} |
|
||||
| Logs | ${{ RUN_URL }} |
|
||||
| Logs | ${{ env.RUN_URL }} |
|
||||
comment-id: "${{ steps.comment.outputs.comment-id }}"
|
||||
issue-number: "${{ github.event.pull_request.number }}"
|
||||
token: "${{ secrets.BOT_TOKEN }}"
|
||||
|
||||
@@ -4,7 +4,7 @@ when:
|
||||
|
||||
steps:
|
||||
- name: "Build Jar and Upload"
|
||||
image: maven:3.9.10-eclipse-temurin-21
|
||||
image: maven:3.9.12-eclipse-temurin-21
|
||||
environment:
|
||||
CODEBERG_API_TOKEN:
|
||||
from_secret: cb_token
|
||||
@@ -29,6 +29,7 @@ steps:
|
||||
- "paper/target/AdvancedServerList-*.jar"
|
||||
- "velocity/target/AdvancedServerList-*.jar"
|
||||
- "addons/banplugins/target/AdvancedServerList-*.jar"
|
||||
- "addons/luckperms/target/AdvancedServerList-*.jar"
|
||||
api_key:
|
||||
from_secret: cb_token
|
||||
- name: "Create Post on Mastodon"
|
||||
@@ -45,4 +46,19 @@ steps:
|
||||
Modrinth - https://modrinth.com/plugin/advancedserverlist
|
||||
Hangar - https://hangar.papermc.io/Andre_601/AdvancedServerList
|
||||
Codeberg - https://codeberg.org/Andre601/AdvancedServerList
|
||||
visibility: public
|
||||
visibility: public
|
||||
- name: "Create Post on Bluesky"
|
||||
image: woodpeckerci/plugin-bluesky-post
|
||||
when:
|
||||
- status: ["success"]
|
||||
settings:
|
||||
identifier: andre601.ch
|
||||
app_password:
|
||||
from_secret: bluesky_app_password
|
||||
languages: english
|
||||
text: |-
|
||||
#AdvancedServerList was updated to ${CI_COMMIT_TAG} and can be downloaded from #Modrinth, #Hangar and #Codeberg!
|
||||
|
||||
Modrinth - https://modrinth.com/plugin/advancedserverlist
|
||||
Hangar - https://hangar.papermc.io/Andre_601/AdvancedServerList
|
||||
Codeberg - https://codeberg.org/Andre601/AdvancedServerList
|
||||
@@ -63,7 +63,7 @@ AdvancedServerList soft-depends on the following plugins, meaning their inclusio
|
||||
|
||||
| Plugin | Supported Platforms |
|
||||
|-------------------------------------------------------------------------|----------------------------------------|
|
||||
| [PlaceholderAPI](https://hangar.papermc.io/HelpChat/PlaceholderAPI) | Paper |
|
||||
| [PlaceholderAPI](https://modrinth.com/plugin/PlaceholderAPI) | Paper |
|
||||
| [ViaVersion](https://hangar.papermc.io/ViaVersion/ViaVersion) | Paper |
|
||||
| [PAPIProxyBridge](https://hangar.papermc.io/William278/PAPIProxyBridge) | BungeeCord, Waterfall, Velocity |
|
||||
| [Maintenance](https://hangar.papermc.io/kennytv/Maintenance) | Paper, BungeeCord, Waterfall, Velocity |
|
||||
|
||||
@@ -65,14 +65,14 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.21-R0.3</version>
|
||||
<version>1.21-R0.4</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.21-R0.3</version>
|
||||
<version>1.21-R0.4</version>
|
||||
<type>javadoc</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
@@ -99,7 +99,7 @@
|
||||
<dependency>
|
||||
<groupId>space.arim.libertybans</groupId>
|
||||
<artifactId>bans-api</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<version>1.1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ MIT License
|
||||
~
|
||||
~ Copyright (c) 2022-2024 Andre_601
|
||||
~
|
||||
~ 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:
|
||||
~
|
||||
~ The above copyright notice and this permission notice shall be included in all
|
||||
~ copies or substantial portions of the Software.
|
||||
~
|
||||
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
~ SOFTWARE.
|
||||
~
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>ch.andre601.advancedserverlist</groupId>
|
||||
<version>parent</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>luckperms</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${plugin.version}</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Proxy/Server -->
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.21-R0.4</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.21-R0.4</version>
|
||||
<type>javadoc</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>3.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Plugin APIs -->
|
||||
<dependency>
|
||||
<groupId>ch.andre601.asl-api</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>${api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.luckperms</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>5.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>AdvancedServerList-LuckPerms-Addon-${plugin.version}${project.build.build_id}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package ch.andre601.advancedserverlist.luckperms.bungee;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.AdvancedServerListAPI;
|
||||
import ch.andre601.advancedserverlist.api.exceptions.InvalidPlaceholderProviderException;
|
||||
import ch.andre601.advancedserverlist.luckperms.placeholders.LuckPermsPlaceholder;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public class LuckPermsAddon extends Plugin{
|
||||
|
||||
@Override
|
||||
public void onEnable(){
|
||||
if(getProxy().getPluginManager().getPlugin("AdvancedServerList") == null){
|
||||
getLogger().warning("AdvancedServerList not found. This plugin is required.");
|
||||
return;
|
||||
}
|
||||
if(getProxy().getPluginManager().getPlugin("LuckPerms") == null){
|
||||
getLogger().warning("LuckPerms not found. This plugin is required.");
|
||||
return;
|
||||
}
|
||||
|
||||
LuckPerms luckPerms;
|
||||
try{
|
||||
luckPerms = LuckPermsProvider.get();
|
||||
}catch(IllegalStateException ex){
|
||||
getLogger().severe("Unable to obtain LuckPerms API instance! The Plugin won't work.");
|
||||
return;
|
||||
}
|
||||
|
||||
getLogger().info("Registering LuckPerms Placeholders...");
|
||||
try{
|
||||
AdvancedServerListAPI.get().addPlaceholderProvider(new LuckPermsPlaceholder(luckPerms));
|
||||
getLogger().info("Successfully registered Placeholder!");
|
||||
}catch(InvalidPlaceholderProviderException ex){
|
||||
getLogger().warning("Couldn't register Placeholder. The plugin won't work.");
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package ch.andre601.advancedserverlist.luckperms.paper;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.AdvancedServerListAPI;
|
||||
import ch.andre601.advancedserverlist.api.exceptions.InvalidPlaceholderProviderException;
|
||||
import ch.andre601.advancedserverlist.luckperms.placeholders.LuckPermsPlaceholder;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class LuckPermsAddon extends JavaPlugin{
|
||||
|
||||
@Override
|
||||
public void onEnable(){
|
||||
if(!this.getServer().getPluginManager().isPluginEnabled("AdvancedServerList")){
|
||||
this.getSLF4JLogger().warn("AdvancedServerList not enabled. This plugin is required!");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.getServer().getPluginManager().isPluginEnabled("LuckPerms")){
|
||||
this.getSLF4JLogger().warn("LuckPerms not enabled. This plugin is required!");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
LuckPerms luckPerms;
|
||||
try{
|
||||
luckPerms = LuckPermsProvider.get();
|
||||
}catch(IllegalStateException ex){
|
||||
this.getSLF4JLogger().error("Unable to obtain LuckPerms API instance! Disabling plugin...");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
this.getSLF4JLogger().info("Registering LuckPerms Placeholder...");
|
||||
try{
|
||||
AdvancedServerListAPI.get().addPlaceholderProvider(new LuckPermsPlaceholder(luckPerms));
|
||||
this.getSLF4JLogger().info("Successfully registered Placeholder!");
|
||||
}catch(InvalidPlaceholderProviderException ex){
|
||||
this.getSLF4JLogger().warn("Couldn't register Placeholder. Disabling Plugin...");
|
||||
this.getServer().getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package ch.andre601.advancedserverlist.luckperms.placeholders;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LuckPermsPlaceholder extends PlaceholderProvider{
|
||||
|
||||
private final LuckPerms luckPerms;
|
||||
|
||||
private final HashMap<UUID, CacheValue> cache = new HashMap<>();
|
||||
|
||||
public LuckPermsPlaceholder(LuckPerms luckPerms){
|
||||
super("luckperms");
|
||||
this.luckPerms = luckPerms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String parsePlaceholder(@NonNull String placholder, @NonNull GenericPlayer player, @NonNull GenericServer server){
|
||||
if(luckPerms == null)
|
||||
return "ERR: LuckPerms not available.";
|
||||
|
||||
CacheValue cacheValue = cache.get(player.getUUID());
|
||||
User user;
|
||||
if(cacheValue == null || cacheValue.expired()){
|
||||
// Can cause lag if on main thread.
|
||||
// But the alternative would be a lot more annoying and error-prone.
|
||||
user = luckPerms.getUserManager().loadUser(player.getUUID()).join();
|
||||
cache.put(player.getUUID(), new CacheValue(System.currentTimeMillis(), user));
|
||||
}else{
|
||||
user = cacheValue.user();
|
||||
}
|
||||
|
||||
if(user == null)
|
||||
return "ERR: Player not found.";
|
||||
|
||||
String[] parts = placholder.split("\\s+");
|
||||
if(parts.length == 1)
|
||||
return "ERR: Missing argument for placeholder " + parts[0] + ".";
|
||||
|
||||
return switch(parts[0]){
|
||||
case "hasGroup" -> String.valueOf(
|
||||
user.getCachedData().getPermissionData().checkPermission("group." + parts[1])
|
||||
);
|
||||
case "hasPermission" -> String.valueOf(
|
||||
user.getCachedData().getPermissionData().checkPermission(parts[1]).asBoolean()
|
||||
);
|
||||
case "primaryGroup" -> user.getPrimaryGroup();
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private record CacheValue(long timestamp, User user){
|
||||
public boolean expired(){
|
||||
// Expired if current timestamp minus old one is more than 60k milliseconds (1 minute)
|
||||
return (timestamp < 0L) || System.currentTimeMillis() - timestamp >= 60_000;
|
||||
}
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package ch.andre601.advancedserverlist.luckperms.velocity;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.AdvancedServerListAPI;
|
||||
import ch.andre601.advancedserverlist.api.exceptions.InvalidPlaceholderProviderException;
|
||||
import ch.andre601.advancedserverlist.luckperms.placeholders.LuckPermsPlaceholder;
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LuckPermsAddon{
|
||||
|
||||
private final ProxyServer proxy;
|
||||
private final Logger logger = LoggerFactory.getLogger("ASLLuckPermsAddon");
|
||||
|
||||
@Inject
|
||||
public LuckPermsAddon(ProxyServer proxy){
|
||||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void init(ProxyInitializeEvent event){
|
||||
if(!proxy.getPluginManager().isLoaded("advancedserverlist")){
|
||||
logger.warn("AdvancedServerList is not enabled. This plugin is required.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!proxy.getPluginManager().isLoaded("luckperms")){
|
||||
logger.warn("LuckPerms is not enabled. This plugin is required.");
|
||||
return;
|
||||
}
|
||||
|
||||
LuckPerms luckPerms;
|
||||
try{
|
||||
luckPerms = LuckPermsProvider.get();
|
||||
}catch(IllegalStateException ex){
|
||||
logger.warn("Unable to obtain LuckPerms API instance. The plugin won't work.");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Registering LuckPerms Placeholder...");
|
||||
try{
|
||||
AdvancedServerListAPI.get().addPlaceholderProvider(new LuckPermsPlaceholder(luckPerms));
|
||||
logger.info("Successfully registered Placeholder!");
|
||||
}catch(InvalidPlaceholderProviderException ex){
|
||||
logger.warn("Unable to register LuckPerms Placeholder! The plugin won't work.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
name: 'ASLLuckPermsAddon'
|
||||
author: 'Andre_601'
|
||||
version: '${plugin.version}'
|
||||
description: 'LuckPerms Add-on for AdvancedServerList to add placeholders to use.'
|
||||
|
||||
softDepends:
|
||||
- AdvancedServerList
|
||||
- LuckPerms
|
||||
|
||||
main: 'ch.andre601.advancedserverlist.luckperms.bungee.LuckPermsAddon'
|
||||
@@ -0,0 +1,16 @@
|
||||
name: 'ASLLuckPermsAddon'
|
||||
author: 'Andre_601'
|
||||
version: '${plugin.version}'
|
||||
|
||||
main: 'ch.andre601.advancedserverlist.luckperms.paper.LuckPermsAddon'
|
||||
|
||||
api-version: '1.19'
|
||||
|
||||
dependencies:
|
||||
server:
|
||||
AdvancedServerList:
|
||||
required: false
|
||||
load: BEFORE
|
||||
LuckPerms:
|
||||
required: false
|
||||
load: BEFORE
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"id": "aslluckpermsaddon",
|
||||
"name": "ASLLuckPermsAddon",
|
||||
"version": "${plugin.version}",
|
||||
"description": "LuckPerms Add-on for AdvancedServerList to add placeholders to use.",
|
||||
"authors": [
|
||||
"Andre_601"
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"id": "advancedserverlist",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "luckperms",
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"main": "ch.andre601.advancedserverlist.luckperms.velocity.LuckPermsAddon"
|
||||
}
|
||||
+3
-3
@@ -132,13 +132,13 @@
|
||||
<dependency>
|
||||
<groupId>org.sayandev</groupId>
|
||||
<artifactId>sayanvanish-api</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.sayandev</groupId>
|
||||
<artifactId>sayanvanish-proxy-bungeecord</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
+18
-8
@@ -36,12 +36,13 @@ import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialogList;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import ch.andre601.advancedserverlist.core.profiles.handlers.FaviconHandler;
|
||||
import com.alessiodp.libby.BungeeLibraryManager;
|
||||
import com.alessiodp.libby.Library;
|
||||
import de.myzelyam.api.vanish.BungeeVanishAPI;
|
||||
import net.kyori.adventure.dialog.DialogLike;
|
||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||
import net.md_5.bungee.api.Favicon;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
@@ -98,8 +99,12 @@ public class BungeeCordCore extends Plugin implements PluginCore<Favicon>{
|
||||
|
||||
this.audiences = BungeeAudiences.create(this);
|
||||
this.handler = new BungeeCommandManagerInterface(this);
|
||||
this.core = AdvancedServerList.init(this,
|
||||
BungeePlayerPlaceholders.init(), BungeeServerPlaceholders.init(this), BungeeProxyPlaceholders.init(this));
|
||||
this.core = AdvancedServerList.init(
|
||||
this,
|
||||
BungeePlayerPlaceholders.init(),
|
||||
BungeeServerPlaceholders.init(this),
|
||||
BungeeProxyPlaceholders.init(this)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,15 +217,20 @@ public class BungeeCordCore extends Plugin implements PluginCore<Favicon>{
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialogLike createDialog(ServerListProfile profile){
|
||||
return null; // Not used.
|
||||
public IDialogList.IDialogListBuilder createDialogListBuilder(String title){
|
||||
return null;
|
||||
}
|
||||
|
||||
public BungeeAudiences getAudiences(){
|
||||
@Override
|
||||
public IDialog.IDialogBuilder createDialogBuilder(String title, ServerListProfile profile, int profilesPosition){
|
||||
return null;
|
||||
}
|
||||
|
||||
public BungeeAudiences audiences(){
|
||||
return audiences;
|
||||
}
|
||||
|
||||
public int getOnlinePlayers(ServerInfo server){
|
||||
public int onlinePlayers(ServerInfo server){
|
||||
List<ProxiedPlayer> players = new ArrayList<>(server == null ? getProxy().getPlayers() : server.getPlayers());
|
||||
|
||||
// Exclude players when PremiumVanish is enabled and player is hidden.
|
||||
@@ -234,7 +244,7 @@ public class BungeeCordCore extends Plugin implements PluginCore<Favicon>{
|
||||
return players.size();
|
||||
}
|
||||
|
||||
public Map<String, ServerPing> getFetchedServers(){
|
||||
public Map<String, ServerPing> fetchedServers(){
|
||||
return fetchedServers;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class BungeeCommandManagerInterface implements CommandManagerInterface<Co
|
||||
@Override
|
||||
public SenderMapper<CommandSender, CmdSender> senderMapper(){
|
||||
return SenderMapper.create(
|
||||
cmdSender -> new BungeeCmdSender(cmdSender, plugin.getAudiences()),
|
||||
cmdSender -> new BungeeCmdSender(cmdSender, plugin.audiences()),
|
||||
sender -> ((BungeeCmdSender)sender).sender()
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ public class BungeeEventWrapper implements GenericEventWrapper<Favicon, BungeePl
|
||||
|
||||
@Override
|
||||
public int onlinePlayers(){
|
||||
return plugin.getOnlinePlayers(null);
|
||||
return plugin.onlinePlayers(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -50,10 +50,10 @@ public class PlayerJoinEventListener implements Listener{
|
||||
plugin.core().playerHandler().addPlayer(address.getHostString(), player.getName(), player.getUniqueId());
|
||||
|
||||
if(player.hasPermission("advancedserverlist.admin") || player.hasPermission("advancedserverlist.updatecheck")){
|
||||
if(plugin.getAudiences() == null || plugin.core().updateChecker() == null)
|
||||
if(plugin.audiences() == null || plugin.core().updateChecker() == null)
|
||||
return;
|
||||
|
||||
BungeeCmdSender sender = new BungeeCmdSender(player, plugin.getAudiences());
|
||||
BungeeCmdSender sender = new BungeeCmdSender(player, plugin.audiences());
|
||||
|
||||
plugin.core().updateChecker().performCachedUpdateCheck(sender);
|
||||
}
|
||||
|
||||
+2
@@ -27,9 +27,11 @@ package ch.andre601.advancedserverlist.bungeecord.objects.impl;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.bungeecord.objects.BungeePlayer;
|
||||
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@NullMarked
|
||||
public record BungeePlayerImpl(CachedPlayer player, int protocol) implements BungeePlayer{
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -27,12 +27,13 @@ package ch.andre601.advancedserverlist.bungeecord.objects.impl;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.bungeecord.objects.BungeeProxy;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public record BungeeProxyImpl(Map<String, ServerInfo> servers, int playersOnline, int playersMax, String host) implements BungeeProxy{
|
||||
@Override
|
||||
public Map<String, ServerInfo> getServers(){
|
||||
public @NonNull Map<String, ServerInfo> getServers(){
|
||||
return servers;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -28,9 +28,12 @@ package ch.andre601.advancedserverlist.bungeecord.objects.placeholders;
|
||||
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@NullMarked
|
||||
public class BungeePlayerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private BungeePlayerPlaceholders(){
|
||||
@@ -42,7 +45,7 @@ public class BungeePlayerPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
return switch(placeholder.toLowerCase(Locale.ROOT)){
|
||||
case "name" -> player.getName();
|
||||
case "protocol" -> String.valueOf(player.getProtocol());
|
||||
|
||||
+5
-2
@@ -9,7 +9,10 @@ import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class BungeeProxyPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final BungeeCordCore plugin;
|
||||
@@ -25,12 +28,12 @@ public class BungeeProxyPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
String[] args = placeholder.split("\\s", 2);
|
||||
if(args.length < 2)
|
||||
return null;
|
||||
|
||||
ServerPing ping = plugin.getFetchedServers().get(args[1]);
|
||||
ServerPing ping = plugin.fetchedServers().get(args[1]);
|
||||
|
||||
return switch(args[0]){
|
||||
case "status" -> ping == null ? "offline" : "online";
|
||||
|
||||
+6
-3
@@ -31,9 +31,12 @@ import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.bungeecord.BungeeCordCore;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@NullMarked
|
||||
public class BungeeServerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final BungeeCordCore plugin;
|
||||
@@ -48,7 +51,7 @@ public class BungeeServerPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
if(!(server instanceof BungeeProxy proxy))
|
||||
return null;
|
||||
|
||||
@@ -68,7 +71,7 @@ public class BungeeServerPlaceholders extends PlaceholderProvider{
|
||||
if(info == null)
|
||||
continue;
|
||||
|
||||
players += plugin.getOnlinePlayers(info);
|
||||
players += plugin.onlinePlayers(info);
|
||||
}
|
||||
|
||||
yield String.valueOf(players);
|
||||
@@ -87,7 +90,7 @@ public class BungeeServerPlaceholders extends PlaceholderProvider{
|
||||
if(args.length > 2)
|
||||
yield "";
|
||||
|
||||
if(args.length == 2 && args[1] != null && !args[1].isEmpty()){
|
||||
if(args.length == 2 && !args[1].isEmpty()){
|
||||
ServerInfo info = proxy.getServers().get(args[1]);
|
||||
if(info == null)
|
||||
yield "";
|
||||
|
||||
+11
-5
@@ -43,7 +43,7 @@
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<plugin.config.version>9</plugin.config.version>
|
||||
<plugin.config.version>10</plugin.config.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -121,7 +121,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.13.1</version>
|
||||
<version>2.13.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -133,7 +133,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>33.4.8-jre</version>
|
||||
<version>33.5.0-jre</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -183,12 +183,18 @@
|
||||
<version>3.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.github.miniplaceholders</groupId>
|
||||
<artifactId>miniplaceholders-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.13.3</version>
|
||||
<version>5.14.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -215,7 +221,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.14.1</version>
|
||||
<configuration>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
|
||||
@@ -36,6 +36,7 @@ import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CommandType;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
|
||||
import ch.andre601.advancedserverlist.core.parsing.TextCenterUtil;
|
||||
import ch.andre601.advancedserverlist.core.placeholders.DatePlaceholder;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import ch.andre601.advancedserverlist.core.profiles.conditions.ProfileConditionParser;
|
||||
import ch.andre601.advancedserverlist.core.profiles.handlers.PlayerHandler;
|
||||
@@ -54,6 +55,7 @@ import org.incendo.cloud.suggestion.SuggestionProvider;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
@@ -61,7 +63,10 @@ import java.util.Properties;
|
||||
public class AdvancedServerList<F>{
|
||||
|
||||
public static <F> AdvancedServerList<F> init(PluginCore<F> plugin, PlaceholderProvider... placeholders){
|
||||
return new AdvancedServerList<>(plugin, Arrays.asList(placeholders));
|
||||
List<PlaceholderProvider> providers = new ArrayList<>(Arrays.asList(placeholders));
|
||||
providers.add(new DatePlaceholder());
|
||||
|
||||
return new AdvancedServerList<>(plugin, providers);
|
||||
}
|
||||
|
||||
private final PluginCore<F> plugin;
|
||||
@@ -261,6 +266,7 @@ public class AdvancedServerList<F>{
|
||||
Permission.permission("advancedserverlist.command.profiles.set")
|
||||
)
|
||||
)
|
||||
.meta(CommandHandler.COMMAND_TYPE, CommandType.Type.ALL)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+55
-3
@@ -29,11 +29,12 @@ import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CommandType;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialogList;
|
||||
import ch.andre601.advancedserverlist.core.migration.minimotd.MiniMOTDConfigMigrator;
|
||||
import ch.andre601.advancedserverlist.core.migration.serverlistplus.SLPConfigMigrator;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import ch.andre601.advancedserverlist.core.profiles.profile.ProfileSerializer;
|
||||
import net.kyori.adventure.dialog.DialogLike;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
import org.incendo.cloud.annotation.specifier.Greedy;
|
||||
@@ -813,9 +814,26 @@ public class CommandHandler{
|
||||
return;
|
||||
}
|
||||
|
||||
DialogLike dialog = core.plugin().createDialog(slp);
|
||||
IDialogList.IDialogListBuilder listBuilder = core.plugin().createDialogListBuilder(slp.file());
|
||||
String warning = """
|
||||
<gold><b>WARNING!</b></gold>
|
||||
|
||||
Dialog-based profile editing is currently an <i>experimental feature</i>!
|
||||
Please create backups first before using it and report any bugs and/or glitches you may find.""";
|
||||
|
||||
sender.audience().showDialog(dialog);
|
||||
listBuilder.appendBody(warning);
|
||||
|
||||
listBuilder.appendDialog(
|
||||
createDialog(core, "Main Settings", warning, slp, slp.defaultProfile(), slp.priority(), slp.condition(), -1)
|
||||
);
|
||||
|
||||
for(int i = 0; i < slp.profiles().size(); i++){
|
||||
listBuilder.appendDialog(
|
||||
createDialog(core, "Profiles <aqua>#" + (i + 1), warning, slp, slp.profiles().get(i), -1, null, i)
|
||||
);
|
||||
}
|
||||
|
||||
listBuilder.build().show(sender);
|
||||
}
|
||||
|
||||
@Suggestions("help")
|
||||
@@ -897,6 +915,40 @@ public class CommandHandler{
|
||||
);
|
||||
}
|
||||
|
||||
private IDialog<?> createDialog(
|
||||
AdvancedServerList<?> core,
|
||||
String title,
|
||||
String warning,
|
||||
ServerListProfile slp,
|
||||
ProfileEntry entry,
|
||||
int priority,
|
||||
String condition,
|
||||
int index
|
||||
){
|
||||
IDialog.IDialogBuilder builder = core.plugin().createDialogBuilder(title, slp, index);
|
||||
builder.appendBody(warning);
|
||||
|
||||
if(index < 0){
|
||||
builder.appendNumberRange("priority", "Priority", priority)
|
||||
.appendTextInput("condition", "Condition", condition, 100);
|
||||
}
|
||||
|
||||
builder.appendTextbox("motd", "MOTD", entry.motd(), 100, 2)
|
||||
.appendTextInput("favicon", "Favicon", entry.favicon(), 100)
|
||||
.appendBoolean("hidePlayers", "Hide Player Count", entry.hidePlayersEnabled())
|
||||
.appendBoolean("hidePlayersHover", "Hide Player Count Hover", entry.hidePlayersHoverEnabled())
|
||||
.appendTextbox("hover", "Player Count Hover", entry.players(), 200, 10)
|
||||
.appendTextInput("text", "Player Count Text", entry.playerCountText(), 100)
|
||||
.appendBoolean("extraPlayersEnabled", "Enable Extra Players", entry.extraPlayersEnabled())
|
||||
.appendTextInput("extraPlayersCount", "Extra Players Count", entry.extraPlayersCount(), 100)
|
||||
.appendBoolean("maxPlayersEnabled", "Enable Max Players", entry.maxPlayersEnabled())
|
||||
.appendTextInput("maxPlayersCount", "Max Players Count", entry.maxPlayersCount(), 100)
|
||||
.appendBoolean("onlinePlayersEnabled", "Enable Online Players", entry.onlinePlayersEnabled())
|
||||
.appendTextInput("onlinePlayersCount", "Online Players Count", entry.onlinePlayersCount(), 100);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public enum Plugin {
|
||||
SERVERLISTPLUS,
|
||||
MINIMOTD
|
||||
|
||||
+4
-1
@@ -4,7 +4,10 @@ import ch.andre601.advancedserverlist.api.PlaceholderProvider;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class MaintenancePlaceholder extends PlaceholderProvider{
|
||||
|
||||
private final AdvancedServerList<?> plugin;
|
||||
@@ -15,7 +18,7 @@ public class MaintenancePlaceholder extends PlaceholderProvider{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
if(!placeholder.equals("maintenanceEnabled") || !plugin.plugin().isPluginEnabled("Maintenance"))
|
||||
return null;
|
||||
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package ch.andre601.advancedserverlist.core.compat.miniplaceholders;
|
||||
|
||||
import io.github.miniplaceholders.api.MiniPlaceholders;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
|
||||
public class MiniPlaceholdersUtil{
|
||||
|
||||
public static TagResolver tagResolvers(){
|
||||
return MiniPlaceholders.globalPlaceholders();
|
||||
}
|
||||
}
|
||||
@@ -72,14 +72,14 @@ public class PAPIUtil{
|
||||
if(values.isEmpty())
|
||||
return null;
|
||||
|
||||
return List.copyOf(values).get(0);
|
||||
return List.copyOf(values).getFirst();
|
||||
}
|
||||
|
||||
public <P> P getPlayer(Collection<P> players){
|
||||
if(players.isEmpty())
|
||||
return null;
|
||||
|
||||
return List.copyOf(players).get(0);
|
||||
return List.copyOf(players).getFirst();
|
||||
}
|
||||
|
||||
public String parse(String text, UUID carrier, UUID player){
|
||||
|
||||
@@ -93,6 +93,7 @@ public class PingEventHandler{
|
||||
String onlinePlayers = ComponentParser.text(entry.onlinePlayersCount())
|
||||
.modifyText(text -> StringReplacer.replace(text, player, server))
|
||||
.modifyText(text -> event.parsePAPIPlaceholders(text, player))
|
||||
.applyMMTags(event.plugin())
|
||||
.toString();
|
||||
|
||||
try{
|
||||
@@ -110,6 +111,7 @@ public class PingEventHandler{
|
||||
String extraPlayers = ComponentParser.text(entry.extraPlayersCount())
|
||||
.modifyText(text -> StringReplacer.replace(text, player, server))
|
||||
.modifyText(text -> event.parsePAPIPlaceholders(text, player))
|
||||
.applyMMTags(event.plugin())
|
||||
.toString();
|
||||
|
||||
try{
|
||||
@@ -127,6 +129,7 @@ public class PingEventHandler{
|
||||
String maxPlayers = ComponentParser.text(entry.maxPlayersCount())
|
||||
.modifyText(text -> StringReplacer.replace(text, player, server))
|
||||
.modifyText(text -> event.parsePAPIPlaceholders(text, player))
|
||||
.applyMMTags(event.plugin())
|
||||
.toString();
|
||||
|
||||
try{
|
||||
@@ -149,6 +152,7 @@ public class PingEventHandler{
|
||||
.modifyText(text -> StringReplacer.replace(text, player, finalServer))
|
||||
.modifyText(text -> event.parsePAPIPlaceholders(text, player))
|
||||
.modifyText(text -> plugin.core().textCenterUtil().getCenteredText(text))
|
||||
.applyMMTags(event.plugin())
|
||||
.toComponent()
|
||||
)
|
||||
.toList();
|
||||
@@ -171,6 +175,7 @@ public class PingEventHandler{
|
||||
ComponentParser.text(entry.playerCountText())
|
||||
.modifyText(text -> StringReplacer.replace(text, player, finalServer))
|
||||
.modifyText(text -> event.parsePAPIPlaceholders(text, player))
|
||||
.applyMMTags(event.plugin())
|
||||
.toString()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ public class ConfigMigrator{
|
||||
public static ConfigurationTransformation.Versioned create(){
|
||||
return ConfigurationTransformation.versionedBuilder()
|
||||
.versionKey("configVersion")
|
||||
.addVersion(LATEST, eightToNine())
|
||||
.addVersion(LATEST, nineToTen())
|
||||
.addVersion(9, eightToNine())
|
||||
.addVersion(8, sevenToEight())
|
||||
.addVersion(7, sixToSeven())
|
||||
.addVersion(6, fiveToSix())
|
||||
@@ -57,6 +58,12 @@ public class ConfigMigrator{
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ConfigurationTransformation nineToTen(){
|
||||
return ConfigurationTransformation.builder()
|
||||
.addAction(NodePath.path("faviconStrategy"), TransformAction.rename("faviconResizeStrategy"))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ConfigurationTransformation eightToNine(){
|
||||
return ConfigurationTransformation.builder()
|
||||
.addAction(NodePath.path(), (path, value) -> {
|
||||
|
||||
+5
-2
@@ -26,11 +26,12 @@
|
||||
package ch.andre601.advancedserverlist.core.interfaces.core;
|
||||
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialogList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import ch.andre601.advancedserverlist.core.profiles.handlers.FaviconHandler;
|
||||
import net.kyori.adventure.dialog.DialogLike;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -70,7 +71,9 @@ public interface PluginCore<F>{
|
||||
|
||||
F createFavicon(BufferedImage image) throws Exception;
|
||||
|
||||
DialogLike createDialog(ServerListProfile profile);
|
||||
IDialogList.IDialogListBuilder createDialogListBuilder(String title);
|
||||
|
||||
IDialog.IDialogBuilder createDialogBuilder(String title, ServerListProfile profile, int profilesPosition);
|
||||
|
||||
default boolean isDebugEnabled(){
|
||||
if(core() == null)
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package ch.andre601.advancedserverlist.core.interfaces.dialogs;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.objects.NullBool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDialog<T>{
|
||||
T createDialog();
|
||||
|
||||
interface IDialogBuilder{
|
||||
IDialogBuilder appendBody(String body);
|
||||
|
||||
IDialogBuilder appendTextInput(String key, String title, String initValue, int maxLength);
|
||||
|
||||
IDialogBuilder appendTextbox(String key, String title, List<String> initValue, int maxLength, int rows);
|
||||
|
||||
IDialogBuilder appendNumberRange(String key, String title, int initValue);
|
||||
|
||||
IDialogBuilder appendBoolean(String key, String title, NullBool initValue);
|
||||
|
||||
IDialog<?> build();
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package ch.andre601.advancedserverlist.core.interfaces.dialogs;
|
||||
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
|
||||
public interface IDialogList{
|
||||
|
||||
void show(CmdSender sender);
|
||||
|
||||
interface IDialogListBuilder{
|
||||
IDialogListBuilder appendBody(String body);
|
||||
|
||||
IDialogListBuilder appendDialog(IDialog<?> dialog);
|
||||
|
||||
IDialogList build();
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,11 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.core.parsing;
|
||||
|
||||
import ch.andre601.advancedserverlist.core.compat.miniplaceholders.MiniPlaceholdersUtil;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import java.util.function.Function;
|
||||
@@ -61,6 +64,17 @@ public class ComponentParser{
|
||||
return this;
|
||||
}
|
||||
|
||||
public ComponentParser applyMMTags(PluginCore<?> plugin){
|
||||
if(!plugin.isPluginEnabled("MiniPlaceholders"))
|
||||
return this;
|
||||
|
||||
TagResolver resolver = MiniPlaceholdersUtil.tagResolvers();
|
||||
Component component = mm.deserialize(this.text, resolver);
|
||||
|
||||
this.text = mm.serialize(component);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Component toComponent(){
|
||||
return mm.deserialize(text);
|
||||
}
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package ch.andre601.advancedserverlist.core.placeholders;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class DatePlaceholder extends PlaceholderProvider{
|
||||
|
||||
public DatePlaceholder(){
|
||||
super("date");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String parsePlaceholder(@NonNull String placeholder, @NonNull GenericPlayer player, @NonNull GenericServer server){
|
||||
String[] args = placeholder.split("\\s+");
|
||||
|
||||
return switch(args[0]){
|
||||
case "current" -> {
|
||||
String format = "dd/MM/yyyy";
|
||||
if(args.length > 1){
|
||||
format = format(Arrays.copyOfRange(args, 1, args.length));
|
||||
}
|
||||
|
||||
try{
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
yield dateFormat.format(new Date());
|
||||
}catch(IllegalArgumentException ex){
|
||||
yield "ERR: Invalid Date pattern " + format;
|
||||
}
|
||||
}
|
||||
case "isBefore" -> compareDates(args, integer -> integer < 0);
|
||||
case "isExactly" -> compareDates(args, integer -> integer == 0);
|
||||
case "isAfter" -> compareDates(args, integer -> integer > 0);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private String format(String... args){
|
||||
if(args.length == 0)
|
||||
return "dd/MM/yyyy";
|
||||
|
||||
String format = String.join(" ", args);
|
||||
if(format.trim().isEmpty()){
|
||||
return "dd/MM/yyyy";
|
||||
}else{
|
||||
return format.trim();
|
||||
}
|
||||
}
|
||||
|
||||
private String compareDates(String[] args, Function<Integer, Boolean> function){
|
||||
if(args.length == 1)
|
||||
return "ERR: No Date provided!";
|
||||
|
||||
String targetDateStr = args[1];
|
||||
String format = "dd/MM/yyyy";
|
||||
if(args.length > 2){
|
||||
format = format(Arrays.copyOfRange(args, 2, args.length));
|
||||
}
|
||||
|
||||
SimpleDateFormat dateFormat;
|
||||
try{
|
||||
dateFormat = new SimpleDateFormat(format);
|
||||
Date targetDate = dateFormat.parse(targetDateStr);
|
||||
int diff = new Date().compareTo(targetDate);
|
||||
|
||||
return String.valueOf(function.apply(diff));
|
||||
}catch(IllegalArgumentException ex){
|
||||
return "ERR: Invalid Date format provided!";
|
||||
}catch(ParseException ex){
|
||||
return "ERR: Received invalid Date " + targetDateStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -110,6 +110,7 @@ public class FaviconHandler<F>{
|
||||
|
||||
public void cleanCache(){
|
||||
localFavicons.clear();
|
||||
faviconCache.invalidateAll();
|
||||
loadLocalFavicons();
|
||||
}
|
||||
|
||||
@@ -172,7 +173,8 @@ public class FaviconHandler<F>{
|
||||
}else
|
||||
if(input.toLowerCase(Locale.ROOT).endsWith(".png")){
|
||||
logger.debug(FaviconHandler.class, "Returning local Favicon '%s'...", input);
|
||||
return localFavicons.get(input.toLowerCase(Locale.ROOT)).image();
|
||||
FaviconPair<F> pair = localFavicons.get(input.toLowerCase(Locale.ROOT));
|
||||
return pair == null ? null : pair.image();
|
||||
}else{
|
||||
logger.debug(FaviconHandler.class, "Handling Player Name/UUID '%s'...", input);
|
||||
return fromURL("https://mc-heads.net/avatar/" + input + "/64");
|
||||
|
||||
@@ -77,7 +77,7 @@ faviconCacheTime: 1
|
||||
#
|
||||
# Setting any not listed option or leaving this blank/removing it sets the option to resize.
|
||||
#
|
||||
faviconStrategy: 'resize'
|
||||
faviconResizeStrategy: 'resize'
|
||||
|
||||
#
|
||||
# Options to disable while the Maintenance Plugin is present and Maintenance Mode is active.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Set the priority of this profile.
|
||||
# If there are multiple profiles (files) will they be sorted by priority, starting with highest.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#priority
|
||||
# Read more: https://asl.andre601.ch/profiles/options/priority/
|
||||
#
|
||||
priority: 0
|
||||
|
||||
@@ -14,7 +14,7 @@ priority: 0
|
||||
#
|
||||
# Removing the condition option or setting it to an empty String will be treated as a true condition being returned.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#condition
|
||||
# Read more: https://asl.andre601.ch/profiles/options/condition
|
||||
#
|
||||
condition: ''
|
||||
|
||||
@@ -30,7 +30,7 @@ condition: ''
|
||||
#
|
||||
# When not present or empty (profiles: []), no profiles will be used and global options from the file will be used instead.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#profiles
|
||||
# Read more: https://asl.andre601.ch/profiles/options/profiles
|
||||
#
|
||||
profiles:
|
||||
- motd: ['<aqua>Line A', '<gold>Line B']
|
||||
@@ -50,7 +50,7 @@ profiles:
|
||||
#
|
||||
# When not present or empty (motd: []), no MOTD will be set.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#motd
|
||||
# Read more: https://asl.andre601.ch/profiles/options/motd
|
||||
#
|
||||
motd:
|
||||
- '<grey>First Line'
|
||||
@@ -71,7 +71,7 @@ motd:
|
||||
#
|
||||
# If not present or empty (favicon: ''), defaults to not modifying the favicon.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#favicon
|
||||
# Read more: https://asl.andre601.ch/profiles/options/favicon
|
||||
#
|
||||
# "The favicon isn't showing!"
|
||||
# This is a side effect of using either URLs or player names/UUIDs for the favicon.
|
||||
@@ -87,7 +87,7 @@ favicon: ''
|
||||
#
|
||||
# Contains options for modifying the player count (Text displaying <online>/<max>).
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#playercount
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount
|
||||
#
|
||||
playerCount:
|
||||
#
|
||||
@@ -97,7 +97,7 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hideplayers
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/hideplayers
|
||||
#
|
||||
hidePlayers: false
|
||||
#
|
||||
@@ -106,7 +106,7 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hideplayershover
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/hideplayershover
|
||||
#
|
||||
hidePlayersHover: false
|
||||
#
|
||||
@@ -116,7 +116,7 @@ playerCount:
|
||||
#
|
||||
# If not present or empty (hover: []), defaults to not modifying the hover.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hover
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/hover
|
||||
#
|
||||
hover:
|
||||
- '<aqua>Line 1'
|
||||
@@ -130,7 +130,7 @@ playerCount:
|
||||
#
|
||||
# If not present or empty (text: ''), defaults to not modifying the text.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#text
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/text
|
||||
#
|
||||
text: ''
|
||||
#
|
||||
@@ -139,7 +139,7 @@ playerCount:
|
||||
#
|
||||
# Using this feature will modify the ${server playersMax} placeholder, except for usage in the condition option.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/extraplayers
|
||||
#
|
||||
extraPlayers:
|
||||
#
|
||||
@@ -149,7 +149,7 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers-enabled
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/extraplayers#enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
@@ -161,7 +161,7 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to 0.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers-amount
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/extraplayers#amount
|
||||
#
|
||||
amount: 0
|
||||
#
|
||||
@@ -169,7 +169,7 @@ playerCount:
|
||||
#
|
||||
# Using this feature will modify the ${server playersMax} placeholder, except for usage in the condition option.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/maxplayers
|
||||
#
|
||||
maxPlayers:
|
||||
#
|
||||
@@ -178,7 +178,7 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers-enabled
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/maxplayers#enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
@@ -187,13 +187,13 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to 0.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers-amount
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/maxplayers#amount
|
||||
#
|
||||
amount: 0
|
||||
#
|
||||
# The onlinePlayers feature allows to set a number to use as the online player count to display.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#onlineplayers
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/onlineplayers
|
||||
#
|
||||
onlinePlayers:
|
||||
#
|
||||
@@ -202,7 +202,7 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#onlineplayers-enabled
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/onlineplayers#enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
@@ -211,6 +211,6 @@ playerCount:
|
||||
#
|
||||
# If not present, defaults to current online player count.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#onlineplayers-amount
|
||||
# Read more: https://asl.andre601.ch/profiles/options/playercount/onlineplayers#amount
|
||||
#
|
||||
amount: 0
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block announce %}
|
||||
<span class="twemoji">{% include ".icons/octicons/paintbrush-24.svg" %}</span>
|
||||
The <a href="/profiles">Profiles page</a> received a huge restructuring!
|
||||
<span class="twemoji balloon">{% include ".icons/material/balloon.svg" %}</span>
|
||||
<span class="rainbow">Celebrating <b>50,000 downloads</b> of AdvancedServerList! THANK YOU!</span>
|
||||
<span class="twemoji balloon">{% include ".icons/material/balloon.svg" %}</span>
|
||||
{% endblock %}
|
||||
@@ -1,6 +1,6 @@
|
||||
[discord]: https://discord.gg/MyPTjpsgGH
|
||||
|
||||
[placeholderapi]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
|
||||
[placeholderapi]: https://modrinth.com/plugin/PlaceholderAPI
|
||||
[viaversion]: https://hangar.papermc.io/ViaVersion/ViaVersion
|
||||
[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
|
||||
[maintenance]: https://hangar.papermc.io/kennytv/Maintenance
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
icon: octicons/checklist-24
|
||||
---
|
||||
# LuckPerms Addon
|
||||
|
||||
The LuckPerms addon provides placeholders to return values from LuckPerms for a specific player.
|
||||
This can be a players primary group, whether they have a specific group or whether they have a specific permission.
|
||||
|
||||
/// note
|
||||
The Userdata retrieval is done asynchronously by LuckPerms.
|
||||
However, this addon forces the thread for this to be blocked, which can cause lag, if done on the main thread.
|
||||
|
||||
This was done due to possible downsides and issues with trying to keep it async and block-free.
|
||||
To mitigate possible lag is the retrieved user data cached for 1 minute before being discarded.
|
||||
///
|
||||
|
||||
## Placeholders
|
||||
|
||||
**Supported Platforms:**
|
||||
|
||||
<!-- icon:all -->
|
||||
|
||||
| Placeholder | Description |
|
||||
|-------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
|
||||
| `${luckperms hasGroup <group>}` | Returns whether the player has the specified group or not. |
|
||||
| `${luckperms hasPermission <permission>}` | Returns whether the player has the specified permission.<br/>No permission or one set to `false` returns false. |
|
||||
| `${luckperms primaryGroup}` | Gives the name of the primary group the player has. |
|
||||
|
||||
/// details | Example
|
||||
type: example
|
||||
|
||||
```yaml title="is_admin.yml
|
||||
priority: 1
|
||||
condition: "${luckperms hasGroup admin}"
|
||||
|
||||
motd:
|
||||
- "<yellow>Welcome Admin!"
|
||||
```
|
||||
///
|
||||
@@ -19,6 +19,12 @@ These Addons are made by Andre601 and available together with the plugin downloa
|
||||
|
||||
Addon for different Punishment plugins such as AdvancedBan, that add new placeholders to use in AdvancedServerList.
|
||||
|
||||
- [**LuckPerms**](first-party/luckperms.md)
|
||||
|
||||
----
|
||||
|
||||
Addon for adding LuckPerms-related placeholders to use in conditions.
|
||||
|
||||
</div>
|
||||
|
||||
## Third-party
|
||||
|
||||
@@ -61,4 +61,86 @@
|
||||
padding: .5em;
|
||||
line-height: 0;
|
||||
color: var(--md-default-fg-color);
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes balloon {
|
||||
0% {
|
||||
transform: translate(0rem, 0rem) rotate(0deg) scale(2);
|
||||
}
|
||||
10% {
|
||||
transform: translate(0.05rem, -0.08rem) rotate(2deg) scale(1.95);
|
||||
}
|
||||
20% {
|
||||
transform: translate(-0.07rem, 0.06rem) rotate(-3deg) scale(2);
|
||||
}
|
||||
30% {
|
||||
transform: translate(0.1rem, -0.02rem) rotate(1.5deg) scale(2.05);
|
||||
}
|
||||
40% {
|
||||
transform: translate(-0.06rem, -0.1rem) rotate(-2deg) scale(1.95);
|
||||
}
|
||||
50% {
|
||||
transform: translate(0.02rem, 0.08rem) rotate(3deg) scale(2);
|
||||
}
|
||||
60% {
|
||||
transform: translate(-0.1rem, -0.01rem) rotate(-1deg) scale(2.05);
|
||||
}
|
||||
70% {
|
||||
transform: translate(0.08rem, 0.04rem) rotate(2.5deg) scale(1.95);
|
||||
}
|
||||
80% {
|
||||
transform: translate(-0.03rem, -0.07rem) rotate(-2.5deg) scale(2);
|
||||
}
|
||||
90% {
|
||||
transform: translate(0.06rem, 0.03rem) rotate(1deg) scale(2.05);
|
||||
}
|
||||
100% {
|
||||
transform: translate(0rem, 0rem) rotate(0deg) scale(2);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rainbow {
|
||||
0% {
|
||||
color: #ff6b6b;
|
||||
}
|
||||
10% {
|
||||
color: #ffcc70;
|
||||
}
|
||||
20% {
|
||||
color: #f7f48b;
|
||||
}
|
||||
30% {
|
||||
color: #caffbf;
|
||||
}
|
||||
40% {
|
||||
color: #9bf6ff;
|
||||
}
|
||||
50% {
|
||||
color: #a0c4ff;
|
||||
}
|
||||
60% {
|
||||
color: #bdb2ff;
|
||||
}
|
||||
70% {
|
||||
color: #ffc6ff;
|
||||
}
|
||||
80% {
|
||||
color: #ffadad;
|
||||
}
|
||||
90% {
|
||||
color: #ffd6a5;
|
||||
}
|
||||
100% {
|
||||
color: #ff6b6b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.balloon {
|
||||
animation: 20s ease-in-out infinite balloon;
|
||||
}
|
||||
|
||||
.rainbow {
|
||||
animation: 10s ease-in-out infinite rainbow;
|
||||
}
|
||||
@@ -11,4 +11,4 @@ title: /asl clearcache
|
||||
- `advancedserverlist.command.clearcache`
|
||||
///
|
||||
|
||||
Resets the current Favicon and Player cache.
|
||||
Clears currently loaded favicons and the player cache and loads local favicons again.
|
||||
@@ -2,7 +2,7 @@
|
||||
title: /asl profiles
|
||||
---
|
||||
|
||||
# `/asl profiles add <profile>`<br>`/asl profiles copy <profile> <name>`<br>`/asl profiles info <profile>`<br>`/asl profiles list`<br>`/asl profiles set <profile> <option> [value]`
|
||||
# `/asl profiles add <profile>`<br>`/asl profiles copy <profile> <name>`<br>`/asl profiles edit <profile>`<br>`/asl profiles info <profile>`<br>`/asl profiles list`<br>`/asl profiles set <profile> <option> [value]`
|
||||
|
||||
/// info |
|
||||
**Permissions:**
|
||||
@@ -56,6 +56,27 @@ Creates a new profile using default values.
|
||||
Creates a copy from the provided profile.
|
||||
[`/asl reload`](reload.md) needs to be executed to load the new profile.
|
||||
|
||||
## `/asl profiles edit <profile>` { #edit }
|
||||
|
||||
/// info |
|
||||
**Permissions:**
|
||||
|
||||
- `advancedserverlist.admin`
|
||||
- `advancedserverlist.command.profiles`
|
||||
- `advancedserverlist.command.profiles.edit`
|
||||
|
||||
**Arguments:**
|
||||
|
||||
- `<profile>` - Name of the profile to edit.
|
||||
///
|
||||
|
||||
Opens a Dialog to edit the specified Profile.
|
||||
The first Dialog allows you to select either the primary settings or the individual `profiles` with each option allowing you to edit their values according to what they support.
|
||||
|
||||
/// warning
|
||||
This Feature only works for `v5.7.0-b1` and newer of AdvancedServerList and only for Paper 1.21.7 Builds 17 and newer due to lack of API in older versions.
|
||||
///
|
||||
|
||||
## `/asl profiles info <profile>` { #info }
|
||||
|
||||
/// info |
|
||||
|
||||
@@ -90,7 +90,7 @@ The plugin also supports these additional plugins. They are all optional.
|
||||
**Supported on:**
|
||||
<!-- icon:all -->
|
||||
|
||||
- [**BanPlugins Addon**][addon]
|
||||
- [**BanPlugins Addon**][banplugins-addon]
|
||||
|
||||
----
|
||||
|
||||
@@ -98,11 +98,23 @@ The plugin also supports these additional plugins. They are all optional.
|
||||
|
||||
----
|
||||
|
||||
**Supported on:**
|
||||
<!-- icon:all -->
|
||||
|
||||
- [**LuckPerms Addon**][luckperms-addon]
|
||||
|
||||
----
|
||||
|
||||
Official Add-on for AdvancedServerList that adds placeholders for LuckPerms.
|
||||
|
||||
----
|
||||
|
||||
**Supported on:**
|
||||
<!-- icon:all -->
|
||||
///
|
||||
|
||||
[addon]: ../addons/first-party/banplugins.md
|
||||
[banplugins-addon]: ../addons/first-party/banplugins.md
|
||||
[luckperms-addon]: ../addons/first-party/luckperms.md
|
||||
|
||||
## 2. Installation { #installation }
|
||||
|
||||
|
||||
@@ -42,6 +42,13 @@ The mode used is set in the `faviconStrategy` option in the `config.yml` and can
|
||||
|
||||
Please note that the actual favicon displayed will always be 64x64 pixels, even if the image(s) depicted in it aren't.
|
||||
|
||||
## Updating local Images
|
||||
|
||||
Local favicons (images in the `favicons` folder) are only loaded during the plugin's startup.
|
||||
If you would like to add new images to be used, you have to execute [`/asl clearcache`](../../commands/clearcache.md) to add them.
|
||||
|
||||
Note that this will also clear any dynamically created Favicons, requiring them to be created again.
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -74,6 +74,22 @@ These placeholders require the [Maintenance](https://hangar.papermc.io/kennytv/M
|
||||
|-------------------------------------|----------------------------------------------------------------|
|
||||
| `${maintenance maintenanceEnabled}` | Returns whether the Global maintenance mode is enabled or not. |
|
||||
|
||||
### Date
|
||||
|
||||
These placeholders can be used to get the current date or compare it with another.
|
||||
|
||||
| Placeholder | Description |
|
||||
|---------------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `${date current}` | Returns the current date. |
|
||||
| `${date isBefore <date>}` | Returns, whether the current date is before the specified one. The specified date needs to match the date pattern used. |
|
||||
| `${date isExact <date>}` | Returns, whether the current date is equal to the specified one. The specified date needs to match the date pattern used. |
|
||||
| `${date isAfter <date>}` | Returns, whether the current date is after the specified one. The specified date needs to match the date pattern used. |
|
||||
|
||||
/// note
|
||||
Each placeholder accepts an optional date pattern that follows Java's SimpleDateFormat structure.
|
||||
If none is provided does each default to `dd/MM/yyyy`
|
||||
///
|
||||
|
||||
## Adding your own Placeholders
|
||||
|
||||
Thanks to the API of AdvancedServerList are you able to add your own Placeholders that can be used using the `${identifier value}` pattern.
|
||||
|
||||
@@ -235,5 +235,6 @@ nav:
|
||||
- addons/index.md
|
||||
- First-party:
|
||||
- BanPlugins: addons/first-party/banplugins.md
|
||||
- LuckPerms: addons/first-party/luckperms.md
|
||||
- Third-party:
|
||||
- SayanVanish: addons/third-party/sayanvanish.md
|
||||
+3
-3
@@ -94,13 +94,13 @@
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.6</version>
|
||||
<version>2.11.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.viaversion</groupId>
|
||||
<artifactId>viaversion-api</artifactId>
|
||||
<version>5.4.1</version>
|
||||
<version>5.7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
@@ -25,15 +25,17 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.paper;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialogList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import ch.andre601.advancedserverlist.core.profiles.handlers.FaviconHandler;
|
||||
import ch.andre601.advancedserverlist.paper.commands.PaperCommandManagerInterface;
|
||||
import ch.andre601.advancedserverlist.paper.dialogs.PaperDialog;
|
||||
import ch.andre601.advancedserverlist.paper.dialogs.PaperDialogList;
|
||||
import ch.andre601.advancedserverlist.paper.listeners.ServerLoadEventListener;
|
||||
import ch.andre601.advancedserverlist.paper.logging.PaperLogger;
|
||||
import ch.andre601.advancedserverlist.paper.objects.WorldCache;
|
||||
@@ -43,14 +45,6 @@ import ch.andre601.advancedserverlist.paper.objects.placeholders.PaperServerPlac
|
||||
import com.alessiodp.libby.Library;
|
||||
import com.alessiodp.libby.PaperLibraryManager;
|
||||
import io.papermc.paper.ServerBuildInfo;
|
||||
import io.papermc.paper.dialog.Dialog;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.dialog.DialogBase;
|
||||
import io.papermc.paper.registry.data.dialog.body.DialogBody;
|
||||
import io.papermc.paper.registry.data.dialog.type.DialogType;
|
||||
import io.papermc.paper.registry.set.RegistrySet;
|
||||
import net.kyori.adventure.dialog.DialogLike;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SimplePie;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -220,49 +214,14 @@ public class PaperCore extends JavaPlugin implements PluginCore<CachedServerIcon
|
||||
return Bukkit.loadServerIcon(image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDialogList.IDialogListBuilder createDialogListBuilder(String title){
|
||||
return PaperDialogList.PaperDialogListBuilder.create(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public DialogLike createDialog(ServerListProfile profile){
|
||||
DialogBase.Builder builder = DialogBase.builder(Component.text(profile.file()))
|
||||
.body(List.of(
|
||||
DialogBody.plainMessage(
|
||||
ComponentParser.text("""
|
||||
<gold><bold>WARNING!</bold></gold>
|
||||
|
||||
Dialog-based Profile editing is considered <u>experimental!</u>
|
||||
You may encounter bugs and/or glitches.
|
||||
Features may also change or no longer work at any given time.
|
||||
|
||||
<u>Always create backups before using this feature!</u>""").toComponent()
|
||||
)
|
||||
));
|
||||
|
||||
List<Dialog> dialogs = new ArrayList<>();
|
||||
dialogs.add(
|
||||
createProfileDialog(
|
||||
profile,
|
||||
"Main Settings",
|
||||
-1
|
||||
)
|
||||
);
|
||||
|
||||
for(int i = 0; i < profile.profiles().size(); i++){
|
||||
dialogs.add(
|
||||
createProfileDialog(
|
||||
profile,
|
||||
String.format("Profiles <aqua>#%d</aqua>", i + 1),
|
||||
i
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
RegistrySet<Dialog> dialogRegistry = RegistrySet.valueSet(RegistryKey.DIALOG, dialogs);
|
||||
|
||||
return Dialog.create(
|
||||
factory -> factory.empty().base(builder.build())
|
||||
.type(DialogType.dialogList(dialogRegistry).columns(3).build())
|
||||
);
|
||||
public IDialog.IDialogBuilder createDialogBuilder(String title, ServerListProfile profile, int profilesPosition){
|
||||
return PaperDialog.PaperDialogBuilder.create(core(), title, profile, profilesPosition);
|
||||
}
|
||||
|
||||
public WorldCache worldCache(){
|
||||
@@ -317,42 +276,4 @@ public class PaperCore extends JavaPlugin implements PluginCore<CachedServerIcon
|
||||
pluginLogger().warn("to v5.4.1.");
|
||||
pluginLogger().warn("================================================================");
|
||||
}
|
||||
|
||||
private Dialog createProfileDialog(ServerListProfile profile, String title, int profilesPosition){
|
||||
PaperDialogBuilder builder = PaperDialogBuilder.create(title, profile, profilesPosition)
|
||||
.appendBody("""
|
||||
<gold><bold>WARNING!</bold></gold>
|
||||
|
||||
Dialog-based Profile editing is considered <u>experimental!</u>
|
||||
You may encounter bugs and/or glitches.
|
||||
<u>Always create backups before using this feature!</u>"""
|
||||
);
|
||||
|
||||
if(profilesPosition < 0){
|
||||
builder.appendRange("priority", "Priority", profile.priority())
|
||||
.appendInput("condition", "Condition", profile.condition(), 100);
|
||||
}
|
||||
|
||||
ProfileEntry entry;
|
||||
if(profilesPosition >= 0){
|
||||
entry = profile.profiles().get(profilesPosition);
|
||||
}else{
|
||||
entry = profile.defaultProfile();
|
||||
}
|
||||
|
||||
builder.appendTextbox("motd", "MOTD", String.join("\n", entry.motd()), 100, 2)
|
||||
.appendInput("favicon", "Favicon", entry.favicon(), 100)
|
||||
.appendBoolean("hidePlayers", "Hide Player Count", entry.hidePlayersEnabled())
|
||||
.appendBoolean("hidePlayersHover", "Hide Player Count Hover", entry.hidePlayersHoverEnabled())
|
||||
.appendTextbox("hover", "Player Count Hover", String.join("\n", entry.players()), 200, 10)
|
||||
.appendInput("text", "Player Count Text", entry.playerCountText(), 100)
|
||||
.appendBoolean("extraPlayersEnabled", "Enable Extra Players", entry.extraPlayersEnabled())
|
||||
.appendInput("extraPlayersCount", "Extra Players Count", entry.extraPlayersCount(), 100)
|
||||
.appendBoolean("maxPlayersEnabled", "Enable Max Players", entry.maxPlayersEnabled())
|
||||
.appendInput("maxPlayersCount", "Max Players Count", entry.maxPlayersCount(), 100)
|
||||
.appendBoolean("onlinePlayersEnabled", "Enable Online Players", entry.onlinePlayersEnabled())
|
||||
.appendInput("onlinePlayersCount", "Online Players Count", entry.onlinePlayersCount(), 100);
|
||||
|
||||
return builder.build(core());
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
package ch.andre601.advancedserverlist.paper;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.objects.NullBool;
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import io.papermc.paper.dialog.Dialog;
|
||||
import io.papermc.paper.dialog.DialogResponseView;
|
||||
import io.papermc.paper.registry.data.dialog.ActionButton;
|
||||
import io.papermc.paper.registry.data.dialog.DialogBase;
|
||||
import io.papermc.paper.registry.data.dialog.action.DialogAction;
|
||||
import io.papermc.paper.registry.data.dialog.body.DialogBody;
|
||||
import io.papermc.paper.registry.data.dialog.input.DialogInput;
|
||||
import io.papermc.paper.registry.data.dialog.input.TextDialogInput;
|
||||
import io.papermc.paper.registry.data.dialog.type.DialogType;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickCallback;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public class PaperDialogBuilder{
|
||||
|
||||
private final String title;
|
||||
private final ServerListProfile profile;
|
||||
private final int profilesPosition;
|
||||
private final List<DialogBody> bodies = new ArrayList<>();
|
||||
private final List<DialogInput> inputs = new ArrayList<>();
|
||||
|
||||
public static PaperDialogBuilder create(String title, ServerListProfile profile, int profilesPosition){
|
||||
return new PaperDialogBuilder(title, profile, profilesPosition);
|
||||
}
|
||||
public PaperDialogBuilder(String title, ServerListProfile profile, int profilesPosition1){
|
||||
this.title = title;
|
||||
this.profile = profile;
|
||||
this.profilesPosition = profilesPosition1;
|
||||
}
|
||||
|
||||
public PaperDialogBuilder appendInput(String key, String title, String initValue, int maxLength){
|
||||
inputs.add(DialogInput.text(key, Component.text(title))
|
||||
.initial(initValue == null ? "" : initValue)
|
||||
.maxLength(maxLength)
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PaperDialogBuilder appendTextbox(String key, String title, String initValue, int maxLength, int rows){
|
||||
inputs.add(DialogInput.text(key, Component.text(title))
|
||||
.initial(initValue == null ? "" : initValue)
|
||||
.maxLength(maxLength)
|
||||
.multiline(TextDialogInput.MultilineOptions.create(rows, null))
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PaperDialogBuilder appendRange(String key, String title, int initValue){
|
||||
float minRange = Math.min((float)initValue, -100.0f);
|
||||
float maxRange = Math.max((float)initValue, 100.0f);
|
||||
inputs.add(DialogInput.numberRange(key, Component.text(title), minRange, maxRange)
|
||||
.initial((float)initValue)
|
||||
.step(1.0f)
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PaperDialogBuilder appendBoolean(String key, String title, NullBool initValue){
|
||||
inputs.add(DialogInput.bool(key, Component.text(title))
|
||||
.initial(initValue.getOrDefault(false))
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PaperDialogBuilder appendBody(String body){
|
||||
bodies.add(DialogBody.plainMessage(ComponentParser.text(body).toComponent()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dialog build(AdvancedServerList<?> core){
|
||||
return Dialog.create(
|
||||
factory -> factory.empty()
|
||||
.base(
|
||||
DialogBase.builder(ComponentParser.text(title).toComponent())
|
||||
.body(bodies)
|
||||
.inputs(inputs)
|
||||
.afterAction(DialogBase.DialogAfterAction.NONE)
|
||||
.pause(false)
|
||||
.build()
|
||||
)
|
||||
.type(DialogType.confirmation(
|
||||
ActionButton.builder(ComponentParser.text("<green>Save changes").toComponent())
|
||||
.tooltip(ComponentParser.text("""
|
||||
<white>Closes this Dialog while saving your changes.
|
||||
|
||||
Requires <aqua>/asl reload</aqua> to apply changes.
|
||||
Click the Back button to go back to the main Dialog.""").toComponent())
|
||||
.action(DialogAction.customClick(
|
||||
(view, audience) -> saveProfile(core, profile.file(), view, audience, profilesPosition),
|
||||
ClickCallback.Options.builder().build()
|
||||
))
|
||||
.build(),
|
||||
ActionButton.builder(ComponentParser.text("Back...").toComponent())
|
||||
.tooltip(ComponentParser.text("""
|
||||
Returns you to the main Dialog screen.
|
||||
|
||||
Press the <green>Save changes</green> button to save your changes.""").toComponent())
|
||||
.action(DialogAction.staticAction(ClickEvent.runCommand("/asl profiles edit " + profile.file())))
|
||||
.build()
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
private void saveProfile(
|
||||
AdvancedServerList<?> core,
|
||||
String filename,
|
||||
DialogResponseView view,
|
||||
Audience audience,
|
||||
int profilesPosition
|
||||
){
|
||||
ServerListProfile slp = core.fileHandler().profile(filename);
|
||||
if(slp == null){
|
||||
audience.sendMessage(
|
||||
ComponentParser.textFormatted("<red>Unable to save changes. Couldn't find file <white>%s</white>", filename)
|
||||
.toComponent()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Float priority = view.getFloat("priority");
|
||||
String condition = view.getText("condition");
|
||||
|
||||
String motd = view.getText("motd");
|
||||
String favicon = view.getText("favicon");
|
||||
|
||||
NullBool hidePlayers = NullBool.resolve(view.getBoolean("hidePlayers"));
|
||||
NullBool hidePlayersHover = NullBool.resolve(view.getBoolean("hidePlayersHover"));
|
||||
|
||||
String hover = view.getText("hover");
|
||||
String playerCountText = view.getText("text");
|
||||
|
||||
NullBool extraPlayersEnabled = NullBool.resolve(view.getBoolean("extraPlayersEnabled"));
|
||||
String extraPlayersCount = view.getText("extraPlayersCount");
|
||||
|
||||
NullBool maxPlayersEnabled = NullBool.resolve(view.getBoolean("maxPlayersEnabled"));
|
||||
String maxPlayersCount = view.getText("maxPlayersCount");
|
||||
|
||||
NullBool onlinePlayersEnabled = NullBool.resolve(view.getBoolean("onlinePlayersEnabled"));
|
||||
String onlinePlayersCount = view.getText("onlinePlayersCount");
|
||||
|
||||
ProfileEntry.Builder builder = ProfileEntry.empty().builder();
|
||||
if(motd != null && !motd.isEmpty())
|
||||
builder.motd(List.of(motd.split("\n")));
|
||||
|
||||
if(favicon != null && !favicon.isEmpty())
|
||||
builder.favicon(favicon);
|
||||
|
||||
builder.hidePlayersEnabled(hidePlayers);
|
||||
builder.hidePlayersHoverEnabled(hidePlayersHover);
|
||||
|
||||
if(hover != null && !hover.isEmpty())
|
||||
builder.players(List.of(hover.split("\n")));
|
||||
|
||||
if(playerCountText != null && !playerCountText.isEmpty())
|
||||
builder.playerCountText(playerCountText);
|
||||
|
||||
builder.extraPlayersEnabled(extraPlayersEnabled);
|
||||
if(extraPlayersCount != null && !extraPlayersCount.isEmpty())
|
||||
builder.extraPlayersCount(extraPlayersCount);
|
||||
|
||||
builder.maxPlayersEnabled(maxPlayersEnabled);
|
||||
if(maxPlayersCount != null && !maxPlayersCount.isEmpty())
|
||||
builder.maxPlayersCount(maxPlayersCount);
|
||||
|
||||
builder.onlinePlayersEnabled(onlinePlayersEnabled);
|
||||
if(onlinePlayersCount != null && !onlinePlayersCount.isEmpty())
|
||||
builder.onlinePlayersCount(onlinePlayersCount);
|
||||
|
||||
ProfileEntry entry = slp.defaultProfile();
|
||||
List<ProfileEntry> entries = slp.profiles();
|
||||
if(profilesPosition >= 0){
|
||||
if(profilesPosition >= entries.size()){
|
||||
entries.add(builder.build());
|
||||
}else{
|
||||
entries.set(profilesPosition, builder.build());
|
||||
}
|
||||
}else{
|
||||
entry = builder.build();
|
||||
}
|
||||
|
||||
float newPriority = priority == null ? slp.priority() : priority;
|
||||
|
||||
if(core.fileHandler().saveProfile(filename, (int)newPriority, condition, entries, entry)){
|
||||
audience.sendMessage(ComponentParser.text("<grey>[<aqua>ASL</aqua>] <green>Changes saved successfully!").toComponent());
|
||||
}else{
|
||||
audience.sendMessage(ComponentParser.text("<grey>[<red>ASL</red>] <red>Error while saving changes. Check console for details").toComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -32,7 +32,6 @@ import net.kyori.adventure.audience.Audience;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public class PaperCmdSender implements CmdSender{
|
||||
|
||||
private final CommandSender sender;
|
||||
@@ -70,7 +69,7 @@ public class PaperCmdSender implements CmdSender{
|
||||
return sender;
|
||||
}
|
||||
|
||||
public CommandSourceStack getCommandSourceStack(){
|
||||
public CommandSourceStack commandSourceStack(){
|
||||
return commandSourceStack;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class PaperCommandManagerInterface implements CommandManagerInterface<Com
|
||||
public SenderMapper<CommandSourceStack, CmdSender> senderMapper(){
|
||||
return SenderMapper.create(
|
||||
PaperCmdSender::new,
|
||||
sender -> ((PaperCmdSender)sender).getCommandSourceStack()
|
||||
sender -> ((PaperCmdSender)sender).commandSourceStack()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package ch.andre601.advancedserverlist.paper.dialogs;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.objects.NullBool;
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import io.papermc.paper.dialog.Dialog;
|
||||
import io.papermc.paper.dialog.DialogResponseView;
|
||||
import io.papermc.paper.registry.data.dialog.ActionButton;
|
||||
import io.papermc.paper.registry.data.dialog.DialogBase;
|
||||
import io.papermc.paper.registry.data.dialog.action.DialogAction;
|
||||
import io.papermc.paper.registry.data.dialog.body.DialogBody;
|
||||
import io.papermc.paper.registry.data.dialog.input.DialogInput;
|
||||
import io.papermc.paper.registry.data.dialog.input.TextDialogInput;
|
||||
import io.papermc.paper.registry.data.dialog.type.DialogType;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickCallback;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public class PaperDialog implements IDialog<Dialog>{
|
||||
|
||||
private final AdvancedServerList<?> core;
|
||||
private final String title;
|
||||
private final ServerListProfile profile;
|
||||
private final int profilesPosition;
|
||||
private final List<DialogBody> bodies;
|
||||
private final List<DialogInput> inputs;
|
||||
|
||||
private PaperDialog(AdvancedServerList<?> core, String title, ServerListProfile profile, int profilesPosition, List<DialogBody> bodies, List<DialogInput> inputs){
|
||||
this.core = core;
|
||||
this.title = title;
|
||||
this.profile = profile;
|
||||
this.profilesPosition = profilesPosition;
|
||||
this.bodies = bodies;
|
||||
this.inputs = inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog createDialog(){
|
||||
return Dialog.create(
|
||||
factory -> factory.empty().base(
|
||||
DialogBase.builder(ComponentParser.text(title).toComponent())
|
||||
.body(bodies)
|
||||
.inputs(inputs)
|
||||
.afterAction(DialogBase.DialogAfterAction.NONE)
|
||||
.pause(false)
|
||||
.build()
|
||||
).type(DialogType.confirmation(
|
||||
ActionButton.builder(ComponentParser.text("<green>Save changes").toComponent())
|
||||
.tooltip(ComponentParser.text("""
|
||||
<grey>Saves your changes made in this Dialog.
|
||||
<grey>Applying changes requires the use of <aqua>/asl reload""").toComponent())
|
||||
.action(
|
||||
DialogAction.customClick(
|
||||
(view, audience) -> handle(audience, view, profile, profilesPosition),
|
||||
ClickCallback.Options.builder().build()
|
||||
)
|
||||
)
|
||||
.build(),
|
||||
ActionButton.builder(ComponentParser.text("Back...").toComponent())
|
||||
.tooltip(ComponentParser.text("""
|
||||
<grey>Returns you to the main Dialog Screen.
|
||||
<grey>Any unsaved changes will be <red>lost</red>!
|
||||
|
||||
<grey>Click the <green>Save changes</green> button to save your changes.""").toComponent())
|
||||
.action(DialogAction.staticAction(ClickEvent.runCommand("/asl profiles edit " + profile.file())))
|
||||
.build()
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
private void handle(Audience audience, DialogResponseView view, ServerListProfile slp, int profilesPosition){
|
||||
Float priority = view.getFloat("priority");
|
||||
String condition = view.getText("condition");
|
||||
|
||||
String motd = view.getText("motd");
|
||||
String favicon = view.getText("favicon");
|
||||
|
||||
NullBool hidePlayers = NullBool.resolve(view.getBoolean("hidePlayers"));
|
||||
NullBool hidePlayersHover = NullBool.resolve(view.getBoolean("hidePlayersHover"));
|
||||
|
||||
String hover = view.getText("hover");
|
||||
String playerCountText = view.getText("text");
|
||||
|
||||
NullBool extraPlayersEnabled = NullBool.resolve(view.getBoolean("extraPlayersEnabled"));
|
||||
String extraPlayersCount = view.getText("extraPlayersCount");
|
||||
|
||||
NullBool maxPlayersEnabled = NullBool.resolve(view.getBoolean("maxPlayersEnabled"));
|
||||
String maxPlayersCount = view.getText("maxPlayersCount");
|
||||
|
||||
NullBool onlinePlayersEnabled = NullBool.resolve(view.getBoolean("onlinePlayersEnabled"));
|
||||
String onlinePlayersCount = view.getText("onlinePlayersCount");
|
||||
|
||||
ProfileEntry.Builder builder = ProfileEntry.empty().builder();
|
||||
if(motd != null && !motd.isEmpty())
|
||||
builder.motd(List.of(motd.split("\n")));
|
||||
|
||||
if(favicon != null && !favicon.isEmpty())
|
||||
builder.favicon(favicon);
|
||||
|
||||
builder.hidePlayersEnabled(hidePlayers);
|
||||
builder.hidePlayersHoverEnabled(hidePlayersHover);
|
||||
|
||||
if(hover != null && !hover.isEmpty())
|
||||
builder.players(List.of(hover.split("\n")));
|
||||
|
||||
if(playerCountText != null && !playerCountText.isEmpty())
|
||||
builder.playerCountText(playerCountText);
|
||||
|
||||
builder.extraPlayersEnabled(extraPlayersEnabled);
|
||||
if(extraPlayersCount != null && !extraPlayersCount.isEmpty())
|
||||
builder.extraPlayersCount(extraPlayersCount);
|
||||
|
||||
builder.maxPlayersEnabled(maxPlayersEnabled);
|
||||
if(maxPlayersCount != null && !maxPlayersCount.isEmpty())
|
||||
builder.maxPlayersCount(maxPlayersCount);
|
||||
|
||||
builder.onlinePlayersEnabled(onlinePlayersEnabled);
|
||||
if(onlinePlayersCount != null && !onlinePlayersCount.isEmpty())
|
||||
builder.onlinePlayersCount(onlinePlayersCount);
|
||||
|
||||
ProfileEntry entry = slp.defaultProfile();
|
||||
List<ProfileEntry> entries = slp.profiles();
|
||||
|
||||
if(profilesPosition >= 0){
|
||||
if(profilesPosition >= entries.size()){
|
||||
entries.add(builder.build());
|
||||
}else{
|
||||
entries.set(profilesPosition, builder.build());
|
||||
}
|
||||
}else{
|
||||
entry = builder.build();
|
||||
}
|
||||
|
||||
float newPriority = priority == null ? slp.priority() : priority;
|
||||
|
||||
if(core.fileHandler().saveProfile(slp.file(), (int)newPriority, condition, entries, entry)){
|
||||
audience.sendMessage(ComponentParser.textFormatted(
|
||||
"<grey>[<aqua>ASL</aqua>] <green>Successfully saved changes for <white>%s</white>!",
|
||||
slp.file()
|
||||
).toComponent());
|
||||
}else{
|
||||
audience.sendMessage(ComponentParser.textFormatted(
|
||||
"<grey>[<red>ASL</red>] <red>Error while saving changes for <white>%s</white>! See console for details.",
|
||||
slp.file()
|
||||
).toComponent());
|
||||
}
|
||||
}
|
||||
|
||||
public static class PaperDialogBuilder implements IDialogBuilder{
|
||||
|
||||
public static PaperDialogBuilder create(AdvancedServerList<?> core, String title, ServerListProfile profile, int profilesPosition){
|
||||
return new PaperDialogBuilder(core, title, profile, profilesPosition);
|
||||
}
|
||||
|
||||
private final AdvancedServerList<?> core;
|
||||
private final String title;
|
||||
private final ServerListProfile profile;
|
||||
private final int profilesPosition;
|
||||
private final List<DialogBody> bodies = new ArrayList<>();
|
||||
private final List<DialogInput> inputs = new ArrayList<>();
|
||||
|
||||
private PaperDialogBuilder(AdvancedServerList<?> core, String title, ServerListProfile profile, int profilesPosition){
|
||||
this.core = core;
|
||||
this.title = title;
|
||||
this.profile = profile;
|
||||
this.profilesPosition = profilesPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogBuilder appendBody(String body){
|
||||
this.bodies.add(DialogBody.plainMessage(ComponentParser.text(body).toComponent()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogBuilder appendTextInput(String key, String title, String initValue, int maxLength){
|
||||
this.inputs.add(DialogInput.text(key, Component.text(title))
|
||||
.initial(initValue == null ? "" : initValue)
|
||||
.maxLength(maxLength)
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogBuilder appendTextbox(String key, String title, List<String> initValue, int maxLength, int rows){
|
||||
this.inputs.add(DialogInput.text(key, Component.text(title))
|
||||
.initial(initValue == null ? "" : String.join("\n", initValue))
|
||||
.maxLength(maxLength)
|
||||
.multiline(TextDialogInput.MultilineOptions.create(rows, null))
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogBuilder appendNumberRange(String key, String title, int initValue){
|
||||
float minValue = Math.min((float)initValue, -100.0F);
|
||||
float maxValue = Math.max((float)initValue, 100.0F);
|
||||
|
||||
this.inputs.add(DialogInput.numberRange(key, Component.text(title), minValue, maxValue)
|
||||
.step(1.0F)
|
||||
.initial((float)initValue)
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogBuilder appendBoolean(String key, String title, NullBool initValue){
|
||||
this.inputs.add(DialogInput.bool(key, Component.text(title))
|
||||
.initial(initValue.getOrDefault(false))
|
||||
.build()
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialog build(){
|
||||
return new PaperDialog(core, title, profile, profilesPosition, bodies, inputs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package ch.andre601.advancedserverlist.paper.dialogs;
|
||||
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialogList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
import io.papermc.paper.dialog.Dialog;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.data.dialog.DialogBase;
|
||||
import io.papermc.paper.registry.data.dialog.body.DialogBody;
|
||||
import io.papermc.paper.registry.data.dialog.type.DialogType;
|
||||
import io.papermc.paper.registry.set.RegistrySet;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PaperDialogList implements IDialogList{
|
||||
|
||||
private final String title;
|
||||
private final List<String> bodies;
|
||||
private final List<IDialog<?>> dialogs;
|
||||
|
||||
protected PaperDialogList(String title, List<String> bodies, List<IDialog<?>> dialogs){
|
||||
this.title = title;
|
||||
this.bodies = bodies;
|
||||
this.dialogs = dialogs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public void show(CmdSender sender){
|
||||
List<DialogBody> dialogBodies = bodies.stream()
|
||||
.<DialogBody>map(text -> DialogBody.plainMessage(ComponentParser.text(text).toComponent()))
|
||||
.toList();
|
||||
List<Dialog> paperDialogs = dialogs.stream()
|
||||
.filter(dialog -> dialog instanceof PaperDialog)
|
||||
.map(dialog -> (PaperDialog)dialog)
|
||||
.map(PaperDialog::createDialog)
|
||||
.toList();
|
||||
|
||||
DialogBase.Builder builder = DialogBase.builder(Component.text(title))
|
||||
.body(dialogBodies);
|
||||
|
||||
RegistrySet<Dialog> dialogRegistry = RegistrySet.valueSet(RegistryKey.DIALOG, paperDialogs);
|
||||
|
||||
Dialog dialog = Dialog.create(
|
||||
factory -> factory.empty().base(builder.build())
|
||||
.type(DialogType.dialogList(dialogRegistry).columns(3).build())
|
||||
);
|
||||
|
||||
sender.audience().showDialog(dialog);
|
||||
}
|
||||
|
||||
public static class PaperDialogListBuilder implements IDialogListBuilder{
|
||||
|
||||
public static PaperDialogListBuilder create(String title){
|
||||
return new PaperDialogListBuilder(title);
|
||||
}
|
||||
|
||||
private final String title;
|
||||
private final List<String> bodies = new ArrayList<>();
|
||||
private final List<IDialog<?>> dialogs = new ArrayList<>();
|
||||
|
||||
private PaperDialogListBuilder(String title){
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogListBuilder appendBody(String body){
|
||||
this.bodies.add(body);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogListBuilder appendDialog(IDialog<?> dialog){
|
||||
this.dialogs.add(dialog);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaperDialogList build(){
|
||||
return new PaperDialogList(this.title, this.bodies, this.dialogs);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -225,6 +225,7 @@ public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon,
|
||||
String parsed = ComponentParser.text(line)
|
||||
.modifyText(text -> StringReplacer.replace(text, player, server))
|
||||
.modifyText(text -> parsePAPIPlaceholders(text, player))
|
||||
.applyMMTags(plugin())
|
||||
.toString();
|
||||
|
||||
playerList.add(function.apply(parsed));
|
||||
|
||||
-1
@@ -29,7 +29,6 @@ import ch.andre601.advancedserverlist.api.bukkit.events.PreServerListSetEvent;
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
|
||||
public class PreServerListSetEventImpl extends PreServerListSetEvent{
|
||||
|
||||
public PreServerListSetEventImpl(ProfileEntry entry){
|
||||
super(entry);
|
||||
}
|
||||
|
||||
+6
-3
@@ -28,14 +28,17 @@ package ch.andre601.advancedserverlist.paper.objects.impl;
|
||||
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitPlayer;
|
||||
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record PaperPlayerImpl(OfflinePlayer player, CachedPlayer cachedPlayer, int protocol) implements BukkitPlayer{
|
||||
@NullMarked
|
||||
public record PaperPlayerImpl(@Nullable OfflinePlayer player, CachedPlayer cachedPlayer, int protocol) implements BukkitPlayer{
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return player == null ? cachedPlayer.name() : player.getName();
|
||||
return player == null || player.getName() == null ? cachedPlayer.name() : player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +52,7 @@ public record PaperPlayerImpl(OfflinePlayer player, CachedPlayer cachedPlayer, i
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfflinePlayer getPlayer(){
|
||||
public @Nullable OfflinePlayer getPlayer(){
|
||||
return player;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -27,12 +27,13 @@ package ch.andre601.advancedserverlist.paper.objects.impl;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitServer;
|
||||
import org.bukkit.World;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public record PaperServerImpl(Map<String, World> worlds, int playersOnline, int playersMax, String host) implements BukkitServer {
|
||||
@Override
|
||||
public Map<String, World> getWorlds(){
|
||||
public @NonNull Map<String, World> getWorlds(){
|
||||
return worlds;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -29,7 +29,10 @@ import ch.andre601.advancedserverlist.api.PlaceholderProvider;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.paper.objects.impl.PaperPlayerImpl;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class PaperPlayerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
public PaperPlayerPlaceholders(){
|
||||
@@ -37,7 +40,7 @@ public class PaperPlayerPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
if(!(player instanceof PaperPlayerImpl paperPlayer))
|
||||
return null;
|
||||
|
||||
|
||||
+4
-1
@@ -32,7 +32,10 @@ import ch.andre601.advancedserverlist.paper.PaperCore;
|
||||
import ch.andre601.advancedserverlist.paper.objects.impl.PaperServerImpl;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class PaperServerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final PaperCore plugin;
|
||||
@@ -43,7 +46,7 @@ public class PaperServerPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
if(!(server instanceof PaperServerImpl paperServer))
|
||||
return null;
|
||||
|
||||
|
||||
@@ -21,5 +21,8 @@ dependencies:
|
||||
load: BEFORE
|
||||
required: false
|
||||
ServerListPlus:
|
||||
load: BEFORE
|
||||
required: false
|
||||
MiniPlaceholders:
|
||||
load: BEFORE
|
||||
required: false
|
||||
@@ -41,24 +41,24 @@
|
||||
|
||||
<project.build.build_id/>
|
||||
|
||||
<plugin.version>5.7.0-b1</plugin.version>
|
||||
<plugin.version>5.7.2</plugin.version>
|
||||
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
|
||||
|
||||
<api.version>4.1.1</api.version>
|
||||
|
||||
<!-- Adventure versions -->
|
||||
<dependency.adventure-api>4.23.0</dependency.adventure-api>
|
||||
<dependency.adventure-text-minimessage>4.23.0</dependency.adventure-text-minimessage>
|
||||
<dependency.adventure-text-serializer-legacy>4.23.0</dependency.adventure-text-serializer-legacy>
|
||||
<dependency.adventure-platform-bungeecord>4.4.0</dependency.adventure-platform-bungeecord>
|
||||
<dependency.adventure-api>4.26.1</dependency.adventure-api>
|
||||
<dependency.adventure-text-minimessage>4.26.1</dependency.adventure-text-minimessage>
|
||||
<dependency.adventure-text-serializer-legacy>4.26.1</dependency.adventure-text-serializer-legacy>
|
||||
<dependency.adventure-platform-bungeecord>4.4.1</dependency.adventure-platform-bungeecord>
|
||||
<!-- Configurate version -->
|
||||
<dependency.configurate-yaml>4.2.0</dependency.configurate-yaml>
|
||||
<!-- Cloud versions -->
|
||||
<dependency.cloud-annotations>2.0.0</dependency.cloud-annotations>
|
||||
<dependency.cloud-bungee>2.0.0-SNAPSHOT</dependency.cloud-bungee>
|
||||
<dependency.cloud-paper>2.0.0-SNAPSHOT</dependency.cloud-paper>
|
||||
<dependency.cloud-velocity>2.0.0-SNAPSHOT</dependency.cloud-velocity>
|
||||
<dependency.cloud-minecraft-extras>2.0.0-beta.11</dependency.cloud-minecraft-extras>
|
||||
<dependency.cloud-bungee>2.0.0-beta.14</dependency.cloud-bungee>
|
||||
<dependency.cloud-paper>2.0.0-beta.14</dependency.cloud-paper>
|
||||
<dependency.cloud-velocity>2.0.0-beta.14</dependency.cloud-velocity>
|
||||
<dependency.cloud-minecraft-extras>2.0.0-beta.14</dependency.cloud-minecraft-extras>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
@@ -96,7 +96,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.14.1</version>
|
||||
<configuration>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
@@ -114,5 +114,6 @@
|
||||
<module>velocity</module>
|
||||
<module>version-uploader</module>
|
||||
<module>addons/banplugins</module>
|
||||
<module>addons/luckperms</module>
|
||||
</modules>
|
||||
</project>
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
mkdocs-material==9.6.15
|
||||
mkdocs-glightbox==0.4.0
|
||||
mkdocs-material==9.7.1
|
||||
mkdocs-glightbox==0.5.2
|
||||
mkdocs-redirects==1.2.2
|
||||
git+https://github.com/Andre601/mkdocs-pagenav-generator
|
||||
mkdocs-macros-plugin==1.3.7
|
||||
mkdocs-macros-plugin==1.5.0
|
||||
pygments-minimessage==1.0.0
|
||||
+3
-3
@@ -103,13 +103,13 @@
|
||||
<dependency>
|
||||
<groupId>org.sayandev</groupId>
|
||||
<artifactId>sayanvanish-api</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.sayandev</groupId>
|
||||
<artifactId>sayanvanish-proxy-velocity</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
package ch.andre601.advancedserverlist.velocity;
|
||||
|
||||
import ch.andre601.advancedserverlist.core.AdvancedServerList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialog;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.dialogs.IDialogList;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.commands.CmdSender;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
|
||||
@@ -53,7 +55,6 @@ import com.velocitypowered.api.proxy.server.ServerPing;
|
||||
import com.velocitypowered.api.scheduler.ScheduledTask;
|
||||
import com.velocitypowered.api.util.Favicon;
|
||||
import de.myzelyam.api.vanish.VelocityVanishAPI;
|
||||
import net.kyori.adventure.dialog.DialogLike;
|
||||
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
import org.bstats.charts.SimplePie;
|
||||
import org.bstats.velocity.Metrics;
|
||||
@@ -142,7 +143,7 @@ public class VelocityCore implements PluginCore<Favicon>{
|
||||
@Override
|
||||
public void downloadLibrary(String groupId, String artifactId, String version){
|
||||
if(libraryManager == null){
|
||||
libraryManager = new VelocityLibraryManager<>(this, this.logger, folderPath(), getProxy().getPluginManager());
|
||||
libraryManager = new VelocityLibraryManager<>(this, this.logger, folderPath(), proxy().getPluginManager());
|
||||
libraryManager.addRepository("https://repo.papermc.io/repository/maven-public");
|
||||
}
|
||||
|
||||
@@ -158,7 +159,7 @@ public class VelocityCore implements PluginCore<Favicon>{
|
||||
|
||||
@Override
|
||||
public void startScheduler(){
|
||||
scheduledTask = getProxy().getScheduler().buildTask(this, this::fetchServers)
|
||||
scheduledTask = proxy().getScheduler().buildTask(this, this::fetchServers)
|
||||
.repeat(10, TimeUnit.SECONDS)
|
||||
.schedule();
|
||||
}
|
||||
@@ -193,7 +194,7 @@ public class VelocityCore implements PluginCore<Favicon>{
|
||||
|
||||
@Override
|
||||
public String platformInfo(){
|
||||
return getProxy().getVersion().getName() + " " + getProxy().getVersion().getVersion();
|
||||
return proxy().getVersion().getName() + " " + proxy().getVersion().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -203,10 +204,10 @@ public class VelocityCore implements PluginCore<Favicon>{
|
||||
|
||||
@Override
|
||||
public boolean isPluginEnabled(String plugin){
|
||||
if(getProxy() == null)
|
||||
if(proxy() == null)
|
||||
return false;
|
||||
|
||||
return getProxy().getPluginManager().isLoaded(plugin.toLowerCase(Locale.ROOT));
|
||||
return proxy().getPluginManager().isLoaded(plugin.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -220,25 +221,30 @@ public class VelocityCore implements PluginCore<Favicon>{
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialogLike createDialog(ServerListProfile profile){
|
||||
public IDialogList.IDialogListBuilder createDialogListBuilder(String title){
|
||||
return null;
|
||||
}
|
||||
|
||||
public ProxyServer getProxy(){
|
||||
@Override
|
||||
public IDialog.IDialogBuilder createDialogBuilder(String title, ServerListProfile profile, int profilesPosition){
|
||||
return null;
|
||||
}
|
||||
|
||||
public ProxyServer proxy(){
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public int getOnlinePlayers(RegisteredServer server){
|
||||
if(getProxy() == null)
|
||||
public int onlinePlayers(RegisteredServer server){
|
||||
if(proxy() == null)
|
||||
return -1;
|
||||
|
||||
List<Player> players = new ArrayList<>(server == null ? getProxy().getAllPlayers() : server.getPlayersConnected());
|
||||
List<Player> players = new ArrayList<>(server == null ? proxy().getAllPlayers() : server.getPlayersConnected());
|
||||
|
||||
// Exclude players when PremiumVanish is enabled and player is hidden.
|
||||
if(getProxy().getPluginManager().isLoaded("premiumvanish")){
|
||||
if(proxy().getPluginManager().isLoaded("premiumvanish")){
|
||||
players.removeIf(VelocityVanishAPI::isInvisible);
|
||||
}else // Do the same if SayanVanish is enabled.
|
||||
if(getProxy().getPluginManager().isLoaded("sayanvanish")){
|
||||
if(proxy().getPluginManager().isLoaded("sayanvanish")){
|
||||
players.removeIf(player -> SayanVanishVelocityAPI.getInstance().isVanished(player.getUniqueId()));
|
||||
}
|
||||
|
||||
@@ -251,7 +257,7 @@ public class VelocityCore implements PluginCore<Favicon>{
|
||||
|
||||
private void fetchServers(){
|
||||
fetchedServers.clear();
|
||||
getProxy().getAllServers().forEach(server -> server.ping().whenComplete((ping, throwable) -> {
|
||||
proxy().getAllServers().forEach(server -> server.ping().whenComplete((ping, throwable) -> {
|
||||
if(throwable != null)
|
||||
return;
|
||||
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class PlayerJoinEventListener{
|
||||
|
||||
public PlayerJoinEventListener(VelocityCore plugin){
|
||||
this.plugin = plugin;
|
||||
plugin.getProxy().getEventManager().register(plugin, this);
|
||||
plugin.proxy().getEventManager().register(plugin, this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
+2
-2
@@ -38,13 +38,13 @@ public class ProxyPingEventListener{
|
||||
|
||||
public ProxyPingEventListener(VelocityCore plugin){
|
||||
this.plugin = plugin;
|
||||
plugin.getProxy().getEventManager().register(plugin, this);
|
||||
plugin.proxy().getEventManager().register(plugin, this);
|
||||
}
|
||||
|
||||
@Subscribe(priority = Short.MIN_VALUE + 1) // Equivalent to PostOrder.LAST which maintenance uses.
|
||||
public void onProxyPing(ProxyPingEvent event){
|
||||
ProfileEntry entry = PingEventHandler.handleEvent(new VelocityEventWrapper(plugin, event));
|
||||
|
||||
plugin.getProxy().getEventManager().fire(new PostServerListSetEvent(entry));
|
||||
plugin.proxy().getEventManager().fire(new PostServerListSetEvent(entry));
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -69,7 +69,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
public GenericServerListEvent callEvent(ProfileEntry entry){
|
||||
PreServerListSetEventImpl event = new PreServerListSetEventImpl(entry);
|
||||
try{
|
||||
plugin.getProxy().getEventManager().fire(event).get();
|
||||
plugin.proxy().getEventManager().fire(event).get();
|
||||
}catch(InterruptedException | ExecutionException ignored){
|
||||
return null;
|
||||
}
|
||||
@@ -110,6 +110,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
String parsed = ComponentParser.text(lines.get(i))
|
||||
.modifyText(text -> StringReplacer.replace(text, player, server))
|
||||
.modifyText(text -> parsePAPIPlaceholders(text, player))
|
||||
.applyMMTags(plugin())
|
||||
.toString();
|
||||
|
||||
players[i] = new ServerPing.SamplePlayer(parsed, UUID.randomUUID());
|
||||
@@ -145,7 +146,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
|
||||
@Override
|
||||
public boolean isMaintenanceModeActive(){
|
||||
if(!plugin.getProxy().getPluginManager().isLoaded("maintenance"))
|
||||
if(!plugin.proxy().getPluginManager().isLoaded("maintenance"))
|
||||
return false;
|
||||
|
||||
return MaintenanceUtil.get().isMaintenanceEnabled();
|
||||
@@ -158,7 +159,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
|
||||
@Override
|
||||
public int onlinePlayers(){
|
||||
int players = plugin.getOnlinePlayers(null);
|
||||
int players = plugin.onlinePlayers(null);
|
||||
if(players == -1)
|
||||
return builder.getOnlinePlayers();
|
||||
|
||||
@@ -177,7 +178,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
|
||||
@Override
|
||||
public String parsePAPIPlaceholders(String text, VelocityPlayerImpl player){
|
||||
if(!plugin.getProxy().getPluginManager().isLoaded("papiproxybridge"))
|
||||
if(!plugin.proxy().getPluginManager().isLoaded("papiproxybridge"))
|
||||
return text;
|
||||
|
||||
if(!PAPIUtil.get().isCompatible())
|
||||
@@ -187,7 +188,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
if(server == null || server.isEmpty())
|
||||
return text;
|
||||
|
||||
RegisteredServer registeredServer = plugin.getProxy().getServer(server).orElse(null);
|
||||
RegisteredServer registeredServer = plugin.proxy().getServer(server).orElse(null);
|
||||
if(registeredServer == null || registeredServer.getPlayersConnected().isEmpty())
|
||||
return text;
|
||||
|
||||
@@ -216,7 +217,7 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
@Override
|
||||
public GenericServer createServer(int playersOnline, int playersMax, String host){
|
||||
Map<String, RegisteredServer> servers = new HashMap<>();
|
||||
plugin.getProxy().getAllServers().forEach(server -> servers.put(server.getServerInfo().getName(), server));
|
||||
plugin.proxy().getAllServers().forEach(server -> servers.put(server.getServerInfo().getName(), server));
|
||||
|
||||
return new VelocityProxyImpl(servers, playersOnline, playersMax, host);
|
||||
}
|
||||
|
||||
+2
@@ -28,9 +28,11 @@ package ch.andre601.advancedserverlist.velocity.objects.impl;
|
||||
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityPlayer;
|
||||
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@NullMarked
|
||||
public record VelocityPlayerImpl(CachedPlayer player, int protocol) implements VelocityPlayer{
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -27,12 +27,13 @@ package ch.andre601.advancedserverlist.velocity.objects.impl;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityProxy;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public record VelocityProxyImpl(Map<String, RegisteredServer> servers, int playersOnline, int playersMax, String host) implements VelocityProxy{
|
||||
@Override
|
||||
public Map<String, RegisteredServer> getServers(){
|
||||
public @NonNull Map<String, RegisteredServer> getServers(){
|
||||
return servers;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -29,7 +29,10 @@ import ch.andre601.advancedserverlist.api.PlaceholderProvider;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityPlayer;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class VelocityPlayerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private VelocityPlayerPlaceholders(){
|
||||
@@ -41,7 +44,7 @@ public class VelocityPlayerPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
if(!(player instanceof VelocityPlayer velocityPlayer))
|
||||
return null;
|
||||
|
||||
|
||||
+4
-1
@@ -6,7 +6,10 @@ import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
import ch.andre601.advancedserverlist.velocity.VelocityCore;
|
||||
import com.velocitypowered.api.proxy.server.ServerPing;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class VelocityProxyPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final VelocityCore plugin;
|
||||
@@ -22,7 +25,7 @@ public class VelocityProxyPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
String[] args = placeholder.split("\\s", 2);
|
||||
if(args.length < 2)
|
||||
return null;
|
||||
|
||||
+6
-3
@@ -31,7 +31,10 @@ import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityProxy;
|
||||
import ch.andre601.advancedserverlist.velocity.VelocityCore;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@NullMarked
|
||||
public class VelocityServerPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final VelocityCore plugin;
|
||||
@@ -46,7 +49,7 @@ public class VelocityServerPlaceholders extends PlaceholderProvider{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
public @Nullable String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
if(!(server instanceof VelocityProxy proxy))
|
||||
return null;
|
||||
|
||||
@@ -66,7 +69,7 @@ public class VelocityServerPlaceholders extends PlaceholderProvider{
|
||||
if(registeredServer == null)
|
||||
continue;
|
||||
|
||||
int connected = plugin.getOnlinePlayers(registeredServer);
|
||||
int connected = plugin.onlinePlayers(registeredServer);
|
||||
if(connected == -1)
|
||||
continue;
|
||||
|
||||
@@ -88,7 +91,7 @@ public class VelocityServerPlaceholders extends PlaceholderProvider{
|
||||
if(args.length > 2)
|
||||
yield "";
|
||||
|
||||
if(args.length == 2 && args[1] != null && !args[1].isEmpty()){
|
||||
if(args.length == 2 && !args[1].isEmpty()){
|
||||
RegisteredServer info = proxy.getServers().get(args[1]);
|
||||
if(info == null)
|
||||
yield "";
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
{
|
||||
"id": "serverlistplus",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "miniplaceholders",
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"main": "ch.andre601.advancedserverlist.velocity.VelocityCore"
|
||||
|
||||
@@ -46,25 +46,25 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.13.1</version>
|
||||
<version>2.13.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.5.18</version>
|
||||
<version>1.5.23</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
<version>5.5</version>
|
||||
<version>5.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp-jvm</artifactId>
|
||||
<version>5.1.0</version>
|
||||
<version>5.3.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -93,7 +93,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.14.1</version>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
</configuration>
|
||||
@@ -101,7 +101,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
@@ -115,7 +115,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
|
||||
+6
-3
@@ -33,7 +33,8 @@ public enum PlatformInfo{
|
||||
"paper",
|
||||
List.of(
|
||||
"paper/target/AdvancedServerList-Paper-{{version}}.jar",
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar"
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar",
|
||||
"addons/luckperms/target/AdvancedServerList-Luckperms-Addon-{{version}}.jar"
|
||||
),
|
||||
List.of("Paper", "Folia")
|
||||
),
|
||||
@@ -41,7 +42,8 @@ public enum PlatformInfo{
|
||||
"bungeecord",
|
||||
List.of(
|
||||
"bungeecord/target/AdvancedServerList-BungeeCord-{{version}}.jar",
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar"
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar",
|
||||
"addons/luckperms/target/AdvancedServerList-Luckperms-Addon-{{version}}.jar"
|
||||
),
|
||||
List.of("BungeeCord", "Waterfall")
|
||||
),
|
||||
@@ -49,7 +51,8 @@ public enum PlatformInfo{
|
||||
"velocity",
|
||||
List.of(
|
||||
"velocity/target/AdvancedServerList-Velocity-{{version}}.jar",
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar"
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar",
|
||||
"addons/luckperms/target/AdvancedServerList-Luckperms-Addon-{{version}}.jar"
|
||||
),
|
||||
List.of("Velocity")
|
||||
);
|
||||
|
||||
+1
-1
@@ -40,5 +40,5 @@ public class ReleaseHolder{
|
||||
return releases;
|
||||
}
|
||||
|
||||
record ReleaseInfo(String type, String platform, String url){}
|
||||
public record ReleaseInfo(String type, String platform, String url){}
|
||||
}
|
||||
+6
-4
@@ -55,11 +55,11 @@ public class ModrinthVersionUploader{
|
||||
);
|
||||
private final List<String> paperVersions = List.of(
|
||||
"1.20.6",
|
||||
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7"
|
||||
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.9", "1.21.10", "1.21.11"
|
||||
);
|
||||
private final List<String> versions = List.of(
|
||||
"1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6",
|
||||
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7"
|
||||
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5", "1.21.6", "1.21.7", "1.21.9", "1.21.10", "1.21.11"
|
||||
);
|
||||
|
||||
private final ModrinthAPI api;
|
||||
@@ -91,7 +91,8 @@ public class ModrinthVersionUploader{
|
||||
|
||||
List<ProjectVersion.ProjectDependency> paperDependencies = List.of(
|
||||
new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // Maintenance
|
||||
new ProjectVersion.ProjectDependency(null, "P1OZGk5p", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // ViaVersion
|
||||
new ProjectVersion.ProjectDependency(null, "P1OZGk5p", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // ViaVersion
|
||||
new ProjectVersion.ProjectDependency(null, "HQyibRsN", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // MiniPlaceholders
|
||||
);
|
||||
List<ProjectVersion.ProjectDependency> bungeeDependencies = List.of(
|
||||
new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // Maintenance
|
||||
@@ -99,7 +100,8 @@ public class ModrinthVersionUploader{
|
||||
);
|
||||
List<ProjectVersion.ProjectDependency> velocityDependencies = List.of(
|
||||
new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // Maintenance
|
||||
new ProjectVersion.ProjectDependency(null, "bEIUEGTX", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // PAPIProxyBridge
|
||||
new ProjectVersion.ProjectDependency(null, "bEIUEGTX", null, ProjectVersion.ProjectDependencyType.OPTIONAL), // PAPIProxyBridge
|
||||
new ProjectVersion.ProjectDependency(null, "HQyibRsN", null, ProjectVersion.ProjectDependencyType.OPTIONAL) // MiniPlaceholders
|
||||
);
|
||||
|
||||
for(int i = 0; i < platforms.size(); i++){
|
||||
|
||||
Reference in new issue
Block a user