mirror of
https://codeberg.org/Andre601/AdvancedServerList.git
synced 2026-11-05 09:00:15 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5ca6fb53e | ||
|
|
164a4823e8 | ||
|
|
352191695a | ||
|
|
b2235e1d8b | ||
|
|
324b6d6f82 | ||
|
|
fd6e2e736f | ||
|
|
efd5164b8e | ||
|
|
cdb86ae83f | ||
|
|
90c02da02e | ||
|
|
53d56c5891 | ||
|
|
7dd02fa0e5 | ||
|
|
e02b944181 | ||
|
|
299eff1b0d | ||
|
|
aa24ab336b | ||
|
|
a8b9e69e30 | ||
|
|
065c9abf9c | ||
|
|
bdc9668b29 | ||
|
|
7d1abdd2b2 | ||
|
|
667c642708 | ||
|
|
79b13ceab6 | ||
|
|
169f560b2c | ||
|
|
7e8c41c27a | ||
|
|
973966c844 | ||
|
|
eee90cc02f | ||
|
|
ecf052b955 | ||
|
|
a791c86df0 | ||
|
|
63d0b0ac62 | ||
|
|
c46bc37818 | ||
|
|
268d5b84c9 | ||
|
|
0c63abfac8 | ||
|
|
35ca151424 | ||
|
|
e28800f72f | ||
|
|
8232357aba | ||
|
|
eae7f1117c | ||
|
|
d25053b285 | ||
|
|
57273bd265 | ||
|
|
9cf694a7d6 | ||
|
|
5bc0c7b843 | ||
|
|
1c48fd61bc | ||
|
|
8e622b4038 | ||
|
|
35e37bca2e | ||
|
|
cdb508994f | ||
|
|
1113c41379 | ||
|
|
d186ca82a2 | ||
|
|
5cda9e819b | ||
|
|
fe5a73440b | ||
|
|
a91e839f8c | ||
|
|
d4668e0e76 | ||
|
|
305f3452c4 | ||
|
|
fec3361fd7 | ||
|
|
f0861ffa6a | ||
|
|
cfca3f72dc | ||
|
|
aca83e8350 | ||
|
|
8383c8b97f | ||
|
|
3d1ddaa782 | ||
|
|
1d615e252f | ||
|
|
310e72d048 |
No files matched your search
@@ -0,0 +1,52 @@
|
||||
when:
|
||||
- event: pull_request
|
||||
path:
|
||||
include: ['.woodpecker/pr_preview.yml', 'requirements.txt', 'mkdocs.yml', 'docs/**']
|
||||
|
||||
variables:
|
||||
setup_git: &setup_git
|
||||
- apk add git
|
||||
- git config --global user.email "andre@andre601.ch"
|
||||
- git config --global user.name "ASL Docs Builder"
|
||||
|
||||
steps:
|
||||
cloneTargetRepo:
|
||||
image: alpine:3.18.4
|
||||
commands:
|
||||
- chmod -R a+w .
|
||||
- <<: *setup_git
|
||||
- git clone https://codeberg.org/Andre601/asl-docs.git site
|
||||
- chmod -R a+w site
|
||||
- cd site
|
||||
- git switch pr-${CI_COMMIT_PULL_REQUEST} 2>/dev/null || git switch -c pr-${CI_COMMIT_PULL_REQUEST}
|
||||
buildDocs:
|
||||
image: woodpeckerci/plugin-mkdocs:latest
|
||||
settings:
|
||||
pip_install_file: requirements.txt
|
||||
commitAndPush:
|
||||
image: alpine:3.18.4
|
||||
secrets:
|
||||
- bot_token
|
||||
commands:
|
||||
- <<: *setup_git
|
||||
- mv domains site/.domains
|
||||
- cd site
|
||||
- git remote add upstream https://$BOT_TOKEN@codeberg.org/Andre601/asl-docs.git
|
||||
- git add --all
|
||||
- git commit -m "Update Preview for PR ${CI_COMMIT_PULL_REQUEST} ($( env TZ=Europe/Zurich date +"%d.%m.%Y %Z" )) [SKIP CI]"
|
||||
- git push --set-upstream upstream pr-${CI_COMMIT_PULL_REQUEST} -f
|
||||
writeComment:
|
||||
image: mcs94/gitea-comment
|
||||
secrets:
|
||||
- bot_token
|
||||
settings:
|
||||
gitea_address: https://codeberg.org
|
||||
gitea_token:
|
||||
from_secret: BOT_TOKEN
|
||||
comment: |-
|
||||
Build-preview created!
|
||||
|
||||
| Name | Value |
|
||||
|--------|-------------------------------------------------------|
|
||||
| Commit | ${CI_COMMIT_SHA} |
|
||||
| Link | https://asl.andre601.ch/@pr-${CI_COMMIT_PULL_REQUEST} |
|
||||
@@ -33,4 +33,14 @@ steps:
|
||||
- "velocity/target/AdvancedServerList-*.jar"
|
||||
- "addons/banplugins/target/AdvancedServerList-*.jar"
|
||||
api_key:
|
||||
from_secret: CB_TOKEN
|
||||
from_secret: CB_TOKEN
|
||||
postOnMastodon:
|
||||
image: woodpeckerci/plugin-mastodon-post
|
||||
when:
|
||||
- status: ['success']
|
||||
settings:
|
||||
server: https://blobfox.coffee
|
||||
access_token:
|
||||
from_secret: MASTODON_TOKEN
|
||||
status: '${CI_COMMIT_TAG} of #AdvancedServerList has been released and can be found on Modrinth (https://modrinth.com/plugin/AdvancedServerList), Hangar (https://hangar.papermc.io/Andre_601/AdvancedServerList) and Codeberg (https://codeberg.org/Andre601/AdvancedServerList).'
|
||||
visibility: public
|
||||
@@ -1,8 +1,8 @@
|
||||
when:
|
||||
- branch: master
|
||||
- branch: '${CI_REPO_DEFAULT_BRANCH}'
|
||||
event: push
|
||||
path:
|
||||
include: ['requirements.txt', 'mkdocs.yml', 'docs/**']
|
||||
include: ['.woodpecker/publish_docs.yml', 'requirements.txt', 'mkdocs.yml', 'docs/**']
|
||||
|
||||
variables:
|
||||
setup_git: &setup_git
|
||||
@@ -16,7 +16,7 @@ steps:
|
||||
commands:
|
||||
- chmod -R a+w .
|
||||
- <<: *setup_git
|
||||
- git clone -b pages https://codeberg.org/Andre601/AdvancedServerList.git site
|
||||
- git clone -b pages https://codeberg.org/Andre601/asl-docs site
|
||||
- chmod -R a+w site
|
||||
buildDocs:
|
||||
image: woodpeckerci/plugin-mkdocs:latest
|
||||
@@ -25,12 +25,12 @@ steps:
|
||||
commitAndPush:
|
||||
image: alpine:3.18.4
|
||||
secrets:
|
||||
- cb_token
|
||||
- bot_token
|
||||
commands:
|
||||
- <<: *setup_git
|
||||
- mv domains site/.domains
|
||||
- cd site
|
||||
- git remote set-url origin https://$CB_TOKEN@codeberg.org/Andre601/AdvancedServerList.git
|
||||
- git remote set-url origin https://$BOT_TOKEN@codeberg.org/Andre601/asl-docs.git
|
||||
- git add --all
|
||||
- git commit -m "Update AdvancedServerList Docs ($( env TZ=Europe/Zurich date +"%d.%m.%Y %Z" )) [SKIP CI]"
|
||||
- git push
|
||||
@@ -122,7 +122,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<version>3.13.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
+3
-15
@@ -30,8 +30,6 @@ import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.banplugins.providers.AdvancedBanProvider;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AdvancedBanPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final AdvancedBanProvider provider = new AdvancedBanProvider();
|
||||
@@ -42,7 +40,7 @@ public class AdvancedBanPlaceholders extends PlaceholderProvider{
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
String[] args = placeholder.split("\\s");
|
||||
String[] args = placeholder.split("\\s", 2);
|
||||
|
||||
return switch(args[0]) {
|
||||
// Mute-related placeholders
|
||||
@@ -52,9 +50,6 @@ public class AdvancedBanPlaceholders extends PlaceholderProvider{
|
||||
if(args.length == 1)
|
||||
yield provider.muteDuration(player);
|
||||
|
||||
if(args.length > 2)
|
||||
yield null;
|
||||
|
||||
boolean fromStart = Boolean.getBoolean(args[1]);
|
||||
yield provider.muteDuration(player, fromStart);
|
||||
}
|
||||
@@ -62,9 +57,7 @@ public class AdvancedBanPlaceholders extends PlaceholderProvider{
|
||||
if(args.length == 1)
|
||||
yield provider.muteExpirationDate(player);
|
||||
|
||||
String pattern = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||
|
||||
yield provider.banExpirationDate(player, pattern);
|
||||
yield provider.banExpirationDate(player, args[1]);
|
||||
}
|
||||
|
||||
// Ban-related placeholders
|
||||
@@ -74,9 +67,6 @@ public class AdvancedBanPlaceholders extends PlaceholderProvider{
|
||||
if(args.length == 1)
|
||||
yield provider.banDuration(player);
|
||||
|
||||
if(args.length > 2)
|
||||
yield null;
|
||||
|
||||
boolean fromStart = Boolean.getBoolean(args[1]);
|
||||
yield provider.banDuration(player, fromStart);
|
||||
}
|
||||
@@ -84,9 +74,7 @@ public class AdvancedBanPlaceholders extends PlaceholderProvider{
|
||||
if(args.length == 1)
|
||||
yield provider.banExpirationDate(player);
|
||||
|
||||
String pattern = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||
|
||||
yield provider.banExpirationDate(player, pattern);
|
||||
yield provider.banExpirationDate(player, args[1]);
|
||||
}
|
||||
|
||||
// Unknown/Invalid placeholder.
|
||||
|
||||
+3
-9
@@ -30,8 +30,6 @@ import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.banplugins.providers.LibertyBansProvider;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class LibertyBansPlaceholders extends PlaceholderProvider{
|
||||
|
||||
private final LibertyBansProvider provider = LibertyBansProvider.create();
|
||||
@@ -42,7 +40,7 @@ public class LibertyBansPlaceholders extends PlaceholderProvider{
|
||||
|
||||
@Override
|
||||
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
|
||||
String[] args = placeholder.split("\\.");
|
||||
String[] args = placeholder.split("\\s", 2);
|
||||
|
||||
return switch(args[0]){
|
||||
// Mute-related placeholders
|
||||
@@ -52,9 +50,7 @@ public class LibertyBansPlaceholders extends PlaceholderProvider{
|
||||
if(args.length == 1)
|
||||
yield provider.muteExpirationDate(player);
|
||||
|
||||
String pattern = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||
|
||||
yield provider.muteExpirationDate(player, pattern);
|
||||
yield provider.muteExpirationDate(player, args[1]);
|
||||
}
|
||||
|
||||
// Ban-related placeholders
|
||||
@@ -64,9 +60,7 @@ public class LibertyBansPlaceholders extends PlaceholderProvider{
|
||||
if(args.length == 1)
|
||||
yield provider.banExpirationDate(player);
|
||||
|
||||
String pattern = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||
|
||||
yield provider.banExpirationDate(player, pattern);
|
||||
yield provider.banExpirationDate(player, args[1]);
|
||||
}
|
||||
|
||||
// Unknown/Invalid placeholder
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<version>3.13.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
+6
-3
@@ -25,12 +25,13 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.bungeecord.listeners;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.bungeecord.events.PostServerListSetEvent;
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.bungeecord.BungeeCordCore;
|
||||
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
|
||||
import net.md_5.bungee.api.event.ProxyPingEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.md_5.bungee.event.EventPriority;
|
||||
|
||||
public class PingEvent implements Listener{
|
||||
|
||||
@@ -41,8 +42,10 @@ public class PingEvent implements Listener{
|
||||
plugin.getProxy().getPluginManager().registerListener(plugin, this);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = 90) // Maintenance has Event Priority 80, so we need to be AFTER it.
|
||||
public void onProxyPing(ProxyPingEvent event){
|
||||
PingEventHandler.handleEvent(new BungeeEventWrapper(plugin, event));
|
||||
ProfileEntry entry = PingEventHandler.handleEvent(new BungeeEventWrapper(plugin, event));
|
||||
|
||||
plugin.getProxy().getPluginManager().callEvent(new PostServerListSetEvent(entry));
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -41,7 +41,7 @@
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
<plugin.config.version>4</plugin.config.version>
|
||||
<plugin.config.version>5</plugin.config.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -119,7 +119,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>33.0.0-jre</version>
|
||||
<version>33.1.0-jre</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<version>3.13.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
+23
-14
@@ -44,11 +44,11 @@ public class PingEventHandler{
|
||||
private static PAPIUtil papiUtil = null;
|
||||
private static MaintenanceUtil maintenanceUtil = null;
|
||||
|
||||
public static <F, P extends GenericPlayer> void handleEvent(GenericEventWrapper<F, P> event){
|
||||
public static <F, P extends GenericPlayer> ProfileEntry handleEvent(GenericEventWrapper<F, P> event){
|
||||
event.getPlugin().getPluginLogger().debug(PingEventHandler.class, "Received ping event. Handling it...");
|
||||
if(event.isInvalidProtocol() || event.isMaintenanceModeActive()){
|
||||
event.getPlugin().getPluginLogger().debug(PingEventHandler.class, "Not handling event. Either protocol was invalid of Maintenance is enabled.");
|
||||
return;
|
||||
if(event.isInvalidProtocol()){
|
||||
event.getPlugin().getPluginLogger().debug(PingEventHandler.class, "Not handling event. Protocol was invalid.");
|
||||
return null;
|
||||
}
|
||||
|
||||
PluginCore<F> plugin = event.getPlugin();
|
||||
@@ -70,7 +70,7 @@ public class PingEventHandler{
|
||||
|
||||
if(profile == null){
|
||||
logger.debugWarn(PingEventHandler.class, "Server List Profile couldn't be resolved properly. Cancelling event handling...");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.debug(PingEventHandler.class, "Received valid Server List Profile. Calling PreServerListSetEvent...");
|
||||
@@ -78,7 +78,7 @@ public class PingEventHandler{
|
||||
GenericServerListEvent e = event.callEvent(ProfileManager.merge(profile));
|
||||
if(e == null || e.isCancelled()){
|
||||
logger.debug(PingEventHandler.class, "PreServerListSetEvent was cancelled. Stopping ping handling...");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.debug(PingEventHandler.class, "PreServerListSetEvent completed. Proceeding with ping handling...");
|
||||
@@ -86,12 +86,12 @@ public class PingEventHandler{
|
||||
ProfileEntry entry = e.getEntry();
|
||||
if(entry.isInvalid()){
|
||||
logger.debugWarn(PingEventHandler.class, "No valid ProfileEntry retrieved. Cancelling ping handling...");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean extraPlayers = ProfileManager.checkOption(entry.extraPlayersEnabled());
|
||||
|
||||
if(extraPlayers){
|
||||
if(extraPlayers && ignoreMaintenance(event, "extraPlayers")){
|
||||
max = online + (entry.extraPlayersCount() == null ? 0 : entry.extraPlayersCount());
|
||||
|
||||
logger.debug(PingEventHandler.class, "Extra Players enabled. Applying '%d' as max player count...", max);
|
||||
@@ -99,7 +99,7 @@ public class PingEventHandler{
|
||||
event.setMaxPlayers(max);
|
||||
}
|
||||
|
||||
if(ProfileManager.checkOption(entry.maxPlayersEnabled()) && !extraPlayers){
|
||||
if(ProfileManager.checkOption(entry.maxPlayersEnabled()) && !extraPlayers && ignoreMaintenance(event, "maxPlayers")){
|
||||
max = (entry.maxPlayersCount() == null) ? 0 : entry.maxPlayersCount();
|
||||
|
||||
logger.debug(PingEventHandler.class, "Max Players enabled. Applying '%d' as max player count...", max);
|
||||
@@ -109,7 +109,7 @@ public class PingEventHandler{
|
||||
|
||||
GenericServer finalServer = event.createGenericServer(online, max, host);
|
||||
|
||||
if(ProfileManager.checkOption(entry.motd())){
|
||||
if(ProfileManager.checkOption(entry.motd()) && ignoreMaintenance(event, "motd")){
|
||||
logger.debug(PingEventHandler.class, "MOTD set. Applying '%s'...", String.join("\\n", entry.motd()));
|
||||
|
||||
event.setMotd(
|
||||
@@ -122,13 +122,13 @@ public class PingEventHandler{
|
||||
|
||||
boolean hidePlayers = ProfileManager.checkOption(entry.hidePlayersEnabled());
|
||||
|
||||
if(hidePlayers){
|
||||
if(hidePlayers && ignoreMaintenance(event, "hidePlayers")){
|
||||
logger.debug(PingEventHandler.class, "Hide Players enabled. Hiding player count...");
|
||||
|
||||
event.hidePlayers();
|
||||
}
|
||||
|
||||
if(ProfileManager.checkOption(entry.playerCountText()) && !hidePlayers){
|
||||
if(ProfileManager.checkOption(entry.playerCountText()) && !hidePlayers && ignoreMaintenance(event, "playerCountText")){
|
||||
logger.debug(PingEventHandler.class, "Player Count Text set. Applying '%s'...", entry.playerCountText());
|
||||
|
||||
event.setPlayerCount(
|
||||
@@ -139,13 +139,13 @@ public class PingEventHandler{
|
||||
);
|
||||
}
|
||||
|
||||
if(ProfileManager.checkOption(entry.players()) && !hidePlayers){
|
||||
if(ProfileManager.checkOption(entry.players()) && !hidePlayers && ignoreMaintenance(event, "playerCountHover")){
|
||||
logger.debug(PingEventHandler.class, "Player Count Hover set. Applying '%s'...", String.join("\\n", entry.players()));
|
||||
|
||||
event.setPlayers(entry.players(), player, server);
|
||||
}
|
||||
|
||||
if(ProfileManager.checkOption(entry.favicon())){
|
||||
if(ProfileManager.checkOption(entry.favicon()) && ignoreMaintenance(event, "favicon")){
|
||||
logger.debug(PingEventHandler.class, "Favicon set. Resolving '%s'...", entry.favicon());
|
||||
|
||||
String faviconString = StringReplacer.replace(entry.favicon(), player, server);
|
||||
@@ -165,6 +165,8 @@ public class PingEventHandler{
|
||||
|
||||
logger.debug(PingEventHandler.class, "Event handling completed. Updating Ping data...");
|
||||
event.updateEvent();
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
public static PAPIUtil getPAPIUtil(){
|
||||
@@ -180,4 +182,11 @@ public class PingEventHandler{
|
||||
|
||||
return (maintenanceUtil = new MaintenanceUtil());
|
||||
}
|
||||
|
||||
private static <F, P extends GenericPlayer> boolean ignoreMaintenance(GenericEventWrapper<F, P> event, String option){
|
||||
if(!event.isMaintenanceModeActive())
|
||||
return true;
|
||||
|
||||
return !event.getPlugin().getCore().getFileHandler().getBool(true, "disableDuringMaintenance", option);
|
||||
}
|
||||
}
|
||||
@@ -46,12 +46,29 @@ public class ConfigMigrator{
|
||||
public static ConfigurationTransformation.Versioned create(){
|
||||
return ConfigurationTransformation.versionedBuilder()
|
||||
.versionKey("configVersion")
|
||||
.addVersion(LATEST, threeToFour())
|
||||
.addVersion(LATEST, fourToFive())
|
||||
.addVersion(4, threeToFour())
|
||||
.addVersion(3, twoToThree())
|
||||
.addVersion(2, oneToTwo())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ConfigurationTransformation fourToFive(){
|
||||
return ConfigurationTransformation.builder()
|
||||
.addAction(NodePath.path(), (path, value) -> {
|
||||
value.node("disableDuringMaintenance", "motd").set(true);
|
||||
value.node("disableDuringMaintenance", "favicon").set(true);
|
||||
value.node("disableDuringMaintenance", "hidePlayers").set(true);
|
||||
value.node("disableDuringMaintenance", "playerCountText").set(true);
|
||||
value.node("disableDuringMaintenance", "playerCountHover").set(true);
|
||||
value.node("disableDuringMaintenance", "extraPlayers").set(true);
|
||||
value.node("disableDuringMaintenance", "maxPlayers").set(true);
|
||||
|
||||
return null;
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
public static ConfigurationTransformation threeToFour(){
|
||||
return ConfigurationTransformation.builder()
|
||||
.addAction(NodePath.path(), (path, value) -> {
|
||||
|
||||
@@ -187,8 +187,12 @@ public class FileHandler{
|
||||
return node.node(path).getString(def);
|
||||
}
|
||||
|
||||
public boolean getBool(boolean def, Object... path){
|
||||
return node.node(path).getBoolean(def);
|
||||
}
|
||||
|
||||
public boolean getBoolean(Object... path){
|
||||
return node.node(path).getBoolean();
|
||||
return getBool(false, path);
|
||||
}
|
||||
|
||||
public long getLong(long def, long limit, Object... path){
|
||||
|
||||
+5
-9
@@ -53,15 +53,11 @@ public record ServerListProfile(int priority, String condition, ProfileEntry def
|
||||
logger.warn("Encountered %d Error(s) while parsing condition for file '%s':", collector.getWarnings().size(), file);
|
||||
|
||||
for(ParseWarnCollector.Context context : collector.getWarnings()){
|
||||
if(context.position() <= -1){
|
||||
logger.warn(" - %s", condition);
|
||||
logger.warn(" -> %s", context.message());
|
||||
}else{
|
||||
logger.warn(" - At position %d:", context.position());
|
||||
logger.warn(" %s", condition);
|
||||
logger.warn(" ".repeat(context.position() + 5) + "^");
|
||||
logger.warn(" -> %s", context.message());
|
||||
}
|
||||
logger.warn(" - At position %s:", context.position() == -1 ? "Unknown" : context.position());
|
||||
logger.warn(" %s", condition);
|
||||
logger.warn(" ".repeat(context.position() + 5) + "^");
|
||||
logger.warn(" -> %s", context.message());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,42 @@ debug: false
|
||||
#
|
||||
faviconCacheTime: 1
|
||||
|
||||
#
|
||||
# List of options that should be disabled while the Maintenance Mode of the plugin Maintenance is active.
|
||||
# Any option not listed here will NOT be disabled, meaning AdvancedServerList will continue to handle it.
|
||||
#
|
||||
# Each option defaults to true when not present, disabling said option while Maintenance is active.
|
||||
#
|
||||
disableDuringMaintenance:
|
||||
#
|
||||
# When true (Default), disables handling of MOTD while Maintenance is enabled.
|
||||
#
|
||||
motd: true
|
||||
#
|
||||
# When true (Default), disables handling of Favicon while Maintenance is enabled.
|
||||
#
|
||||
favicon: true
|
||||
#
|
||||
# When true (Default), disables hiding of player count while Maintenance is enabled.
|
||||
#
|
||||
hidePlayers: true
|
||||
#
|
||||
# When true (Default), disables handling of player count text while Maintenance is enabled.
|
||||
#
|
||||
playerCountText: true
|
||||
#
|
||||
# When true (Default), disables handling of player count hover while Maintenance is enabled.
|
||||
#
|
||||
playerCountHover: true
|
||||
#
|
||||
# When true (Default), disables use of extra players feature while Maintenance is enabled.
|
||||
#
|
||||
extraPlayers: true
|
||||
#
|
||||
# When true (Default), disables use of max players feature while Maintenance is enabled.
|
||||
#
|
||||
maxPlayers: true
|
||||
|
||||
#
|
||||
# DO NOT EDIT!
|
||||
#
|
||||
|
||||
@@ -1,176 +1,169 @@
|
||||
#
|
||||
# Set the priority of this profile.
|
||||
# Higher number = Higher priority.
|
||||
# If there are multiple profiles (files) will they be sorted by priority, starting with highest.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#priority
|
||||
#
|
||||
priority: 0
|
||||
|
||||
#
|
||||
# Set conditions that need to me met to show this profile.
|
||||
# You can use keywords 'and' or 'or' (Or alternatively '&&' or `||`) to make more complex condition sets.
|
||||
# Set condition(s) that should return true to display this profile.
|
||||
# This allows you to create profiles to only show for specific scenarios (i.e. player is banned).
|
||||
#
|
||||
# Multiple conditions can be chaing with the keywords 'and', 'or', or their counterparts '&&' and '||'.
|
||||
#
|
||||
# No condition or an empty condition will be treated as true by default.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#condition
|
||||
#
|
||||
# condition: '${player protocol} < 759'
|
||||
#
|
||||
condition: ''
|
||||
|
||||
#
|
||||
# Set conditions that needs to be met.
|
||||
# Only when all conditions return true will the profile be shown (Given no profile with higher priority is used).
|
||||
# Set one or multiple profiles.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#conditions
|
||||
# A profile can contain the same options as used in the file itself, except for priority and condition.
|
||||
# If multiple entries are present, a random one will be selected. Any options set in the selected profile will override
|
||||
# any existing option in the file.
|
||||
#
|
||||
#conditions:
|
||||
# - '{playerVersion} < 759'
|
||||
|
||||
# Example: The below profile configuration will randomly change the MOTD between two types, but keep the Hover text
|
||||
# the same.
|
||||
#
|
||||
# Option that allows you to define multiple profiles to use.
|
||||
# Each entry supports the same options as the server list profile does. Whenever an option is not present, or set to
|
||||
# an empty value (If supported) would the option in the file be used (if present).
|
||||
# This allows you to f.e. randomize the MOTD while keeping other options the same, without copy-pasting the same options.
|
||||
#
|
||||
# A profile will be selected randomly.
|
||||
#
|
||||
# Remove this option or set it to profiles: [] to use the global options of this file.
|
||||
# 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
|
||||
#
|
||||
#profiles:
|
||||
# - motd:
|
||||
# - '<aqua>Line 1'
|
||||
# - '<aqua>Line 2'
|
||||
# favicon: ''
|
||||
# playerCount:
|
||||
# hidePlayers: false
|
||||
# hover:
|
||||
# - '<green>Line 1'
|
||||
# - '<green>Line 2'
|
||||
# - '<green>Line 3'
|
||||
# text: ''
|
||||
# extraPlayers:
|
||||
# enabled: false
|
||||
# amount: 0
|
||||
profiles:
|
||||
- motd: ['<aqua>Line A', '<gold>Line B']
|
||||
- motd:
|
||||
- '<aqua>Line 1'
|
||||
- '<gold>Line 2'
|
||||
|
||||
#
|
||||
# Set the default (Global) MOTD used by this server list profile.
|
||||
# Supports HEX colors for 1.16+ servers including gradients using MiniMessage's <gradient:color:color> format.
|
||||
#
|
||||
# Remove this option or set it to motd: [] to not alter the MOTD.
|
||||
# Set the "Message of the day" to display.
|
||||
# This option supports RGB colors for 1.16+ Servers and clients, including gradients using MiniMessage's <gradient>
|
||||
# option.
|
||||
#
|
||||
# Only the first two lines will be considered and any additional one is ignored.
|
||||
#
|
||||
# When not present or empty (motd: []), no MOTD will be set.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#motd
|
||||
#
|
||||
motd:
|
||||
- '<grey>Line 1'
|
||||
- '<grey>Line 2'
|
||||
- '<grey>First Line'
|
||||
- '<grey>Second Line'
|
||||
|
||||
#
|
||||
# Allows you to set a global (Default) favicon for this server list profile.
|
||||
# You can use one of three possible options:
|
||||
# 1. A file name matching a PNG file located in the 'favicons' folder (Needs to end with .png)
|
||||
# 2. A URL pointing to a valid Image
|
||||
# 3. ${player name} to display the player's head as favicon. Uses https://mc-heads.net for this
|
||||
# Set the Favicon (image on the left of a server entry) to display.
|
||||
# This option supports three types of inputs:
|
||||
#
|
||||
# Remove this option or set to favicon: '' to not replace the Favicon.
|
||||
# 1. Name, including .png extension, pointing to an image located in the plugin's favicons folder.
|
||||
# 2. URL pointing to an image.*
|
||||
# 3. Player name, UUID or placeholders returning one of these.*
|
||||
# https://mc-heads.net will be used to retrieve an image of the provided name/UUID.
|
||||
#
|
||||
# * These images are loaded asynchronously, meaning they may not yet be "ready" when AdvancedServerList is done with
|
||||
# the event, requiring a refresh of the server list by the player to have it shown.
|
||||
#
|
||||
# Any images above or below 64x64 pixels will be automatically resized to these dimensions.
|
||||
#
|
||||
# If not present or empty (favicon: ''), defaults to not modifying the favicon.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#favicon
|
||||
#
|
||||
favicon: ''
|
||||
|
||||
#
|
||||
# Contains various options to manipulate the player count (Text displaying online and max players allowed).
|
||||
# Contains options for modifying the player count (Text displaying <online>/<max>).
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#playercount
|
||||
#
|
||||
playerCount:
|
||||
#
|
||||
# Whether AdvancedServerList should hide the player count or not.
|
||||
# When set to true will the player count display '???' instead of <online>/<max>
|
||||
# Set whether the Player count should be hidden.
|
||||
# When set to true, the player count will be displayed as '???' instead of the usual '<online>/<max>' and all other
|
||||
# playerCount options, except for extraPlayers and maxPlayers, will be ignored.
|
||||
#
|
||||
# Note that when this is enabled will all other options, except for 'extraPlayers', be ignored.
|
||||
#
|
||||
# Defaults to false when not present.
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hideplayers
|
||||
#
|
||||
hidePlayers: false
|
||||
#
|
||||
# Sets the text displayed when hovering over the player count.
|
||||
# Set the lines shown when the player hovers over the player count.
|
||||
# Unlike the MOTD option does this one only support basic color and formatting codes. Any RGB colors will be
|
||||
# downsampled to the nearest matching color.
|
||||
#
|
||||
# Remove this option or set it to hover: [] to not modify the player samples on the player count.
|
||||
# If not present or empty (hover: []), defaults to not modifying the hover.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hover
|
||||
#
|
||||
hover:
|
||||
- '<grey>Line 1'
|
||||
- '<grey>Line 2'
|
||||
- '<grey>Line 3'
|
||||
- '<aqua>Line 1'
|
||||
- '<yellow>Line 2'
|
||||
- '<green>Line 3'
|
||||
#
|
||||
# Modifies the text that usually displays '<online>/<max>'
|
||||
#
|
||||
# Note that when used, the Ping icon will display as 'outdated server'/'outdated client'.
|
||||
# This is nothing that can be fixed or avoided and would require changes from Mojang.
|
||||
# Set the text that should be displayed instead of the default '<online>/<max>' text.
|
||||
#
|
||||
# Remove this option or set it to text: '' to not modify the player count text.
|
||||
# Using this option will show the server as "outdated" to the client (Have the ping icon crossed out).
|
||||
# This cannot be fixed and would require Mojang to change stuff.
|
||||
#
|
||||
# If not present or empty (text: ''), defaults to not modifying the text.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#text
|
||||
#
|
||||
text: ''
|
||||
#
|
||||
# Allows you to modify the max player count displayed.
|
||||
# Note that this will affect ${server playersMax} (Except for when used in conditions).
|
||||
# The extraPlayers feature allows to set a number that should be added to the current online players and then be
|
||||
# used as the "max" player count.
|
||||
#
|
||||
# Using this feature will modify the ${server playersMax} placeholder, except for usage in the condition option.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers
|
||||
#
|
||||
extraPlayers:
|
||||
#
|
||||
# Enables/Disables the extraPlayers option.
|
||||
# When enabled will the total amount of players allowed to join be modified to the current
|
||||
# number of online players + 'amount'
|
||||
# Set whether the extraPlayers feature should be enabled or not.
|
||||
# When set to true, the max players count will be modified to be the number of online players with the 'amount'
|
||||
# value added to it.
|
||||
#
|
||||
# Defaults to false when not present.
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers-enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
# Sets how much should be added/subtracted from the current number of online players
|
||||
# to then use for the max player count.
|
||||
# Set the number that should be added to the online player count to then use as the new max player count.
|
||||
#
|
||||
# Example:
|
||||
# When set to 1 while 10 players are online would the player count - if unmodified -
|
||||
# display '10/11'. When -1 is used will it display '10/9'
|
||||
# Example: Setting this to 1 will result in ${server playersMax} displaying 11 while 10 players are online,
|
||||
# 9 when 8 are online and so on.
|
||||
#
|
||||
# Defaults to 0 when not present.
|
||||
# If not present, defaults to 0.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers-amount
|
||||
#
|
||||
amount: 0
|
||||
#
|
||||
# Allows you to set the max players that could join your server.
|
||||
# Note that this option influences the '${server playersMax}' placeholder.
|
||||
# The maxPlayers feature allows to set a number to use as the max player count to display.
|
||||
#
|
||||
# The settings of this option have no effect should 'extraPlayers' be enabled
|
||||
# Using this feature will modify the ${server playersMax} placeholder, except for usage in the condition option.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers
|
||||
#
|
||||
maxPlayers:
|
||||
#
|
||||
# Enables/Disables the maxPlayers option.
|
||||
# When enabled will the total amount of players allowed to join be changed to what 'amount' is set to.
|
||||
# Set whether the maxPlayers feature should be enabled or not.
|
||||
# When set to true, the max player count will be set to the 'amount' value.
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Defaults to false when not present.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers-enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
# Sets the number to display for the max number of players allowed to join your server.
|
||||
# Set the number that should be used as the new max players count.
|
||||
#
|
||||
# Example:
|
||||
# Setting this option to 0 (Default) while 1 player is online would display '1/0'
|
||||
#
|
||||
# Defaults to 0 if not set.
|
||||
# If not present, defaults to 0.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers-amount
|
||||
#
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
Detailed object info
|
||||
-->
|
||||
{% if page.meta.constructors %}
|
||||
{{ info.info('Constructor Detail', page.meta.constructors, defaults=page.meta.defaults) }}
|
||||
{{ info.info('Constructor Detail', page.meta.constructors, 'constructor', defaults=page.meta.defaults) }}
|
||||
{% endif %}
|
||||
{% if page.meta.enums %}
|
||||
{{ info.info('Enum Constant Detail', page.meta.enums, true, defaults=page.meta.defaults) }}
|
||||
{{ info.info('Enum Constant Detail', page.meta.enums, 'enum', defaults=page.meta.defaults) }}
|
||||
{% endif %}
|
||||
{% if page.meta.methods %}
|
||||
{{ info.info('Method Detail', page.meta.methods, defaults=page.meta.defaults)}}
|
||||
{{ info.info('Method Detail', page.meta.methods, 'method', defaults=page.meta.defaults)}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -105,14 +105,14 @@
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro info(title, details, enum = false, defaults = []) -%}
|
||||
{% macro info(title, details, details_type = 'unknown', defaults = []) -%}
|
||||
<h2 id="{{ title | lower() | replace(' ', '-') | e}}">
|
||||
{{ title }}
|
||||
</h2>
|
||||
{% for detail in details %}
|
||||
<div class="api-detail">
|
||||
{% set final_name = namespace(name = "") %}
|
||||
{% if enum %}
|
||||
{% if details_type == "enum" %}
|
||||
{% set final_name.name = detail.name | upper() %}
|
||||
{% else %}
|
||||
{% set final_name.name = detail.name ~ "(" %}
|
||||
@@ -123,7 +123,7 @@
|
||||
{% if loop.revindex > 1 %}{% set final_name.name = final_name.name ~ ", " %}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if not enum %}
|
||||
{% if details_type != "enum" %}
|
||||
{% set final_name.name = final_name.name ~ ")" %}
|
||||
{% endif %}
|
||||
|
||||
@@ -140,19 +140,19 @@
|
||||
<api__static></api__static> <api__final></api__final>
|
||||
{% endif %}
|
||||
|
||||
{% if detail.type %}
|
||||
{% if detail.type and details_type == "method" %}
|
||||
{% if detail.type.link %}
|
||||
<a href="{{ detail.type.link }}" class="api-type__{{- detail.type.type | default('primitive') -}}">{{ detail.type.name | default('void') | e }}</a>
|
||||
{% else %}
|
||||
<span class="api-type__{{- detail.type.type | default('primitive') -}}">{{ detail.type.name | default('void') | e }}</span>
|
||||
{% endif %}
|
||||
{% elif defaults and defaults.type %}
|
||||
{% elif defaults and defaults.type and details_type == "method" %}
|
||||
{% if defaults.type.link %}
|
||||
<a href="{{ defaults.type.link }}" class="api-type__{{- defaults.type.type | default('primitive') -}}">{{ defaults.type.name | default('void') | e }}</a>
|
||||
{% else %}
|
||||
<span class="api-type__{{- defaults.type.type | default('primitive') -}}">{{ defaults.type.name | default('void') }}</span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% elif details_type == "method" %}
|
||||
<span class="api-type__primitive">void</span>
|
||||
{% endif %}
|
||||
<code>{{ final_name.name | e }}</code><a href="#{{ final_name.name | lower() | replace(' ', '-') | e }}" class="headerlink" title="Permanent link">¶</a>
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
<!-- Actions -->
|
||||
{% include "partials/actions.html" %}
|
||||
|
||||
{% if config.extra.github_repository %}
|
||||
<div class="admonition info">
|
||||
<p class="admonition-title">Moved</p>
|
||||
<p>
|
||||
The documenation has been moved and can now be found at <a href="https://asl.andre601.ch" target="_blank" rel="noreferral nofollow noopener"><strong>asl.andre601.ch</strong></a>.<br>
|
||||
This page in particular can be found at <a href="https://asl.andre601.ch/{{ page.url }}" target="_blank" rel="noreferral nofollow noopener"><strong>asl.andre601.ch/{{ page.url }}</strong></a>.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!--
|
||||
Hack: check whether the content contains a h1 headline. If it doesn't, the
|
||||
page title (or respectively site name) is used as the main headline.
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
nav:
|
||||
- Home: index.md
|
||||
- getting-started
|
||||
- commands
|
||||
- profiles
|
||||
- examples
|
||||
- migration
|
||||
- api
|
||||
- addons
|
||||
- PlaceholderAPI: placeholderapi
|
||||
@@ -1,2 +0,0 @@
|
||||
nav:
|
||||
- ...
|
||||
@@ -7,6 +7,14 @@ icon: octicons/log-24
|
||||
This page lists the recent changes made towards the AdvancedServerListAPI.
|
||||
They are ordered newest to oldest.
|
||||
|
||||
## v3.3.0 { #v3.3.0 }
|
||||
|
||||
### :octicons-plus-circle-24:{ .changelog-added title="Added" } Added { #v3.3.0-added }
|
||||
|
||||
- Added `PostServerListSetEvent` to the different platform APIs.
|
||||
- Fired **after** AdvancedServerList is done with handling the PingEvent.
|
||||
- Allows to retrieve the [`ProfileEntry`][profileentry] used for the PingEvent.
|
||||
|
||||
## v3.2.1 { #v3.2.1 }
|
||||
|
||||
### :octicons-pencil-24:{ .changelog-changed title="Changed" } Changed { #v3.2.1-changed }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
template: redirect.html
|
||||
|
||||
location: https://jd.andre601.ch
|
||||
location: https://jd.andre601.ch/asl-api
|
||||
|
||||
title: Javadocs
|
||||
icon: octicons/link-external-24
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
nav:
|
||||
- index.md
|
||||
- api: api
|
||||
- platform-bukkit: platform-bukkit
|
||||
- platform-bungeecord: platform-bungeecord
|
||||
- platform-velocity: platform-velocity
|
||||
@@ -1,3 +0,0 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api: ch.andre601.advancedserverlist.api
|
||||
@@ -8,7 +8,7 @@ constructors:
|
||||
- name: 'identifier'
|
||||
description: 'The identifier to use for the placeholder. Cannot be empty.'
|
||||
type: String
|
||||
attributes:
|
||||
attribute:
|
||||
- notnull
|
||||
|
||||
methods:
|
||||
@@ -28,7 +28,7 @@ methods:
|
||||
type: GenericServer
|
||||
description: 'The <a href="./../objects/genericserver/"><code>GenericServer</code> instance</a> used.'
|
||||
returns: 'Possibly-parsed or possibly-null String to replace the placeholder with.'
|
||||
attributes:
|
||||
attribute:
|
||||
- nullable
|
||||
- abstract
|
||||
type:
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api.bukkit: ch.andre601.advancedserverlist.api.bukkit
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PostServerListSetEvent'
|
||||
description: 'Constructor for creating a new PostServerListSetEvent instance.'
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
description: 'The <a href="../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/"><code>ProfileEntry</code></a> used during the PingEvent.'
|
||||
type: ProfileEntry
|
||||
attribute:
|
||||
- nullable
|
||||
|
||||
methods:
|
||||
- name: 'getHandlerList'
|
||||
description: 'Static <a href="https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/HandlerList.html" target="_blank" rel="nofollow"><code>HandlerList</code></a> getter. Required by Paper.'
|
||||
returns: 'The static <a href="https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/HandlerList.html" target="_blank" rel="nofollow"><code>HandlerList instance</code></a> of this event.'
|
||||
attributes:
|
||||
- static
|
||||
type:
|
||||
name: 'HandlerList'
|
||||
type: 'object'
|
||||
- name: 'getEntry'
|
||||
description: |
|
||||
The <a href="../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/"><code>ProfileEntry</code></a> that was used during the PingEvent handling.<br>
|
||||
<br>
|
||||
The returned value may be <code>null</code> should the PingEvent handling be cancelled at any point (i.e. due to an invalid protocol or because the <a href="../preserverlistsetevent/"><code>PreServerListSetEvent</code></a> has been cancelled).<br>
|
||||
The values within the ProfileEntry also do not represent what is actually used within the Server list itself, but only the values provided for the PingEvent handling.
|
||||
returns: 'Possibly-null ProfileEntry used for the PingEvent.'
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'ProfileEntry'
|
||||
type: 'object'
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/'
|
||||
|
||||
inherits:
|
||||
'org.bukkit.event.Event':
|
||||
link: 'https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/Event.html'
|
||||
list:
|
||||
- 'getHandlers()'
|
||||
---
|
||||
|
||||
# <api__class></api__class> PostServerListSetEvent
|
||||
|
||||
Called **after** the plugin has updated the Server List.
|
||||
|
||||
The provided [`ProfileEntry`](#getentry()) may be null due to the PingEvent handling being cancelled (i.e. due to a invalid protocol or due to the [`PreServerListSetEvent`](preserverlistsetevent.md) being cancelled).
|
||||
The entry also only represents the values used during the PingEvent, not the actual content that is being displayed.
|
||||
@@ -1,3 +0,0 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api.bungeecord: ch.andre601.advancedserverlist.api.bungeecord
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PostServerListSetEvent'
|
||||
description: 'Constructor for creating a new PostServerListSetEvent instance.'
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
description: 'The <a href="../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/"><code>ProfileEntry</code></a> used during the PingEvent.'
|
||||
type: ProfileEntry
|
||||
attribute:
|
||||
- nullable
|
||||
|
||||
methods:
|
||||
- name: 'getEntry'
|
||||
description: |
|
||||
The <a href="../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/"><code>ProfileEntry</code></a> that was used during the PingEvent handling.<br>
|
||||
<br>
|
||||
The returned value may be <code>null</code> should the PingEvent handling be cancelled at any point (i.e. due to an invalid protocol or because the <a href="../preserverlistsetevent/"><code>PreServerListSetEvent</code></a> has been cancelled).<br>
|
||||
The values within the ProfileEntry also do not represent what is actually used within the Server list itself, but only the values provided for the PingEvent handling.
|
||||
returns: 'Possibly-null ProfileEntry used for the PingEvent.'
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'ProfileEntry'
|
||||
type: 'object'
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/'
|
||||
---
|
||||
|
||||
# <api__class></api__class> PostServerListSetEvent
|
||||
|
||||
Called **after** the plugin has updated the Server List.
|
||||
|
||||
The provided [`ProfileEntry`](#getentry()) may be null due to the PingEvent handling being cancelled (i.e. due to a invalid protocol or due to the [`PreServerListSetEvent`](preserverlistsetevent.md) being cancelled).
|
||||
The entry also only represents the values used during the PingEvent, not the actual content that is being displayed.
|
||||
@@ -1,3 +0,0 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api.velocity: ch.andre601.advancedserverlist.api.velocity
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PostServerListSetEvent'
|
||||
description: 'Constructor for creating a new PostServerListSetEvent instance.'
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
description: 'The <a href="../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/"><code>ProfileEntry</code></a> used during the PingEvent.'
|
||||
type: ProfileEntry
|
||||
attribute:
|
||||
- nullable
|
||||
|
||||
methods:
|
||||
- name: 'getEntry'
|
||||
description: |
|
||||
The <a href="../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/"><code>ProfileEntry</code></a> that was used during the PingEvent handling.<br>
|
||||
<br>
|
||||
The returned value may be <code>null</code> should the PingEvent handling be cancelled at any point (i.e. due to an invalid protocol or because the <a href="../preserverlistsetevent/"><code>PreServerListSetEvent</code></a> has been cancelled).<br>
|
||||
The values within the ProfileEntry also do not represent what is actually used within the Server list itself, but only the values provided for the PingEvent handling.
|
||||
returns: 'Possibly-null ProfileEntry used for the PingEvent.'
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'ProfileEntry'
|
||||
type: 'object'
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/profiles/profileentry/'
|
||||
---
|
||||
|
||||
# <api__class></api__class> PostServerListSetEvent
|
||||
|
||||
Called **after** the plugin has updated the Server List.
|
||||
|
||||
The provided [`ProfileEntry`](#getentry()) may be null due to the PingEvent handling being cancelled (i.e. due to a invalid protocol or due to the [`PreServerListSetEvent`](preserverlistsetevent.md) being cancelled).
|
||||
The entry also only represents the values used during the PingEvent, not the actual content that is being displayed.
|
||||
@@ -1 +0,0 @@
|
||||
hide: true
|
||||
+127
-88
@@ -5,7 +5,7 @@ icon: octicons/milestone-24
|
||||
# Getting Started
|
||||
|
||||
This page will explain how to set up AdvancedServerList and make it work for your server.
|
||||
It tries to be as easy to understand as possible. But if you still have problems, consider joining the [Discord Server](https://discord.gg/6dazXp6) for help.
|
||||
It tries to be as easy to understand as possible. But if you still have problems, consider joining the [Discord Server](https://discord.gg/6dazXp6){ target="_blank" rel="nofollow" } for help.
|
||||
|
||||
## 1. Download the plugin { #download-the-plugin }
|
||||
|
||||
@@ -14,26 +14,26 @@ AdvancedServerList is available on the following places (Please note the current
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- [:simple-modrinth: **Modrinth**][modrinth]
|
||||
- [:simple-modrinth: **Modrinth**][modrinth]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
:octicons-check-24:{ style="color: var(--md-badge-fg--success);" } **Actively updated!**
|
||||
|
||||
- [:simple-codeberg: **Codeberg**][codeberg]
|
||||
- [:simple-codeberg: **Codeberg**][codeberg]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
:octicons-check-24:{ style="color: var(--md-badge-fg--success);" } **Actively updated!**
|
||||
|
||||
- [:fontawesome-solid-paper-plane: **HangarMC**][hangar]
|
||||
- [:fontawesome-solid-paper-plane: **HangarMC**][hangar]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
:octicons-check-24:{ style="color: var(--md-badge-fg--success);" } **Actively updated!**
|
||||
|
||||
|
||||
- [:simple-spigotmc: **SpigotMC**][spigot]
|
||||
- [:simple-spigotmc: **SpigotMC**][spigot]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
@@ -52,18 +52,18 @@ The plugin also supports these additional plugins. They are all optional.
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- [**PlaceholderAPI**][placeholderapi]
|
||||
- [**PlaceholderAPI**][placeholderapi]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
AdvancedServerList supports the use of placeholder from PlaceholderAPI in all its text options, excluding the `condition` option.
|
||||
AdvancedServerList supports the use of placeholder from PlaceholderAPI in all its text options, except for the `condition` option.
|
||||
|
||||
----
|
||||
|
||||
**Supported on:**
|
||||
:fontawesome-solid-paper-plane: Paper
|
||||
|
||||
- [**ViaVersion**][viaversion]
|
||||
- [**ViaVersion**][viaversion]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
@@ -74,7 +74,7 @@ The plugin also supports these additional plugins. They are all optional.
|
||||
**Supported on:**
|
||||
:fontawesome-solid-paper-plane: Paper
|
||||
|
||||
- [**PAPIProxyBridge**][papiproxybridge]
|
||||
- [**PAPIProxyBridge**][papiproxybridge]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
@@ -85,7 +85,7 @@ The plugin also supports these additional plugins. They are all optional.
|
||||
**Supported on:**
|
||||
:simple-spigotmc: BungeeCord, :fontawesome-solid-paper-plane: Velocity
|
||||
|
||||
- [**Maintenance**][maintenance]
|
||||
- [**Maintenance**][maintenance]{ target="_blank" rel="nofollow" }
|
||||
|
||||
----
|
||||
|
||||
@@ -156,167 +156,170 @@ On first creation will the folder have a `default.yml` file. This file contains
|
||||
```yaml
|
||||
#
|
||||
# Set the priority of this profile.
|
||||
# Higher number = Higher priority.
|
||||
# If there are multiple profiles (files) will they be sorted by priority, starting with highest.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#priority
|
||||
#
|
||||
priority: 0
|
||||
|
||||
#
|
||||
# Set conditions that need to me met to show this profile.
|
||||
# You can use keywords 'and' or 'or' (Or alternatively '&&' or `||`) to make more complex condition sets.
|
||||
# Set condition(s) that should return true to display this profile.
|
||||
# This allows you to create profiles to only show for specific scenarios (i.e. player is banned).
|
||||
#
|
||||
# Multiple conditions can be chaing with the keywords 'and', 'or', or their counterparts '&&' and '||'.
|
||||
#
|
||||
# No condition or an empty condition will be treated as true by default.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#condition
|
||||
#
|
||||
# condition: '${player protocol} < 759'
|
||||
condition: ''
|
||||
|
||||
#
|
||||
# Option that allows you to define multiple profiles to use.
|
||||
# Each entry supports the same options as the server list profile does. Whenever an option is not present, or set to
|
||||
# an empty value (If supported) would the option in the file be used (if present).
|
||||
# This allows you to f.e. randomize the MOTD while keeping other options the same, without copy-pasting the same options.
|
||||
# Set one or multiple profiles.
|
||||
#
|
||||
# A profile will be selected randomly.
|
||||
# A profile can contain the same options as used in the file itself, except for priority and condition.
|
||||
# If multiple entries are present, a random one will be selected. Any options set in the selected profile will override
|
||||
# any existing option in the file.
|
||||
#
|
||||
# Remove this option or set it to profiles: [] to use the global options of this file.
|
||||
# Example: The below profile configuration will randomly change the MOTD between two types, but keep the Hover text
|
||||
# the same.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#profiles:
|
||||
# - motd:
|
||||
# - '<aqua>Line 1'
|
||||
# - '<aqua>Line 2'
|
||||
# favicon: ''
|
||||
# playerCount:
|
||||
# hidePlayers: false
|
||||
# hover:
|
||||
# - '<green>Line 1'
|
||||
# - '<green>Line 2'
|
||||
# - '<green>Line 3'
|
||||
# text: ''
|
||||
# extraPlayers:
|
||||
# enabled: false
|
||||
# amount: 0
|
||||
profiles:
|
||||
- motd: ['<aqua>Line A', '<gold>Line B']
|
||||
- motd:
|
||||
- '<aqua>Line 1'
|
||||
- '<gold>Line 2'
|
||||
|
||||
#
|
||||
# Set the default (Global) MOTD used by this server list profile.
|
||||
# Supports HEX colors for 1.16+ servers including gradients using MiniMessage's <gradient:color:color> format.
|
||||
#
|
||||
# Remove this option or set it to motd: [] to not alter the MOTD.
|
||||
# Set the "Message of the day" to display.
|
||||
# This option supports RGB colors for 1.16+ Servers and clients, including gradients using MiniMessage's <gradient>
|
||||
# option.
|
||||
#
|
||||
# Only the first two lines will be considered and any additional one is ignored.
|
||||
#
|
||||
# When not present or empty (motd: []), no MOTD will be set.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#motd
|
||||
#
|
||||
motd:
|
||||
- '<grey>Line 1'
|
||||
- '<grey>Line 2'
|
||||
- '<grey>First Line'
|
||||
- '<grey>Second Line'
|
||||
|
||||
#
|
||||
# Allows you to set a global (Default) favicon for this server list profile.
|
||||
# You can use one of three possible options:
|
||||
# 1. A file name matching a PNG file located in the 'favicons' folder (Needs to end with .png)
|
||||
# 2. A URL pointing to a valid Image
|
||||
# 3. ${player name} to display the player's head as favicon. Uses https://mc-heads.net for this
|
||||
# Set the Favicon (image on the left of a server entry) to display.
|
||||
# This option supports three types of inputs:
|
||||
#
|
||||
# Remove this option or set to favicon: '' to not replace the Favicon.
|
||||
# 1. Name, including .png extension, pointing to an image located in the plugin's favicons folder.
|
||||
# 2. URL pointing to an image.*
|
||||
# 3. Player name, UUID or placeholders returning one of these.*
|
||||
# https://mc-heads.net will be used to retrieve an image of the provided name/UUID.
|
||||
#
|
||||
# * These images are loaded asynchronously, meaning they may not yet be "ready" when AdvancedServerList is done with
|
||||
# the event, requiring a refresh of the server list by the player to have it shown.
|
||||
#
|
||||
# Any images above or below 64x64 pixels will be automatically resized to these dimensions.
|
||||
#
|
||||
# If not present or empty (favicon: ''), defaults to not modifying the favicon.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#favicon
|
||||
#
|
||||
favicon: ''
|
||||
|
||||
#
|
||||
# Contains various options to manipulate the player count (Text displaying online and max players allowed).
|
||||
# Contains options for modifying the player count (Text displaying <online>/<max>).
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#playercount
|
||||
#
|
||||
playerCount:
|
||||
#
|
||||
# Whether AdvancedServerList should hide the player count or not.
|
||||
# When set to true will the player count display '???' instead of <online>/<max>
|
||||
# Set whether the Player count should be hidden.
|
||||
# When set to true, the player count will be displayed as '???' instead of the usual '<online>/<max>' and all other
|
||||
# playerCount options, except for extraPlayers and maxPlayers, will be ignored.
|
||||
#
|
||||
# Note that when this is enabled will all other options, except for 'extraPlayers', be ignored.
|
||||
#
|
||||
# Defaults to false when not present.
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hideplayers
|
||||
#
|
||||
hidePlayers: false
|
||||
#
|
||||
# Sets the text displayed when hovering over the player count.
|
||||
# Set the lines shown when the player hovers over the player count.
|
||||
# Unlike the MOTD option does this one only support basic color and formatting codes. Any RGB colors will be
|
||||
# downsampled to the nearest matching color.
|
||||
#
|
||||
# Remove this option or set it to hover: [] to not modify the player samples on the player count.
|
||||
# If not present or empty (hover: []), defaults to not modifying the hover.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#hover
|
||||
#
|
||||
hover:
|
||||
- '<grey>Line 1'
|
||||
- '<grey>Line 2'
|
||||
- '<grey>Line 3'
|
||||
- '<aqua>Line 1'
|
||||
- '<yellow>Line 2'
|
||||
- '<green>Line 3'
|
||||
#
|
||||
# Modifies the text that usually displays '<online>/<max>'
|
||||
#
|
||||
# Note that when used, the Ping icon will display as 'outdated server'/'outdated client'.
|
||||
# This is nothing that can be fixed or avoided and would require changes from Mojang.
|
||||
# Set the text that should be displayed instead of the default '<online>/<max>' text.
|
||||
#
|
||||
# Remove this option or set it to text: '' to not modify the player count text.
|
||||
# Using this option will show the server as "outdated" to the client (Have the ping icon crossed out).
|
||||
# This cannot be fixed and would require Mojang to change stuff.
|
||||
#
|
||||
# If not present or empty (text: ''), defaults to not modifying the text.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#text
|
||||
#
|
||||
text: ''
|
||||
#
|
||||
# Allows you to modify the max player count displayed.
|
||||
# Note that this will affect ${server playersMax} (Except for when used in conditions).
|
||||
# The extraPlayers feature allows to set a number that should be added to the current online players and then be
|
||||
# used as the "max" player count.
|
||||
#
|
||||
# Using this feature will modify the ${server playersMax} placeholder, except for usage in the condition option.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers
|
||||
#
|
||||
extraPlayers:
|
||||
#
|
||||
# Enables/Disables the extraPlayers option.
|
||||
# When enabled will the total amount of players allowed to join be modified to the current
|
||||
# number of online players + 'amount'
|
||||
# Set whether the extraPlayers feature should be enabled or not.
|
||||
# When set to true, the max players count will be modified to be the number of online players with the 'amount'
|
||||
# value added to it.
|
||||
#
|
||||
# Defaults to false when not present.
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers-enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
# Sets how much should be added/subtracted from the current number of online players
|
||||
# to then use for the max player count.
|
||||
# Set the number that should be added to the online player count to then use as the new max player count.
|
||||
#
|
||||
# Example:
|
||||
# When set to 1 while 10 players are online would the player count - if unmodified -
|
||||
# display '10/11'. When -1 is used will it display '10/9'
|
||||
# Example: Setting this to 1 will result in ${server playersMax} displaying 11 while 10 players are online,
|
||||
# 9 when 8 are online and so on.
|
||||
#
|
||||
# Defaults to 0 when not present.
|
||||
# If not present, defaults to 0.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#extraplayers-amount
|
||||
#
|
||||
amount: 0
|
||||
#
|
||||
# Allows you to set the max players that could join your server.
|
||||
# Note that this option influences the '${server playersMax}' placeholder.
|
||||
# The maxPlayers feature allows to set a number to use as the max player count to display.
|
||||
#
|
||||
# The settings of this option have no effect should 'extraPlayers' be enabled
|
||||
# Using this feature will modify the ${server playersMax} placeholder, except for usage in the condition option.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers
|
||||
#
|
||||
maxPlayers:
|
||||
#
|
||||
# Enables/Disables the maxPlayers option.
|
||||
# When enabled will the total amount of players allowed to join be changed to what 'amount' is set to.
|
||||
# Set whether the maxPlayers feature should be enabled or not.
|
||||
# When set to true, the max player count will be set to the 'amount' value.
|
||||
#
|
||||
# If not present, defaults to false.
|
||||
#
|
||||
# Defaults to false when not present.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers-enabled
|
||||
#
|
||||
enabled: false
|
||||
#
|
||||
# Sets the number to display for the max number of players allowed to join your server.
|
||||
# Set the number that should be used as the new max players count.
|
||||
#
|
||||
# Example:
|
||||
# Setting this option to 0 (Default) while 1 player is online would display '1/0'
|
||||
#
|
||||
# Defaults to 0 if not set.
|
||||
# If not present, defaults to 0.
|
||||
#
|
||||
# Read more: https://asl.andre601.ch/profiles/#maxplayers-amount
|
||||
#
|
||||
@@ -395,13 +398,49 @@ debug: false
|
||||
#
|
||||
faviconCacheTime: 1
|
||||
|
||||
#
|
||||
# List of options that should be disabled while the Maintenance Mode of the plugin Maintenance is active.
|
||||
# Any option not listed here will NOT be disabled, meaning AdvancedServerList will continue to handle it.
|
||||
#
|
||||
# Each option defaults to true when not present, disabling said option while Maintenance is active.
|
||||
#
|
||||
disableDuringMaintenance:
|
||||
#
|
||||
# When true (Default), disables handling of MOTD while Maintenance is enabled.
|
||||
#
|
||||
motd: true
|
||||
#
|
||||
# When true (Default), disables handling of Favicon while Maintenance is enabled.
|
||||
#
|
||||
favicon: true
|
||||
#
|
||||
# When true (Default), disables hiding of player count while Maintenance is enabled.
|
||||
#
|
||||
hidePlayers: true
|
||||
#
|
||||
# When true (Default), disables handling of player count text while Maintenance is enabled.
|
||||
#
|
||||
playerCountText: true
|
||||
#
|
||||
# When true (Default), disables handling of player count hover while Maintenance is enabled.
|
||||
#
|
||||
playerCountHover: true
|
||||
#
|
||||
# When true (Default), disables use of extra players feature while Maintenance is enabled.
|
||||
#
|
||||
extraPlayers: true
|
||||
#
|
||||
# When true (Default), disables use of max players feature while Maintenance is enabled.
|
||||
#
|
||||
maxPlayers: true
|
||||
|
||||
#
|
||||
# DO NOT EDIT!
|
||||
#
|
||||
# This is used internally to determine if the config needs to be migrated.
|
||||
# Changing or even removing this option could result in your config being broken.
|
||||
#
|
||||
config-version: 4
|
||||
config-version: 5
|
||||
```
|
||||
///
|
||||
|
||||
|
||||
+55
-34
@@ -12,13 +12,16 @@ If you're new to the plugin is it recommended to check out the [Profiles page](p
|
||||
## Downloads
|
||||
|
||||
[![modrinth-img]{ width="260" loading="lazy" }][modrinth-download]{ target="_blank" rel="noreferrer nofollow noopener" }
|
||||
[![hangar-img]{ width="260" loading="lazy" }][hangar-download]{ target="_blank" rel="noreferrer nofollow noopener" }
|
||||
[![hangar-img]{ width="260" loading="lazy" }][hangar-download]{ target="_blank" rel="noreferrer nofollow noopener" }
|
||||
[![codeberg-img]{ width="260" loading="lazy" }][codeberg-download]{ target="_blank" rel="noreferrer nofollow noopener" }
|
||||
|
||||
[modrinth-img]: https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/modrinth_vector.svg "Available on Modrinth"
|
||||
[hangar-img]: https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/hangar_vector.svg "Available on Hangar"
|
||||
[codeberg-img]: https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/codeberg_vector.svg "Available on Codeberg"
|
||||
|
||||
[modrinth-download]: https://modrinth.com/plugin/advancedserverlist
|
||||
[hangar-download]: https://hangar.papermc.io/Andre_601/AdvancedServerList
|
||||
[codeberg-download]: https://codeberg.org/Andre601/AdvancedServerList
|
||||
|
||||
## Platforms
|
||||
|
||||
@@ -38,38 +41,56 @@ AdvancedServerList supports the following platforms:
|
||||
[paper]: https://papermc.io
|
||||
[velocity]: https://velocitypowered.com
|
||||
|
||||
## Dependencies
|
||||
|
||||
/// info
|
||||
All listed dependencies are optional.
|
||||
///
|
||||
|
||||
| Dependency | Platforms |
|
||||
|-------------------------------------------------------------------------|----------------------|
|
||||
| [PlaceholderAPI]{ target="_blank" rel="noreferrer nofollow noopener" } | Paper |
|
||||
| [ViaVersion]{ target="_blank" rel="noreferrer nofollow noopener" } | Paper |
|
||||
| [PAPIProxyBridge]{ target="_blank" rel="noreferrer nofollow noopener" } | BungeeCord, Velocity |
|
||||
| [Maintenance]{ target="_blank" rel="noreferrer nofollow noopener" } | All |
|
||||
|
||||
[placeholderapi]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
|
||||
[viaversion]: https://hangar.papermc.io/ViaVersion/ViaVersion
|
||||
[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
|
||||
[maintenance]: https://hangar.papermc.io/kennytv/Maintenance
|
||||
|
||||
## Pages
|
||||
|
||||
- [Getting started](getting-started/index.md)
|
||||
- [Commands](commands/index.md)
|
||||
- [Profiles](profiles/index.md)
|
||||
- [Formatting](profiles/formatting.md)
|
||||
- [Placeholders](profiles/placeholders.md)
|
||||
- [Examples](examples/index.md)
|
||||
- [Migration](migration/index.md)
|
||||
- [v1.5.3 to v1.6.0](migration/v1_5_3-to-v1_6_0.md)
|
||||
- [v1.9.0 to v1.10.0](migration/v1_9_0-to-v1_10_0.md)
|
||||
- [API](api/index.md)
|
||||
- [Changelog](api/changelog.md)
|
||||
- [Javadocs](api/javadocs.md) (External site)
|
||||
- [Source Code](api/source.md) (External site)
|
||||
- [Reference](api/reference/index.md)
|
||||
- [PlaceholderAPI](placeholderapi/index.md)
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- [:octicons-milestone-24: **Getting Started**](getting-started/index.md)
|
||||
|
||||
----
|
||||
|
||||
A simple guide on how to get started with AdvancedServerList.
|
||||
|
||||
- [:octicons-rel-file-path-24: **Commands**](commands/index.md)
|
||||
|
||||
----
|
||||
|
||||
A list of all available commands in AdvancedServerList.
|
||||
|
||||
- [:octicons-note-24: **Profiles**](profiles/index.md)
|
||||
|
||||
----
|
||||
|
||||
Pages containing information about the Server List Profile System and all its available options.
|
||||
|
||||
- [:octicons-list-unordered-24: **Examples**](examples/index.md)
|
||||
|
||||
----
|
||||
|
||||
Collection of various profile examples to use for different situations.
|
||||
|
||||
- [:octicons-file-directory-symlink-24: **Migration**](migration/index.md)
|
||||
|
||||
----
|
||||
|
||||
Pages explaining how to migrate from one version of the plugin to another.
|
||||
|
||||
- [:octicons-command-palette-24: **API**](api/index.md)
|
||||
|
||||
----
|
||||
|
||||
Pages all about the API of AdvancedServerList.
|
||||
|
||||
- [:octicons-plus-circle-24: **Addons**](addons/index.md)
|
||||
|
||||
----
|
||||
|
||||
Pages listing 1st-party and 3rd-party add-ons for AdvancedServerList.
|
||||
|
||||
- [:material-percent: **PlaceholderAPI**](placeholderapi/index.md)
|
||||
|
||||
----
|
||||
|
||||
Information about available placeholders to use in PlaceholderAPI and how to use placeholders from other plugins in AdvancedServerList using PlaceholderAPI.
|
||||
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
nav:
|
||||
- index.md
|
||||
- v3_8_0-to-v3_9_0.md
|
||||
- v3_7_0-to-v3_8_0.md
|
||||
- pre-v3_7_0-to-v3_7_0.md
|
||||
- v1_9_0-to-v1_10_0.md
|
||||
- v1_5_3-to-v1_6_0.md
|
||||
@@ -12,6 +12,12 @@ Note that these pages only cover server list profile files. The config.yml is au
|
||||
|
||||
<div class="grid cards" markdown>
|
||||
|
||||
- [**v3.8.0 to v3.9.0**](v3_8_0-to-v3_9_0.md)
|
||||
|
||||
----
|
||||
|
||||
Migrate from version 3.8.0 to 3.9.0.
|
||||
|
||||
- [**v3.7.0 to v3.8.0**](v3_7_0-to-v3_8_0.md)
|
||||
|
||||
----
|
||||
|
||||
@@ -49,8 +49,12 @@ priority: 0
|
||||
-conditions:
|
||||
- - '${player protocol} >= 763'
|
||||
- - '${player isWhitelisted} == true'
|
||||
+# The text can all be in one line. This is only for better readability.
|
||||
+condition: |
|
||||
+ ${player protocol} >= 763 and
|
||||
+ ${player isWhitelisted}
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
```
|
||||
///
|
||||
@@ -18,7 +18,7 @@ Here is a before and after example to help visualize the change:
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
conditions: '${server host} <- "survival"'
|
||||
condition: '${server host} <- "survival"'
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
|
||||
@@ -18,7 +18,7 @@ Here is a before and after example to help visualize the change:
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
conditions: '${player name} ~= "Someone"'
|
||||
condition: '${player name} ~= "Someone"'
|
||||
|
||||
motd:
|
||||
- 'Welcome ${player name}!'
|
||||
|
||||
+74
-4
@@ -57,7 +57,6 @@ extra_javascript:
|
||||
- assets/js/repo-stats.js
|
||||
|
||||
extra:
|
||||
github_repository: !ENV [GITHUB_REPO_INSTANCE, False]
|
||||
social:
|
||||
- icon: 'simple/codeberg'
|
||||
link: 'https://codeberg.org/Andre601/AdvancedServerList'
|
||||
@@ -69,8 +68,6 @@ extra:
|
||||
plugins:
|
||||
- search
|
||||
- glightbox
|
||||
- awesome-pages:
|
||||
filename: .pages.yml
|
||||
- pagenav-generator
|
||||
|
||||
markdown_extensions:
|
||||
@@ -107,4 +104,77 @@ markdown_extensions:
|
||||
|
||||
hooks:
|
||||
- docs/.hooks/badges.py
|
||||
- docs/.hooks/replacer.py
|
||||
- docs/.hooks/replacer.py
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Getting Started: getting-started/index.md
|
||||
- Commands: commands/index.md
|
||||
- Profiles:
|
||||
- profiles/index.md
|
||||
- Expressions: profiles/expressions.md
|
||||
- Formatting: profiles/formatting.md
|
||||
- Placeholders: profiles/placeholders.md
|
||||
- Examples: examples/index.md
|
||||
- Migration:
|
||||
- migration/index.md
|
||||
- v3.8.0 to v3.9.0: migration/v3_8_0-to-v3_9_0.md
|
||||
- v3.7.0 to v3.8.0: migration/v3_7_0-to-v3_8_0.md
|
||||
- '< v3.7.0 to v3.7.0': migration/pre-v3_7_0-to-v3_7_0.md
|
||||
- v1.9.0 to v1.10.0: migration/v1_9_0-to-v1_10_0.md
|
||||
- v1.5.3 to v1.6.0: migration/v1_5_3-to-v1_6_0.md
|
||||
- API:
|
||||
- api/index.md
|
||||
- Changelog: api/changelog.md
|
||||
- Javadocs: api/javadocs.md
|
||||
- Source Code: api/source.md
|
||||
- Reference:
|
||||
- api/reference/index.md
|
||||
- api:
|
||||
- api/reference/api/index.md
|
||||
- ch.andre601.advancedserverlist.api:
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/advancedserverlistapi.md
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/placeholderprovider.md
|
||||
- events:
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md
|
||||
- exceptions:
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/exceptions/invalidplaceholderproviderexception.md
|
||||
- objects:
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/objects/genericplayer.md
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/objects/genericserver.md
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/objects/nullbool.md
|
||||
- profiles:
|
||||
- '<api__record></api__record> ProfileEntry':
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/index.md
|
||||
- api/reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/builder.md
|
||||
- platform-bukkit:
|
||||
- api/reference/platform-bukkit/index.md
|
||||
- ch.andre601.advancedserverlist.api.bukkit:
|
||||
- events:
|
||||
- api/reference/platform-bukkit/ch.andre601.advancedserverlist.api.bukkit/events/postserverlistsetevent.md
|
||||
- api/reference/platform-bukkit/ch.andre601.advancedserverlist.api.bukkit/events/preserverlistsetevent.md
|
||||
- objects:
|
||||
- api/reference/platform-bukkit/ch.andre601.advancedserverlist.api.bukkit/objects/bukkitplayer.md
|
||||
- api/reference/platform-bukkit/ch.andre601.advancedserverlist.api.bukkit/objects/bukkitserver.md
|
||||
- platform-bungeecord:
|
||||
- api/reference/platform-bungeecord/index.md
|
||||
- ch.andre601.advancedserverlist.api.bungeecord:
|
||||
- events:
|
||||
- api/reference/platform-bungeecord/ch.andre601.advancedserverlist.api.bungeecord/events/postserverlistsetevent.md
|
||||
- api/reference/platform-bungeecord/ch.andre601.advancedserverlist.api.bungeecord/events/preserverlistsetevent.md
|
||||
- objects:
|
||||
- api/reference/platform-bungeecord/ch.andre601.advancedserverlist.api.bungeecord/objects/bungeeplayer.md
|
||||
- api/reference/platform-bungeecord/ch.andre601.advancedserverlist.api.bungeecord/objects/bungeeproxy.md
|
||||
- platform-velocity:
|
||||
- api/reference/platform-velocity/index.md
|
||||
- ch.andre601.advancedserverlist.api.velocity:
|
||||
- events:
|
||||
- api/reference/platform-velocity/ch.andre601.advancedserverlist.api.velocity/events/postserverlistsetevent.md
|
||||
- api/reference/platform-velocity/ch.andre601.advancedserverlist.api.velocity/events/preserverlistsetevent.md
|
||||
- objects:
|
||||
- api/reference/platform-velocity/ch.andre601.advancedserverlist.api.velocity/objects/velocityplayer.md
|
||||
- api/reference/platform-velocity/ch.andre601.advancedserverlist.api.velocity/objects/velocityproxy.md
|
||||
- Addons:
|
||||
- addons/index.md
|
||||
- BanPlugins: addons/banplugins.md
|
||||
- PlaceholderAPI: placeholderapi/index.md
|
||||
+1
-1
@@ -109,7 +109,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
</configuration>
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.paper.listeners;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.bukkit.events.PostServerListSetEvent;
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
|
||||
import ch.andre601.advancedserverlist.paper.PaperCore;
|
||||
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class PingEvent implements Listener{
|
||||
@@ -40,8 +43,10 @@ public class PingEvent implements Listener{
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST) // Maintenance plugin has HIGHEST priority, so ASL needs too.
|
||||
public void onPaperServerListPing(PaperServerListPingEvent event){
|
||||
PingEventHandler.handleEvent(new PaperEventWrapper(plugin, event));
|
||||
ProfileEntry entry = PingEventHandler.handleEvent(new PaperEventWrapper(plugin, event));
|
||||
|
||||
plugin.getServer().getPluginManager().callEvent(new PostServerListSetEvent(entry));
|
||||
}
|
||||
}
|
||||
@@ -37,10 +37,10 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<plugin.version>4.4.0</plugin.version>
|
||||
<plugin.version>4.6.1</plugin.version>
|
||||
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
|
||||
|
||||
<api.version>3.2.1</api.version>
|
||||
<api.version>3.3.0</api.version>
|
||||
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
mkdocs-material==9.5.13
|
||||
mkdocs-material==9.5.14
|
||||
mkdocs-glightbox==0.3.7
|
||||
mkdocs-awesome-pages-plugin==2.9.2
|
||||
git+https://github.com/Andre601/mkdocs-pagenav-generator
|
||||
+1
-1
@@ -109,7 +109,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<version>3.13.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
+6
-2
@@ -25,6 +25,8 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.velocity.listeners;
|
||||
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.api.velocity.events.PostServerListSetEvent;
|
||||
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
|
||||
import ch.andre601.advancedserverlist.velocity.VelocityCore;
|
||||
import com.velocitypowered.api.event.PostOrder;
|
||||
@@ -40,8 +42,10 @@ public class PingEvent{
|
||||
plugin.getProxy().getEventManager().register(plugin, this);
|
||||
}
|
||||
|
||||
@Subscribe(order = PostOrder.EARLY)
|
||||
@Subscribe(order = PostOrder.LAST) // Maintenance has LAST priority, so ASL needs it too.
|
||||
public void onProxyPing(ProxyPingEvent event){
|
||||
PingEventHandler.handleEvent(new VelocityEventWrapper(plugin, event));
|
||||
ProfileEntry entry = PingEventHandler.handleEvent(new VelocityEventWrapper(plugin, event));
|
||||
|
||||
plugin.getProxy().getEventManager().fire(new PostServerListSetEvent(entry));
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
</configuration>
|
||||
|
||||
+11
-5
@@ -35,7 +35,7 @@ public enum PlatformInfo{
|
||||
"paper/target/AdvancedServerList-Paper-{{version}}.jar",
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar"
|
||||
),
|
||||
"paper", "folia"
|
||||
List.of("Paper", "Folia")
|
||||
),
|
||||
BUNGEECORD(
|
||||
"bungeecord",
|
||||
@@ -43,7 +43,7 @@ public enum PlatformInfo{
|
||||
"bungeecord/target/AdvancedServerList-BungeeCord-{{version}}.jar",
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar"
|
||||
),
|
||||
"bungeecord", "waterfall"
|
||||
List.of("BungeeCord", "Waterfall")
|
||||
),
|
||||
VELOCITY(
|
||||
"velocity",
|
||||
@@ -51,17 +51,19 @@ public enum PlatformInfo{
|
||||
"velocity/target/AdvancedServerList-Velocity-{{version}}.jar",
|
||||
"addons/banplugins/target/AdvancedServerList-BanPlugins-Addon-{{version}}.jar"
|
||||
),
|
||||
"velocity"
|
||||
List.of("Velocity")
|
||||
);
|
||||
|
||||
private final String platform;
|
||||
private final List<String> filePaths;
|
||||
private final List<String> loaders;
|
||||
private final List<String> platformNames;
|
||||
|
||||
PlatformInfo(String platform, List<String> filePaths, String... loaders){
|
||||
PlatformInfo(String platform, List<String> filePaths, List<String> loaders){
|
||||
this.platform = platform;
|
||||
this.filePaths = filePaths;
|
||||
this.loaders = List.of(loaders);
|
||||
this.loaders = loaders.stream().map(String::toLowerCase).toList();
|
||||
this.platformNames = loaders;
|
||||
}
|
||||
|
||||
public String getPlatform(){
|
||||
@@ -75,4 +77,8 @@ public enum PlatformInfo{
|
||||
public List<String> getLoaders(){
|
||||
return loaders;
|
||||
}
|
||||
|
||||
public List<String> getPlatformNames(){
|
||||
return platformNames;
|
||||
}
|
||||
}
|
||||
+9
-5
@@ -25,18 +25,22 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModrinthRelease{
|
||||
public class ReleaseHolder{
|
||||
|
||||
Map<String, String> releases = new HashMap<>();
|
||||
private final List<ReleaseInfo> releases = new ArrayList<>();
|
||||
|
||||
public void addRelease(String platform, String id){
|
||||
releases.put(platform, id);
|
||||
public void addRelease(String type, String platform, String url){
|
||||
releases.add(new ReleaseInfo(type, platform, url));
|
||||
}
|
||||
|
||||
public Map<String, String> getReleases(){
|
||||
public List<ReleaseInfo> getReleases(){
|
||||
return releases;
|
||||
}
|
||||
|
||||
record ReleaseInfo(String type, String platform, String url){}
|
||||
}
|
||||
+32
-21
@@ -40,8 +40,8 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class VersionUploader{
|
||||
@@ -53,7 +53,7 @@ public class VersionUploader{
|
||||
|
||||
if(args.length == 0){
|
||||
LOGGER.warn("MISSING ARGUMENT!");
|
||||
LOGGER.warn("COMMAND USAGE: java -jar VersionUploader.jar <--all|--modrinth|--hangar> [--dryrun]");
|
||||
LOGGER.warn("COMMAND USAGE: java -jar VersionUploader.jar [--dryrun] --all | --modrinth | --hangar");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
@@ -72,22 +72,19 @@ public class VersionUploader{
|
||||
}
|
||||
|
||||
CompletableFuture<?> future;
|
||||
ModrinthRelease modrinthRelease = null;
|
||||
ReleaseHolder releaseHolder = new ReleaseHolder();
|
||||
switch(args[0].toLowerCase(Locale.ROOT)){
|
||||
case "--modrinth" -> {
|
||||
modrinthRelease = new ModrinthRelease();
|
||||
future = new ModrinthVersionUploader().performUpload(release, modrinthRelease, dryrun);
|
||||
}
|
||||
case "--hangar" -> future = new HangarVersionUploader().performUpload(release, dryrun);
|
||||
case "--modrinth" -> future = new ModrinthVersionUploader().performUpload(release, releaseHolder, dryrun);
|
||||
case "--hangar" -> future = new HangarVersionUploader().performUpload(release, releaseHolder, dryrun);
|
||||
case "--all" -> {
|
||||
modrinthRelease = new ModrinthRelease();
|
||||
future = CompletableFuture.allOf(
|
||||
new ModrinthVersionUploader().performUpload(release, modrinthRelease, dryrun),
|
||||
new HangarVersionUploader().performUpload(release, dryrun)
|
||||
new ModrinthVersionUploader().performUpload(release, releaseHolder, dryrun),
|
||||
new HangarVersionUploader().performUpload(release, releaseHolder, dryrun)
|
||||
);
|
||||
}
|
||||
default -> {
|
||||
LOGGER.warn("Unknown argument '{}' provided. Supported are '--all', '--modrinth' or '--hangar'", args[0]);
|
||||
LOGGER.warn("Unknown argument '{}' provided.", args[0]);
|
||||
LOGGER.warn("COMMAND USAGE: java -jar VersionUploader.jar [--dryrun] --all | --modrinth | --hangar");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
@@ -111,8 +108,8 @@ public class VersionUploader{
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
if(modrinthRelease == null || modrinthRelease.getReleases().isEmpty()){
|
||||
LOGGER.warn("No Modrinth release info on Discord to share... Skipping.");
|
||||
if(releaseHolder.getReleases().isEmpty()){
|
||||
LOGGER.warn("No releases to share on Discord... Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,17 +121,31 @@ public class VersionUploader{
|
||||
|
||||
WebhookEmbedBuilder builder = new WebhookEmbedBuilder()
|
||||
.setTitle(new WebhookEmbed.EmbedTitle("New Release", null))
|
||||
.setDescription("A new release of AdvancedServerList is available on Modrinth for you to download!")
|
||||
.setDescription("A new release of AdvancedServerList is available on Modrinth and Hangar for you to download!")
|
||||
.setColor(0x1BD96A);
|
||||
|
||||
for(Map.Entry<String, String> entry : modrinthRelease.getReleases().entrySet()){
|
||||
builder.addField(new WebhookEmbed.EmbedField(
|
||||
false,
|
||||
entry.getKey(),
|
||||
"https://modrinth.com/plugin/advancedserverlist/version/" + entry.getValue()
|
||||
));
|
||||
StringJoiner modrinthText = new StringJoiner("\n");
|
||||
String hangarText = null;
|
||||
for(ReleaseHolder.ReleaseInfo info : releaseHolder.getReleases()){
|
||||
String text = String.format("[%s](%s)", info.platform(), info.url());
|
||||
|
||||
if(info.type().equalsIgnoreCase("modrinth")){
|
||||
modrinthText.add(text);
|
||||
}else{
|
||||
hangarText = text;
|
||||
}
|
||||
}
|
||||
|
||||
builder.addField(new WebhookEmbed.EmbedField(
|
||||
true,
|
||||
"Modrinth:",
|
||||
modrinthText.toString()
|
||||
)).addField(new WebhookEmbed.EmbedField(
|
||||
true,
|
||||
"Hangar:",
|
||||
hangarText == null ? "No download available" : hangarText
|
||||
));
|
||||
|
||||
try(WebhookClient client = new WebhookClientBuilder(webhookUrl).build()){
|
||||
CompletableFuture<ReadonlyMessage> webhookFuture = client.send(builder.build()).whenComplete((readonlyMessage, throwable) -> {
|
||||
if(throwable != null){
|
||||
|
||||
+21
-4
@@ -26,6 +26,7 @@
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar;
|
||||
|
||||
import ch.andre601.advancedserverlist.versionuploader.PlatformInfo;
|
||||
import ch.andre601.advancedserverlist.versionuploader.ReleaseHolder;
|
||||
import ch.andre601.advancedserverlist.versionuploader.VersionUploader;
|
||||
import ch.andre601.advancedserverlist.versionuploader.data.CodebergRelease;
|
||||
import ch.andre601.advancedserverlist.versionuploader.hangar.version.Dependency;
|
||||
@@ -35,6 +36,7 @@ import ch.andre601.advancedserverlist.versionuploader.hangar.version.Version;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import org.apache.hc.client5.http.classic.HttpClient;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
||||
import org.apache.hc.client5.http.entity.mime.FileBody;
|
||||
@@ -72,7 +74,7 @@ public class HangarVersionUploader{
|
||||
this.apiKey = System.getenv("HANGAR_API_TOKEN");
|
||||
}
|
||||
|
||||
public CompletableFuture<?> performUpload(CodebergRelease release, boolean dryrun){
|
||||
public CompletableFuture<?> performUpload(CodebergRelease release, ReleaseHolder releaseInfo, boolean dryrun){
|
||||
LOGGER.info("Starting HangarVersionUploader...");
|
||||
|
||||
if((apiKey == null || apiKey.isEmpty()) && !dryrun){
|
||||
@@ -145,14 +147,14 @@ public class HangarVersionUploader{
|
||||
|
||||
try{
|
||||
HttpClient client = HttpClients.createDefault();
|
||||
return uploadVersion(client, versionUpload, filePaths);
|
||||
return uploadVersion(client, versionUpload, filePaths, releaseInfo);
|
||||
}catch(ParseException | IOException ex){
|
||||
LOGGER.warn("Encountered an exception while uploading to Hangar!", ex);
|
||||
return CompletableFuture.completedFuture(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private CompletableFuture<?> uploadVersion(HttpClient client, Version versionUpload, List<Path> filePaths) throws IOException, ParseException{
|
||||
private CompletableFuture<?> uploadVersion(HttpClient client, Version versionUpload, List<Path> filePaths, ReleaseHolder releaseInfo) throws IOException, ParseException{
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addPart("versionUpload", new StringBody(GSON.toJson(versionUpload), ContentType.APPLICATION_JSON));
|
||||
@@ -174,7 +176,22 @@ public class HangarVersionUploader{
|
||||
));
|
||||
}
|
||||
LOGGER.info("Successfully uploaded new release on Hangar!");
|
||||
return true;
|
||||
|
||||
String body = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
try{
|
||||
JsonObject json = GSON.fromJson(body, JsonObject.class);
|
||||
if(json == null)
|
||||
return true;
|
||||
|
||||
releaseInfo.addRelease(
|
||||
"hangar",
|
||||
"Paper, Waterfall, Velocity",
|
||||
json.getAsJsonPrimitive("url").getAsString()
|
||||
);
|
||||
return true;
|
||||
}catch(JsonSyntaxException ex){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}catch(IOException ex){
|
||||
LOGGER.warn("Encountered IOException while perfoming upload.", ex);
|
||||
|
||||
+20
-12
@@ -25,7 +25,7 @@
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.modrinth;
|
||||
|
||||
import ch.andre601.advancedserverlist.versionuploader.ModrinthRelease;
|
||||
import ch.andre601.advancedserverlist.versionuploader.ReleaseHolder;
|
||||
import ch.andre601.advancedserverlist.versionuploader.PlatformInfo;
|
||||
import ch.andre601.advancedserverlist.versionuploader.VersionUploader;
|
||||
import ch.andre601.advancedserverlist.versionuploader.data.CodebergRelease;
|
||||
@@ -45,7 +45,9 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModrinthVersionUploader{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ModrinthVersionUploader.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(ModrinthVersionUploader.class);
|
||||
|
||||
private final String versionUrl = "https://modrinth.com/plugin/advancedserverlist/version/";
|
||||
|
||||
private final List<PlatformInfo> platforms = List.of(
|
||||
PlatformInfo.PAPER,
|
||||
@@ -62,11 +64,11 @@ public class ModrinthVersionUploader{
|
||||
this.api = createClient();
|
||||
}
|
||||
|
||||
public CompletableFuture<?> performUpload(CodebergRelease release, ModrinthRelease modrinthRelease, boolean dryrun){
|
||||
LOGGER.info("Starting ModrinthVersionUploader...");
|
||||
public CompletableFuture<?> performUpload(CodebergRelease release, ReleaseHolder releaseHolder, boolean dryrun){
|
||||
logger.info("Starting ModrinthVersionUploader...");
|
||||
|
||||
if(api == null){
|
||||
LOGGER.warn("Cannot create updates on Modrinth. API instance is null.");
|
||||
logger.warn("Cannot create updates on Modrinth. API instance is null.");
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
@@ -74,7 +76,7 @@ public class ModrinthVersionUploader{
|
||||
final String pluginVersion = VersionUploader.retrieveVersion();
|
||||
|
||||
if(pluginVersion == null || pluginVersion.isEmpty()){
|
||||
LOGGER.warn("Retrieved null/empty plugin version.");
|
||||
logger.warn("Retrieved null/empty plugin version.");
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
@@ -97,7 +99,7 @@ public class ModrinthVersionUploader{
|
||||
);
|
||||
|
||||
for(int i = 0; i < platforms.size(); i++){
|
||||
LOGGER.info("Creating release for platform {}...", platforms.get(i).getPlatform());
|
||||
logger.info("Creating release for platform {}...", platforms.get(i).getPlatform());
|
||||
|
||||
List<File> files = platforms.get(i).getFilePaths().stream()
|
||||
.map(path -> new File(path.replace("{{version}}", pluginVersion)))
|
||||
@@ -125,7 +127,7 @@ public class ModrinthVersionUploader{
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(builder.build());
|
||||
|
||||
LOGGER.info("JSON Data to send: {}", json);
|
||||
logger.info("JSON Data to send: {}", json);
|
||||
|
||||
futures[i] = CompletableFuture.completedFuture(json);
|
||||
continue;
|
||||
@@ -134,14 +136,20 @@ public class ModrinthVersionUploader{
|
||||
final int index = i;
|
||||
futures[i] = api.versions().createProjectVersion(builder.build()).whenComplete(((projectVersion, throwable) -> {
|
||||
if(throwable != null){
|
||||
LOGGER.warn("Encountered an exception while uploading a new release to Modrinth!", throwable);
|
||||
logger.warn("Encountered an exception while uploading a new release to Modrinth!", throwable);
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("Created new release!");
|
||||
LOGGER.info("Link: https://modrinth.com/plugin/advancedserverlist/version/{}", projectVersion.getId());
|
||||
String url = versionUrl + projectVersion.getId();
|
||||
|
||||
modrinthRelease.addRelease(String.join(", ", platforms.get(index).getLoaders()), projectVersion.getId());
|
||||
logger.info("Created new release!");
|
||||
logger.info("Link: {}", url);
|
||||
|
||||
releaseHolder.addRelease(
|
||||
"modrinth",
|
||||
String.join(", ", platforms.get(index).getPlatformNames()),
|
||||
url
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user