Compare commits

..
209 Commits
Author SHA1 Message Date
Andre601 8f98846bc3 Ignore deprecation state of getUnsafe() 2023-10-15 00:00:57 +02:00
Andre601 bbcab59845 Final change I hope 2023-10-14 23:59:49 +02:00
Andre601 3130e07070 More consistent names 2023-10-14 23:57:05 +02:00
Andre601 7bc61ddf4d Use more matching placeholder names 2023-10-14 23:54:32 +02:00
Andre601 53d15a9011 Bump version 2023-10-14 23:42:16 +02:00
Andre601 8718e4a0ae update PAPI placeholders info 2023-10-11 12:10:04 +00:00
Andre601 06a49956af Merge pull request 'Update dependency com.google.guava:guava to v32.1.3-jre' (#166) from renovate/com.google.guava-guava-32.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/166
2023-10-11 12:04:37 +00:00
Andre601's Renovate Bot 38ec131b69 Update dependency com.google.guava:guava to v32.1.3-jre 2023-10-11 12:00:57 +00:00
Andre601 1bdaa61dd9 Merge pull request 'Update dependency mkdocs-material to v9.4.5' (#165) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/165
2023-10-10 12:02:55 +00:00
Andre601's Renovate Bot 080d5055c4 Update dependency mkdocs-material to v9.4.5 2023-10-10 12:01:23 +00:00
Andre601 423b363964 Use maxPlayers value 2023-10-09 01:33:40 +02:00
Andre601 6b9abfccfc Update PlaceholderAPI placeholders 2023-10-07 12:53:46 +02:00
Andre601 f589a8da35 Update Docs 2023-10-06 23:54:51 +02:00
Andre601 465581306f docs/api/javadocs.md aktualisiert 2023-10-06 20:54:27 +00:00
Andre601 6b2919961b Merge pull request 'Add Javadoc redirect' (#164) from docs/javadoc-link into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/164
2023-10-06 20:52:04 +00:00
Andre601 adb6e797b2 Add Javadoc redirect 2023-10-06 20:51:35 +00:00
Andre601 b410b9438f Merge pull request 'Update dependency mkdocs-material to v9.4.4' (#163) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/163
2023-10-06 12:22:17 +00:00
Andre601's Renovate Bot c1d5b4efa9 Update dependency mkdocs-material to v9.4.4 2023-10-06 12:01:00 +00:00
Andre601 4785dd127e Only allow workflow_dispatch from now on 2023-10-04 14:19:16 +00:00
Andre601 9e8e2f7e74 Add missing id property 2023-10-03 21:49:01 +00:00
Andre601 c14dfe0f3a Merge pull request 'Update dependency com.viaversion:viaversion-api to v4.8.1' (#162) from renovate/com.viaversion-viaversion-api-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/162
2023-10-03 12:40:03 +00:00
Andre601's Renovate Bot ed92e7002c Update dependency com.viaversion:viaversion-api to v4.8.1 2023-10-03 12:01:05 +00:00
Andre601 8f93d9732c Merge pull request 'Update dependency mkdocs-material to v9.4.3' (#161) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/161
2023-10-02 12:03:50 +00:00
Andre601's Renovate Bot 96f8fa5860 Update dependency mkdocs-material to v9.4.3 2023-10-02 12:00:57 +00:00
Andre601 bfb857bd5c Merge pull request 'Update dependency net.william278:papiproxybridge to v1.4.2' (#160) from renovate/net.william278-papiproxybridge-1.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/160
2023-09-30 12:04:14 +00:00
Andre601 5fe3b5811c Merge pull request 'Update dependency net.kyori:adventure-platform-bungeecord to v4.3.1' (#159) from renovate/net.kyori-adventure-platform-bungeecord-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/159
2023-09-30 12:03:54 +00:00
Andre601's Renovate Bot 2a7eff0092 Update dependency net.william278:papiproxybridge to v1.4.2 2023-09-30 12:01:23 +00:00
Andre601 1907f5d47e Merge pull request 'Update dependency net.kyori:adventure-platform-bukkit to v4.3.1' (#158) from renovate/net.kyori-adventure-platform-bukkit-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/158
2023-09-29 12:03:12 +00:00
Andre601's Renovate Bot aa92350b52 Update dependency net.kyori:adventure-platform-bungeecord to v4.3.1 2023-09-29 12:01:05 +00:00
Andre601's Renovate Bot 869b9bd3b7 Update dependency net.kyori:adventure-platform-bukkit to v4.3.1 2023-09-29 12:00:56 +00:00
Andre601 fe31dcf0a4 Merge pull request 'Update dependency net.william278:papiproxybridge to v1.4.1' (#156) from renovate/net.william278-papiproxybridge-1.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/156
2023-09-26 18:39:12 +00:00
Andre601 6b44438f52 Use custom compact admonition boxes 2023-09-26 20:38:22 +02:00
Andre601's Renovate Bot 6b0c654f41 Update dependency net.william278:papiproxybridge to v1.4.1 2023-09-26 12:00:57 +00:00
Andre601 c28ff3a891 Use some JS to insert API version 2023-09-26 13:56:48 +02:00
Andre601 f424b41c3b Header consistency 2023-09-25 15:14:10 +02:00
Andre601 b5f901d8f5 Use Hangar version of PAPI as dependency 2023-09-25 15:04:10 +02:00
Andre601 29d52492fc Merge pull request 'Update dependency mkdocs-material to v9.4.2' (#155) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/155
2023-09-25 12:03:05 +00:00
Andre601's Renovate Bot 2d6af20bdc Update dependency mkdocs-material to v9.4.2 2023-09-25 12:01:00 +00:00
Andre601 59c913ecf8 Merge pull request 'Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.1' (#154) from renovate/org.apache.maven.plugins-maven-shade-plugin-3.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/154
2023-09-24 22:18:35 +00:00
Andre601's Renovate Bot 4a50beb4e0 Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.1 2023-09-24 22:16:36 +00:00
Andre601 c099127272 delete renovate.yml 2023-09-24 21:48:23 +00:00
Andre601 15974b5c54 Merge pull request 'Update dependency me.clip:placeholderapi to v2.11.4' (#153) from renovate/me.clip-placeholderapi-2.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/153
2023-09-24 13:03:36 +00:00
Andre601's Renovate Bot 483afe63c4 Update dependency me.clip:placeholderapi to v2.11.4 2023-09-24 12:00:56 +00:00
Andre601 f0cb458a34 Use snippets for API version display 2023-09-24 03:19:41 +02:00
Andre601 2c547cd6d0 Add changelog newline sanitization to HangarVersionUploader too 2023-09-23 22:35:45 +02:00
Andre601 e7282b4a97 Support all MC 1.19 versions. 2023-09-23 22:27:48 +02:00
Andre601 4fc0ad97fc Revert to normal publish setup 2023-09-23 21:59:12 +02:00
Andre601 3ae02167b9 Lowercase loaders 2023-09-23 21:55:49 +02:00
Andre601 e407b38565 Use proper plugin release to test. 2023-09-23 21:42:06 +02:00
Andre601 c98d52ed46 Make a dryrun-test for VersionUploader 2023-09-23 21:29:06 +02:00
Andre601 266913e4b4 Use response directly from client's execute method 2023-09-23 16:42:21 +02:00
Andre601 a3d4a009a5 Use unique ID for modrinth dependencies 2023-09-23 16:27:17 +02:00
Andre601 18e00d082e Use addLabels and not labels 2023-09-23 12:09:04 +00:00
Andre601 6a3979743b Merge pull request 'Update dependency mkdocs-material to v9.4.1' (#152) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/152
2023-09-23 12:05:45 +00:00
Andre601's Renovate Bot 3a29ad54ca Update dependency mkdocs-material to v9.4.1 2023-09-23 12:01:03 +00:00
Andre601 987c520160 Merge pull request 'Update dependency com.viaversion:viaversion-api to v4.8.0' (#151) from renovate/com.viaversion-viaversion-api-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/151
2023-09-22 12:06:48 +00:00
Andre601's Renovate Bot 4b6197f6e0 Update dependency com.viaversion:viaversion-api to v4.8.0 2023-09-22 12:00:55 +00:00
Andre601 01611d4130 Add 1.20.2 for ModrinthVersionUploader 2023-09-21 20:59:35 +02:00
Andre601 531aa65fcc Merge pull request 'Bump mkdocs-material to 9.4.0' (#150) from feature/update-mkdocs into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/150
2023-09-21 17:39:22 +00:00
Andre601 fb101c4a14 Use new emoji extension 2023-09-21 17:39:11 +00:00
Andre601 7bd97f5f5a Bump mkdocs-material to 9.4.0 2023-09-21 17:37:28 +00:00
Andre601 52c3edd0ea Use debug log level 2023-09-21 12:15:49 +00:00
Andre601 368e544051 Don't include core-module in codeberg release 2023-09-21 00:52:20 +02:00
Andre601 12b2f5a208 Give non-successful response codes on fails 2023-09-21 00:50:26 +02:00
Andre601 adc88a8640 Increase timeout delay for Release data fetching 2023-09-21 00:43:08 +02:00
Andre601 817db44492 Add null check for codeberg release 2023-09-21 00:40:57 +02:00
Andre601 f74f7dfa6b Use CompletableFuture.join() for VersionUploader 2023-09-21 00:37:12 +02:00
Andre601 e9c8730090 Merge pull request 'Fix docs' (#149) from fix/docs into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/149
2023-09-20 22:32:41 +00:00
Andre601 861ada0396 docs/examples/index.md aktualisiert 2023-09-20 22:32:29 +00:00
Andre601 a2fb9c3d81 Fix docs 2023-09-20 22:31:52 +00:00
Andre601 f747461018 Use the right Env variable... 2023-09-20 23:37:03 +02:00
Andre601 f408146d57 Fix wrong API URL. 2023-09-20 23:34:27 +02:00
Andre601 c684001fcf mkdocs.yml aktualisiert 2023-09-20 21:19:39 +00:00
Andre601 6dc53c8c4f define source and target for modrinth and hangar token 2023-09-20 21:17:24 +00:00
Andre601 64ab958c67 docs/examples/index.md aktualisiert 2023-09-20 20:20:26 +00:00
Andre601 7a66c9a0c9 Merge pull request 'Add maxPlayers options' (#145) from feature/maxplayers-option into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/145
2023-09-20 20:05:44 +00:00
Andre601 0ff658632a Merge branch 'master' into feature/maxplayers-option 2023-09-20 17:41:50 +00:00
Andre601 ee32347bd0 Merge pull request 'Re-make Modrinth and Hangar uploader' (#144) from feature/modrinth-and-hangar-uploader into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/144
2023-09-20 17:41:23 +00:00
Andre601 9e11038e98 Merge branch 'master' into feature/modrinth-and-hangar-uploader 2023-09-20 17:39:15 +00:00
Andre601 008ddbb98a .github/dependabot.yml gelöscht 2023-09-20 17:34:13 +00:00
Andre601 f084c17d76 Merge pull request 'Update api.version to v3.1.0' (#148) from renovate/api.version into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/148
2023-09-20 15:55:20 +00:00
Andre601's Renovate Bot 9dd73aec9d Update api.version to v3.1.0 2023-09-20 15:51:15 +00:00
Andre601 3ebf151f3a Improve renovate configuration 2023-09-20 11:50:28 +00:00
Andre601 872c194a62 Add 'folia-supported: true' to paper-plugin.yml 2023-09-20 11:03:19 +00:00
Andre601 d122603c70 Merge pull request 'Update dependency mkdocs-material to v9.3.2' (#146) from renovate/mkdocs-material-9.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/146
2023-09-20 00:20:40 +00:00
Andre601's Renovate Bot 489fce2031 Update dependency mkdocs-material to v9.3.2 2023-09-20 00:06:48 +00:00
Andre601 1651151f26 Test without RENOVATE_ADD_LABELS for now 2023-09-19 23:49:21 +00:00
Andre601 aa61ea826f renovate.json aktualisiert 2023-09-19 23:48:42 +00:00
Andre601 0877eb4187 Add github token for release notes and gh actions dependencies 2023-09-19 23:43:49 +00:00
Andre601 6e89cdb3cc .woodpecker/test.yml gelöscht 2023-09-19 23:24:07 +00:00
Andre601 1eb0b30356 Improve source facts fetcher 2023-09-19 22:53:51 +02:00
Andre601 417f5dc5d0 Also include image 2023-09-19 21:02:42 +02:00
Andre601 01a73b9ea3 Bump plugin and API version 2023-09-19 20:54:02 +02:00
Andre601 c06788a55c Update API changelog 2023-09-19 20:45:09 +02:00
Andre601 fd924107bc Add maxPlayers option for server list profile 2023-09-19 20:32:05 +02:00
Andre601 dce90b91f0 .woodpecker/publish_assets.yml aktualisiert 2023-09-18 18:22:30 +00:00
Andre601 aa968b7d25 Add gitea release plugin 2023-09-18 16:01:47 +02:00
Andre601 137d089e4a Merge branch 'master' into feature/modrinth-and-hangar-uploader 2023-09-18 13:11:27 +00:00
Andre601 bfa27f92e1 Re-make Modrinth and Hangar uploader 2023-09-18 15:10:24 +02:00
Andre601 b405706b50 Merge pull request 'Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.0' (#143) from renovate/org.apache.maven.plugins-maven-shade-plugin-3.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/143
2023-09-18 00:06:48 +00:00
Andre601's Renovate Bot 89f44d7bec Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.0 2023-09-18 00:04:39 +00:00
Andre601 28e9b6ed96 .woodpecker/test.yml aktualisiert 2023-09-17 20:29:19 +00:00
Andre601 19b3eec401 .woodpecker/test.yml aktualisiert 2023-09-17 20:11:37 +00:00
Andre601 c712b3b715 .woodpecker/test.yml aktualisiert 2023-09-17 20:10:22 +00:00
Andre601 5c379c3b13 .woodpecker/test.yml aktualisiert 2023-09-17 20:09:29 +00:00
Andre601 f6f48708d9 .woodpecker/test.yml aktualisiert 2023-09-17 20:08:51 +00:00
Andre601 83890fa5cb .woodpecker/test.yml aktualisiert 2023-09-17 20:07:55 +00:00
Andre601 d7653a6a6f .woodpecker/test.yml aktualisiert 2023-09-17 20:02:43 +00:00
Andre601 676c4c8f1f .woodpecker/test.yml aktualisiert 2023-09-17 20:00:49 +00:00
Andre601 b66870c942 .woodpecker/test.yml aktualisiert 2023-09-17 19:56:23 +00:00
Andre601 af97a0dac2 Test out JSON creation 2023-09-17 19:56:01 +00:00
Andre601 d43ef090ef Use double quotes 2023-09-17 19:42:36 +00:00
Andre601 e7451ae567 .woodpecker/test.yml aktualisiert 2023-09-17 19:32:57 +00:00
Andre601 cf4f095624 Test user auth 2023-09-17 19:28:12 +00:00
Andre601 9280809ab0 .woodpecker/publish_assets.yml aktualisiert 2023-09-17 19:25:04 +00:00
Andre601 875ae4d43d .woodpecker/test.yml aktualisiert 2023-09-17 19:19:27 +00:00
Andre601 dbd45ac65e .woodpecker/test.yml aktualisiert 2023-09-17 19:14:57 +00:00
Andre601 7c15778ebc test without token 2023-09-17 19:12:24 +00:00
Andre601 2699856a75 .woodpecker/test.yml aktualisiert 2023-09-17 19:11:30 +00:00
Andre601 b49c105620 .woodpecker/test.yml aktualisiert 2023-09-17 18:57:19 +00:00
Andre601 2ffbfeec48 .woodpecker/test.yml aktualisiert 2023-09-17 18:56:50 +00:00
Andre601 bd885e25e2 .woodpecker/test.yml aktualisiert 2023-09-17 18:56:11 +00:00
Andre601 e2c6eb142c Merge pull request 'Update dependency org.apache.maven.plugins:maven-jar-plugin to v3.3.0' (#142) from renovate/org.apache.maven.plugins-maven-jar-plugin-3.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/142
2023-09-17 00:12:53 +00:00
Andre601 db11e42c6d Merge pull request 'Update dependency net.md-5:bungeecord-api to v1.20-R0.1' (#141) from renovate/net.md-5-bungeecord-api-1.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/141
2023-09-17 00:12:11 +00:00
Andre601's Renovate Bot 36e5829943 Update dependency org.apache.maven.plugins:maven-jar-plugin to v3.3.0 2023-09-17 00:11:49 +00:00
Andre601's Renovate Bot 7bbb2bbfa7 Update dependency net.md-5:bungeecord-api to v1.20-R0.1 2023-09-17 00:11:46 +00:00
Andre601 6acd536f43 Merge pull request 'Update dependency net.kyori:adventure-text-minimessage to v4.14.0' (#140) from renovate/net.kyori-adventure-text-minimessage-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/140
2023-09-16 00:10:40 +00:00
Andre601 64d1440ad2 Merge pull request 'Update dependency net.kyori:adventure-platform-bungeecord to v4.3.0' (#139) from renovate/net.kyori-adventure-platform-bungeecord-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/139
2023-09-16 00:10:08 +00:00
Andre601's Renovate Bot 6f1dd78aa7 Update dependency net.kyori:adventure-text-minimessage to v4.14.0 2023-09-16 00:04:39 +00:00
Andre601's Renovate Bot 4330978816 Update dependency net.kyori:adventure-platform-bungeecord to v4.3.0 2023-09-16 00:04:22 +00:00
Andre601 935603b852 Use VersionUploader for hangar only again 2023-09-15 21:42:35 +02:00
Andre601 9671938a66 .woodpecker/test.yml aktualisiert 2023-09-15 19:16:23 +00:00
Andre601 5cc974eb9c Return of the | . 2023-09-15 19:15:44 +00:00
Andre601 e526cc6750 .woodpecker/test.yml aktualisiert 2023-09-15 19:09:20 +00:00
Andre601 34fea78b01 Check if tag actually is set. 2023-09-15 19:02:26 +00:00
Andre601 072547005c .woodpecker/test.yml aktualisiert 2023-09-15 19:01:39 +00:00
Andre601 cdb5852e8b .woodpecker/test.yml aktualisiert 2023-09-15 18:59:06 +00:00
Andre601 050477c19f .woodpecker/test.yml aktualisiert 2023-09-15 18:58:22 +00:00
Andre601 52b24bb3e9 .woodpecker/test.yml aktualisiert 2023-09-15 18:55:28 +00:00
Andre601 df8a063369 .woodpecker/test.yml aktualisiert 2023-09-15 18:48:48 +00:00
Andre601 3fc4a788b8 Add missing \ 2023-09-15 18:36:28 +00:00
Andre601 15e5108ec7 Try without {} again 2023-09-15 18:35:33 +00:00
Andre601 b8fa694e26 .woodpecker/test.yml aktualisiert 2023-09-15 18:32:19 +00:00
Andre601 f1b55cba79 try without auth 2023-09-15 18:30:11 +00:00
Andre601 e76dd78cd5 Try "${token}" format again 2023-09-15 18:28:42 +00:00
Andre601 09a668493b try this 2023-09-15 18:27:50 +00:00
Andre601 1ef466d2a4 Try single quotes 2023-09-15 18:19:51 +00:00
Andre601 e15ddbf2d4 Try this format? 2023-09-15 18:16:24 +00:00
Andre601 1c0ce073e5 Try "| ." again 2023-09-15 18:14:24 +00:00
Andre601 5964be18ed .woodpecker/test.yml aktualisiert 2023-09-15 18:13:11 +00:00
Andre601 06ad4f106b Try former select syntax 2023-09-15 18:12:05 +00:00
Andre601 adf343468f try --anyauth 2023-09-15 18:10:06 +00:00
Andre601 5a0bb3ce03 Try this structure 2023-09-15 16:14:23 +00:00
Andre601 b3edb2833e Create test for curl setu 2023-09-15 16:12:04 +00:00
Andre601 83c2017544 .woodpecker/publish_assets.yml aktualisiert 2023-09-15 11:46:45 +00:00
Andre601 42ecf8ec2a Create github release creation step 2023-09-15 11:41:28 +00:00
Andre601 fe53c28f77 Re-add release workflow 2023-09-15 11:33:36 +00:00
Andre601 44e8b395f5 .woodpecker/renovate.yml aktualisiert 2023-09-15 00:12:47 +00:00
Andre601 13828897a2 Merge pull request 'Update dependency net.kyori:adventure-api to v4.14.0' (#138) from renovate/net.kyori-adventure-api-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/138
2023-09-15 00:08:18 +00:00
Andre601 965a9898ca Merge pull request 'Update dependency dev.masecla:Modrinth4J to v2.2.0' (#137) from renovate/dev.masecla-modrinth4j-2.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/137
2023-09-15 00:07:49 +00:00
Andre601's Renovate Bot d3c9d1e7e2 Update dependency net.kyori:adventure-api to v4.14.0 2023-09-15 00:03:11 +00:00
Andre601's Renovate Bot ff3df14a90 Update dependency dev.masecla:Modrinth4J to v2.2.0 2023-09-15 00:03:08 +00:00
Andre601 374f477645 Merge pull request 'Update dependency com.squareup.okhttp3:okhttp to v4.11.0' (#136) from renovate/com.squareup.okhttp3-okhttp-4.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/136
2023-09-14 00:04:07 +00:00
Andre601 11bcbc7918 Merge branch 'master' into renovate/com.squareup.okhttp3-okhttp-4.x 2023-09-14 00:03:55 +00:00
Andre601 f91f77dba0 Merge pull request 'Update dependency com.comphenix.protocol:ProtocolLib to v5.1.0' (#135) from renovate/com.comphenix.protocol-protocollib-5.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/135
2023-09-14 00:03:36 +00:00
Andre601's Renovate Bot ac36bc7c6c Update dependency com.squareup.okhttp3:okhttp to v4.11.0 2023-09-14 00:03:14 +00:00
Andre601's Renovate Bot 184aa7cd83 Update dependency com.comphenix.protocol:ProtocolLib to v5.1.0 2023-09-14 00:02:08 +00:00
Andre601 e20a80b410 Merge pull request 'Update dependency org.bstats:bstats-bungeecord to v3.0.2' (#134) from renovate/org.bstats-bstats-bungeecord-3.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/134
2023-09-13 19:44:52 +00:00
Andre601 43f5cbdcf1 Merge branch 'master' into renovate/org.bstats-bstats-bungeecord-3.x 2023-09-13 19:44:43 +00:00
Andre601 7c8d6067f5 Merge pull request 'Update dependency ch.qos.logback:logback-classic to v1.4.11' (#133) from renovate/ch.qos.logback-logback-classic-1.x into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/133
2023-09-13 19:41:51 +00:00
Andre601 5500239146 Merge branch 'master' into renovate/ch.qos.logback-logback-classic-1.x 2023-09-13 19:38:23 +00:00
Andre601 62844f3111 renovate.json aktualisiert 2023-09-13 19:37:24 +00:00
Andre601 37df1c6376 .woodpecker/renovate.yml aktualisiert 2023-09-13 19:25:08 +00:00
Andre601 abe1dea027 Disable dryrun for now 2023-09-13 19:24:47 +00:00
Andre601 66500050fe .woodpecker/renovate.yml aktualisiert 2023-09-13 19:24:06 +00:00
Andre601's Renovate Bot 2bc2f11fb1 Update dependency org.bstats:bstats-bungeecord to v3.0.2 2023-09-13 19:22:01 +00:00
Andre601's Renovate Bot 4b88c78036 Update dependency ch.qos.logback:logback-classic to v1.4.11 2023-09-13 19:21:57 +00:00
Andre601 5a98301b7d Merge pull request 'Configure Renovate' (#132) from renovate/configure into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/132
2023-09-13 19:19:37 +00:00
Andre601's Renovate Bot 2cf7fd4ffc Add renovate.json 2023-09-13 19:16:06 +00:00
Andre601 83349e1c37 Include git author 2023-09-13 19:13:33 +00:00
Andre601 d928991ca5 Add chmod 2023-09-13 18:32:01 +00:00
Andre601 8b3cd0fcee Setup git configuration 2023-09-13 18:31:11 +00:00
Andre601 2afd7483df steps, not pipeline 2023-09-13 18:25:09 +00:00
Andre601 ae108d1bed indent fix 2023-09-13 18:24:40 +00:00
Andre601 37e343e92e Create renovate.yml 2023-09-13 18:24:02 +00:00
Andre601 8b01a12ef9 Add admonition box to inform of moved wiki 2023-09-13 00:29:24 +02:00
Andre601 91ea80fbde Update docs 2023-09-12 22:04:49 +02:00
Andre601 deec676180 Fix wrong platforms for papiproxybridge 2023-09-12 19:57:49 +00:00
Andre601 5fb22a505f typo 2023-09-12 19:07:04 +00:00
Andre601 539a1300d2 Don't use gh-pages branch 2023-09-12 19:00:48 +00:00
Andre601 915fe7b134 .github/workflows/release.yml gelöscht 2023-09-12 18:46:21 +00:00
Andre601 da393a66c1 .github/workflows/pr-comment.yml gelöscht 2023-09-12 18:46:17 +00:00
Andre601 6563b93721 .github/workflows/create-pr-artifact.yml gelöscht 2023-09-12 18:46:11 +00:00
Andre601 c8e51ab82e .woodpecker/push_to_github.yml gelöscht 2023-09-12 18:45:51 +00:00
Andre601 435fbe721d typo 2023-09-12 18:35:05 +00:00
Andre601 3677e90ad1 Try this aproach 2023-09-12 18:33:01 +00:00
Andre601 cd96a87028 Bump mkdocs-material to 9.3.1 2023-09-12 18:29:46 +00:00
Andre601 3b1e5244e4 Try this syntax for jq 2023-09-12 13:57:44 +00:00
Andre601 07a1baff36 Merge pull request 'Create setup for GitHub hosted docs' (#131) from feature/improve-github-hosted-docs into master
Reviewed-on: https://codeberg.org/Andre601/AdvancedServerList/pulls/131
2023-09-12 12:49:07 +00:00
Andre601 c87f6d5a0d Merge branch 'master' into feature/improve-github-hosted-docs 2023-09-12 12:48:31 +00:00
Andre601 36f6c41059 Fix workflow not having any upstream 2023-09-12 12:48:17 +00:00
Andre601 fa0170fa16 Add env variable to github workflow 2023-09-12 12:47:02 +00:00
Andre601 c66936861f Wrap entire announce block in if check 2023-09-12 12:43:38 +00:00
Andre601 8933c39ce0 Create option for env 2023-09-12 12:42:44 +00:00
Andre601 34865b5bb8 Create setup for GitHub hosted docs 2023-09-12 12:38:31 +00:00
Andre601 271ebed7b6 Setup basic github -> Codeberg mirror 2023-09-12 12:31:56 +00:00
Andre601 08e7eca34f Remove the System.exit at end of Modrinth upload 2023-09-12 00:10:02 +02:00
Andre601 0162bcdaaf Change dependency declaration for Modrinth 2023-09-11 23:47:46 +02:00
Andre601 39e76862d5 Add log message for ModrinthVersionUploader 2023-09-11 23:37:09 +02:00
57 changed files with 1569 additions and 972 deletions

No files matched your search

-50
View File
@@ -1,50 +0,0 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/bungeecord"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: BungeeCord'
- package-ecosystem: maven
directory: "/core"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: Core'
- package-ecosystem: maven
directory: "/bukkit"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: Bukkit'
- package-ecosystem: maven
directory: "/velocity"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: Velocity'
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: GitHub Action'
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: MkDocs'
-100
View File
@@ -1,100 +0,0 @@
name: Create PR Artifacts
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
branches:
- master
paths-ignore:
- '.github/**'
- 'docs/**'
- '.gitignore'
- 'LICENSE'
- 'README.md'
- 'mkdocs.yml'
- 'requirements.txt'
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref }}'
cancel-in-progress: false
permissions:
issues: write
pull-requests: write
jobs:
buildArtifacts:
runs-on: ubuntu-latest
outputs:
comment_id: ${{ steps.comment.outputs.comment-id }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- pr-build comment -->'
- name: Print Comment info
run: |
echo "Comment ID: ${{ steps.find-comment.outputs.comment-id }}"
echo "Comment Author: ${{ steps.find-comment.outputs.comment-author }}"
echo "Comment created at: ${{ steps.find-comment.outputs.comment-created-at }}"
- name: Post/Update Comment
uses: peter-evans/create-or-update-comment@v3
id: comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body-path: .github/assets/pr-comments/building.md
- name: Set up JDK 1.16
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '16'
cache: 'maven'
- name: Obtain short Commit SHA
id: get-commit
run: 'echo "sha_short=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT'
- name: Build Jar files
run: mvn clean install
env:
COMMIT_SHA: ${{ steps.get-commit.outputs.sha_short }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: AdvancedServerList-Artifacts
path: '*/target/AdvancedServerList-*.jar'
if-no-files-found: error
commentOnFail:
needs: [buildArtifacts]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Render Markdown Template
id: render
uses: chuhlomin/render-template@v1.7
with:
template: './.github/assets/pr-comments/failed.md'
vars: |
commit: ${{ github.event.pull_request.head.sha }}
logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Update Comment (Failure)
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ needs.buildArtifacts.outputs.comment_id }}
edit-mode: replace
body: ${{ steps.render.outputs.result }}
+26 -16
View File
@@ -2,20 +2,25 @@ name: 'Deploy Site (Push)'
on:
workflow_dispatch:
push:
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'mkdocs-theme/**'
- 'requirements.txt'
branches:
- master
tags-ignore:
- '**'
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
env:
GITHUB_REPO_INSTANCE: true
jobs:
build:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.7
@@ -31,9 +36,14 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements.txt
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "actions@github.com"
- name: Deploy Files
run: mkdocs gh-deploy --force
- name: Build docs
run: mkdocs build
- name: Configure GitHub Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'site/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
-99
View File
@@ -1,99 +0,0 @@
name: Comment on Pull request
on:
workflow_run:
types:
- completed
workflows:
- 'Create PR Artifacts'
permissions:
issues: write
pull-requests: write
jobs:
comment:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
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.
WORKFLOW_RUN_EVENT_OBJ: ${{ toJSON(github.event.workflow_run) }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
run: |
PREVIOUS_JOB_ID=$(jq -r '.id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "Previous Job ID: $PREVIOUS_JOB_ID"
echo "PREVIOUS_JOB_ID=$PREVIOUS_JOB_ID" >> "$GITHUB_ENV"
SUITE_ID=$(jq -r '.check_suite_id' <<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "Previous Suite ID: $SUITE_ID"
echo "SUITE_ID=$SUITE_ID" >> "$GITHUB_ENV"
ARTIFACT_ID=$(gh api "/repos/$OWNER/$REPO/actions/artifacts" \
--jq ".artifacts.[] |
select(.workflow_run.id==${PREVIOUS_JOB_ID}) |
select(.expired==false) |
.id")
echo "Artifact ID: $ARTIFACT_ID"
echo "ARTIFACT_ID=$ARTIFACT_ID" >> "$GITHUB_ENV"
ARTIFACT_EXPIRE_DATE=$(gh api "/repos/$OWNER/$REPO/actions/artifacts" \
--jq ".artifacts.[] |
select(.workflow_run.id==${PREVIOUS_JOB_ID}) |
select(.expired==false) |
.expires_at")
echo "Artifact Expire Date: $ARTIFACT_EXPIRE_DATE"
echo "ARTIFACT_EXPIRE_DATE=$ARTIFACT_EXPIRE_DATE" >> "$GITHUB_ENV"
PR_NUMBER=$(jq -r '.pull_requests[0].number' \
<<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "Pull request Number: $PR_NUMBER"
echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_ENV"
HEAD_SHA=$(jq -r '.pull_requests[0].head.sha' \
<<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "Head SHA: $HEAD_SHA"
echo "HEAD_SHA=$HEAD_SHA" >> "$GITHUB_ENV"
- name: Find Comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ env.PR_NUMBER }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- pr-build comment -->'
- name: Print Comment info
run: |
echo "Comment ID: ${{ steps.find-comment.outputs.comment-id }}"
echo "Comment Author: ${{ steps.find-comment.outputs.comment-author }}"
echo "Comment created at: ${{ steps.find-comment.outputs.comment-created-at }}"
- name: Render Markdown Template
id: render
uses: chuhlomin/render-template@v1.7
env:
JOB_PATH: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ env.PREVIOUS_JOB_ID }}"
ARTIFACT_URL: "https://nightly.link/${{ github.repository }}/suites/${{ env.SUITE_ID }}/artifacts/${{ env.ARTIFACT_ID }}"
ARTIFACT_EXPIRE_DATE: "${{ env.ARTIFACT_EXPIRE_DATE }}"
HEAD_SHA: "${{ env.HEAD_SHA }}"
with:
template: './.github/assets/pr-comments/success.md'
timezone: Europe/Zurich
vars: |
commit: ${{ env.HEAD_SHA }}
logs: ${{ env.JOB_PATH }}
download: ${{ env.ARTIFACT_URL }}
expire: ${{ env.ARTIFACT_EXPIRE_DATE }}
- name: Update Comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ env.PR_NUMBER }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.render.outputs.result }}
-125
View File
@@ -1,125 +0,0 @@
#
# Big thank you to @Kir-Antipov for providing this workflow file.
# Check out his mc-publish action here: https://github.com/Kir-Antipov/mc-publish
#
name: Publish Assets
on:
release:
types:
- published
jobs:
buildJars:
runs-on: ubuntu-latest
outputs:
plugin_release: ${{ steps.github-release.outputs.PLUGIN_RELEASE }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Version from Release
id: github-release
run: |
version=$(echo ${{ github.event.release.tag_name }} | cut -d'v' -f2)
echo "PLUGIN_RELEASE=$version" >> $GITHUB_OUTPUT
- name: Set up JDK 1.16
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '16'
cache: 'maven'
- name: Build Jar files
run: mvn clean install
- name: Save All files
uses: actions/upload-artifact@v3
with:
name: asl-files
path: |
*/target/AdvancedServerList-*.jar
hangar-uploader/target/HangarUploader.jar
if-no-files-found: error
retention-days: 1
publish:
needs: [buildJars]
strategy:
matrix:
include:
- platforms: BungeeCord, Waterfall
directory: bungeecord
loaders: |
bungeecord
waterfall
dependencies: 'papiproxybridge@1.3(optional)'
- platforms: Spigot, Paper, Folia
directory: bukkit
loaders: |
spigot
paper
folia
dependencies: ''
- platforms: Velocity
directory: velocity
loaders: velocity
dependencies: 'papiproxybridge@1.3(optional)'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Jar files
uses: actions/download-artifact@v3
with:
name: asl-files
- name: Upload AdvancedServerList v${{ needs.buildJars.outputs.plugin_release }} (${{ matrix.loaders }}) to GitHub and Modrinth
if: '!github.event.release.prerelease'
uses: Kir-Antipov/mc-publish@v3.3
with:
name: ${{ github.event.release.tag_name }} (${{ matrix.platforms }})
version: ${{ needs.buildJars.outputs.plugin_release }}
version-type: release
files: ${{ matrix.directory}}/target/AdvancedServerList-*.jar
loaders: ${{ matrix.loaders }}
game-version-filter: releases
game-versions: '>=1.19'
java: 16
dependencies: ${{ matrix.dependencies }}
modrinth-id: xss83sOY
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload AdvancedServerList v${{ needs.buildJars.outputs.plugin_release }} (${{ matrix.loaders }}) to GitHub and Modrinth [Pre-Release]
if: 'github.event.release.prerelease'
uses: Kir-Antipov/mc-publish@v3.3
with:
name: ${{ github.event.release.tag_name }} (${{ matrix.platforms }})
version: ${{ needs.buildJars.outputs.plugin_release }}
version-type: beta
files: ${{ matrix.directory }}/target/AdvancedServerList-*.jar
loaders: ${{ matrix.loaders }}
game-version-filter: releases
game-versions: '>=1.19'
java: 16
dependencies: ${{ matrix.dependencies }}
modrinth-id: xss83sOY
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
publishHangar:
needs: [buildJars]
runs-on: ubuntu-latest
steps:
- name: Set up JDK 1.16
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '16'
- name: Download Release Assets
uses: actions/download-artifact@v3
with:
name: asl-files
- name: Move HangarUploader.jar
working-directory: hangar-uploader/target/
run: mv HangarUploader.jar ../../
- name: Execute HangarUploader.jar
run: java -jar HangarUploader.jar ${{ secrets.HANGAR_TOKEN }} ${{ needs.buildJars.outputs.plugin_release }} ${{ github.event.release.prerelease }}
env:
GITHUB_RELEASE_BODY: ${{ github.event.release.body }}
+1
View File
@@ -2,3 +2,4 @@
/.idea/
/**/dependency-reduced-pom.xml
/**/target/
/**/__pycache__/
+22 -45
View File
@@ -5,54 +5,31 @@ when:
steps:
createFiles:
image: maven:3.9.4-eclipse-temurin-17
secrets:
- source: cb_token
target: codeberg_api_token
- source: gh_token
target: github_api_token
- source: modrinth_api_token
target: modrinth_api_token
- source: hangar_api_token
target: hangar_api_token
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
# Move VersionUploader jar file
- cd version-uploader/target/
- mv VersionUploader.jar ../../
- cd ../../
# Create Modrinth releases
- java -jar VersionUploader.jar --modrinth
# Create Hangar release
- java -jar VersionUploader.jar --hangar
# Execute Jar file
- java -jar VersionUploader.jar --all
uploadToCodeberg:
image: woodpeckerci/plugin-gitea-release
settings:
base_url: https://codeberg.org
files:
- "bukkit/target/AdvancedServerList-*.jar"
- "bungeecord/target/AdvancedServerList-*.jar"
- "velocity/target/AdvancedServerList-*.jar"
api_key:
from_secret: CB_TOKEN
+12 -10
View File
@@ -3,6 +3,7 @@
AdvancedServerList is a plugin that allowys you to customize your server's MOTD, favicon, Player count text and player count hover displayed in a player's multiplayer server list based on conditions and priorities.
## Downloads
<a href="https://modrinth.com/plugin/advancedserverlist" target="_blank">
<img src="https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/modrinth_vector.svg" height="46" alt="modrinth" title="Available on Modrinth">
</a>
@@ -43,10 +44,10 @@ When multiple profiles exist that have valid conditions will the one with the hi
> [*Read More*][conditions]
### Placeholders
Placeholders can be used within conditions to further customize them. They can also be used in any other text option (motd, playerCount and players) to display their respective values.
Placeholders can be used within conditions to further customize them. They can also be used in any other text option to display their respective values.
The format is `${<target> <identifier>}` which was adopted from BungeeTabListPlus. Depending on what platform you use the plugin on are only specific placeholders available.
When using the SpigotMC/PaperMC version can you also use placeholders from [PlaceholderAPI][placeholderapi] using its `%<identifier>_<values>%` placeholder format. PlaceholderAPI needs to be installed for that.
When using the SpigotMC/PaperMC version, or while PAPIProxyBridge is installed on your proxy, can you also use placeholders from [PlaceholderAPI][placeholderapi] using its `%<identifier>_<values>%` placeholder format. PlaceholderAPI needs to be installed for that.
If you're a plugin dev can you even add your own custom placeholders through AdvancedServerList's own API.
@@ -60,13 +61,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 |
| [PAPIProxyBridge] | Spigot, Paper, BungeeCord, Velocity | No |
| [Maintenance] | Spigot, Paper, BungeeCord, Velocity | No |
| Dependency | Platforms | Required? |
|-------------------|----------------------|-----------|
| [ProtocolLib] | Spigot | Yes |
| [PlaceholderAPI] | Spigot, Paper | No |
| [ViaVersion] | Spigot, Paper | No |
| [PAPIProxyBridge] | BungeeCord, Velocity | No |
| [Maintenance] | All | No |
## Statistics
@@ -84,6 +85,7 @@ You can disable this in the global bStats config file located in `/plugins/bstat
</a>
## Support
<a href="https://discord.gg/6dazXp6" target="_blank">
<img src="https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact-minimal/social/discord-singular_vector.svg" height="64" alt="discord" title="Join my Discord Server">
</a>
@@ -103,7 +105,7 @@ You can disable this in the global bStats config file located in `/plugins/bstat
[modrinth]: https://modrinth.com/plugin/advancedserverlist
[protocollib]: https://hangar.papermc.io/dmulloy2/ProtocolLib
[placeholderapi]: https://www.spigotmc.org/resources/6245/
[placeholderapi]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
[viaversion]: https://hangar.papermc.io/ViaVersion/ViaVersion
[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
[maintenance]: https://hangar.papermc.io/kennytv/Maintenance
+5 -5
View File
@@ -94,13 +94,13 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.0</version>
<version>4.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0</version>
<version>5.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -112,13 +112,13 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<version>2.11.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.viaversion</groupId>
<artifactId>viaversion-api</artifactId>
<version>4.7.0</version>
<version>4.8.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -143,7 +143,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
@@ -25,13 +25,14 @@
package ch.andre601.advancedserverlist.bukkit.objects.placeholders;
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitServer;
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.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitPlayerImpl;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitServerImpl;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import ch.andre601.advancedserverlist.core.objects.GenericServerImpl;
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
import ch.andre601.advancedserverlist.core.profiles.profile.ProfileManager;
@@ -92,7 +93,7 @@ public class PAPIPlaceholders<F> extends PlaceholderExpansion{
int protocol = resolveProtocol(pl);
int online = Bukkit.getOnlinePlayers().size();
int max = Bukkit.getMaxPlayers();
GenericServer server = new GenericServerImpl(online, max, host);
BukkitServer server = new BukkitServerImpl(plugin.getWorldCache().worlds(), online, max, host);
GenericPlayer player = new BukkitPlayerImpl(pl, cached, protocol);
ServerListProfile profile = ProfileManager.resolveProfile(plugin.getCore(), player, server);
@@ -101,17 +102,29 @@ public class PAPIPlaceholders<F> extends PlaceholderExpansion{
ProfileEntry entry = ProfileManager.merge(profile);
if(ProfileManager.checkOption(entry.extraPlayersEnabled()))
max = online + (entry.extraPlayersCount() == null ? 0 : entry.extraPlayersCount());
Integer maxPlayers = null;
if(ProfileManager.checkOption(entry.maxPlayersEnabled())){
max = entry.maxPlayersCount() == null ? 0 : entry.maxPlayersCount();
maxPlayers = entry.maxPlayersCount();
}
GenericServer finalServer = new GenericServerImpl(online, max, host);
Integer extraPlayers = null;
if(ProfileManager.checkOption(entry.extraPlayersEnabled())){
max = online + (entry.extraPlayersCount() == null ? 0 : entry.extraPlayersCount());
extraPlayers = entry.extraPlayersCount();
}
BukkitServer finalServer = new BukkitServerImpl(plugin.getWorldCache().worlds(), online, max, host);
return switch(identifier.toLowerCase(Locale.ROOT)){
case "motd" -> getOption(entry.motd(), pl, player, finalServer);
case "favicon" -> getOption(entry.favicon(), pl, player, finalServer);
case "playercount_hover" -> getOption(entry.players(), pl, player, finalServer);
case "playercount_text" -> getOption(entry.playerCountText(), pl, player, finalServer);
case "extra_players_max" -> String.valueOf(max);
// TODO: Remove extra_players_max in future release
case "extra_players_max", "playercount_extraplayers" -> extraPlayers == null ? "null" : String.valueOf(extraPlayers);
case "playercount_maxplayers" -> maxPlayers == null ? "null" : String.valueOf(maxPlayers);
case "server_playersmax" -> String.valueOf(max);
default -> null;
};
}
@@ -137,6 +150,7 @@ public class PAPIPlaceholders<F> extends PlaceholderExpansion{
// getProtocolVersion is only in Paper, so this is only called when main class isn't SpigotCore.
// Also, ViaVersion is not present, so the player protocol *should* be the same as the server.
//noinspection deprecation
return Bukkit.getUnsafe().getProtocolVersion();
}
@@ -8,6 +8,8 @@ loader: 'ch.andre601.advancedserverlist.paper.ASLLoader'
api-version: '1.19'
folia-supported: true
dependencies:
server:
PlaceholderAPI:
+8 -8
View File
@@ -67,39 +67,39 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.20-R0.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.20-R0.1</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.13.0</version>
<version>4.14.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.13.0</version>
<version>4.14.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bungeecord</artifactId>
<version>4.1.2</version>
<version>4.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bungeecord</artifactId>
<version>3.0.0</version>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -111,7 +111,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -133,7 +133,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
+3 -3
View File
@@ -110,13 +110,13 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
<version>32.1.3-jre</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.william278</groupId>
<artifactId>papiproxybridge</artifactId>
<version>1.3</version>
<version>1.4.2</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -152,7 +152,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
@@ -31,7 +31,6 @@ import ch.andre601.advancedserverlist.core.check.UpdateChecker;
import ch.andre601.advancedserverlist.core.commands.CommandHandler;
import ch.andre601.advancedserverlist.core.file.FileHandler;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.core.objects.ServerPlaceholders;
import ch.andre601.advancedserverlist.core.profiles.players.PlayerHandler;
import java.io.IOException;
@@ -72,11 +72,18 @@ public class PingEventHandler{
if(entry.isInvalid())
return;
if(ProfileManager.checkOption(entry.extraPlayersEnabled())){
boolean extraPlayers = ProfileManager.checkOption(entry.extraPlayersEnabled());
if(extraPlayers){
max = online + (entry.extraPlayersCount() == null ? 0 : entry.extraPlayersCount());
event.setMaxPlayers(max);
}
if(ProfileManager.checkOption(entry.maxPlayersEnabled()) && !extraPlayers){
max = (entry.maxPlayersCount() == null) ? 0 : entry.maxPlayersCount();
event.setMaxPlayers(max);
}
GenericServer finalServer = event.createGenericServer(online, max, host);
if(ProfileManager.checkOption(entry.motd())){
@@ -1,56 +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.core.objects;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
public class GenericServerImpl implements GenericServer{
private final int online;
private final int max;
private final String host;
public GenericServerImpl(int online, int max, String host){
this.online = online;
this.max = max;
this.host = host;
}
@Override
public int getPlayersOnline(){
return online;
}
@Override
public int getPlayersMax(){
return max;
}
@Override
public String getHost(){
return host;
}
}
@@ -1,47 +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.core.objects;
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
public class ServerPlaceholders extends PlaceholderProvider{
public ServerPlaceholders(){
super("server");
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer genericPlayer, GenericServer genericServer){
return switch(placeholder){
case "playersOnline" -> String.valueOf(genericServer.getPlayersOnline());
case "playersMax" -> String.valueOf(genericServer.getPlayersMax());
case "host" -> genericServer.getHost();
default -> null;
};
}
}
@@ -53,13 +53,16 @@ public class ProfileManager{
String favicon = resolveFavicon(entry, defEntry);
boolean isHidePlayersEnabled = resolveHidePlayersEnabled(entry, defEntry);
boolean isExtraPlayersEnabled = resolveExtraPlayersEnabled(entry, defEntry);
boolean isMaxPlayersEnabled = resolveMaxPlayersEnabled(entry, defEntry);
Integer extraPlayersCount = resolveExtraPlayersCount(entry, defEntry);
Integer maxPlayersCount = resolveMaxPlayersCount(entry, defEntry);
return new ProfileEntry(motd, players, playerCountText, favicon,
NullBool.resolve(isHidePlayersEnabled), NullBool.resolve(isExtraPlayersEnabled), extraPlayersCount);
NullBool.resolve(isHidePlayersEnabled), NullBool.resolve(isExtraPlayersEnabled), NullBool.resolve(isMaxPlayersEnabled),
extraPlayersCount, maxPlayersCount);
}
public static ServerListProfile resolveProfile(AdvancedServerList core, GenericPlayer player, GenericServer server){
public static ServerListProfile resolveProfile(AdvancedServerList<?> core, GenericPlayer player, GenericServer server){
for(ServerListProfile profile : core.getFileHandler().getProfiles()){
if(profile.isInvalidProfile())
continue;
@@ -78,7 +81,9 @@ public class ProfileManager{
String favicon = node.node("favicon").getString("");
NullBool hidePlayers = resolveNullBool(node, "playerCount", "hidePlayers");
NullBool extraPlayersEnabled = resolveNullBool(node, "playerCount", "extraPlayers", "enabled");
Integer extraPlayers = resolveNullableInt(node);
NullBool maxPlayersEnabled = resolveNullBool(node, "playerCount", "maxPlayers", "enabled");
Integer extraPlayers = resolveNullableInt(node, "playerCount", "extraPlayers", "amount");
Integer maxPlayers = resolveNullableInt(node, "playerCount", "maxPlayers", "amount");
return new ProfileEntry.Builder()
.setMotd(motd)
@@ -87,7 +92,9 @@ public class ProfileManager{
.setFavicon(favicon)
.setHidePlayersEnabled(hidePlayers)
.setExtraPlayersEnabled(extraPlayersEnabled)
.setExtraPlayerCount(extraPlayers)
.setMaxPlayersEnabled(maxPlayersEnabled)
.setExtraPlayersCount(extraPlayers)
.setMaxPlayersCount(maxPlayers)
.build();
}
@@ -150,6 +157,13 @@ public class ProfileManager{
return profile.extraPlayersEnabled().getOrDefault(false);
}
private static boolean resolveMaxPlayersEnabled(ProfileEntry profile, ProfileEntry defaultProfile){
if(profile == null || !checkOption(profile.maxPlayersEnabled()))
return defaultProfile.maxPlayersEnabled().getOrDefault(false);
return profile.maxPlayersEnabled().getOrDefault(false);
}
private static Integer resolveExtraPlayersCount(ProfileEntry profile, ProfileEntry defaultProfile){
if(profile == null || profile.extraPlayersCount() == null)
return defaultProfile.extraPlayersCount() == null ? 0 : defaultProfile.extraPlayersCount();
@@ -157,6 +171,13 @@ public class ProfileManager{
return profile.extraPlayersCount();
}
private static Integer resolveMaxPlayersCount(ProfileEntry profile, ProfileEntry defaultProfile){
if(profile == null || profile.maxPlayersCount() == null)
return defaultProfile.maxPlayersCount() == null ? 0 : defaultProfile.maxPlayersCount();
return profile.maxPlayersCount();
}
private static List<String> resolveList(ConfigurationNode node, Object... path){
try{
return node.node(path).getList(String.class);
@@ -172,10 +193,10 @@ public class ProfileManager{
return NullBool.resolve(node.node(path).getBoolean());
}
private static Integer resolveNullableInt(ConfigurationNode node){
if(node.node("playerCount", "extraPlayers", "amount").virtual())
private static Integer resolveNullableInt(ConfigurationNode node, Object... path){
if(node.node(path).virtual())
return null;
return node.node("playerCount", "extraPlayers", "amount").getInt();
return node.node(path).getInt();
}
}
@@ -52,8 +52,10 @@ public class ProfileSerializer implements TypeSerializer<ProfileEntry>{
node.node("playerCount", "hover").set(profile.players());
node.node("playerCount", "text").set(profile.playerCountText());
node.node("favicon").set(profile.favicon());
node.node("playerCount", "hidePlayers").set(profile.hidePlayersEnabled());
node.node("playerCount", "extraPlayers", "enabled").set(profile.extraPlayersEnabled());
node.node("playerCount", "extraPlayers", "amount").set(profile.extraPlayersCount());
node.node("playerCount", "hidePlayers").set(profile.hidePlayersEnabled().getOrDefault(false));
node.node("playerCount", "extraPlayers", "enabled").set(profile.extraPlayersEnabled().getOrDefault(false));
node.node("playerCount", "extraPlayers", "amount").set((profile.extraPlayersCount() == null) ? 0 : profile.extraPlayersCount());
node.node("playerCount", "maxPlayers", "enabled").set(profile.maxPlayersEnabled().getOrDefault(false));
node.node("playerCount", "maxPlayers", "amount").set((profile.maxPlayersCount() == null) ? 0 : profile.maxPlayersCount());
}
}
+42 -13
View File
@@ -2,7 +2,7 @@
# Set the priority of this profile.
# Higher number = Higher priority.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#priority
# Read more: https://asl.andre601.ch/profiles/#priority
#
priority: 0
@@ -10,7 +10,7 @@ priority: 0
# Set conditions that needs to be met.
# Only when all conditions return true will the profile be shown (Given no profile with higher priority is used).
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#conditions
# Read more: https://asl.andre601.ch/profiles/#conditions
#
#conditions:
# - '{playerVersion} < 759'
@@ -25,7 +25,7 @@ priority: 0
#
# Remove this option or set it to profiles: [] to use the global options of this file.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#profiles
# Read more: https://asl.andre601.ch/profiles/#profiles
#
#profiles:
# - motd:
@@ -49,7 +49,7 @@ priority: 0
#
# Remove this option or set it to motd: [] to not alter the MOTD.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#motds
# Read more: https://asl.andre601.ch/profiles/#motd
#
motd:
- '<grey>Line 1'
@@ -64,14 +64,14 @@ motd:
#
# Remove this option or set to favicon: '' to not replace the Favicon.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#favicon
# Read more: https://asl.andre601.ch/profiles/#favicon
#
favicon: ''
#
# Contains various options to manipulate the player count (Text displaying online and max players allowed).
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#playercount
# Read more: https://asl.andre601.ch/profiles/#playercount
#
playerCount:
#
@@ -82,7 +82,7 @@ playerCount:
#
# Defaults to false when not present.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#hideplayers
# Read more: https://asl.andre601.ch/profiles/#hideplayers
#
hidePlayers: false
#
@@ -90,7 +90,7 @@ playerCount:
#
# Remove this option or set it to hover: [] to not modify the player samples on the player count.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#hover
# Read more: https://asl.andre601.ch/profiles/#hover
#
hover:
- '<grey>Line 1'
@@ -104,24 +104,24 @@ playerCount:
#
# Remove this option or set it to text: '' to not modify the player count text.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#text
# Read more: https://asl.andre601.ch/profiles/#text
#
text: ''
#
# Allows you to modify the max player count displayed.
# Note that this will affect ${server playersMax} (Except for when used in conditions).
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#extraPlayers
# Read more: https://asl.andre601.ch/profiles/#extraplayers
#
extraPlayers:
#
# Enables/Disables the extraPlayers option.
# When enabled will the total amount of players allowed be modified to the current
# When enabled will the total amount of players allowed to join be modified to the current
# number of online players + 'amount'
#
# Defaults to false when not present.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#enabled
# Read more: https://asl.andre601.ch/profiles/#extraplayers-enabled
#
enabled: false
#
@@ -134,6 +134,35 @@ playerCount:
#
# Defaults to 0 when not present.
#
# Read more: https://github.com/Andre601/AdvancedServerList/wiki/Profiles#amount
# Read more: https://asl.andre601.ch/profiles/#extraplayers-amount
#
amount: 0
#
# Allows you to set the max players that could join your server.
# Note that this option influences the '${server playersMax}' placeholder.
#
# The settings of this option have no effect should 'extraPlayers' be enabled
#
# Read more: https://asl.andre601.ch/profiles/#maxplayers
#
maxPlayers:
#
# Enables/Disables the maxPlayers option.
# When enabled will the total amount of players allowed to join be changed to what 'amount' is set to.
#
# Defaults to false when not present.
#
# Read more: https://asl.andre601.ch/profiles/#maxplayers-enabled
#
enabled: false
#
# Sets the number to display for the max number of players allowed to join your server.
#
# Example:
# Setting this option to 0 (Default) while 1 player is online would display '1/0'
#
# Defaults to 0 if not set.
#
# Read more: https://asl.andre601.ch/profiles/#maxplayers-amount
#
amount: 0
+58
View File
@@ -0,0 +1,58 @@
#
# Modified version of Squidfunk's shortcodes.py file for Material for MkDocs.
#
# It was altered to create compact admonition-like boxes to display in the documentation.
#
# Original shortcodes.py file:
# https://github.com/squidfunk/mkdocs-material/blob/56b96b4d799174d48d36613d70ffac9b964171cc/material/overrides/hooks/shortcodes.py
#
from __future__ import annotations
import posixpath
import re
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.files import File, Files
from mkdocs.structure.pages import Page
from re import Match
def on_page_markdown(
markdown: str, *, page: Page, config: MkDocsConfig, files: Files
):
# Replace callback
def replace(match: Match):
type, args = match.groups()
args = args.strip()
if type == "abstract": return _admo(text = args, type = "abstract")
elif type == "info": return _admo(text = args, type = "info")
elif type == "tip": return _admo(text = args, type = "tip")
elif type == "success": return _admo(text = args, type = "success")
elif type == "question": return _admo(text = args, type = "question")
elif type == "warning": return _admo(text = args, type = "warning")
elif type == "failure": return _admo(text = args, type = "failure")
elif type == "danger": return _admo(text = args, type = "danger")
elif type == "bug": return _admo(text = args, type = "bug")
elif type == "example": return _admo(text = args, type = "example")
elif type == "quote": return _admo(text = args, type = "quote")
else: return _admo(text = args)
# Otherwise, raise an error
raise RuntimeError(f"Unknown shortcode: {type}")
# Find and replace all external asset URLs in current page
return re.sub(
r"<!-- admo:(\w+)(.*?) -->",
replace, markdown, flags = re.I | re.M
)
def _admo(text: str = "", type: str = ""):
classes = f"mdx-badge mdx-badge--{type}" if type else "mdx-badge"
iconClasses = f"mdx-badge__icon mdx-badge--{type}" if type else "mdx-badge__icon"
return "".join([
f"<div class=\"{classes}\">",
f"<span class=\"{iconClasses}\"></span>",
*([f"<span class=\"mdx-badge__text\">{text}</span>"] if text else []),
f"</div>",
])
+17 -2
View File
@@ -33,7 +33,9 @@
{% endif %}
{% set desc = "" %}
{% if summary.description %}
{% if summary.deprecated %}
{% set desc = "<api__deprecated></api__deprecated><br>" ~ summary.deprecated.split("<br>")[0] %}
{% elif summary.description %}
{% set desc = summary.description.split("<br>")[0] %}
{% endif %}
@@ -53,7 +55,7 @@
{% set final_name.name = final_name.name ~ ")" %}
{% endif %}
{% if details_type and details_type == "method" %}
{% if details_type and details_type == "method" %}
{% if modifiers.name %}
<td><code>{{ modifiers.name }}</code></td>
{% else %}
@@ -124,6 +126,10 @@
{% endif %}
<h3 id="{{ final_name.name | lower() | replace(' ', '-') | e }}">
{% if detail.deprecated %}
<api__deprecated></api__deprecated>
{% endif %}
{% for attribute in detail.attributes %}
<api__{{- attribute -}}></api__{{- attribute -}}>
{% endfor %}
@@ -142,6 +148,15 @@
<code>{{ final_name.name | e }}</code><a href="#{{ final_name.name | lower() | replace(' ', '-') | e }}" class="headerlink" title="Permanent link"></a>
</h3>
{% if detail.deprecated %}
<div class="admonition deprecated">
<div class="admonition-title">Deprecation Warning</div>
<p>
{{ detail.deprecated }}
</p>
</div>
{% endif %}
{% if detail.description %}
<p class="api-detail__description">
{{ detail.description }}
+42
View File
@@ -0,0 +1,42 @@
<!-- Tags -->
{% if "material/tags" in config.plugins and tags %}
{% include "partials/tags.html" %}
{% endif %}
<!-- Actions -->
{% include "partials/actions.html" %}
{% if config.extra.github_repository %}
<div class="admonition info">
<p class="admonition-title">Moved</p>
<p>
The documenation has been moved and can now be found at <a href="https://asl.andre601.ch" target="_blank" rel="noreferral nofollow noopener"><strong>asl.andre601.ch</strong></a>.<br>
This page in particular can be found at <a href="https://asl.andre601.ch/{{ page.url }}" target="_blank" rel="noreferral nofollow noopener"><strong>asl.andre601.ch/{{ page.url }}</strong></a>.
</p>
</div>
{% endif %}
<!--
Hack: check whether the content contains a h1 headline. If it doesn't, the
page title (or respectively site name) is used as the main headline.
-->
{% if "\x3ch1" not in page.content %}
<h1>{{ page.title | d(config.site_name, true)}}</h1>
{% endif %}
<!-- Page content -->
{{ page.content }}
<!-- Source file information -->
{% if page.meta and (
page.meta.git_revision_date_localized or
page.meta.revision_date
) %}
{% include "partials/source-file.html" %}
{% endif %}
<!-- Was this page helpful? -->
{% include "partials/feedback.html" %}
<!-- Comment system -->
{% include "partials/comments.html" %}
-17
View File
@@ -1,17 +0,0 @@
<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>
+3 -4
View File
@@ -1,9 +1,8 @@
nav:
- Home:
- index.md
- commands.md
- Home: index.md
- commands
- profiles
- examples
- migration
- api
- placeholderapi
- PlaceholderAPI: placeholderapi
+1
View File
@@ -0,0 +1 @@
<div class="mdx-badge"><span class="mdx-badge__icon">[:octicons-tag-24:](changelog.md#v3.1.0 'View latest Release Changelog')</span><span class="mdx-badge__text">[v3.1.0](changelog.md#v3.1.0 'View latest Release Changelog')</span></div>
+1
View File
@@ -0,0 +1 @@
<div class="mdx-badge"><span class="mdx-badge__icon" >[:octicons-alert-24:](changelog.md)</span><span class="mdx-badge__text">[v3.1.0](changelog.md#v3.1.0 'View latest Release Changelog')</span></div>
+38 -4
View File
@@ -7,7 +7,34 @@ icon: octicons/log-24
This page lists the recent changes made towards the AdvancedServerListAPI.
They are ordered newest to oldest.
## v3.0.0
## v3.1.0 { #v3.1.0 }
### :octicons-plus-circle-24:{ .changelog-added title="Added" } Added { #v3.1.0-added }
- New getters in [`ProfileEntry`][profileentry]:
- [`maxPlayersEnabled()`][maxplayersenabled] - Returns the value for `playerCount -> maxPlayers -> enabled` as `NullBool`
- [`maxPlayersCount()`][maxplayerscount] - Returns the value of `playerCount -> maxPlayers -> amount` as nullable `Integer`
- New setters in [`ProfileEntry.Builder`][profileentry.builder]:
- [`setMaxPlayersEnabled(NullBool)`][setmaxplayersenabled] - Sets whether the max players feature is enabled or not.
- [`setMaxPlayersCount(Integer)`][setmaxplayerscount] - Sets the number to use for the max players count.
- [`setExtraPlayersCount(Integer)`][setextraplayersecount] - Replacement for [deprecated `setExtraPlayerCount(Integer)` method](#v3.1.0-deprecated).
### :octicons-zap-24:{ .changelog-breaking title="Deprecated" } Deprecated { #v3.1.0-deprecated }
- `setExtraPlayerEnabled(Integer)` in `ProfileEntry.Builder` - Typo in method name.
[profileentry]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/index.md
[maxplayersenabled]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/index.md#maxplayersenabled()
[maxplayerscount]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/index.md#maxplayerscount()
[profileentry.builder]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/builder.md
[setmaxplayersenabled]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/builder.md#setmaxplayersenabled(nullbool)
[setmaxplayerscount]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/builder.md#setmaxplayerscount(integer)
[setextraplayersecount]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/builder.md#setextraplayerscount(integer)
----
## v3.0.0 { #v3.0.0 }
### :octicons-alert-24:{ .changelog-breaking title="Breaking Changes" } Breaking Changes { #v3-breaking }
@@ -25,14 +52,18 @@ They are ordered newest to oldest.
- All previously deprecated `getX()` methods from the `ProfileEntry` record
## v2.1.0
----
## v2.1.0 { #v2.1.0 }
### :octicons-pencil-24:{ .changelog-changed title="Changed" } Changed { #v2.1.0-changed }
- Turned `ProfileEntry` class into a record
- Former `getX()` methods are now deprecated in favour of the record's own `x()` methods (i.e. `getMotd()` -> `motd()`)
## v2.0.0
----
## v2.0.0 { #v2.0.0 }
### :octicons-alert-24:{ .changelog-breaking title="Breaking Changes" } Breaking Changes { #v2-breaking }
@@ -61,7 +92,9 @@ They are ordered newest to oldest.
- `UnsupportedAPIAccessException` as it is no longer used in the API itself.
## v1.0.0
----
## v1.0.0 { #v1.0.0 }
### :octicons-plus-circle-24:{ .changelog-added title="Added" } Added { #v1-added }
@@ -78,5 +111,6 @@ Templates for changelog
### :octicons-plus-circle-24:{ .changelog-added title="Added" } Added { #v-added }
### :octicons-pencil-24:{ .changelog-changed title="Changed" } Changed { #v-changed }
### :octicons-trash-24:{ .changelog-removed title="Removed" } Removed { #v-removed }
### :octicons-zap-24:{ .changelog-deprecated title="Deprecated" } Deprecated { #v-deprecated }
-->
+278 -75
View File
@@ -9,35 +9,10 @@ It provides a way for your plugin to provide its own placeholders that should be
## Add dependency
Add the following to your `build.gradle` or `pom.xml` file to use the API:
=== ":simple-gradle: Gradle"
[![latest_release][release]][api-repo]
Make sure to replace `{version}` with the version displayed above.
```groovy title="build.gradle"
repositorories {
maven { url = 'https://jitpack.io/' }
}
dependencies {
implementation 'ch.andre601.asl-api:api:{version}'
// Optional platform dependencies
implementation 'ch.andre601.asl-api:platform-bukkit:{version}'
implementation 'ch.andre601.asl-api:platform-bungeecord:{version}'
implementation 'ch.andre601.asl-api:platform-velocity:{version}'
}
```
Add the following to your `pom.xml`, `build.gradle` or `build.gradle.kts` depending on what you use:
=== ":simple-apachemaven: Maven"
[![latest_release][release]][api-repo]
Make sure to replace `{version}` with the version displayed above.
```xml title="pom.xml"
<repositories>
<repository>
@@ -51,6 +26,7 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
<groupId>ch.andre601.asl-api</groupId>
<artifactId>api</artifactId>
<version>{version}</version>
<scope>provided</scope>
</dependency>
<!-- Optional platform dependencies -->
@@ -58,38 +34,67 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
<groupId>ch.andre601.asl-api</groupId>
<artifactId>platform-bukkit</artifactId>
<version>{version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.andre601.asl-api</groupId>
<artifactId>platform-bungeecord</artifactId>
<version>{version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.andre601.asl-api</groupId>
<artifactId>platform-velocity</artifactId>
<version>{version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
```
=== ":simple-gradle: Gradle"
```groovy title="build.gradle"
repositorories {
maven { url = 'https://jitpack.io/' }
}
dependencies {
compileOnly 'ch.andre601.asl-api:api:{version}'
// Optional platform dependencies
compileOnly 'ch.andre601.asl-api:platform-bukkit:{version}'
compileOnly 'ch.andre601.asl-api:platform-bungeecord:{version}'
compileOnly 'ch.andre601.asl-api:platform-velocity:{version}'
}
```
=== ":simple-gradle: Gradle (KTS)"
```kotlin title="build.gradle.kts"
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("ch.andre601.asl-api:api:{version}")
// Optional platform dependencies
compileOnly("ch.andre601.asl-api:platform-bukkit:{version}")
compileOnly("ch.andre601.asl-api:platform-bungeecord:{version}")
compileOnly("ch.andre601.asl-api:platform-velocity:{version}")
}
```
[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
## Adding your own Placeholders
## Add own placeholders
<!-- admo:info This requires the main api module -->
To add your own placeholders will you need to do a few steps.
The API allows you to add your own placeholders which would be available through the `${<identifier> <values>}` placeholder Pattern in a Server List profile.
### 1) Get API instance
To add your own placeholders, follow these steps:
Use `AdvancedServerListAPI.get()` to retrieve an instance of the currently used AdvancedServerList API.
It will be needed at a later point.
### 1. Create a Placeholder class
### 2) Create a Placeholder class
You should first create a new class and make it extend the abstract [`PlaceholderProvider`][placeholderprovider]. This class includes a constructor and a method you need to add, so do that:
Make a new class that you want to use for the placeholders and let it extend the `PlaceholderProvider` class of AdvancedServerList.
Your IDE should now tell you to implement/override some methods. Confirm this action and your class should look something alongside this:
```java title="PlaceholderProvider example"
```java
public class MyPlaceholders extends PlaceholderProvider {
public MyPlaceholders(String identifier) {
@@ -103,60 +108,258 @@ public class MyPlaceholders extends PlaceholderProvider {
}
```
It's recommended to replace your generated constructor with a no-args one and set the identifier directly in the `super()`.
For example:
```java
public MyPlaceholders() {
super("myplaceholders");
}
```
The next step now would be to handle the different placeholders. These are handled in the `parsePlaceholder` method you had to override.
The `placeholder` String is whatever value was provided after the identifier in `${<identifier> <placeholder>}`. It can contain spaces.
Something to note is, that when returning `null` will AdvancedServerList understand it as an invalid placeholder and return it unchanged.
Here is a small example of the final class:
```java title="PlaceholderProvider example"
public class MyPlaceholders extends PlaceholderProvider {
!!! tip
You can replace the Constructor with a String argument with a no-args constructor and set the identifier directly in the `super`:
```java
public MyPlaceholders() {
super("myplaceholders");
}
```
The [`parsePlaceholder(String, GenericPlayer, GenericServer)`][parseplaceholder] method is used by AdvancedServerList to replace a matching placeholder with a value.
What you return is completely up to you. Just keep in mind that returning `null` will be treated as an invalid placeholder by AdvancedServerList, resulting in the placeholder being returned as-is without any changes.
[placeholderprovider]: reference/api/ch.andre601.advancedserverlist.api/placeholderprovider.md
[parseplaceholder]: reference/api/ch.andre601.advancedserverlist.api/placeholderprovider.md#parseplaceholder(string,-genericplayer,-genericserver)
??? example "Example of final class"
```java
public class MyPlaceholders extends PlaceholderProvider {
public MyPlaceholders() {
super("myplaceholders");
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server) {
if(placeholder.equalsIgnoreCase("hello"))
return "Hello " + player.getName();
return null;
}
}
```
### 2. Register the Placeholders
Next step should be to register the placeholder. To achieve this, first obtain an instance of the [`AdvancedServerListAPI`][advancedserverlistapi] by using the static [`get()`][get] method. After that call [`addPlaceholderProvider(PlaceholderProvider placeholderProvider)`][addplaceholderprovider].
Your code may look similar to this:
```java title="Registering PlaceholderProvider class"
public class MyPlugin extends JavaPlugin {
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server) {
if(placeholder.equals("hello"))
return "Hi!";
public void onEnable() {
AdvancedServerListAPI api = AdvancedServerListAPI.get();
return null;
api.addPlaceholderProvider(new MyPlaceholders());
}
}
```
### 3) Register the placeholder class
[advancedserverlistapi]: reference/api/ch.andre601.advancedserverlist.api/advancedserverlistapi.md
[get]: reference/api/ch.andre601.advancedserverlist.api/advancedserverlistapi.md#get()
[addplaceholderprovider]: reference/api/ch.andre601.advancedserverlist.api/advancedserverlistapi.md#addplaceholderprovider(placeholderprovider)
All that is left to do now is to register your class as a new PlaceholderProvider instance. To do this, get the API instance you retrieved earlier and use `addPlaceholderProvider` with a new instance of your class.
This should register your PlaceholderExpansion as long as it is valid, meaning that the identifier...
```java title="Registering PlaceholderProvider class"
AdvancedServerListAPI api = AdvancedServerListAPI.get();
- ...is not `null`
- ...is not containing spaces
- ...is not using a name already registered in the API
api.addPlaceholderProvider(new MyPlaceholders());
```
### 3. Declare AdvancedServerList as (soft)depend
## Events
The final thing you should make sure is to define AdvancedServerList as a depend or soft-depend for your plugin, to make sure it loads after AdvancedServerList.
!!! info "Note"
The mentioned event is only accessible through one of the platform dependencies, as those are used in the platform's respective event handler system.
Below are example setups for Spigot, Paper, BungeeCord and Velocity:
v2 of the API adds the `PreServerListSetEvent` to the different platform dependencies to use.
It allows you to modify the ProfileEntry used for the player pinging the server/proxy or even cancelling the event altogether.
=== ":simple-spigotmc: Spigot"
=== "Softdepend"
```yaml title="plugin.yml"
name: "MyPlugin"
author: "author"
version: "1.0.0"
main: "com.example.plugin.ExamplePlugin"
softdepend:
- AdvancedServerList
```
=== "Depend"
```yaml title="plugin.yml"
name: "MyPlugin"
author: "author"
version: "1.0.0"
main: "com.example.plugin.ExamplePlugin"
depend:
- AdvancedServerList
```
=== ":fontawesome-solid-paper-plane: Paper"
=== "Softdepend"
```yaml title="paper-plugin.yml"
name: "MyPlugin"
author: "author"
version: "1.0.0"
main: "com.example.plugin.ExamplePlugin"
dependencies:
server:
AdvancedServerList:
load: BEFORE
required: false # Default, not required
```
=== "Depend"
```yaml title="paper-plugin.yml"
name: "MyPlugin"
author: "author"
version: "1.0.0"
main: "com.example.plugin.ExamplePlugin"
dependencies:
server:
AdvancedServerList:
load: BEFORE
required: true
```
=== ":octicons-git-merge-24: BungeeCord"
=== "Softdepend"
```yaml title="bungee.yml"
name: "MyPlugin"
author: "author"
version: "1.0.0"
main: "com.example.plugin.ExamplePlugin"
softDepends:
- AdvancedServerList
```
=== "Depend"
```yaml title="bungee.yml"
name: "MyPlugin"
author: "author"
version: "1.0.0"
main: "com.example.plugin.ExamplePlugin"
depends:
- AdvancedServerList
```
=== ":octicons-git-merge-24: Velocity"
=== "Softdepend (File)"
```json title="velocity-plugin.json"
{
"id": "myplugin",
"name": "MyPlugin",
"version": "1.0.0",
"authors": [
"author"
],
"main": "com.example.plugin.ExamplePlugin",
"dependencies": [
{
"id": "advancedserverlist",
"optional": true
}
]
}
```
=== "Depend (File)"
```json title="velocity-plugin.json"
{
"id": "myplugin",
"name": "MyPlugin",
"version": "1.0.0",
"authors": [
"author"
],
"main": "com.example.plugin.ExamplePlugin",
"dependencies": [
{
"id": "advancedserverlist",
"optional": false
}
]
}
```
=== "Softdepend (Annotation)"
```java title="MyPlugin.java"
@Plugin(
id = "myplugin",
name = "MyPlugin",
version = "1.0.0",
authors = {"author"},
dependencies = {
@Dependency(
id = "advancedserverlist",
optional = true
)
}
)
public class MyPlugin {
// ...
}
```
=== "Depend (Annotation)"
```java title="MyPlugin.java"
@Plugin(
id = "myplugin",
name = "MyPlugin",
version = "1.0.0",
authors = {"author"},
dependencies = {
@Dependency(
id = "advancedserverlist",
optional = false // Default, not required
)
}
)
public class MyPlugin {
// ...
}
```
### 4. You're done!
Your plugin should now hook into AdvancedServerList and register its own custom placeholders to use.
## Listening for events
<!-- admo:info This requires the platform specific dependencies -->
AdvancedServerList provides an Event that your plugin can listen for.
The event is called `PreServerListSetEvent` and provides the following methods to use:
- [`getEntry()`][getentry] - Gets the currently set [`ProfileEntry`][profileentry].
- [`setEntry(ProfileEntry)`][setentry] - Sets a new [`ProfileEntry`][profileentry] to use.
- [`isCancelled()`][iscancelled] - Gets the current cancelled state of the event.
- [`setCancelled(boolean)`][setcancelled] - Sets the current cancelled state.
Setting the event's cancelled state to true will result in AdvancedServerList not altering the Server list.
Please check the server/proxy's documentation on how to listen for events with your plugin.
[getentry]: reference/api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#getentry()
[setentry]: reference/api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#setentry(profileentry)
[iscancelled]: reference/api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#iscancelled()
[setcancelled]: reference/api/ch.andre601.advancedserverlist.api/events/genericserverlistevent.md#setcancelled(boolean)
[profileentry]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/index.md
### ProfileEntry
The ProfileEntry class has been moved to the API in v2 allowing you to create your own versions using the available Builder class.
The ProfileEntry record is the core class used within the `PreServerListSetEvent`. It sets what values (MOTD, Favicon, Players, etc.) should be displayed.
Note that the record is - by nature - immutable and that the [`Builder`][builder] class should be used to create a new ProfileEntry instance to use.
This class contains values from a Server List Profile file. The values can either be from a `profiles` list entry, one of the global options in the file, or a mix of both, depending on what options are present.
You can create a new entry or copy an existing one (i.e. from the [`PreServerListSetEvent`](#events)) to modify and use in the server list by setting it in the aforementioned `PreServerListSetEvent`.
A convenience method exists to create a `Builder` instance from an existing `ProfileEntry` in case you only want to alter certain options while everything else unchanged.
This allows you to customize the Server list using your plugin. Just keep in mind that other plugins may also do the same, overriding your changes.
[builder]: reference/api/ch.andre601.advancedserverlist.api/profiles/profileentry/builder.md
+10
View File
@@ -0,0 +1,10 @@
---
template: redirect.html
location: https://docs.andre601.ch/asl-api
title: Javadocs
icon: octicons/link-external-24
---
<!-- Comment to trigger proper build -->
@@ -112,16 +112,67 @@ methods:
type:
name: 'Builder'
type: 'object'
- name: 'setExtraPlayers'
- name: 'setMaxPlayersEnabled'
description: |
Sets whether the max players feature should be enabled.<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: 'maxPlayersEnabled'
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: 'setExtraPlayerCount'
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>
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> or <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</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.'
description: 'The number of extra players to add.'
type: Integer
attributes:
- nullable
deprecated: 'Typo in the name. Use <a href="#setextraplayerscount(integer)">setExtraPlayersCount(Integer)</a> instead.'
type:
name: 'Builder'
type: 'object'
- name: 'setExtraPlayersCount'
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> or <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</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 add.'
type: Integer
attributes:
- nullable
type:
name: 'Builder'
type: 'object'
- name: 'setMaxPlayersCount'
description: |
Sets the number of max players allowed to join this server.<br>
This option has no effect when <a href="../#maxplayersenabled()"><code>maxPlayersEnabled</code></a> is set to <a href="../../objects/nullbool/#false"><code>NullBool.FALSE</code></a> or <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</code></a>.<br>
<br>
Set this to <code>null</code> to not alter the max player count. Alternatively, set <a href="#setmaxplayersenabled(nullbool)"><code>setMaxPlayersEnabled(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: 'maxPlayersCount'
description: 'The number of max players to set.'
type: Integer
attributes:
- nullable
@@ -37,11 +37,21 @@ constructors:
type: NullBool
attributes:
- notnull
- name: 'maxPlayersEnabled'
description: 'Whether the max 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
- name: 'maxPlayersCount'
description: 'The number to use for the max players count.'
type: Integer
attributes:
- nullable
seealso:
- name: 'ProfileEntry.Builder'
link: './builder/'
@@ -61,9 +71,11 @@ methods:
<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="#hideplayersenabled()"><code>hidePlayersEnabled</code></a>: <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</code></a></li>
<li><a href="#extraplayersenabled()"><code>extraPlayersEnabled</code></a>: <a href="../../objects/nullbool/#not_set"><code>NullBool.NOT_SET</code></a></li>
<li><a href="#maxplayersenabled()"><code>maxPlayersEnabled</code></a>: <a href="../../objects/nullbool/#not_set"><code>NullBoo.NOT_SET</code></a></li>
<li><a href="#extraplayerscount()"><code>extraPlayersCount</code></a>: <code>null</code></li>
<li><a href="#maxplayerscount()"><code>maxPlayersCount</code></a>: <code>null</code></li>
</ul>
returns: 'New ProfileEntry instance with empty/null values defined'
attributes:
@@ -142,6 +154,15 @@ methods:
name: 'NullBool'
type: 'object'
link: '../../objects/nullbool/'
- name: 'maxPlayersEnabled'
description: |
Whether the max players feature should be used or not.<br>
To get the actual boolean value, append <a href="../../objects/nullbool/#getordefault()"><code>getOrDefault(boolean)</code></a>.
returns: 'Whether the max players feature should be used or not.'
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.'
@@ -150,6 +171,14 @@ methods:
type:
name: 'Integer'
type: 'object'
- name: 'maxPlayersCount'
description: 'Gets the currently set number of max players of this ProfileEntry.'
returns: 'The current number of max players used by this ProfileEntry.'
attributes:
- nullable
type:
name: 'Integer'
type: 'object'
- name: 'isInvalid'
description: |
Whether this ProfileEntry is considered invalid or not.<br>
+18 -9
View File
@@ -5,6 +5,8 @@ The Reference docs follow a specific mixture of manually created and auto-genera
A page may look something like this:
```markdown
---
template: api-doc.html
constructors:
- name: 'Constructor'
description: 'Creates a new instance of this class.'
@@ -25,7 +27,7 @@ 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.
Below is a list of all custom tags. Note that these tags only render on the actual site and not within the repository when viewing the source.
- `<api__class></api__class>`: <api__class></api__class>
- `<api__interface></api__interface>`: <api__interface></api__interface>
@@ -36,16 +38,17 @@ Below is a list of all custom tags. Note that these tags only render on the actu
- `<api__final></api__final>`: <api__final></api__final>
- `<api__notnull></api__notnull>`: <api__notnull></api__notnull>
- `<api__nullable></api__nullable>`: <api__nullable></api__nullable>
- `<api__deprecated></api__deprecated>`: <api__deprecated></api__deprecated>
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>
- `<span class="api-type__primitive">primitive</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.
A page template is used to auto-generate the page content based on available YAML frontmatter.
Depending on the frontmatter available will the template call a jinja2 Macro to generate a Summary and Detailed info on the page for the respective frontmatter data.
There are 5 frontmatter options, each following a specific structure:
@@ -67,10 +70,11 @@ constructors:
type: '<string>'
attributes:
- '<string>'
deprecated: '<string>'
throws:
- name: '<string>'
description: '<string>'
seealos:
seealso:
- name: '<string>'
link: '<string>'
```
@@ -84,6 +88,7 @@ constructors:
- `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.
- `deprecated` - Adds a notice about the deprecation of this Constructor in the form of a deprecation label and a `deprecated` section with the provided `<string>` as explanation.
- `throws` - List of possible throws to display.
- `name` - Name of the throw to display.
- `description` - Description of the throw.
@@ -115,6 +120,7 @@ enums:
- name: '<string>'
description: '<string>'
type: '<string>'
deprecated: '<string>'
seealso:
- name: '<string>'
link: '<string>'
@@ -122,9 +128,10 @@ enums:
**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.
- `name` - The name to display for the Enum summary and detail. This should include any parameters the Enum has, but without any parameter name.
- `description` - The description to display for the Enum.
- `type` - The return type to display. Will default to `{{ page.title }}` if not set.
- `deprecated` - Adds a notice about the deprecation of this Enum in the form of a deprecation label and a `deprecated` section with the provided `<string>` as explanation.
- `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.
@@ -148,6 +155,7 @@ methods:
attributes:
- '<string>'
returns: '<string>'
deprecated: '<string>'
throws:
- name: '<string>'
description: '<string>'
@@ -158,8 +166,8 @@ methods:
**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.
- `name` - The name to display for the Method summary and detail. This should include any parameters the Method has, but without any parameter name.
- `description` - The description to display for the Method.
- `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.
@@ -171,6 +179,7 @@ methods:
- `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.
- `deprecated` - Adds a notice about the deprecation of this Method in the form of a deprecation label and a `deprecated` section with the provided `<string>` as explanation.
- `throws` - List of possible throws to display.
- `name` - Name of the throw to display.
- `description` - Description of the throw.
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+76 -10
View File
@@ -1,16 +1,82 @@
document$.subscribe(async () => {
const url = 'https://codeberg-stats-proxy.vercel.app/repo'
const repo_stats = document.querySelector('[data-md-component="source"] .md-source__repository');
const [release, repo] = await Promise.all([
fetch(`${url}/latest-release`).then(_ => _.json()),
fetch(`${url}/stats`).then(_ => _.json()),
]);
function loadCodebergInfo(data) {
const facts = document.createElement("ul");
facts.className = "md-source__facts";
const version = document.createElement("li");
version.className = "md-source__fact md-source__fact--version";
const stars = document.createElement("li");
stars.className = "md-source__fact md-source__fact--stars";
const forks = document.createElement("li");
forks.className = "md-source__fact md-source__fact--forks";
version.innerText = data["version"];
stars.innerText = data["stars"];
forks.innerText = data["forks"];
facts.appendChild(version);
facts.appendChild(stars);
facts.appendChild(forks);
repo_stats.appendChild(facts);
}
const list = document.querySelectorAll('ul[data-md-component="codeberg-stats"]');
function loadApiInfo(data) {
const version = data["version"];
const versionToken = '{version}';
const codeBlocks = document.querySelectorAll('.md-content pre code');
for(const codeBlock of codeBlocks) {
codeBlock.innerHTML = codeBlock.innerHTML.replace(new RegExp(versionToken, 'g'), version);
}
}
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>`
})
async function fetchApiInfo() {
const tag = await fetch("https://api.github.com/repos/Andre601/asl-api/releases/latest").then(_ => _.json());
const data = {
"version": tag.tag_name
};
__md_set("__api_tag", data, sessionStorage);
loadApiInfo(data);
}
async function fetchInfo() {
const [release, repo] = await Promise.all([
fetch(`${url}/latest-release`).then(_ => _.json()),
fetch(`${url}/stats`).then(_ => _.json()),
]);
const data = {
"version": release.name,
"stars": repo.stars,
"forks": repo.forks
};
__md_set("__git_repo", data, sessionStorage);
loadCodebergInfo(data);
}
if(!document.querySelector('[data-md-component="source"] .md-source__facts')) {
const cached = __md_get("__git_repo", sessionStorage);
if((cached != null) && (cached["version"])) {
loadCodebergInfo(cached);
} else {
fetchInfo();
}
}
if(location.href.includes('/api/')) {
const cachedApi = __md_get("__api_tag", sessionStorage);
if((cachedApi != null) && (cachedApi["version"])) {
loadApiInfo(cachedApi);
} else {
fetchApiInfo();
}
}
})
+257
View File
@@ -0,0 +1,257 @@
:root {
--md-badge-fg--note: #448aff;
--md-badge-bg--note: #448aff1a;
--md-badge-fg--abstract: #00b0ff;
--md-badge-bg--abstract: #00b0ff1a;
--md-badge-fg--info: #00b8d4;
--md-badge-bg--info: #00b8d41a;
--md-badge-fg--tip: #00bfa5;
--md-badge-bg--tip: #00bfa51a;
--md-badge-fg--success: #00c853;
--md-badge-bg--success: #00c8531a;
--md-badge-fg--question: #64dd17;
--md-badge-bg--question: #64dd171a;
--md-badge-fg--warning: #ff9100;
--md-badge-bg--warning: #ff91001a;
--md-badge-fg--failure: #ff5252;
--md-badge-bg--failure: #ff52521a;
--md-badge-fg--danger: #ff1744;
--md-badge-bg--danger: #ff17441a;
--md-badge-fg--bug: #f50057;
--md-badge-bg--bug: #f500571a;
--md-badge-fg--example: #7c4dff;
--md-badge-bg--example: #7c4dff1a;
--md-badge-fg--quote: #9e9e9e;
--md-badge-bg--quote: #9e9e9e1a;
--badge-icon--note: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M17.263 2.177a1.75 1.75 0 0 1 2.474 0l2.586 2.586a1.75 1.75 0 0 1 0 2.474L19.53 10.03l-.012.013L8.69 20.378a1.753 1.753 0 0 1-.699.409l-5.523 1.68a.748.748 0 0 1-.747-.188.748.748 0 0 1-.188-.747l1.673-5.5a1.75 1.75 0 0 1 .466-.756L14.476 4.963ZM4.708 16.361a.26.26 0 0 0-.067.108l-1.264 4.154 4.177-1.271a.253.253 0 0 0 .1-.059l10.273-9.806-2.94-2.939-10.279 9.813ZM19 8.44l2.263-2.262a.25.25 0 0 0 0-.354l-2.586-2.586a.25.25 0 0 0-.354 0L16.061 5.5Z"></path></svg>');
--badge-icon--abstract: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M5.962 2.513a.75.75 0 0 1-.475.949l-.816.272a.25.25 0 0 0-.171.237V21.25c0 .138.112.25.25.25h14.5a.25.25 0 0 0 .25-.25V3.97a.25.25 0 0 0-.17-.236l-.817-.272a.75.75 0 0 1 .474-1.424l.816.273A1.751 1.751 0 0 1 21 3.97v17.28A1.75 1.75 0 0 1 19.25 23H4.75A1.75 1.75 0 0 1 3 21.25V3.97a1.75 1.75 0 0 1 1.197-1.66l.816-.272a.75.75 0 0 1 .949.475Z"></path><path d="M7 1.75C7 .784 7.784 0 8.75 0h6.5C16.216 0 17 .784 17 1.75v1.5A1.75 1.75 0 0 1 15.25 5h-6.5A1.75 1.75 0 0 1 7 3.25Zm1.75-.25a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h6.5a.25.25 0 0 0 .25-.25v-1.5a.25.25 0 0 0-.25-.25Z"></path></svg>');
--badge-icon--info: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M13 7.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-3 3.75a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 .75.75v4.25h.75a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5h.75V12h-.75a.75.75 0 0 1-.75-.75Z"></path><path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Z"></path></svg>');
--badge-icon--tip: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M14.265 1.627c0 3.545 1.869 5.327 3.479 7.021 1.54 1.62 3.006 3.163 3.006 6.102 0 4.812-3.753 8.25-8.565 8.25-4.813 0-8.935-3.421-8.935-8.25 0-2.039.962-4.011 2.509-4.899.305-.175.672.007.803.334C7.563 12.684 8.797 12.64 9.437 12c.388-.387.47-1.116-.004-2.062-2.405-4.812 1.863-8.279 4.2-8.854.336-.082.615.198.632.543ZM12.185 21.5c4.059 0 7.065-2.84 7.065-6.75 0-2.337-1.093-3.489-2.678-5.158l-.021-.023c-1.44-1.517-3.139-3.351-3.649-6.557a6.148 6.148 0 0 0-1.911 1.76c-.787 1.144-1.147 2.633-.216 4.495.603 1.205.777 2.74-.277 3.794-.657.657-1.762 1.1-2.956.586-.752-.324-1.353-.955-1.838-1.79-.567.706-.954 1.74-.954 2.893 0 3.847 3.288 6.75 7.435 6.75Z"></path></svg>');
--badge-icon--success: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M21.03 5.72a.75.75 0 0 1 0 1.06l-11.5 11.5a.747.747 0 0 1-1.072-.012l-5.5-5.75a.75.75 0 1 1 1.084-1.036l4.97 5.195L19.97 5.72a.75.75 0 0 1 1.06 0Z"></path></svg>');
--badge-icon--question: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M10.97 8.265a1.45 1.45 0 0 0-.487.57.75.75 0 0 1-1.341-.67c.2-.402.513-.826.997-1.148C10.627 6.69 11.244 6.5 12 6.5c.658 0 1.369.195 1.934.619a2.45 2.45 0 0 1 1.004 2.006c0 1.033-.513 1.72-1.027 2.215-.19.183-.399.358-.579.508l-.147.123a4.329 4.329 0 0 0-.435.409v1.37a.75.75 0 1 1-1.5 0v-1.473c0-.237.067-.504.247-.736.22-.28.486-.517.718-.714l.183-.153.001-.001c.172-.143.324-.27.47-.412.368-.355.569-.676.569-1.136a.953.953 0 0 0-.404-.806C12.766 8.118 12.384 8 12 8c-.494 0-.814.121-1.03.265ZM13 17a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path><path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Z"></path></svg>');
--badge-icon--warning: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M13 17.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-.25-8.25a.75.75 0 0 0-1.5 0v4.5a.75.75 0 0 0 1.5 0v-4.5Z"></path><path d="M9.836 3.244c.963-1.665 3.365-1.665 4.328 0l8.967 15.504c.963 1.667-.24 3.752-2.165 3.752H3.034c-1.926 0-3.128-2.085-2.165-3.752Zm3.03.751a1.002 1.002 0 0 0-1.732 0L2.168 19.499A1.002 1.002 0 0 0 3.034 21h17.932a1.002 1.002 0 0 0 .866-1.5L12.866 3.994Z"></path></svg>');
--badge-icon--failure: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M5.72 5.72a.75.75 0 0 1 1.06 0L12 10.94l5.22-5.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L13.06 12l5.22 5.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L12 13.06l-5.22 5.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L10.94 12 5.72 6.78a.75.75 0 0 1 0-1.06Z"></path></svg>');
--badge-icon--danger: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M15.716 1.329a1.341 1.341 0 0 1 2.109 1.55L15.147 9h4.161c1.623 0 2.372 2.016 1.143 3.075L8.102 22.721a1.148 1.148 0 0 1-1.81-1.317L8.996 15H4.674c-1.619 0-2.37-2.008-1.148-3.07l12.19-10.6Zm.452 1.595L4.51 13.061a.25.25 0 0 0 .164.439h5.45a.749.749 0 0 1 .692 1.041l-2.559 6.066 11.215-9.668a.25.25 0 0 0-.164-.439H14a.75.75 0 0 1-.687-1.05Z"></path></svg>');
--badge-icon--bug: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M7.72.22a.75.75 0 0 1 1.06 0l1.204 1.203A4.98 4.98 0 0 1 12 1c.717 0 1.4.151 2.016.423L15.22.22a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-.971.972A4.991 4.991 0 0 1 17 6v1.104a2.755 2.755 0 0 1 1.917 1.974l1.998-.999a.75.75 0 0 1 .67 1.342L19 10.714V13.5l3.25.003a.75.75 0 0 1 0 1.5L19 15.001V16c0 .568-.068 1.134-.204 1.686l.04.018 2.75 1.375a.75.75 0 1 1-.671 1.342l-2.638-1.319A6.998 6.998 0 0 1 12 23a6.998 6.998 0 0 1-6.197-3.742l-2.758 1.181a.752.752 0 0 1-1.064-.776.752.752 0 0 1 .474-.602l2.795-1.199A6.976 6.976 0 0 1 5 16v-.996H1.75a.75.75 0 0 1 0-1.5H5v-2.79L2.415 9.42a.75.75 0 0 1 .67-1.342l1.998.999A2.756 2.756 0 0 1 7 7.104V6a4.99 4.99 0 0 1 1.69-3.748l-.97-.972a.75.75 0 0 1 0-1.06ZM6.5 9.75V16a5.5 5.5 0 1 0 11 0V9.75c0-.69-.56-1.25-1.25-1.25h-8.5c-.69 0-1.25.56-1.25 1.25ZM8.5 7h7V6a3.5 3.5 0 1 0-7 0Z"></path></svg>');
--badge-icon--example: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M8 8.807V3.5h-.563a.75.75 0 0 1 0-1.5h9.125a.75.75 0 0 1 0 1.5H16v5.307l5.125 9.301c.964 1.75-.302 3.892-2.299 3.892H5.174c-1.998 0-3.263-2.142-2.3-3.892ZM4.189 18.832a1.123 1.123 0 0 0 .985 1.668h13.652a1.123 1.123 0 0 0 .985-1.668L17.7 15H6.3ZM14.5 3.5h-5V9a.75.75 0 0 1-.093.362L7.127 13.5h9.746l-2.28-4.138A.75.75 0 0 1 14.5 9Z"></path></svg>');
--badge-icon--quote: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M3 6.25a.75.75 0 0 1 .75-.75h13.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.25Zm5 6.063a.75.75 0 0 1 .75-.75h11.5a.75.75 0 0 1 0 1.5H8.75a.75.75 0 0 1-.75-.75Zm0 5.937a.75.75 0 0 1 .75-.75h11.5a.75.75 0 0 1 0 1.5H8.75a.75.75 0 0 1-.75-.75ZM3.75 11a.75.75 0 0 1 .75.75v7a.75.75 0 0 1-1.5 0v-7a.75.75 0 0 1 .75-.75Z"></path></svg>');
}
.md-typeset .mdx-badge {
font-size: .85em;
border: .075rem solid var(--md-badge-fg--note);
border-radius: .1rem;
padding: .3rem;
}
.md-typeset .mdx-badge .mdx-badge__icon {
background: var(--md-accent-fg-color--transparent);
padding: .5rem .3rem;
margin-left: -.3rem;
}
.md-typeset .mdx-badge .mdx-badge__icon::before {
content: "";
background-color: var(--md-badge-fg--note);
mask-position: center;
mask-repeat: no-repeat;
mask-size: contain;
display: inline-block;
height: 1rem;
width: 1rem;
vertical-align: middle;
-webkit-mask-image: var(--badge-icon--note);
mask-image: var(--badge-icon--note);
}
.md-typeset .mdx-badge__text {
padding: .3rem .3rem;
margin: .3rem;
}
/*
* Types
*/
/* Abstract */
.md-typeset .mdx-badge.mdx-badge--abstract {
border-color: var(--md-badge-fg--abstract);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--abstract {
background-color: var(--md-badge-bg--abstract);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--abstract::before {
background-color: var(--md-badge-fg--abstract);
mask-image: var(--badge-icon--abstract);
-webkit-mask-image: var(--badge-icon--abstract);
}
/* Info */
.md-typeset .mdx-badge.mdx-badge--info {
border-color: var(--md-badge-fg--info);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--info {
background-color: var(--md-badge-bg--info);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--info::before {
background-color: var(--md-badge-fg--info);
mask-image: var(--badge-icon--info);
-webkit-mask-image: var(--badge-icon--info);
}
/* Tip */
.md-typeset .mdx-badge.mdx-badge--tip {
border-color: var(--md-badge-fg--tip);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--tip {
background-color: var(--md-badge-bg--tip);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--tip::before {
background-color: var(--md-badge-fg--tip);
mask-image: var(--badge-icon--tip);
-webkit-mask-image: var(--badge-icon--tip);
}
/* Success */
.md-typeset .mdx-badge.mdx-badge--success {
border-color: var(--md-badge-fg--success);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--success {
background-color: var(--md-badge-bg--success);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--success::before {
background-color: var(--md-badge-fg--success);
mask-image: var(--badge-icon--success);
-webkit-mask-image: var(--badge-icon--success);
}
/* Question */
.md-typeset .mdx-badge.mdx-badge--question {
border-color: var(--md-badge-fg--question);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--question {
background-color: var(--md-badge-bg--question);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--question::before {
background-color: var(--md-badge-fg--question);
mask-image: var(--badge-icon--question);
-webkit-mask-image: var(--badge-icon--question);
}
/* Warning */
.md-typeset .mdx-badge.mdx-badge--warning {
border-color: var(--md-badge-fg--warning);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--warning {
background-color: var(--md-badge-bg--warning);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--warning::before {
background-color: var(--md-badge-fg--warning);
mask-image: var(--badge-icon--warning);
-webkit-mask-image: var(--badge-icon--warning);
}
/* Failure */
.md-typeset .mdx-badge.mdx-badge--failure {
border-color: var(--md-badge-fg--failure);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--failure {
background-color: var(--md-badge-bg--failure);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--failure::before {
background-color: var(--md-badge-fg--failure);
mask-image: var(--badge-icon--failure);
-webkit-mask-image: var(--badge-icon--failure);
}
/* Danger */
.md-typeset .mdx-badge.mdx-badge--danger {
border-color: var(--md-badge-fg--danger);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--danger {
background-color: var(--md-badge-bg--danger);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--danger::before {
background-color: var(--md-badge-fg--danger);
mask-image: var(--badge-icon--danger);
-webkit-mask-image: var(--badge-icon--danger);
}
/* Bug */
.md-typeset .mdx-badge.mdx-badge--bug {
border-color: var(--md-badge-fg--bug);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--bug {
background-color: var(--md-badge-bg--bug);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--bug::before {
background-color: var(--md-badge-fg--bug);
mask-image: var(--badge-icon--bug);
-webkit-mask-image: var(--badge-icon--bug);
}
/* Example */
.md-typeset .mdx-badge.mdx-badge--example {
border-color: var(--md-badge-fg--example);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--example {
background-color: var(--md-badge-bg--example);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--example::before {
background-color: var(--md-badge-fg--example);
mask-image: var(--badge-icon--example);
-webkit-mask-image: var(--badge-icon--example);
}
/* Quote */
.md-typeset .mdx-badge.mdx-badge--quote {
border-color: var(--md-badge-fg--quote);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--quote {
background-color: var(--md-badge-bg--quote);
}
.md-typeset .mdx-badge .mdx-badge__icon.mdx-badge--quote::before {
background-color: var(--md-badge-fg--quote);
mask-image: var(--badge-icon--quote);
-webkit-mask-image: var(--badge-icon--quote);
}
+32
View File
@@ -4,6 +4,9 @@
--color-border: #e9ebfc1f;
--color-api-fg__deprecated: #ff5252;
--color-api-bg__deprecated: #ff52521a;
--color-api-fg__static: #00c853;
--color-api-fg__final: #ff9100;
--color-api-fg__abstract: #00bfa5;
@@ -17,6 +20,8 @@
--color-api-bg__static: #00c8531a;
--color-api-bg__final: #ff91001a;
--color-api-bg__abstract: #00bfa51a;
--md-admonition-icon--deprecated: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M16 1.75V3h5.25a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1 0-1.5H8V1.75C8 .784 8.784 0 9.75 0h4.5C15.216 0 16 .784 16 1.75Zm-6.5 0V3h5V1.75a.25.25 0 0 0-.25-.25h-4.5a.25.25 0 0 0-.25.25ZM4.997 6.178a.75.75 0 1 0-1.493.144L4.916 20.92a1.75 1.75 0 0 0 1.742 1.58h10.684a1.75 1.75 0 0 0 1.742-1.581l1.413-14.597a.75.75 0 0 0-1.494-.144l-1.412 14.596a.25.25 0 0 1-.249.226H6.658a.25.25 0 0 1-.249-.226L4.997 6.178Z"></path><path d="M9.206 7.501a.75.75 0 0 1 .793.705l.5 8.5A.75.75 0 1 1 9 16.794l-.5-8.5a.75.75 0 0 1 .705-.793Zm6.293.793A.75.75 0 1 0 14 8.206l-.5 8.5a.75.75 0 0 0 1.498.088l.5-8.5Z"></path></svg>');
}
/* Page design */
@@ -43,6 +48,16 @@
/* Attributes */
api__deprecated::before {
color: var(--color-api-fg__deprecated);
background-color: var(--color-api-bg__deprecated);
border-radius: var(--api-label-border-radius);
padding: var(--api-label-padding);
content: "Deprecated"
}
api__static::before {
color: var(--color-api-fg__static);
background-color: var(--color-api-bg__static);
@@ -135,4 +150,21 @@ api__record::before {
.api-type__primitive {
color: var(--color-api-fg-type__primitive);
font-weight: bold;
}
.md-typeset .admonition.deprecated,
.md-typeset details.deprecated {
border-color: var(--color-api-fg__deprecated);
}
.md-typeset .deprecated > .admonition-title,
.md-typeset .deprecated > summary {
background-color: var(--color-api-bg__deprecated);
}
.md-typeset .deprecated > .admonition-title::before,
.md-typeset .deprecated > summary::before {
background-color: var(--color-api-fg__deprecated);
-webkit-mask-image: var(--md-admonition-icon--deprecated);
mask-image: var(--md-admonition-icon--deprecated);
}
+4
View File
@@ -40,4 +40,8 @@
/* Override mkdocs-material styling */
.md-banner--warning {
background: rgba(187,128,9,0.15);
}
.md-source__repository .md-source__facts {
animation: facts .25s ease-in;
}
File renamed without changes.
+4 -2
View File
@@ -2,9 +2,11 @@
icon: octicons/list-unordered-24
---
# Examples
## About
!!! warning "The below examples may only work in v1.10.0 or newer!"
<!-- admo:info The below examples may only work in v1.10.0 or newer! -->
This page lists some examples you may want to use for your proxy or server.
@@ -70,7 +72,7 @@ Examples that can be used with the Spigot or PaperMC version.
### Different profile for banned Player
!!! warning "Requires a cached player to work reliably."
<!-- admo:info Requires a cached player -->
Displays a separate profile for when the player has been banned from the server.
+40 -19
View File
@@ -9,23 +9,52 @@ 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/index.md) for a quick start on how to use this plugin.
## Downloads
[![modrinth-img]{ width="260" loading="lazy" }][modrinth-download]{ target="_blank" rel="noreferrer nofollow noopener" }
[![hangar-img]{ width="260" loading="lazy" }][hangar-download]{ target="_blank" rel="noreferrer nofollow noopener" }
[modrinth-img]: https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/modrinth_vector.svg "Available on Modrinth"
[hangar-img]: https://cdn.jsdelivr.net/gh/Andre601/devins-badges@13e0142/assets/compact/available/hangar_vector.svg "Available on Hangar"
[modrinth-download]: https://modrinth.com/plugin/advancedserverlist
[hangar-download]: https://hangar.papermc.io/Andre_601/AdvancedServerList
## Platforms
AdvancedServerList supports the following platforms:
[![spigot-img](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/spigot_vector.svg "Tested on Spigot"){ width=64 }][spigot]
[![paper-img](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/paper_vector.svg "Tested on Paper"){ width=64 }][paper]
[![bungeecord-img](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/bungeecord_vector.svg "Tested on BungeeCord"){ width=64 }][spigot]
[![waterfall](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/waterfall_vector.svg "Tested on Waterfall"){ width=64 }][paper]
[![velocity](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/velocity_vector.svg "Tested on Velocity"){ width=64 }][velocity]
[![spigot-img]{ width="64" loading="lazy" }][spigot]
[![paper-img]{ width="64" loading="lazy" }][paper]
[![bungeecord-img]{ width="64" loading="lazy" }][spigot]
[![waterfall-img]{ width="64" loading="lazy" }][paper]
[![velocity-img]{ width="64" loading="lazy" }][velocity]
[spigot-img]: https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/spigot_vector.svg "Tested on Spigot"
[paper-img]: https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/paper_vector.svg "Tested on Paper"
[bungeecord-img]: https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/bungeecord_vector.svg "Tested on BungeeCord"
[waterfall-img]: https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/waterfall_vector.svg "Tested on Waterfall"
[velocity-img]: https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/velocity_vector.svg "Tested on Velocity"
[spigot]: https://www.spigotmc.org
[paper]: https://papermc.io
[velocity]: https://velocitypowered.com
## Dependencies
| Dependency | Platforms | Required? |
|------------------|---------------|-----------|
| [ProtocolLib] | Spigot | Yes |
| [PlaceholderAPI] | Spigot, Paper | No |
| [ViaVersion] | Spigot, Paper | No |
| Dependency | Platforms | Required? |
|-------------------------------------------------------------------------|----------------------|-----------|
| [ProtocolLib]{ target="_blank" rel="noreferrer nofollow noopener" } | Spigot | Yes |
| [PlaceholderAPI]{ target="_blank" rel="noreferrer nofollow noopener" } | Spigot, Paper | No |
| [ViaVersion]{ target="_blank" rel="noreferrer nofollow noopener" } | Spigot, Paper | No |
| [PAPIProxyBridge]{ target="_blank" rel="noreferrer nofollow noopener" } | BungeeCord, Velocity | No |
| [Maintenance]{ target="_blank" rel="noreferrer nofollow noopener" } | All | No |
[protocollib]: https://www.spigotmc.org/resources/1997/
[placeholderapi]: https://www.spigotmc.org/resources/6245/
[viaversion]: https://www.spigotmc.org/resources/19254/
[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
[maintenance]: https://hangar.papermc.io/kennytv/Maintenance
## Pages
@@ -39,12 +68,4 @@ AdvancedServerList supports the following platforms:
- [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
[velocity]: https://velocitypowered.com
[protocollib]: https://www.spigotmc.org/resources/1997/
[placeholderapi]: https://www.spigotmc.org/resources/6245/
[viaversion]: https://www.spigotmc.org/resources/19254/
- [PlaceholderAPI](placeholderapi/index.md)
+26 -13
View File
@@ -2,21 +2,34 @@
icon: material/percent
---
# PlaceholderAPI Placeholders
# PlaceholderAPI Placeholder support
The Spigot and Paper version of AdvancedServerList provide their own set of placeholders to use through [PlaceholderAPI].
AdvancedServerList provides support for [PlaceholderAPI] placeholders to be used, while also providing its own set of placeholders.
## Placeholders
[placeholderapi]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
!!! note
AdvancedServerList will try to find a matching Profile for the player similar to when they ping the server when using any of the below placeholders.
## Own placeholders
| Placeholder | Description |
|---------------------------|-------------------------------------------------------------------------------|
| `%asl_favicon%` | Gives the value of `favicon` from a matching Profile. |
| `%asl_extra_players_max%` | Gives the value of `playerCount.extraPlayers.amount` from a matching Profile. |
| `%asl_motd%` | Gives the value of `motd` in the matching Profile. |
| `%asl_playercount_hover%` | Gives the value of `playerCount.hover` from a matching Profile. |
| `%asl_playercount_text%` | Gives the value of `playerCount.text` from a matching Profile. |
The below listed placeholders can be used through PlaceholderAPI in other plugins.
Note that the values depend on the player it is used for, as AdvancedServerList will try and get a matching [Server List Profile](../profiles/index.md) to display values from.
[placeholderapi]: https://www.spigotmc.org/resources/6245/
| Placeholder | Description |
|------------------------------|---------------------------------------------------------------------------------------------------------|
| `%asl_favicon%` | Gives the value of `favicon` from a matching Profile. |
| `%asl_extra_players_max%` | Gives the value of `playerCount -> extraPlayers -> amount` from a matching Profile. Can return `null`. |
| `%asl_motd%` | Gives the value of `motd` in the matching Profile as a single String. |
| `%asl_playercount_hover%` | Gives the value of `playerCount -> hover` from a matching Profile as a single String. |
| `%asl_playercount_text%` | Gives the value of `playerCount -> text` from a matching Profile. |
| `%asl_players_max%` | Gives the value of `playerCount -> maxPlayers -> amount` from a matching Profile. Can return `null`. |
| `%asl_players_max_modified%` | Returns the output of `${server playersMax}`. |
## Using Placeholders in Server List profiles
You can use any PlaceholderAPI placeholder in a server list profile, if the following conditions are met:
- The placeholder does not require the player to be online.
- [PAPIProxyBridge] is installed alongside AdvancedServerList, if used on a Proxy.
To use a placeholder, simply use its default `%identifier_parameters%` format.
[papiproxybridge]: https://hangar.papermc.io/William278/PAPIProxyBridge
+55 -14
View File
@@ -2,7 +2,7 @@
icon: octicons/note-24
---
# Profiles
# Profiles { #profiles-settings }
AdvancedServerList allows the creation of multiple profiles.
A profile is a single YAML file located in the plugin's `profiles` directory containing multiple settings including [Conditions](#conditions) and [Priority](#priority).
@@ -39,7 +39,7 @@ You can remove this option, or set it to an empty list (`conditions: []`) to alw
The following operants are available and can be used in the conditions.
!!! warning "Only one operant can be used per condition!"
<!-- admo:warning Only one operant can be used per condition! -->
| Operand | Description |
|---------|------------------------------------------------------------------------|
@@ -58,7 +58,7 @@ The following operants are available and can be used in the conditions.
## Profiles
!!! warning "Priority and Conditions are NOT supported!"
<!-- admo:warning Priority and Conditions can NOT be used within profiles -->
The `profiles` option allows you to set multiple MOTDs, player counts, etc. which the plugin would randomly choose from.
If an option such as motd is not present in an entry will it check the file for the option and use that if present.
@@ -82,8 +82,8 @@ If an option such as motd is not present in an entry will it check the file for
```
<div class="result">
![profiles-example-1](../assets/images/examples/profiles-example-1.jpg)
![profiles-example-2](../assets/images/examples/profiles-example-2.jpg)
![profiles-example-1](../assets/images/examples/profiles-example-1.jpg){ loading="lazy" }
![profiles-example-2](../assets/images/examples/profiles-example-2.jpg){ loading="lazy" }
</div>
@@ -104,7 +104,7 @@ If you want to display multiple MOTDs will you need to use the [`Profiles` optio
```
<div class="result">
![motd-example](../assets/images/examples/motd-example.jpg)
![motd-example](../assets/images/examples/motd-example.jpg){ loading="lazy" }
</div>
@@ -135,7 +135,7 @@ Please note that AdvancedServerList will rescale the image to be 64x64 pixels, s
```
<div class="result">
![hideplayers-example](../assets/images/examples/favicon-example.jpg)
![hideplayers-example](../assets/images/examples/favicon-example.jpg){ loading="lazy" }
</div>
@@ -162,7 +162,7 @@ Additionally will the [`Text`](#text) and [`Hover`](#hover) option be ignored.
```
<div class="result">
![hideplayers-example](../assets/images/examples/hideplayers-example.jpg)
![hideplayers-example](../assets/images/examples/hideplayers-example.jpg){ loading="lazy" }
</div>
@@ -189,7 +189,7 @@ You can either remove this option or set to an empty list (`hover: []`) to not o
```
<div class="result">
![hover-example](../assets/images/examples/hover-example.jpg)
![hover-example](../assets/images/examples/hover-example.jpg){ loading="lazy" }
</div>
@@ -218,7 +218,7 @@ To not override the player count, remove this option or set it to an empty Strin
```
<div class="result">
![hover-example](../assets/images/examples/text-example.jpg)
![hover-example](../assets/images/examples/text-example.jpg){ loading="lazy" }
</div>
@@ -226,14 +226,14 @@ To not override the player count, remove this option or set it to an empty Strin
Contains options to modify how the `<max>` number in the player count should look like.
!!! warning "Using this option will modify the `${server playersMax}` placeholder (Except in conditions)"
<!-- admo:warning Using this option will modify the `${server playersMax}` placeholder (Except when used in conditions) -->
#### Enabled
#### Enabled { #extraplayers-enabled }
Boolean option to set whether the extra players feature should be used or not.
When set to `true` will the max amount of players be modified by taking the current amount of online players, add [`Amount`](#amount) more to it and use it.
#### Amount
#### Amount { #extraplayers-amount }
Sets the number to add to the current online players to then use as the new max players count.
@@ -255,6 +255,47 @@ As an example, setting this to `1` while `10` players are online will display `1
```
<div class="result">
![hover-example](../assets/images/examples/extraplayers-example.jpg)
![extraplayers-example](../assets/images/examples/extraplayers-example.jpg){ loading="lazy" }
</div>
### MaxPlayers
Contains options to set the max number of players allowed to join the server. This has only a visual effect and won't actually influence how many players can join your server.
Note that this feature is ignored should [`extraPlayers`](#extraplayers) be enabled.
In case [`hidePlayers`](#hideplayers) is enabled will the max player count not be displayed, but still changed by this option.
Should [`text`](#text) be set to a non-empty String will the max player count only be displayed when `${server playersMax}` is used.
<!-- admo:warning Using this option will modify the `${server playersMax}` placeholder (Except when used in conditions) -->
#### Enabled { #maxplayers-enabled }
Boolean option to set whether the max players feature should be used or not.
When set to `true` will the value usually displaying how many players can join be changed to what you've set in the [`amount`](#maxplayers-amount) option.
#### Amount { #maxplayers-amount }
Sets the number to display as the max number of players allowed to join your server.
Note that this will also affect the `${server playersMax}` placeholder, except when it is used inside conditions.
??? example "Example"
```yaml title="YAML file"
priority: 0
# We use just colour to hide the MOTD
motd:
- '<grey>'
- '<grey>'
playerCount:
maxPlayers:
enabled: true
amount: -1
```
<div class="result">
![maxplayes-example](../assets/images/examples/maxplayers-example.jpg){ loading="lazy" }
</div>
+1 -4
View File
@@ -54,10 +54,7 @@ These placeholders use values given by the server/proxy AdvancedServerList runs
## PlaceholderAPI
The Spigot and Paper version of AdvancedServerList allow the usage of *any* placeholders provided by PlaceholderAPI by using the `%<identifier>_<values>%` placeholder format.
Depending on the placeholder used is a cached player required (i.e. `%player_name%`). AdvancedServerList will try to get a OfflinePlayer instance based on the cached UUID from the server to manage this.
!!! warning "PlaceholderAPI placeholders can NOT be used in Conditions!"
Please visit the [PlaceholderAPI page](../placeholderapi/index.md) for how AdvancedServerList works with PlaceholderAPI.
## Custom Placeholders
+16 -61
View File
@@ -12,64 +12,8 @@ docs_dir: docs/
repo_name: Andre601/AdvancedServerList
repo_url: https://codeberg.org/Andre601/AdvancedServerList
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
not_in_nav: |
api/reference/structure.md
theme:
name: 'material'
@@ -92,7 +36,7 @@ theme:
note: 'octicons/tag-24'
abstract: 'octicons/checklist-24'
info: 'octicons/info-24'
tip: 'octicons/squirrel-24'
tip: 'octicons/flame-24'
success: 'octicons/check-24'
question: 'octicons/question-24'
warning: 'octicons/alert-24'
@@ -105,14 +49,20 @@ theme:
extra_css:
- assets/stylesheets/custom.css
- assets/stylesheets/api-docs.css
- assets/stylesheets/admo.css
extra_javascript:
- assets/js/repo-stats.js
extra:
github_repository: !ENV [GITHUB_REPO_INSTANCE, False]
social:
- icon: 'simple/codeberg'
link: 'https://codeberg.org/Andre601/AdvancedServerList'
- icon: 'simple/modrinth'
link: 'https://modrinth.com/plugin/advancedserverlist'
- icon: 'fontawesome/solid/paper-plane'
link: 'https://hangar.papermc.io/Andre_601/AdvancedServerList'
plugins:
- search
@@ -129,11 +79,16 @@ markdown_extensions:
- 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
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight:
- pymdownx.magiclink:
- pymdownx.superfences:
- pymdownx.tabbed:
alternate_style: true
- pymdownx.details:
- pymdownx.snippets:
base_path: docs/.snippets
hooks:
- docs/.hooks/badges.py
+2 -2
View File
@@ -38,10 +38,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.commit/>
<plugin.version>3.4.0</plugin.version>
<plugin.version>3.5.1</plugin.version>
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
<api.version>v3.0.0</api.version>
<api.version>v3.1.0</api.version>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
+57
View File
@@ -0,0 +1,57 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"labels": ["PR Type/Dependency Update"],
"ignoreDeps": [
"ch.andre601.advancedserverlist:parent",
"ch.andre601.advancedserverlist:core"
],
"packageRules": [
{
"description": "Use a specific registry URL for specific dependencies",
"matchPackageNames": [
"ch.andre601.asl-api:platform-bukkit",
"ch.andre601.asl-api:platform-bungeecord",
"ch.andre601.asl-api:platform-velocity",
"ch.andre601.asl-api:api"
],
"registryUrls": [
"https://jitpack.io"
]
},
{
"description": "Apply label for Bukkit platform",
"matchFileNames": ["bukkit/pom.xml"],
"addLabels": ["PR Target/Bukkit"]
},
{
"description": "Apply label for BungeeCord platform",
"matchFileNames": ["bungeecord/pom.xml"],
"addLabels": ["PR Target/BungeeCord"]
},
{
"description": "Apply label for Core platform",
"matchFileNames": ["core/pom.xml"],
"addLabels": ["PR Target/Core"]
},
{
"description": "Apply label for Velocity platform",
"matchFileNames": ["velocity/pom.xml"],
"addLabels": ["PR Target/Velocity"]
},
{
"description": "Apply label for GitHub Actions",
"matchFileNames": [".github/workflows/*.yml"],
"addLabels": ["PR Target/GitHub Action"]
},
{
"description": "Apply label for MkDocs",
"matchFileNames": ["requirements.txt"],
"addLabels": ["PR Target/MkDocs"]
},
{
"description": "Apply label for Woodpecker-CI",
"matchFileNames": [".woodpecker/*.yml"],
"addLabels": ["PR Target/Woodpecker-CI"]
}
]
}
+1 -1
View File
@@ -1,4 +1,4 @@
mkdocs-material==9.2.8
mkdocs-material==9.4.5
mkdocs-glightbox==0.3.4
mkdocs-awesome-pages-plugin==2.9.2
git+https://github.com/Andre601/mkdocs-pagenav-generator
+1 -1
View File
@@ -106,7 +106,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
+15 -9
View File
@@ -52,7 +52,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.6</version>
<version>1.4.11</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -61,22 +61,28 @@
<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>
<dependency>
<groupId>dev.masecla</groupId>
<artifactId>Modrinth4J</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>VersionUploader</finalName>
<resources>
<resource>
<filtering>true</filtering>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -89,7 +95,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
@@ -103,7 +109,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
@@ -30,26 +30,35 @@ import java.util.List;
public enum PlatformInfo{
BUKKIT(
"bukkit",
"bukkit/target/AdvancedServerList-Bukkit-{{version}}.jar",
"Spigot", "Paper", "Folia"
"spigot", "paper", "folia"
),
BUNGEECORD(
"bungeecord",
"bungeecord/target/AdvancedServerList-BungeeCord-{{version}}.jar",
"BungeeCord", "Waterfall"
"bungeecord", "waterfall"
),
VELOCITY(
"velocity",
"velocity/target/AdvancedServerList-Velocity-{{version}}.jar",
"Velocity"
"velocity"
);
private final String platform;
private final String filePath;
private final List<String> loaders;
PlatformInfo(String filePath, String... loaders){
PlatformInfo(String platform, String filePath, String... loaders){
this.platform = platform;
this.filePath = filePath;
this.loaders = List.of(loaders);
}
public String getPlatform(){
return platform;
}
public String getFilePath(){
return filePath;
}
@@ -25,11 +25,19 @@
package ch.andre601.advancedserverlist.versionuploader;
import ch.andre601.advancedserverlist.versionuploader.data.CodebergRelease;
import ch.andre601.advancedserverlist.versionuploader.data.CodebergReleaseFetcher;
import ch.andre601.advancedserverlist.versionuploader.hangar.HangarVersionUploader;
import ch.andre601.advancedserverlist.versionuploader.modrinth.ModrinthVersionUploader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import java.util.Properties;
import java.util.concurrent.CompletableFuture;
public class VersionUploader{
private static final Logger LOGGER = LoggerFactory.getLogger(VersionUploader.class);
@@ -37,37 +45,76 @@ public class VersionUploader{
public static void main(String[] args) {
LOGGER.info("Starting release uploader...");
CodebergRelease release = CodebergReleaseFetcher.fetchRelease();
if(args.length == 0){
LOGGER.warn("MISSING ARGUMENT!");
LOGGER.warn("COMMAND USAGE: java -jar VersionUploader.jar [--all|--modrinth|--hangar]");
System.exit(1);
return;
}
CodebergRelease release = CodebergReleaseFetcher.fetch();
if(release == null){
LOGGER.warn("Non-successful attempt at fetching a release from Codeberg! Aborting upload");
LOGGER.warn("Couldn't fetch Codeberg Release information!");
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;
CompletableFuture<?> future;
switch(args[0].toLowerCase(Locale.ROOT)){
case "--modrinth" -> future = new ModrinthVersionUploader().performUpload(release, false);
case "--hangar" -> future = new HangarVersionUploader().performUpload(release, false);
case "--all" -> future = CompletableFuture.allOf(
new ModrinthVersionUploader().performUpload(release, false),
new HangarVersionUploader().performUpload(release, false)
);
case "--dryrun" -> {
LOGGER.info("Performing Dry-run for Modrinth and Hangar...");
future = CompletableFuture.allOf(
new ModrinthVersionUploader().performUpload(release, true),
new HangarVersionUploader().performUpload(release, true)
);
try{
future.join();
}catch(Exception ex){
LOGGER.warn("Exception while waiting for CompletableFutures to end...", ex);
}
LOGGER.info("Dry-run completed!");
return;
}
if(arg.equalsIgnoreCase("--hangar")){
new HangarVersionUploader().performUpload(release);
break;
default -> {
LOGGER.warn("Unknown argument '{}' provided. Supported are '--all', '--modrinth', '--hangar' and '--dryrun'", args[0]);
System.exit(1);
return;
}
}
if(future == null){
LOGGER.warn("Issue while performing upload. Received CompletableFuture is null.");
System.exit(1);
return;
}
try{
future.join();
LOGGER.info("Upload completed!");
}catch(Exception ex){
LOGGER.warn("Upload was not successful! Encountered an Exception!", ex);
System.exit(1);
}
}
public static String retrieveVersion(){
try(InputStream is = VersionUploader.class.getResourceAsStream("/version.properties")){
Properties properties = new Properties();
properties.load(is);
return properties.getProperty("version");
}catch(IOException ex){
return null;
}
}
}
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.versionuploader;
package ch.andre601.advancedserverlist.versionuploader.data;
import com.google.gson.annotations.SerializedName;
@@ -23,10 +23,9 @@
*
*/
package ch.andre601.advancedserverlist.versionuploader;
package ch.andre601.advancedserverlist.versionuploader.data;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@@ -35,66 +34,62 @@ 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;
import java.util.concurrent.TimeUnit;
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();
private static final OkHttpClient CLIENT = new OkHttpClient.Builder()
.callTimeout(30, TimeUnit.SECONDS)
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build();
public static CodebergRelease fetchRelease(){
public static CodebergRelease fetch(){
String tag = System.getenv("CI_COMMIT_TAG");
String authToken = System.getenv("CB_TOKEN");
String codbergToken = System.getenv("CODEBERG_API_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.");
if(tag == null || codbergToken == null || tag.isEmpty() || codbergToken.isEmpty()){
LOGGER.warn("Cannot fetch release data. Either Tag or Codeberg token was null/empty.");
return null;
}
String url = "https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases/tags/" + tag;
LOGGER.info("Fetching Release data from {}...", url);
Request request = new Request.Builder()
.url("https://codeberg.org/api/v1/repos/Andre601/AdvancedServerList/releases?limit=10")
.header("User-Agent", "VersionUploader-CodebergFetcher/${plugin.version}")
.url(url)
.header("User-Agent", "VersionUploader-CodebergReleaseFetcher/v1.0.0")
.header("Accept", "application/json")
.header("Authorization", "token " + authToken)
.header("Authorization", "token " + codbergToken)
.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());
LOGGER.warn("Received non-successful response code from Codeberg API:");
LOGGER.warn("Response Code: {}", response.code());
LOGGER.warn("Response Message: {}", response.message());
return null;
}
ResponseBody body = response.body();
if(body == null){
LOGGER.warn("Cannot fetch release info. Retrieved Response body was null");
LOGGER.warn("Received null response body while fetching Codeberg Release.");
return null;
}
String bodyString = body.string();
if(bodyString.isEmpty()){
LOGGER.warn("Cannot fetch release info. Retrieved Response body was null");
LOGGER.warn("Received empty response body while fetching Codeberg Release.");
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;
return GSON.fromJson(bodyString, CodebergRelease.class);
}catch(IOException ex){
LOGGER.warn("Encountered an IOException while fetching Codeberg Release data.", ex);
return null;
}
}
@@ -25,8 +25,9 @@
package ch.andre601.advancedserverlist.versionuploader.hangar;
import ch.andre601.advancedserverlist.versionuploader.CodebergRelease;
import ch.andre601.advancedserverlist.versionuploader.PlatformInfo;
import ch.andre601.advancedserverlist.versionuploader.VersionUploader;
import ch.andre601.advancedserverlist.versionuploader.data.CodebergRelease;
import ch.andre601.advancedserverlist.versionuploader.hangar.version.*;
import com.google.gson.Gson;
@@ -54,6 +55,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
public class HangarVersionUploader{
@@ -69,32 +71,37 @@ public class HangarVersionUploader{
this.apiKey = System.getenv("HANGAR_API_TOKEN");
}
public void performUpload(CodebergRelease release){
public CompletableFuture<?> performUpload(CodebergRelease release, boolean dryrun){
LOGGER.info("Starting HangarVersionUploader...");
if(apiKey == null || apiKey.isEmpty()){
if((apiKey == null || apiKey.isEmpty()) && !dryrun){
LOGGER.warn("Received a null/empty API key!");
System.exit(1);
return;
return CompletableFuture.completedFuture(null);
}
final Namespace project = new Namespace("Andre_601", "AdvancedServerList");
final String version = release.tagName().startsWith("v") ? release.tagName().substring(1) : release.tagName();
final String releaseVersion = release.tagName().startsWith("v") ? release.tagName().substring(1) : release.tagName();
final String pluginVersion = VersionUploader.retrieveVersion();
if(pluginVersion == null || pluginVersion.isEmpty()){
LOGGER.warn("Retrieved null/empty plugin version.");
return CompletableFuture.completedFuture(false);
}
final String changelog = release.body();
boolean preRelease = release.prerelease();
final List<Path> filePaths = List.of(
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()
new File(PlatformInfo.BUKKIT.getFilePath().replace("{{version}}", pluginVersion)).toPath(),
new File(PlatformInfo.BUNGEECORD.getFilePath().replace("{{version}}", pluginVersion)).toPath(),
new File(PlatformInfo.VELOCITY.getFilePath().replace("{{version}}", pluginVersion)).toPath()
);
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/")
Dependency.fromNamespace("PlaceholderAPI", false, new Namespace("HelpChat", "PlaceholderAPI"))
);
final List<Dependency> bungeeDependencies = List.of(
Dependency.fromNamespace("PapiProxyBridge", false, new Namespace("William278", "PAPIProxyBridge")),
@@ -112,7 +119,7 @@ public class HangarVersionUploader{
);
final Version versionUpload = new Version(
version,
releaseVersion,
Map.of(
Platform.PAPER, bukkitDependencies,
Platform.WATERFALL, bungeeDependencies,
@@ -123,45 +130,57 @@ public class HangarVersionUploader{
Platform.WATERFALL, List.of("1.19.x", "1.20.x"),
Platform.VELOCITY, Collections.singletonList("3.2")
),
changelog,
changelog.replaceAll("\r\n", "\n"),
fileInfo,
preRelease ? "Beta" : "Release"
);
if(dryrun){
String json = GSON.toJson(versionUpload);
LOGGER.info("Namespace: {}", project);
LOGGER.info("JSON: {}", json);
return CompletableFuture.completedFuture(json);
}
try(CloseableHttpClient client = HttpClients.createDefault()){
uploadVersion(client, project, versionUpload, filePaths);
return uploadVersion(client, project, versionUpload, filePaths);
}catch(ParseException | IOException ex){
LOGGER.warn("Unable to upload to Hangar! Encountered an exception.", ex);
System.exit(1);
return CompletableFuture.failedFuture(ex);
}
}
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));
for(Path path : filePaths){
builder.addPart("files", new FileBody(path.toFile(), ContentType.DEFAULT_BINARY));
}
HttpPost post = new HttpPost(API_URL + "projects/" + namespace + "/upload");
post.setEntity(builder.build());
this.addAuthHeader(client, post);
LOGGER.info("Uploading release...");
final boolean success = client.execute(post, response -> {
if(response.getCode() != 200){
LOGGER.error("Error while uploading version. Received response code {}: {}", response.getCode(), response.getReasonPhrase());
LOGGER.error("Body: {}", EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8));
private CompletableFuture<?> uploadVersion(HttpClient client, Namespace namespace, Version versionUpload, List<Path> filePaths) throws IOException, ParseException{
return CompletableFuture.supplyAsync(() -> {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addPart("versionUpload", new StringBody(GSON.toJson(versionUpload), ContentType.APPLICATION_JSON));
for(Path path : filePaths){
builder.addPart("files", new FileBody(path.toFile(), ContentType.DEFAULT_BINARY));
}
HttpPost post = new HttpPost(API_URL + "projects/" + namespace + "/upload");
post.setEntity(builder.build());
try{
this.addAuthHeader(client, post);
LOGGER.info("Uploading release...");
return client.execute(post, response -> {
if(response.getCode() != 200){
throw new RuntimeException(String.format(
"Received non-successful response while uploading release. Code: %d, Message: %s", response.getCode(), response.getReasonPhrase()
));
}
LOGGER.info("Successfully uploaded new release on Hangar!");
return true;
});
}catch(IOException ex){
LOGGER.warn("Encountered IOException while perfoming upload.", ex);
return false;
}
return true;
});
if(!success){
throw new RuntimeException("Error uploading version!");
}
LOGGER.info("Upload complete!");
System.exit(0);
}
private synchronized void addAuthHeader(HttpClient client, HttpMessage message) throws IOException{
@@ -25,8 +25,11 @@
package ch.andre601.advancedserverlist.versionuploader.modrinth;
import ch.andre601.advancedserverlist.versionuploader.CodebergRelease;
import ch.andre601.advancedserverlist.versionuploader.PlatformInfo;
import ch.andre601.advancedserverlist.versionuploader.VersionUploader;
import ch.andre601.advancedserverlist.versionuploader.data.CodebergRelease;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import masecla.modrinth4j.client.agent.UserAgent;
import masecla.modrinth4j.endpoints.version.CreateVersion;
import masecla.modrinth4j.main.ModrinthAPI;
@@ -35,17 +38,20 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
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 List<String> versions = List.of("1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20", "1.20.1", "1.20.2");
private final ModrinthAPI api;
@@ -53,66 +59,88 @@ public class ModrinthVersionUploader{
this.api = createClient();
}
public void performUploads(CodebergRelease release){
public CompletableFuture<?> performUpload(CodebergRelease release, boolean dryrun){
LOGGER.info("Starting ModrinthVersionUploader...");
if(api == null){
LOGGER.warn("Unable to obtain ModrinthAPI instance!");
System.exit(1);
return;
LOGGER.warn("Cannot create updates on Modrinth. API instance is null.");
return CompletableFuture.completedFuture(false);
}
final String version = release.tagName().startsWith("v") ? release.tagName().substring(1) : release.tagName();
final String releaseVersion = release.tagName().startsWith("v") ? release.tagName().substring(1) : release.tagName();
final String pluginVersion = VersionUploader.retrieveVersion();
if(pluginVersion == null || pluginVersion.isEmpty()){
LOGGER.warn("Retrieved null/empty plugin version.");
return CompletableFuture.completedFuture(false);
}
final String changelog = release.body();
final boolean preRelease = release.prerelease();
final boolean prerelease = release.prerelease();
for(PlatformInfo platform : platforms){
File file = new File(platform.getFilePath().replace("{{version}}", version));
CompletableFuture<?>[] futures = new CompletableFuture[platforms.size()];
for(int i = 0; i < platforms.size(); i++){
LOGGER.info("Creating release for platform {}...", platforms.get(i).getPlatform());
File file = new File(platforms.get(i).getFilePath().replace("{{version}}", pluginVersion));
List<ProjectVersion.ProjectDependency> dependencies = new ArrayList<>();
// Maintenance plugin
dependencies.add(new ProjectVersion.ProjectDependency(null, "VCAqN1ln", null, ProjectVersion.ProjectDependencyType.OPTIONAL));
if(!platforms.get(i).getPlatform().equalsIgnoreCase("bukkit")){
// PAPIProxyBridge plugin
dependencies.add(new ProjectVersion.ProjectDependency(null, "bEIUEGTX", null, ProjectVersion.ProjectDependencyType.OPTIONAL));
}
CreateVersion.CreateVersionRequest request = CreateVersion.CreateVersionRequest.builder()
.projectId("xss83sOY")
.name(String.format("v%s (%s)", version, String.join(", ", platform.getLoaders())))
.versionNumber(version)
.changelog(changelog)
.name(String.format("v%s (%s)", releaseVersion, String.join(", ", platforms.get(i).getLoaders())))
.versionNumber(releaseVersion)
.changelog(changelog.replaceAll("\r\n", "\n"))
.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)
))
.loaders(platforms.get(i).getLoaders())
.versionType(prerelease ? ProjectVersion.VersionType.BETA : ProjectVersion.VersionType.RELEASE)
.dependencies(dependencies)
.build();
api.versions().createProjectVersion(request).whenComplete((project, throwable) -> {
if(dryrun){
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(request);
LOGGER.info("JSON Data to send: {}", json);
futures[i] = CompletableFuture.completedFuture(json);
continue;
}
futures[i] = api.versions().createProjectVersion(request).whenComplete(((projectVersion, throwable) -> {
if(throwable != null){
LOGGER.warn("Encountered error while creating a release on Modrinth!", throwable);
LOGGER.warn("Encountered an exception while uploading a new release to Modrinth!", throwable);
return;
}
LOGGER.info("Successfully uploaded new Modrinth release!");
LOGGER.info("https://modrinth.com/plugin/advancedserverlist/version/{}", project.getId());
});
LOGGER.info("Created new release!");
LOGGER.info("Link: https://modrinth.com/plugin/advancedserverlist/version/{}", projectVersion.getId());
}));
}
LOGGER.info("Upload task completed! Shutting down jar...");
System.exit(0);
return CompletableFuture.allOf(futures);
}
private ModrinthAPI createClient(){
String apiToken = System.getenv("MODRINTH_API_TOKEN");
if(apiToken == null || apiToken.isEmpty())
String token = System.getenv("MODRINTH_API_TOKEN");
if(token == null || token.isEmpty())
return null;
UserAgent agent = UserAgent.builder()
.authorUsername("Andre_601")
.projectVersion("${plugin.version}")
.projectVersion("v1.0.0")
.projectName("ModrinthVersionUploader")
.contact("github@andre601.ch")
.build();
return ModrinthAPI.rateLimited(agent, apiToken);
return ModrinthAPI.rateLimited(agent, token);
}
}
@@ -0,0 +1,26 @@
#
# 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.
#
#
version=${plugin.version}