mirror of
https://codeberg.org/Andre601/AdvancedServerList.git
synced 2026-11-05 17:02:34 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7aeffa52a | ||
|
|
9f847ca1db | ||
|
|
6f4a429123 | ||
|
|
60db6eb445 | ||
|
|
5c06fec00a | ||
|
|
12eb80d4d7 | ||
|
|
c371bf323c | ||
|
|
8dca20c73d | ||
|
|
aabfb5273e | ||
|
|
a282382402 | ||
|
|
e86733052b | ||
|
|
a112036c2e | ||
|
|
6c07bfb5a3 | ||
|
|
7668a3e881 | ||
|
|
f53f2c724d | ||
|
|
5ea6f9307c | ||
|
|
8bdaa232ca | ||
|
|
1ad945a1a9 | ||
|
|
85d11e7896 | ||
|
|
bcd940d808 | ||
|
|
dd837b96e8 | ||
|
|
57295756fc | ||
|
|
9f1307f559 | ||
|
|
c489764b06 | ||
|
|
845b1b2022 | ||
|
|
3662a66ec9 | ||
|
|
e1e0083633 | ||
|
|
58e4624cf5 | ||
|
|
df069ebcdc | ||
|
|
82f2c476d8 | ||
|
|
3545cac908 | ||
|
|
cb95b833e6 | ||
|
|
e2c1c44537 | ||
|
|
aeb0587263 | ||
|
|
3471876687 | ||
|
|
82d58564ee | ||
|
|
d3918a487a | ||
|
|
a25232be6a | ||
|
|
bfa05f943a | ||
|
|
dc40a54999 | ||
|
|
682621e196 | ||
|
|
41fa678591 | ||
|
|
e7557da944 | ||
|
|
c7c9885e18 | ||
|
|
62c665a598 | ||
|
|
6d687d391d | ||
|
|
2ac6b89368 | ||
|
|
b8d4829e02 | ||
|
|
a9b4355ebf | ||
|
|
b7f3ecdc5d | ||
|
|
0428280480 | ||
|
|
31e7fb9a22 | ||
|
|
b3fc768ea7 | ||
|
|
7b990e798d | ||
|
|
7e1e00d246 | ||
|
|
15677e948d | ||
|
|
457f85d697 | ||
|
|
f3a3df648f | ||
|
|
000f3dd680 | ||
|
|
db3b0e39b5 | ||
|
|
e5a5cf9f7e | ||
|
|
0c3853de2b | ||
|
|
0146e594de | ||
|
|
1a790bca41 | ||
|
|
fc039ebe93 | ||
|
|
22561f6848 | ||
|
|
8a7ccc07ae | ||
|
|
b43f7b9f31 | ||
|
|
69b3086c65 | ||
|
|
e5b05b5859 | ||
|
|
a07994adb1 | ||
|
|
8d83b45657 | ||
|
|
22371715c5 | ||
|
|
8a7d042476 | ||
|
|
26205cdd67 | ||
|
|
ccb9cd5522 | ||
|
|
2383214b7e | ||
|
|
a82b6bf0e9 | ||
|
|
3e541e65ed | ||
|
|
314becdc45 | ||
|
|
8f662ced5c | ||
|
|
3ff782e128 | ||
|
|
6a6a708ee7 | ||
|
|
1751a77e6f | ||
|
|
3069244f21 | ||
|
|
99d4232304 | ||
|
|
ec408316bd | ||
|
|
eee5271966 | ||
|
|
34e4816517 | ||
|
|
7bde6dedb5 | ||
|
|
6864f57917 | ||
|
|
0b705ca897 | ||
|
|
4661d72f8c |
No files matched your search
@@ -9,7 +9,7 @@ body:
|
||||
Please make sure you've checked the following things first:
|
||||
|
||||
- You're using the latest release of AdvancedServerList [[Download from Modrinth](https://modrinth.com/plugin/advancedserverlist)] and the right API version.
|
||||
- You're using a supported Proxy/Server version. As of right now is only 1.19.x supported.
|
||||
- You're using a supported Proxy/Server version. As of right now is only 1.19+ supported.
|
||||
- The Feature you suggest hasn't been suggested before.
|
||||
- type: dropdown
|
||||
attributes:
|
||||
|
||||
@@ -9,7 +9,7 @@ body:
|
||||
Please make sure you've checked the following things first:
|
||||
|
||||
- You're using the latest release of AdvancedServerList [[Download from Modrinth](https://modrinth.com/plugin/advancedserverlist)]
|
||||
- You're using a supported Proxy/Server version. As of right now is only 1.19.x supported.
|
||||
- You're using a supported Proxy/Server version. As of right now is only 1.19+ supported.
|
||||
- The issue happens with just AdvancedServerList installed.
|
||||
- type: dropdown
|
||||
attributes:
|
||||
|
||||
@@ -5,4 +5,4 @@ contact_links:
|
||||
url: https://discord.gg/6dazXp6
|
||||
- name: Wiki
|
||||
about: Check the Wiki for explanations about the features and examples.
|
||||
url: https://github.com/Andre601/AdvancedServerList/wiki
|
||||
url: https://docs.andre601.ch/AdvancedServerList
|
||||
@@ -9,7 +9,7 @@ body:
|
||||
Please make sure you've checked the following things first:
|
||||
|
||||
- You're using the latest release of AdvancedServerList [[Download from Modrinth](https://modrinth.com/plugin/advancedserverlist)]
|
||||
- You're using a supported Proxy/Server version. As of right now is only 1.19.x supported.
|
||||
- You're using a supported Proxy/Server version. As of right now is only 1.19+ supported.
|
||||
- The Feature you suggest hasn't been suggested before.
|
||||
- type: dropdown
|
||||
attributes:
|
||||
|
||||
@@ -32,7 +32,7 @@ jobs:
|
||||
comment_id: ${{ steps.comment.outputs.comment-id }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- name: Find Comment
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
- name: Render Markdown Template
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python 3.7
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Get Artifact and Pull request info
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }} # Needs to be set as env variable so that 'gh api' can be used.
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
plugin_release: ${{ steps.github-release.outputs.PLUGIN_RELEASE }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Get Version from Release
|
||||
id: github-release
|
||||
run: |
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
dependencies: 'papiproxybridge@1.3(optional)'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get Jar files
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
when:
|
||||
- event: tag
|
||||
branch: master
|
||||
|
||||
steps:
|
||||
createFiles:
|
||||
image: maven:3.9.4-eclipse-temurin-17
|
||||
commands:
|
||||
# Create the jar files.
|
||||
- mvn clean install
|
||||
#uploadFiles:
|
||||
# image: badouralix/curl-jq
|
||||
# secrets:
|
||||
# - cb_token
|
||||
# commands:
|
||||
# # Get release info and setup env vars.
|
||||
# - |-
|
||||
# export JSON=`curl --location "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases?limit=10" \
|
||||
# --header 'Authorization: token $CB_TOKEN' \
|
||||
# --header 'Accept: application/json' -s -S \
|
||||
# --fail-with-body | jq ".[] | select (.tag_name==\"$CI_COMMIT_TAG\").")`
|
||||
# - export PLUGIN_CHANGELOG=$( echo $JSON | jq -r '.body' )
|
||||
# - export PLUGIN_PRE_RELEASE=$( echo $JSON | jq -r '.prerelease' )
|
||||
# - export RELEASE_ID=$( echo $JSON | jq -r '.id' )
|
||||
# # Upload release assets to Codeberg release
|
||||
# - |-
|
||||
# curl -X POST --location "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases/$RELEASE_ID/assets" \
|
||||
# --header "Authorization: token $CB_TOKEN" \
|
||||
# --header "Content-Type: multipart/form-data" -s -S \
|
||||
# --form "attachment=@bukkit/target/AdvancedServerList-Bukkit-${CI_COMMIT_TAG##v}.jar;type=application/octet-stream" \
|
||||
# --fail-with-body
|
||||
# - |-
|
||||
# curl -X POST --location "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases/$RELEASE_ID/assets" \
|
||||
# --header "Authorization: token $CB_TOKEN" \
|
||||
# --header "Content-Type: multipart/form-data" -s -S \
|
||||
# --form "attachment=@bungeecord/target/AdvancedServerList-BungeeCord-${CI_COMMIT_TAG##v}.jar;type=application/octet-stream" \
|
||||
# --fail-with-body
|
||||
# - |-
|
||||
# curl -X POST --location "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases/$RELEASE_ID/assets" \
|
||||
# --header "Authorization: token $CB_TOKEN" \
|
||||
# --header "Content-Type: multipart/form-data" -s -S \
|
||||
# --form "attachment=@velocity/target/AdvancedServerList-Velocity-${CI_COMMIT_TAG##v}.jar;type=application/octet-stream" \
|
||||
# --fail-with-body
|
||||
uploadToModrinthAndMaven:
|
||||
image: eclipse-temurin
|
||||
secrets:
|
||||
- cb_token
|
||||
- modrinth_api_token
|
||||
- hangar_api_token
|
||||
commands:
|
||||
# Move VersionUploader.jar
|
||||
- cd version-uploader/target/
|
||||
- mv VersionUploader.jar ../../
|
||||
- cd ../../
|
||||
# Create Modrinth releases
|
||||
- java -jar VersionUploader.jar --modrinth
|
||||
# Create Hangar release
|
||||
- java -jar VersionUploader.jar --hangar
|
||||
@@ -0,0 +1,28 @@
|
||||
when:
|
||||
- branch: master
|
||||
event: push
|
||||
path:
|
||||
include: ['requirements.txt', 'mkdocs.yml', 'docs/**']
|
||||
|
||||
steps:
|
||||
buildDocs:
|
||||
image: python
|
||||
secrets:
|
||||
- cb_token
|
||||
commands:
|
||||
- chmod -R a+w .
|
||||
- git config --global --add safe.directory /woodpecker/src/codeberg.org/Andre601/blog-source/website
|
||||
- git config --global user.email "github@andre601.ch"
|
||||
- git config --global user.name "CI Website Builder"
|
||||
- git fetch --unshallow
|
||||
- git clone -b pages https://codeberg.org/Andre601/AdvancedServerList.git site
|
||||
- chmod -R a+w site
|
||||
- python -m pip install --upgrade pip
|
||||
- python -m pip install -r requirements.txt
|
||||
- mkdocs build
|
||||
- mv domains site/.domains
|
||||
- cd site
|
||||
- git remote set-url origin https://$CB_TOKEN@codeberg.org/Andre601/AdvancedServerList.git
|
||||
- git add --all
|
||||
- git commit -m "Update AdvancedServerList Docs ($( env TZ=Europe/Zurich date +"%d.%m.%Y" )) [CI SKIP]"
|
||||
- git push
|
||||
@@ -10,10 +10,6 @@ AdvancedServerList is a plugin that allowys you to customize your server's MOTD,
|
||||
<a href="https://hangar.papermc.io/Andre_601/AdvancedServerList" target="_blank">
|
||||
<img src="https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/hangar_vector.svg" height="46" alt="hangar" title="Available on Hangar">
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://www.spigotmc.org/resources/102910" target="_blank">
|
||||
<img src="https://cdn.jsdelivr.net/gh/Andre601/devins-badges@b9ff12b/assets/compact/available/spigot_vector.svg" height="46" alt="spigot" title="Available on SpigotMC">
|
||||
</a>
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
@@ -64,11 +60,13 @@ Only certain options are usable for each option. As an example does motd support
|
||||
|
||||
## Dependencies
|
||||
|
||||
| Dependency | Platforms | Required? |
|
||||
|------------------|---------------|-----------|
|
||||
| [ProtocolLib] | Spigot | Yes |
|
||||
| [PlaceholderAPI] | Spigot, Paper | No |
|
||||
| [ViaVersion] | Spigot, Paper | No |
|
||||
| Dependency | Platforms | Required? |
|
||||
|-------------------|-------------------------------------|-----------|
|
||||
| [ProtocolLib] | Spigot | Yes |
|
||||
| [PlaceholderAPI] | Spigot, Paper | No |
|
||||
| [ViaVersion] | Spigot, Paper | No |
|
||||
| [PAPIProxyBridge] | Spigot, Paper, BungeeCord, Velocity | No |
|
||||
| [Maintenance] | Spigot, Paper, BungeeCord, Velocity | No |
|
||||
|
||||
## Statistics
|
||||
|
||||
@@ -97,16 +95,18 @@ You can disable this in the global bStats config file located in `/plugins/bstat
|
||||
</a>
|
||||
|
||||
<!-- Links -->
|
||||
[profiles]: https://docs.andre601.ch/AdvancedServerList/profiles/
|
||||
[conditions]: https://docs.andre601.ch/AdvancedServerList/profiles/#conditions
|
||||
[placeholders]: https://docs.andre601.ch/AdvancedServerList/profiles/placeholders/
|
||||
[minimessage]: https://docs.andre601.ch/AdvancedServerList/profiles/formatting/
|
||||
[profiles]: https://asl.andre601.ch/profiles/
|
||||
[conditions]: https://asl.andre601.ch/profiles/#conditions
|
||||
[placeholders]: https://asl.andre601.ch/profiles/placeholders/
|
||||
[minimessage]: https://asl.andre601.ch/profiles/formatting/
|
||||
|
||||
[modrinth]: https://modrinth.com/plugin/advancedserverlist
|
||||
|
||||
[protocollib]: https://www.spigotmc.org/resources/1997/
|
||||
[protocollib]: https://hangar.papermc.io/dmulloy2/ProtocolLib
|
||||
[placeholderapi]: https://www.spigotmc.org/resources/6245/
|
||||
[viaversion]: https://www.spigotmc.org/resources/19254/
|
||||
[viaversion]: https://hangar.papermc.io/ViaVersion/ViaVersion
|
||||
[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
|
||||
[maintenance]: https://hangar.papermc.io/kennytv/Maintenance
|
||||
|
||||
[bstats]: https://bstats.org
|
||||
[bstats-bungee]: https://bstats.org/plugin/bungeecord/AdvancedServerList/15585
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>AdvancedServerList-Bukkit-${plugin.version}${project.build.commit}</finalName>
|
||||
<finalName>AdvancedServerList-Bukkit-${plugin.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
|
||||
+9
@@ -32,6 +32,7 @@ import ch.andre601.advancedserverlist.bukkit.BukkitCore;
|
||||
import ch.andre601.advancedserverlist.bukkit.listeners.PreServerListSetEventImpl;
|
||||
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitServerImpl;
|
||||
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitPlayerImpl;
|
||||
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.events.GenericEventWrapper;
|
||||
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
@@ -129,6 +130,14 @@ public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon,
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenanceModeActive(){
|
||||
if(!Bukkit.getPluginManager().isPluginEnabled("Maintenance"))
|
||||
return false;
|
||||
|
||||
return PingEventHandler.getMaintenanceUtil().isMaintenanceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion(){
|
||||
return event.getClient().getProtocolVersion();
|
||||
|
||||
+9
@@ -31,6 +31,7 @@ import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
|
||||
import ch.andre601.advancedserverlist.bukkit.listeners.PreServerListSetEventImpl;
|
||||
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitServerImpl;
|
||||
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.events.GenericEventWrapper;
|
||||
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
@@ -133,6 +134,14 @@ public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServe
|
||||
return event.getPlayer().getAddress() == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenanceModeActive(){
|
||||
if(!Bukkit.getPluginManager().isPluginEnabled("Maintenance"))
|
||||
return false;
|
||||
|
||||
return PingEventHandler.getMaintenanceUtil().isMaintenanceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion(){
|
||||
return ping.getVersionProtocol();
|
||||
|
||||
@@ -16,6 +16,9 @@ dependencies:
|
||||
ViaVersion:
|
||||
load: BEFORE
|
||||
required: false
|
||||
Maintenance:
|
||||
load: BEFORE
|
||||
required: false
|
||||
|
||||
# The below stuff is NOT used by Paper plugin.
|
||||
commands:
|
||||
|
||||
@@ -20,6 +20,7 @@ libraries:
|
||||
softdepend:
|
||||
- 'ProtocolLib'
|
||||
- 'PlaceholderAPI'
|
||||
- 'Maintenance'
|
||||
|
||||
commands:
|
||||
advancedserverlist:
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>AdvancedServerList-BungeeCord-${plugin.version}${project.build.commit}</finalName>
|
||||
<finalName>AdvancedServerList-BungeeCord-${plugin.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
|
||||
+8
@@ -133,6 +133,14 @@ public class BungeeEventWrapper implements GenericEventWrapper<Favicon, BungeePl
|
||||
return protocol == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenanceModeActive(){
|
||||
if(plugin.getProxy().getPluginManager().getPlugin("Maintenance") == null)
|
||||
return false;
|
||||
|
||||
return PingEventHandler.getMaintenanceUtil().isMaintenanceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion(){
|
||||
return this.protocol.getProtocol();
|
||||
|
||||
@@ -5,5 +5,6 @@ description: '${plugin.description}'
|
||||
|
||||
softDepends:
|
||||
- PAPIProxyBridge
|
||||
- Maintenance
|
||||
|
||||
main: 'ch.andre601.advancedserverlist.bungeecord.BungeeCordCore'
|
||||
+12
-2
@@ -52,6 +52,10 @@
|
||||
<id>papiproxybridge-repo</id>
|
||||
<url>https://repo.william278.net/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -106,7 +110,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.1.1-jre</version>
|
||||
<version>32.1.2-jre</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -115,6 +119,12 @@
|
||||
<version>1.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv.maintenance</groupId>
|
||||
<artifactId>maintenance-api</artifactId>
|
||||
<version>4.2.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
@@ -126,7 +136,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>AdvancedServerList-Core-${plugin.version}${project.build.commit}</finalName>
|
||||
<finalName>AdvancedServerList-Core-${plugin.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.core.compat.maintenance;
|
||||
|
||||
import eu.kennytv.maintenance.api.Maintenance;
|
||||
import eu.kennytv.maintenance.api.MaintenanceProvider;
|
||||
|
||||
public class MaintenanceUtil{
|
||||
|
||||
private final Maintenance api;
|
||||
|
||||
public MaintenanceUtil(){
|
||||
this.api = MaintenanceProvider.get();
|
||||
}
|
||||
|
||||
public boolean isMaintenanceEnabled(){
|
||||
return api.isMaintenance();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.core.papi;
|
||||
package ch.andre601.advancedserverlist.core.compat.papi;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.core.papi;
|
||||
package ch.andre601.advancedserverlist.core.compat.papi;
|
||||
|
||||
import net.william278.papiproxybridge.api.PlaceholderAPI;
|
||||
|
||||
+11
-2
@@ -29,9 +29,10 @@ import ch.andre601.advancedserverlist.api.events.GenericServerListEvent;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
|
||||
import ch.andre601.advancedserverlist.api.objects.GenericServer;
|
||||
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
|
||||
import ch.andre601.advancedserverlist.core.compat.maintenance.MaintenanceUtil;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
|
||||
import ch.andre601.advancedserverlist.core.interfaces.events.GenericEventWrapper;
|
||||
import ch.andre601.advancedserverlist.core.papi.PAPIUtil;
|
||||
import ch.andre601.advancedserverlist.core.compat.papi.PAPIUtil;
|
||||
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
|
||||
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
|
||||
import ch.andre601.advancedserverlist.core.profiles.profile.ProfileManager;
|
||||
@@ -40,9 +41,10 @@ import ch.andre601.advancedserverlist.core.profiles.replacer.StringReplacer;
|
||||
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){
|
||||
if(event.isInvalidProtocol())
|
||||
if(event.isInvalidProtocol() || event.isMaintenanceModeActive())
|
||||
return;
|
||||
|
||||
PluginCore<F> plugin = event.getPlugin();
|
||||
@@ -133,4 +135,11 @@ public class PingEventHandler{
|
||||
|
||||
return (papiUtil = new PAPIUtil());
|
||||
}
|
||||
|
||||
public static MaintenanceUtil getMaintenanceUtil(){
|
||||
if(maintenanceUtil != null)
|
||||
return maintenanceUtil;
|
||||
|
||||
return (maintenanceUtil = new MaintenanceUtil());
|
||||
}
|
||||
}
|
||||
+2
@@ -59,6 +59,8 @@ public interface GenericEventWrapper<F, P extends GenericPlayer>{
|
||||
|
||||
boolean isInvalidProtocol();
|
||||
|
||||
boolean isMaintenanceModeActive();
|
||||
|
||||
int getProtocolVersion();
|
||||
|
||||
int getOnlinePlayers();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "api-objects/info-template.html" as info %}
|
||||
|
||||
{% block content %}
|
||||
{% include "partials/content.html" %}
|
||||
{% if page.meta %}
|
||||
<!--
|
||||
Object summaries
|
||||
-->
|
||||
{% if page.meta.constructors %}
|
||||
{{ info.summary('Constructor Summary', page.meta.constructors, details_type='constructor') }}
|
||||
{% endif %}
|
||||
{% if page.meta.classes %}
|
||||
{{ info.summary('Class Summary', page.meta.classes, details_type='class') }}
|
||||
{% endif %}
|
||||
{% if page.meta.enums %}
|
||||
{{ info.summary('Enum Constant Summary', page.meta.enums, details_type='enum') }}
|
||||
{% endif %}
|
||||
{% if page.meta.methods or page.meta.inherits %}
|
||||
{{ info.summary('Method Summary', page.meta.methods, page.meta.inherits, details_type='method') }}
|
||||
{% endif %}
|
||||
<!--
|
||||
Detailed object info
|
||||
-->
|
||||
{% if page.meta.constructors %}
|
||||
{{ info.info('Constructor Detail', page.meta.constructors) }}
|
||||
{% endif %}
|
||||
{% if page.meta.enums %}
|
||||
{{ info.info('Enum Constant Detail', page.meta.enums, true) }}
|
||||
{% endif %}
|
||||
{% if page.meta.methods %}
|
||||
{{ info.info('Method Detail', page.meta.methods)}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,203 @@
|
||||
{% macro summary(title, summaries, inherits, details_type = 'unknown') -%}
|
||||
<h2 id="{{ title | lower() | replace(' ', '-') | e}}">
|
||||
{{ title }}
|
||||
</h2>
|
||||
<div class="md-typeset__scrollwrap">
|
||||
<div class="md-typeset__table">
|
||||
{% if summaries %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{% if details_type and details_type == "method" %}
|
||||
<th>Modifier and Type</th>
|
||||
{% endif %}
|
||||
<th>{{ details_type | capitalize() }}</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for summary in summaries %}
|
||||
<tr>
|
||||
{% set modifiers = namespace(name = "") %}
|
||||
{% for attribute in summary.attributes %}
|
||||
{% set modifiers.name = modifiers.name ~ attribute %}
|
||||
{% if loop.revindex > 0 %}{% set modifiers.name = modifiers.name ~ " " %}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if modifiers.name %}{% set modifiers.name = modifiers.name ~ " " %}{% endif %}
|
||||
|
||||
{% if summary.type and summary.type.name %}
|
||||
{% set modifiers.name = modifiers.name ~ summary.type.name %}
|
||||
{% else %}
|
||||
{% set modifiers.name = modifiers.name ~ "void" %}
|
||||
{% endif %}
|
||||
|
||||
{% set desc = "" %}
|
||||
{% if summary.description %}
|
||||
{% set desc = summary.description.split("<br>")[0] %}
|
||||
{% endif %}
|
||||
|
||||
{% set final_name = namespace(name = "") %}
|
||||
{% if details_type and details_type == "enum" %}
|
||||
{% set final_name.name = summary.name | upper() %}
|
||||
{% else %}
|
||||
{% set final_name.name = summary.name ~ "(" %}
|
||||
{% endif %}
|
||||
|
||||
{% for parameter in summary.parameters %}
|
||||
{% set final_name.name = final_name.name ~ parameter.type %}
|
||||
{% if loop.revindex > 1 %}{% set final_name.name = final_name.name ~ ", " %}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if details_type != "enum" %}
|
||||
{% set final_name.name = final_name.name ~ ")" %}
|
||||
{% endif %}
|
||||
|
||||
{% if details_type and details_type == "method" %}
|
||||
{% if modifiers.name %}
|
||||
<td><code>{{ modifiers.name }}</code></td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if summary.link %}
|
||||
<a href="{{ summary.link }}"><code>{{ final_name.name | e}}</code></a>
|
||||
{% else %}
|
||||
<a href="#{{ final_name.name | lower() | replace(' ', '-') | e }}"><code>{{ final_name.name | e}}</code></a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ desc }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if inherits %}
|
||||
{% for classpath, inherit in inherits.items() %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Methods inherited from <a href="{{ inherit.link }}"><code>{{ classpath }}</code></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
{% for inh in inherit.list %}
|
||||
<a href="{{ inherit.link }}#{{ inh | lower() | replace(' ', '-') | e }}">
|
||||
<code>{{- inh | e -}}</code>
|
||||
</a>
|
||||
{%- if loop.revindex > 1 %}, {% endif -%}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro info(title, details, enum = false) -%}
|
||||
<h2 id="{{ title | lower() | replace(' ', '-') | e}}">
|
||||
{{ title }}
|
||||
</h2>
|
||||
{% for detail in details %}
|
||||
<div class="api-detail">
|
||||
{% set final_name = namespace(name = "") %}
|
||||
{% if enum %}
|
||||
{% set final_name.name = detail.name | upper() %}
|
||||
{% else %}
|
||||
{% set final_name.name = detail.name ~ "(" %}
|
||||
{% endif %}
|
||||
|
||||
{% for parameter in detail.parameters %}
|
||||
{% set final_name.name = final_name.name ~ parameter.type %}
|
||||
{% if loop.revindex > 1 %}{% set final_name.name = final_name.name ~ ", " %}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if not enum %}
|
||||
{% set final_name.name = final_name.name ~ ")" %}
|
||||
{% endif %}
|
||||
|
||||
<h3 id="{{ final_name.name | lower() | replace(' ', '-') | e }}">
|
||||
{% for attribute in detail.attributes %}
|
||||
<api__{{- attribute -}}></api__{{- attribute -}}>
|
||||
{% endfor %}
|
||||
|
||||
{% if enum %}
|
||||
<api__static></api__static> <api__final></api__final>
|
||||
{% endif %}
|
||||
|
||||
{% if detail.type %}
|
||||
{% 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 %}
|
||||
{% endif %}
|
||||
<code>{{ final_name.name | e }}</code><a href="#{{ final_name.name | lower() | replace(' ', '-') | e }}" class="headerlink" title="Permanent link">¶</a>
|
||||
</h3>
|
||||
|
||||
{% if detail.description %}
|
||||
<p class="api-detail__description">
|
||||
{{ detail.description }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if detail.parameters %}
|
||||
<h4 id="{{ detail.name | lower() | replace(' ', '-') | e }}-parameters">
|
||||
Parameters:<a href="#{{ detail.name | lower() | replace(' ', '-') | e }}-parameters" class="headerlink" title="Permanent link">¶</a>
|
||||
</h4>
|
||||
<ul>
|
||||
{% for parameter in detail.parameters %}
|
||||
<li>
|
||||
{% for attribute in parameter.attribute %}
|
||||
<api__{{- attribute -}}></api__{{- attribute -}}>
|
||||
{% endfor %}
|
||||
<code>{{ parameter.type | e }}: {{ parameter.name }}</code>{% if parameter.description %} - {{ parameter.description }}{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if detail.returns %}
|
||||
<h4 id="{{ detail.name | lower() | replace(' ', '-') | e }}-returns">
|
||||
Returns:<a href="#{{ detail.name | lower() | replace(' ', '-') | e }}-returns" class="headerlink" title="Permanent link">¶</a>
|
||||
</h4>
|
||||
<p class="api-detail__description">
|
||||
{{ detail.returns }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if detail.throws %}
|
||||
<h4 id="{{ detail.name | lower() | replace(' ', '-') | e }}-throws">
|
||||
Throws:<a href="#{{ detail.name | lower() | replace(' ', '-') | e }}-throws" class="headerlink" title="Permanent link">¶</a>
|
||||
</h4>
|
||||
<ul>
|
||||
{% for throw in detail.throws %}
|
||||
<li>
|
||||
<code>{{ throw.name }}</code>{% if throw.description %} - {{ throw.description }}{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if seealso %}
|
||||
<h4 id="{{ detail.name | lower() | replace(' ', '-') | e }}-see-also">
|
||||
See also:<a href="#{{ detail.name | lower() | replace(' ', '-') | e }}-see-also" class="headerlink" title="Permanent link">¶</a>
|
||||
</h4>
|
||||
<ul>
|
||||
{% for see in detail.seealso %}
|
||||
<li>
|
||||
<a href="{{ see.link }}"><code>{{ see.name }}</code></a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{%- endmacro %}
|
||||
@@ -0,0 +1,17 @@
|
||||
<a
|
||||
href="{{ config.repo_url}}"
|
||||
title="{{ lang.t('source') }}"
|
||||
class="md-source"
|
||||
target="_blank"
|
||||
rel="nofollow noreferral noopener"
|
||||
>
|
||||
<div class="md-source__icon md-icon">
|
||||
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
|
||||
{% include ".icons/" ~ icon ~ ".svg" %}
|
||||
</div>
|
||||
<div class="md-source__repository">
|
||||
{{ config.repo_name }}
|
||||
<ul class="md-source__facts" data-md-component="codeberg-stats">
|
||||
</ul>
|
||||
</div>
|
||||
</a>
|
||||
@@ -0,0 +1,9 @@
|
||||
nav:
|
||||
- Home:
|
||||
- index.md
|
||||
- commands.md
|
||||
- profiles
|
||||
- examples
|
||||
- migration
|
||||
- api
|
||||
- placeholderapi
|
||||
@@ -0,0 +1,2 @@
|
||||
nav:
|
||||
- ...
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
icon: octicons/log-24
|
||||
---
|
||||
|
||||
# Changelog
|
||||
|
||||
This page lists the recent changes made towards the AdvancedServerListAPI.
|
||||
@@ -17,7 +21,7 @@ They are ordered newest to oldest.
|
||||
- `BungeeProxy` - Contains a `getServers()` method that returns a `Map<String, ServerInfo>` of all known Servers for BungeeCord.
|
||||
- `VelocityProxy` - Contains a `getServers()` method that returns a `Map<String, RegisteredServer>` of all known Servers for Velocity.
|
||||
|
||||
### :octicons-trash-24:{ .changelog-removed title="Removed" } Removed { #v-removed }
|
||||
### :octicons-trash-24:{ .changelog-removed title="Removed" } Removed { #v3-removed }
|
||||
|
||||
- All previously deprecated `getX()` methods from the `ProfileEntry` record
|
||||
|
||||
|
||||
+11
-2
@@ -1,3 +1,7 @@
|
||||
---
|
||||
icon: octicons/command-palette-24
|
||||
---
|
||||
|
||||
# API
|
||||
|
||||
AdvancedServerList v2 introduced a new API that plugins can hook into to use.
|
||||
@@ -9,7 +13,9 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
|
||||
|
||||
=== ":simple-gradle: Gradle"
|
||||
|
||||
Make sure to replace `{version}` with the latest version available in the [GitHub Repository][api-repo].
|
||||
[![latest_release][release]][api-repo]
|
||||
|
||||
Make sure to replace `{version}` with the version displayed above.
|
||||
|
||||
```groovy title="build.gradle"
|
||||
repositorories {
|
||||
@@ -28,7 +34,9 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
|
||||
|
||||
=== ":simple-apachemaven: Maven"
|
||||
|
||||
Make sure to replace `{version}` with the latest version available in the [GitHub Repository][api-repo].
|
||||
[![latest_release][release]][api-repo]
|
||||
|
||||
Make sure to replace `{version}` with the version displayed above.
|
||||
|
||||
```xml title="pom.xml"
|
||||
<repositories>
|
||||
@@ -64,6 +72,7 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
[release]: https://img.shields.io/github/v/tag/Andre601/asl-api?labelColor=252631&color=292a36&style=for-the-badge&label=Latest%20Release:
|
||||
[api-repo]: https://github.com/Andre601/asl-api
|
||||
|
||||
## Add own placeholders
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
nav:
|
||||
- index.md
|
||||
- api: api
|
||||
- platform-bukkit: platform-bukkit
|
||||
- platform-bungeecord: platform-bungeecord
|
||||
- platform-velocity: platform-velocity
|
||||
@@ -0,0 +1,3 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api: ch.andre601.advancedserverlist.api
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'get'
|
||||
description: |
|
||||
Retrieve the instance used of this API.<br>
|
||||
If no instance has been made so far will a new one be created.
|
||||
returns: 'Instance of this API.'
|
||||
attributes:
|
||||
- static
|
||||
type:
|
||||
name: 'AdvancedServerListAPI'
|
||||
type: 'object'
|
||||
- name: 'addPlaceholderProvider'
|
||||
description: |
|
||||
Adds the provided <a href="./../placeholderprovider/"><code>PlaceholderProvider</code></a> to the list, if it passes the following checks:<br>
|
||||
<ul>
|
||||
<li>Provided PlaceholderProvider instance is not null.</li>
|
||||
<li>The identifier is not null nor empty.</li>
|
||||
<li>The identifier does not contain any spaces.</li>
|
||||
<li>A PlaceholderProvider with the same identifier doesn't exist already.</li>
|
||||
</ul>
|
||||
Not passing any of the above checks results in a <a href="./../exceptions/invalidplaceholderproviderexception/"><code>InvalidPlaceholderProviderException</code></a> being thrown.
|
||||
parameters:
|
||||
- name: 'placeholderProvider'
|
||||
description: 'The <a href="./../placeholderprovider/"><code>PlaceholderProvider</code></a> to add.'
|
||||
type: PlaceholderProvider
|
||||
attributes:
|
||||
- notnull
|
||||
throws:
|
||||
- name: 'InvalidPlaceholderProviderException'
|
||||
description: 'When the provided <a href="./../placeholderprovider/"><code>PlaceholderProvider</code> instance</a> is null, has a null or empty identifier, the identifier contains spaces, or another PlaceholderProvider with the same identifier is already in use.'
|
||||
type:
|
||||
name: 'void'
|
||||
- name: 'retrievePlaceholderProvider'
|
||||
description: 'Retrieves the <a href="./../placeholderprovider/"><code>PlaceholderProvider</code></a> associated with the provided identifier, or <code>null</code> should no such entry exist.'
|
||||
parameters:
|
||||
- name: 'identifier'
|
||||
description: 'The identifier to find a matching <a href="./../placeholderprovider/"><code>PlaceholderProvider</code></a> for.'
|
||||
type: String
|
||||
returns: 'Possibly-null <a href="./../placeholderprovider/"><code>PlaceholderProvider</code> instance</a>.'
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: PlaceholderProvider
|
||||
type: object
|
||||
link: './../placeholderprovider'
|
||||
---
|
||||
|
||||
# <api__class></api__class> AdvancedServerListAPI
|
||||
|
||||
Core class of the API for AdvancedServerList.
|
||||
Use [`get()`](#get) to retrieve the instance currently used.
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getEntry'
|
||||
description: 'Gets the <a href="../../profiles/profileentry/"><code>ProfileEntry</code></a> currently set.'
|
||||
returns: The currently used ProfileEntry.
|
||||
type:
|
||||
name: ProfileEntry
|
||||
type: object
|
||||
link: '../../profiles/profileentry/'
|
||||
- name: 'setEntry'
|
||||
description: |-
|
||||
Sets the new <a href="../../profiles/profileentry/"><code>ProfileEntry</code></a> to use.<br>
|
||||
This may not be <code>null</code>.
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
description: 'The new <a href="../../profiles/profileentry/"><code>ProfileEntry</code></a> to use.'
|
||||
type: ProfileEntry
|
||||
attributes:
|
||||
- notnull
|
||||
throws:
|
||||
- name: 'IllegalArgumentException'
|
||||
description: 'When the provided ProfileEntry is <code>null</code>'
|
||||
type:
|
||||
name: 'void'
|
||||
- name: 'isCancelled'
|
||||
description: Returns whether this event has been cancelled or not.
|
||||
returns: Whether this event has been cancelled or not.
|
||||
type:
|
||||
name: boolean
|
||||
- name: 'setCancelled'
|
||||
description: Sets the event's cancel state
|
||||
parameters:
|
||||
- name: 'cancelled'
|
||||
description: 'Boolean to set the event''s cancelled state.'
|
||||
type: boolean
|
||||
type:
|
||||
name: 'void'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> GenericServerListEvent
|
||||
|
||||
Interface used for the platform-specific PreServerListSetEvent instances.
|
||||
This allows the plugin to pull common info such as ProfileEntry or if the event has been cancelled by another plugin.
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
---
|
||||
template: 'api-doc.html'
|
||||
|
||||
constructors:
|
||||
- name: 'InvalidPlaceholderProviderException'
|
||||
parameters:
|
||||
- name: msg
|
||||
type: String
|
||||
---
|
||||
|
||||
# <api__class></api__class> InvalidPlaceholderProviderException
|
||||
|
||||
RuntimeException thrown whenever an invalid [`PlaceholderProvider`](../placeholderprovider.md) has been given.
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getName'
|
||||
description: |
|
||||
Returns the name of the player.<br>
|
||||
Note that on Spigot, Paper and other forks can the name differ from the one cached by AdvancedServerList, if the plugin was able to retrieve an OfflinePlayer instance from the server. On BungeeCord and Velocity will the returned String always be the name from the cache.<br>
|
||||
<br>
|
||||
Name may be whatever has been defined in AdvancedServerList's config.yml, should the player not be cached yet by the plugin.
|
||||
returns: 'String representing the player''s name'
|
||||
type:
|
||||
name: String
|
||||
type: object
|
||||
- name: 'getProtocol'
|
||||
description: |
|
||||
Returns the protocol ID the player is using.<br>
|
||||
The protocol ID is an integer used by Minecraft to determine what version a server or client is running.
|
||||
returns: 'Integer representing the protocol version of this player.'
|
||||
type:
|
||||
name: int
|
||||
- name: 'getUUID'
|
||||
description: |
|
||||
Returns the unique ID associated with this player.<br>
|
||||
<br>
|
||||
UUID may be whatever has been defined in AdvancedServerList's config.yml, should the player not be cached yet by AdvancedServerList.
|
||||
returns: 'UUID of the player'
|
||||
type:
|
||||
name: UUID
|
||||
type: object
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> GenericPlayer
|
||||
|
||||
A basic interface used to store generic player data to use in placeholder resolving.
|
||||
The different variants of AdvancedServerList implement this into their own class and may provide additional data not available through this interface.
|
||||
|
||||
The following values will always be present, no matter the platform this interface is used on:
|
||||
|
||||
- [Name of the Player](#getname())
|
||||
- [Protocol version of the Player](#getprotocol())
|
||||
- [UUID of the Player](#getuuid())
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getPlayersOnline'
|
||||
description: 'Returns the number of players currently online on the server.'
|
||||
returns: 'Number of players online on the server.'
|
||||
type:
|
||||
name: int
|
||||
- name: 'getPlayersMax'
|
||||
description: 'Returns the number of total players that can join the server.'
|
||||
returns: 'Number of total players that can join the server.'
|
||||
type:
|
||||
name: int
|
||||
- name: 'getHost'
|
||||
description: 'Returns the IP/Domain that got pinged by the player.'
|
||||
returns: 'Possibly-null String containing the IP/Domain that got pinged by the player'
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'String'
|
||||
type: 'object'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> GenericServer
|
||||
|
||||
Simple class used to wrap around some generic server data such as online player count, number of total players that can join and the host (IP/Domain) that got pinged by the player.
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
enums:
|
||||
- name: 'true'
|
||||
description: 'Boolean value <code>true</code>'
|
||||
- name: 'false'
|
||||
description: 'Boolean value <code>false</code>'
|
||||
- name: 'not_set'
|
||||
description: 'Boolean value <code>null</code>'
|
||||
|
||||
methods:
|
||||
- name: 'resolve'
|
||||
description: |
|
||||
Returns a NullBool instance based on the provided <code>Boolean</code> value.<br>
|
||||
In case of <code>null</code> being provided will <a href="#not_set"><code>NullBool.NOT_SET</code></a> be returned, otherwise will the corresponding NullBool instance matching the Boolean value be returned.
|
||||
returns: 'NullBool instance based on the provided <code>Boolean</code> value.'
|
||||
parameters:
|
||||
- name: 'bool'
|
||||
description: 'The <code>Boolean</code> value to receive a NullBool instance for.'
|
||||
type: Boolean
|
||||
attributes:
|
||||
- nullable
|
||||
attributes:
|
||||
- static
|
||||
type:
|
||||
name: 'NullBool'
|
||||
type: 'object'
|
||||
- name: 'isNotSet'
|
||||
description: 'Returns whether the NullBool is <a href="#not_set"><code>NullBool.NOT_SET</code></a>.'
|
||||
returns: 'True if the instance is <a href="#not_set"><code>NullBool.NOT_SET</code></a>, otherwise false.'
|
||||
type:
|
||||
name: 'boolean'
|
||||
type: 'primitive'
|
||||
- name: 'getOrDefault'
|
||||
description: |
|
||||
Gets the corresponding boolean value associated with the NullBool instance.<br>
|
||||
In the case of NullBool <a href="#isnotset()">not being set</a> will the provided default value be returned.
|
||||
returns: 'True or false depending on the NullBool instance and the provided default value.'
|
||||
parameters:
|
||||
- name: 'def'
|
||||
description: 'The default boolean value to return should the NullBool instance be <a href="#not_set"><code>NullBool.NOT_SET</code></a>.'
|
||||
type: boolean
|
||||
type:
|
||||
name: 'boolean'
|
||||
type: 'primitive'
|
||||
---
|
||||
|
||||
# <api__enum></api__enum> NullBool
|
||||
|
||||
Enum used to return a `Boolean` value with a default one should no value be set.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PlaceholderProvider'
|
||||
description: 'Constructor used to set the identifier for the class extending the PlaceholderProvider class itself.'
|
||||
parameters:
|
||||
- name: 'identifier'
|
||||
description: 'The identifier to use for the placeholder. Cannot be empty.'
|
||||
type: String
|
||||
attributes:
|
||||
- notnull
|
||||
|
||||
methods:
|
||||
- name: 'parsePlaceholder'
|
||||
description: |
|
||||
Method called by AdvancedServerList's StringReplacer class to replace any appearances of <code>${<identifier> <placeholder>}</code> with whatever value a matching PlaceholderProvider may return.<br>
|
||||
<br>
|
||||
Returning <code>null</code> will be treated as an invalid placeholder by the plugin, making it return the placeholder as-is without any changes.
|
||||
parameters:
|
||||
- name: 'placeholder'
|
||||
type: String
|
||||
description: 'The part of the Placeholder that comes after the identifier and before the closing curly bracket.'
|
||||
- name: 'player'
|
||||
type: GenericPlayer
|
||||
description: 'The <a href="./../objects/genericplayer/"><code>GenericPlayer</code> instance</a> used.'
|
||||
- name: 'server'
|
||||
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:
|
||||
- nullable
|
||||
- abstract
|
||||
type:
|
||||
name: 'String'
|
||||
type: 'object'
|
||||
- name: 'getIdentifier'
|
||||
description: 'Returns the identifier used by this PlaceholderProvider instance.'
|
||||
returns: 'String representing the identifier of this PlaceholderProvider instance.'
|
||||
type:
|
||||
name: 'String'
|
||||
type: 'object'
|
||||
---
|
||||
|
||||
# <api__abstract></api__abstract> <api__class></api__class> PlaceholderProvider
|
||||
|
||||
Abstract class that is used to provide your own Placeholder patterns for AdvancedServerList to parse.
|
||||
|
||||
In order for your class to be considered a valid PlaceholderProvider will you need to set the `identifier` to a non-null, non-empty value without having any spaces in it.
|
||||
Once set, use [`AdvancedServerListAPI#addPlaceholderProvider(PlaceholderProvider)`](advancedserverlistapi.md#addplaceholderprovider(placeholderprovider)) to register your class for AdvancedServerList to use.
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'Builder'
|
||||
|
||||
methods:
|
||||
- name: 'setMotd'
|
||||
description: |
|
||||
Sets a new MOTD to use.<br>
|
||||
<br>
|
||||
Set to an empty list to not change the MOTD.<br>
|
||||
Only the first two entries of the list will be considered and any additional ones discarded.
|
||||
returns: 'This Builder after the motd has been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'motd'
|
||||
description: 'The MOTD to use.'
|
||||
type: 'List<String>'
|
||||
attributes:
|
||||
- notnull
|
||||
throws:
|
||||
- name: 'IllegalArgumentException'
|
||||
description: 'Thrown by the <code>CheckUtil</code> in case <code>null</code> has been provided as parameter.'
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'setPlayers'
|
||||
description: |
|
||||
Sets the players (lines) to use for the hover.<br>
|
||||
<br>
|
||||
Set to an empty list to not change the hover text.
|
||||
returns: 'This Builder after the players have been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'players'
|
||||
description: 'The lines to set for the hover.'
|
||||
type: 'List<String>'
|
||||
attributes:
|
||||
- notnull
|
||||
throws:
|
||||
- name: 'IllegalArgumentException'
|
||||
description: 'Thrown by the <code>CheckUtil</code> in case <code>null</code> has been provided as parameter.'
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'setPlayerCountText'
|
||||
description: |
|
||||
Sets the text to override the player count with.<br>
|
||||
<br>
|
||||
Set to an empty String or <code>null</code> to not alter the player count text.
|
||||
returns: 'This Builder after the player count text has been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'playerCountText'
|
||||
description: 'The text to show in the player count.'
|
||||
type: String
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'setFavicon'
|
||||
description: |
|
||||
Sets the value to use for the favicon.<br>
|
||||
The following values are supported:
|
||||
<ul>
|
||||
<li>URL to a valid PNG file.</li>
|
||||
<li>File name (with <code>.png</code> extension) matching a file saved in the favicons folder of AdvancedServerList.</li>
|
||||
<li><code>${player uuid}</code> to display the avatar of the player.</li>
|
||||
</ul>
|
||||
returns: 'This Builder after the favicon has been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'favicon'
|
||||
description: 'The favicon to set'
|
||||
type: String
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'setHidePlayersEnabled'
|
||||
description: |
|
||||
Sets whether the player count should be hidden or not.<br>
|
||||
<br>
|
||||
Set to <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</code></a> to not set this.
|
||||
returns: 'This Builder after the NullBool has been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'hidePlayersEnabled'
|
||||
description: 'Whether the player count should be hidden or not.'
|
||||
type: NullBool
|
||||
attributes:
|
||||
- notnull
|
||||
throws:
|
||||
- name: 'IllegalArgumentException'
|
||||
description: 'Thrown by the <code>CheckUtil</code> in case <code>null</code> has been provided as parameter.'
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'setExtraPlayersEnabled'
|
||||
description: |
|
||||
Sets whether the extra players feature should be enabled or not.<br>
|
||||
<br>
|
||||
Set to <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</code></a> to not set this.
|
||||
returns: 'This Builder after the NullBool has been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'extraPlayersEnabled'
|
||||
description: 'Whether the extra players feature should be enabled or not.'
|
||||
type: NullBool
|
||||
attributes:
|
||||
- notnull
|
||||
throws:
|
||||
- name: 'IllegalArgumentException'
|
||||
description: 'Thrown by the <code>CheckUtil</code> in case <code>null</code> has been provided as parameter.'
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'setExtraPlayers'
|
||||
description: |
|
||||
Sets the number of players to add to the online players to use as the new max players value.<br>
|
||||
This option has no effect when <a href="../#extraplayersenabled()"><code>extraPlayersEnabled()</code></a> is set to <a href="../../objects/nullbool/#false"><code>NullBool.FALSE</code></a>.<br>
|
||||
<br>
|
||||
Set this to <code>null</code> to not alter the max player count. Alternatively, set <a href="#setextraplayersenabled(nullbool)"><code>setExtraPlayersEnabled(NullBool)</code></a> to <a href="../../objects/nullbool/#false"><code>NullBool.FALSE</code></a>.
|
||||
returns: 'This Builder after the extra player count has been set. Useful for chaining.'
|
||||
parameters:
|
||||
- name: 'extraPlayersCount'
|
||||
description: 'The number of extra players to use.'
|
||||
type: Integer
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
- name: 'build'
|
||||
description: 'Creates a new <a href="./.."><code>ProfileEntry</code> instance</a> with the values set in this Builder.'
|
||||
returns: 'New <a href="./.."><code>ProfileEntry</code> instance</a>.'
|
||||
type:
|
||||
name: 'ProfileEntry'
|
||||
type: 'object'
|
||||
link: './..'
|
||||
---
|
||||
|
||||
# <api__class></api__class> Builder
|
||||
|
||||
Builder class to create a new [`ProfileEntry` instance](index.md).
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'ProfileEntry'
|
||||
description: |
|
||||
Creates a new instance of a ProfileEntry with the given values.<br>
|
||||
It's recommended to use the <a href="./builder/"><code>Builder</code> class</a> for a more convenient configuration of the Settings.
|
||||
parameters:
|
||||
- name: 'motd'
|
||||
description: 'The MOTD to use.'
|
||||
type: 'List<String>'
|
||||
attributes:
|
||||
- notnull
|
||||
- name: 'players'
|
||||
description: 'The players (Lines) to show in the hover.'
|
||||
type: 'List<String>'
|
||||
attributes:
|
||||
- notnull
|
||||
- name: 'playerCountText'
|
||||
description: 'The text to display instead of the player count.'
|
||||
type: String
|
||||
attributes:
|
||||
- nullable
|
||||
- name: 'favicon'
|
||||
description: 'The favicon to use.'
|
||||
type: String
|
||||
attributes:
|
||||
- nullable
|
||||
- name: 'hidePlayersEnabled'
|
||||
description: 'Whether player count should be hidden.'
|
||||
type: NullBool
|
||||
attributes:
|
||||
- notnull
|
||||
- name: 'extraPlayersEnabled'
|
||||
description: 'Whether the extra players option should be enabled.'
|
||||
type: NullBool
|
||||
attributes:
|
||||
- notnull
|
||||
- name: 'extraPlayersCount'
|
||||
description: 'The number to add to the online players for the max players number.'
|
||||
type: Integer
|
||||
attributes:
|
||||
- nullable
|
||||
seealso:
|
||||
- name: 'ProfileEntry.Builder'
|
||||
link: './builder/'
|
||||
|
||||
classes:
|
||||
- name: 'Builder'
|
||||
description: 'Builder class to create a new ProfileEntry instance.'
|
||||
type: 'static class'
|
||||
link: 'builder/'
|
||||
|
||||
methods:
|
||||
- name: 'empty'
|
||||
description: |
|
||||
Creates an "empty" PlayerEntry with the following values set:<br>
|
||||
<ul>
|
||||
<li><a href="#motd()"><code>motd</code></a>: Empty List</li>
|
||||
<li><a href="#players()"><code>players</code></a>: Empty List</li>
|
||||
<li><a href="#playercounttext()"><code>playerCountText</code></a>: Empty String</li>
|
||||
<li><a href="#favicon()"><code>favicon</code></a>: Empty String</li>
|
||||
<li><a href="#hideplayersenabled()"><code>hidePlayersEnabled</code></a>: <a href="../../objects/nullbool/"><code>NullBool.NOT_SET</code></a></li>
|
||||
<li><a href="#extraplayersenabled()"><code>extraPlayersEnabled</code></a>: <a href="../../objects/nullbool/"><code>NullBool.NOT_SET</code></a></li>
|
||||
<li><a href="#extraplayerscount()"><code>extraPlayersCount</code></a>: <code>null</code></li>
|
||||
</ul>
|
||||
returns: 'New ProfileEntry instance with empty/null values defined'
|
||||
attributes:
|
||||
- static
|
||||
type:
|
||||
name: 'ProfileEntry'
|
||||
type: 'object'
|
||||
- name: 'copy'
|
||||
description: |
|
||||
Creates a copy of this ProfileEntry instance.<br>
|
||||
<br>
|
||||
This is simply a convenience method to not have to call <a href="#builder()"><code>builder()</code></a><code>.</code><a href="./builder/#build()"><code>build()</code></a>.<br>
|
||||
If you want to modify the ProfileEntry <a href="#builder()"><code>builder()</code></a> is preferred.
|
||||
returns: 'A copy of this ProfileEntry instance.'
|
||||
seealso:
|
||||
- name: 'builder()'
|
||||
link: '#builder()'
|
||||
type:
|
||||
name: 'ProfileEntry'
|
||||
type: 'object'
|
||||
- name: 'builder'
|
||||
description: |
|
||||
Creates a <a href="./builder/"><code>Builder</code> instance</a> with the values from this ProfileEntry set.<br>
|
||||
Use this method if you would like to modify the ProfileEntry.
|
||||
returns: 'A new <a href="./builder/"><code>Builder</code> instance</a> with the values of this ProfileEntry set.'
|
||||
type:
|
||||
name: 'Builder'
|
||||
type: 'object'
|
||||
link: './builder/'
|
||||
- name: 'motd'
|
||||
description: 'Gets the currently set MOTD of this ProfileEntry.'
|
||||
returns: 'The current MOTD used by this ProfileEntry.'
|
||||
type:
|
||||
name: 'List<String>'
|
||||
type: 'object'
|
||||
- name: 'players'
|
||||
description: 'Gets the currently set players of this ProfileEntry.'
|
||||
returns: 'The current list of players used by this ProfileEntry.'
|
||||
type:
|
||||
name: 'List<String>'
|
||||
type: 'object'
|
||||
- name: 'playerCountText'
|
||||
description: 'Gets the currently set player count text of this ProfileEntry.'
|
||||
returns: 'The current player count text used by this ProfileEntry.'
|
||||
type:
|
||||
name: 'String'
|
||||
type: 'object'
|
||||
- name: 'favicon'
|
||||
description: |
|
||||
Gets the currently set favicon of this ProfileEntry.<br>
|
||||
Note that the favicon usually is and supports one of the following options:
|
||||
<ul>
|
||||
<li>URL to a valid PNG file</li>
|
||||
<li>File name (with <code>.png</code> extension) matching a file saved in the favicons folder of AdvancedServerList</li>
|
||||
<li><code>${player uuid}</code> to display the avatar of the player</li>
|
||||
</ul>
|
||||
returns: 'The current favicon used by this ProfileEntry.'
|
||||
type:
|
||||
name: 'String'
|
||||
type: 'object'
|
||||
- name: 'hidePlayersEnabled'
|
||||
description: |
|
||||
Whether the player count should be hidden or not in this ProfileEntry.<br>
|
||||
To get the actual boolean value, append <a href="../../objects/nullbool/#getordefault()"><code>getOrDefault(boolean)</code></a>.
|
||||
returns: 'Whether the player count should be hidden or not in this ProfileEntry.'
|
||||
type:
|
||||
name: 'NullBool'
|
||||
type: 'object'
|
||||
link: '../../objects/nullbool/'
|
||||
- name: 'extraPlayersEnabled'
|
||||
description: |
|
||||
Whether the extra players feature should be used or not in this ProfileEntry.<br>
|
||||
To get the actual boolean value, append <a href="../../objects/nullbool/#getordefault()"><code>getOrDefault(boolean)</code></a>.
|
||||
returns: 'Whether the extra players feature should be used or not in this ProfileEntry.'
|
||||
type:
|
||||
name: 'NullBool'
|
||||
type: 'object'
|
||||
link: '../../objects/nullbool/'
|
||||
- name: 'extraPlayersCount'
|
||||
description: 'Gets the currently set number of extra players to use by this ProfileEntry. May be <code>null</code>.'
|
||||
returns: 'Possibly-null integer number of extra players used by this ProfileEntry.'
|
||||
attributes:
|
||||
- nullable
|
||||
type:
|
||||
name: 'Integer'
|
||||
type: 'object'
|
||||
- name: 'isInvalid'
|
||||
description: |
|
||||
Whether this ProfileEntry is considered invalid or not.<br>
|
||||
The ProfileEntry is considered invalid if all the following is true:
|
||||
<ul>
|
||||
<li><a href="#motd()"><code>motd()</code></a> is empty.</li>
|
||||
<li><a href="#players()"><code>players()</code></a> is empty.</li>
|
||||
<li><a href="#playercounttext()"><code>playerCountText()</code></a> is null/empty <b>and</b> <a href="#hideplayersenabled()"><code>hidePlayersEnabled()</code></a> is <code>false</code>.</li>
|
||||
<li><a href="#favicon()"><code>favicon()</code></a> is null/empty.</li>
|
||||
</ul>
|
||||
As long as one of the above is <b>not</b> true is this ProfileEntry considered valid and <code>false</code> will be returned.
|
||||
returns: 'Whether this ProfileEntry is invalid or not.'
|
||||
type:
|
||||
name: 'boolean'
|
||||
type: 'primitive'
|
||||
---
|
||||
|
||||
# <api__record></api__record> ProfileEntry
|
||||
|
||||
This record represents the content found in a server list profile YAML file.
|
||||
The content may come from either the "profiles" list, the options in the file itself (global options) or a mix of both.
|
||||
|
||||
This class is immutable. Use [`builder()`](#builder()) to get a [`Builder` instance](builder.md) with the values of this class added.
|
||||
@@ -0,0 +1,7 @@
|
||||
# API Module
|
||||
|
||||
The `api` module is the main part of the AdvancedServerList API. It contains all necessary classes and methods you would want to use to interact with AdvancedServerList.
|
||||
|
||||
## Module Structure
|
||||
|
||||
{nav}
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
icon: octicons/file-code-24
|
||||
---
|
||||
|
||||
# API Reference
|
||||
|
||||
This page contains the various classes and methods that the AdvancedServerList API provides to you for use.
|
||||
Please note that while the nav and page content is auto-generated, the data used for the page content is not. So information may be out of date.
|
||||
|
||||
## API Structure
|
||||
|
||||
{nav}
|
||||
@@ -0,0 +1,3 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api.bukkit: ch.andre601.advancedserverlist.api.bukkit
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PreServerListSetEvent'
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
type: ProfileEntry
|
||||
|
||||
methods:
|
||||
- name: 'getHandlerList'
|
||||
returns: 'Static <code>HandlerList</code> instance.'
|
||||
attributes:
|
||||
- static
|
||||
type:
|
||||
name: 'HandlerList'
|
||||
type: 'object'
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.events.GenericServerListEvent':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/events/genericserverlistevent/'
|
||||
list:
|
||||
- 'getEntry()'
|
||||
- 'setEntry(ProfileEntry)'
|
||||
- 'isCancelled()'
|
||||
- 'setCancelled(boolean)'
|
||||
'org.bukkit.event.Event':
|
||||
link: 'https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/Event.html'
|
||||
list:
|
||||
- 'getHandlers()'
|
||||
---
|
||||
|
||||
# <api__class></api__class> PreServerListSetEvent
|
||||
|
||||
Called **before** AdvancedServerList modifies the server list.
|
||||
The provided [`ProfileEntry`](../../../api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#getentry()) will be the one used for the server list.
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getPlayer'
|
||||
description: 'Gives the OfflinePlayer embedded in this BukkitPlayer.'
|
||||
returns: 'OfflinePlayer instance'
|
||||
type:
|
||||
name: 'OfflinePlayer'
|
||||
type: 'object'
|
||||
- name: 'hasPlayedBefore'
|
||||
description: |
|
||||
Returns whether this player has played on the server before.<br>
|
||||
<br>
|
||||
The returned boolean may be inaccurate if AdvancedServerList was unable to obtain a valid OfflinePlayer instance.
|
||||
returns: 'Boolean indicating whether this player has played on the server before.'
|
||||
type:
|
||||
name: 'boolean'
|
||||
- name: 'isBanned'
|
||||
description: |
|
||||
Returns whether this player has been banned from the server.<br>
|
||||
<br>
|
||||
The returned boolean may be inaccurate if AdvancedServerList was unable to obtain a valid OfflinePlayer instance.
|
||||
returns: 'Boolean indicating whether this player has been banned from the server.'
|
||||
type:
|
||||
name: 'boolean'
|
||||
- name: 'isWhitelisted'
|
||||
description: |
|
||||
Returns whether this player is whitelisted on the server.<br>
|
||||
<br>
|
||||
The returned boolean may be inaccurate if AdvancedServerList was unable to obtain a valid OfflinePlayer instance.
|
||||
returns: 'Boolean indicating whether this player is whitelisted on the server.'
|
||||
type:
|
||||
name: 'boolean'
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.objects.GenericPlayer':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer/'
|
||||
list:
|
||||
- 'getName()'
|
||||
- 'getProtocol()'
|
||||
- 'getUUID()'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> BukkitPlayer
|
||||
|
||||
[`GenericPlayer` instance](../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer.md) for the SpigotMC/Paper server implementation of AdvancedServerList.
|
||||
This interface includes a [`OfflinePlayer` instance](#getplayer()) obtained from the server the plugin runs on alongside some getters to get if the player [has played on the server before](#hasplayedbefore()), [is banned](#isbanned()) or [is whitelisted](#iswhitelisted()). These options actually require a proper OfflinePlayer instance to be present or will otherwise default to `false`.
|
||||
|
||||
This class is useful for cases where you want to use the OfflinePlayer. Simply cast the GenericPlayer instance to a SpigotPlayer (Granted that it actually is an instance of it to begin with).
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getWorlds'
|
||||
description: 'Returns a <code>Map<String, World></code> where the key is the name of the World and the value the world of the server.'
|
||||
returns: 'Possibly-empty Map containing pairs of Strings and Worlds.'
|
||||
type:
|
||||
name: 'Map<String, World>'
|
||||
type: 'object'
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.objects.GenericServer':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/objects/genericserver/'
|
||||
list:
|
||||
- 'getPlayersOnline()'
|
||||
- 'getPlayersMax()'
|
||||
- 'getHost()'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> BukkitServer
|
||||
|
||||
Spigot/Paper specific instance of a [`GenericServer`](../../../api/ch.andre601.advancedserverlist.api/objects/genericserver.md).
|
||||
This interface includes a [Map of Worlds](#getworlds()) the server currently has.
|
||||
|
||||
This interface is useful for cases where you want to get the worlds of the Server itself, by simply casting your GenericServer instance to a BukkitServer one. Make sure to do proper instanceof checks first before attempting to cast.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Bukkit Module
|
||||
|
||||
The `platform-bukkit` module contains classes for platform-specific things such as Server events or a Server-specific CachedPlayer instance.
|
||||
|
||||
## Module Structure
|
||||
|
||||
{nav}
|
||||
@@ -0,0 +1,3 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api.bungeecord: ch.andre601.advancedserverlist.api.bungeecord
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PreServerListSetEvent'
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
type: ProfileEntry
|
||||
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.events.GenericServerListEvent':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/events/genericserverlistevent/'
|
||||
list:
|
||||
- 'getEntry()'
|
||||
- 'setEntry(ProfileEntry)'
|
||||
- 'isCancelled()'
|
||||
- 'setCancelled(boolean)'
|
||||
---
|
||||
|
||||
# <api__class></api__class> PreServerListSetEvent
|
||||
|
||||
Called **before** AdvancedServerList modifies the server list.
|
||||
The provided [`ProfileEntry`](../../../api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#getentry()) will be the one used for the server list.
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.objects.GenericPlayer':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer/'
|
||||
list:
|
||||
- 'getName()'
|
||||
- 'getProtocol()'
|
||||
- 'getUUID()'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> BungeePlayer
|
||||
|
||||
[`GenericPlayer` instance](../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer.md) for the BungeeCord proxy implementation of AdvancedServerList.
|
||||
|
||||
To get an instance of this class from a GenericPlayer instance, simply cast it to a BungeePlayer (Granted that the GenericPlayer instance actually is a BungeePlayer instance).
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getServers'
|
||||
description: 'Returns a <code>Map<String, ServerInfo></code> where the key is the name of the server and the value the ServerInfo of the proxy.'
|
||||
returns: 'Possibly-empty Map containing pairs of Strings and ServerInfos.'
|
||||
type:
|
||||
name: 'Map<String, ServerInfo>'
|
||||
type: 'object'
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.objects.GenericServer':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/objects/genericserver/'
|
||||
list:
|
||||
- 'getPlayersOnline()'
|
||||
- 'getPlayersMax()'
|
||||
- 'getHost()'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> BungeeProxy
|
||||
@@ -0,0 +1,7 @@
|
||||
# BungeeCord Module
|
||||
|
||||
The `platform-bungeecord` module contains classes for platform-specific things such as Proxy events or a Proxy-specific CachedPlayer instance.
|
||||
|
||||
## Module Structure
|
||||
|
||||
{nav}
|
||||
@@ -0,0 +1,3 @@
|
||||
nav:
|
||||
- index.md
|
||||
- ch.andre601.advancedserverlist.api.velocity: ch.andre601.advancedserverlist.api.velocity
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
constructors:
|
||||
- name: 'PreServerListSetEvent'
|
||||
parameters:
|
||||
- name: 'entry'
|
||||
type: ProfileEntry
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.events.GenericServerListEvent':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/events/genericserverlistevent/'
|
||||
list:
|
||||
- 'getEntry()'
|
||||
- 'setEntry(ProfileEntry)'
|
||||
- 'isCancelled()'
|
||||
- 'setCancelled(boolean)'
|
||||
---
|
||||
|
||||
# <api__class></api__class> PreServerListSetEvent
|
||||
|
||||
Called **before** AdvancedServerList modifies the server list.
|
||||
The provided [`ProfileEntry`](../../../api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#getentry()) will be the one used for the server list.
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getVersion'
|
||||
description: 'Returns the <a href="../../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer/#getprotocol()">protocol version</a> of the player in a readable MC version format (i.e. 1.19.3).'
|
||||
returns: 'The readable MC version the player uses.'
|
||||
type:
|
||||
name: 'String'
|
||||
type: 'object'
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.objects.GenericPlayer':
|
||||
link: '../../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer/'
|
||||
list:
|
||||
- 'getName()'
|
||||
- 'getProtocol()'
|
||||
- 'getUUID()'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> VelocityPlayer
|
||||
|
||||
[`GenericPlayer` instance](../../../api/ch.andre601.advancedserverlist.api/objects/genericplayer.md) for the Velocity proxy implementation of AdvancedServerList.
|
||||
Provides a [`getVersion()` method](#getversion()) to get the MC version used as a readable String (i.e. 1.19.3) rather than just the protocol version.
|
||||
|
||||
To get an instance of this class from a GenericPlayer instance, simply cast it to a VelocityPlayer (Granted that the GenericPlayer instance actually is a VelocityPlayer instance).
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
template: api-doc.html
|
||||
|
||||
methods:
|
||||
- name: 'getServers'
|
||||
description: 'Returns a <code>Map<String, RegisteredServer></code> where the key is the name of the server and the value the RegisteredServer of the proxy.'
|
||||
returns: 'Possibly-empty Map containing pairs of Strings and RegisteredServers.'
|
||||
type:
|
||||
name: 'Map<String, RegisteredServer>'
|
||||
type: 'object'
|
||||
|
||||
inherits:
|
||||
'ch.andre601.advancedserverlist.api.objects.GenericServer':
|
||||
link: '../../../api/objects/genericserver/'
|
||||
list:
|
||||
- 'getPlayersOnline()'
|
||||
- 'getPlayersMax()'
|
||||
- 'getHost()'
|
||||
---
|
||||
|
||||
# <api__interface></api__interface> VelocityProxy
|
||||
@@ -0,0 +1,7 @@
|
||||
# Velocity Module
|
||||
|
||||
The `platform-velocity` module contains classes for platform-specific things such as Proxy events or a Proxy-specific CachedPlayer instance.
|
||||
|
||||
## Module Structure
|
||||
|
||||
{nav}
|
||||
@@ -0,0 +1,195 @@
|
||||
# API Reference Docs Structure
|
||||
|
||||
The Reference docs follow a specific mixture of manually created and auto-generated page content.
|
||||
|
||||
A page may look something like this:
|
||||
```markdown
|
||||
---
|
||||
constructors:
|
||||
- name: 'Constructor'
|
||||
description: 'Creates a new instance of this class.'
|
||||
|
||||
methods:
|
||||
- name: 'getString'
|
||||
description: 'Gets a String.'
|
||||
type:
|
||||
name: String
|
||||
type: object
|
||||
---
|
||||
|
||||
# <api__class></api__class> Constructor
|
||||
|
||||
An example class to show how the page structure may look like.
|
||||
```
|
||||
|
||||
## custom HTML tags
|
||||
|
||||
There is a collection of custom HTML tags that are used to render specific text in certain styles.
|
||||
Below is a list of all custom tags. Note that these tags only render on the actual site and not within the repository.
|
||||
|
||||
- `<api__class></api__class>`: <api__class></api__class>
|
||||
- `<api__interface></api__interface>`: <api__interface></api__interface>
|
||||
- `<api__enum></api__enum>`: <api__enum></api__enum>
|
||||
- `<api__record></api__record>`: <api__record></api__record>
|
||||
- `<api__abstract></api__abstract>`: <api__abstract></api__abstract>
|
||||
- `<api__static></api__static>`: <api__static></api__static>
|
||||
- `<api__final></api__final>`: <api__final></api__final>
|
||||
- `<api__notnull></api__notnull>`: <api__notnull></api__notnull>
|
||||
- `<api__nullable></api__nullable>`: <api__nullable></api__nullable>
|
||||
|
||||
In addition are there two classes used within `span` tags to colour the text, to indicate their type:
|
||||
|
||||
- `<span class="api-type__object">Object</span>`: <span class="api-type__object">Object</span>
|
||||
- `<span class="api-type__primitive">Object</span>`: <span class="api-type__primitive">Primitive</span>
|
||||
|
||||
## Auto-generated content
|
||||
|
||||
The page template used checks for specific YAML frontmatter in the page to include other templates.
|
||||
These templates pull the data from the YAML frontmatter to generate the page content which is then appendet to the already existing page content.
|
||||
|
||||
There are 5 frontmatter options, each following a specific structure:
|
||||
|
||||
- [`Constructors`](#constructors)
|
||||
- [`Nested Classes`](#nested-classes)
|
||||
- [`Enum Constants`](#enum constants)
|
||||
- [`Methods`](#methods)
|
||||
- [`Inherits`](#inherits)
|
||||
|
||||
### Constructors
|
||||
|
||||
```yaml
|
||||
constructors:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
parameters:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
type: '<string>'
|
||||
attributes:
|
||||
- '<string>'
|
||||
throws:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
seealos:
|
||||
- name: '<string>'
|
||||
link: '<string>'
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `name` - The name to display for the Constructor summary and detail. This should include any parameters the Constructor has, but without any parameter name.
|
||||
- `description` - The description to display for the Constructor.
|
||||
- `parameters` - List of parameters to display.
|
||||
- `name` - Name of the parameter to display.
|
||||
- `description` - Description of the parameter.
|
||||
- `type` - The type this parameter is.
|
||||
- `attributes` - List of attributes (i.e. nullability) to display. The provided values will be turned into `<api__{name}></api__{name}>` tags that will be prependet to the parameter name.
|
||||
- `throws` - List of possible throws to display.
|
||||
- `name` - Name of the throw to display.
|
||||
- `description` - Description of the throw.
|
||||
- `seealso` - List of "See also" text to display.
|
||||
- `name` - Name of the See also link.
|
||||
- `link` - Link (Relative, absolute or URL) to use for the See also text.
|
||||
|
||||
### Nested Classes
|
||||
|
||||
```yaml
|
||||
classes:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
type: '<string>'
|
||||
link: '<string>'
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `name` - The name to display for the Nested Classes Summary.
|
||||
- `description` - The description of the nested class.
|
||||
- `type` - Modifier and type of the nested class.
|
||||
- `link` - Link to the nested class.
|
||||
|
||||
### Enum Constants
|
||||
|
||||
```yaml
|
||||
enums:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
type: '<string>'
|
||||
seealso:
|
||||
- name: '<string>'
|
||||
link: '<string>'
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `name` - The name to display for the Constructor summary and detail. This should include any parameters the Constructor has, but without any parameter name.
|
||||
- `description` - The description to display for the Constructor.
|
||||
- `type` - The return type to display. Will default to `{{ page.title }}` if not set.
|
||||
- `seealso` - List of "See also" text to display.
|
||||
- `name` - Name of the See also link.
|
||||
- `link` - Link (Relative, absolute or URL) to use for the See also text.
|
||||
|
||||
### Methods
|
||||
|
||||
```yaml
|
||||
methods:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
type:
|
||||
name: '<string>'
|
||||
type: '<string>'
|
||||
link: '<string>'
|
||||
attributes:
|
||||
- '<string>'
|
||||
parameters:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
type: '<string>'
|
||||
attributes:
|
||||
- '<string>'
|
||||
returns: '<string>'
|
||||
throws:
|
||||
- name: '<string>'
|
||||
description: '<string>'
|
||||
seealos:
|
||||
- name: '<string>'
|
||||
link: '<string>'
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `name` - The name to display for the Constructor summary and detail. This should include any parameters the Constructor has, but without any parameter name.
|
||||
- `description` - The description to display for the Constructor.
|
||||
- `type` - Options for object type to display.
|
||||
- `name` - Displayed name of the object.
|
||||
- `type` - Object type. Can be either `object` or `primitive` which would be used in a class name for styling.
|
||||
- `link` - Link (Relative, absolute or URL) to use for the type name.
|
||||
- `attributes` - List of attributes (i.e. nullability) to display. The provided values will be turned into `<api__{name}></api__{name}>` tags that will be prependet to the name.
|
||||
- `parameters` - List of parameters to display.
|
||||
- `name` - Name of the parameter to display.
|
||||
- `description` - Description of the parameter.
|
||||
- `type` - The type this parameter is.
|
||||
- `attributes` - List of attributes (i.e. nullability) to display. The provided values will be turned into `<api__{name}></api__{name}>` tags that will be prependet to the parameter name.
|
||||
- `returns` - Possible return values.
|
||||
- `throws` - List of possible throws to display.
|
||||
- `name` - Name of the throw to display.
|
||||
- `description` - Description of the throw.
|
||||
- `seealso` - List of "See also" text to display.
|
||||
- `name` - Name of the See also link.
|
||||
- `link` - Link (Relative, absolute or URL) to use for the See also text.
|
||||
|
||||
### Inherits
|
||||
|
||||
```yaml
|
||||
inherits:
|
||||
'<string>':
|
||||
link: '<string>'
|
||||
methods:
|
||||
- '<string>'
|
||||
```
|
||||
|
||||
**Options:**
|
||||
|
||||
- `inherits.<string>` - Classpath used to display in the text `Methods inherited from <string>`
|
||||
- `link` - Link to use for the classpath text.
|
||||
- `methods` - List of strings to display. Each will be linked using `{link}#{method}`
|
||||
@@ -0,0 +1 @@
|
||||
hide: true
|
||||
@@ -0,0 +1,16 @@
|
||||
document$.subscribe(async () => {
|
||||
const url = 'https://codeberg-stats-proxy.vercel.app/repo'
|
||||
|
||||
const [release, repo] = await Promise.all([
|
||||
fetch(`${url}/latest-release`).then(_ => _.json()),
|
||||
fetch(`${url}/stats`).then(_ => _.json()),
|
||||
]);
|
||||
|
||||
const list = document.querySelectorAll('ul[data-md-component="codeberg-stats"]');
|
||||
|
||||
list.forEach((entry) => {
|
||||
entry.innerHTML = `<li class="md-source__fact md-source__fact--version">${release.name}</li>
|
||||
<li class="md-source__fact md-source__fact--stars">${repo.stars}</li>
|
||||
<li class="md-source__fact md-source__fact--forks">${repo.forks}</li>`
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,138 @@
|
||||
:root {
|
||||
--api-label-border-radius: .2rem;
|
||||
--api-label-padding: 0 .3em;
|
||||
|
||||
--color-border: #e9ebfc1f;
|
||||
|
||||
--color-api-fg__static: #00c853;
|
||||
--color-api-fg__final: #ff9100;
|
||||
--color-api-fg__abstract: #00bfa5;
|
||||
|
||||
--color-api-fg__annotation: #00b8d4;
|
||||
--color-api-bg__annotation: #00b8d41a;
|
||||
|
||||
--color-api-fg-type__object: #9e9e9e;
|
||||
--color-api-fg-type__primitive: #448aff;
|
||||
|
||||
--color-api-bg__static: #00c8531a;
|
||||
--color-api-bg__final: #ff91001a;
|
||||
--color-api-bg__abstract: #00bfa51a;
|
||||
}
|
||||
|
||||
/* Page design */
|
||||
.api-detail {
|
||||
border: .05rem solid var(--color-border);
|
||||
|
||||
border-bottom-left-radius: .1rem;
|
||||
border-bottom-right-radius: .1rem;
|
||||
|
||||
padding: 0 1em;
|
||||
|
||||
margin: .5em 0;
|
||||
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.api-detail h3 {
|
||||
margin: .5em 0 .8em;
|
||||
}
|
||||
|
||||
.api-detail__description {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
/* Attributes */
|
||||
|
||||
api__static::before {
|
||||
color: var(--color-api-fg__static);
|
||||
background-color: var(--color-api-bg__static);
|
||||
|
||||
border-radius: var(--api-label-border-radius);
|
||||
padding: var(--api-label-padding);
|
||||
|
||||
content: "static";
|
||||
}
|
||||
|
||||
api__final::before {
|
||||
color: var(--color-api-fg__final);
|
||||
background-color: var(--color-api-bg__final);
|
||||
|
||||
border-radius: var(--api-label-border-radius);
|
||||
padding: var(--api-label-padding);
|
||||
|
||||
content: "final";
|
||||
}
|
||||
|
||||
api__abstract::before {
|
||||
color: var(--color-api-fg__abstract);
|
||||
background-color: var(--color-api-bg__abstract);
|
||||
|
||||
border-radius: var(--api-label-border-radius);
|
||||
padding: var(--api-label-padding);
|
||||
|
||||
content: "abstract";
|
||||
}
|
||||
|
||||
/* Annotations */
|
||||
|
||||
api__notnull::before {
|
||||
color: var(--color-api-fg__annotation);
|
||||
background-color: var(--color-api-bg__annotation);
|
||||
|
||||
border-radius: var(--api-label-border-radius);
|
||||
padding: var(--api-label-padding);
|
||||
|
||||
content: "@NotNull";
|
||||
}
|
||||
|
||||
api__nullable::before {
|
||||
color: var(--color-api-fg__annotation);
|
||||
background-color: var(--color-api-bg__annotation);
|
||||
|
||||
border-radius: var(--api-label-border-radius);
|
||||
padding: var(--api-label-padding);
|
||||
|
||||
content: "@Nullable";
|
||||
}
|
||||
|
||||
/* class types */
|
||||
|
||||
api__class::before {
|
||||
color: var(--color-api-fg-type__primitive);
|
||||
font-weight: bold;
|
||||
|
||||
content: "class";
|
||||
}
|
||||
|
||||
api__interface::before {
|
||||
color: var(--color-api-fg-type__primitive);
|
||||
font-weight: bold;
|
||||
|
||||
content: "interface";
|
||||
}
|
||||
|
||||
api__enum::before {
|
||||
color: var(--color-api-fg-type__primitive);
|
||||
font-weight: bold;
|
||||
|
||||
content: "enum";
|
||||
}
|
||||
|
||||
api__record::before {
|
||||
color: var(--color-api-fg-type__primitive);
|
||||
font-weight: bold;
|
||||
|
||||
content: "record";
|
||||
}
|
||||
|
||||
/* object types */
|
||||
|
||||
.api-type__object {
|
||||
color: var(--color-api-fg-type__object);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.api-type__primitive {
|
||||
color: var(--color-api-fg-type__primitive);
|
||||
font-weight: bold;
|
||||
}
|
||||
+12
-2
@@ -1,3 +1,7 @@
|
||||
---
|
||||
icon: octicons/rel-file-path-24
|
||||
---
|
||||
|
||||
# Commands
|
||||
|
||||
The plugin adds commands to use for various things related to the plugin itself.
|
||||
@@ -17,12 +21,18 @@ The following subcommands are available (Subcommands are case-insensitive):
|
||||
|
||||
### help
|
||||
|
||||
**Permission:** `advancedserverlist.command.help`
|
||||
|
||||
Shows a list of all available [subcommands](#subcommands) for AdvancedServerList.
|
||||
|
||||
### reload
|
||||
|
||||
Reloads the plugin's `config.yml`, all available YAML files in the `profiles` folder and also clears the currently cached favicons and Players.
|
||||
**Permission:** `advancedserverlist.command.reload`
|
||||
|
||||
Reloads the plugin's `config.yml` and all available YAML files in the `profiles` folder.
|
||||
|
||||
### clearCache
|
||||
|
||||
Clears the currently cached favicons and Players.
|
||||
**Permission:** `advancedserverlist.command.clearcache`
|
||||
|
||||
Clears the currently cached favicons and players.
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
icon: octicons/list-unordered-24
|
||||
---
|
||||
|
||||
## About
|
||||
|
||||
!!! warning "The below examples may only work in v1.10.0 or newer!"
|
||||
@@ -36,8 +40,8 @@ conditions:
|
||||
- '${player protocol} < 760'
|
||||
|
||||
motd:
|
||||
- <red>You are using an outdated client!
|
||||
- <red>Please update to 1.19.1 to join.
|
||||
- '<red>You are using an outdated client!'
|
||||
- '<red>Please update to 1.19.1 to join.'
|
||||
|
||||
playerCount:
|
||||
text: '<red>Outdated Client!'
|
||||
@@ -55,8 +59,8 @@ conditions:
|
||||
- '${player protocol} < 735'
|
||||
|
||||
motd:
|
||||
- <grey>Welcome to <aqua>YourServer.com</aqua>!
|
||||
- <grey>Enjoy your stay.
|
||||
- '<grey>Welcome to <aqua>YourServer.com</aqua>!'
|
||||
- '<grey>Enjoy your stay.'
|
||||
```
|
||||
|
||||
----
|
||||
@@ -77,8 +81,8 @@ conditions:
|
||||
- '${player isBanned} = true'
|
||||
|
||||
motd:
|
||||
- <red>You have been <bold>BANNED</bold>!
|
||||
- <red>Go away.
|
||||
- '<red>You have been <bold>BANNED</bold>!'
|
||||
- '<red>Go away.'
|
||||
|
||||
# Don't show the player count to the banned player.
|
||||
playerCount:
|
||||
@@ -101,8 +105,8 @@ conditions:
|
||||
- '${server host} = other.example.com'
|
||||
|
||||
motd:
|
||||
- <grey>Please use <aqua>mc.example.com
|
||||
- <grey>to join our server.
|
||||
- '<grey>Please use <aqua>mc.example.com'
|
||||
- '<grey>to join our server.'
|
||||
```
|
||||
|
||||
### Different profile for known player
|
||||
@@ -116,8 +120,8 @@ conditions:
|
||||
- `${player name} != Anonymous` # "Anonymous" should be replaced with whatever you use in 'unknown_player'
|
||||
|
||||
motd:
|
||||
- <grey>Hello there <aqua>${player name}</aqua>!
|
||||
- <grey>It's nice to see you again.
|
||||
- '<grey>Hello there <aqua>${player name}</aqua>!'
|
||||
- '<grey>It's nice to see you again.'
|
||||
|
||||
playerCount:
|
||||
hover:
|
||||
+16
-7
@@ -1,9 +1,13 @@
|
||||
---
|
||||
icon: octicons/home-24
|
||||
---
|
||||
|
||||
# AdvancedServerList Wiki
|
||||
|
||||
Welcome to the Wiki of AdvancedServerList!
|
||||
|
||||
On this site can you find the latest documentation for the plugin, including some useful examples.
|
||||
If you're new to the plugin is it recommended to check out the [Profiles page](./profiles) for a quick start on how to use this plugin.
|
||||
If you're new to the plugin is it recommended to check out the [Profiles page](profiles/index.md) for a quick start on how to use this plugin.
|
||||
|
||||
## Platforms
|
||||
|
||||
@@ -25,12 +29,17 @@ AdvancedServerList supports the following platforms:
|
||||
|
||||
## Pages
|
||||
|
||||
- [Profiles](./profiles)
|
||||
- [Formatting](./profiles/formatting)
|
||||
- [Placeholders](./profiles/placeholders)
|
||||
- [API](./api)
|
||||
- [Examples](./examples)
|
||||
- [PlaceholderAPI placeholders](./placeholderapi.md)
|
||||
- [Profiles](profiles/index.md)
|
||||
- [Formatting](profiles/formatting.md)
|
||||
- [Placeholders](profiles/placeholders.md)
|
||||
- [API](api/index.md)
|
||||
- [Changelog](api/changelog.md)
|
||||
- [Reference](api/reference/index.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)
|
||||
- [PlaceholderAPI](placeholderapi/index.md)
|
||||
|
||||
[spigot]: https://www.spigotmc.org
|
||||
[paper]: https://papermc.io
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
icon: octicons/file-directory-symlink-24
|
||||
---
|
||||
|
||||
# Migration
|
||||
|
||||
This page lists all migration guides for specific AdvancedServerList versions.
|
||||
|
||||
Note that these pages only cover server list profile files. The config.yml is automatically being migrated (Feature since v3.1.0).
|
||||
|
||||
## Pages
|
||||
|
||||
{nav}
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
icon: octicons/arrow-right-24
|
||||
---
|
||||
|
||||
# v1.5.3 to v1.6.0
|
||||
|
||||
v1.6.0 has some structural changes to the server list profile that requires you to do some updates on your files.
|
||||
|
||||
## Migration
|
||||
|
||||
The migration should be fairly simple. [An example](#example) is available to look at.
|
||||
|
||||
- `playerCount` is no longer a String but has been turned into a section containing the `hidePlayers` option and the following renamed options:
|
||||
- `players` -\> `hover`
|
||||
- `playerCount` -\> `text`
|
||||
- `xMore` has been removed. There is now a new section called `extraPlayers` in the `playerCount` section as a replacement.
|
||||
It contains the following options:
|
||||
- `enabled` - to enable/disable the feature.
|
||||
- `amount` - This is the former `xMore` option. Difference is, that it also allows negative numbers.
|
||||
|
||||
## Example
|
||||
|
||||
Here is a before and after example to help visualize the change:
|
||||
|
||||
=== "Before"
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
motd:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
|
||||
favicon: '${player name}'
|
||||
|
||||
hidePlayers: false
|
||||
|
||||
players:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
- 'Line 3'
|
||||
|
||||
playerCount: '<grey>Hover Me!'
|
||||
|
||||
xMore: 1
|
||||
```
|
||||
=== "After"
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
motd:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
|
||||
favicon: '${player name}'
|
||||
|
||||
playerCount:
|
||||
hidePlayers: false
|
||||
|
||||
hover:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
- 'Line 3'
|
||||
|
||||
text: '<grey>Hover Me!'
|
||||
|
||||
extraPlayers:
|
||||
enabled: true
|
||||
amount: 1
|
||||
```
|
||||
=== "Diff view"
|
||||
```diff
|
||||
priority: 0
|
||||
|
||||
motd:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
|
||||
favicon: '${player name}'
|
||||
|
||||
-hidePlayers: false
|
||||
-
|
||||
-players:
|
||||
- - 'Line 1'
|
||||
- - 'Line 2'
|
||||
- - 'Line 3'
|
||||
-
|
||||
-playerCount: '<grey>Hover Me!'
|
||||
-
|
||||
-xMore: 1
|
||||
+playerCount:
|
||||
+ hidePlayers: false
|
||||
+
|
||||
+ hover:
|
||||
+ - 'Line 1'
|
||||
+ - 'Line 2'
|
||||
+ - 'Line 3'
|
||||
+
|
||||
+ text: '<grey>Hover Me!'
|
||||
+
|
||||
+ extraPlayers:
|
||||
+ enabled: true
|
||||
+ amount: 1
|
||||
```
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
icon: octicons/arrow-right-24
|
||||
---
|
||||
|
||||
# v1.9.0 to v1.10.0
|
||||
|
||||
v1.9.0 introduced a `motds` option to define multiple MOTDs to use.
|
||||
However, this option has been removed just one update later in v1.10.0, meaning any server list profile using the `motds` option will no longer work as expected.
|
||||
|
||||
## Migration
|
||||
|
||||
To migrate all you have to do is use the new `profiles` option and add separate List entries with a `motd` option.
|
||||
|
||||
## Example
|
||||
|
||||
Here is a before and after example to help visualize the change:
|
||||
|
||||
=== "Before"
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
motds:
|
||||
- |-
|
||||
Line 1
|
||||
Line 2
|
||||
- |-
|
||||
Line A
|
||||
Line B
|
||||
|
||||
favicon: '${player name}'
|
||||
|
||||
playerCount:
|
||||
hidePlayers: false
|
||||
players:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
- 'Line 3'
|
||||
text: '<grey>Hover Me!'
|
||||
extraPlayers:
|
||||
enabled: false
|
||||
amount: 0
|
||||
```
|
||||
=== "After"
|
||||
```yaml
|
||||
priority: 0
|
||||
|
||||
profiles:
|
||||
# You can also use motd: ['Line 1', 'Line 2']
|
||||
- motd:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
# You can also use motd: ['Line A', 'Line B']
|
||||
- motd:
|
||||
- 'Line A'
|
||||
- 'Line B'
|
||||
|
||||
favicon: '${player name}'
|
||||
|
||||
playerCount:
|
||||
hidePlayers: false
|
||||
players:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
- 'Line 3'
|
||||
text: '<grey>Hover Me!'
|
||||
extraPlayers:
|
||||
enabled: false
|
||||
amount: 0
|
||||
```
|
||||
=== "Diff view"
|
||||
```diff
|
||||
priority: 0
|
||||
|
||||
-motds:
|
||||
- - |-
|
||||
- Line 1
|
||||
- Line 2
|
||||
- - |-
|
||||
- Line A
|
||||
- Line B
|
||||
+profiles:
|
||||
+ # You can also use motd: ['Line 1', 'Line 2']
|
||||
+ - motd:
|
||||
+ - 'Line 1'
|
||||
+ - 'Line 2'
|
||||
+ # You can also use motd: ['Line A', 'Line B']
|
||||
+ - motd:
|
||||
+ - 'Line A'
|
||||
+ - 'Line B'
|
||||
|
||||
favicon: '${player name}'
|
||||
|
||||
playerCount:
|
||||
hidePlayers: false
|
||||
players:
|
||||
- 'Line 1'
|
||||
- 'Line 2'
|
||||
- 'Line 3'
|
||||
text: '<grey>Hover Me!'
|
||||
extraPlayers:
|
||||
enabled: false
|
||||
amount: 0
|
||||
```
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
icon: material/percent
|
||||
---
|
||||
|
||||
# PlaceholderAPI Placeholders
|
||||
|
||||
The Spigot and Paper version of AdvancedServerList provide their own set of placeholders to use through [PlaceholderAPI].
|
||||
+26
-20
@@ -1,27 +1,32 @@
|
||||
---
|
||||
icon: octicons/pencil-24
|
||||
---
|
||||
|
||||
# Formatting
|
||||
|
||||
All text options with exception of [`Conditions`](../#conditions) allow the usage of formatting options using [MiniMessage].
|
||||
|
||||
!!! warning "IMPORTANT"
|
||||
Whenever your text starts with a colour or formatting code (`<aqua>`, `<blue>`, `<bold>`, `<italic>`, etc.) should it be surrounded with single or double quotes.
|
||||
Not doing so will cause the YAML parses used - Configurate - to not see the value as a String, but something else, causing exceptions to appear.
|
||||
|
||||
```yaml title="Wrong formatting"
|
||||
motd:
|
||||
- <red>This will cause
|
||||
- <red>Errors
|
||||
```
|
||||
|
||||
```yaml title="Right formatting"
|
||||
motd:
|
||||
- '<green>This will be formatted'
|
||||
- '<green>properly.'
|
||||
```
|
||||
All text options, with exception of [`Conditions`](../index.md#conditions), allow the usage of formatting options using [MiniMessage].
|
||||
|
||||
!!! info "Online Tool"
|
||||
The devs of the Adventure library provide a handy online tool to create the right formatting codes to display the text properly.
|
||||
You can find the tool at https://webui.advntr.dev/
|
||||
|
||||
## Before starting
|
||||
|
||||
Please make sure to surround your text with either single quotes (`'`) or double quotes (`"`) should they start with a color or formatting code.
|
||||
Not surrounding these lines with (double) quotes will make the YAML parser Configurate treat them as something other than a String.
|
||||
|
||||
```yaml title="Wrong formatting"
|
||||
motd:
|
||||
- <red>This will cause
|
||||
- <red>Errors
|
||||
```
|
||||
|
||||
```yaml title="Right formatting"
|
||||
motd:
|
||||
- '<green>This will be formatted'
|
||||
- '<green>properly.'
|
||||
```
|
||||
|
||||
## Unsupported options
|
||||
|
||||
The following options are **not** supported, no matter what option they are used in:
|
||||
@@ -32,10 +37,11 @@ The following options are **not** supported, no matter what option they are used
|
||||
|
||||
## Colors
|
||||
|
||||
Normal text colours such as `<aqua>` or `<red>` can be used in all text options.
|
||||
Color options (`<aqua>`, `<red>`, `<gray>`, etc.) are available for all text options.
|
||||
24-Bit HEX colors (`<#ff0000>`, `<#123abc>`, etc.) are only available for the [`Motd` option](../index.md#motd) for a 1.16+ Server/Proxy.
|
||||
|
||||
## HEX Colours
|
||||
## Formatting
|
||||
|
||||
24-Bit HEX colours such as `<#ffffff>` can be used in the [`Motd`](../#motd) option on 1.16+ servers/proxies.
|
||||
Formatting options (`<bold>`, `<italic>`, etc.) are available for all text options.
|
||||
|
||||
[MiniMessage]: https://docs.adventure.kyori.net/minimessage/index.html
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
icon: octicons/note-24
|
||||
---
|
||||
|
||||
# Profiles
|
||||
|
||||
AdvancedServerList allows the creation of multiple profiles.
|
||||
@@ -25,7 +29,7 @@ This means that a profile with no conditions and a priority of `1` will be used
|
||||
## Conditions
|
||||
|
||||
A list of conditions can be set that need to be met in order to have this profile shown to the player.
|
||||
[Placeholders](./formatting#placeholders) can be used to further customize the conditions (PlaceholderAPI placeholders are **not** supported).
|
||||
[Placeholders](formatting.md#placeholders) can be used to further customize the conditions (PlaceholderAPI placeholders are **not** supported).
|
||||
|
||||
Only when **all** conditions defined return true will the profile be displayed.
|
||||
|
||||
@@ -48,7 +52,9 @@ The following operants are available and can be used in the conditions.
|
||||
| `~=` | Checks if the left value is equal to the right one, ignoring case. |
|
||||
| `!~` | Checks if the left value is not equal to the right one, ignoring case. |
|
||||
|
||||
[^1]: In the case of the provided value not being a number will the plugin instead use the text length to compare with.
|
||||
[^1]:
|
||||
Should the provided value not be a number, will AdvancedServerList use the text length to compare.
|
||||
Example: `SomeString > String` would be translated to `10 > 6`.
|
||||
|
||||
## Profiles
|
||||
|
||||
@@ -190,7 +196,7 @@ You can either remove this option or set to an empty list (`hover: []`) to not o
|
||||
### Text
|
||||
|
||||
This option allows to override the text usually displaying the online players and total players that can join.
|
||||
Note that AdvancedServerList will not add the `<online>/<max>` text to the player count. Instead will you need to use [`${server playersOnline}`](./placeholders#server) and [`${server playersMax}`](./placeholders#server) respectively.
|
||||
Note that AdvancedServerList will not add the `<online>/<max>` text to the player count. Instead will you need to use [`${server playersOnline}`](placeholders.md#server) and [`${server playersMax}`](placeholders.md#server)
|
||||
|
||||
!!! info "Note"
|
||||
This feature works by changing the "outdated server" message followed by altering the protocol version of the server.
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
---
|
||||
icon: material/percent
|
||||
---
|
||||
|
||||
# Placeholders
|
||||
|
||||
AdvancedServerList provides a set of pre-made placeholders using the `${<identifier> <placeholder>}` format adobted from BungeeTabListPlus.
|
||||
It also has built-in [PlaceholderAPI support](#placeholderapi) for Spigot and Paper Servers and since v2 can even allow you to [add your own placeholders](#custom-placeholders) by using its [API](../../api).
|
||||
It also has built-in [PlaceholderAPI support](#placeholderapi) for Spigot and Paper Servers and since v2 can even allow you to [add your own placeholders](#custom-placeholders) by using its [API](../api/index.md).
|
||||
|
||||
## Built-in Placeholders
|
||||
|
||||
@@ -42,8 +46,8 @@ These placeholders use values given by the server/proxy AdvancedServerList runs
|
||||
An space-separated list of worlds (Spigot/Paper) or Servers (BungeeCord/Velocity) can be provided to display the number of players in these worlds/servers.
|
||||
Example: `${server playersOnline lobby1 lobby2}` will display the numbers of players online on the servers `lobby1` and `lobby2`.
|
||||
[^5]:
|
||||
When the [`amount` option](../#amount) is used will this placeholder display the modified max players count.
|
||||
The only exception is [`conditions`](../#conditions) where it uses the actual max players of the server/proxy.
|
||||
When the [`amount` option](../index.md#amount) is used will this placeholder display the modified max players count.
|
||||
The only exception is [`conditions`](../index.md#conditions) where it uses the actual max players of the server/proxy.
|
||||
[^6]:
|
||||
An optional server name can be provided to display the IP/Domain associated with that server. Only works on BungeeCord/Velocity.
|
||||
Example: `${server host survival}` would display the IP/Domain associated with the `survival` server.
|
||||
@@ -60,4 +64,4 @@ Depending on the placeholder used is a cached player required (i.e. `%player_nam
|
||||
Since version 2 of AdvancedServerList are developers able to provide their own placeholders to be used in a server list profile.
|
||||
The format follows the same one as the [built-in placeholders](#built-in-placeholders), meaning it is `${<identifier> <placeholder>}`.
|
||||
|
||||
If you're a developer and want to integrate your own placeholders into AdvancedServerList, read about it [here](../../api).
|
||||
If you're a developer and want to integrate your own placeholders into AdvancedServerList, read about it [here](../api/index.md).
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.hangaruploader;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public record VersionUpload(String version, Map<Platform, List<PluginDependency>> pluginDependencies,
|
||||
Map<Platform, List<String>> platformDependencies, String description,
|
||||
List<MultipartFileOrUrl> files, String channel){
|
||||
|
||||
public record Namespace(String owner, String slug){
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.owner + "/" + this.slug;
|
||||
}
|
||||
}
|
||||
|
||||
public record PluginDependency(String name, boolean required, Namespace namespace, String externalUrl){
|
||||
|
||||
public PluginDependency{
|
||||
if(namespace == null && externalUrl == null)
|
||||
throw new IllegalStateException("Either a Hangar Namespace or an external URL needs to be defined.");
|
||||
}
|
||||
|
||||
public static PluginDependency createWithHangarNamespace(String name, boolean required, Namespace namespace){
|
||||
return new PluginDependency(name, required, namespace, null);
|
||||
}
|
||||
|
||||
public static PluginDependency createWithExternalUrl(String name, boolean required, String externalUrl){
|
||||
return new PluginDependency(name, required, null, externalUrl);
|
||||
}
|
||||
}
|
||||
|
||||
public record MultipartFileOrUrl(List<Platform> platforms, String externalUrl){}
|
||||
|
||||
public enum Platform{
|
||||
PAPER,
|
||||
WATERFALL,
|
||||
VELOCITY
|
||||
}
|
||||
}
|
||||
+86
-34
@@ -1,30 +1,79 @@
|
||||
site_name: AdvancedServerList Wiki
|
||||
site_description: 'Wiki for the AdvancedServerList plugin'
|
||||
site_author: 'Andre_601'
|
||||
site_url: 'https://www.andre601.ch/AdvancedServerList' # Uncomment to set a canonical URL
|
||||
site_url: 'https://asl.andre601.ch'
|
||||
|
||||
copyright: |
|
||||
© Andre_601
|
||||
Images © Andre_601<br>
|
||||
Docs licensed under <a href="https://codeberg.org/Andre601/AdvancedServerList/src/branch/master/LICENSE" target="_blank" rel="noopener noreferrer noopener">MIT</a>
|
||||
|
||||
docs_dir: docs/
|
||||
|
||||
repo_name: Andre601/AdvancedServerList
|
||||
repo_url: https://github.com/Andre601/AdvancedServerList
|
||||
repo_url: https://codeberg.org/Andre601/AdvancedServerList
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Profiles:
|
||||
- profiles/index.md
|
||||
- Formatting: profiles/formatting.md
|
||||
- Placeholders: profiles/placeholders.md
|
||||
- API:
|
||||
- api/index.md
|
||||
- Changelog: api/changelog.md
|
||||
- Examples: examples.md
|
||||
- PlaceholderAPI: placeholderapi.md
|
||||
not_in_nav: api/reference/structure.md
|
||||
|
||||
#nav:
|
||||
# - Home:
|
||||
# - index.md
|
||||
# - Commands: commands.md
|
||||
# - Profiles:
|
||||
# - profiles/index.md
|
||||
# - Formatting: profiles/formatting.md
|
||||
# - Placeholders: profiles/placeholders.md
|
||||
# - API:
|
||||
# - api/index.md
|
||||
# - Changelog: api/changelog.md
|
||||
# - Reference:
|
||||
# - api/reference/index.md
|
||||
# - api:
|
||||
# - api/reference/api/index.md
|
||||
# - events:
|
||||
# - GenericServerListEvent: api/reference/api/events/genericserverlistevent.md
|
||||
# - exceptions:
|
||||
# - InvalidPlaceholderProviderException: api/reference/api/exceptions/invalidplaceholderproviderexception.md
|
||||
# - objects:
|
||||
# - GenericPlayer: api/reference/api/objects/genericplayer.md
|
||||
# - GenericServer: api/reference/api/objects/genericserver.md
|
||||
# - NullBool: api/reference/api/objects/nullbool.md
|
||||
# - profiles:
|
||||
# - ProfileEntry:
|
||||
# - api/reference/api/profiles/profileentry/index.md
|
||||
# - Builder: api/reference/api/profiles/profileentry/builder.md
|
||||
# - AdvancedServerListAPI: api/reference/api/advancedserverlistapi.md
|
||||
# - PlaceholderProvider: api/reference/api/placeholderprovider.md
|
||||
# - platform-bukkit:
|
||||
# - api/reference/platform-bukkit/index.md
|
||||
# - events:
|
||||
# - PreServerListSetEvent: api/reference/platform-bukkit/events/preserverlistsetevent.md
|
||||
# - objects:
|
||||
# - BukkitPlayer: api/reference/platform-bukkit/objects/bukkitplayer.md
|
||||
# - BukkitServer: api/reference/platform-bukkit/objects/bukkitserver.md
|
||||
# - platform-bungeecord:
|
||||
# - api/reference/platform-bungeecord/index.md
|
||||
# - events:
|
||||
# - PreServerListSetEvent: api/reference/platform-bungeecord/events/preserverlistsetevent.md
|
||||
# - objects:
|
||||
# - BungeePlayer: api/reference/platform-bungeecord/objects/bungeeplayer.md
|
||||
# - BungeeProxy: api/reference/platform-bungeecord/objects/bungeeproxy.md
|
||||
# - platform-velocity:
|
||||
# - api/reference/platform-velocity/index.md
|
||||
# - events:
|
||||
# - PreServerListSetEvent: api/reference/platform-velocity/events/preserverlistsetevent.md
|
||||
# - objects:
|
||||
# - VelocityPlayer: api/reference/platform-velocity/objects/velocityplayer.md
|
||||
# - VelocityProxy: api/reference/platform-velocity/objects/velocityproxy.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
|
||||
# - Examples: examples/index.md
|
||||
# - PlaceholderAPI: placeholderapi/index.md
|
||||
|
||||
theme:
|
||||
name: 'material'
|
||||
custom_dir: 'docs/.overrides'
|
||||
favicon: 'assets/images/favicon.png'
|
||||
logo: 'assets/images/favicon.png'
|
||||
palette:
|
||||
@@ -38,37 +87,39 @@ theme:
|
||||
- content.code.copy
|
||||
|
||||
icon:
|
||||
repo: 'octicons/mark-github-16'
|
||||
repo: 'simple/codeberg'
|
||||
admonition:
|
||||
note: 'octicons/tag-16'
|
||||
abstract: 'octicons/checklist-16'
|
||||
info: 'octicons/info-16'
|
||||
tip: 'octicons/squirrel-16'
|
||||
success: 'octicons/check-16'
|
||||
question: 'octicons/question-16'
|
||||
warning: 'octicons/alert-16'
|
||||
failure: 'octicons/x-circle-16'
|
||||
danger: 'octicons/zap-16'
|
||||
bug: 'octicons/bug-16'
|
||||
example: 'octicons/beaker-16'
|
||||
quote: 'octicons/quote-16'
|
||||
note: 'octicons/tag-24'
|
||||
abstract: 'octicons/checklist-24'
|
||||
info: 'octicons/info-24'
|
||||
tip: 'octicons/squirrel-24'
|
||||
success: 'octicons/check-24'
|
||||
question: 'octicons/question-24'
|
||||
warning: 'octicons/alert-24'
|
||||
failure: 'octicons/x-circle-24'
|
||||
danger: 'octicons/zap-24'
|
||||
bug: 'octicons/bug-24'
|
||||
example: 'octicons/beaker-24'
|
||||
quote: 'octicons/quote-24'
|
||||
|
||||
extra_css:
|
||||
- assets/stylesheets/custom.css
|
||||
- assets/stylesheets/api-docs.css
|
||||
|
||||
extra_javascript:
|
||||
- assets/js/repo-stats.js
|
||||
|
||||
extra:
|
||||
social:
|
||||
- icon: 'fontawesome/brands/github'
|
||||
link: 'https://github.com/Andre601/asl-wiki'
|
||||
version:
|
||||
provider: 'mike'
|
||||
default:
|
||||
- latest
|
||||
- dev
|
||||
- icon: 'simple/codeberg'
|
||||
link: 'https://codeberg.org/Andre601/AdvancedServerList'
|
||||
|
||||
plugins:
|
||||
- search
|
||||
- glightbox
|
||||
- awesome-pages:
|
||||
filename: .pages.yml
|
||||
- pagenav-generator
|
||||
|
||||
markdown_extensions:
|
||||
- markdown.extensions.admonition:
|
||||
@@ -76,6 +127,7 @@ markdown_extensions:
|
||||
permalink: true
|
||||
- markdown.extensions.attr_list:
|
||||
- markdown.extensions.footnotes:
|
||||
- markdown.extensions.md_in_html:
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.commit/>
|
||||
|
||||
<plugin.version>3.3.0</plugin.version>
|
||||
<plugin.version>3.4.0</plugin.version>
|
||||
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
|
||||
|
||||
<api.version>v3.0.0</api.version>
|
||||
@@ -47,20 +47,6 @@
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>gh-actions</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.COMMIT_SHA</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<project.build.commit>_${env.COMMIT_SHA}</project.build.commit>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack</id>
|
||||
@@ -73,6 +59,6 @@
|
||||
<module>bungeecord</module>
|
||||
<module>bukkit</module>
|
||||
<module>velocity</module>
|
||||
<module>hangar-uploader</module>
|
||||
<module>version-uploader</module>
|
||||
</modules>
|
||||
</project>
|
||||
+4
-2
@@ -1,2 +1,4 @@
|
||||
mkdocs-material==9.1.21
|
||||
mkdocs-glightbox==0.3.4
|
||||
mkdocs-material==9.2.8
|
||||
mkdocs-glightbox==0.3.4
|
||||
mkdocs-awesome-pages-plugin==2.9.2
|
||||
git+https://github.com/Andre601/mkdocs-pagenav-generator
|
||||
+1
-1
@@ -90,7 +90,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>AdvancedServerList-Velocity-${plugin.version}${project.build.commit}</finalName>
|
||||
<finalName>AdvancedServerList-Velocity-${plugin.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
|
||||
+8
@@ -132,6 +132,14 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
|
||||
return protocol == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenanceModeActive(){
|
||||
if(!plugin.getProxy().getPluginManager().isLoaded("maintenance"))
|
||||
return false;
|
||||
|
||||
return PingEventHandler.getMaintenanceUtil().isMaintenanceEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtocolVersion(){
|
||||
return protocol.getProtocol();
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
{
|
||||
"id": "papiproxybridge",
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": "maintenance",
|
||||
"optional": true
|
||||
}
|
||||
],
|
||||
"main": "ch.andre601.advancedserverlist.velocity.VelocityCore"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<version>parent</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hangar-uploader</artifactId>
|
||||
<artifactId>version-uploader</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
@@ -61,10 +61,22 @@
|
||||
<version>5.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.masecla</groupId>
|
||||
<artifactId>Modrinth4J</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.11.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>HangarUploader</finalName>
|
||||
<finalName>VersionUploader</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -83,7 +95,7 @@
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
<mainClass>ch.andre601.advancedserverlist.hangaruploader.HangarUploader</mainClass>
|
||||
<mainClass>ch.andre601.advancedserverlist.versionuploader.VersionUploader</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public record CodebergRelease(long id, @SerializedName("tag_name") String tagName, String body, boolean prerelease){}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CodebergReleaseFetcher{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CodebergReleaseFetcher.class);
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final Type LIST_TYPE = new TypeToken<ArrayList<CodebergRelease>>(){}.getType();
|
||||
|
||||
private static final OkHttpClient CLIENT = new OkHttpClient();
|
||||
|
||||
public static CodebergRelease fetchRelease(){
|
||||
String tag = System.getenv("CI_COMMIT_TAG");
|
||||
String authToken = System.getenv("CB_TOKEN");
|
||||
|
||||
if(tag == null || authToken == null || tag.isEmpty() || authToken.isEmpty()){
|
||||
LOGGER.warn("Cannot fetch release data. Either CI_COMMIT_TAG or CB_TOKEN was null or empty.");
|
||||
return null;
|
||||
}
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases?limit=10")
|
||||
.header("User-Agent", "VersionUploader-CodebergFetcher/${plugin.version}")
|
||||
.header("Accept", "application/json")
|
||||
.header("Authorization", "token " + authToken)
|
||||
.build();
|
||||
|
||||
try(Response response = CLIENT.newCall(request).execute()){
|
||||
if(!response.isSuccessful()){
|
||||
LOGGER.warn("Cannot fetch releases. Received non-successful response-code: {}", response.code());
|
||||
LOGGER.warn("Message: {}", response.message());
|
||||
return null;
|
||||
}
|
||||
|
||||
ResponseBody body = response.body();
|
||||
if(body == null){
|
||||
LOGGER.warn("Cannot fetch release info. Retrieved Response body was null");
|
||||
return null;
|
||||
}
|
||||
|
||||
String bodyString = body.string();
|
||||
if(bodyString.isEmpty()){
|
||||
LOGGER.warn("Cannot fetch release info. Retrieved Response body was null");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<CodebergRelease> releases = GSON.fromJson(bodyString, LIST_TYPE);
|
||||
|
||||
CodebergRelease release = null;
|
||||
for(CodebergRelease tmp : releases){
|
||||
if(tmp.tagName().equals(tag)){
|
||||
release = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return release;
|
||||
}catch(IOException ex){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public enum PlatformInfo{
|
||||
|
||||
BUKKIT(
|
||||
"bukkit/target/AdvancedServerList-Bukkit-{{version}}.jar",
|
||||
"Spigot", "Paper", "Folia"
|
||||
),
|
||||
BUNGEECORD(
|
||||
"bungeecord/target/AdvancedServerList-BungeeCord-{{version}}.jar",
|
||||
"BungeeCord", "Waterfall"
|
||||
),
|
||||
VELOCITY(
|
||||
"velocity/target/AdvancedServerList-Velocity-{{version}}.jar",
|
||||
"Velocity"
|
||||
);
|
||||
|
||||
private final String filePath;
|
||||
private final List<String> loaders;
|
||||
|
||||
PlatformInfo(String filePath, String... loaders){
|
||||
this.filePath = filePath;
|
||||
this.loaders = List.of(loaders);
|
||||
}
|
||||
|
||||
public String getFilePath(){
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public List<String> getLoaders(){
|
||||
return loaders;
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader;
|
||||
|
||||
import ch.andre601.advancedserverlist.versionuploader.hangar.HangarVersionUploader;
|
||||
import ch.andre601.advancedserverlist.versionuploader.modrinth.ModrinthVersionUploader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class VersionUploader{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(VersionUploader.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
LOGGER.info("Starting release uploader...");
|
||||
|
||||
CodebergRelease release = CodebergReleaseFetcher.fetchRelease();
|
||||
if(release == null){
|
||||
LOGGER.warn("Non-successful attempt at fetching a release from Codeberg! Aborting upload");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if(release.tagName() == null || release.tagName().isEmpty()){
|
||||
LOGGER.info("Received invalid Release Structure. Tag name was null/empty.");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Gson uses 0 for nummerics by default
|
||||
if(release.id() == 0){
|
||||
LOGGER.info("Received invalid Release Structure. ID was 0.");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("Successfully obtained release info: [ID: {}, Tag: {}, Prerelease: {}]", release.id(), release.tagName(), release.prerelease());
|
||||
|
||||
for(String arg : args){
|
||||
if(arg.equalsIgnoreCase("--modrinth")){
|
||||
new ModrinthVersionUploader().performUploads(release);
|
||||
break;
|
||||
}
|
||||
if(arg.equalsIgnoreCase("--hangar")){
|
||||
new HangarVersionUploader().performUpload(release);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+56
-66
@@ -23,7 +23,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.hangaruploader;
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar;
|
||||
|
||||
import ch.andre601.advancedserverlist.versionuploader.CodebergRelease;
|
||||
import ch.andre601.advancedserverlist.versionuploader.PlatformInfo;
|
||||
import ch.andre601.advancedserverlist.versionuploader.hangar.version.*;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -46,107 +50,93 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class HangarUploader{
|
||||
public class HangarVersionUploader{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HangarUploader.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HangarVersionUploader.class);
|
||||
private static final String API_URL = "https://hangar.papermc.io/api/v1/";
|
||||
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
private final String apiKey;
|
||||
private ActiveJWT activeJWT;
|
||||
|
||||
public HangarUploader(String apiKey){
|
||||
this.apiKey = apiKey;
|
||||
public HangarVersionUploader(){
|
||||
this.apiKey = System.getenv("HANGAR_API_TOKEN");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException{
|
||||
LOGGER.info("Starting Jar file...");
|
||||
final VersionUpload.Namespace project = new VersionUpload.Namespace("Andre_601", "AdvancedServerList");
|
||||
public void performUpload(CodebergRelease release){
|
||||
LOGGER.info("Starting HangarVersionUploader...");
|
||||
|
||||
if(args.length < 3){
|
||||
throw new IllegalStateException("Application requires HANGAR_TOKEN, RELEASE_TAG, PRERELEASE and RELEASE_BODY to work");
|
||||
if(apiKey == null || apiKey.isEmpty()){
|
||||
LOGGER.warn("Received a null/empty API key!");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
String apiToken = args[0];
|
||||
String version = args[1].startsWith("v") ? args[1].substring(1) : args[1];
|
||||
boolean isPreRelease = args[2].equalsIgnoreCase("true");
|
||||
String body = System.getenv("GITHUB_RELEASE_BODY");
|
||||
final Namespace project = new Namespace("Andre_601", "AdvancedServerList");
|
||||
|
||||
LOGGER.info("Version: {}", version);
|
||||
LOGGER.info("Is Prerelease: {}", isPreRelease);
|
||||
LOGGER.info("Release Message:");
|
||||
LOGGER.info(body);
|
||||
final String version = release.tagName().startsWith("v") ? release.tagName().substring(1) : release.tagName();
|
||||
|
||||
final String changelog = release.body();
|
||||
boolean preRelease = release.prerelease();
|
||||
|
||||
final List<Path> filePaths = List.of(
|
||||
new File("bukkit/target/AdvancedServerList-Bukkit-" + version + ".jar").toPath(),
|
||||
new File("bungeecord/target/AdvancedServerList-BungeeCord-" + version + ".jar").toPath(),
|
||||
new File("velocity/target/AdvancedServerList-Velocity-" + version + ".jar").toPath()
|
||||
);
|
||||
final List<VersionUpload.PluginDependency> paperDependencies = List.of(
|
||||
VersionUpload.PluginDependency.createWithHangarNamespace(
|
||||
"ViaVersion",
|
||||
false,
|
||||
new VersionUpload.Namespace("ViaVersion", "ViaVersion")
|
||||
),
|
||||
VersionUpload.PluginDependency.createWithExternalUrl(
|
||||
"PlaceholderAPI",
|
||||
false,
|
||||
"https://www.spigotmc.org/resources/6245/"
|
||||
)
|
||||
);
|
||||
final List<VersionUpload.PluginDependency> bungeeDependencies = List.of(
|
||||
VersionUpload.PluginDependency.createWithHangarNamespace(
|
||||
"PAPIProxyBridge",
|
||||
false,
|
||||
new VersionUpload.Namespace("William278", "PAPIProxyBridge")
|
||||
)
|
||||
);
|
||||
final List<VersionUpload.PluginDependency> velocityDependencies = List.of(
|
||||
VersionUpload.PluginDependency.createWithHangarNamespace(
|
||||
"PAPIProxyBridge",
|
||||
false,
|
||||
new VersionUpload.Namespace("William278", "PAPIProxyBridge")
|
||||
)
|
||||
new File(PlatformInfo.BUKKIT.getFilePath().replace("{{version}}", version)).toPath(),
|
||||
new File(PlatformInfo.BUNGEECORD.getFilePath().replace("{{version}}", version)).toPath(),
|
||||
new File(PlatformInfo.VELOCITY.getFilePath().replace("{{version}}", version)).toPath()
|
||||
);
|
||||
|
||||
final List<VersionUpload.MultipartFileOrUrl> fileInfo = List.of(
|
||||
new VersionUpload.MultipartFileOrUrl(List.of(VersionUpload.Platform.PAPER), null),
|
||||
new VersionUpload.MultipartFileOrUrl(List.of(VersionUpload.Platform.WATERFALL), null),
|
||||
new VersionUpload.MultipartFileOrUrl(List.of(VersionUpload.Platform.VELOCITY), null)
|
||||
final List<Dependency> bukkitDependencies = List.of(
|
||||
Dependency.fromNamespace("ViaVersion", false, new Namespace("ViaVersion", "ViaVersion")),
|
||||
Dependency.fromNamespace("Maintenance", false, new Namespace("kennytv", "Maintenance")),
|
||||
Dependency.fromUrl("PlaceholderAPI", false, "https://www.spigot.org/resources/6245/")
|
||||
);
|
||||
final List<Dependency> bungeeDependencies = List.of(
|
||||
Dependency.fromNamespace("PapiProxyBridge", false, new Namespace("William278", "PAPIProxyBridge")),
|
||||
Dependency.fromNamespace("Maintenance", false, new Namespace("kennytv", "Maintenance"))
|
||||
);
|
||||
final List<Dependency> velocityDependencies = List.of(
|
||||
Dependency.fromNamespace("PapiProxyBridge", false, new Namespace("William278", "PAPIProxyBridge")),
|
||||
Dependency.fromNamespace("Maintenance", false, new Namespace("kennytv", "Maintenance"))
|
||||
);
|
||||
|
||||
final VersionUpload versionUpload = new VersionUpload(
|
||||
final List<MultipartObject> fileInfo = List.of(
|
||||
new MultipartObject(Collections.singletonList(Platform.PAPER), null),
|
||||
new MultipartObject(Collections.singletonList(Platform.WATERFALL), null),
|
||||
new MultipartObject(Collections.singletonList(Platform.VELOCITY), null)
|
||||
);
|
||||
|
||||
final Version versionUpload = new Version(
|
||||
version,
|
||||
Map.of(
|
||||
VersionUpload.Platform.PAPER, paperDependencies,
|
||||
VersionUpload.Platform.WATERFALL, bungeeDependencies,
|
||||
VersionUpload.Platform.VELOCITY, velocityDependencies
|
||||
Platform.PAPER, bukkitDependencies,
|
||||
Platform.WATERFALL, bungeeDependencies,
|
||||
Platform.VELOCITY, velocityDependencies
|
||||
),
|
||||
Map.of(
|
||||
VersionUpload.Platform.PAPER, List.of("1.19.x", "1.20.x"),
|
||||
VersionUpload.Platform.WATERFALL, List.of("1.19.x", "1.20.x"),
|
||||
VersionUpload.Platform.VELOCITY, List.of("3.2")
|
||||
Platform.PAPER, List.of("1.19.x", "1.20.x"),
|
||||
Platform.WATERFALL, List.of("1.19.x", "1.20.x"),
|
||||
Platform.VELOCITY, Collections.singletonList("3.2")
|
||||
),
|
||||
body,
|
||||
changelog,
|
||||
fileInfo,
|
||||
isPreRelease ? "Beta" : "Release"
|
||||
preRelease ? "Beta" : "Release"
|
||||
);
|
||||
|
||||
HangarUploader uploader = new HangarUploader(apiToken);
|
||||
try(CloseableHttpClient client = HttpClients.createDefault()){
|
||||
uploader.uploadVersion(client, project, versionUpload, filePaths);
|
||||
}catch(ParseException ex){
|
||||
LOGGER.error("Encountered ParseException while performing a request.", ex);
|
||||
uploadVersion(client, project, versionUpload, filePaths);
|
||||
}catch(ParseException | IOException ex){
|
||||
LOGGER.warn("Unable to upload to Hangar! Encountered an exception.", ex);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void uploadVersion(HttpClient client, VersionUpload.Namespace namespace, VersionUpload versionUpload,
|
||||
List<Path> filePaths) throws IOException, ParseException{
|
||||
private void uploadVersion(HttpClient client, Namespace namespace, Version versionUpload, List<Path> filePaths) throws IOException, ParseException{
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addPart("versionUpload", new StringBody(GSON.toJson(versionUpload), ContentType.APPLICATION_JSON));
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar.version;
|
||||
|
||||
public record Dependency(String name, boolean required, Namespace namespace, String externalUrl){
|
||||
|
||||
public Dependency{
|
||||
if(namespace == null && externalUrl == null)
|
||||
throw new IllegalStateException("Either a namespace or external URL needs to be defined.");
|
||||
}
|
||||
|
||||
public static Dependency fromNamespace(String name, boolean required, Namespace namespace){
|
||||
return new Dependency(name, required, namespace, null);
|
||||
}
|
||||
|
||||
public static Dependency fromUrl(String name, boolean required, String url){
|
||||
return new Dependency(name, required, null, url);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar.version;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record MultipartObject(List<Platform> platforms, String url){}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar.version;
|
||||
|
||||
public record Namespace(String owner, String slug){
|
||||
@Override
|
||||
public String toString(){
|
||||
return owner() + "/" + slug();
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar.version;
|
||||
|
||||
public enum Platform{
|
||||
PAPER,
|
||||
WATERFALL,
|
||||
VELOCITY
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.hangar.version;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public record Version(String version, Map<Platform, List<Dependency>> pluginDependencies,
|
||||
Map<Platform, List<String>> platformDependencies, String description,
|
||||
List<MultipartObject> files, String channel){
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022-2023 Andre_601
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
package ch.andre601.advancedserverlist.versionuploader.modrinth;
|
||||
|
||||
import ch.andre601.advancedserverlist.versionuploader.CodebergRelease;
|
||||
import ch.andre601.advancedserverlist.versionuploader.PlatformInfo;
|
||||
import masecla.modrinth4j.client.agent.UserAgent;
|
||||
import masecla.modrinth4j.endpoints.version.CreateVersion;
|
||||
import masecla.modrinth4j.main.ModrinthAPI;
|
||||
import masecla.modrinth4j.model.version.ProjectVersion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class ModrinthVersionUploader{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ModrinthVersionUploader.class);
|
||||
private final List<PlatformInfo> platforms = List.of(
|
||||
PlatformInfo.BUKKIT,
|
||||
PlatformInfo.BUNGEECORD,
|
||||
PlatformInfo.VELOCITY
|
||||
);
|
||||
private final List<String> versions = List.of("1.19.4", "1.20", "1.20.1");
|
||||
|
||||
private final ModrinthAPI api;
|
||||
|
||||
public ModrinthVersionUploader(){
|
||||
this.api = createClient();
|
||||
}
|
||||
|
||||
public void performUploads(CodebergRelease release){
|
||||
LOGGER.info("Starting ModrinthVersionUploader...");
|
||||
|
||||
if(api == null){
|
||||
LOGGER.warn("Unable to obtain ModrinthAPI instance!");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
final String version = release.tagName().startsWith("v") ? release.tagName().substring(1) : release.tagName();
|
||||
|
||||
final String changelog = release.body();
|
||||
final boolean preRelease = release.prerelease();
|
||||
|
||||
for(PlatformInfo platform : platforms){
|
||||
File file = new File(platform.getFilePath().replace("{{version}}", version));
|
||||
|
||||
CreateVersion.CreateVersionRequest request = CreateVersion.CreateVersionRequest.builder()
|
||||
.projectId("xss83sOY")
|
||||
.name(String.format("v%s (%s)", version, String.join(", ", platform.getLoaders())))
|
||||
.versionNumber(version)
|
||||
.changelog(changelog)
|
||||
.featured(false)
|
||||
.files(file)
|
||||
.gameVersions(versions)
|
||||
.loaders(platform.getLoaders())
|
||||
.versionType(preRelease ? ProjectVersion.VersionType.BETA : ProjectVersion.VersionType.RELEASE)
|
||||
.dependencies(List.of(
|
||||
new ProjectVersion.ProjectDependency(null, "papiproxabridge", null, ProjectVersion.ProjectDependencyType.OPTIONAL),
|
||||
new ProjectVersion.ProjectDependency(null, "maintenance", null, ProjectVersion.ProjectDependencyType.OPTIONAL)
|
||||
))
|
||||
.build();
|
||||
|
||||
api.versions().createProjectVersion(request).whenComplete((project, throwable) -> {
|
||||
if(throwable != null){
|
||||
LOGGER.warn("Encountered error while creating a release on Modrinth!", throwable);
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("Successfully uploaded new Modrinth release!");
|
||||
LOGGER.info("https://modrinth.com/plugin/advancedserverlist/version/{}", project.getId());
|
||||
});
|
||||
}
|
||||
|
||||
LOGGER.info("Upload task completed! Shutting down jar...");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private ModrinthAPI createClient(){
|
||||
String apiToken = System.getenv("MODRINTH_API_TOKEN");
|
||||
if(apiToken == null || apiToken.isEmpty())
|
||||
return null;
|
||||
|
||||
UserAgent agent = UserAgent.builder()
|
||||
.authorUsername("Andre_601")
|
||||
.projectVersion("${plugin.version}")
|
||||
.projectName("ModrinthVersionUploader")
|
||||
.contact("github@andre601.ch")
|
||||
.build();
|
||||
|
||||
return ModrinthAPI.rateLimited(agent, apiToken);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -39,13 +39,13 @@
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<file>${DEV_HOME}/Purr.log</file>
|
||||
<file>${DEV_HOME}/HangarUploader.log</file>
|
||||
<encoder>
|
||||
<pattern>%d{dd.MM.yyyy HH:mm:ss} [%thread] [ %-5level] [%logger{0}] %msg%n</pattern>
|
||||
</encoder>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- rollover daily -->
|
||||
<fileNamePattern>${DEV_HOME}/archived/purr-%d{dd.MM.yyyy}.%i.log</fileNamePattern>
|
||||
<fileNamePattern>${DEV_HOME}/archived/hangeruploader-%d{dd.MM.yyyy}.%i.log</fileNamePattern>
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
<maxHistory>60</maxHistory>
|
||||
<totalSizeCap>20GB</totalSizeCap>
|
||||
Reference in new issue
Block a user