Compare commits

..
176 Commits
Author SHA1 Message Date
Andre601 9cbd7fb6b7 Fix rare NPE for gson.fromJson in PlayerHandler 2023-07-15 23:47:09 +02:00
Andre_601 71313afb01 Merge pull request #119 from Andre601/dependabot/maven/core/com.google.guava-guava-32.1.1-jre
Bump guava from 32.0.1-jre to 32.1.1-jre in /core
2023-07-03 17:36:42 +02:00
Andre_601 039f2f7b8a Merge pull request #118 from Andre601/dependabot/pip/mkdocs-material-9.1.18
Bump mkdocs-material from 9.1.17 to 9.1.18
2023-07-03 17:36:10 +02:00
dependabot[bot] b34c7b3cec Bump guava from 32.0.1-jre to 32.1.1-jre in /core
Bumps [guava](https://github.com/google/guava) from 32.0.1-jre to 32.1.1-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-03 15:33:34 +00:00
dependabot[bot] 40e1fb1f02 Bump mkdocs-material from 9.1.17 to 9.1.18
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.17 to 9.1.18.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.17...9.1.18)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-03 15:18:43 +00:00
Andre_601 9292a46a86 Merge pull request #116 from Andre601/dependabot/pip/mkdocs-material-9.1.17
Bump mkdocs-material from 9.1.16 to 9.1.17
2023-06-26 19:13:18 +02:00
dependabot[bot] fbb7e0f103 Bump mkdocs-material from 9.1.16 to 9.1.17
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.16 to 9.1.17.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.16...9.1.17)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 16:04:25 +00:00
Andre_601 c6b6187fe8 Create labeler.yml 2023-06-24 13:29:48 +02:00
Andre601 04534e18c3 Make sure api-version is a string 2023-06-23 17:35:48 +02:00
Andre_601 6a3adee315 Merge pull request #114 from Andre601/dependabot/maven/bukkit/org.apache.maven.plugins-maven-shade-plugin-3.5.0
Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /bukkit
2023-06-19 18:28:07 +02:00
Andre_601 dddea9c022 Merge pull request #113 from Andre601/dependabot/maven/velocity/org.apache.maven.plugins-maven-shade-plugin-3.5.0
Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /velocity
2023-06-19 18:27:53 +02:00
dependabot[bot] a5029f22ad Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /bukkit
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.1...maven-shade-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 16:08:13 +00:00
dependabot[bot] e425ae4ce3 Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /velocity
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.1...maven-shade-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-19 16:01:30 +00:00
Andre_601 48163610a4 Make note about priority and conditions more clear 2023-06-19 15:24:47 +02:00
Andre_601 78fc37c2d7 Add missing whitelistEnabled placeholder 2023-06-18 16:18:36 +02:00
Andre_601 61aceb3fe8 Merge pull request #112 from Andre601/feature/new-placeholder-features
Allow multiple servers/worlds for playersOnline, add whitelistEnabled for spigot/paper and config backup on migration.
2023-06-18 15:52:04 +02:00
Andre601 2ccb2a470f Use the right method for whitelistEnabled
+ config migrator backup
2023-06-18 15:44:37 +02:00
Andre601 849ea169a2 Make backups during config migrations. 2023-06-18 15:34:06 +02:00
Andre601 da7ae22535 Allow multiple worlds/Servers for playersOnline 2023-06-18 15:12:47 +02:00
Andre_601 fbd8d9fffa Merge pull request #110 from Andre601/dependabot/maven/bungeecord/org.apache.maven.plugins-maven-shade-plugin-3.5.0
Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /bungeecord
2023-06-16 18:05:14 +02:00
Andre_601 df10bdcc65 Merge pull request #109 from Andre601/dependabot/maven/core/org.apache.maven.plugins-maven-shade-plugin-3.5.0
Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /core
2023-06-16 18:05:00 +02:00
dependabot[bot] da1ada5a10 Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /bungeecord
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.1...maven-shade-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-16 15:59:58 +00:00
dependabot[bot] 21f083dda1 Bump maven-shade-plugin from 3.4.1 to 3.5.0 in /core
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.4.1...maven-shade-plugin-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-16 15:59:44 +00:00
Andre_601 e7882d1be8 Include GitHub Actions account in git 2023-06-15 22:39:59 +02:00
Andre_601 81ed3a441f Merge pull request #108 from Andre601/dependabot/pip/mkdocs-material-9.1.16
Bump mkdocs-material from 9.1.15 to 9.1.16
2023-06-15 18:16:41 +02:00
dependabot[bot] 41381f498e Bump mkdocs-material from 9.1.15 to 9.1.16
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.15 to 9.1.16.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.15...9.1.16)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-15 16:02:48 +00:00
Andre601 e669a995a7 Include 1.20 in HangarUploader 2023-06-12 17:21:17 +02:00
Andre601 aad10a1146 Fix broken version check for config 2023-06-11 21:38:29 +02:00
Andre601 eb4455797a Force a block-style for sections 2023-06-11 21:35:02 +02:00
Andre601 02f1e68522 Fix some ConfigMigrator stuff 2023-06-11 21:30:31 +02:00
Andre_601 933d5f1e48 Merge pull request #96 from Andre601/feature/more-placeholders
Add Server placeholder options
2023-06-11 20:56:59 +02:00
Andre601 50e2fa95bf Bump API version 2023-06-11 20:52:00 +02:00
Andre_601 c908e6dc21 Merge pull request #105 from Andre601/feature/paper-plugin-changes
Use new Paper plugin dependency structure
2023-06-11 20:51:26 +02:00
Andre601 ccbe2afffb Add small comment 2023-06-11 20:42:02 +02:00
Andre_601 3d94259160 Merge pull request #107 from Andre601/dependabot/maven/core/com.google.guava-guava-32.0.1-jre
Bump guava from 32.0.0-jre to 32.0.1-jre in /core
2023-06-09 21:26:56 +02:00
Andre_601 ee6d596493 Fix wrong URL 2023-06-09 21:26:29 +02:00
dependabot[bot] 8c608b60bd Bump guava from 32.0.0-jre to 32.0.1-jre in /core
Bumps [guava](https://github.com/google/guava) from 32.0.0-jre to 32.0.1-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-09 16:00:07 +00:00
Andre_601 2b5e7d98c8 Update success.md 2023-06-08 22:43:20 +02:00
Andre_601 ee6e879c08 Use nightly.link 2023-06-08 22:42:56 +02:00
Andre_601 639084806a Update MODRINTH.md 2023-06-08 17:48:56 +02:00
Andre_601 74a929d0ad Add note about adventure online tool 2023-06-08 17:44:38 +02:00
Andre_601 5caffcb49a Merge pull request #106 from Andre601/dependabot/maven/bukkit/com.viaversion-viaversion-api-4.7.0
Bump viaversion-api from 4.6.2 to 4.7.0 in /bukkit
2023-06-07 20:09:56 +02:00
dependabot[bot] ce73d3c0e7 Bump viaversion-api from 4.6.2 to 4.7.0 in /bukkit
Bumps viaversion-api from 4.6.2 to 4.7.0.

---
updated-dependencies:
- dependency-name: com.viaversion:viaversion-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-07 18:00:25 +00:00
Andre_601 a0b59aecc8 Merge pull request #104 from Andre601/dependabot/maven/core/net.kyori-adventure-text-serializer-legacy-4.14.0
Bump adventure-text-serializer-legacy from 4.13.1 to 4.14.0 in /core
2023-06-07 19:43:37 +02:00
Andre_601 3758a99ae2 Update checked modules 2023-06-07 19:42:21 +02:00
Andre_601 1f45f5c3e5 Merge pull request #103 from Andre601/dependabot/maven/core/net.kyori-adventure-text-minimessage-4.14.0
Bump adventure-text-minimessage from 4.13.1 to 4.14.0 in /core
2023-06-07 19:41:05 +02:00
Andre_601 937dc93366 Merge pull request #102 from Andre601/dependabot/maven/core/net.kyori-adventure-api-4.14.0
Bump adventure-api from 4.13.1 to 4.14.0 in /core
2023-06-07 19:38:35 +02:00
Andre601 b4dffedd09 Use new Paper plugin dependency structure 2023-06-07 19:24:46 +02:00
dependabot[bot] ae1e16ca8b Bump adventure-text-serializer-legacy from 4.13.1 to 4.14.0 in /core
Bumps [adventure-text-serializer-legacy](https://github.com/KyoriPowered/adventure) from 4.13.1 to 4.14.0.
- [Release notes](https://github.com/KyoriPowered/adventure/releases)
- [Commits](https://github.com/KyoriPowered/adventure/compare/v4.13.1...v4.14.0)

---
updated-dependencies:
- dependency-name: net.kyori:adventure-text-serializer-legacy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-07 16:00:18 +00:00
dependabot[bot] 775482ea0f Bump adventure-text-minimessage from 4.13.1 to 4.14.0 in /core
Bumps [adventure-text-minimessage](https://github.com/KyoriPowered/adventure) from 4.13.1 to 4.14.0.
- [Release notes](https://github.com/KyoriPowered/adventure/releases)
- [Commits](https://github.com/KyoriPowered/adventure/compare/v4.13.1...v4.14.0)

---
updated-dependencies:
- dependency-name: net.kyori:adventure-text-minimessage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-07 16:00:15 +00:00
dependabot[bot] 6fa848f730 Bump adventure-api from 4.13.1 to 4.14.0 in /core
Bumps [adventure-api](https://github.com/KyoriPowered/adventure) from 4.13.1 to 4.14.0.
- [Release notes](https://github.com/KyoriPowered/adventure/releases)
- [Commits](https://github.com/KyoriPowered/adventure/compare/v4.13.1...v4.14.0)

---
updated-dependencies:
- dependency-name: net.kyori:adventure-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-07 16:00:10 +00:00
Andre_601 6a1d720f08 Merge branch 'master' into feature/more-placeholders 2023-05-30 00:07:05 +02:00
Andre_601 7d72af0e44 Fix protocollib version 2023-05-29 18:06:27 +02:00
Andre_601 ef1a34bdec Merge pull request #100 from Andre601/dependabot/maven/core/com.google.guava-guava-32.0.0-jre
Bump guava from 31.1-jre to 32.0.0-jre in /core
2023-05-29 18:05:42 +02:00
Andre_601 c30334d2af Merge pull request #101 from Andre601/dependabot/pip/mkdocs-material-9.1.15
Bump mkdocs-material from 9.1.14 to 9.1.15
2023-05-29 18:05:34 +02:00
dependabot[bot] da71fc0af9 Bump mkdocs-material from 9.1.14 to 9.1.15
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.14 to 9.1.15.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.14...9.1.15)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 16:04:35 +00:00
dependabot[bot] f5ff4702e5 Bump guava from 31.1-jre to 32.0.0-jre in /core
Bumps [guava](https://github.com/google/guava) from 31.1-jre to 32.0.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-29 16:02:52 +00:00
Andre601 257031827d Try 5.0.0 of ProtocolLib 2023-05-29 00:37:59 +02:00
Andre601 5e9c6f43fe Merge branch 'master' into feature/more-placeholders 2023-05-29 00:31:27 +02:00
Andre601 bfc76290a7 Populate map on Server Load 2023-05-27 21:58:24 +02:00
Andre_601 4d8139bb3e Merge pull request #99 from Andre601/dependabot/pip/mkdocs-material-9.1.14
Bump mkdocs-material from 9.1.13 to 9.1.14
2023-05-22 18:42:54 +02:00
dependabot[bot] 77cc783855 Bump mkdocs-material from 9.1.13 to 9.1.14
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.13 to 9.1.14.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.13...9.1.14)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-22 16:07:36 +00:00
Andre601 d01605ee47 Update API changelog 2023-05-22 01:27:52 +02:00
Andre601 8128f3e4af Use asl-api v3 2023-05-22 01:11:21 +02:00
Andre_601 10436a55bb Update to mc-publish 3.3 2023-05-20 12:23:26 +02:00
Andre601 740bf63afa remove broken import 2023-05-18 00:09:23 +02:00
Andre601 9508f34cc2 Cache worlds for Spigot and Paper 2023-05-17 23:59:40 +02:00
Andre_601 10de3a42f4 Merge pull request #98 from Andre601/dependabot/pip/mkdocs-material-9.1.13
Bump mkdocs-material from 9.1.12 to 9.1.13
2023-05-17 19:25:13 +02:00
dependabot[bot] 407008284b Bump mkdocs-material from 9.1.12 to 9.1.13
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.12 to 9.1.13.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.12...9.1.13)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-17 16:03:15 +00:00
Andre601 e2fd877e91 Add glightbox mkdocs plugin 2023-05-16 15:40:17 +02:00
Andre601 ca16f618d8 Add config migration + case-insensitive equals 2023-05-16 15:37:58 +02:00
Andre_601 80731117a3 Merge pull request #97 from Andre601/dependabot/pip/mkdocs-material-9.1.12
Bump mkdocs-material from 9.1.11 to 9.1.12
2023-05-12 18:19:29 +02:00
dependabot[bot] dc62ef0989 Bump mkdocs-material from 9.1.11 to 9.1.12
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.11 to 9.1.12.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.11...9.1.12)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-12 16:12:52 +00:00
Andre_601 13209e7a79 Add timezone indicator 2023-05-12 00:31:58 +02:00
Andre_601 8edb7b194a Add timezone 2023-05-12 00:30:35 +02:00
Andre_601 354b5f83b2 Update to latest template action 2023-05-12 00:22:35 +02:00
Andre_601 5e568c68c4 Update to latest template action 2023-05-12 00:22:16 +02:00
Andre601 5cc9678b5a Update docs 2023-05-10 11:31:20 +02:00
Andre601 ae5a5973aa Trigger Workflow 2023-05-10 11:03:59 +02:00
Andre_601 5a589b2297 Fix JSON paths 2023-05-10 11:03:56 +02:00
Andre601 e6bc14fca5 Trigger Workflow 2023-05-10 10:59:43 +02:00
Andre_601 95d67a270b Use different date 2023-05-10 10:59:35 +02:00
Andre601 559d5a2d9b Trigger Workflow 2023-05-10 10:55:54 +02:00
Andre_601 a60bffa04d Update template action 2023-05-10 10:37:44 +02:00
Andre_601 1a5dd75157 Update template action 2023-05-10 10:37:24 +02:00
Andre601 f5113d3d45 Trigger Workflow 2023-05-09 20:01:12 +02:00
Andre_601 cddd2dbeb7 Remove :funcs 2023-05-09 20:01:10 +02:00
Andre601 10da7c9eeb Trigger Workflow 2023-05-09 19:59:21 +02:00
Andre_601 e50bbf4620 Try newer commit SHA 2023-05-09 19:59:19 +02:00
Andre_601 fe1b6dc0e5 Try newer commit SHA 2023-05-09 19:59:05 +02:00
Andre601 a20acf5378 Trigger Workflow 2023-05-09 19:52:52 +02:00
Andre_601 1d74640d67 Update success.md 2023-05-09 19:52:39 +02:00
Andre_601 20e3f908f9 Use :funcs 2023-05-09 19:51:48 +02:00
Andre_601 8b2a499d20 use :funcs 2023-05-09 19:51:27 +02:00
Andre601 d8ba5ffaea Trigger Workflow 2023-05-09 18:35:19 +02:00
Andre_601 608c617b17 Remove - from placeholder 2023-05-09 18:34:41 +02:00
Andre_601 50d47a0c65 Don't use - I guess? 2023-05-09 18:33:37 +02:00
Andre601 1d41072767 Trigger Workflow 2023-05-09 18:30:42 +02:00
Andre_601 2ffd7f479b Checkout repo 2023-05-09 18:30:39 +02:00
Andre_601 38f1e4f21d Checkout repo 2023-05-09 18:30:03 +02:00
Andre601 33f29b5694 Trigger Workflow 2023-05-09 18:25:52 +02:00
Andre_601 4b6901467f Revert artifact info getting 2023-05-09 18:23:55 +02:00
Andre_601 62dc420d55 Prefix path with ./ 2023-05-09 18:20:02 +02:00
Andre_601 d7cb52d785 Try with ./ prefixed path 2023-05-09 18:19:11 +02:00
Andre_601 67bdd98a5b Merge pull request #86 from Andre601/feature/improve-pr-comment-action
Update pr-comment.yml
2023-05-09 18:10:21 +02:00
Andre_601 ffa0da8f1c Update building.md 2023-05-09 18:07:24 +02:00
Andre_601 abb2378bf2 Wrong location for the options 2023-05-09 18:06:02 +02:00
Andre_601 d10c6ffb78 Merge pull request #95 from Andre601/dependabot/pip/mkdocs-material-9.1.11
Bump mkdocs-material from 9.1.9 to 9.1.11
2023-05-09 18:05:36 +02:00
dependabot[bot] e2b4fdf72f Bump mkdocs-material from 9.1.9 to 9.1.11
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.9 to 9.1.11.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.9...9.1.11)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-09 16:03:25 +00:00
Andre_601 993c665445 Update failed.md 2023-05-09 18:00:52 +02:00
Andre_601 607b95b723 Update success.md 2023-05-09 18:00:18 +02:00
Andre_601 8476e72e9a Update failed.md 2023-05-09 17:54:35 +02:00
Andre_601 57b782d7d7 Update create-pr-artifact.yml 2023-05-09 17:53:31 +02:00
Andre_601 2dd3b04dbe Use experimental template action ver 2023-05-09 17:51:59 +02:00
Andre_601 38d6ac3972 Merge pull request #94 from Andre601/fix/81-noclassdeffoundexception-issue
Fix ProtocolLib component issue
2023-05-08 17:38:06 +02:00
Andre601 360b961221 Bump version 2023-05-08 17:34:57 +02:00
Andre601 ef22ede56d Fix ProtocolLib component issue 2023-05-08 17:03:09 +02:00
Andre601 afa18b81fe Add Server placeholder options 2023-05-08 17:00:35 +02:00
Andre_601 ec9ea799cf Merge pull request #93 from Andre601/dependabot/pip/mkdocs-material-9.1.9
Bump mkdocs-material from 9.1.8 to 9.1.9
2023-05-02 18:12:08 +02:00
dependabot[bot] 99f762ff18 Bump mkdocs-material from 9.1.8 to 9.1.9
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.8 to 9.1.9.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.8...9.1.9)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-02 16:04:19 +00:00
Andre601 2bd59ff554 Load JoinEvent properly on Paper 2023-04-26 23:21:07 +02:00
Andre601 53157a7c06 Bump version 2023-04-26 23:11:20 +02:00
Andre_601 bfc39ab172 Merge pull request #91 from Andre601/feature/plugin-improvements
Plugin improvements
2023-04-26 23:08:39 +02:00
Andre_601 fa44192bd3 Ignore non-code files 2023-04-26 18:30:58 +02:00
Andre_601 53fc434bdd Merge pull request #92 from Andre601/dependabot/pip/mkdocs-material-9.1.8
Bump mkdocs-material from 9.1.7 to 9.1.8
2023-04-26 18:28:42 +02:00
dependabot[bot] b6152372a8 Bump mkdocs-material from 9.1.7 to 9.1.8
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.7 to 9.1.8.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.7...9.1.8)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-26 16:03:16 +00:00
Andre_601 5441d2bd96 Merge pull request #88 from Andre601/dependabot/maven/velocity/com.squareup.okhttp3-okhttp-4.11.0
Bump okhttp from 4.10.0 to 4.11.0 in /velocity
2023-04-24 18:35:57 +02:00
Andre_601 2d358f76c0 Merge pull request #89 from Andre601/dependabot/maven/core/com.squareup.okhttp3-okhttp-4.11.0
Bump okhttp from 4.10.0 to 4.11.0 in /core
2023-04-24 18:34:34 +02:00
Andre_601 d1cbaa3ef6 Merge pull request #90 from Andre601/dependabot/pip/mkdocs-material-9.1.7
Bump mkdocs-material from 9.1.6 to 9.1.7
2023-04-24 18:34:05 +02:00
dependabot[bot] 29513d953d Bump mkdocs-material from 9.1.6 to 9.1.7
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.6 to 9.1.7.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.6...9.1.7)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 16:06:42 +00:00
dependabot[bot] 365ec3d6f5 Bump okhttp from 4.10.0 to 4.11.0 in /core
Bumps [okhttp](https://github.com/square/okhttp) from 4.10.0 to 4.11.0.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.10.0...parent-4.11.0)

---
updated-dependencies:
- dependency-name: com.squareup.okhttp3:okhttp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 16:02:45 +00:00
dependabot[bot] d4babddc31 Bump okhttp from 4.10.0 to 4.11.0 in /velocity
Bumps [okhttp](https://github.com/square/okhttp) from 4.10.0 to 4.11.0.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.10.0...parent-4.11.0)

---
updated-dependencies:
- dependency-name: com.squareup.okhttp3:okhttp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-24 16:02:17 +00:00
Andre601 648b656dd4 Reduce duplicate code. 2023-04-22 00:04:21 +02:00
Andre601 b2b71144d9 Improve plugin code... I guess? 2023-04-21 23:34:22 +02:00
Andre601 17357345ab Use old badge system + add template render 2023-04-17 00:09:30 +02:00
Andre601 f696fc2160 Add missing perms and command info 2023-04-16 23:35:39 +02:00
Andre_601 b9885c1249 Update building.md 2023-04-16 23:29:58 +02:00
Andre_601 e357f370e0 Update failed.md 2023-04-16 23:29:08 +02:00
Andre_601 d777ac84f0 Create success.md 2023-04-16 23:28:52 +02:00
Andre_601 5da627b1b6 Create failed.md 2023-04-16 23:24:10 +02:00
Andre_601 8ee063daec Merge pull request #87 from Andre601/feature/pr-comment-files
Create building.md
2023-04-16 23:19:47 +02:00
Andre_601 ad46149bb6 Create building.md 2023-04-16 23:18:50 +02:00
Andre_601 528226401f Update pr-comment.yml 2023-04-14 23:38:30 +02:00
Andre_601 97a71958e1 Add permission 2023-04-14 23:32:19 +02:00
Andre_601 b15d5f0633 Add permissions 2023-04-14 23:32:03 +02:00
Andre601 b4e39ca985 Add examples to profiles page 2023-04-13 16:24:56 +02:00
Andre_601 5aae2cccdc Add comment info output 2023-04-11 21:48:11 +02:00
Andre_601 c7ccd48037 Add some info lines 2023-04-11 21:47:31 +02:00
Andre_601 2b6c904fbf Update pr-comment.yml 2023-04-11 21:36:16 +02:00
Andre_601 eeefea3f6a Make finding comment more precise 2023-04-11 21:33:45 +02:00
Andre_601 2840c29a90 Merge pull request #85 from Andre601/dependabot/pip/mkdocs-material-9.1.6
Bump mkdocs-material from 9.1.5 to 9.1.6
2023-04-10 18:07:20 +02:00
Andre_601 862e631405 Merge pull request #84 from Andre601/dependabot/maven/core/net.kyori-adventure-text-serializer-legacy-4.13.1
Bump adventure-text-serializer-legacy from 4.13.0 to 4.13.1 in /core
2023-04-10 18:06:45 +02:00
dependabot[bot] f00737b0f0 Bump mkdocs-material from 9.1.5 to 9.1.6
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.5 to 9.1.6.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.5...9.1.6)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 16:06:42 +00:00
Andre_601 2d4d1d3136 Merge pull request #83 from Andre601/dependabot/maven/core/net.kyori-adventure-api-4.13.1
Bump adventure-api from 4.13.0 to 4.13.1 in /core
2023-04-10 18:06:38 +02:00
Andre_601 04d255bb54 Merge pull request #82 from Andre601/dependabot/maven/core/net.kyori-adventure-text-minimessage-4.13.1
Bump adventure-text-minimessage from 4.13.0 to 4.13.1 in /core
2023-04-10 18:06:30 +02:00
dependabot[bot] f77db9c760 Bump adventure-text-serializer-legacy from 4.13.0 to 4.13.1 in /core
Bumps [adventure-text-serializer-legacy](https://github.com/KyoriPowered/adventure) from 4.13.0 to 4.13.1.
- [Release notes](https://github.com/KyoriPowered/adventure/releases)
- [Commits](https://github.com/KyoriPowered/adventure/compare/v4.13.0...v4.13.1)

---
updated-dependencies:
- dependency-name: net.kyori:adventure-text-serializer-legacy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 16:03:03 +00:00
dependabot[bot] 9cde35aa2f Bump adventure-api from 4.13.0 to 4.13.1 in /core
Bumps [adventure-api](https://github.com/KyoriPowered/adventure) from 4.13.0 to 4.13.1.
- [Release notes](https://github.com/KyoriPowered/adventure/releases)
- [Commits](https://github.com/KyoriPowered/adventure/compare/v4.13.0...v4.13.1)

---
updated-dependencies:
- dependency-name: net.kyori:adventure-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 16:02:53 +00:00
dependabot[bot] 13ca53140c Bump adventure-text-minimessage from 4.13.0 to 4.13.1 in /core
Bumps [adventure-text-minimessage](https://github.com/KyoriPowered/adventure) from 4.13.0 to 4.13.1.
- [Release notes](https://github.com/KyoriPowered/adventure/releases)
- [Commits](https://github.com/KyoriPowered/adventure/compare/v4.13.0...v4.13.1)

---
updated-dependencies:
- dependency-name: net.kyori:adventure-text-minimessage
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 16:02:46 +00:00
Andre_601 bc1d0722fa Merge pull request #80 from Andre601/feature/gh-actions-include-commit
Include Commit SHA in PR builds
2023-04-08 02:12:09 +02:00
Andre601 6201342ca7 Trigger new workflow 2023-04-08 02:06:42 +02:00
Andre_601 801e0a2749 Use PR SHA 2023-04-08 02:04:22 +02:00
Andre601 10718e6d03 Include Commit SHA in PR builds 2023-04-08 01:52:31 +02:00
Andre601 03203345c0 Include commit SHA for PR builds 2023-04-08 01:49:23 +02:00
Andre601 3ade0952e2 Folia support 2023-04-06 21:22:33 +02:00
Andre_601 f0e30d47dc typo fixes 2023-04-05 19:37:11 +02:00
Andre_601 bb94510858 Update URL and add expire date 2023-04-05 19:33:03 +02:00
Andre_601 c9d94619dd Merge pull request #77 from Andre601/dependabot/github_actions/peter-evans/create-or-update-comment-3
Bump peter-evans/create-or-update-comment from 2 to 3
2023-04-05 18:59:21 +02:00
dependabot[bot] 7ab8749421 Bump peter-evans/create-or-update-comment from 2 to 3
Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 2 to 3.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/v2...v3)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-05 16:00:47 +00:00
Andre_601 a9216cc82c Improve badges 2023-04-05 17:13:28 +02:00
Andre_601 f14ef643b8 Improve badge 2023-04-05 17:10:47 +02:00
Andre_601 cc876d2f21 Fix Java version 2023-04-05 16:57:20 +02:00
Andre_601 0f8693add2 typo fixes 2023-04-05 16:50:55 +02:00
Andre_601 dcc9d18dbe typo fixes 2023-04-05 16:50:29 +02:00
Andre_601 f579aa0088 Fix broken ref 2023-04-05 16:48:19 +02:00
Andre601 579b945fbd Update workflow 2023-04-04 15:55:28 +02:00
Andre601 664bea8109 Create actions for PR previews. 2023-04-04 15:53:13 +02:00
83 changed files with 1674 additions and 424 deletions

No files matched your search

+30 -14
View File
@@ -4,19 +4,19 @@ AdvancedServerList is a plugin that allowys you to customize your server's MOTD,
## Supported Platforms
<a href="https://www.spigotmc.org" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/spigot_vector.svg" width="64" alt="platform-spigot" title="Tested on Spigot">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/spigot_vector.svg&w=64 alt="platform-spigot" title="Tested on Spigot">
</a>
<a href="https://papermc.io" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/paper_vector.svg" width="64" alt="platform-paper" title="Tested on Paper">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/paper_vector.svg&w=64 alt="platform-paper" title="Tested on Paper">
</a>
<a href="https://www.spigotmc.org" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/bungeecord_vector.svg" width="64" alt="platform-bungeecord" title="Tested on BungeeCord">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/bungeecord_vector.svg&w=64 alt="platform-bungeecord" title="Tested on BungeeCord">
</a>
<a href="https://www.papermc.io" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/waterfall_vector.svg" width="64" alt="platform-waterfall" title="Tested on Waterfall">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/waterfall_vector.svg&w=64 alt="platform-waterfall" title="Tested on Waterfall">
</a>
<a href="https://velocitypowered.com" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/velocity_vector.svg" width="64" alt="platform-velocity" title="Tested on Velocity">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/supported/velocity_vector.svg&w=64 alt="platform-velocity" title="Tested on Velocity">
</a>
## What is a Server List Profile?
@@ -24,12 +24,14 @@ A Server List Profile refers to a YAML file located in the plugin's `profiles` d
It allows you to configure specific aspects of the server display in the MC-Client's multiplayer server list, such as the MOTD, player count text, player count hover or Favicon.
> [*Read More*][profiles]
### Conditions
Thanks to conditions can you determine when a profile should be displayed in the player’s server list, to allow displaying specific text (i.e. a warning when they are using an outdated version).
When multiple profiles exist that have valid conditions will the one with the highest priority (Higher number = higher priority) be selected. Having no conditions makes the profile automatically return true.
> [*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.
The format is `${<target> <identifier>}` which was adopted from BungeeTabListPlus. Depending on what platform you use the plugin on are only specific placeholders available.
@@ -37,17 +39,20 @@ The format is `${<target> <identifier>}` which was adopted from BungeeTabListPlu
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.
> [*Read More*][placeholders]
### Formatting
The plugin uses the MiniMessage format for a consistent, easy way of formatting your text.
Only certain options are usable for each option. As an example does motd support HEX colours and gradients, while the other options only support default colour codes.
> [*Read More*][minimessage]
## Dependencies
| Dependency | Platforms | Required? |
| ---------------- | ------------- | --------- |
|------------------|---------------|-----------|
| [ProtocolLib] | Spigot | Yes |
| [PlaceholderAPI] | Spigot, Paper | No |
| [ViaVersion] | Spigot, Paper | No |
## Statistics
@@ -58,31 +63,42 @@ You can disable this in the global bStats config file located in `/plugins/bstat
- [Paper/Spigot][bstats-spigot]
- [Velocity][bstats-velocity]
## Videos
Do you have your own video to share? Contact me and I will add it to this section.
<details><summary>Click to Show/Hide Videos</summary>
Spanish Video by Ajneb97
<iframe width="560" height="auto" src="https://www.youtube.com/embed/rIbljm_4HVI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</details>
## Screenshots
<a href="https://modrinth.com/plugin/advancedserverlist/gallery" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/modrinth-gallery_vector.svg" width="208" alt="gallery" title="Check out the Gallery">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/documentation/modrinth-gallery_vector.svg&w=208" alt="gallery" title="Check out the Gallery">
</a>
## Support
<a href="https://discord.gg/6dazXp6" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/social/discord-singular_vector.svg" width="64" alt="discord" title="Join my Discord Server">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/social/discord-singular_vector.svg&w=64" alt="discord" title="Join my Discord Server">
</a>
<a href="https://app.revolt.chat/invite/74TpERXA" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/social/revolt-singular_vector.svg" width="64" alt="revolt" title="Join my Revolt Server">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/social/revolt-singular_vector.svg&w=64" alt="revolt" title="Join my Revolt Server">
</a>
<a href="https://blobfox.coffee/@andre_601" target="_blank">
<img src="https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/social/mastodon-singular_vector.svg" width="64" alt="revolt" title="Chat with me on Mastodon">
<img src="https://wsrv.nl/?url=https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact-minimal/social/mastodon-singular_vector.svg&w=64" alt="revolt" title="Chat with me on Mastodon">
</a>
<!-- Links -->
[profiles]: https://andre601.ch/AdvancedServerList/profiles
[conditions]: https://andre601.ch/AdvancedServerList/profiles/#conditions
[placeholders]: https://andre601.ch/AdvancedServerList/profiles/placeholders
[minimessage]: https://andre601.ch/AdvancedServerList/profiles/formatting
[profiles]: https://andre601.ch/AdvancedServerList/latest/profiles
[conditions]: https://andre601.ch/AdvancedServerList/latest/profiles/#conditions
[placeholders]: https://andre601.ch/AdvancedServerList/latest/profiles/placeholders
[minimessage]: https://andre601.ch/AdvancedServerList/latest/profiles/formatting
[protocollib]: https://www.spigotmc.org/resources/1997/
[placeholderapi]: https://www.spigotmc.org/resources/6245/
[viaversion]: https://www.spigotmc.org/resources/19254/
[bstats]: https://bstats.org
[bstats-bungee]: https://bstats.org/plugin/bungeecord/AdvancedServerList/15585
+7
View File
@@ -0,0 +1,7 @@
<!-- pr-build comment -->
![badge]
Building jar file from Pull request. Please wait...
[badge]: https://img.shields.io/badge/Building...-0d1117?style=for-the-badge&labelColor=7a8490&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjZmZmZmZmIj48cGF0aCBkPSJNNC43NSAyaDE0LjVhLjc1Ljc1IDAgMCAxIDAgMS41aC0uNzV2Mi45ODJhNC43NSA0Ljc1IDAgMCAxLTIuMjE1IDQuMDE3bC0yLjA0NCAxLjI5YS4yNS4yNSAwIDAgMCAwIC40MjJsMi4wNDQgMS4yOWE0Ljc1IDQuNzUgMCAwIDEgMi4yMTUgNC4wMTdWMjAuNWguNzVhLjc1Ljc1IDAgMCAxIDAgMS41SDQuNzVhLjc1Ljc1IDAgMCAxIDAtMS41aC43NXYtMi45ODJhNC43NSA0Ljc1IDAgMCAxIDIuMjE1LTQuMDE3bDIuMDQ0LTEuMjlhLjI1LjI1IDAgMCAwIDAtLjQyMmwtMi4wNDQtMS4yOUE0Ljc1IDQuNzUgMCAwIDEgNS41IDYuNDgyVjMuNWgtLjc1YS43NS43NSAwIDAgMSAwLTEuNVpNMTcgMy41SDd2Mi45ODJBMy4yNSAzLjI1IDAgMCAwIDguNTE2IDkuMjNsMi4wNDQgMS4yOWExLjc1IDEuNzUgMCAwIDEgMCAyLjk2bC0yLjA0NCAxLjI5QTMuMjUgMy4yNSAwIDAgMCA3IDE3LjUxOFYyMC41aDEwdi0yLjk4MmEzLjI1IDMuMjUgMCAwIDAtMS41MTYtMi43NDhsLTIuMDQ0LTEuMjlhMS43NSAxLjc1IDAgMCAxIDAtMi45NmwyLjA0NC0xLjI5QTMuMjUgMy4yNSAwIDAgMCAxNyA2LjQ4MloiPjwvcGF0aD48L3N2Zz4=
+12
View File
@@ -0,0 +1,12 @@
<!-- pr-build comment -->
![badge]
**Compiling of jar files failed!**
Please check the logs below for any errors.
| Name | Link |
| ------ | -------------------------------- |
| Commit | {{ .commit }} |
| Logs | {{ .logs | mdlink "View Logs" }} |
[badge]: https://img.shields.io/badge/Build_Failure!-0d1117?style=for-the-badge&labelColor=f85149&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjZmZmZmZmIj48cGF0aCBkPSJNNS43MiA1LjcyYS43NS43NSAwIDAgMSAxLjA2IDBMMTIgMTAuOTRsNS4yMi01LjIyYS43NDkuNzQ5IDAgMCAxIDEuMjc1LjMyNi43NDkuNzQ5IDAgMCAxLS4yMTUuNzM0TDEzLjA2IDEybDUuMjIgNS4yMmEuNzQ5Ljc0OSAwIDAgMS0uMzI2IDEuMjc1Ljc0OS43NDkgMCAwIDEtLjczNC0uMjE1TDEyIDEzLjA2bC01LjIyIDUuMjJhLjc1MS43NTEgMCAwIDEtMS4wNDItLjAxOC43NTEuNzUxIDAgMCAxLS4wMTgtMS4wNDJMMTAuOTQgMTIgNS43MiA2Ljc4YS43NS43NSAwIDAgMSAwLTEuMDZaIj48L3BhdGg+PC9zdmc+
+15
View File
@@ -0,0 +1,15 @@
<!-- pr-build comment -->
![badge]
The compiling of the jar files was successful!
You can find a direct download for the artifact below.
File expires: `{{ .expire | date "02 Jan 2006 15:04 MST" }}`
| Name | Link |
| -------- | -------------------------------------------- |
| Commit | {{ .commit }} |
| Logs | {{ .logs | mdlink "View Logs" }} |
| Download | {{ .download | mdlink "Download Artifact" }} |
[badge]: https://img.shields.io/badge/Build_Success!-0d1117?style=for-the-badge&labelColor=3fb950&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjZmZmZmZmIj48cGF0aCBkPSJNMjEuMDMgNS43MmEuNzUuNzUgMCAwIDEgMCAxLjA2bC0xMS41IDExLjVhLjc0Ny43NDcgMCAwIDEtMS4wNzItLjAxMmwtNS41LTUuNzVhLjc1Ljc1IDAgMSAxIDEuMDg0LTEuMDM2bDQuOTcgNS4xOTVMMTkuOTcgNS43MmEuNzUuNzUgMCAwIDEgMS4wNiAwWiI+PC9wYXRoPjwvc3ZnPg==
+2 -10
View File
@@ -17,21 +17,13 @@ updates:
- 'Type: Update Dependency'
- 'Target: Core'
- package-ecosystem: maven
directory: "/paper"
directory: "/bukkit"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: PaperMC'
- package-ecosystem: maven
directory: "/spigot"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- 'Type: Update Dependency'
- 'Target: Spigot'
- 'Target: Bukkit'
- package-ecosystem: maven
directory: "/velocity"
schedule:
+14
View File
@@ -0,0 +1,14 @@
"Target: All":
- all: ["bukkit/**", "bungeecord/**", "core/**", "velocity/**"]
"Target: Bukkit":
- all: ["bukkit/**", "!bungeecord/**", "!core/**", "!velocity/**"]
"Target: BungeeCord":
- all: ["!bukkit/**", "bungeecord/**", "!core/**", "!velocity/**"]
"Target: Core":
- all: ["!bukkit/**", "!bungeecord/**", "core/**", "!velocity/**"]
"Target: Velocity":
- all: ["!bukkit/**", "!bungeecord/**", "!core/**", "velocity/**"]
+100
View File
@@ -0,0 +1,100 @@
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@v3
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@v3
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 }}
+4
View File
@@ -31,5 +31,9 @@ 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
-88
View File
@@ -1,88 +0,0 @@
name: 'Build PR changes'
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
paths:
- 'bukkit/src/**'
- 'bungeecord/src/**'
- 'core/src/**'
- 'velocity/src/**'
concurrency: 'pr-preview'
jobs:
buildJars:
name: 'Build Jars from Pull request'
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Setup Java 16'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '16'
cache: 'maven'
- name: 'Build Jar files'
run: mvn clean install
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: asl-files
path: '*/target/AdvancedServerList-*.jar'
if-no-files-found: error
updateCommentSuccess:
name: 'Create or update Comment (On Success).'
needs: [buildJars]
if: success()
runs-on: ubuntu-latest
steps:
- 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]'
- name: Update Comment
uses: peter-evans/create-or-update-comment@v2
with:
body: |-
## Build Preview
Below is a URL to the Jar files made using this Pull request.
Please note that artifacts build by this GitHub Action only exist for at most 90 days since last run!
| Name | Link |
|-----------|-------------------------------------------------------------------------------------|
| Commit | ${{ github.event.pull_request.head.sha }} |
| Logs | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| Jar Files | <!-- What can I put here? --> |
UpdateCommentFailure:
name: 'Create or update Comment (On Success).'
needs: [buildJars]
if: failure()
runs-on: ubuntu-latest
steps:
- 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]'
- name: Update Comment
uses: peter-evans/create-or-update-comment@v2
with:
body: |-
## Build Preview
There was an issue generating the Jar files from your Pull request.
Please review the logs linked below for further information.
| Name | Link |
|--------|-------------------------------------------------------------------------------------|
| Commit | ${{ github.event.pull_request.head.sha }} |
| Logs | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
+99
View File
@@ -0,0 +1,99 @@
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@v3
- 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 }}
+7 -19
View File
@@ -67,21 +67,15 @@ jobs:
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.2
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
files-secondary: ""
loaders: ${{ matrix.loaders }}
version-resolver: releases
game-versions: |
1.19
1.19.1
1.19.2
1.19.3
1.19.4
game-version-filter: releases
game-versions: '>=1.19'
java: 16
modrinth-id: xss83sOY
modrinth-featured: false
@@ -89,21 +83,15 @@ jobs:
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.2
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
files-secondary: ""
loaders: ${{ matrix.loaders }}
version-resolver: releases
game-versions: |
1.19
1.19.1
1.19.2
1.19.3
1.19.4
game-version-filter: releases
game-versions: '>=1.19'
java: 16
modrinth-id: xss83sOY
modrinth-featured: false
@@ -128,4 +116,4 @@ jobs:
- 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 }}
GITHUB_RELEASE_BODY: ${{ github.event.release.body }}
+6 -6
View File
@@ -75,7 +75,7 @@
</dependency>
<dependency>
<groupId>ch.andre601.asl-api</groupId>
<artifactId>platform-spigot</artifactId>
<artifactId>platform-bukkit</artifactId>
<version>${api.version}</version>
<scope>compile</scope>
</dependency>
@@ -100,7 +100,7 @@
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0-SNAPSHOT</version>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -118,13 +118,13 @@
<dependency>
<groupId>com.viaversion</groupId>
<artifactId>viaversion-api</artifactId>
<version>4.6.2</version>
<version>4.7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>AdvancedServerList-Bukkit-${plugin.version}</finalName>
<finalName>AdvancedServerList-Bukkit-${plugin.version}${project.build.commit}</finalName>
<resources>
<resource>
<filtering>true</filtering>
@@ -143,7 +143,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
@@ -174,4 +174,4 @@
</plugins>
</build>
</project>
</project>
@@ -0,0 +1,39 @@
/*
* 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.bukkit;
import ch.andre601.advancedserverlist.bukkit.objects.WorldCache;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import org.bukkit.plugin.java.JavaPlugin;
/*
* Small convenience class to "merge" the PluginCore and JavaPlugin classes.
* Allows me to have BukkitCore<?> for whenever I also need a JavaPlugin (i.e. registering events).
* See JoinEvent class for an example.
*/
public abstract class BukkitCore<F> extends JavaPlugin implements PluginCore<F>{
public abstract WorldCache getWorldCache();
}
@@ -50,7 +50,7 @@ public class CmdAdvancedServerList extends Command implements CommandExecutor{
super(
"advancedserverlist",
"Main command of the plugin",
"/asl [reload|help]",
"/asl [reload|help|clearCache]",
Collections.singletonList("asl")
);
@@ -23,9 +23,10 @@
*
*/
package ch.andre601.advancedserverlist.bukkit.events;
package ch.andre601.advancedserverlist.bukkit.listeners;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -33,12 +34,17 @@ import org.bukkit.event.player.PlayerJoinEvent;
import java.net.InetSocketAddress;
public class JoinEvent implements Listener{
public class JoinEvent<F> implements Listener{
private final PluginCore<?> plugin;
private final BukkitCore<F> plugin;
public JoinEvent(PluginCore<?> plugin){
private JoinEvent(BukkitCore<F> plugin){
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public static <F> void init(BukkitCore<F> plugin){
new JoinEvent<>(plugin);
}
@EventHandler
@@ -23,41 +23,52 @@
*
*/
package ch.andre601.advancedserverlist.spigot.events;
package ch.andre601.advancedserverlist.bukkit.listeners;
import ch.andre601.advancedserverlist.bukkit.events.JoinEvent;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.PAPIPlaceholders;
import ch.andre601.advancedserverlist.spigot.SpigotCore;
import ch.andre601.advancedserverlist.bukkit.objects.PAPIPlaceholders;
import ch.andre601.advancedserverlist.spigot.listeners.ProtocolLibEvents;
import com.comphenix.protocol.ProtocolLibrary;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.ServerLoadEvent;
import org.bukkit.plugin.PluginManager;
public class LoadEvent implements Listener{
private final SpigotCore plugin;
private final BukkitCore<?> plugin;
public LoadEvent(SpigotCore plugin){
private LoadEvent(BukkitCore<?> plugin){
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public static void init(BukkitCore<?> plugin){
new LoadEvent(plugin);
}
@EventHandler
public void onServerLoad(ServerLoadEvent event){
PluginManager manager = plugin.getServer().getPluginManager();
JoinEvent.init(plugin);
WorldEvents.init(plugin);
if(!manager.isPluginEnabled("ProtocolLib")){
// Populate WorldCache with all loaded worlds
Bukkit.getWorlds().forEach(world -> plugin.getWorldCache().addWorld(world.getName(), world));
if(!(plugin instanceof SpigotCore spigotCore))
return;
if(!Bukkit.getPluginManager().isPluginEnabled("ProtocolLib")){
plugin.getCore().getPlugin().getPluginLogger().warn("ProtocolLib not found! AdvancedServerList requires it to work on Spigot!");
manager.disablePlugin(plugin);
Bukkit.getPluginManager().disablePlugin(plugin);
return;
}
manager.registerEvents(new JoinEvent(plugin), plugin);
manager.registerEvents(new ProtocolLibEvents(plugin, ProtocolLibrary.getProtocolManager()), plugin);
ProtocolLibEvents.init(spigotCore, ProtocolLibrary.getProtocolManager());
if(manager.isPluginEnabled("PlaceholderAPI"))
new PAPIPlaceholders(plugin);
if(Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"))
spigotCore.setPapiPlaceholders(PAPIPlaceholders.init(spigotCore));
}
}
@@ -23,8 +23,9 @@
*
*/
package ch.andre601.advancedserverlist.bungeecord.events;
package ch.andre601.advancedserverlist.bukkit.listeners;
import ch.andre601.advancedserverlist.api.bukkit.events.PreServerListSetEvent;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
public class PreServerListSetEventImpl extends PreServerListSetEvent{
@@ -0,0 +1,57 @@
/*
* 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.bukkit.listeners;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldUnloadEvent;
public class WorldEvents implements Listener{
private final BukkitCore<?> plugin;
private WorldEvents(BukkitCore<?> plugin){
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public static void init(BukkitCore<?> plugin){
new WorldEvents(plugin);
}
@EventHandler
public void onWorldLoad(WorldLoadEvent event){
plugin.getWorldCache().addWorld(event.getWorld().getName(), event.getWorld());
}
@EventHandler
public void onWorldUnload(WorldUnloadEvent event){
plugin.getWorldCache().removeWorld(event.getWorld().getName());
}
}
@@ -0,0 +1,50 @@
/*
* 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.bukkit.objects;
import org.bukkit.World;
import java.util.HashMap;
import java.util.Map;
public record WorldCache(Map<String, World> worlds){
public WorldCache(){
this(new HashMap<>());
}
public boolean containsWorld(String key){
return worlds().containsKey(key);
}
public void addWorld(String key, World world){
worlds().put(key, world);
}
public void removeWorld(String key){
worlds().remove(key);
}
}
@@ -23,21 +23,21 @@
*
*/
package ch.andre601.advancedserverlist.bukkit.objects;
package ch.andre601.advancedserverlist.bukkit.objects.impl;
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitPlayer;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import ch.andre601.advancedserverlist.core.profiles.players.GenericPlayerImpl;
import ch.andre601.advancedserverlist.spigot.objects.SpigotPlayer;
import org.bukkit.OfflinePlayer;
public class SpigotPlayerImpl extends GenericPlayerImpl implements SpigotPlayer{
public class BukkitPlayerImpl extends GenericPlayerImpl implements BukkitPlayer{
private final OfflinePlayer player;
private boolean playedBefore = false;
private boolean banned = false;
private boolean whitelisted = false;
public SpigotPlayerImpl(OfflinePlayer player, CachedPlayer cachedPlayer, int protocol){
public BukkitPlayerImpl(OfflinePlayer player, CachedPlayer cachedPlayer, int protocol){
this.player = player;
this.name = player == null ? cachedPlayer.getName() : player.getName();
@@ -0,0 +1,54 @@
/*
* 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.bukkit.objects.impl;
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitServer;
import org.bukkit.World;
import java.util.Map;
public record BukkitServerImpl(Map<String, World> worlds, int playersOnline, int playersMax, String host) implements BukkitServer{
@Override
public Map<String, World> getWorlds(){
return worlds;
}
@Override
public int getPlayersOnline(){
return playersOnline;
}
@Override
public int getPlayersMax(){
return playersMax;
}
@Override
public String getHost(){
return host;
}
}
@@ -23,22 +23,27 @@
*
*/
package ch.andre601.advancedserverlist.bukkit.objects;
package ch.andre601.advancedserverlist.bukkit.objects.placeholders;
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.spigot.objects.SpigotPlayer;
public class BukkitPlayerPlaceholders extends PlaceholderProvider{
public BukkitPlayerPlaceholders(){
private BukkitPlayerPlaceholders(){
super("player");
}
public static BukkitPlayerPlaceholders init(){
return new BukkitPlayerPlaceholders();
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
SpigotPlayer bukkitPlayer = (SpigotPlayer)player;
if(!(player instanceof BukkitPlayer bukkitPlayer))
return null;
return switch(placeholder){
case "name" -> bukkitPlayer.getName();
@@ -51,7 +56,7 @@ public class BukkitPlayerPlaceholders extends PlaceholderProvider{
};
}
private String returnValue(SpigotPlayer player, Object value){
private String returnValue(BukkitPlayer player, Object value){
return player.getPlayer() == null ? null : String.valueOf(value);
}
}
@@ -0,0 +1,90 @@
/*
* 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.bukkit.objects.placeholders;
import ch.andre601.advancedserverlist.api.bukkit.objects.BukkitServer;
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import org.bukkit.Bukkit;
import org.bukkit.World;
public class BukkitServerPlaceholders extends PlaceholderProvider{
private BukkitServerPlaceholders(){
super("server");
}
public static BukkitServerPlaceholders init(){
return new BukkitServerPlaceholders();
}
@Override
public String parsePlaceholder(String placeholders, GenericPlayer player, GenericServer server){
if(!(server instanceof BukkitServer bukkitServer))
return null;
String[] args = placeholders.split("\\s", 2);
return switch(args[0]){
case "playersOnline" -> {
if(args.length >= 2){
int players = 0;
for(int i = 1; i < args.length; i++){
World world = bukkitServer.getWorlds().get(args[i]);
if(world == null)
continue;
players += world.getPlayers().size();
}
yield String.valueOf(players);
}
yield String.valueOf(bukkitServer.getPlayersOnline());
}
case "playersMax" -> {
if(args.length >= 2)
yield null;
yield String.valueOf(bukkitServer.getPlayersMax());
}
case "host" -> {
if(args.length >= 2)
yield null;
yield bukkitServer.getHost();
}
case "whitelistEnabled" -> {
if(args.length >= 2)
yield null;
yield String.valueOf(Bukkit.hasWhitelist());
}
default -> null;
};
}
}
@@ -23,12 +23,13 @@
*
*/
package ch.andre601.advancedserverlist.bukkit.objects;
package ch.andre601.advancedserverlist.bukkit.objects.placeholders;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitPlayerImpl;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import ch.andre601.advancedserverlist.core.objects.GenericServerImpl;
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
@@ -36,7 +37,7 @@ import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
import ch.andre601.advancedserverlist.core.profiles.profile.ProfileManager;
import ch.andre601.advancedserverlist.core.profiles.replacer.StringReplacer;
import ch.andre601.advancedserverlist.spigot.SpigotCore;
import ch.andre601.advancedserverlist.spigot.events.ProtocolLibEvents;
import ch.andre601.advancedserverlist.spigot.listeners.ProtocolLibEvents;
import com.comphenix.protocol.ProtocolLibrary;
import com.viaversion.viaversion.api.Via;
import me.clip.placeholderapi.PlaceholderAPI;
@@ -46,17 +47,21 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.net.InetSocketAddress;
import java.util.Locale;
import java.util.*;
public class PAPIPlaceholders extends PlaceholderExpansion{
public class PAPIPlaceholders<F> extends PlaceholderExpansion{
private final PluginCore<?> plugin;
private final BukkitCore<F> plugin;
public PAPIPlaceholders(PluginCore<?> plugin){
private PAPIPlaceholders(BukkitCore<F> plugin){
this.plugin = plugin;
this.register();
}
public static <F> PAPIPlaceholders<F> init(BukkitCore<F> plugin){
return new PAPIPlaceholders<>(plugin);
}
@Override
public @NotNull String getIdentifier(){
return "asl";
@@ -72,6 +77,11 @@ public class PAPIPlaceholders extends PlaceholderExpansion{
return plugin.getCore().getVersion();
}
@Override
public boolean persist(){
return true;
}
@Override
public String onPlaceholderRequest(Player pl, @NotNull String identifier){
InetSocketAddress address = pl.getAddress();
@@ -83,7 +93,7 @@ public class PAPIPlaceholders extends PlaceholderExpansion{
int online = Bukkit.getOnlinePlayers().size();
int max = Bukkit.getMaxPlayers();
GenericServer server = new GenericServerImpl(online, max, host);
GenericPlayer player = new SpigotPlayerImpl(pl, cached, protocol);
GenericPlayer player = new BukkitPlayerImpl(pl, cached, protocol);
ServerListProfile profile = ProfileManager.resolveProfile(plugin.getCore(), player, server);
if(profile == null)
@@ -97,27 +107,26 @@ public class PAPIPlaceholders extends PlaceholderExpansion{
GenericServer finalServer = new GenericServerImpl(online, max, host);
return switch(identifier.toLowerCase(Locale.ROOT)){
case "motd" -> ComponentParser.list(entry.motd())
.modifyText(text -> PlaceholderAPI.setPlaceholders(pl, text))
.modifyText(text -> StringReplacer.replace(text, player, finalServer))
.toString();
case "favicon" -> ComponentParser.text(entry.favicon())
.modifyText(text -> PlaceholderAPI.setPlaceholders(pl, text))
.modifyText(text -> StringReplacer.replace(text, player, finalServer))
.toString();
case "playercount_hover" -> ComponentParser.list(entry.players())
.modifyText(text -> PlaceholderAPI.setPlaceholders(pl, text))
.modifyText(text -> StringReplacer.replace(text, player, finalServer))
.toString();
case "playercount_text" -> ComponentParser.text(entry.playerCountText())
.modifyText(text -> PlaceholderAPI.setPlaceholders(pl, text))
.modifyText(text -> StringReplacer.replace(text, player, finalServer))
.toString();
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);
default -> null;
};
}
private String getOption(String str, Player pl, GenericPlayer player, GenericServer server){
return getOption(Collections.singletonList(str), pl, player, server);
}
private String getOption(List<String> list, Player pl, GenericPlayer player, GenericServer server){
return ComponentParser.list(list)
.modifyText(text -> PlaceholderAPI.setPlaceholders(pl, text))
.modifyText(text -> StringReplacer.replace(text, player, server))
.toString();
}
private int resolveProtocol(Player player){
if(Bukkit.getPluginManager().isPluginEnabled("ViaVersion"))
return Via.getAPI().getPlayerVersion(player.getUniqueId());
@@ -126,7 +135,8 @@ public class PAPIPlaceholders extends PlaceholderExpansion{
if(plugin instanceof SpigotCore)
return ProtocolLibrary.getProtocolManager().getProtocolVersion(player);
// getProtocolVersion is only in Paper, so this is only called when main class isn't SpigotCore
// 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.
return Bukkit.getUnsafe().getProtocolVersion();
}
@@ -25,40 +25,53 @@
package ch.andre601.advancedserverlist.paper;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.commands.CmdAdvancedServerList;
import ch.andre601.advancedserverlist.bukkit.events.JoinEvent;
import ch.andre601.advancedserverlist.bukkit.listeners.JoinEvent;
import ch.andre601.advancedserverlist.bukkit.listeners.LoadEvent;
import ch.andre601.advancedserverlist.bukkit.listeners.WorldEvents;
import ch.andre601.advancedserverlist.bukkit.logging.BukkitLogger;
import ch.andre601.advancedserverlist.bukkit.objects.BukkitPlayerPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.PAPIPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.BukkitPlayerPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.BukkitServerPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.PAPIPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.WorldCache;
import ch.andre601.advancedserverlist.core.AdvancedServerList;
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.core.profiles.favicon.FaviconHandler;
import ch.andre601.advancedserverlist.paper.events.PaperPingEvent;
import ch.andre601.advancedserverlist.paper.listeners.PaperPingEvent;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.CachedServerIcon;
import java.nio.file.Path;
public class PaperCore extends JavaPlugin implements PluginCore<CachedServerIcon>{
public class PaperCore extends BukkitCore<CachedServerIcon>{
private final PluginLogger logger = new BukkitLogger(getLogger());
private AdvancedServerList core;
private FaviconHandler<CachedServerIcon> faviconHandler;
private AdvancedServerList<CachedServerIcon> core;
private FaviconHandler<CachedServerIcon> faviconHandler = null;
private PAPIPlaceholders<CachedServerIcon> papiPlaceholders = null;
private WorldCache worldCache = null;
@Override
public void onEnable(){
this.core = new AdvancedServerList(this, new BukkitPlayerPlaceholders());
this.core = AdvancedServerList.init(this, BukkitPlayerPlaceholders.init(), BukkitServerPlaceholders.init());
if(getServer().getPluginManager().isPluginEnabled("PlaceholderAPI"))
new PAPIPlaceholders(this);
papiPlaceholders = PAPIPlaceholders.init(this);
}
@Override
public void onDisable(){
if(papiPlaceholders != null){
papiPlaceholders.unregister();
papiPlaceholders = null;
}
if(worldCache != null)
worldCache = null;
getCore().disable();
}
@@ -73,8 +86,8 @@ public class PaperCore extends JavaPlugin implements PluginCore<CachedServerIcon
@Override
public void loadEvents(){
new JoinEvent(this);
new PaperPingEvent(this);
LoadEvent.init(this);
PaperPingEvent.init(this);
}
@Override
@@ -93,7 +106,7 @@ public class PaperCore extends JavaPlugin implements PluginCore<CachedServerIcon
}
@Override
public AdvancedServerList getCore(){
public AdvancedServerList<CachedServerIcon> getCore(){
return core;
}
@@ -129,4 +142,12 @@ public class PaperCore extends JavaPlugin implements PluginCore<CachedServerIcon
public String getLoader(){
return "paper";
}
@Override
public WorldCache getWorldCache(){
if(worldCache != null)
return worldCache;
return (worldCache = new WorldCache());
}
}
@@ -23,14 +23,15 @@
*
*/
package ch.andre601.advancedserverlist.paper.events;
package ch.andre601.advancedserverlist.paper.listeners;
import ch.andre601.advancedserverlist.api.events.GenericServerListEvent;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
import ch.andre601.advancedserverlist.bukkit.events.PreServerListSetEventImpl;
import ch.andre601.advancedserverlist.bukkit.objects.SpigotPlayerImpl;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.listeners.PreServerListSetEventImpl;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitServerImpl;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitPlayerImpl;
import ch.andre601.advancedserverlist.core.interfaces.events.GenericEventWrapper;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
@@ -45,11 +46,9 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.util.CachedServerIcon;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.*;
public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon, SpigotPlayerImpl>{
public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon, BukkitPlayerImpl>{
private final PaperCore plugin;
private final PaperServerListPingEvent event;
@@ -89,7 +88,7 @@ public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon,
}
@Override
public void setPlayers(List<String> lines, SpigotPlayerImpl player, GenericServer server){
public void setPlayers(List<String> lines, BukkitPlayerImpl player, GenericServer server){
event.getPlayerSample().clear();
List<PlayerProfile> players = new ArrayList<>(lines.size());
@@ -151,7 +150,7 @@ public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon,
}
@Override
public String parsePAPIPlaceholders(String text, SpigotPlayerImpl player){
public String parsePAPIPlaceholders(String text, BukkitPlayerImpl player){
if(plugin.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI"))
return PlaceholderAPI.setPlaceholders(player.getPlayer(), text);
@@ -164,15 +163,20 @@ public class PaperEventWrapper implements GenericEventWrapper<CachedServerIcon,
}
@Override
public PluginCore<CachedServerIcon> getPlugin(){
public BukkitCore<CachedServerIcon> getPlugin(){
return plugin;
}
@Override
public SpigotPlayerImpl createPlayer(CachedPlayer player, int protocol){
public BukkitPlayerImpl createPlayer(CachedPlayer player, int protocol){
OfflinePlayer pl = Bukkit.getOfflinePlayer(player.getUuid());
return new SpigotPlayerImpl(pl.hasPlayedBefore() ? pl : null, player, protocol);
return new BukkitPlayerImpl(pl.hasPlayedBefore() ? pl : null, player, protocol);
}
@Override
public GenericServer createGenericServer(int playersOnline, int playersMax, String host){
return new BukkitServerImpl(plugin.getWorldCache().worlds(), playersOnline, playersMax, host);
}
@Override
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.paper.events;
package ch.andre601.advancedserverlist.paper.listeners;
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
import ch.andre601.advancedserverlist.paper.PaperCore;
@@ -35,11 +35,15 @@ public class PaperPingEvent implements Listener{
private final PaperCore plugin;
public PaperPingEvent(PaperCore plugin){
private PaperPingEvent(PaperCore plugin){
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public static void init(PaperCore plugin){
new PaperPingEvent(plugin);
}
@EventHandler
public void onPaperServerListPing(PaperServerListPingEvent event){
PingEventHandler.handleEvent(new PaperEventWrapper(plugin, event));
@@ -25,29 +25,33 @@
package ch.andre601.advancedserverlist.spigot;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.commands.CmdAdvancedServerList;
import ch.andre601.advancedserverlist.bukkit.logging.BukkitLogger;
import ch.andre601.advancedserverlist.bukkit.objects.BukkitPlayerPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.BukkitPlayerPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.BukkitServerPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.placeholders.PAPIPlaceholders;
import ch.andre601.advancedserverlist.bukkit.objects.WorldCache;
import ch.andre601.advancedserverlist.core.AdvancedServerList;
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.core.profiles.favicon.FaviconHandler;
import ch.andre601.advancedserverlist.spigot.events.LoadEvent;
import ch.andre601.advancedserverlist.bukkit.listeners.LoadEvent;
import com.comphenix.protocol.wrappers.WrappedServerPing;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
import java.nio.file.Path;
public class SpigotCore extends JavaPlugin implements PluginCore<WrappedServerPing.CompressedImage>{
public class SpigotCore extends BukkitCore<WrappedServerPing.CompressedImage>{
private final PluginLogger logger = new BukkitLogger(getLogger());
private AdvancedServerList core;
FaviconHandler<WrappedServerPing.CompressedImage> faviconHandler = null;
private AdvancedServerList<WrappedServerPing.CompressedImage> core;
private FaviconHandler<WrappedServerPing.CompressedImage> faviconHandler = null;
private PAPIPlaceholders<WrappedServerPing.CompressedImage> papiPlaceholders = null;
private WorldCache worldCache = null;
@Override
public void onEnable(){
@@ -64,11 +68,19 @@ public class SpigotCore extends JavaPlugin implements PluginCore<WrappedServerPi
}catch(ClassNotFoundException ignored){}
}
this.core = new AdvancedServerList(this, new BukkitPlayerPlaceholders());
this.core = AdvancedServerList.init(this, BukkitPlayerPlaceholders.init(), BukkitServerPlaceholders.init());
}
@Override
public void onDisable(){
if(papiPlaceholders != null){
papiPlaceholders.unregister();
papiPlaceholders = null;
}
if(worldCache != null)
worldCache = null;
getCore().disable();
}
@@ -84,7 +96,7 @@ public class SpigotCore extends JavaPlugin implements PluginCore<WrappedServerPi
@Override
public void loadEvents(){
new LoadEvent(this);
LoadEvent.init(this);
}
@Override
@@ -103,7 +115,7 @@ public class SpigotCore extends JavaPlugin implements PluginCore<WrappedServerPi
}
@Override
public AdvancedServerList getCore(){
public AdvancedServerList<WrappedServerPing.CompressedImage> getCore(){
return core;
}
@@ -140,12 +152,24 @@ public class SpigotCore extends JavaPlugin implements PluginCore<WrappedServerPi
return "spigot";
}
@Override
public WorldCache getWorldCache(){
if(worldCache != null)
return worldCache;
return (worldCache = new WorldCache());
}
public void setPapiPlaceholders(PAPIPlaceholders<WrappedServerPing.CompressedImage> papiPlaceholders){
this.papiPlaceholders = papiPlaceholders;
}
private void printPaperInfo(){
getPluginLogger().warn("======================================================================================");
getPluginLogger().warn("You are using the Spigot version of AdvancedServerList on a Paper server.");
getPluginLogger().warn("It is recommended to use the dedicated Paper version, to benefit from the");
getPluginLogger().warn("following improvements:");
getPluginLogger().warn(" - No need to download external libraries already provided by PaperMC.");
getPluginLogger().warn(" - No downloading of external Libraries already provided by Paper (i.e. Adventure).");
getPluginLogger().warn(" - No dependency on ProtocolLib thanks to provided Events.");
getPluginLogger().warn("");
getPluginLogger().warn("AdvancedServerList may work as normal, but consider using the PaperMC version instead!");
@@ -23,34 +23,34 @@
*
*/
package ch.andre601.advancedserverlist.spigot.events;
package ch.andre601.advancedserverlist.spigot.listeners;
import ch.andre601.advancedserverlist.api.events.GenericServerListEvent;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
import ch.andre601.advancedserverlist.bukkit.events.PreServerListSetEventImpl;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.bukkit.BukkitCore;
import ch.andre601.advancedserverlist.bukkit.listeners.PreServerListSetEventImpl;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitServerImpl;
import ch.andre601.advancedserverlist.core.interfaces.events.GenericEventWrapper;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
import ch.andre601.advancedserverlist.core.profiles.replacer.StringReplacer;
import ch.andre601.advancedserverlist.spigot.SpigotCore;
import ch.andre601.advancedserverlist.bukkit.objects.SpigotPlayerImpl;
import ch.andre601.advancedserverlist.bukkit.objects.impl.BukkitPlayerImpl;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.AdventureComponentConverter;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedServerPing;
import me.clip.placeholderapi.PlaceholderAPI;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.*;
public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServerPing.CompressedImage, SpigotPlayerImpl>{
public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServerPing.CompressedImage, BukkitPlayerImpl>{
private final SpigotCore plugin;
private final PacketEvent event;
@@ -77,7 +77,7 @@ public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServe
@Override
public void setMotd(Component component){
ping.setMotD(AdventureComponentConverter.fromComponent(component));
ping.setMotD(WrappedChatComponent.fromJson(GsonComponentSerializer.gson().serialize(component)));
}
@Override
@@ -92,7 +92,7 @@ public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServe
}
@Override
public void setPlayers(List<String> lines, SpigotPlayerImpl player, GenericServer server){
public void setPlayers(List<String> lines, BukkitPlayerImpl player, GenericServer server){
List<WrappedGameProfile> players = new ArrayList<>(lines.size());
for(String line : lines){
@@ -154,7 +154,7 @@ public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServe
}
@Override
public String parsePAPIPlaceholders(String text, SpigotPlayerImpl player){
public String parsePAPIPlaceholders(String text, BukkitPlayerImpl player){
if(plugin.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI"))
return PlaceholderAPI.setPlaceholders(player.getPlayer(), text);
@@ -171,15 +171,20 @@ public class ProtocolLibEventWrapper implements GenericEventWrapper<WrappedServe
}
@Override
public PluginCore<WrappedServerPing.CompressedImage> getPlugin(){
public BukkitCore<WrappedServerPing.CompressedImage> getPlugin(){
return plugin;
}
@Override
public SpigotPlayerImpl createPlayer(CachedPlayer player, int protocol){
public BukkitPlayerImpl createPlayer(CachedPlayer player, int protocol){
OfflinePlayer pl = Bukkit.getOfflinePlayer(player.getUuid());
return new SpigotPlayerImpl(pl.hasPlayedBefore() ? pl : null, player, protocol);
return new BukkitPlayerImpl(pl.hasPlayedBefore() ? pl : null, player, protocol);
}
@Override
public GenericServer createGenericServer(int playersOnline, int playersMax, String host){
return new BukkitServerImpl(plugin.getWorldCache().worlds(), playersOnline, playersMax, host);
}
@Override
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.spigot.events;
package ch.andre601.advancedserverlist.spigot.listeners;
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
import ch.andre601.advancedserverlist.spigot.SpigotCore;
@@ -32,22 +32,28 @@ import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
public class ProtocolLibEvents implements Listener{
private final ProtocolManager protocolManager;
private static final Map<String, String> hostAddresses = new HashMap<>();
private static final Map<String, String> hostAddresses = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
public ProtocolLibEvents(SpigotCore plugin, ProtocolManager protocolManager){
private ProtocolLibEvents(SpigotCore plugin, ProtocolManager protocolManager){
this.protocolManager = protocolManager;
loadPacketListener(plugin);
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public static void init(SpigotCore plugin, ProtocolManager protocolManager){
new ProtocolLibEvents(plugin, protocolManager);
}
public static Map<String, String> getHostAddresses(){
+9 -13
View File
@@ -6,21 +6,16 @@ description: '${plugin.description}'
main: 'ch.andre601.advancedserverlist.paper.PaperCore'
loader: 'ch.andre601.advancedserverlist.paper.ASLLoader'
api-version: 1.19
api-version: '1.19'
dependencies:
- name: PlaceholderAPI
required: false
bootstrap: false
- name: ViaVersion
required: false
bootstrap: false
load-after:
- name: PlaceholderAPI
bootstrap: false
- name: ViaVersion
bootstrap: false
server:
PlaceholderAPI:
load: BEFORE
required: false
ViaVersion:
load: BEFORE
required: false
# The below stuff is NOT used by Paper plugin.
commands:
@@ -31,6 +26,7 @@ commands:
- 'asl'
permission: 'advancedserverlist.admin'
# This is actually supported(?)
permissions:
advancedserverlist.*:
description: 'Grants access to all permissions'
+4 -1
View File
@@ -24,7 +24,7 @@ softdepend:
commands:
advancedserverlist:
description: 'Main command of AdvancedServerList'
usage: '/<command> [help|reload]'
usage: '/<command> [help|reload|clearCache]'
aliases:
- 'asl'
permission: 'advancedserverlist.admin'
@@ -51,4 +51,7 @@ permissions:
default: op
advancedserverlist.command.reload:
description: 'Grants access to /asl reload'
default: op
advancedserverlist.command.clearcache:
description: 'Clears the Player and Favicon cache'
default: op
+2 -2
View File
@@ -117,7 +117,7 @@
</dependencies>
<build>
<finalName>AdvancedServerList-BungeeCord-${plugin.version}</finalName>
<finalName>AdvancedServerList-BungeeCord-${plugin.version}${project.build.commit}</finalName>
<resources>
<resource>
<filtering>true</filtering>
@@ -133,7 +133,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
@@ -26,10 +26,11 @@
package ch.andre601.advancedserverlist.bungeecord;
import ch.andre601.advancedserverlist.bungeecord.commands.CmdAdvancedServerList;
import ch.andre601.advancedserverlist.bungeecord.events.JoinEvent;
import ch.andre601.advancedserverlist.bungeecord.events.PingEvent;
import ch.andre601.advancedserverlist.bungeecord.listeners.JoinEvent;
import ch.andre601.advancedserverlist.bungeecord.listeners.PingEvent;
import ch.andre601.advancedserverlist.bungeecord.logging.BungeeLogger;
import ch.andre601.advancedserverlist.bungeecord.objects.BungeePlayerPlaceholders;
import ch.andre601.advancedserverlist.bungeecord.objects.BungeeServerPlaceholders;
import ch.andre601.advancedserverlist.core.AdvancedServerList;
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
@@ -43,13 +44,13 @@ import java.nio.file.Path;
public class BungeeCordCore extends Plugin implements PluginCore<Favicon>{
private AdvancedServerList core;
private AdvancedServerList<Favicon> core;
private FaviconHandler<Favicon> faviconHandler = null;
private final PluginLogger logger = new BungeeLogger(getLogger());
@Override
public void onEnable(){
this.core = new AdvancedServerList(this, new BungeePlayerPlaceholders());
this.core = AdvancedServerList.init(this, BungeePlayerPlaceholders.init(), BungeeServerPlaceholders.init());
}
@Override
@@ -85,7 +86,7 @@ public class BungeeCordCore extends Plugin implements PluginCore<Favicon>{
}
@Override
public AdvancedServerList getCore(){
public AdvancedServerList<Favicon> getCore(){
return core;
}
@@ -23,13 +23,14 @@
*
*/
package ch.andre601.advancedserverlist.bungeecord.events;
package ch.andre601.advancedserverlist.bungeecord.listeners;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
import ch.andre601.advancedserverlist.bungeecord.BungeeCordCore;
import ch.andre601.advancedserverlist.bungeecord.objects.BungeePlayerImpl;
import ch.andre601.advancedserverlist.api.events.GenericServerListEvent;
import ch.andre601.advancedserverlist.bungeecord.objects.BungeeProxyImpl;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.core.interfaces.events.GenericEventWrapper;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
@@ -40,11 +41,13 @@ import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
import net.md_5.bungee.api.Favicon;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.ProxyPingEvent;
import java.awt.image.BufferedImage;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class BungeeEventWrapper implements GenericEventWrapper<Favicon, BungeePlayerImpl>{
@@ -168,6 +171,13 @@ public class BungeeEventWrapper implements GenericEventWrapper<Favicon, BungeePl
return new BungeePlayerImpl(player, protocol);
}
@Override
public GenericServer createGenericServer(int playersOnline, int playersMax, String host){
Map<String, ServerInfo> servers = plugin.getProxy().getServers();
return new BungeeProxyImpl(servers, playersOnline, playersMax, host);
}
@Override
public Favicon createFavicon(BufferedImage image) throws IllegalArgumentException{
return Favicon.create(image);
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.bungeecord.events;
package ch.andre601.advancedserverlist.bungeecord.listeners;
import ch.andre601.advancedserverlist.bungeecord.BungeeCordCore;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.bungeecord.events;
package ch.andre601.advancedserverlist.bungeecord.listeners;
import ch.andre601.advancedserverlist.bungeecord.BungeeCordCore;
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
@@ -23,11 +23,13 @@
*
*/
package ch.andre601.advancedserverlist.velocity.events;
package ch.andre601.advancedserverlist.bungeecord.listeners;
import ch.andre601.advancedserverlist.api.bungeecord.events.PreServerListSetEvent;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
public class PreServerListSetEventImpl extends PreServerListSetEvent{
public PreServerListSetEventImpl(ProfileEntry entry){
super(entry);
}
@@ -33,10 +33,14 @@ import java.util.Locale;
public class BungeePlayerPlaceholders extends PlaceholderProvider{
public BungeePlayerPlaceholders(){
private BungeePlayerPlaceholders(){
super("player");
}
public static BungeePlayerPlaceholders init(){
return new BungeePlayerPlaceholders();
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
return switch(placeholder.toLowerCase(Locale.ROOT)){
@@ -0,0 +1,53 @@
/*
* 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.bungeecord.objects;
import ch.andre601.advancedserverlist.api.bungeecord.objects.BungeeProxy;
import net.md_5.bungee.api.config.ServerInfo;
import java.util.Map;
public record BungeeProxyImpl(Map<String, ServerInfo> servers, int playersOnline, int playersMax, String host) implements BungeeProxy{
@Override
public Map<String, ServerInfo> getServers(){
return servers;
}
@Override
public int getPlayersOnline(){
return playersOnline;
}
@Override
public int getPlayersMax(){
return playersMax;
}
@Override
public String getHost(){
return host;
}
}
@@ -0,0 +1,93 @@
/*
* 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.bungeecord.objects;
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
import ch.andre601.advancedserverlist.api.bungeecord.objects.BungeeProxy;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import net.md_5.bungee.api.config.ServerInfo;
import java.net.InetSocketAddress;
public class BungeeServerPlaceholders extends PlaceholderProvider{
private BungeeServerPlaceholders(){
super("server");
}
public static BungeeServerPlaceholders init(){
return new BungeeServerPlaceholders();
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
if(!(server instanceof BungeeProxy proxy))
return null;
String[] args = placeholder.split("\\s", 2);
return switch(args[0]){
case "playersOnline" -> {
if(args.length >= 2){
int players = 0;
for(int i = 1; i < args.length; i++){
ServerInfo info = proxy.getServers().get(args[i]);
if(info == null)
continue;
players += info.getPlayers().size();
}
yield String.valueOf(players);
}
yield String.valueOf(proxy.getPlayersOnline());
}
case "playersMax" -> {
// ServerInfo doesn't provide the max players that could join, so we won't allow an extra argument
if(args.length >= 2)
yield null;
yield String.valueOf(proxy.getPlayersMax());
}
case "host" -> {
if(args.length > 2)
yield null;
if(args.length == 2){
ServerInfo info = proxy.getServers().get(args[1]);
yield String.valueOf(((InetSocketAddress)info.getSocketAddress()).getHostString());
}
yield proxy.getHost();
}
default -> null;
};
}
}
+7 -7
View File
@@ -66,19 +66,19 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.13.0</version>
<version>4.14.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.13.0</version>
<version>4.14.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId>
<version>4.13.0</version>
<version>4.14.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -90,7 +90,7 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -102,7 +102,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>32.1.1-jre</version>
<scope>provided</scope>
</dependency>
@@ -116,7 +116,7 @@
</dependencies>
<build>
<finalName>AdvancedServerList-Core-${plugin.version}</finalName>
<finalName>AdvancedServerList-Core-${plugin.version}${project.build.commit}</finalName>
<resources>
<resource>
<filtering>true</filtering>
@@ -132,7 +132,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
@@ -37,11 +37,13 @@ import ch.andre601.advancedserverlist.core.profiles.players.PlayerHandler;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
public class AdvancedServerList{
public class AdvancedServerList<F>{
private final PluginCore<?> plugin;
private final PluginCore<F> plugin;
private final FileHandler fileHandler;
private final CommandHandler commandHandler;
private final PlayerHandler playerHandler;
@@ -51,19 +53,22 @@ public class AdvancedServerList{
private String version;
public AdvancedServerList(PluginCore<?> plugin, PlaceholderProvider player){
private AdvancedServerList(PluginCore<F> plugin, List<PlaceholderProvider> placeholders){
this.plugin = plugin;
this.fileHandler = new FileHandler(this);
this.commandHandler = new CommandHandler(this);
this.playerHandler = new PlayerHandler(this);
this.api.addPlaceholderProvider(player);
this.api.addPlaceholderProvider(new ServerPlaceholders());
placeholders.forEach(this.api::addPlaceholderProvider);
load();
}
public PluginCore<?> getPlugin(){
public static <F> AdvancedServerList<F> init(PluginCore<F> plugin, PlaceholderProvider... placeholders){
return new AdvancedServerList<>(plugin, Arrays.asList(placeholders));
}
public PluginCore<F> getPlugin(){
return plugin;
}
@@ -121,6 +126,16 @@ public class AdvancedServerList{
return;
}
if(getFileHandler().isOldConfig()){
getPlugin().getPluginLogger().info("Detected old config.yml. Attempting to migrate...");
if(getFileHandler().migrateConfig()){
getPlugin().getPluginLogger().info("Migration completed successfully!");
}else{
getPlugin().getPluginLogger().warn("Couldn't migrate config.yml! Check previous lines for errors.");
return;
}
}
if(getFileHandler().loadProfiles()){
getPlugin().getPluginLogger().info("Successfully loaded " + getFileHandler().getProfiles().size() + " profiles!");
}else{
@@ -149,7 +164,7 @@ public class AdvancedServerList{
getPlugin().getPluginLogger().info("AdvancedServerList is ready!");
if(getFileHandler().getBoolean("check_updates"))
if(getFileHandler().getBoolean("checkUpdates"))
this.updateChecker = new UpdateChecker(this);
}
@@ -53,7 +53,7 @@ public class PingEventHandler{
plugin.getCore().getPlayerHandler().getCachedPlayer(event.getPlayerIP()),
event.getProtocolVersion()
);
GenericServer server = new GenericServerImpl(online, max, host);
GenericServer server = event.createGenericServer(online, max, host);
ServerListProfile profile = ProfileManager.resolveProfile(plugin.getCore(), player, server);
@@ -73,7 +73,7 @@ public class PingEventHandler{
event.setMaxPlayers(max);
}
GenericServer finalServer = new GenericServerImpl(online, max, host);
GenericServer finalServer = event.createGenericServer(online, max, host);
if(ProfileManager.checkOption(entry.motd())){
event.setMotd(
@@ -0,0 +1,75 @@
/*
* 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.file;
import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import org.spongepowered.configurate.ConfigurateException;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.NodePath;
import org.spongepowered.configurate.transformation.ConfigurationTransformation;
import org.spongepowered.configurate.transformation.TransformAction;
public class ConfigMigrator{
public static final int LATEST = 1;
private ConfigMigrator(){}
public static ConfigurationTransformation.Versioned create(){
return ConfigurationTransformation.versionedBuilder()
.versionKey("configVersion")
.addVersion(LATEST, oneToTwo())
.build();
}
public static ConfigurationTransformation oneToTwo(){
return ConfigurationTransformation.builder()
.addAction(NodePath.path("unknown_player"), (path, value) -> new Object[]{"unknownPlayer", "name"})
.addAction(NodePath.path("unknown_player_uuid"), (path, value) -> new Object[]{"unknownPlayer", "uuid"})
.addAction(NodePath.path("disable_cache"), TransformAction.rename("disableCache"))
.addAction(NodePath.path("check_updates"), TransformAction.rename("checkUpdates"))
.addAction(NodePath.path("send_statistics"), TransformAction.rename("sendStatistics"))
.addAction(NodePath.path(), (path, value) -> {
value.node("configVersion").set(LATEST);
return null;
})
.build();
}
public static <N extends ConfigurationNode> N updateNode(final N node, PluginLogger logger) throws ConfigurateException{
if(!node.virtual()){
final ConfigurationTransformation.Versioned versioned = create();
final int startVersion = versioned.version(node);
versioned.apply(node);
final int endVersion = versioned.version(node);
if(startVersion < endVersion)
logger.info("Migrated config.yml from " + startVersion + " to " + endVersion);
}
return node;
}
}
@@ -30,7 +30,9 @@ import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import ch.andre601.advancedserverlist.core.profiles.ServerListProfile;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
import ch.andre601.advancedserverlist.core.profiles.profile.ProfileSerializer;
import org.spongepowered.configurate.ConfigurateException;
import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.yaml.NodeStyle;
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
import java.io.File;
@@ -38,13 +40,16 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class FileHandler{
private final AdvancedServerList plugin;
private final AdvancedServerList<?> plugin;
private final PluginLogger logger;
private final Path config;
@@ -54,7 +59,7 @@ public class FileHandler{
private ConfigurationNode node = null;
public FileHandler(AdvancedServerList core){
public FileHandler(AdvancedServerList<?> core){
this.plugin = core;
this.logger = core.getPlugin().getPluginLogger();
@@ -68,7 +73,7 @@ public class FileHandler{
public boolean loadConfig(){
logger.info("Loading config.yml...");
File folder = config.toFile().getParentFile();
File folder = plugin.getPlugin().getFolderPath().toFile();
if(!folder.exists() && !folder.mkdirs()){
logger.warn("Couldn't create folder for plugin. Is it missing Write permissions?");
return false;
@@ -82,6 +87,7 @@ public class FileHandler{
}
Files.copy(stream, config);
logger.info("Created new config.yml!");
}catch(IOException ex){
logger.warn("Cannot create config.yml for plugin.", ex);
return false;
@@ -112,6 +118,26 @@ public class FileHandler{
return reloadProfiles();
}
public boolean migrateConfig(){
YamlConfigurationLoader loader = YamlConfigurationLoader.builder()
.path(config)
.nodeStyle(NodeStyle.BLOCK)
.build();
if(!makeBackup())
return false;
try{
node = ConfigMigrator.updateNode(loader.load(), logger);
loader.save(node);
return true;
}catch(ConfigurateException ex){
logger.warn("Error while trying to migrate config.yml.", ex);
return false;
}
}
public boolean reloadConfig(){
return (node = getConfigurationNode(config)) != null;
}
@@ -164,4 +190,36 @@ public class FileHandler{
public boolean getBoolean(Object... path){
return node.node(path).getBoolean();
}
public boolean isOldConfig(){
return node.node("configVersion").virtual() || node.node("configVersion").getInt(0) < ConfigMigrator.LATEST;
}
private boolean makeBackup(){
logger.info("Making backup of old config.yml...");
File backups = plugin.getPlugin().getFolderPath().resolve("backups").toFile();
if(!backups.exists() && !backups.mkdirs()){
logger.warn("Cannot create backups folder for migration!");
return false;
}
String date = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(LocalDateTime.now());
File configBackup = new File(backups, "config_" + date.replace(":", "_") + ".yml");
try{
if(!configBackup.exists() && !configBackup.createNewFile()){
logger.warn("Cannot create backup file for config.yml!");
return false;
}
Files.copy(config, configBackup.toPath(), StandardCopyOption.REPLACE_EXISTING);
logger.info("Saved backup as '" + configBackup.getName() + "'!");
return true;
}catch(IOException ex){
logger.warn("Encountered IOException while trying to create a backup.", ex);
return false;
}
}
}
@@ -25,6 +25,8 @@
package ch.andre601.advancedserverlist.core.interfaces.commands;
import java.util.Locale;
public abstract class PluginCommand{
private final String argument;
@@ -38,7 +40,7 @@ public abstract class PluginCommand{
}
public String getPermission(){
return "advancedserverlist.command." + getArgument();
return "advancedserverlist.command." + getArgument().toLowerCase(Locale.ROOT);
}
public abstract void handle(CmdSender sender);
@@ -41,7 +41,7 @@ public interface PluginCore<F>{
void clearFaviconCache();
AdvancedServerList getCore();
AdvancedServerList<F> getCore();
Path getFolderPath();
@@ -75,6 +75,8 @@ public interface GenericEventWrapper<F, P extends GenericPlayer>{
P createPlayer(CachedPlayer player, int protocol);
GenericServer createGenericServer(int playersOnline, int playersMax, String host);
F createFavicon(BufferedImage image) throws Exception;
default String resolveHost(InetSocketAddress address){
@@ -127,12 +127,24 @@ public class Expression{
return left.equals(right);
}
},
EQUALS_IGNORE_CASE('~', '='){
@Override
public boolean evaluate(String left, String right){
return left.equalsIgnoreCase(right);
}
},
NOT_EQUAL('!', '='){
@Override
public boolean evaluate(String left, String right){
return !left.equals(right);
}
},
NOT_EQUAL_IGNORE_CASE('!', '~'){
@Override
public boolean evaluate(String left, String right){
return !left.equalsIgnoreCase(right);
}
},
GREATER('>', '\0'){
@Override
public boolean evaluate(String left, String right){
@@ -172,7 +184,7 @@ public class Expression{
public static Operator getOperand(char first, char second){
for(Operator operator : VALUES){
if(operator.first == first){
if((!operator.hasSecond() && second != '=') || operator.second == second)
if((!operator.hasSecond() && second != '=' && second != '~') || operator.second == second)
return operator;
}
}
@@ -31,33 +31,31 @@ import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import com.google.gson.Gson;
import io.leangen.geantyref.TypeToken;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.*;
public class PlayerHandler{
private final AdvancedServerList core;
private final AdvancedServerList<?> core;
private final PluginLogger logger;
private final Path cache;
private List<CachedPlayer> cachedPlayers = new ArrayList<>();
private final Type listType = new TypeToken<ArrayList<CachedPlayer>>(){}.getType();
private final Gson gson = new Gson();
// UUID of MHF_Question
private final String defaultUUID = "606e2ff0-ed77-4842-9d6c-e1d3321c7838";
private final UUID defaultUUID = UUID.fromString("606e2ff0-ed77-4842-9d6c-e1d3321c7838");
private List<CachedPlayer> cachedPlayers = new ArrayList<>();
private CachedPlayer defaultPlayer = null;
public PlayerHandler(AdvancedServerList core){
public PlayerHandler(AdvancedServerList<?> core){
this.core = core;
this.logger = core.getPlugin().getPluginLogger();
this.cache = core.getPlugin().getFolderPath().resolve("playercache.json");
@@ -69,13 +67,13 @@ public class PlayerHandler{
return;
}
if(core.getFileHandler().getBoolean("disable_cache")){
if(core.getFileHandler().getBoolean("disableCache")){
logger.info("'disable_cache' is set to true. Skipping playercache.json loading...");
return;
}
try{
Reader reader = Files.newBufferedReader(cache);
BufferedReader reader = Files.newBufferedReader(cache);
cachedPlayers = gson.fromJson(reader, listType);
@@ -85,6 +83,14 @@ public class PlayerHandler{
return;
}
// In case Gson messes up... I guess.
if(cachedPlayers == null){
logger.warn("Couldn't load players from playercache.json file. Is the JSON valid?");
// Create new ArrayList instance to avoid further issues.
cachedPlayers = new ArrayList<>();
return;
}
logger.info("Loaded %d players into cache!", cachedPlayers.size());
}
@@ -94,7 +100,7 @@ public class PlayerHandler{
return;
}
if(core.getFileHandler().getBoolean("disable_cache")){
if(core.getFileHandler().getBoolean("disableCache")){
logger.info("'disable_cache' is set to true. Skipping saving of cached players...");
return;
}
@@ -110,14 +116,14 @@ public class PlayerHandler{
}
public void addPlayer(String ip, String name, UUID uuid){
if(contains(ip) || core.getFileHandler().getBoolean("disable_cache"))
if(contains(ip) || core.getFileHandler().getBoolean("disableCache"))
return;
cachedPlayers.add(new CachedPlayer(ip, name, uuid));
}
public CachedPlayer getCachedPlayer(String key){
if(!contains(key) || core.getFileHandler().getBoolean("disable_cache"))
if(!contains(key) || core.getFileHandler().getBoolean("disableCache"))
return getDefaultPlayer();
for(CachedPlayer player : cachedPlayers){
@@ -157,8 +163,8 @@ public class PlayerHandler{
return (defaultPlayer = new CachedPlayer(
"0.0.0.0",
core.getFileHandler().getString("Anonymous", "unknown_player"),
convertToUUID(core.getFileHandler().getString(defaultUUID, "unknown_player_uuid"))
core.getFileHandler().getString("Anonymous", "unknownPlayer", "name"),
convertToUUID(core.getFileHandler().getString(defaultUUID.toString(), "unknownPlayer", "uuid"))
));
}
@@ -167,7 +173,7 @@ public class PlayerHandler{
return UUID.fromString(uuid);
}catch(IllegalArgumentException ex){
// This is always a valid UUID.
return UUID.fromString(defaultUUID);
return defaultUUID;
}
}
+21 -15
View File
@@ -1,27 +1,25 @@
#
# Used for when AdvancedServerList doesn't have a cached player to use for ${player name}
# Used for when AdvancedServerList doesn't have a cached player to use for player placeholders.
#
# Defaults to 'Anonymous' when not present.
#
unknown_player: "Anonymous"
#
# UUID used for when AdvancedServerList doesn't have a cached player to use for the ${player uuid}
# placeholder.
#
# Defaults to the UUID of MHF_Question (606e2ff0-ed77-4842-9d6c-e1d3321c7838) when not present.
#
unknown_player_uuid: "606e2ff0-ed77-4842-9d6c-e1d3321c7838"
unknownPlayer:
#
# The name to use. Defaults to Anonymous.
#
name: "Anonymous"
#
# The UUID to use. Defaults to 606e2ff0-ed77-4842-9d6c-e1d3321c7838 (UUID of MHF_Question).
#
uuid: "606e2ff0-ed77-4842-9d6c-e1d3321c7838"
#
# Should the Caching of players be disabled?
#
# When set to true will AdvancedServerList not load any players from the cache.data file (if present) nor save any to it.
# Placeholders that rely on the player being cached (such as ${player isWhitelisted}) will not work while this option is enabled.
# Placeholders that rely on the player being cached (such as ${player name}) will not work while this option is enabled.
#
# Defaults to false when not present.
#
disable_cache: false
disableCache: false
#
# Should AdvancedServerList check for new versions?
@@ -31,4 +29,12 @@ disable_cache: false
#
# Defaults to false when not present.
#
check_updates: true
checkUpdates: true
#
# DO NOT EDIT!
#
# This is used internally to determine if the config needs to be migrated.
# Changing or even removing this option could result in your config being broken.
#
config-version: 2
+20 -2
View File
@@ -3,12 +3,30 @@
This page lists the recent changes made towards the AdvancedServerListAPI.
They are ordered newest to oldest.
## v3.0.0
### :octicons-alert-24:{ .changelog-breaking title="Breaking Changes" } Breaking Changes { #v3-breaking }
- Removed `platform-spigot` API in favour of a more generic sounding `platform-bukkit`
- Renamed all platform-specific packages from `ch.andre601.advancedserverlist.<platform>` to `ch.andre601.advancedserverlist.api.<platform>`
### :octicons-plus-circle-24:{ .changelog-added title="Added" } Added { #v3-added }
- New platform-specific `GenericServer` instances with their own methods to use.
- `BukkitServer` - Contains a `getWorlds()` method that returns a `Map<String, World>` of all loaded worlds in the server.
- `BungeeProxy` - Contains a `getServers()` method that returns a `Map<String, ServerInfo>` of all known Servers for BungeeCord.
- `VelocityProxy` - Contains a `getServers()` method that returns a `Map<String, RegisteredServer>` of all known Servers for Velocity.
### :octicons-trash-24:{ .changelog-removed title="Removed" } Removed { #v-removed }
- All previously deprecated `getX()` methods from the `ProfileEntry` record
## v2.1.0
### :octicons-pencil-24:{ .changelog-changed title="Changed" } Changed { #v-changed }
### :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 recor's own `x()` methods (i.e. `getMotd()` -> `motd()`)
- Former `getX()` methods are now deprecated in favour of the record's own `x()` methods (i.e. `getMotd()` -> `motd()`)
## v2.0.0
+11 -9
View File
@@ -11,7 +11,7 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
Make sure to replace `{version}` with the latest version available in the [GitHub Repository][api-repo].
```groovy
```groovy title="build.gradle"
repositorories {
maven { url = 'https://jitpack.io/' }
}
@@ -30,7 +30,7 @@ Add the following to your `build.gradle` or `pom.xml` file to use the API:
Make sure to replace `{version}` with the latest version available in the [GitHub Repository][api-repo].
```xml
```xml title="pom.xml"
<repositories>
<repository>
<id>jitpack</id>
@@ -78,8 +78,9 @@ It will be needed at a later point.
### 2) Create a Placeholder class
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
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"
public class MyPlaceholders extends PlaceholderProvider {
public MyPlaceholders(String identifier) {
@@ -94,7 +95,8 @@ 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:
For example:
```java
public MyPlaceholders() {
super("myplaceholders");
@@ -106,8 +108,9 @@ The `placeholder` String is whatever value was provided after the identifier in
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
Here is a small example of the final class:
```java title="PlaceholderProvider example"
public class MyPlaceholders extends PlaceholderProvider {
public MyPlaceholders() {
@@ -128,8 +131,7 @@ public class MyPlaceholders extends 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.
Example:
```java
```java title="Registering PlaceholderProvider class"
AdvancedServerListAPI api = AdvancedServerListAPI.get();
api.addPlaceholderProvider(new MyPlaceholders());
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

+10
View File
@@ -27,6 +27,16 @@
color: #d29922;
}
.result {
border: .05rem solid var(--md-code-bg-color);
border-bottom-left-radius: .1rem;
border-bottom-right-radius: .1rem;
border-top-width: .1rem;
margin-top: -1.125em;
overflow: visible;
padding: 0 1em;
}
/* Override mkdocs-material styling */
.md-banner--warning {
background: rgba(187,128,9,0.15);
+7 -6
View File
@@ -28,7 +28,7 @@ Some examples about version-related things.
You may want to display a separate MOTD or text for incompatible client versions.
This example here shows a separate MOTD and player count message for when the player's client version is older than what the server supports.
```yaml
```yaml title="outdated-client.yml"
priority: 1
# Display this profile, if the version of the player is below 760 (1.19.1)
@@ -47,7 +47,7 @@ playerCount:
This profile would display a MOTD without HEX colours if the player's version is below 735 (1.16).
```yaml
```yaml title="pre-1_16.yml"
priority: 1
# Display this profile, if the version of the player is below 735 (1.16)
@@ -70,7 +70,7 @@ Examples that can be used with the Spigot or PaperMC version.
Displays a separate profile for when the player has been banned from the server.
```yaml
```yaml title="banned.yml"
priority: 1
conditions:
@@ -94,7 +94,7 @@ Some misc examples.
Display a different profile when the playing pings a specific domain/IP.
```yaml
```yaml title="specific-host.yml"
priority: 1
conditions:
@@ -109,7 +109,7 @@ motd:
Display a different profile, if the player pinging the server is "known" by AdvancedServerList (Has joined before with the same IP).
```yaml
```yaml title="personalized.yml"
priority: 1
conditions:
@@ -132,7 +132,8 @@ playerCount:
v1.10.0 of AdvancedServerList introduced an option called `profiles`. It allows you to create multiple variants of an MOTD, playercount, etc. while also supporting the normal (global) options as a fallback.
The following example will create a profile that has a randomized MOTD, but the same hover for both:
```yaml
```yaml title="random-motd.yml"
priority: 1
profiles:
+21 -1
View File
@@ -2,6 +2,26 @@
All text options with exception of [`Conditions`](../#conditions) allow the usage of formatting options using [MiniMessage].
!!! warning "IMPORTANT"
Whenever your text starts with a colour or formatting code (`<aqua>`, `<blue>`, `<bold>`, `<italic>`, etc.) should it be surrounded with single or double quotes.
Not doing so will cause the YAML parses used - Configurate - to not see the value as a String, but something else, causing exceptions to appear.
```yaml title="Wrong formatting"
motd:
- <red>This will cause
- <red>Errors
```
```yaml title="Right formatting"
motd:
- '<green>This will be formatted'
- '<green>properly.'
```
!!! info "Online Tool"
The devs of the Adventure library provide a handy online tool to create the right formatting codes to display the text properly.
You can find the tool at https://webui.advntr.dev/
## Unsupported options
The following options are **not** supported, no matter what option they are used in:
@@ -18,4 +38,4 @@ Normal text colours such as `<aqua>` or `<red>` can be used in all text options.
24-Bit HEX colours such as `<#ffffff>` can be used in the [`Motd`](../#motd) option on 1.16+ servers/proxies.
[MiniMessage]: https://docs.adventure.kyori.net/minimessage/index.html
[MiniMessage]: https://docs.adventure.kyori.net/minimessage/index.html
+148 -33
View File
@@ -31,50 +31,55 @@ Only when **all** conditions defined return true will the profile be displayed.
You can remove this option, or set it to an empty list (`conditions: []`) to always return true.
### Operants
### Operands
The following operants are available and can be used in the conditions.
!!! warning "Only one operant can be used per condition!"
| Operant | Description |
| ------- | ------------------------------------------------------------------ |
| `<` | Checks if the left value is less than the right one.\* |
| `<=` | Checks if the left value is less than or equal to the right one.\* |
| `>` | Checks if the left value is more than the right one.\* |
| `>=` | Checks if the left value is more than or equal to the right one.\* |
| `=` | Checks if the left value is equal to the right one. |
| `!=` | Checks if the left value is not equal to the right one. |
| Operand | Description |
|---------|------------------------------------------------------------------------|
| `<` | Checks if the left value is less than the right one.[^1] |
| `<=` | Checks if the left value is less than or equal to the right one.[^1] |
| `>` | Checks if the left value is more than the right one.[^1] |
| `>=` | Checks if the left value is more than or equal to the right one.[^1] |
| `=` | Checks if the left value is equal to the right one. |
| `!=` | Checks if the left value is not equal to the right one. |
| `~=` | Checks if the left value is equal to the right one, ignoring case. |
| `!~` | Checks if the left value is not equal to the right one, ignoring case. |
\* In the case of the provided value not being a number will the plugin instead use the text length to compare with.
[^1]: In the case of the provided value not being a number will the plugin instead use the text length to compare with.
## Profiles
The profiles option allows you to add multiple combinations of all the other options (With the exception of [`Priority`](#priority) and [`Conditions`](#conditions)) to have randomized MOTDs, player counts, etc.
!!! warning "Priority and Conditions are NOT supported!"
If an option is not present in an entry will AdvancedServerList try to use one defined in the file or use whatever default value would be for that option.
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.
As an example:
```yaml
priority: 0
??? example "Example"
```yaml title="YAML file"
priority: 0
profiles:
- motd:
- '<rainbow>Line 1</rainbow>'
- '<rainbow:!>Line 2</rainbow>'
playerCount:
text: '<green><bold>Awesome!'
- playerCount:
text: '<yellow><bold>Also Awesome!'
motd:
- '<rainbow:2>Line A</rainbow>'
- '<rainbow:!2>Line B</rainbow>'
```
<div class="result">
![profiles-example-1](../assets/images/examples/profiles-example-1.jpg)
![profiles-example-2](../assets/images/examples/profiles-example-2.jpg)
profiles:
- motd:
- '<rainbow>Line 1</rainbow>'
- '<rainbow:!>Line 2</rainbow>'
playerCount:
text: '<green><bold>Awesome!'
- playerCount:
text: '<yellow><bold>Also Awesome!'
motd:
- '<rainbow:2>Line A</rainbow>'
- '<rainbow:!2>Line B</rainbow>'
```
...the above example would randomly select between the following combinations of MOTD and Player count text:
![motd-example-1](../assets/images/examples/motd-example-1.jpg)
![motd-example-2](../assets/images/examples/motd-example-2.jpg)
</div>
## Motd
@@ -83,6 +88,21 @@ Normal colour and formatting codes such as `<aqua>` or `<bold>` are supported. O
If you want to display multiple MOTDs will you need to use the [`Profiles` option](#profiles)
??? example "Example"
```yaml title="YAML file"
priority: 0
motd:
- '<rainbow:2>Rainbow Gradients</rainbow>'
- '<rainbow:!2>|||||||||||||||||||||||||||||||||||||</rainbow>'
```
<div class="result">
![motd-example](../assets/images/examples/motd-example.jpg)
</div>
## Favicon
The favicon option allows you to customize the favicon and display one or multiple different images.
@@ -95,6 +115,24 @@ This option currently supports the following values:
Please note that AdvancedServerList will rescale the image to be 64x64 pixels, so be sure to provide images at that particular scale.
??? example "Example"
```yaml title="YAML file"
priority: 0
# We use just colour to hide the MOTD
motd:
- '<grey>'
- '<grey>'
# Player is Andre_601
favicon: ${player uuid}
```
<div class="result">
![hideplayers-example](../assets/images/examples/favicon-example.jpg)
</div>
## PlayerCount
The `playerCount` option contains multiple different options all about the Player count itself.
@@ -104,12 +142,51 @@ The `playerCount` option contains multiple different options all about the Playe
Boolean option to set whether AdvancedServerList should hide the player count or not. When set to `true` will the player count be replaced with `???`.
Additionally will the [`Text`](#text) and [`Hover`](#hover) option be ignored.
??? example "Example"
```yaml title="YAML file"
priority: 0
# We use just colour to hide the MOTD
motd:
- '<grey>'
- '<grey>'
playerCount:
hidePlayers: true
```
<div class="result">
![hideplayers-example](../assets/images/examples/hideplayers-example.jpg)
</div>
### Hover
This option allows to override the hover text usually displaying the players on the server when hovering over the player count.
You can either remove this option or set to an empty list (`hover: []`) to not override the hover.
??? example "Example"
```yaml title="YAML file"
priority: 0
# We use just colour to hide the MOTD
motd:
- '<grey>'
- '<grey>'
playerCount:
hover:
- '<grey>Line 1'
- '<aqua>Line 2'
- '<gold>Line 3'
```
<div class="result">
![hover-example](../assets/images/examples/hover-example.jpg)
</div>
### Text
This option allows to override the text usually displaying the online players and total players that can join.
@@ -121,6 +198,24 @@ Note that AdvancedServerList will not add the `<online>/<max>` text to the playe
To not override the player count, remove this option or set it to an empty String (`text: ''`).
??? example "Example"
```yaml title="YAML file"
priority: 0
# We use just colour to hide the MOTD
motd:
- '<grey>'
- '<grey>'
playerCount:
text: '<yellow><bold>Cool text!'
```
<div class="result">
![hover-example](../assets/images/examples/text-example.jpg)
</div>
### ExtraPlayers
Contains options to modify how the `<max>` number in the player count should look like.
@@ -136,4 +231,24 @@ When set to `true` will the max amount of players be modified by taking the curr
Sets the number to add to the current online players to then use as the new max players count.
As an example, setting this to `1` while `10` players are online will display `11`, while `-1` would display `9`.
As an example, setting this to `1` while `10` players are online will display `11`, while `-1` would display `9`.
??? example "Example"
```yaml title="YAML file"
priority: 0
# We use just colour to hide the MOTD
motd:
- '<grey>'
- '<grey>'
playerCount:
extraPlayers:
enabled: true
amount: 1
```
<div class="result">
![hover-example](../assets/images/examples/extraplayers-example.jpg)
</div>
+30 -19
View File
@@ -11,31 +11,42 @@ The following placeholders are available in AdvancedServerList itself. Please no
These placeholders use the player who pinged the server, to return values. They may require the player to be cached in order to work.
| Placeholder | Description | Platforms | Cached Player required?\* |
|-----------------------------|-----------------------------------------------------------------|--------------|---------------------------|
| `${player name}` | The name of the player. | All | Yes\*\* |
| `${player protocol}` | The protocol version of the player. | All | No |
| `${player uuid}` | The UUID of the player. | All | Yes\*\*\* |
| `${player version}` | The protocol version of the player as readable MC version. | Velocity | No |
| `${player hasPlayedBefore}` | Boolean for whether the player has played on the server before. | Spigot/Paper | Yes |
| `${player isBanned}` | Boolean for whether the player has been banned from the server. | Spigot/Paper | Yes |
| `${player isWhitelisted}` | Boolean for whether the player is whitelisted on the server. | Spigot/Paper | Yes |
| Placeholder | Description | Platforms | Cached Player required?[^1] |
|-----------------------------|-----------------------------------------------------------------|--------------|-----------------------------|
| `${player name}` | The name of the player. | All | Yes[^2] |
| `${player protocol}` | The protocol version of the player. | All | No |
| `${player uuid}` | The UUID of the player. | All | Yes[^3] |
| `${player version}` | The protocol version of the player as readable MC version. | Velocity | No |
| `${player hasPlayedBefore}` | Boolean for whether the player has played on the server before. | Spigot/Paper | Yes |
| `${player isBanned}` | Boolean for whether the player has been banned from the server. | Spigot/Paper | Yes |
| `${player isWhitelisted}` | Boolean for whether the player is whitelisted on the server. | Spigot/Paper | Yes |
\*Whether this placeholder requires the player to have joined before while AdvancedServerList was running. When `disable_cache` is enabled will these placeholders not work.
\*\*Will default to whatever name has been provided in the config.yml's `unknown_player` option, when the player isn't cached yet.
\*\*\*Will default to whatever name has been provided in the config.yml's `unknown_player_uuid` option, when the player isn't cached yet.
[^1]:
Whether this placeholder requires the player to have joined before while AdvancedServerList was running.
When `disableCache` is enabled will these placeholders not work.
[^2]: Will default to whatever name has been provided in the `unknownPlayer -> name` option of the config.yml, when the player isn't cached yet.
[^3]: Will default to whatever name has been provided in the `unknownPlayer -> uuid` option of the config.yml, when the player isn't cached yet.
### Server
These placeholders use values given by the server/proxy AdvancedServerList runs on.
| Placeholder | Description |
|---------------------------|----------------------------------------------------------|
| `${server playersOnline}` | The number of players online on this server. |
| `${server playersMax}` | The total number of players that can join this server.\* |
| `${server host}` | The domain/IP the player pinged. |
| Placeholder | Description |
|------------------------------|-------------------------------------------------------------------------|
| `${server playersOnline}` | The number of players online on this proxy/server.[^4] |
| `${server playersMax}` | The total number of players that can join this server.[^5] |
| `${server host}` | The domain/IP the player pinged.[^6] |
| `${server whitelistEnabled}` | Whether the whitelist is enabled or not. Only available on Spigot/Paper |
\*This placeholder is affected by the [`Amount` option](../#amount) in a server list profile, with the exception being when used in [`Conditions`](../#conditions).
[^4]:
An space-separated list of worlds (Spigot/Paper) or Servers (BungeeCord/Velocity) can be provided to display the number of players in these worlds/servers.
Example: `${server playersOnline lobby1 lobby2}` will display the numbers of players online on the servers `lobby1` and `lobby2`.
[^5]:
When the [`amount` option](../#amount) is used will this placeholder display the modified max players count.
The only exception is [`conditions`](../#conditions) where it uses the actual max players of the server/proxy.
[^6]:
An optional server name can be provided to display the IP/Domain associated with that server. Only works on BungeeCord/Velocity.
Example: `${server host survival}` would display the IP/Domain associated with the `survival` server.
## PlaceholderAPI
@@ -49,4 +60,4 @@ Depending on the placeholder used is a cached player required (i.e. `%player_nam
Since version 2 of AdvancedServerList are developers able to provide their own placeholders to be used in a server list profile.
The format follows the same one as the [built-in placeholders](#built-in-placeholders), meaning it is `${<identifier> <placeholder>}`.
If you're a developer and want to integrate your own placeholders into AdvancedServerList, read about it [here](../../api).
If you're a developer and want to integrate your own placeholders into AdvancedServerList, read about it [here](../../api).
@@ -112,8 +112,8 @@ public class HangarUploader{
VersionUpload.Platform.VELOCITY, List.of()
),
Map.of(
VersionUpload.Platform.PAPER, List.of("1.19.x"),
VersionUpload.Platform.WATERFALL, List.of("1.19.x"),
VersionUpload.Platform.PAPER, List.of("1.19.x", "1.20.x"),
VersionUpload.Platform.WATERFALL, List.of("1.19.x", "1.20.x"),
VersionUpload.Platform.VELOCITY, List.of("3.1")
),
body,
+7
View File
@@ -35,6 +35,7 @@ theme:
- navigation.indexes
- navigation.tabs
- navigation.tabs.sticky
- content.code.copy
icon:
repo: 'octicons/mark-github-16'
@@ -65,11 +66,16 @@ extra:
- latest
- dev
plugins:
- search
- glightbox
markdown_extensions:
- markdown.extensions.admonition:
- markdown.extensions.toc:
permalink: true
- markdown.extensions.attr_list:
- markdown.extensions.footnotes:
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
@@ -78,3 +84,4 @@ markdown_extensions:
- pymdownx.superfences:
- pymdownx.tabbed:
alternate_style: true
- pymdownx.details:
+17 -2
View File
@@ -36,16 +36,31 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.commit/>
<plugin.version>3.0.0</plugin.version>
<plugin.version>3.2.1</plugin.version>
<plugin.description>Create multiple Server lists based on conditions.</plugin.description>
<api.version>v2.1.0</api.version>
<api.version>v3.0.0</api.version>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<profiles>
<profile>
<id>gh-actions</id>
<activation>
<property>
<name>env.COMMIT_SHA</name>
</property>
</activation>
<properties>
<project.build.commit>_${env.COMMIT_SHA}</project.build.commit>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>jitpack</id>
+2 -1
View File
@@ -1 +1,2 @@
mkdocs-material==9.1.5
mkdocs-material==9.1.18
mkdocs-glightbox==0.3.4
+3 -3
View File
@@ -84,13 +84,13 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
<version>4.11.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>AdvancedServerList-Velocity-${plugin.version}</finalName>
<finalName>AdvancedServerList-Velocity-${plugin.version}${project.build.commit}</finalName>
<resources>
<resource>
<filtering>true</filtering>
@@ -106,7 +106,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
@@ -30,10 +30,11 @@ import ch.andre601.advancedserverlist.core.interfaces.PluginLogger;
import ch.andre601.advancedserverlist.core.interfaces.core.PluginCore;
import ch.andre601.advancedserverlist.core.profiles.favicon.FaviconHandler;
import ch.andre601.advancedserverlist.velocity.commands.CmdAdvancedServerList;
import ch.andre601.advancedserverlist.velocity.events.JoinEvent;
import ch.andre601.advancedserverlist.velocity.events.PingEvent;
import ch.andre601.advancedserverlist.velocity.listeners.JoinEvent;
import ch.andre601.advancedserverlist.velocity.listeners.PingEvent;
import ch.andre601.advancedserverlist.velocity.logging.VelocityLogger;
import ch.andre601.advancedserverlist.velocity.objects.VelocityPlayerPlaceholders;
import ch.andre601.advancedserverlist.velocity.objects.VelocityServerPlaceholders;
import com.google.inject.Inject;
import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.event.Subscribe;
@@ -55,7 +56,7 @@ public class VelocityCore implements PluginCore<Favicon>{
private final Path path;
private final Metrics.Factory metrics;
private AdvancedServerList core;
private AdvancedServerList<Favicon> core;
private FaviconHandler<Favicon> faviconHandler = null;
@Inject
@@ -69,7 +70,7 @@ public class VelocityCore implements PluginCore<Favicon>{
@Subscribe
public void init(ProxyInitializeEvent event){
this.core = new AdvancedServerList(this, new VelocityPlayerPlaceholders());
this.core = AdvancedServerList.init(this, VelocityPlayerPlaceholders.init(), VelocityServerPlaceholders.init());
}
@Subscribe
@@ -109,7 +110,7 @@ public class VelocityCore implements PluginCore<Favicon>{
}
@Override
public AdvancedServerList getCore(){
public AdvancedServerList<Favicon> getCore(){
return core;
}
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.velocity.events;
package ch.andre601.advancedserverlist.velocity.listeners;
import ch.andre601.advancedserverlist.velocity.VelocityCore;
import com.velocitypowered.api.event.Subscribe;
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.velocity.events;
package ch.andre601.advancedserverlist.velocity.listeners;
import ch.andre601.advancedserverlist.core.events.PingEventHandler;
import ch.andre601.advancedserverlist.velocity.VelocityCore;
@@ -23,13 +23,12 @@
*
*/
package ch.andre601.advancedserverlist.bukkit.events;
package ch.andre601.advancedserverlist.velocity.listeners;
import ch.andre601.advancedserverlist.api.profiles.ProfileEntry;
import ch.andre601.advancedserverlist.spigot.events.PreServerListSetEvent;
import ch.andre601.advancedserverlist.api.velocity.events.PreServerListSetEvent;
public class PreServerListSetEventImpl extends PreServerListSetEvent{
public PreServerListSetEventImpl(ProfileEntry entry){
super(entry);
}
@@ -23,7 +23,7 @@
*
*/
package ch.andre601.advancedserverlist.velocity.events;
package ch.andre601.advancedserverlist.velocity.listeners;
import ch.andre601.advancedserverlist.api.events.GenericServerListEvent;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
@@ -35,13 +35,17 @@ import ch.andre601.advancedserverlist.core.parsing.ComponentParser;
import ch.andre601.advancedserverlist.core.profiles.replacer.StringReplacer;
import ch.andre601.advancedserverlist.velocity.VelocityCore;
import ch.andre601.advancedserverlist.velocity.objects.VelocityPlayerImpl;
import ch.andre601.advancedserverlist.velocity.objects.VelocityProxyImpl;
import com.velocitypowered.api.event.proxy.ProxyPingEvent;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.api.util.Favicon;
import net.kyori.adventure.text.Component;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
@@ -166,6 +170,14 @@ public class VelocityEventWrapper implements GenericEventWrapper<Favicon, Veloci
return new VelocityPlayerImpl(player, protocol);
}
@Override
public GenericServer createGenericServer(int playersOnline, int playersMax, String host){
Map<String, RegisteredServer> servers = new HashMap<>();
plugin.getProxy().getAllServers().forEach(server -> servers.put(server.getServerInfo().getName(), server));
return new VelocityProxyImpl(servers, playersOnline, playersMax, host);
}
@Override
public Favicon createFavicon(BufferedImage image){
return Favicon.create(image);
@@ -25,6 +25,7 @@
package ch.andre601.advancedserverlist.velocity.objects;
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityPlayer;
import ch.andre601.advancedserverlist.core.objects.CachedPlayer;
import ch.andre601.advancedserverlist.core.profiles.players.GenericPlayerImpl;
import com.velocitypowered.api.network.ProtocolVersion;
@@ -28,20 +28,28 @@ package ch.andre601.advancedserverlist.velocity.objects;
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityPlayer;
public class VelocityPlayerPlaceholders extends PlaceholderProvider{
public VelocityPlayerPlaceholders(){
private VelocityPlayerPlaceholders(){
super("player");
}
public static VelocityPlayerPlaceholders init(){
return new VelocityPlayerPlaceholders();
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
if(!(player instanceof VelocityPlayer velocityPlayer))
return null;
return switch(placeholder){
case "name" -> player.getName();
case "protocol" -> String.valueOf(player.getProtocol());
case "uuid" -> String.valueOf(player.getUUID());
case "version" -> ((VelocityPlayerImpl)player).getVersion();
case "name" -> velocityPlayer.getName();
case "protocol" -> String.valueOf(velocityPlayer.getProtocol());
case "uuid" -> String.valueOf(velocityPlayer.getUUID());
case "version" -> velocityPlayer.getVersion();
default -> null;
};
}
@@ -0,0 +1,53 @@
/*
* 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.velocity.objects;
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityProxy;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.util.Map;
public record VelocityProxyImpl(Map<String, RegisteredServer> servers, int playersOnline, int playersMax, String host) implements VelocityProxy{
@Override
public Map<String, RegisteredServer> getServers(){
return servers;
}
@Override
public int getPlayersOnline(){
return playersOnline;
}
@Override
public int getPlayersMax(){
return playersMax;
}
@Override
public String getHost(){
return host;
}
}
@@ -0,0 +1,92 @@
/*
* 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.velocity.objects;
import ch.andre601.advancedserverlist.api.PlaceholderProvider;
import ch.andre601.advancedserverlist.api.objects.GenericPlayer;
import ch.andre601.advancedserverlist.api.objects.GenericServer;
import ch.andre601.advancedserverlist.api.velocity.objects.VelocityProxy;
import com.velocitypowered.api.proxy.server.RegisteredServer;
public class VelocityServerPlaceholders extends PlaceholderProvider{
private VelocityServerPlaceholders(){
super("server");
}
public static VelocityServerPlaceholders init(){
return new VelocityServerPlaceholders();
}
@Override
public String parsePlaceholder(String placeholder, GenericPlayer player, GenericServer server){
if(!(server instanceof VelocityProxy proxy))
return null;
String[] args = placeholder.split("\\s", 2);
return switch(args[0]){
case "playersOnline" -> {
if(args.length >= 2){
int players = 0;
for(int i = 1; i < args.length; i++){
RegisteredServer registeredServer = proxy.getServers().get(args[i]);
if(registeredServer == null)
continue;
players += registeredServer.getPlayersConnected().size();
}
yield String.valueOf(players);
}
yield String.valueOf(proxy.getPlayersOnline());
}
case "playersMax" -> {
if(args.length >= 2)
yield null;
yield String.valueOf(proxy.getPlayersMax());
}
case "host" -> {
if(args.length > 2)
yield null;
if(args.length == 2){
RegisteredServer info = proxy.getServers().get(args[1]);
if(info == null)
yield null;
yield info.getServerInfo().getAddress().getHostString();
}
yield proxy.getHost();
}
default -> null;
};
}
}