Compare commits

..
545 Commits
Author SHA1 Message Date
Adrian Gonzales 3a2ba24f3d release: Version 3.2.0 2026-03-27 13:03:56 -05:00
Adrian Gonzales 38592abaa3 misc: Updated to Velocity 3.5.0 and reorganized versions catalog 2026-03-26 15:48:36 -05:00
Adrian 2628ef6279 Merge pull request #359 from MiniPlaceholders/renovate/dokka
chore(deps): update dependency org.jetbrains.dokka to v2.2.0
2026-03-26 10:46:43 -05:00
renovate[bot] 6bf9c23e09 chore(deps): update dependency org.jetbrains.dokka to v2.2.0 2026-03-26 14:08:26 +00:00
Adrian e99ae1a6fd Merge pull request #325 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.144.3+26.1
2026-03-25 14:47:50 -05:00
renovate[bot] e552a0e90d fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.144.3+26.1 2026-03-25 19:39:58 +00:00
Adrian 7146b1d348 Merge pull request #354 from Leon-JavaScript/feat/minestom
Add support for Minestom platform
2026-03-25 14:39:31 -05:00
Adrian Gonzales e91b6796cb Merge remote-tracking branch 'minestom/feat/minestom' into feat/minestom 2026-03-25 14:33:12 -05:00
Adrian Gonzales 6e528c5d6b test(minestom): Improved Minestom testing instance 2026-03-25 14:32:48 -05:00
Adrian 9c029ab519 Merge branch 'main' into feat/minestom 2026-03-25 12:49:43 -05:00
Adrian Gonzales 114b38ba5b feat(minestom): Use static methods to initialize MiniPlaceholders Minestom 2026-03-25 12:47:22 -05:00
Adrian Gonzales 288a5ae5e0 fix(ci): Fixed jenkins javadoc generation 2026-03-25 12:05:02 -05:00
Adrian ae720f3dce Merge pull request #356 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.5
2026-03-25 11:50:18 -05:00
Leon Marschke 57df8615dc Merge branch 'main' into feat/minestom 2026-03-25 17:47:06 +01:00
renovate[bot] b00e37131d fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.5 2026-03-25 16:36:46 +00:00
Adrian 34c2330af8 Added support for Fabric 26.1 (#357)
* feat: Initial 26.1 progress

* feat: Working Fabric 26.1 support

* misc: Removed unused references
2026-03-25 11:35:59 -05:00
Leon-JavaScript 6bc35b3e16 docs(README): update compatibility section for Minestom 1.21.11 2026-03-25 17:29:15 +01:00
Leon-JavaScript 1eea547f7a feat(example): add audience and relational placeholders 2026-03-25 17:28:29 +01:00
Leon-JavaScript 68f8ce504c feat(build): add Maven publishing configuration for Minestom 2026-03-24 20:04:43 +01:00
Leon-JavaScript 007b10e0c3 fix(commands): message argument to support multiple strings 2026-03-24 17:08:50 +01:00
Leon-JavaScript 4c556c4925 fix(commands): suggestion filtering for command arguments 2026-03-24 17:08:02 +01:00
Leon-JavaScript 39b20b1827 fix(tests): disable failOnNoDiscoveredTests in test task 2026-03-24 15:56:45 +01:00
Leon-JavaScript 8206b99d00 fix(review): Apply suggestions from PR review
- Update version to documentation to 3.2.0
- Change method platformHasComplementLoaded to always return `false` because Minestom doesn't support plugins
2026-03-24 15:56:26 +01:00
Adrian 35b3c31341 Merge pull request #353 from SmiteMCde/fix/help-command-expansions-click
Fix expansions command click in help message
2026-03-23 17:17:42 -05:00
Leon-JavaScript 075cca14b0 feat(minestom): add support for Minestom platform and related commands 2026-03-23 20:10:48 +01:00
Leon Marschke 4fb84b3ddc Update command click events in CommandConstants.java
Signed-off-by: Leon Marschke <70959426+Leon-JavaScript@users.noreply.github.com>
2026-03-23 19:53:41 +01:00
Adrian f9df6ddd1a Merge pull request #352 from MiniPlaceholders/renovate/nick-invision-retry-4.x
chore(deps): update nick-invision/retry action to v4
2026-03-20 00:20:08 -05:00
renovate[bot] 6557d0c99d chore(deps): update nick-invision/retry action to v4 2026-03-20 04:35:30 +00:00
Adrian fbaada216a Merge pull request #351 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.4.1
2026-03-19 09:56:58 -05:00
renovate[bot] c97f2c2dc5 chore(deps): update gradle to v9.4.1 2026-03-19 09:29:20 +00:00
Adrian 97f6561724 Merge pull request #350 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.3.20
2026-03-18 22:39:24 -05:00
renovate[bot] 98835a90b2 fix(deps): update kotlin monorepo to v2.3.20 2026-03-16 09:54:10 +00:00
Adrian a03ee83d54 Merge pull request #349 from MiniPlaceholders/renovate/shadow
fix(deps): update shadow to v9.4.0
2026-03-15 10:06:18 -05:00
renovate[bot] 7433aa0394 fix(deps): update shadow to v9.4.0 2026-03-15 05:06:35 +00:00
Adrian Gonzales c392a112e5 feat: Added support to Fabric 1.21.11+ 2026-03-14 12:10:06 -05:00
Adrian 4d8673aeeb Merge pull request #348 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.4.0
2026-03-06 23:22:18 -05:00
renovate[bot] b60ea1a9a9 chore(deps): update gradle to v9.4.0 2026-03-04 12:45:06 +00:00
Adrian ecfee088cd Merge pull request #340 from MiniPlaceholders/renovate/quiet-fabric-loom-1.x
chore(deps): update plugin quiet-fabric-loom to v1.15.332
2026-02-27 22:48:13 -05:00
Adrian 39b0e12c49 Merge pull request #341 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.3.10
2026-02-27 22:47:41 -05:00
Adrian 8c4158eee8 Merge pull request #346 from MiniPlaceholders/renovate/major-github-artifact-actions
chore(deps): update actions/upload-artifact action to v7
2026-02-27 22:47:24 -05:00
Adrian f425afc2bb Merge pull request #345 from MiniPlaceholders/renovate/bstats
fix(deps): update bstats to v3.2.1
2026-02-27 22:47:14 -05:00
Adrian 373fc7f757 Merge pull request #347 from MiniPlaceholders/renovate/shadow
fix(deps): update shadow to v9.3.2
2026-02-27 22:44:11 -05:00
renovate[bot] 05619a4939 fix(deps): update shadow to v9.3.2 2026-02-27 13:01:49 +00:00
renovate[bot] 968c930060 fix(deps): update kotlin monorepo to v2.3.10 2026-02-27 13:01:44 +00:00
renovate[bot] b1bc70bba7 chore(deps): update plugin quiet-fabric-loom to v1.15.332 2026-02-27 13:01:37 +00:00
renovate[bot] 5c412ba2ff chore(deps): update actions/upload-artifact action to v7 2026-02-26 22:33:39 +00:00
renovate[bot] 366f9b43a6 fix(deps): update bstats to v3.2.1 2026-02-24 23:08:20 +00:00
Adrian e699e48ae3 Merge pull request #344 from MiniPlaceholders/renovate/bstats
fix(deps): update bstats to v3.2.0
2026-02-24 01:16:46 -05:00
renovate[bot] bc018cfb2d fix(deps): update bstats to v3.2.0 2026-02-23 22:14:10 +00:00
Adrian 1c299e6595 Merge pull request #343 from MiniPlaceholders/renovate/org.jetbrains.gradle.plugin.idea-ext-1.x
chore(deps): update plugin idea-ext to v1.4.1
2026-02-18 12:42:59 -05:00
renovate[bot] 510ca51111 chore(deps): update plugin idea-ext to v1.4.1 2026-02-18 11:14:25 +00:00
Adrian a466dbd378 Merge pull request #342 from MiniPlaceholders/renovate/junit-framework-monorepo
fix(deps): update dependency org.junit:junit-bom to v6.0.3
2026-02-15 14:05:56 -05:00
renovate[bot] 029b528669 fix(deps): update dependency org.junit:junit-bom to v6.0.3 2026-02-15 17:36:53 +00:00
Adrian a3f371105e Merge pull request #339 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.3.1
2026-01-31 01:21:04 -05:00
renovate[bot] f6fae9b54b chore(deps): update gradle to v9.3.1 2026-01-29 17:13:18 +00:00
Adrian 5828f8d1ff Merge pull request #335 from MiniPlaceholders/renovate/quiet-fabric-loom-1.x
chore(deps): update plugin quiet-fabric-loom to v1.15.331
2026-01-26 23:42:25 -05:00
renovate[bot] 88a27c40e6 chore(deps): update plugin quiet-fabric-loom to v1.15.331 2026-01-26 16:04:42 +00:00
Adrian 34a33a0f44 Merge pull request #338 from MiniPlaceholders/renovate/org.jetbrains.gradle.plugin.idea-ext-1.x
chore(deps): update plugin idea-ext to v1.4
2026-01-26 10:54:42 -05:00
renovate[bot] c27bf3a907 chore(deps): update plugin idea-ext to v1.4 2026-01-26 11:11:38 +00:00
Adrian 7b332154bc Merge pull request #337 from MiniPlaceholders/renovate/velocity
fix(deps): update dependency com.velocitypowered:velocity-api to v3.4.0
2026-01-25 22:27:30 -05:00
renovate[bot] 132c1f8fac fix(deps): update dependency com.velocitypowered:velocity-api to v3.4.0 2026-01-25 22:13:00 +00:00
Adrian 009873b5e9 Merge pull request #334 from MiniPlaceholders/renovate/com.vanniktech.maven.publish-0.x
chore(deps): update plugin com.vanniktech.maven.publish to v0.36.0
2026-01-19 15:03:58 -05:00
renovate[bot] 0d27f10575 chore(deps): update plugin com.vanniktech.maven.publish to v0.36.0 2026-01-18 18:41:45 +00:00
Adrian 519d131a16 Merge pull request #333 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.3.0
2026-01-16 12:32:50 -05:00
renovate[bot] 5e9da46f8c chore(deps): update gradle to v9.3.0 2026-01-16 15:16:21 +00:00
Adrian 207a4e8db3 Merge pull request #329 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.4
2026-01-12 13:03:49 -05:00
Adrian ad17ce84bd Merge pull request #332 from MiniPlaceholders/renovate/quiet-fabric-loom-1.x
chore(deps): update plugin quiet-fabric-loom to v1.14.330
2026-01-12 13:03:38 -05:00
renovate[bot] 4aa9524cfd chore(deps): update plugin quiet-fabric-loom to v1.14.330 2026-01-11 04:51:20 +00:00
Adrian 097203729f Merge pull request #331 from MiniPlaceholders/renovate/junit-framework-monorepo
fix(deps): update dependency org.junit:junit-bom to v6.0.2
2026-01-06 23:45:37 -05:00
renovate[bot] 13cc13539d fix(deps): update dependency org.junit:junit-bom to v6.0.2 2026-01-06 17:55:42 +00:00
Adrian 53bc542588 Merge pull request #330 from MiniPlaceholders/renovate/shadow
fix(deps): update shadow to v9.3.1
2026-01-06 12:54:59 -05:00
renovate[bot] 5f20e679c6 fix(deps): update dependency com.gradleup.shadow:shadow-gradle-plugin to v9.3.1 2026-01-06 05:58:51 +00:00
renovate[bot] 7fe01d729c fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.4 2025-12-24 20:43:32 +00:00
Adrian 42976b576a Merge pull request #327 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.3.0
2025-12-17 13:08:15 -05:00
Adrian f50d95aa07 Merge pull request #328 from MiniPlaceholders/renovate/adventure
fix(deps): update adventure to v4.26.1
2025-12-17 13:07:15 -05:00
Adrian 961f8d33ff Merge pull request #322 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.3
2025-12-17 12:49:43 -05:00
Adrian 2c1b24c586 Merge pull request #326 from MiniPlaceholders/renovate/major-github-artifact-actions
chore(deps): update actions/upload-artifact action to v6
2025-12-17 12:45:05 -05:00
renovate[bot] c29774fb78 fix(deps): update kotlin monorepo to v2.3.0 2025-12-17 17:43:48 +00:00
renovate[bot] 6524d599f2 fix(deps): update adventure to v4.26.1 2025-12-17 17:43:43 +00:00
Adrian dab817a653 Merge pull request #324 from MiniPlaceholders/renovate/adventuremodded
fix(deps): update dependency net.kyori:adventure-platform-fabric to v6.8.0
2025-12-17 12:42:27 -05:00
Adrian 06c908a2cc Merge pull request #323 from MiniPlaceholders/renovate/me.lucko-fabric-permissions-api-0.x
fix(deps): update dependency me.lucko:fabric-permissions-api to v0.6.1
2025-12-17 12:40:45 -05:00
renovate[bot] 21a67c2d85 fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.3 2025-12-17 02:39:20 +00:00
renovate[bot] e7974dfbca chore(deps): update actions/upload-artifact action to v6 2025-12-12 21:09:23 +00:00
Adrian bd80c435c0 Merge pull request #300 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.139.4+1.21.11
2025-12-11 12:50:49 -05:00
renovate[bot] c85e2cd1ac fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.139.4+1.21.11 2025-12-10 12:42:08 +00:00
renovate[bot] dbf167412d fix(deps): update dependency net.kyori:adventure-platform-fabric to v6.8.0 2025-12-10 06:01:14 +00:00
renovate[bot] d17883962e fix(deps): update dependency me.lucko:fabric-permissions-api to v0.6.1 2025-12-10 03:46:56 +00:00
Adrian f41e1e672a Merge pull request #321 from MiniPlaceholders/renovate/shadow
fix(deps): update shadow to v9.3.0
2025-12-05 12:50:47 -05:00
renovate[bot] 31355fa183 fix(deps): update shadow to v9.3.0 2025-12-05 17:13:13 +00:00
Adrian 30ce81cf67 Merge pull request #320 from MiniPlaceholders/renovate/quiet-fabric-loom-1.x
chore(deps): update plugin quiet-fabric-loom to v1.13.328
2025-11-23 10:13:15 -05:00
renovate[bot] aeaa712d8c chore(deps): update plugin quiet-fabric-loom to v1.13.328 2025-11-21 22:53:02 +00:00
Adrian 061d483f20 Merge pull request #318 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.1
2025-11-21 11:00:09 -05:00
Adrian 408c225b5d Merge pull request #319 from MiniPlaceholders/renovate/actions-checkout-6.x
chore(deps): update actions/checkout action to v6
2025-11-21 10:19:11 -05:00
renovate[bot] 562e42c220 chore(deps): update actions/checkout action to v6 2025-11-20 17:36:49 +00:00
renovate[bot] 2e36e96d7f fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.1 2025-11-20 17:36:45 +00:00
Adrian 98ee83e714 Merge pull request #317 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.2.1
2025-11-19 14:58:16 -05:00
renovate[bot] 34d33b2b81 chore(deps): update gradle to v9.2.1 2025-11-18 02:29:17 +00:00
Adrian 882723c155 Merge pull request #316 from MiniPlaceholders/renovate/com.vanniktech.maven.publish-0.x
chore(deps): update plugin com.vanniktech.maven.publish to v0.35.0
2025-11-12 01:10:55 -05:00
renovate[bot] 80fa0c07d0 chore(deps): update plugin com.vanniktech.maven.publish to v0.35.0 2025-11-11 20:42:36 +00:00
Adrian fbc48c4c5c Merge pull request #315 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.0
2025-11-09 11:41:03 -05:00
renovate[bot] 095228cce8 fix(deps): update dependency net.fabricmc:fabric-loader to v0.18.0 2025-11-09 01:15:12 +00:00
Adrian 775d62233c Merge pull request #313 from MiniPlaceholders/renovate/quiet-fabric-loom-1.x
chore(deps): update plugin quiet-fabric-loom to v1.12.326
2025-11-07 22:23:52 -05:00
renovate[bot] 67cb025d0f chore(deps): update plugin quiet-fabric-loom to v1.12.326 2025-11-08 02:33:57 +00:00
Adrian e296bf8a90 Merge pull request #314 from MiniPlaceholders/renovate/junit-framework-monorepo
fix(deps): update dependency org.junit:junit-bom to v6.0.1
2025-11-07 16:56:00 -05:00
Adrian 9f9950de70 Merge pull request #312 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.2.0
2025-11-07 16:55:07 -05:00
Adrian ffe0e0f5d8 Merge pull request #311 from MiniPlaceholders/renovate/major-github-artifact-actions
chore(deps): update actions/upload-artifact action to v5
2025-11-07 16:52:21 -05:00
renovate[bot] b5063d9a02 fix(deps): update dependency org.junit:junit-bom to v6.0.1 2025-10-31 19:49:04 +00:00
renovate[bot] e0e0b4fe3e chore(deps): update gradle to v9.2.0 2025-10-29 23:17:04 +00:00
renovate[bot] eeb756d1fc chore(deps): update actions/upload-artifact action to v5 2025-10-24 23:02:20 +00:00
Adrian 4c173ae8ee Merge pull request #310 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.2.21
2025-10-23 11:19:23 -05:00
renovate[bot] 0dc6d85cdb fix(deps): update kotlin monorepo to v2.2.21 2025-10-23 14:28:44 +00:00
Adrian 944fef34f6 Merge pull request #308 from MiniPlaceholders/renovate/dokka
fix(deps): update dokka to v2.1.0
2025-10-15 10:49:53 -05:00
Adrian 0c7e327323 Merge pull request #309 from MiniPlaceholders/renovate/org.jetbrains.dokka-2.x
chore(deps): update plugin org.jetbrains.dokka to v2.1.0
2025-10-15 10:49:44 -05:00
renovate[bot] 17aef8b922 chore(deps): update plugin org.jetbrains.dokka to v2.1.0 2025-10-15 10:32:07 +00:00
renovate[bot] 94baa536a4 chore(deps): update dependency org.jetbrains.dokka to v2.1.0 2025-10-15 10:32:03 +00:00
Adrian f7a59f1279 Merge pull request #307 from MiniPlaceholders/renovate/blossom
chore(deps): update dependency net.kyori.blossom to v2.2.0
2025-10-12 00:54:33 -05:00
renovate[bot] 9b314854a2 chore(deps): update dependency net.kyori.blossom to v2.2.0 2025-10-12 05:03:43 +00:00
Adrian 1579b264a8 Merge pull request #306 from MiniPlaceholders/renovate/runtask
fix(deps): update runtask to v3.0.2
2025-10-11 13:24:16 -05:00
renovate[bot] 17cc2016fe fix(deps): update runtask to v3.0.2 2025-10-11 05:11:30 +00:00
Adrian Gonzales ea3a80a0bd feat: Added support to Fabric 1.21.9+ 2025-10-10 03:27:30 -05:00
Adrian 2dee5f0d66 Merge pull request #303 from MiniPlaceholders/renovate/adventure
fix(deps): update adventure to v4.25.0
2025-10-10 03:25:10 -05:00
renovate[bot] 4efed28253 fix(deps): update adventure to v4.25.0 2025-10-10 08:09:11 +00:00
Adrian 45b1a0da5d Merge pull request #298 from MiniPlaceholders/renovate/me.lucko-fabric-permissions-api-0.x
fix(deps): update dependency me.lucko:fabric-permissions-api to v0.5.0
2025-10-10 03:08:08 -05:00
Adrian c4002e0a3d Merge pull request #304 from MiniPlaceholders/renovate/adventuremodded
fix(deps): update dependency net.kyori:adventure-platform-fabric to v6.7.0
2025-10-10 03:07:47 -05:00
Adrian Gonzales eb4fba66eb misc: 3.1.1-SNAPSHOT 2025-10-10 03:05:27 -05:00
Adrian Gonzales 6a084a6d2e release: Version 3.1.0 2025-10-10 02:35:19 -05:00
Adrian Gonzales d02ac7abc1 [ci skip] Created CHANGELOG.md 2025-10-09 18:59:53 -05:00
Adrian 9bcefee265 Merge pull request #305 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.17.3
2025-10-09 18:42:13 -05:00
Adrian 47dd5a96e9 Merge pull request #302 from MiniPlaceholders/renovate/runtask
fix(deps): update runtask to v3.0.1
2025-10-09 18:42:02 -05:00
renovate[bot] 36dbeed21d fix(deps): update dependency net.fabricmc:fabric-loader to v0.17.3 2025-10-09 17:07:35 +00:00
renovate[bot] 9dd473092a fix(deps): update dependency net.kyori:adventure-platform-fabric to v6.7.0 2025-10-09 12:44:50 +00:00
renovate[bot] 9139d2260f fix(deps): update dependency me.lucko:fabric-permissions-api to v0.5.0 2025-10-09 12:44:42 +00:00
renovate[bot] e19527a9d6 fix(deps): update runtask to v3.0.1 2025-10-09 12:44:34 +00:00
Adrian Gonzales f648dd8f83 misc: Added bstats metrics 2025-10-09 00:31:50 -05:00
Adrian Gonzales 079b88d99f docs: Use the NullMarked annotation throughout the module instead of in each file 2025-10-08 23:12:44 -05:00
Adrian Gonzales 0f48a4baed docs: Replaced some uses of JetBrains annotations with jspecify
This fixes a duplication of annotations in the generation of javadocs
2025-10-08 12:43:32 -05:00
Adrian Gonzales 2608e81fae fix: Enable expansion providers after the server initializes.
This allows all other plugins to initialize, and if any depend on MiniPlaceholders, they can register their expansions. After the server initializes, expansion providers will be enabled, and if anyone wants to remove an expansion or iterate between them, they can simply use a higher priority for late server initialization events
2025-10-08 12:04:18 -05:00
Adrian Gonzales afb4a4451d build: Added testing support for fabric and sponge modules 2025-10-05 01:27:09 -05:00
Adrian Gonzales df53a0a2fa build: Simplify example expansion loading 2025-10-05 00:52:33 -05:00
Adrian Gonzales 591df2e6df feat(build): Added the capability to test the example expansion using runtask 2025-10-05 00:33:35 -05:00
Adrian Gonzales bf995b7103 feat: Allow the use of injected constructors when creating an ExpansionProvider 2025-10-05 00:32:22 -05:00
Adrian Gonzales 02f30ead85 misc: Added deprecation message 2025-10-04 23:11:09 -05:00
Adrian f522456b76 Merge pull request #301 from MiniPlaceholders/feat/newparsesubcommands
Implement new parserel subcommand
2025-10-03 01:16:17 -05:00
Adrian Gonzales de7d14d55d fix: Fixed command formatting 2025-10-02 23:19:00 -05:00
Adrian Gonzales c0230efb3b misc: Some component creation cleanup 2025-10-02 22:41:53 -05:00
Adrian Gonzales 3cdb7de9f2 feat: Add --null argument to parse node 2025-10-02 19:41:57 -05:00
Adrian Gonzales 9c954834cb misc: Simplify brigadier suggestions 2025-10-02 16:18:18 -05:00
Adrian Gonzales 55e493c013 feat: Implement parseglobal subcommand 2025-10-02 16:08:52 -05:00
Adrian Gonzales ea725a8121 feat: Implement parserel subcommand 2025-10-02 15:48:22 -05:00
Adrian Gonzales d138d00b26 misc: Renamed #presentClass to #requiredClass 2025-10-02 14:54:17 -05:00
Adrian d63397fc96 Merge pull request #299 from MiniPlaceholders/fix/sponge/commands
Implement Sponge commands
2025-10-02 14:50:02 -05:00
Adrian Gonzales fe6ea73bb0 misc: Some cleanup 2025-10-02 13:20:58 -05:00
Adrian Gonzales be368a7690 feat: Allow operator execution 2025-10-02 12:38:52 -05:00
Adrian Gonzales b31b91e9b8 fix: Fixed Fabric permissions check 2025-10-02 12:28:31 -05:00
Adrian Gonzales 7d8243711a fix(sponge): Fixed console command execution 2025-10-01 21:11:09 -05:00
Adrian Gonzales 7633ada70e feat: Initial Sponge commands implementation 2025-10-01 19:58:08 -05:00
Adrian 6d8267684a Merge pull request #296 from MiniPlaceholders/renovate/major-junit-framework-monorepo
fix(deps): update dependency org.junit:junit-bom to v6
2025-09-30 13:05:44 -05:00
renovate[bot] a1d5bb7eed fix(deps): update dependency org.junit:junit-bom to v6 2025-09-30 09:53:12 +00:00
Adrian 161a254613 Merge pull request #294 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.14+1.21.9
2025-09-29 18:16:30 -05:00
renovate[bot] d957269743 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.14+1.21.9 2025-09-29 21:10:18 +00:00
Adrian 7ac5aec82d Merge pull request #292 from MiniPlaceholders/renovate/shadow
fix(deps): update shadow to v9.2.2
2025-09-27 23:28:40 -05:00
Adrian 9713704352 Merge pull request #293 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.13+1.21.9
2025-09-27 23:28:19 -05:00
renovate[bot] 4240fb556c fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.13+1.21.9 2025-09-26 21:53:12 +00:00
renovate[bot] 5a9ac8af87 fix(deps): update shadow to v9.2.2 2025-09-26 10:00:24 +00:00
Adrian 97b68a3616 Merge pull request #290 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.12+1.21.9
2025-09-25 16:08:43 -05:00
renovate[bot] afde5e6e2c fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.12+1.21.9 2025-09-25 20:50:11 +00:00
Adrian 8a37136565 Merge pull request #291 from MiniPlaceholders/renovate/shadow
fix(deps): update shadow to v9.2.1
2025-09-24 11:46:24 -05:00
renovate[bot] 8d5378ff3e fix(deps): update shadow to v9.2.1 2025-09-24 10:30:48 +00:00
Adrian Gonzales 31ee16e412 feat: Added LoadRequirement#presentClass and LoadRequirement#anyOf 2025-09-23 12:48:57 -05:00
Adrian Gonzales 8aec3e592f fix: Added nullability checks to RelationalAudience 2025-09-23 12:05:45 -05:00
Adrian 88c26dee51 Merge pull request #281 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.10+1.21.9
2025-09-22 12:49:22 -05:00
renovate[bot] 659be54911 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.133.10+1.21.9 2025-09-20 21:08:10 +00:00
Adrian 3808d660d9 Merge pull request #289 from MiniPlaceholders/renovate/gradle-9.x
chore(deps): update gradle to v9.1.0
2025-09-18 12:09:59 -05:00
renovate[bot] c6ecdacdbc chore(deps): update gradle to v9.1.0 2025-09-18 13:53:15 +00:00
Adrian 25a9b435ff Update outdated README 2025-09-15 22:03:51 -05:00
Adrian d95b9fddac Merge pull request #287 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.2.20
2025-09-10 23:52:26 -05:00
renovate[bot] 78d1b83513 fix(deps): update kotlin monorepo to v2.2.20 2025-09-10 09:43:54 +00:00
Adrian 56a1e9afca Merge pull request #288 from MiniPlaceholders/renovate/major-runtask
chore(deps): update runtask to v3 (major)
2025-09-09 12:27:22 -05:00
Adrian ba1438457b Merge pull request #286 from MiniPlaceholders/renovate/quiet-fabric-loom-1.x
chore(deps): update plugin quiet-fabric-loom to v1.11.325
2025-09-09 01:09:53 -05:00
renovate[bot] ad36fab536 chore(deps): update runtask to v3 2025-09-08 01:08:10 +00:00
renovate[bot] f2ff2c0bf3 chore(deps): update plugin quiet-fabric-loom to v1.11.325 2025-09-07 23:34:41 +00:00
renovate[bot] 6e28786b09 fix(deps): update shadow to v9.1.0 (#283)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-30 16:14:56 -05:00
Adrian Gonzales f67690f413 fix: Fixed multiple loading expansions 2025-08-30 11:18:49 -05:00
Adrian cc8646cb4e [ci skip] Fix link formatting in README.md 2025-08-24 16:45:14 -05:00
Adrian 4db80d7583 [ci skip] Updated README
Updated compatibility section and command examples in README.md.
2025-08-24 16:44:20 -05:00
renovate[bot] 67d480c969 chore(deps): update plugin idea-ext to v1.3 (#280)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-23 00:39:51 -05:00
Adrian Gonzales 8593beccbd release: Version 3.0.1 2025-08-22 20:01:43 -05:00
Adrian Gonzales 5d92446a6b Merge remote-tracking branch 'origin/main' 2025-08-22 19:15:54 -05:00
Adrian Gonzales edc82b2bc9 fix: Fixed Fabric Initialization 2025-08-22 19:15:24 -05:00
Adrian Gonzales 70bd4fee88 fix: Fixed maven publication 2025-08-22 19:02:06 -05:00
renovate[bot] dbf440b4b3 chore(deps): update actions/setup-java action to v5 (#278)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-21 14:59:27 -05:00
Adrian Gonzales 0ffc47a889 feat: Added some kotlin-ext API 2025-08-20 14:05:35 -05:00
FabianAdrian 3f3c3f9ec5 fix:remove sponge plugin from the root project (#277) 2025-08-20 12:19:24 -05:00
renovate[bot] bfc05edb26 fix(deps): update kotlin monorepo to v2.2.20-rc (#259)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 22:58:26 -05:00
renovate[bot] c7c1576fe1 fix(deps): update dependency org.junit:junit-bom to v5.13.4 (#274)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 21:09:05 -05:00
renovate[bot] e84a484fcd chore(deps): update actions/checkout action to v5 (#275)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 21:08:56 -05:00
renovate[bot] 6743e35109 chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v1 (#276)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 21:08:47 -05:00
renovate[bot] fe2bdd8165 fix(deps): update dependency me.lucko:fabric-permissions-api to v0.4.1 (#273)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:59:49 -05:00
renovate[bot] 8ce7846aa1 fix(deps): update cloud.minecraft to v2.0.0-snapshot (#271)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:59:28 -05:00
renovate[bot] 7c415f19ac chore(deps): update plugin quiet-fabric-loom to v1.11.324 (#261)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:59:15 -05:00
renovate[bot] 771cf33788 chore(deps): update plugin idea-ext to v1.2 (#272)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:32:25 -05:00
renovate[bot] 4edf4180cd fix(deps): update dependency net.kyori:adventure-platform-fabric to v6.6.0 (#264)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:32:03 -05:00
renovate[bot] bb6f2d67c3 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.132.1+1.21.9 (#247)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:31:26 -05:00
renovate[bot] 0c51aeb82d fix(deps): update dependency org.incendo:cloud-fabric to v2.0.0-snapshot (#244)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:31:12 -05:00
renovate[bot] c2771a42e2 fix(deps): update shadow to v9.0.2 (#243)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-19 20:30:27 -05:00
Adrian 431270e8b5 MiniPlaceholders V3: Placeholders Refactor (#256)
* refactor: Changed the way of processing and creating placeholders, now based on the MiniMessage parsing context

* fix: Fixed version string

* feat: Added ability to obtain placeholders directly

resolves #174

* feat: Implement GlobalPlaceholder instance

* feat: Reimplemented support for ForwardingAudiences

* test: Fixed resolver equality tests

* test: Implemented some test based on recent API changes

* docs: Added some documentation

* docs: Added some placeholders documentation

* test: Added complex tag tests

* fix: Fixed javadoc generation

* feat: Implement Expansion Providers

resolves #9

* fix: Apply changes from #265

* feat: Removed default expansions

This allows more control by server admins to be able to control which Expansions are used on a server. The default expansions will be included in external expansions.

* docs: A few advances in documentation

This commit took over three months to publish...

* feat: Added error messages to expansion providers loading process

* build: Updated to Gradle 9.0.0

* docs: Finished javadocs documentation

build: Use gradle configuration cache

* fix: Fixed dynamic expansions loading

* feat: Added basic dependency injection for ExpansionProvider

This allows certain expansions to obtain data from the platform on which they are running where there is no static context for their platform or plugin/mod instances.
This feature will be used by a minority of expansions, but it eliminates the need to create expansions that load as plugins, as in MiniPlaceholders v1 and v2.

* fix: Expansions initialization on Paper
2025-08-19 17:21:42 -05:00
FabianAdrian a87226d33b update cloud snapshot repository (#268) 2025-06-29 12:00:37 -05:00
Willsr71 98d27e40a1 Fix expansion author and version being built backwards (#265) 2025-04-12 20:50:13 -05:00
renovate[bot] 59de135b95 chore(deps): update dependency gradle to v8.13 (#249)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-25 13:00:37 -05:00
Adrian f939fac882 build: Back to snapshots 2025-02-23 15:08:26 -05:00
Adrian adde850c52 release: Version 2.3.0 2025-02-23 14:03:35 -05:00
Adrian 94d97b97eb Added expansions subcommand (#255)
* refactor: Refactor commands organization

Also, added expansions subcommand

* feat: Added expansions subcommand to help menu

* feat: Added default author and version to built-in expansions

* feat: ReImplemented Sponge Module

At the moment the commands are disabled, but this will be resolved in a future release
2025-02-23 10:59:39 -05:00
renovate[bot] 122e338e4e chore(deps): update plugin idea-ext to v1.1.10 (#251)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-22 23:59:48 -05:00
renovate[bot] 32fa6bc38d chore(deps): update plugin quiet-fabric-loom to v1.10.316 (#248)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-22 23:55:10 -05:00
renovate[bot] 373c061089 fix(deps): update kotlin monorepo to v2.1.10 (#250)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-22 23:54:57 -05:00
renovate[bot] 8addfe3829 chore(deps): update dependency me.champeau.jmh to v0.7.3 (#252)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-22 23:54:46 -05:00
renovate[bot] 0e7fe5fec2 fix(deps): update dependency org.junit:junit-bom to v5.12.0 (#254)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-22 23:54:38 -05:00
renovate[bot] f0bce37135 fix(deps): update adventure to v4.19.0 (#253)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-22 23:54:29 -05:00
Adrian 4bd423bba8 fix(docs): Fixed Dokka docs generation and updated to V2 2025-02-22 23:53:15 -05:00
Adrian 2d75b5f36e build: Updated gradle to 8.12.1 2025-02-22 18:22:56 -05:00
Adrian a0fd80f883 misc: Fixed Deprecation version notice 2025-02-22 17:56:37 -05:00
renovate[bot] e846e2989b fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v2 (#245)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:45 -05:00
renovate[bot] aa0e6a1d51 chore(deps): update dependency org.jetbrains.dokka to v2 (#239)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:39 -05:00
renovate[bot] 702465f922 fix(deps): update dependency org.junit:junit-bom to v5.11.4 (#238)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:33 -05:00
renovate[bot] 012a322dca chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.9.0 (#237)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:27 -05:00
renovate[bot] c780f1c046 chore(deps): update plugin quiet-fabric-loom to v1.9.312 (#241)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:20 -05:00
renovate[bot] 51c1c71b7f fix(deps): update cloud.minecraft to v2.0.0-snapshot (#242)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:12 -05:00
renovate[bot] 530f0ae96b fix(deps): update dependency net.fabricmc:fabric-loader to v0.16.10 (#246)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 23:06:02 -05:00
renovate[bot] c5fdf94d27 fix(deps): update kotlin monorepo to v2.1.0 (#236)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 22:44:30 -05:00
renovate[bot] 855f9ca7ff fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.114.3+1.21.5 (#215)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-15 22:44:14 -05:00
Adrian e24c08fad0 Merge pull request #240 from powercasgamer/ver/1.21.4
1.21.4
2024-12-25 11:56:51 -05:00
powercas_gamer b1faea8c2d remove/update more deps 2024-12-24 19:35:12 +00:00
powercas_gamer ed5005be67 1.21.4 2024-12-24 19:08:00 +00:00
Adrian 1003e666e4 Merge pull request #230 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.16.9
2024-11-10 15:09:27 -05:00
Adrian c7dde0986a Merge pull request #226 from MiniPlaceholders/renovate/cloud.minecraft
fix(deps): update cloud.minecraft to v2.0.0-snapshot
2024-11-10 15:09:16 -05:00
Adrian 167c9101be Merge pull request #231 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.14.2
2024-11-10 15:09:00 -05:00
renovate[bot] a04b7ef182 fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.14.2 2024-11-10 19:47:35 +00:00
Adrian 97b5f2b77e Merge pull request #218 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.7.4
2024-11-10 10:10:47 -05:00
Adrian 32cfd1b0a7 Merge pull request #224 from MiniPlaceholders/renovate/org.jetbrains.gradle.plugin.idea-ext-1.x
chore(deps): update plugin idea-ext to v1.1.9
2024-11-10 10:10:39 -05:00
Adrian 9be5a6c676 Merge pull request #217 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v2.0.21
2024-11-10 10:10:30 -05:00
renovate[bot] 64e634033e fix(deps): update dependency net.fabricmc:fabric-loader to v0.16.9 2024-11-10 15:10:05 +00:00
renovate[bot] d66dadadab fix(deps): update cloud.minecraft to v2.0.0-snapshot 2024-11-10 15:09:56 +00:00
Adrian 3a78626d80 Merge pull request #216 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.8.12
2024-11-10 10:09:53 -05:00
Adrian 7f8325b605 Merge pull request #220 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.10.2
2024-11-10 10:09:42 -05:00
Adrian 759ca10c4f Merge pull request #221 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.11.3
2024-11-10 10:09:34 -05:00
Adrian 6e5bca56c1 Merge pull request #225 from MiniPlaceholders/renovate/shadow
chore(deps): update shadow to v8.3.5
2024-11-10 10:09:11 -05:00
Adrian c21201e948 Merge pull request #227 from MiniPlaceholders/renovate/cloud.minecraft.modded
fix(deps): update dependency org.incendo:cloud-fabric to v2.0.0-snapshot
2024-11-10 10:09:01 -05:00
renovate[bot] 41a35ce3ce chore(deps): update shadow to v8.3.5 2024-11-03 02:16:32 +00:00
renovate[bot] 31f5f286eb chore(deps): update plugin fabric-loom to v1.8.12 2024-11-01 16:19:35 +00:00
renovate[bot] ce4c694f87 chore(deps): update dependency io.papermc.paperweight.userdev to v1.7.4 2024-10-25 22:34:48 +00:00
renovate[bot] 62ab9feaea fix(deps): update dependency org.junit:junit-bom to v5.11.3 2024-10-21 15:49:26 +00:00
renovate[bot] 076aa128fd fix(deps): update kotlin monorepo to v2.0.21 2024-10-10 10:50:03 +00:00
renovate[bot] e2dba8c7ac fix(deps): update dependency org.incendo:cloud-fabric to v2.0.0-snapshot 2024-10-03 00:51:59 +00:00
renovate[bot] d40e6e2cd8 chore(deps): update plugin idea-ext to v1.1.9 2024-10-02 22:53:31 +00:00
renovate[bot] ecbf3d3ee4 chore(deps): update dependency gradle to v8.10.2 2024-10-02 22:53:25 +00:00
Adrian b0c980672d Merge pull request #223 from powercasgamer/ver/1.21
update to 1.21.1
2024-10-02 17:50:07 -05:00
powercas_gamer 40890cfbd0 remove unneeded dependency 2024-09-20 10:19:09 +00:00
powercas_gamer beee6c6266 fix: typo 2024-09-20 09:56:51 +00:00
powercas_gamer b0fb3dc4d8 fabric 2024-09-20 09:49:39 +00:00
powercas_gamer a9c3128698 progress
would be more progress if IntellIJ actually worked..
2024-09-20 09:37:27 +00:00
powercas_gamer a7a7558fdf update/fix versions 2024-09-20 09:19:11 +00:00
powercas_gamer 5adab32ef0 update to 1.21.1 2024-09-20 09:07:48 +00:00
Adrian 36ca8be51b Merge pull request #213 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.14.1
2024-07-26 17:58:40 -05:00
renovate[bot] 6254e29eec fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.14.1 2024-07-26 03:34:32 +00:00
Adrian 08e57e8e98 fix: Fixed getting Expansions by name 2024-07-25 10:17:12 -05:00
Adrian a1cdb1a212 fix: Re-added custom MinecraftExceptionHandlers 2024-07-25 08:46:48 -05:00
Adrian aa86a36ba1 misc: Removed some outdated mentions 2024-07-24 18:23:23 -05:00
Adrian 0310f1a260 Merge pull request #199 from Stampede2011/cloud2
Cloud v2 Implementation
2024-07-24 18:09:14 -05:00
Adrian 28b56abf3b Finished Cloud 2 implementation 2024-07-24 18:01:56 -05:00
Adrian 504eff952f Merge branch 'main' into cloud2 2024-07-24 15:55:44 -05:00
Adrian cb75bcb84b Merge pull request #205 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.14.0
2024-07-18 15:11:18 -05:00
Adrian a78e988132 Merge pull request #202 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.10.3
2024-07-18 15:11:10 -05:00
Adrian e5b8b36014 Merge pull request #192 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.100.7+1.21
2024-07-18 15:11:02 -05:00
renovate[bot] 0cc1c4bdd6 fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.14.0 2024-07-18 20:04:07 +00:00
renovate[bot] ee4e23d658 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.100.7+1.21 2024-07-18 20:03:05 +00:00
renovate[bot] 407807948c fix(deps): update dependency org.junit:junit-bom to v5.10.3 2024-07-18 20:03:01 +00:00
Adrian 634011dee0 misc: Updated to Java 21 2024-07-18 15:00:51 -05:00
Adrian 12596860b1 Merge pull request #207 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.16.0
2024-07-18 11:30:30 -05:00
Adrian 1ecabc43d6 Merge pull request #206 from MiniPlaceholders/renovate/major-kotlin-monorepo
fix(deps): update kotlin monorepo to v2 (major)
2024-07-18 11:30:23 -05:00
Adrian bae4722945 Merge pull request #203 from MiniPlaceholders/renovate/runtask
chore(deps): update runtask to v2.3.0
2024-07-18 11:26:43 -05:00
Adrian df07b08a45 Merge pull request #204 from MiniPlaceholders/renovate/me.lucko-fabric-permissions-api-0.x
fix(deps): update dependency me.lucko:fabric-permissions-api to v0.3.1
2024-07-18 11:25:32 -05:00
renovate[bot] b2c73f521d fix(deps): update dependency net.fabricmc:fabric-loader to v0.16.0 2024-07-12 16:56:58 +00:00
renovate[bot] 977ba115d0 fix(deps): update kotlin monorepo to v2 2024-07-12 11:26:08 +00:00
renovate[bot] 2b2c3ecddf fix(deps): update dependency me.lucko:fabric-permissions-api to v0.3.1 2024-07-12 07:03:35 +00:00
renovate[bot] c63e59aca6 chore(deps): update dependency gradle to v8.9 (#198)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:07:34 -05:00
renovate[bot] de9b8e78d1 chore(deps): update plugin fabric-loom to v1.7.2 (#197)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:07:26 -05:00
renovate[bot] 922e0dceb0 chore(deps): update plugin idea-ext to v1.1.8 (#196)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:07:18 -05:00
renovate[bot] 68644fd9cd fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.11 (#201)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:07:11 -05:00
renovate[bot] d3e3092ca1 chore(deps): update dependency io.papermc.paperweight.userdev to v1.7.1 (#200)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:07:02 -05:00
renovate[bot] af07305052 chore(deps): update runtask to v2.3.0 2024-07-12 03:05:40 +00:00
renovate[bot] ef2c7d80bc fix(deps): update kotlin monorepo to v1.9.24 (#195)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:05:23 -05:00
renovate[bot] be94b7e078 fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.20 (#194)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:04:58 -05:00
renovate[bot] 901335174c chore(deps): update dependency org.jetbrains.dokka to v1.9.20 (#193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:04:50 -05:00
renovate[bot] 2b05d77cf8 fix(deps): update adventure to v4.17.0 (#188)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-11 22:04:42 -05:00
Stampede f4c0a7e100 Remove duplicate repository 2024-03-27 12:26:17 -05:00
Stampede 87465740c6 Fix shadow relocation 2024-03-27 12:24:02 -05:00
Stampede 0f8144a9fb Updated to Cloud v2 2024-03-27 11:04:35 -05:00
Adrian 3808fc9d89 Add LegacyUtils methods to check if a string contains legacy characters (#191)
* feat: Add LegacyUtils methods to check if a string contains legacy characters

* chore: Rename to #mapLegacyOrElse
2024-03-03 15:48:43 -05:00
renovate[bot] a7cc73fe7d fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.12.0 (#189)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-28 22:27:16 -05:00
renovate[bot] 8ac0c398d7 chore(deps): update plugin fabric-loom to v1.5.8 (#190)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-28 22:27:07 -05:00
renovate[bot] 25618c0d42 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.96.4+1.20.5 (#187)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-28 22:27:00 -05:00
renovate[bot] 9b61e8efa0 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.96.2+1.20.5 (#177)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-17 09:37:01 -05:00
renovate[bot] ad95e239bc fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.7 (#184)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-15 12:14:09 -05:00
powercas_gamer d18ff640d2 feat(api): expansion metadata (#185)
* feat(api): expansion metadata

* more

* actually expose it

* javadoc

* oopsie whoopsie import

* change javadoc version
2024-02-15 12:13:47 -05:00
Adrian 7536d32055 Merge pull request #182 from MiniPlaceholders/renovate/runtask
chore(deps): update dependency xyz.jpenilla.run-velocity to v2.2.3
2024-02-04 15:14:01 -05:00
Adrian 5dffb9c251 Merge pull request #183 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.10.2
2024-02-04 15:13:54 -05:00
renovate[bot] e75baceb77 fix(deps): update dependency org.junit:junit-bom to v5.10.2 2024-02-04 11:23:07 +00:00
Adrian f2c6aa08f4 release: Version 2.2.4 2024-02-03 22:06:57 -05:00
Adrian 7727dca940 misc: Removed old Krypton module sources 2024-02-03 21:57:41 -05:00
Adrian 151b2dc2a4 misc: Deprecated TagsUtils#staticTag 2024-02-03 21:57:06 -05:00
renovate[bot] 16e3d09204 chore(deps): update runtask to v2.2.3 2024-02-04 02:55:42 +00:00
Adrian 62c11dd84a Merge pull request #176 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.6
2024-02-03 21:54:18 -05:00
Adrian 77913be0fa Merge pull request #178 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.5.7
2024-02-03 21:54:03 -05:00
Adrian 685f67146d Merge pull request #179 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.11.0
2024-02-03 21:53:56 -05:00
Adrian 6f524b056a Merge pull request #180 from MiniPlaceholders/renovate/nick-invision-retry-3.x
chore(deps): update nick-invision/retry action to v3
2024-02-03 21:53:50 -05:00
Adrian 36f1cce813 Merge pull request #181 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.6
2024-02-03 21:53:43 -05:00
renovate[bot] 4061c8acbe chore(deps): update dependency gradle to v8.6 2024-02-02 18:22:06 +00:00
renovate[bot] 319731cef0 chore(deps): update nick-invision/retry action to v3 2024-01-31 18:53:24 +00:00
renovate[bot] 9e29afa9c5 chore(deps): update plugin fabric-loom to v1.5.7 2024-01-25 09:35:54 +00:00
renovate[bot] 9655509c2f fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.11.0 2024-01-21 07:40:06 +00:00
renovate[bot] 26f1042d17 fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.6 2024-01-18 03:44:36 +00:00
Adrian 84c39e9205 Merge pull request #171 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.5.5
2024-01-15 21:25:24 -05:00
Adrian 77327661f3 Merge pull request #172 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.93.1+1.20.5
2024-01-15 21:25:17 -05:00
Adrian b725fd2bae Merge pull request #173 from MiniPlaceholders/renovate/org.gradle.toolchains.foojay-resolver-convention-0.x
chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.8.0
2024-01-15 21:25:10 -05:00
renovate[bot] f9a5acaaaf chore(deps): update plugin fabric-loom to v1.5.5 2024-01-13 11:05:36 +00:00
renovate[bot] fe613ce82d chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.8.0 2024-01-12 16:49:57 +00:00
renovate[bot] 21839e1e37 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.93.1+1.20.5 2024-01-12 14:14:32 +00:00
Adrian 25d1588032 Merge pull request #167 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.92.0+1.20.5
2023-12-29 19:45:03 -05:00
renovate[bot] 92583013db fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.92.0+1.20.5 2023-12-29 15:38:27 +00:00
Adrian 89a7bdb208 Merge pull request #165 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.3
2023-12-29 10:37:41 -05:00
Adrian 0e7d4cb6dd Merge pull request #169 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v1.9.22
2023-12-29 10:37:23 -05:00
renovate[bot] 159b96579f fix(deps): update kotlin monorepo to v1.9.22 2023-12-21 17:01:40 +00:00
renovate[bot] efb155a171 fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.3 2023-12-18 18:01:40 +00:00
Adrian 71ad7fb399 Merge pull request #168 from MiniPlaceholders/renovate/adventure
fix(deps): update adventure to v4.15.0
2023-12-18 07:04:22 -05:00
renovate[bot] 8b219fd553 fix(deps): update adventure to v4.15.0 2023-12-18 10:44:32 +00:00
Adrian 9899f0bab4 Merge pull request #166 from MiniPlaceholders/renovate/actions-upload-artifact-4.x
chore(deps): update actions/upload-artifact action to v4
2023-12-14 18:29:38 -05:00
renovate[bot] 7044e43483 chore(deps): update actions/upload-artifact action to v4 2023-12-14 20:59:42 +00:00
Adrian 36f1739704 Merge pull request #162 from MiniPlaceholders/renovate/actions-setup-java-4.x
chore(deps): update actions/setup-java action to v4
2023-12-12 18:11:11 -05:00
Adrian d173de4250 Merge pull request #163 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.11
2023-12-12 18:10:25 -05:00
Adrian 410fe06117 Merge pull request #164 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.4.5
2023-12-12 18:10:08 -05:00
Adrian e198769698 Merge pull request #161 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.1
2023-12-12 12:59:04 -05:00
renovate[bot] 41ff8c1e12 fix(deps): update dependency net.fabricmc:fabric-loader to v0.15.1 2023-12-11 16:06:24 +00:00
Adrian 344af47d19 Merge pull request #144 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.91.2+1.20.4
2023-12-11 11:06:00 -05:00
Adrian 756b1e9b43 Merge pull request #160 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.5
2023-12-11 11:05:48 -05:00
renovate[bot] 85b7a24770 chore(deps): update plugin fabric-loom to v1.4.5 2023-12-10 01:26:49 +00:00
renovate[bot] 7f484f33f0 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.91.2+1.20.4 2023-12-09 01:44:53 +00:00
renovate[bot] 5d21522fa7 chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.11 2023-12-08 18:53:59 +00:00
renovate[bot] 176266c9d5 chore(deps): update actions/setup-java action to v4 2023-11-29 16:22:40 +00:00
renovate[bot] c5bf073888 chore(deps): update dependency gradle to v8.5 2023-11-29 14:51:10 +00:00
Adrian f2cbd1db75 Merge pull request #159 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.25
2023-11-29 09:46:01 -05:00
renovate[bot] e995e5441e fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.25 2023-11-28 12:37:22 +00:00
Adrian f776f8ae61 Merge pull request #157 from MiniPlaceholders/renovate/org.jetbrains.kotlin.jvm-1.x
chore(deps): update plugin org.jetbrains.kotlin.jvm to v1.9.21
2023-11-27 17:04:38 -05:00
Adrian a26f92e75c Merge pull request #158 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v1.9.21
2023-11-27 17:04:30 -05:00
renovate[bot] b030f02aac fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v1.9.21 2023-11-24 07:39:15 +00:00
renovate[bot] 4336746bf3 chore(deps): update plugin org.jetbrains.kotlin.jvm to v1.9.21 2023-11-23 16:49:59 +00:00
Adrian e7e87a72dd Merge pull request #156 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.10
2023-11-21 19:11:24 -05:00
renovate[bot] 0dce995222 chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.10 2023-11-21 22:38:10 +00:00
Adrian a280cf16cb release: Version 2.2.3 2023-11-17 23:14:59 -05:00
Adrian b37fad9611 fix: Fixed native expansions placeholders nesting 2023-11-17 11:29:58 -05:00
Adrian 483ba964da license: Changed license to Apache 2 2023-11-17 08:48:17 -05:00
Adrian eaf0556bc2 Merge pull request #154 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.10.1
2023-11-17 08:38:42 -05:00
Adrian 65369e9121 Merge pull request #153 from MiniPlaceholders/renovate/runtask
chore(deps): update runtask to v2.2.2
2023-11-17 08:38:30 -05:00
renovate[bot] 9715805f59 fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.10.1 2023-11-17 04:58:24 +00:00
renovate[bot] cd375b0116 chore(deps): update runtask to v2.2.2 2023-11-14 00:56:25 +00:00
Adrian 8a03dc7dda Merge pull request #152 from MiniPlaceholders/renovate/runtask
chore(deps): update runtask to v2.2.1
2023-11-13 10:47:54 -05:00
renovate[bot] 53deb75b7a chore(deps): update runtask to v2.2.1 2023-11-13 07:09:44 +00:00
Adrian 15d8fcff71 fix: Fixed compilation
Reminder: Never make a hotfix blindly
2023-11-07 20:21:19 -05:00
Adrian bfe5607ed9 fix(velocity): Fixed proxy expansion placeholders nesting 2023-11-07 12:34:55 -05:00
Adrian 56f8305527 Merge pull request #150 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.10.1
2023-11-05 21:09:04 -05:00
renovate[bot] 7ea612dede fix(deps): update dependency org.junit:junit-bom to v5.10.1 2023-11-06 01:52:51 +00:00
Adrian 21f07b6994 release: Version 2.2.2 2023-11-04 14:20:13 -05:00
Adrian a30a3e33d1 fix(fabric): Fixed legacy serializer inclusion 2023-11-04 14:15:51 -05:00
Adrian 7ad7386dcb Merge remote-tracking branch 'origin/main' 2023-11-04 13:52:57 -05:00
Adrian bced1b15d0 misc: Updated some dependencies 2023-11-04 13:50:26 -05:00
Adrian ecf2b7290f Merge pull request #148 from MiniPlaceholders/renovate/org.jetbrains.kotlin.jvm-1.x
chore(deps): update plugin org.jetbrains.kotlin.jvm to v1.9.20
2023-11-04 09:42:53 -05:00
Adrian 8ecedfa7fc Merge pull request #149 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v1.9.20
2023-11-04 09:40:48 -05:00
Adrian 84920b1499 Merge pull request #127 from MiniPlaceholders/renovate/org.spongepowered.gradle.plugin-2.x
chore(deps): update plugin org.spongepowered.gradle.plugin to v2.2.0
2023-11-04 09:40:40 -05:00
renovate[bot] 885d91a491 chore(deps): update plugin org.spongepowered.gradle.plugin to v2.2.0 2023-11-04 14:33:55 +00:00
renovate[bot] cb39d6cce7 fix(deps): update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v1.9.20 2023-11-04 14:33:53 +00:00
renovate[bot] c426672f6d chore(deps): update plugin org.jetbrains.kotlin.jvm to v1.9.20 2023-11-04 14:33:48 +00:00
Adrian 12935d9584 fix: Update Blossom usage 2023-11-04 09:32:10 -05:00
Adrian 013f6bdf62 Merge pull request #117 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.4
2023-11-04 09:16:53 -05:00
Adrian 763a4c4a8c Merge pull request #142 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.4.4
2023-10-27 13:56:40 -05:00
Adrian b30f89a254 Merge pull request #143 from MiniPlaceholders/renovate/org.jetbrains.dokka-dokka-gradle-plugin-1.x
fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.10
2023-10-27 13:56:31 -05:00
Adrian 797f97080b Merge pull request #145 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.24
2023-10-27 13:56:22 -05:00
Adrian 6709f021ca Merge pull request #147 from MiniPlaceholders/renovate/jmh
chore(deps): update dependency me.champeau.jmh to v0.7.2
2023-10-27 13:55:55 -05:00
renovate[bot] ea339fffb3 chore(deps): update dependency me.champeau.jmh to v0.7.2 2023-10-27 16:54:53 +00:00
Adrian 600f5c4381 Merge pull request #146 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.9
2023-10-26 21:54:25 -05:00
renovate[bot] 8a3b80de09 chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.9 2023-10-26 23:00:49 +00:00
renovate[bot] 2100f66d73 fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.24 2023-10-25 01:27:31 +00:00
renovate[bot] 7591a25f03 chore(deps): update plugin fabric-loom to v1.4.4 2023-10-22 13:37:10 +00:00
renovate[bot] 7003a4e077 fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.10 2023-10-17 09:13:01 +00:00
Adrian b99b34f70d Merge pull request #141 from MiniPlaceholders/renovate/dokka
chore(deps): update dependency org.jetbrains.dokka to v1.9.10
2023-10-16 09:56:06 -05:00
renovate[bot] a390ec1f18 chore(deps): update dependency org.jetbrains.dokka to v1.9.10 2023-10-16 13:57:31 +00:00
Adrian 52e546420d Merge pull request #137 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.8
2023-10-12 23:41:36 -05:00
Adrian 633f46c13d Merge pull request #140 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.90.1+1.20.3
2023-10-12 23:41:29 -05:00
renovate[bot] cfe2a04b5c fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.90.1+1.20.3 2023-10-12 07:02:25 +00:00
renovate[bot] dc157f44ff chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.8 2023-10-10 01:52:00 +00:00
Adrian 721b41b1bd Merge pull request #138 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.23
2023-10-08 10:28:19 -05:00
renovate[bot] b0c0fdb8c7 fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.23 2023-10-08 15:05:34 +00:00
Adrian 845c57bf66 Merge pull request #139 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.4+1.20.3
2023-10-08 10:05:14 -05:00
renovate[bot] 5cf03e3553 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.4+1.20.3 2023-10-06 03:22:57 +00:00
renovate[bot] 2e0a4492d3 chore(deps): update dependency gradle to v8.4 2023-10-05 01:37:17 +00:00
Adrian 275941f96b Merge pull request #136 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.3+1.20.2
2023-10-01 22:06:53 -05:00
renovate[bot] 43cc9813e2 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.3+1.20.2 2023-10-02 01:17:12 +00:00
Adrian 7083f3ac4a Merge pull request #135 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.4.1
2023-09-26 17:08:18 -05:00
renovate[bot] dab6d1aeb6 chore(deps): update plugin fabric-loom to v1.4.1 2023-09-26 10:18:10 +00:00
Adrian 82640a8adc Merge pull request #134 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.2+1.20.2
2023-09-23 23:25:56 -05:00
renovate[bot] 3dec1a56ac fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.2+1.20.2 2023-09-23 22:44:24 +00:00
Adrian bfafcc8e4e Merge pull request #131 from MiniPlaceholders/renovate/runtask
chore(deps): update runtask to v2.2.0
2023-09-23 09:17:49 -05:00
Adrian 22f4981296 Merge pull request #133 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.10.0
2023-09-23 09:17:24 -05:00
renovate[bot] 59bf4d12f3 fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.10.0 2023-09-22 23:12:47 +00:00
Adrian f7a09a627f Merge pull request #132 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.1+1.20.2
2023-09-21 21:17:05 -05:00
renovate[bot] bfddcebda7 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.1+1.20.2 2023-09-21 22:43:33 +00:00
renovate[bot] 55b43aa268 chore(deps): update runtask to v2.2.0 2023-09-21 09:58:48 +00:00
Adrian 8d9643bd31 Merge pull request #130 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.0+1.20.2
2023-09-19 22:04:30 -05:00
renovate[bot] 3ffb2706f5 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.89.0+1.20.2 2023-09-18 19:29:49 +00:00
Adrian 26d3857628 Merge pull request #129 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.88.5+1.20.2
2023-09-16 20:16:25 -05:00
renovate[bot] 2f5393f91f fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.88.5+1.20.2 2023-09-15 20:19:45 +00:00
Adrian 4dd08d7fe4 Merge pull request #121 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.88.4+1.20.2
2023-09-15 12:05:15 -05:00
Adrian 3c6f7c3369 Merge pull request #126 from MiniPlaceholders/renovate/cloud
fix(deps): update cloud to v1.8.4
2023-09-15 12:05:02 -05:00
renovate[bot] 0b2e0206d5 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.88.4+1.20.2 2023-09-13 21:56:28 +00:00
renovate[bot] 66aba20ac2 fix(deps): update cloud to v1.8.4 2023-09-09 11:23:32 +00:00
Adrian 323d89dc97 Merge pull request #120 from MiniPlaceholders/renovate/indra
fix(deps): update indra to v3.1.3
2023-09-07 11:04:09 -05:00
Adrian e6a1093cc0 Merge pull request #125 from MiniPlaceholders/renovate/actions-checkout-4.x
chore(deps): update actions/checkout action to v4
2023-09-04 20:56:27 -05:00
renovate[bot] 9778d6fed3 chore(deps): update actions/checkout action to v4 2023-09-04 15:10:12 +00:00
Adrian 4411d1bcdc Merge pull request #122 from MiniPlaceholders/renovate/dokka
chore(deps): update dependency org.jetbrains.dokka to v1.9.0
2023-09-03 12:52:24 -05:00
Adrian cf74ae9392 Merge pull request #123 from MiniPlaceholders/renovate/org.jetbrains.dokka
fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.0
2023-09-03 12:52:04 -05:00
renovate[bot] 207d79f5c2 fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.9.0 2023-08-31 22:49:25 +00:00
renovate[bot] 57d91ed5e9 chore(deps): update dependency org.jetbrains.dokka to v1.9.0 2023-08-31 22:49:21 +00:00
renovate[bot] 2416cdae68 fix(deps): update indra to v3.1.3 2023-08-29 01:35:44 +00:00
Adrian 38cb9dd9d9 Merge pull request #119 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v1.9.10
2023-08-23 15:03:17 -05:00
renovate[bot] d2ce5c0931 fix(deps): update kotlin monorepo to v1.9.10 2023-08-23 14:08:18 +00:00
Adrian 1441177841 Merge pull request #116 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.87.1+1.20.2
2023-08-18 23:30:40 -05:00
renovate[bot] f03a9e17fb fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.87.1+1.20.2 2023-08-18 11:26:43 +00:00
Adrian 80da7b3c11 Merge pull request #118 from MiniPlaceholders/renovate/org.gradle.toolchains.foojay-resolver-convention-0.x
chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.7.0
2023-08-17 14:13:27 -05:00
renovate[bot] 938e6b1abb chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.7.0 2023-08-17 14:14:23 +00:00
Adrian c3cf3ec4e3 Merge pull request #114 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.3+1.20.2
2023-08-12 22:59:00 -05:00
Adrian 5e08e0bc2c Merge pull request #115 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.3.9
2023-08-12 22:58:53 -05:00
renovate[bot] 8fd72d5e2b fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.3+1.20.2 2023-08-12 07:49:54 +00:00
renovate[bot] d4492cec47 chore(deps): update plugin fabric-loom to v1.3.9 2023-08-10 17:30:46 +00:00
Adrian 6dcc96955c Merge pull request #113 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.1+1.20.2
2023-08-08 08:33:38 -05:00
renovate[bot] 0b9b261ce0 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.1+1.20.2 2023-08-08 06:18:43 +00:00
Adrian f6705b9ee6 Merge pull request #112 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.22
2023-08-05 17:46:36 -05:00
renovate[bot] e4cdd6feae fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.22 2023-08-03 05:06:13 +00:00
Adrian 879fa06672 Merge pull request #110 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.10.0
2023-07-27 09:03:16 -05:00
Adrian 518659b8d3 Merge pull request #111 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.1+1.20.1
2023-07-27 09:03:04 -05:00
renovate[bot] 85141b6fa6 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.1+1.20.1 2023-07-26 01:42:47 +00:00
renovate[bot] 976a05f458 fix(deps): update dependency org.junit:junit-bom to v5.10.0 2023-07-23 13:42:57 +00:00
Adrian 998828138b release: Version 2.2.1 2023-07-19 16:37:35 -05:00
Adrian 638acd9e88 fix(build): Fixed some deprecations 2023-07-19 16:13:53 -05:00
Adrian 5c0850dbdd Merge pull request #109 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.0+1.20.1
2023-07-19 15:01:03 -05:00
renovate[bot] 8a5415c37d fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.86.0+1.20.1 2023-07-18 23:04:47 +00:00
Adrian b5c6afa368 Merge pull request #105 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.2.1
2023-07-17 22:34:18 -05:00
Adrian 4bcf85d718 Merge pull request #107 from MiniPlaceholders/renovate/major-krypton
fix(deps): update krypton to v7796647145 (major)
2023-07-17 22:31:13 -05:00
Adrian 548187238e feat: Add more Legacy API parsing 2023-07-17 17:02:31 -05:00
Adrian c7845cec0b fix: Fixed legacy chars replacement in LegacyUtils 2023-07-17 16:07:05 -05:00
Adrian ab3316bcf1 Merge pull request #108 from MiniPlaceholders/renovate/adventurefabric
fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.9.0
2023-07-16 22:48:08 -05:00
renovate[bot] 33b09e85d7 fix(deps): update dependency net.kyori:adventure-platform-fabric to v5.9.0 2023-07-16 22:42:49 +00:00
Adrian 4b6110aa2b Merge pull request #106 from MiniPlaceholders/renovate/org.gradle.toolchains.foojay-resolver-convention-0.x
chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.6.0
2023-07-15 15:34:33 -05:00
renovate[bot] e404a158e7 fix(deps): update krypton 2023-07-12 00:05:10 +00:00
renovate[bot] 981901271c chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.6.0 2023-07-10 14:06:18 +00:00
renovate[bot] 3f93840e5a chore(deps): update dependency gradle to v8.2.1 2023-07-10 14:06:14 +00:00
Adrian 4d5e45e9eb Merge pull request #102 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.3.8
2023-07-10 09:00:56 -05:00
Adrian be8e6d268e Merge pull request #103 from MiniPlaceholders/renovate/indra
fix(deps): update indra to v3.1.2
2023-07-10 09:00:48 -05:00
Adrian b89799ff75 Merge pull request #104 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v1.9.0
2023-07-08 14:55:11 -05:00
renovate[bot] 10cb91ac56 chore(deps): update plugin fabric-loom to v1.3.8 2023-07-06 16:18:47 +00:00
renovate[bot] b7d190ce7f fix(deps): update kotlin monorepo to v1.9.0 2023-07-06 07:41:06 +00:00
renovate[bot] e028a3bada fix(deps): update indra to v3.1.2 2023-07-06 04:31:53 +00:00
Adrian f339248ad3 Merge pull request #101 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.85.0+1.20.1
2023-07-04 07:15:33 -05:00
Adrian b8a6f9b746 Merge pull request #100 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.3.5
2023-07-04 07:15:24 -05:00
renovate[bot] 3d45362241 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.85.0+1.20.1 2023-07-03 22:53:35 +00:00
renovate[bot] 859047762c chore(deps): update plugin fabric-loom to v1.3.5 2023-07-03 18:53:44 +00:00
Adrian 63a95961f8 Merge pull request #99 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.3.4
2023-07-03 11:30:10 -05:00
renovate[bot] f3c5540d15 chore(deps): update plugin fabric-loom to v1.3.4 2023-07-02 22:48:18 +00:00
Adrian fcbf2e9454 Merge pull request #98 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.2
2023-06-30 13:53:48 -05:00
renovate[bot] ae993a34e0 chore(deps): update dependency gradle to v8.2 2023-06-30 18:39:15 +00:00
Adrian eba9aa8e0e Merge pull request #97 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.3.2
2023-06-27 20:22:50 -05:00
renovate[bot] 04b86d4a56 chore(deps): update plugin fabric-loom to v1.3.2 2023-06-27 22:13:13 +00:00
Adrian 53402d3c1d Merge pull request #95 from MiniPlaceholders/renovate/pluginyml
chore(deps): update dependency net.minecrell.plugin-yml.bukkit to v0.6.0
2023-06-27 12:31:09 -05:00
Adrian 7634c37ad4 Merge pull request #93 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.84.0+1.20.1
2023-06-27 12:31:00 -05:00
Adrian 26125abef2 Merge pull request #94 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.2.7
2023-06-27 12:30:53 -05:00
Adrian 93182688e2 Merge pull request #92 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v1.8.22
2023-06-27 12:30:46 -05:00
renovate[bot] a67b23079d fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.84.0+1.20.1 2023-06-23 21:31:16 +00:00
renovate[bot] 79bffc2522 chore(deps): update dependency net.minecrell.plugin-yml.bukkit to v0.6.0 2023-06-19 13:34:14 +00:00
renovate[bot] 7e9aa41fdd chore(deps): update plugin fabric-loom to v1.2.7 2023-06-14 15:38:33 +00:00
renovate[bot] cc30f56c76 fix(deps): update kotlin monorepo to v1.8.22 2023-06-07 20:14:59 +00:00
Adrian b24ddb12cc Merge pull request #91 from MiniPlaceholders/renovate/adventure
fix(deps): update adventure to v4.14.0
2023-06-07 08:08:17 -05:00
renovate[bot] 2df52bf858 fix(deps): update adventure to v4.14.0 2023-06-07 11:44:20 +00:00
Adrian dd64837958 Merge pull request #89 from MiniPlaceholders/renovate/dokka
chore(deps): update dependency org.jetbrains.dokka to v1.8.20
2023-06-06 11:35:58 -05:00
Adrian ccf3045cb3 Merge pull request #90 from MiniPlaceholders/renovate/org.jetbrains.dokka
fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.8.20
2023-06-06 11:35:48 -05:00
renovate[bot] 34cab56b2c fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.8.20 2023-06-05 21:13:02 +00:00
renovate[bot] 7090497684 chore(deps): update dependency org.jetbrains.dokka to v1.8.20 2023-06-05 21:12:58 +00:00
Adrian 4fefeda34d Merge pull request #88 from MiniPlaceholders/renovate/fabric.api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.83.0+1.20
2023-06-04 10:08:11 -05:00
renovate[bot] 9ec693ae16 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.83.0+1.20 2023-06-04 14:26:34 +00:00
Adrian 36039dd0f6 Merge pull request #87 from MiniPlaceholders/renovate/fabric.loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.21
2023-06-04 09:25:59 -05:00
renovate[bot] 7295ce2b6c fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.21 2023-06-04 14:16:25 +00:00
Adrian 82987e54f1 Merge pull request #84 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.82.0+1.20
2023-05-25 19:46:24 -05:00
renovate[bot] 19da3e8050 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.82.0+1.20 2023-05-25 01:16:06 +00:00
Adrian 440efc5d8a Merge pull request #83 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.81.3+1.20
2023-05-24 12:52:16 -05:00
renovate[bot] b8e9cf3b07 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.81.3+1.20 2023-05-24 01:43:18 +00:00
Adrian eb34c410e0 Merge pull request #80 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.81.2+1.20
2023-05-23 17:19:20 -05:00
renovate[bot] 866767f08f fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.81.2+1.20 2023-05-23 01:44:45 +00:00
Adrian 9c175b8ffd Merge pull request #82 from MiniPlaceholders/renovate/fabric-loader
fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.20
2023-05-22 20:44:01 -05:00
renovate[bot] f3460dbc51 fix(deps): update dependency net.fabricmc:fabric-loader to v0.14.20 2023-05-23 00:00:28 +00:00
Adrian a8671bbcd2 Merge pull request #79 from MiniPlaceholders/renovate/indra
fix(deps): update indra to v3.1.1
2023-05-17 08:36:58 -05:00
Adrian 47f17eb199 fix: Check Tag equality using String#equalsIgnoreCase 2023-05-15 22:49:23 -05:00
Adrian f92df0f0dd Merge remote-tracking branch 'origin/main' 2023-05-15 22:46:09 -05:00
Adrian 1ccf5ce3ec fix: Improved encapsulation of the Expansion class by converting it to a sealed interface 2023-05-15 22:45:50 -05:00
renovate[bot] 9dad10c46a fix(deps): update indra to v3.1.1 2023-05-14 20:42:18 +00:00
Adrian b87e7bc50f Merge pull request #78 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.80.3+1.20
2023-05-13 11:43:44 -05:00
Adrian 103bdf9a78 release: Version 2.2.0 2023-05-13 11:20:23 -05:00
Adrian 58391bd263 fix(ci): Fixed upload action 2023-05-13 11:16:30 -05:00
Adrian 1405925a43 fix: Fixed javadoc invalid character 2023-05-13 11:13:53 -05:00
Adrian bc6d51e07c api: Improved conditional API methods 2023-05-13 10:43:56 -05:00
Adrian 0048eb1186 perf: Reuse empty arrays 2023-05-13 10:42:27 -05:00
Adrian 3f00242d1a fix(api): Fixed possible NPE if the forwarded audience is null 2023-05-13 10:20:26 -05:00
renovate[bot] 89573967fd fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.80.3+1.20 2023-05-11 20:51:15 +00:00
Adrian 18d8538144 Merge pull request #77 from MiniPlaceholders/build/module-jars
Split platforms into separate files
2023-05-09 22:26:55 -05:00
Adrian c6a2739162 Merge branch 'main' into build/module-jars
# Conflicts:
#	fabric/build.gradle.kts
2023-05-09 21:28:57 -05:00
Adrian 42049dc7d7 fix(test): Fixed Junit Jupiter and Plain Serializer test dependencies 2023-05-09 21:22:11 -05:00
Adrian 94bd9180f7 fix(sponge): Fixed Geantyref inclusion 2023-05-09 21:11:45 -05:00
Adrian 3ea331f00a build: Split platforms into separate files 2023-05-05 17:03:20 -05:00
Adrian 98e27c85d2 Merge pull request #76 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.2.7
2023-05-05 12:27:59 -05:00
renovate[bot] c48e42c21d chore(deps): update plugin fabric-loom to v1.2.7 2023-05-05 15:27:09 +00:00
Adrian 18901c887c Merge pull request #68 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.80.1+1.20
2023-05-04 15:40:53 -05:00
Adrian 218bfc0bab Merge pull request #73 from MiniPlaceholders/feat/platform/sponge
Sponge Implementation
2023-05-04 13:59:31 -05:00
Adrian dba1bbe0d5 Merge pull request #72 from MiniPlaceholders/renovate/desertwell
fix(deps): update dependency net.william278:desertwell to v2.0.4
2023-05-03 21:01:33 -05:00
Adrian 6be0f99a85 feat: Initial Sponge Implementation 2023-05-03 20:43:47 -05:00
renovate[bot] b65c83eb69 fix(deps): update dependency net.william278:desertwell to v2.0.4 2023-05-04 01:22:35 +00:00
renovate[bot] 96836270d6 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.80.1+1.20 2023-05-03 20:32:09 +00:00
Adrian d94c3c5bba Merge pull request #71 from MiniPlaceholders/feat/cloud
Cloud Implementation
2023-05-03 15:30:27 -05:00
Adrian c780a1bb8f [ci skip] build: Exclude Fabric/run directory 2023-05-03 15:14:55 -05:00
Adrian 9954cf36db fix: Fixed Fabric libs inclusion and Plugin relocations 2023-05-03 13:51:52 -05:00
Adrian 15aa2779c8 fix: Fixed Source suggestions 2023-05-03 12:48:44 -05:00
Adrian b1fa65d335 feat: Initial Cloud Implementation 2023-05-02 22:13:56 -05:00
Adrian dd4af51264 Merge pull request #70 from MiniPlaceholders/feat/forwarding-audience-support
Added Support for passing ForwardingAudience.Single instead of the actual instance
2023-05-02 17:02:41 -05:00
Adrian ac138706b7 feat: Added Support for passing ForwardingAudience.Single instead of the actual instance 2023-05-02 16:36:11 -05:00
Adrian 888df22b1f test: Add Empty Arguments test 2023-05-02 16:02:33 -05:00
Adrian 98048622c6 Merge pull request #69 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.2.6
2023-05-02 08:30:33 -05:00
renovate[bot] 6ba68553c6 chore(deps): update plugin fabric-loom to v1.2.6 2023-05-02 11:42:56 +00:00
Adrian 6aa65a6a95 Merge pull request #66 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.9.3
2023-04-26 16:32:00 -05:00
Adrian 37a7ece2d3 Merge pull request #67 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.5
2023-04-26 16:30:31 -05:00
renovate[bot] 4d5f6a2928 chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.5 2023-04-26 20:57:13 +00:00
renovate[bot] 65f7a9652c fix(deps): update dependency org.junit:junit-bom to v5.9.3 2023-04-26 11:41:54 +00:00
128 changed files with 4729 additions and 2539 deletions

No files matched your search

+8 -10
View File
@@ -8,26 +8,24 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: 17
distribution: 'temurin'
java-version: 25
distribution: 'zulu'
cache: 'gradle'
- name: Build with Gradle
uses: nick-invision/retry@v2
uses: nick-invision/retry@v4
with:
timeout_minutes: 10
max_attempts: 2
command: gradle build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
name: MiniPlaceholders
path: |-
build/libs/MiniPlaceholders-*.jar
fabric/build/libs/MiniPlaceholders-Fabric-mc*.jar
path: jar/MiniPlaceholders-*.jar
+1
View File
@@ -2,6 +2,7 @@
/.idea/
build/
bin/
jar/
# Visual Studio Code
+1 -1
View File
@@ -1,3 +1,3 @@
FROM gitpod/workspace-full
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.1.fx-zulu"
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && sdk install java 21.0.6.fx-zulu"
+42
View File
@@ -0,0 +1,42 @@
<!--
MiniPlaceholders Changelog
-->
## 3.2.0 (unreleased)
### Features
- Added support to Fabric 26.1+
- Added Minestom support
### Fixes
### API Additions
## 3.1.0 (10/10/2025)
### Features
- [feat: Sponge commands implementation](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/7633ada70ed62571b707cbf709fbb5c027c44f46)
- [feat: Implement parserel subcommand](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/ea725a81210911a8779545781b56a647d6b84cf3)
- [feat: Add --null argument to parse node](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/3cdb7de9f2e675f494c84df693142a817535fe9a)
- [misc: Added bstats metrics](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/f648dd8f836d5f2911eaf0bc53f6769ed2a0fdcc)
### Fixes
- [fix: Fixed multiple loading expansions](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/f67690f41347031a32d4acd7bb4bb493b42bb4f9)
- [fix: Added nullability checks to RelationalAudience](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/8aec3e592ff6774737602a3a3a6187ddb577a681)
- [fix: Fixed command formatting](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/de7d14d55d6aeff8dbaf1706dd06bb6812b54390)
### API Additions
- [feat: Added LoadRequirement#requiredClass and LoadRequirement#anyOf](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/31ee16e41234cabf992736f81eda5bbbdc09d954)
- [docs: Replaced some uses of JetBrains annotations with jspecify](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/0f48a4baed91ec5d0fe285649822f189e69a5b57)
- [feat: Allow the use of injected constructors when creating an ExpansionProvider](https://github.com/MiniPlaceholders/MiniPlaceholders/commit/bf995b71030064a174532d38282407ab6baa7170)
+201 -674
View File
@@ -1,674 +1,201 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 4drian3d
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+19 -35
View File
@@ -1,45 +1,31 @@
# MiniPlaceholders
[![WorkFlow](https://img.shields.io/github/actions/workflow/status/MiniPlaceholders/MiniPlaceholders/build.yml?style=flat-square)](https://github.com/MiniPlaceholders/MiniPlaceholders/actions)
[![GitHub WorkFlow](https://img.shields.io/github/actions/workflow/status/MiniPlaceholders/MiniPlaceholders/build.yml?logo=GitHub&style=flat-square)](https://github.com/MiniPlaceholders/MiniPlaceholders/actions)
[![Jenkins Build](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.codemc.io%2Fjob%2FMiniPlaceholders%2Fjob%2FMiniPlaceholders%2F&style=flat-square&logo=jenkins)](https://ci.codemc.io/job/MiniPlaceholders/job/MiniPlaceholders/)
![Latest Version](https://img.shields.io/github/v/release/MiniPlaceholders/MiniPlaceholders?style=flat-square)
[![Discord](https://img.shields.io/discord/899740810956910683?color=7289da&logo=Discord&label=Discord&style=flat-square)](https://discord.gg/5NMMzK5mAn)
![Modrinth Downloads](https://img.shields.io/modrinth/dt/HQyibRsN?logo=Modrinth&style=flat-square)
![GitHub Downloads](https://img.shields.io/github/downloads/MiniPlaceholders/MiniPlaceholders/total?logo=GitHub&style=flat-square)
MiniMessage Component-based Placeholders for PaperMC, Folia, Fabric, Krypton and Velocity platforms
MiniMessage Component-based Placeholders API for Minecraft Platforms.
## Compatibility
- Paper 1.19.4+
- Folia 1.19.4
- Velocity 3.1.2+
- Fabric
- Krypton
## Commands
### Velocity
- `/vminiplaceholders parse me "[message with placeholders]"`
- `/vminiplaceholders parse player [some-player] "[message with placeholders]"`
### Paper | Folia | Fabric | Krypton
- `/miniplaceholders <parse|help> player [some-player] "[message with placeholders]`
- `/miniplaceholders parse player [some-player] "[message with placeholders]"`
#### Example:
- `/miniplaceholders parse me "<player_xp>"`
- `/vminiplaceholders parse player 4drian3d "<player_name>"`
- Paper 1.21+
- Velocity 3.5+
- Fabric 26.1+
- Sponge API 12+
- Minestom 1.21.11+
## User Usage
Check our user usage wiki [here](https://github.com/MiniPlaceholders/MiniPlaceholders/wiki/User-Getting-Started)
Check our user usage wiki [here](https://miniplaceholders.github.io/docs/user-guide/User-Getting-Started)
## API
Check the available [Javadocs](https://javadoc.io/doc/io.github.miniplaceholders/miniplaceholders-api)
Or check the [Developer Wiki](https://github.com/MiniPlaceholders/MiniPlaceholders/wiki/Developer-Getting-Started)
Or check the [Developer Wiki](https://miniplaceholders.github.io/docs/developer-guide/Developer-Getting-Started)
### Java
```java
@@ -47,9 +33,7 @@ Or check the [Developer Wiki](https://github.com/MiniPlaceholders/MiniPlaceholde
class Main {
public static void registerExpansion() {
final Expansion expansion = Expansion.builder("my-expansion")
.filter(Player.class)
.audiencePlaceholder("name", (audience, ctx, queue) -> {
final Player player = (player) audience;
.audiencePlaceholder(Player.class, "name", (player, ctx, queue) -> {
return Tag.selfClosingInserting(player.getName());
})
.globalPlaceholder("tps", (ctx, queue) ->
@@ -59,8 +43,8 @@ class Main {
expansion.register();
Player player;
final TagResolver playerResolver = MiniPlaceholders.getAudiencePlaceholders(player);
player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", playerResolver));
final TagResolver playerResolver = MiniPlaceholders.audiencePlaceholders();
player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", player, playerResolver));
}
}
@@ -70,10 +54,10 @@ class Main {
```kotlin
fun register() {
val expansion = expansion("my-expansion") {
audiencePlaceholder("name") { aud, _, _ ->
audience<Player>("name") { player, _, _ ->
aud.getName().asClosingTag()
}
globalPlaceholder("tps") { _, _ ->
global("tps") { _, _ ->
Component.text(Bukkit.getTps()[0]).asInsertingTag()
}
}
@@ -81,7 +65,7 @@ fun register() {
expansion.register()
val player: Player
val playerResolver = MiniPlaceholders.getAudiencePlaceholders(player)
player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", playerResolver))
val playerResolver = MiniPlaceholders.audiencePlaceholders()
player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", player, playerResolver))
}
```
+78 -30
View File
@@ -1,28 +1,28 @@
plugins {
alias(libs.plugins.jmh)
id("miniplaceholders.publish")
import java.time.LocalDate
plugins {
id("miniplaceholders.base")
alias(libs.plugins.jmh)
`java-library`
id("com.vanniktech.maven.publish")
}
dependencies {
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.minimesssage)
compileOnly("net.kyori:adventure-text-serializer-legacy:4.13.1")
compileOnly(libs.adventure.minimessage)
compileOnly(libs.adventure.serializer.legacy)
compileOnly(projects.miniplaceholdersConnect)
testImplementation(platform("org.junit:junit-bom:5.9.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation(libs.adventure.api)
testImplementation(libs.adventure.minimesssage)
testImplementation("net.kyori:adventure-text-serializer-plain:4.13.1")
}
compileOnlyApi(libs.unnamedinject)
tasks {
test {
useJUnitPlatform()
testLogging {
events("passed", "failed")
}
}
testImplementation(platform(libs.junit.bom))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation(libs.adventure.api)
testImplementation(libs.adventure.minimessage)
testImplementation(libs.adventure.serializer.plain)
testImplementation(libs.adventure.serializer.legacy)
compileOnly(libs.jspecify)
}
jmh {
@@ -31,24 +31,72 @@ jmh {
fork.set(2)
}
java {
withJavadocJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
processResources {
filteringCharset = Charsets.UTF_8.name()
}
javadoc {
options.encoding = Charsets.UTF_8.name()
(options as StandardJavadocDocletOptions).links(
val o = options as StandardJavadocDocletOptions
o.encoding = Charsets.UTF_8.name()
o.links(
"https://jd.advntr.dev/api/${libs.versions.adventure.get()}/",
"https://jd.advntr.dev/text-minimessage/${libs.versions.adventure.get()}/"
"https://jd.advntr.dev/text-minimessage/${libs.versions.adventure.get()}/",
"https://javadoc.io/doc/org.jspecify/jspecify/latest/"
)
o.tags(
"apiNote:a:API Note:",
"implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:",
"sinceMinecraft:a:Since Minecraft:"
)
}
compileTestJava {
options.encoding = Charsets.UTF_8.name()
}
test {
useJUnitPlatform()
testLogging {
events("passed", "failed")
}
}
}
mavenPublishing {
publishToMavenCentral()
signAllPublications()
coordinates(project.group as String, "miniplaceholders-api", project.version as String)
pom {
name.set(project.name)
description.set(project.description)
inceptionYear.set(LocalDate.now().year.toString())
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("4drian3d")
name.set("Adrian Gonzales")
email.set("adriangonzalesval@gmail.com")
}
}
scm {
connection.set("scm:git:https://github.com/MiniPlaceholders/MiniPlaceholders.git")
developerConnection.set("scm:git:ssh://git@github.com/MiniPlaceholders/MiniPlaceholders.git")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
}
ciManagement {
name.set("GitHub Actions")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/actions")
}
issueManagement {
name.set("GitHub")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/issues")
}
}
}
@@ -12,39 +12,46 @@ import org.openjdk.jmh.annotations.State;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
@SuppressWarnings("unused")
@State(Scope.Benchmark)
public class PlaceholderBenchmark {
@Benchmark
public void placeholderBench(){
BenchAudience player = new BenchAudience("4drian3d");
Expansion.Builder expansion = Expansion.builder("benchmark")
@Benchmark
public void placeholderBench() {
BenchAudience player = new BenchAudience("4drian3d");
Expansion.Builder expansion = Expansion.builder("benchmark")
.audiencePlaceholder(
"name", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((BenchAudience)aud).getName()))
BenchAudience.class,
"name",
(aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(aud.getName()))
)
.audiencePlaceholder(
"uuid", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((BenchAudience)aud).getUUID().toString()))
BenchAudience.class,
"uuid",
(aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(aud.getUUID().toString()))
)
.audiencePlaceholder(
"tablistfooter", (aud, queue, ctx) ->Tag.selfClosingInserting(Component.text("footer"))
"tablistfooter",
(aud, queue, ctx) -> Tag.selfClosingInserting(Component.text("footer"))
);
Expansion expansionBuilded = expansion.build();
expansionBuilded.audiencePlaceholders(player);
final TagResolver resolvers = MiniPlaceholders.getAudiencePlaceholders(player);
Expansion expansionBuilded = expansion.build();
expansionBuilded.register();
final TagResolver resolvers = MiniPlaceholders.audiencePlaceholders();
MiniMessage.miniMessage().deserialize("Player Name: <benchmark-name>", resolvers);
}
MiniMessage.miniMessage().deserialize("Player Name: <benchmark_name>", player, resolvers);
}
@Benchmark
public void singleBench(){
Expansion.builder("single")
.globalPlaceholder("servername", (queue, ctx) -> Tag.selfClosingInserting(Component.text("Peruviankkit")))
@Benchmark
public void singleBench() {
Expansion.builder("single")
.globalPlaceholder("servername",
(queue, ctx) -> Tag.selfClosingInserting(Component.text("Peruviankkit")))
.build()
.register();
TagResolver resolvers = MiniPlaceholders.getGlobalPlaceholders();
TagResolver resolvers = MiniPlaceholders.globalPlaceholders();
MiniMessage.miniMessage().deserialize("Server name: <single-servername>", resolvers);
}
MiniMessage.miniMessage().deserialize("Server name: <single_servername>", resolvers);
}
}
@@ -1,20 +1,22 @@
package io.github.miniplaceholders.api;
import io.github.miniplaceholders.api.placeholder.AudiencePlaceholder;
import io.github.miniplaceholders.api.placeholder.GlobalPlaceholder;
import io.github.miniplaceholders.api.placeholder.RelationalPlaceholder;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import io.github.miniplaceholders.api.resolver.AudienceTagResolver;
import io.github.miniplaceholders.api.resolver.GlobalTagResolver;
import io.github.miniplaceholders.api.resolver.RelationalTagResolver;
import io.github.miniplaceholders.api.types.PlaceholderType;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.builder.AbstractBuilder;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Contract;
import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NullMarked;
import java.util.Collection;
/**
* Expansion that contains placeholders
@@ -23,33 +25,49 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
* <pre>
* Player player = event.getPlayer();
* Expansion.Builder builder = Expansion.builder("player")
* .audiencePlaceholder("name", (p, queue, ctx) -> Tag.selfClosingInserting(Component.text(((Player)p).getUsername()))
* .resolver(Player.class, "name", (p, queue, ctx) -> Tag.selfClosingInserting(Component.text(p.getUsername()))
* .build();
* Expansion expansion = builder.build();
* // You can also call the {@link Expansion#register} method to register
* // the {@link Expansion} in the {@link MiniPlaceholders} global Extensions and
* // use it in {@link MiniPlaceholders#getAudiencePlaceholders(Audience)} e.g.
* TagResolver resolver = expansion.audiencePlaceholder(player);
* player.sendMessage(MiniMessage.miniMessage().deserialize("Hello {@literal <luckperms_prefix> <player_name>}", resolver));
* // use it in {@link MiniPlaceholders#audiencePlaceholders()} e.g.
* TagResolver resolver = expansion.resolver();
* player.sendMessage(MiniMessage.miniMessage().deserialize("Hello {@literal <luckperms_prefix> <player_name>}", player, resolver));
* </pre>
*
* @since 1.0.0
*/
public interface Expansion {
public sealed interface Expansion permits ExpansionImpl {
/**
* Get the expansion name
*
* @return the expansion name
* @since 1.0.0
*/
@NotNull String name();
String name();
/**
* Get the {@link TagResolver} of the desired {@link Audience}
* @param audience the audience
* Get the author of this expansion
*
* @return the author or null
* @since 2.3.0
*/
@Nullable String author();
/**
* Get the version of this expansion
*
* @return the version or null
* @since 2.3.0
*/
@Nullable String version();
/**
* Get the {@link TagResolver} of an {@link Audience}
* @return A TagResolver with variable placeholders of an Audience
* @since 1.0.0
*/
@NotNull TagResolver audiencePlaceholders(final @NotNull Audience audience);
TagResolver audiencePlaceholders();
/**
* Get the relational placeholders based on two audiences
@@ -57,19 +75,17 @@ public interface Expansion {
* <p>The resulting TagResolver will give results according
* to the 2 {@link Audience} provided and when called
* at any time will retrieve the required values</p>
* @param audience the main audience
* @param otherAudience the secondary audience
* @return A TagResolver with variable placeholders between 2 {@link Audience}s
* @since 1.0.0
*/
@NotNull TagResolver relationalPlaceholders(final @NotNull Audience audience, final @NotNull Audience otherAudience);
TagResolver relationalPlaceholders();
/**
* Get global placeholders
* @return the global placeholders
* @since 1.0.0
*/
@NotNull TagResolver globalPlaceholders();
TagResolver globalPlaceholders();
/**
* Register this expansion
@@ -94,16 +110,129 @@ public interface Expansion {
*/
boolean registered();
/**
* Get the registered audience placeholders
*
* @return registered audience placeholders
*/
Collection<AudiencePlaceholder<?>> registeredAudiencePlaceholders();
/**
* Get the registered relational placeholders
*
* @return registered relational placeholders
*/
Collection<RelationalPlaceholder<?>> registeredRelationalPlaceholders();
/**
* Get an Audience Placeholder by name
*
* <pre>{@code
* Expansion expansion = MiniPlaceholders.expansionByName("player")
* AudiencePlaceholder<?> placeholder = expansion.audiencePlaceholderByName("name");
* }</pre>
* @param name the name of the placeholder to search
* @return the desired placeholder or null
*/
@Nullable AudiencePlaceholder<?> audiencePlaceholderByName(final String name);
/**
* Get a Relational Placeholder by name
*
* <pre>{@code
* Expansion expansion = MiniPlaceholders.expansionByName("expansion")
* RelationalPlaceholder<?> placeholder = expansion.relationalPlaceholderByName("placeholder");
* }</pre>
* @param name the name of the placeholder to search
* @return the desired placeholder or null
* @apiNote The name of a relational placeholder does not contain the prefix “rel”,
* just the name assigned when it was created
*/
@Nullable RelationalPlaceholder<?> relationalPlaceholderByName(final String name);
/**
* Get a Global Placeholder by name
*
* <pre>{@code
* Expansion expansion = MiniPlaceholders.expansionByName("player")
* GlobalPlaceholder placeholder = expansion.globalPlaceholderByName("name");
* }</pre>
* @param name the name of the placeholder to search
* @return the desired placeholder or null
*/
@Nullable GlobalPlaceholder globalPlaceholderByName(final String name);
/**
* Checks whether an audience placeholder with the specified name has been registered in this expansion.
*
* @param name the name of the placeholder to check
* @return true if the placeholder is registered, else false
*/
default boolean hasAudiencePlaceholder(final String name) {
return audiencePlaceholderByName(name) != null;
}
/**
* Checks whether a relational placeholder with the specified name has been registered in this expansion.
*
* @param name the name of the placeholder to check
* @return true if the placeholder is registered, else false
*/
default boolean hasRelationalPlaceholder(final String name) {
return relationalPlaceholderByName(name) != null;
}
/**
* Checks whether a global placeholder with the specified name has been registered in this expansion.
*
* @param name the name of the placeholder to check
* @return true if the placeholder is registered, else false
*/
default boolean hasGlobalPlaceholder(final String name) {
return globalPlaceholderByName(name) != null;
}
/**
* Get a TagResolver that contains all placeholders of a specific type in this expansion.
*
* @param type the desired type
* @return a TagResolver containing all placeholder of a specific type
*/
TagResolver placeholdersByType(PlaceholderType type);
/**
* Creates a new Expansion Builder
* @param name the expansion name
* @return a new expansion builder
* @since 1.0.0
*/
static @NotNull Expansion.Builder builder(final @NotNull String name){
static Expansion.Builder builder(final String name){
return new ExpansionImpl.Builder(name);
}
/**
* Get a shorter ToString with the details of this expansion.
* @return a shorter ToString
* @deprecated Starting with MiniPlaceholders 3.1, the way loaded expansions
* are displayed in the console has changed, so this method is no longer used
*/
@ApiStatus.Internal
@Deprecated(forRemoval = true, since = "3.1.0")
default String shortToString() {
final StringBuilder builder = new StringBuilder(name()).append('[');
if (author() != null) {
builder.append("Author: ").append(author());
}
if (version() != null) {
if (author() != null) {
builder.append(", ");
}
builder.append("Version: ").append(version());
}
builder.append(']');
return builder.toString();
}
/**
* Expansion Builder
* <p>Example use:</p>
@@ -112,7 +241,7 @@ public interface Expansion {
* builder
* // Thanks to this filter, a cast can be performed without the probability of a ClassCastException
* .filter(Player.class)
* .audiencePlaceholder("name", (audience, queue, ctx) -> Tag.selfClosingInserting(Component.text(((Player)audience).getUsername())));
* .resolver("name", (audience, queue, ctx) -> Tag.selfClosingInserting(Component.text(((Player)audience).getUsername())));
* Expansion expansion = builder.build();
* </pre>
*
@@ -120,13 +249,15 @@ public interface Expansion {
*
* <pre>
* Player player = event.getPlayer();
* TagResolver resolver = expansion.audiencePlaceholder(player);
* TagResolver resolver = expansion.resolver(player);
* Component messageReplaced = MiniMessage.deserialize({@link String}, resolver);
* </pre>
*
* @since 1.0.0
*/
@NullMarked
interface Builder extends AbstractBuilder<Expansion> {
/**
* Adds an audience placeholder
*
@@ -134,12 +265,36 @@ public interface Expansion {
*
* <p>The content of this Placeholder is cached
* and can mutate depending on when it is invoked</p>
*
* @param targetClass the target class
* @param key the placeholder key, cannot be an empty or black string
* @param audiencePlaceholder the single placeholder
* @param <A> the type of audience that this placeholder supports, must be the same as targetClass
* @return the {@link Builder} itself
* @since 1.0.0
*/
@NotNull Builder audiencePlaceholder(final @NotNull String key, final @NotNull AudiencePlaceholder audiencePlaceholder);
<A extends Audience> Builder audiencePlaceholder(
final @Nullable Class<A> targetClass,
final String key,
final AudienceTagResolver<A> audiencePlaceholder
);
/**
* Adds an audience placeholder
*
* <p>This type of Placeholder depends on a specific audience to obtain its values</p>
*
* <p>The content of this Placeholder is cached
* and can mutate depending on when it is invoked</p>
*
* @param key the placeholder key, cannot be an empty or black string
* @param audiencePlaceholder the single placeholder
* @return the {@link Builder} itself
* @since 3.0.0
*/
default Builder audiencePlaceholder(final String key, final AudienceTagResolver<Audience> audiencePlaceholder) {
return this.audiencePlaceholder(null, key, audiencePlaceholder);
}
/**
* Adds a Relational Placeholder based on two audiences
@@ -152,12 +307,43 @@ public interface Expansion {
*
* <p>The content of this Placeholder is cached
* and can mutate depending on when it is invoked</p>
*
* @param targetClass the target class
* @param key the placeholder key, cannot be an empty or black string
* @param relationalPlaceholder the relational placeholder
* @param <A> the type of audience that this placeholder supports, must be the same as targetClass
* @return the {@link Builder} itself
* @since 1.0.0
* @since 3.0.0
*/
@NotNull Builder relationalPlaceholder(final @NotNull String key, final @NotNull RelationalPlaceholder relationalPlaceholder);
<A extends Audience> Builder relationalPlaceholder(
final @Nullable Class<A> targetClass,
final String key,
final RelationalTagResolver<A> relationalPlaceholder
);
/**
* Adds a Relational Placeholder based on two audiences
*
* <p>This type of placeholder allows you to create
* components based on a 2-audiences relationship,
* one is the one on which the placeholder
* is based and the other is the one on which
* the placeholder is displayed.</p>
*
* <p>The content of this Placeholder is cached
* and can mutate depending on when it is invoked</p>
*
* @param key the placeholder key, cannot be an empty or black string
* @param relationalResolver the relational placeholder
* @return the {@link Builder} itself
* @since 3.0.0
*/
default Builder relationalPlaceholder(
final String key,
final RelationalTagResolver<Audience> relationalResolver
) {
return this.relationalPlaceholder(null, key, relationalResolver);
}
/**
* Adds a global placeholder
@@ -165,11 +351,11 @@ public interface Expansion {
* <p>The content of this Placeholder is cached
* and can mutate depending on when it is invoked</p>
* @param key the placeholder key, cannot be an empty or black string
* @param function the function
* @param resolver the function
* @return the {@link Builder} itself
* @since 1.0.0
* @since 3.0.0
*/
@NotNull Builder globalPlaceholder(final @NotNull String key, final @NotNull BiFunction<@NotNull ArgumentQueue, @NotNull Context, @Nullable Tag> function);
Builder globalPlaceholder(final String key, final GlobalTagResolver resolver);
/**
* Adds a global placeholder
@@ -180,37 +366,28 @@ public interface Expansion {
* @return the {@link Builder} itself
* @since 1.1.0
*/
@NotNull Builder globalPlaceholder(final @NotNull String key, final @NotNull Tag tag);
default Builder globalPlaceholder(final String key, final Tag tag) {
return this.globalPlaceholder(key, (queue, context) -> tag);
}
/**
* Filter the type of Audiences that this expansion can receive
* <p>In case the {@link Expansion#audiencePlaceholders(Audience)} or
* {@link Expansion#relationalPlaceholders(Audience, Audience)} method is called
* and the provided audiences are not instances of
* the specified class, a {@link TagResolver#empty} will be returned</p>
* Sets the author of this expansion
*
* <p>This eliminates the need to perform a manual
* <pre>if(!(audience instanceof Player)) return TagResolver.empty();</pre>
* @param clazz the class to filter
* @param author the author of this expansion
* @return the {@link Builder} itself
* @since 1.0.0
* @since 2.3.0
*/
@Contract("_ -> this")
@NotNull Builder filter(final @Nullable Class<? extends Audience> clazz);
Builder author(final @Nullable String author);
/**
* Filters the audiences that this expansion can receive through a Predicate
* <p>Example:</p>
* <pre>
* Expansion.builder("example").filter(Player.class).filter(aud -> isInProtectedServer((Player)aud))
* .audiencePlaceholder("hello", (aud, queue, ctx) -> Tag.selfInsertingClosing(Component.text("you are in protected server")))
* .build();
* </pre>
* @param predicate the check to realize
* Sets the version of this expansion
*
* @param version the version of this expansion
* @return the {@link Builder} itself
* @since 1.0.0
* @since 2.3.0
*/
@Contract("_ -> this")
@NotNull Builder filter(final @Nullable Predicate<Audience> predicate);
Builder version(final @Nullable String version);
}
}
@@ -1,218 +1,275 @@
package io.github.miniplaceholders.api;
import java.util.Collection;
import java.util.HashSet;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import io.github.miniplaceholders.api.placeholder.AudiencePlaceholder;
import io.github.miniplaceholders.api.placeholder.RelationalPlaceholder;
import io.github.miniplaceholders.api.utils.Conditions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import io.github.miniplaceholders.api.placeholder.*;
import io.github.miniplaceholders.api.resolver.AudienceTagResolver;
import io.github.miniplaceholders.api.resolver.GlobalTagResolver;
import io.github.miniplaceholders.api.resolver.RelationalTagResolver;
import io.github.miniplaceholders.api.types.PlaceholderType;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.intellij.lang.annotations.Subst;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.jspecify.annotations.NullUnmarked;
import java.util.*;
import static io.github.miniplaceholders.api.utils.Conditions.nonNullOrEmptyString;
import static java.util.Objects.requireNonNull;
final class ExpansionImpl implements Expansion {
private final String name;
private final Tags.Single[] audiencePlaceholders;
private final Tags.Relational[] relationalPlaceholders;
private final TagResolver globalPlaceholders;
private final Class<? extends Audience> filterClass;
private final Predicate<Audience> predicateFilter;
private static final AudiencePlaceholder<?>[] EMPTY_SINGLE_AUDIENCE = new AudiencePlaceholder[0];
private static final RelationalPlaceholder<?>[] EMPTY_RELATIONAL_AUDIENCE = new RelationalPlaceholder[0];
private static final GlobalPlaceholder[] EMPTY_GLOBAL_PLACEHOLDER = new GlobalPlaceholder[0];
ExpansionImpl(
@NotNull final String expansionName,
@Nullable final Collection<Tags.Single> audiencePlaceholders,
@Nullable final Collection<Tags.Relational> relationalPlaceholders,
@Nullable final TagResolver globalPlaceholders,
@Nullable final Class<? extends Audience> filterClass,
@Nullable final Predicate<Audience> predicateFilter){
this.name = expansionName+"-";
this.audiencePlaceholders = audiencePlaceholders != null
? audiencePlaceholders.toArray(Tags.Single[]::new)
: new Tags.Single[0];
this.relationalPlaceholders = relationalPlaceholders != null
? relationalPlaceholders.toArray(Tags.Relational[]::new)
: new Tags.Relational[0];
this.globalPlaceholders = globalPlaceholders == null
? TagResolver.empty()
: globalPlaceholders;
this.filterClass = filterClass;
this.predicateFilter = predicateFilter;
private final String name;
private final PlaceholderTagResolver audiencePlaceholders;
private final PlaceholderTagResolver relationalPlaceholders;
private final PlaceholderTagResolver globalPlaceholders;
@Nullable
private final String author;
@Nullable
private final String version;
ExpansionImpl(
final String expansionName,
@Nullable final Collection<AudiencePlaceholder<?>> audiencePlaceholders,
@Nullable final Collection<RelationalPlaceholder<?>> relationalPlaceholders,
@Nullable final Collection<GlobalPlaceholder> globalPlaceholders,
@Nullable final String author,
@Nullable final String version
) {
this.name = expansionName;
this.audiencePlaceholders = audiencePlaceholders != null
? new PlaceholderTagResolver(audiencePlaceholders.toArray(EMPTY_SINGLE_AUDIENCE))
: PlaceholderTagResolver.EMPTY;
this.relationalPlaceholders = relationalPlaceholders != null
? new PlaceholderTagResolver(relationalPlaceholders.toArray(EMPTY_RELATIONAL_AUDIENCE))
: PlaceholderTagResolver.EMPTY;
this.globalPlaceholders = globalPlaceholders == null
? PlaceholderTagResolver.EMPTY
: new PlaceholderTagResolver(globalPlaceholders.toArray(EMPTY_GLOBAL_PLACEHOLDER));
this.author = author;
this.version = version;
}
@Override
public String name() {
return this.name;
}
@Override
public @Nullable String author() {
return this.author;
}
@Override
public @Nullable String version() {
return this.version;
}
@Override
public TagResolver audiencePlaceholders() {
if (audiencePlaceholders.placeholders().length == 0) return TagResolver.empty();
return this.audiencePlaceholders;
}
@Override
public TagResolver relationalPlaceholders() {
if (relationalPlaceholders.placeholders().length == 0) return TagResolver.empty();
return this.relationalPlaceholders;
}
@Override
public TagResolver globalPlaceholders() {
if (globalPlaceholders.placeholders().length == 0) return TagResolver.empty();
return this.globalPlaceholders;
}
@Override
public void register() {
if (this.registered()) {
throw new IllegalStateException("Expansion" + this.name + "is already registered");
}
MiniPlaceholders.expansions.add(this);
}
@Override
public void unregister() {
if (!this.registered()) {
throw new IllegalStateException("Expansion " + this.name + " is not registered");
}
MiniPlaceholders.expansions.remove(this);
}
@Override
public boolean registered() {
return MiniPlaceholders.expansions.contains(this);
}
@Override
public Collection<AudiencePlaceholder<?>> registeredAudiencePlaceholders() {
return List.of((AudiencePlaceholder<?>[]) audiencePlaceholders.placeholders());
}
@Override
public Collection<RelationalPlaceholder<?>> registeredRelationalPlaceholders() {
return List.of((RelationalPlaceholder<?>[]) relationalPlaceholders.placeholders());
}
@Override
public @Nullable AudiencePlaceholder<?> audiencePlaceholderByName(String name) {
requireNonNull(name);
for (Placeholder audiencePlaceholder : audiencePlaceholders.placeholders()) {
if (Objects.equals(audiencePlaceholder.name(), name)) {
return (AudiencePlaceholder<?>) audiencePlaceholder;
}
}
return null;
}
@Override
public @Nullable RelationalPlaceholder<?> relationalPlaceholderByName(String name) {
requireNonNull(name);
for (Placeholder relationalPlaceholder : relationalPlaceholders.placeholders()) {
if (Objects.equals(relationalPlaceholder.name(), name)) {
return (RelationalPlaceholder<?>) relationalPlaceholder;
}
}
return null;
}
@Override
public @Nullable GlobalPlaceholder globalPlaceholderByName(String name) {
for (Placeholder placeholder : globalPlaceholders.placeholders()) {
if (Objects.equals(placeholder.name(), name)) {
return (GlobalPlaceholder) placeholder;
}
}
return null;
}
@Override
public TagResolver placeholdersByType(PlaceholderType type) {
return switch (type) {
case AUDIENCE -> audiencePlaceholders();
case RELATIONAL -> relationalPlaceholders();
case GLOBAL -> globalPlaceholders();
};
}
@NullUnmarked
static final class Builder implements Expansion.Builder {
private final String expansionName;
@Subst("server")
private final String expansionPrefix;
private Set<AudiencePlaceholder<?>> audiencePlaceholders;
private Set<RelationalPlaceholder<?>> relationalPlaceholders;
private Set<GlobalPlaceholder> globalPlaceholders;
private String author;
private String version;
Builder(final @NonNull String name) {
this.expansionName = nonNullOrEmptyString(name, "Expansion name");
this.expansionPrefix = name.toLowerCase(Locale.ROOT).concat("_");
}
@Override
public @NotNull String name(){
return this.name;
public <A extends Audience> @NonNull Builder audiencePlaceholder(
final @Nullable Class<A> targetClass,
final @Subst("name") @NonNull String key,
final @NonNull AudienceTagResolver<@NonNull A> audiencePlaceholder
) {
nonNullOrEmptyString(key, "Placeholder key");
requireNonNull(audiencePlaceholder, "the audience placeholder cannot be null");
if (this.audiencePlaceholders == null) this.audiencePlaceholders = new HashSet<>();
this.audiencePlaceholders.add(AudiencePlaceholder.single(targetClass, expansionPrefix + key, key, audiencePlaceholder));
return this;
}
@Override
public @NotNull TagResolver audiencePlaceholders(@NotNull final Audience audience){
if(audiencePlaceholders.length == 0) return TagResolver.empty();
public <A extends Audience> @NonNull Builder relationalPlaceholder(
final Class<A> targetClass,
final @Subst("relation") @NonNull String key,
final @NonNull RelationalTagResolver<@NonNull A> relationalPlaceholder
) {
nonNullOrEmptyString(key, "Placeholder key");
requireNonNull(relationalPlaceholder, "the relational placeholder cannot be null");
Objects.requireNonNull(audience, "the audience cannot be null");
if (this.relationalPlaceholders == null) this.relationalPlaceholders = new HashSet<>();
if(this.singleFilter(audience)) return TagResolver.empty();
final TagResolver.Builder placeholders = TagResolver.builder();
for(final Tags.Single pl : this.audiencePlaceholders){
placeholders.resolver(pl.of(audience));
}
return placeholders.build();
}
private boolean singleFilter(final Audience audience){
return filterClass != null && !filterClass.isInstance(audience)
|| predicateFilter != null && predicateFilter.test(audience);
final var relationalTag = RelationalPlaceholder.relational(targetClass, expansionPrefix + "rel_" + key, key, relationalPlaceholder);
this.relationalPlaceholders.add(relationalTag);
return this;
}
@Override
public @NotNull TagResolver relationalPlaceholders(@NotNull final Audience audience, @NotNull final Audience otherAudience){
if(relationalPlaceholders.length == 0) return TagResolver.empty();
public @NonNull Builder globalPlaceholder(
final @Subst("time") @NonNull String key,
final @NonNull GlobalTagResolver function
) {
nonNullOrEmptyString(key, "Placeholder key");
requireNonNull(function, "the global placeholder cannot be null");
Objects.requireNonNull(audience, "the audience cannot be null");
Objects.requireNonNull(otherAudience, "the other audience cannot be null");
if (this.globalPlaceholders == null) this.globalPlaceholders = new HashSet<>();
if (this.relationalFilter(audience, otherAudience)) return TagResolver.empty();
final TagResolver.Builder placeholders = TagResolver.builder();
for (final Tags.Relational pl : this.relationalPlaceholders){
placeholders.resolver(pl.of(audience, otherAudience));
}
return placeholders.build();
}
private boolean relationalFilter(final Audience audience, final Audience otherAudience){
return filterClass != null && (!filterClass.isInstance(audience) || !filterClass.isInstance(otherAudience))
|| predicateFilter != null && (!predicateFilter.test(audience) || !predicateFilter.test(otherAudience));
final var globalResolver = new GlobalPlaceholder(expansionPrefix + key, key, function);
this.globalPlaceholders.add(globalResolver);
return this;
}
@Override
public @NotNull TagResolver globalPlaceholders(){
return this.globalPlaceholders;
public @NonNull Builder author(final @Nullable String author) {
this.author = author;
return this;
}
@Override
public void register() {
if (this.registered()) {
throw new IllegalStateException("Expansion" + this.name + "is already registered");
}
MiniPlaceholders.expansions.add(this);
public @NonNull Builder version(final @Nullable String version) {
this.version = version;
return this;
}
@Override
public void unregister() {
if (!this.registered()) {
throw new IllegalStateException("Expansion " + this.name + " is not registered");
}
MiniPlaceholders.expansions.remove(this);
public @NonNull Expansion build() {
return new ExpansionImpl(
this.expansionName,
this.audiencePlaceholders,
this.relationalPlaceholders,
this.globalPlaceholders,
this.author,
this.version
);
}
}
@Override
public boolean registered() {
return MiniPlaceholders.expansions.contains(this);
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (!(o instanceof Expansion that)) return false;
static final class Builder implements Expansion.Builder {
private final String expansionName;
private Set<Tags.Single> audiencePlaceholders;
private Set<Tags.Relational> relationalPlaceholders;
private TagResolver.Builder globalPlaceholders;
private Class<? extends Audience> filterClass;
private Predicate<Audience> predicateFilter;
return that.name().equalsIgnoreCase(this.name());
}
Builder(@NotNull final String name){
this.expansionName = Conditions.nonNullOrEmptyString(name, () -> "expansion name")
.toLowerCase(Locale.ROOT).concat("_");
}
@Override
public int hashCode() {
return Objects.hash(name.hashCode());
}
@Override
public @NotNull Builder audiencePlaceholder(@NotNull final String key, @NotNull final AudiencePlaceholder audiencePlaceholder){
Conditions.nonNullOrEmptyString(key, () -> "placeholder key");
Objects.requireNonNull(audiencePlaceholder, "the audience placeholder cannot be null");
if (this.audiencePlaceholders == null) this.audiencePlaceholders = new HashSet<>(5);
this.audiencePlaceholders.add(Tags.single(expansionName+key, audiencePlaceholder));
return this;
}
@Override
public @NotNull Builder relationalPlaceholder(@NotNull final String key, @NotNull final RelationalPlaceholder relationalPlaceholder){
Conditions.nonNullOrEmptyString(key, () -> "placeholder key");
Objects.requireNonNull(relationalPlaceholder, "the relational placeholder cannot be null");
if (this.relationalPlaceholders == null) this.relationalPlaceholders = new HashSet<>(4);
this.relationalPlaceholders.add(Tags.relational(expansionName+"rel_"+key, relationalPlaceholder));
return this;
}
@Override
public @NotNull Builder globalPlaceholder(@NotNull final String key, @NotNull final BiFunction<ArgumentQueue, Context, Tag> function){
Conditions.nonNullOrEmptyString(key, () -> "placeholder key");
Objects.requireNonNull(function, "the global placeholder cannot be null");
if(this.globalPlaceholders == null) this.globalPlaceholders = TagResolver.builder();
this.globalPlaceholders.tag(expansionName+key, function);
return this;
}
@Override
public @NotNull Builder globalPlaceholder(@NotNull final String key, @NotNull final Tag tag){
Conditions.nonNullOrEmptyString(key, () -> "placeholder key");
Objects.requireNonNull(tag, "the tag cannot be null");
if(this.globalPlaceholders == null) this.globalPlaceholders = TagResolver.builder();
this.globalPlaceholders.tag(expansionName+key, tag);
return this;
}
@Override
public @NotNull Builder filter(@Nullable final Class<? extends Audience> clazz) {
this.filterClass = clazz;
return this;
}
@Override
public @NotNull Builder filter(@Nullable final Predicate<Audience> predicate){
this.predicateFilter = predicate;
return this;
}
@Override
public @NotNull Expansion build(){
return new ExpansionImpl(
this.expansionName,
this.audiencePlaceholders,
this.relationalPlaceholders,
this.globalPlaceholders != null ? this.globalPlaceholders.build() : null,
this.filterClass,
this.predicateFilter
);
}
}
@Override
public boolean equals(Object o){
if (this==o) return true;
if (o == null || o.getClass() != ExpansionImpl.class) return false;
return ((ExpansionImpl)o).name.equals(this.name);
}
@Override
public int hashCode(){
return Objects.hash(name.hashCode());
}
@Override
public String toString() {
return "ExpansionImpl{" +
"name='" + name + '\'' +
", audiencePlaceholders=" + audiencePlaceholders +
", relationalPlaceholders=" + relationalPlaceholders +
", globalPlaceholders=" + globalPlaceholders +
", author='" + author + '\'' +
", version='" + version + '\'' +
'}';
}
}
@@ -1,22 +1,24 @@
package io.github.miniplaceholders.api;
import io.github.miniplaceholders.api.types.PlaceholderType;
import io.github.miniplaceholders.api.types.Platform;
import io.github.miniplaceholders.api.types.RelationalAudience;
import io.github.miniplaceholders.connect.InternalPlatform;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jetbrains.annotations.Unmodifiable;
import org.jspecify.annotations.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import io.github.miniplaceholders.api.enums.Platform;
import org.jetbrains.annotations.NotNull;
import io.github.miniplaceholders.connect.InternalPlatform;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jetbrains.annotations.Nullable;
import static io.github.miniplaceholders.api.utils.Resolvers.applyIfNotEmpty;
import static java.util.Objects.requireNonNull;
/**
* MiniPlaceholders
* MiniPlaceholders, a component-based placeholders API.
*
* <p>This class allows you to obtain the {@link TagResolver}
* that other plugins provide based on single {@link Audience},
@@ -32,55 +34,56 @@ public final class MiniPlaceholders {
static final Set<Expansion> expansions = ConcurrentHashMap.newKeySet();
/**
* Get the platform
* Get the platform on which MiniPlaceholders is running.
*
* @return the platform
* @since 1.0.0
* @since 3.0.0
*/
public static @NotNull Platform getPlatform() {
public static Platform platform() {
return switch (InternalPlatform.platform()) {
case PAPER -> Platform.PAPER;
case VELOCITY -> Platform.VELOCITY;
case KRYPTON -> Platform.KRYPTON;
case FABRIC -> Platform.FABRIC;
case SPONGE -> Platform.SPONGE;
case MINESTOM -> Platform.MINESTOM;
};
}
/**
* Get the global placeholders
*
* <pre>TagResolver resolver = MiniPlaceholders.getGlobalPlaceholders();
* <pre>TagResolver resolver = MiniPlaceholders.globalPlaceholders();
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);</pre>
*
* @return global placeholders independent of any audience
* @see TagResolver
* @since 1.0.0
* @since 3.0.0
*/
public static @NotNull TagResolver getGlobalPlaceholders() {
public static TagResolver globalPlaceholders() {
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
final TagResolver resolver = expansion.globalPlaceholders();
if (resolver != TagResolver.empty())
builder.resolver(resolver);
applyIfNotEmpty(resolver, builder);
}
return builder.build();
}
/**
* Get the TagResolver based on an Audience
* Gets the TagResolver that can get data from an Audience.
* <br>
* The audience is provided at the time of parsing from the respective MiniMessage instance.
*
* <pre>TagResolver resolver = MiniPlaceholders.getAudiencePlaceholders({@link Audience});
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);</pre>
* <pre>TagResolver resolver = MiniPlaceholders.audiencePlaceholders();
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, {@link Audience}, resolver);
* </pre>
*
* @param audience the audience
* @return {@link TagResolver} with placeholders based on an audience
* @since 1.0.0
* @since 3.0.0
*/
public static @NotNull TagResolver getAudiencePlaceholders(final @NotNull Audience audience) {
requireNonNull(audience, "audience cannot be null");
public static TagResolver audiencePlaceholders() {
final TagResolver.Builder resolvers = TagResolver.builder();
for (Expansion expansion : expansions) {
final TagResolver resolver = expansion.audiencePlaceholders(audience);
for (final Expansion expansion : expansions) {
final TagResolver resolver = expansion.audiencePlaceholders();
applyIfNotEmpty(resolver, resolvers);
}
return resolvers.build();
@@ -88,54 +91,53 @@ public final class MiniPlaceholders {
/**
* Get the relational placeholders based on two audiences
* <br>
* The audiences are provided at the time of parsing
* from the respective MiniMessage instance through the use of a {@link RelationalAudience}.
*
* <pre>TagResolver resolver = MiniPlaceholders.getRelationalPlaceholders({@link Audience}, {@link Audience});
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);</pre>
* <pre>{@code
* TagResolver resolver = MiniPlaceholders.relationalPlaceholders();
* Component parsed = MiniMessage.miniMessage().deserialize(@link String, {@link RelationalAudience}, resolver);
* }</pre>
*
* @param audience an audience
* @param otherAudience another audience
* @return placeholders based on two audiences
* @since 1.0.0
* @since 3.0.0
* @see RelationalAudience
*/
public static @NotNull TagResolver getRelationalPlaceholders(final @NotNull Audience audience, final @NotNull Audience otherAudience) {
requireNonNull(audience, "audience cannot be null");
requireNonNull(otherAudience, "otherAudience cannot be null");
public static TagResolver relationalPlaceholders() {
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
applyIfNotEmpty(
expansion.relationalPlaceholders(audience, otherAudience),
builder
);
applyIfNotEmpty(expansion.relationalPlaceholders(), builder);
}
return builder.build();
}
/**
* Get the TagResolver based on an Audience and the global placeholders
* Get a TagResolver that can obtain data based on a relationship of 2 audiences
* and at the same time from the main audience and global placeholders.
* <br>
* The audience is provided at the time of parsing from the respective MiniMessage instance.
*
* <pre>
* TagResolver resolver = MiniPlaceholders.getAudienceGlobalPlaceholders({@link Audience});
* TagResolver resolver = MiniPlaceholders.audienceGlobalPlaceholders();
* TagResolver resolver2 = TagResolver.resolver(
* MiniPlaceholders.getAudienceGlobalPlaceholders({@link Audience}),
* MiniPlaceholders.getGlobalPlaceholders()
* MiniPlaceholders.audienceGlobalPlaceholders(),
* MiniPlaceholders.globalPlaceholders()
* );
* // This two resolvers returns the same TagResolver
* assertEquals(resolver, resolver2);
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);
* Component parsed = MiniMessage.miniMessage().deserialize({@link String}, {@link Audience}, resolver);
* </pre>
*
* @param audience the audience
* @return {@link TagResolver} with placeholders based on an audience and the global placeholders
* @since 1.1.0
*/
public static @NotNull TagResolver getAudienceGlobalPlaceholders(final @NotNull Audience audience) {
requireNonNull(audience, "audience cannot be null");
public static TagResolver audienceGlobalPlaceholders() {
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
applyIfNotEmpty(expansion.audiencePlaceholders(audience), builder);
applyIfNotEmpty(expansion.audiencePlaceholders(), builder);
applyIfNotEmpty(expansion.globalPlaceholders(), builder);
}
@@ -147,30 +149,27 @@ public final class MiniPlaceholders {
* and the global placeholders
*
* <pre>
* TagResolver resolver = MiniPlaceholders.getRelationalGlobalPlaceholders({@link Audience}, {@link Audience});
* TagResolver resolver = MiniPlaceholders.relationalGlobalPlaceholders();
* TagResolver resolver2 = TagResolver.resolver(
* MiniPlaceholders.getRelationalPlaceholders(audience1, audience2),
* MiniPlaceholders.getAudiencePlaceholders(audience1),
* MiniPlaceholders.getGlobalPlaceholders()
* MiniPlaceholders.relationalPlaceholders(),
* MiniPlaceholders.audiencePlaceholders(),
* MiniPlaceholders.globalPlaceholders()
* );
* // This methods should return the same TagResolver
* assertEquals(resolver, resolver2);
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, {@link RelationalAudience}, resolver);
* </pre>
*
* @param audience an audience
* @param otherAudience another audience
* @return the placeholders based on two audiences, placeholders based on the first audience and the global placeholders
* @since 1.1.0
* @since 3.0.0
* @apiNote In the case of audience placeholders, the audience to be used will be the {@link RelationalAudience#audience()}
* @see RelationalAudience
*/
public static @NotNull TagResolver getRelationalGlobalPlaceholders(final @NotNull Audience audience, final @NotNull Audience otherAudience) {
requireNonNull(audience, "audience cannot be null");
requireNonNull(otherAudience, "otherAudience cannot be null");
public static TagResolver relationalGlobalPlaceholders() {
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
applyIfNotEmpty(expansion.audiencePlaceholders(audience), builder);
applyIfNotEmpty(expansion.relationalPlaceholders(audience, otherAudience), builder);
applyIfNotEmpty(expansion.audiencePlaceholders(), builder);
applyIfNotEmpty(expansion.relationalPlaceholders(), builder);
applyIfNotEmpty(expansion.globalPlaceholders(), builder);
}
@@ -178,11 +177,33 @@ public final class MiniPlaceholders {
}
/**
* Get the amount of expansion registered
* @return the amount of expansions registered
* @since 1.0.0
* Get a TagResolver based on the desired placeholder type.
* <br>
* {@link PlaceholderType#GLOBAL} will return {@link #globalPlaceholders()}
* <br>
* {@link PlaceholderType#AUDIENCE} will return {@link #audiencePlaceholders()}
* <br>
* {@link PlaceholderType#RELATIONAL} will return {@link #relationalPlaceholders()}
*
* @param type the desired type
* @return the TagResolvers from the respective type
* @see PlaceholderType
*/
public static int getExpansionCount(){
public static TagResolver placeholdersByType(final PlaceholderType type) {
return switch (type) {
case GLOBAL -> globalPlaceholders();
case AUDIENCE -> audiencePlaceholders();
case RELATIONAL -> relationalPlaceholders();
};
}
/**
* Get the amount of expansion registered.
*
* @return the amount of expansions registered
* @since 3.0.0
*/
public static int expansionCount(){
return expansions.size();
}
@@ -193,14 +214,15 @@ public final class MiniPlaceholders {
* Expansion expansion = Expansion.builder("example").build();
* expansion.register();
*
* assertThat(MiniPlaceholders.getExpansionByName("example")).isNotNull();
* assertThat(MiniPlaceholders.expansionByName("example")).isNotNull();
* </pre>
*
* @param name the name of the required expansion
* @return the required expansion, if not present, will return null
* @see Expansion#builder(String)
* @since 2.1.0
* @since 3.0.0
*/
public @Nullable Expansion getExpansionByName(final @NotNull String name) {
public static @Nullable Expansion expansionByName(final String name) {
for (final Expansion expansion : expansions) {
if (Objects.equals(expansion.name(), name)) {
return expansion;
@@ -208,4 +230,15 @@ public final class MiniPlaceholders {
}
return null;
}
/**
* Obtain all available registered expansions
*
* @return all available registered expansions
* @since 3.0.0
*/
@Unmodifiable
public static Collection<Expansion> expansionsAvailable() {
return Collections.unmodifiableSet(expansions);
}
}
@@ -1,107 +0,0 @@
package io.github.miniplaceholders.api;
import java.util.Objects;
import io.github.miniplaceholders.api.placeholder.AudiencePlaceholder;
import io.github.miniplaceholders.api.placeholder.RelationalPlaceholder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.ParsingException;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
final class Tags {
private Tags(){}
static Relational relational(@NotNull final String name, @NotNull final RelationalPlaceholder relationalPlaceholder){
return new Tags.Relational(name, relationalPlaceholder);
}
static Single single(@NotNull final String name, @NotNull final AudiencePlaceholder audiencePlaceholder){
return new Single(name, audiencePlaceholder);
}
static final class Relational {
private final RelationalPlaceholder relationalPlaceholder;
private final String key;
Relational(final String key, final RelationalPlaceholder relationalPlaceholder){
this.relationalPlaceholder = relationalPlaceholder;
this.key = key;
}
TagResolver of(@NotNull final Audience audience, @NotNull final Audience otherAudience){
return new TagResolver(){
@Override
public @Nullable Tag resolve(@NotNull String name, @NotNull ArgumentQueue arguments,
@NotNull Context ctx) throws ParsingException {
return this.has(name)
? relationalPlaceholder.tag(audience, otherAudience, arguments, ctx)
: null;
}
@Override
public boolean has(@NotNull String name) {
return key.equalsIgnoreCase(name);
}
};
}
@Override
public boolean equals(Object o){
if(o == this) return true;
if(!(o instanceof Relational)) return false;
return ((Relational)o).key.equals(this.key);
}
@Override
public int hashCode(){
return Objects.hash(key);
}
}
static final class Single {
private final AudiencePlaceholder audiencePlaceholder;
private final String key;
private Single(@NotNull final String key, @NotNull final AudiencePlaceholder audiencePlaceholder){
this.key = key;
this.audiencePlaceholder = audiencePlaceholder;
}
TagResolver of(@NotNull final Audience audience){
return new TagResolver() {
@Override
public @Nullable Tag resolve(@NotNull String name, @NotNull ArgumentQueue arguments,
@NotNull Context ctx) throws ParsingException {
return this.has(name)
? audiencePlaceholder.tag(audience, arguments, ctx)
: null;
}
@Override
public boolean has(@NotNull String name) {
return key.equalsIgnoreCase(name);
}
};
}
@Override
public boolean equals(Object o){
if(o == this) return true;
if(!(o instanceof Single)) return false;
return ((Single)o).key.equals(this.key);
}
@Override
public int hashCode(){
return Objects.hash(key);
}
}
}
@@ -1,13 +0,0 @@
package io.github.miniplaceholders.api.enums;
/**Platforms on which MiniPlaceholders can be used */
public enum Platform {
/**Paper Platform */
PAPER,
/**Velocity Platform */
VELOCITY,
/**Krypton Platform */
KRYPTON,
/**Fabric Platform */
FABRIC
}
@@ -1,2 +0,0 @@
/**Plugin enums */
package io.github.miniplaceholders.api.enums;
@@ -1,27 +1,110 @@
package io.github.miniplaceholders.api.placeholder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import io.github.miniplaceholders.api.resolver.AudienceTagResolver;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
import net.kyori.adventure.pointer.Pointered;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.TagPattern;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.jetbrains.annotations.Nullable;
/**Audience Placeholder based on an Audience */
@FunctionalInterface
public interface AudiencePlaceholder {
/**
* A Tag based on an Audience
* @param audience the audience
* @param queue the argument queue
* @param ctx the context
* @return a Tag
* @since 1.0.0
*/
@Nullable Tag tag(
@NotNull final Audience audience,
@NotNull final ArgumentQueue queue,
@NotNull final Context ctx
);
}
import java.util.Objects;
import static java.util.Objects.requireNonNull;
/**
* A placeholder that can be applied based on an audience of the specified type.
*
* @param targetClass the type of audience from which this placeholder can obtain information
* @param key the full placeholder key
* @param name the name of this placeholder
* @param resolver the object responsible for obtaining audience information
* @param <A> the parametrized type
*/
public record AudiencePlaceholder<A extends Audience>(
@Nullable Class<A> targetClass,
@TagPattern String key,
String name,
AudienceTagResolver<A> resolver
) implements Placeholder {
/**
* Creates a new AudiencePlaceholder.
*
* @param targetClass the type of audience from which this placeholder can obtain information
* @param key the placeholder key
* @param name the name of this placeholder
* @param resolver the object responsible for obtaining audience information
* @return a new AudiencePlaceholder
* @param <A> the parametrized type
*/
public static <A extends Audience> AudiencePlaceholder<A> single(
@Nullable Class<A> targetClass,
@TagPattern String key,
String name,
AudienceTagResolver<A> resolver
) {
return new AudiencePlaceholder<>(targetClass, requireNonNull(key), requireNonNull(name), requireNonNull(resolver));
}
@Override
public @Nullable Tag resolve(final String name, final ArgumentQueue arguments, final Context ctx) {
final Pointered targetRaw = ctx.target();
if (targetRaw == null) {
return null;
}
if (targetClass == null) {
//noinspection unchecked
return this.resolveA(name, (A) targetRaw, arguments, ctx);
}
final @Nullable A audience = forwardingFilter(targetRaw);
if (audience == null) {
return null;
}
return resolveA(name, audience, arguments, ctx);
}
private @Nullable Tag resolveA(String key, A audience, ArgumentQueue queue, Context ctx) {
return this.has(key)
? resolver.tag(audience, queue, ctx)
: null;
}
@SuppressWarnings("OverrideOnly")
private @Nullable A forwardingFilter(final Pointered source) {
//noinspection DataFlowIssue
if (targetClass.isInstance(source)) {
return targetClass.cast(source);
}
if (source instanceof final ForwardingAudience.Single forward) {
return forwardingFilter(forward.audience());
}
return null;
}
@Override
public boolean has(String name) {
return key.equalsIgnoreCase(name);
}
@Override
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof AudiencePlaceholder<?> that)) return false;
return that.key.equalsIgnoreCase(this.key);
}
@Override
public int hashCode() {
return Objects.hash(key);
}
@Override
public String toString() {
return "AudiencePlaceholder{" +
"key='" + key + '\'' +
'}';
}
}
@@ -0,0 +1,49 @@
package io.github.miniplaceholders.api.placeholder;
import io.github.miniplaceholders.api.resolver.GlobalTagResolver;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.TagPattern;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.jspecify.annotations.Nullable;
import java.util.Objects;
/**
* A placeholder that can obtain data without the need to provide an {@link net.kyori.adventure.audience.Audience}
* or {@link io.github.miniplaceholders.api.types.RelationalAudience}.
*
* @param key the placeholder key
* @param name the placeholder name
* @param resolver the object responsible for providing information
*/
public record GlobalPlaceholder(@TagPattern String key, String name, GlobalTagResolver resolver) implements Placeholder {
@Override
public @Nullable Tag resolve(final String name, final ArgumentQueue arguments, final Context ctx) {
return this.has(name) ? resolver.tag(arguments, ctx) : null;
}
@Override
public boolean has(final String name) {
return key.equalsIgnoreCase(name);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof GlobalPlaceholder(var oKey, var __, var ___)) {
return Objects.equals(oKey, this.key);
}
return false;
}
@Override
public String toString() {
return "GlobalPlaceholder{" +
"key='" + key + '\'' +
"name=" + name + '\'' +
'}';
}
}
@@ -0,0 +1,26 @@
package io.github.miniplaceholders.api.placeholder;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
/**
* Base class of all Placeholders
*/
public sealed interface Placeholder extends TagResolver permits AudiencePlaceholder, GlobalPlaceholder, RelationalPlaceholder {
/**
* The key of this placeholder.<br>
* For example, the placeholder <pre>{@code <expansion_placeholder}</pre>
* will have the key <code>expansion_placeholder</code>
*
* @return this placeholder's key
*/
String key();
/**
* The key of this placeholder.<br>
* For example, the placeholder <pre>{@code <expansion_placeholder}</pre>
* will have the key <code>placeholder</code>
*
* @return this placeholder's name
*/
String name();
}
@@ -0,0 +1,38 @@
package io.github.miniplaceholders.api.placeholder;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.ParsingException;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jetbrains.annotations.Nullable;
/**
* A TagResolver responsible for containing and processing multiple placeholders.
* @param placeholders the placeholders to process
*/
public record PlaceholderTagResolver(Placeholder... placeholders) implements TagResolver {
public static final PlaceholderTagResolver EMPTY = new PlaceholderTagResolver();
@Override
public @Nullable Tag resolve(final String name, final ArgumentQueue arguments, final Context ctx) throws ParsingException {
@Nullable Tag tag;
for (final Placeholder placeholder : placeholders) {
tag = placeholder.resolve(name, arguments, ctx);
if (tag != null) {
return tag;
}
}
return null;
}
@Override
public boolean has(final String name) {
for (final Placeholder placeholder : placeholders) {
if (placeholder.has(name)) {
return true;
}
}
return false;
}
}
@@ -1,29 +1,134 @@
package io.github.miniplaceholders.api.placeholder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import io.github.miniplaceholders.api.types.RelationalAudience;
import io.github.miniplaceholders.api.resolver.RelationalTagResolver;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
import net.kyori.adventure.pointer.Pointered;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.TagPattern;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.jetbrains.annotations.Nullable;
/**Relational Placeholder based on two Audiences*/
@FunctionalInterface
public interface RelationalPlaceholder {
/**
* A Tag based on two audiences
* @param audience the principal audience
* @param otherAudience the another audience
* @param queue the argument queue
* @param ctx the context
* @return a tag
* @since 1.0.0
*/
@Nullable Tag tag(
@NotNull final Audience audience,
@NotNull final Audience otherAudience,
@NotNull final ArgumentQueue queue,
@NotNull final Context ctx
);
}
import java.util.Objects;
import static java.util.Objects.requireNonNull;
/**
* Relational Placeholder.
* <br>
* This placeholder is able to obtain data based on a relationship between 2 audiences
* using a type-safe filter and a relational resolver.
*
* @param targetClass the target class, can be null
* @param key the key of the entire placeholder
* @param name the name of this placeholder
* @param resolver the relational resolver,
* in charge of obtaining data based on a relationship of 2 audiences
* @param <A> the audience type, if not specified, will be a generic {@linkplain Audience}
* @apiNote The {@link #key()} method returns the full name of the placeholder,
* for example, if the placeholder is {@code <server_name>},
* the {@linkplain #key()} method will return {@code server_name}.
* @see RelationalTagResolver
*/
public record RelationalPlaceholder<A extends Audience>(
@Nullable Class<A> targetClass,
@TagPattern String key,
String name,
RelationalTagResolver<A> resolver
) implements Placeholder {
/**
* Static method capable of creating an instance of a relational placeholder.
*
* @param targetClass the target class, can be null
* @param key the key of the entire placeholder
* @param name the name of this placeholder
* @param resolver the relational resolver,
* in charge of obtaining data based on a relationship of 2 audiences
* @param <A> the audience type, if not specified, will be a generic {@linkplain Audience}
* @return a new RelationalPlaceholder
* @since 3.0.0
*/
public static <A extends Audience> RelationalPlaceholder<A> relational(
final @Nullable Class<A> targetClass,
final @TagPattern String key,
final String name,
final RelationalTagResolver<A> resolver
) {
return new RelationalPlaceholder<>(targetClass, requireNonNull(key), name, requireNonNull(resolver));
}
@Override
public @Nullable Tag resolve(final String name, final ArgumentQueue arguments, final Context ctx) {
final Pointered targetRaw = ctx.target();
if (targetRaw == null) {
return null;
}
if (!(targetRaw instanceof RelationalAudience<?>(Audience a, Audience b))) {
return null;
}
if (targetClass == null) {
//noinspection unchecked
return this.resolveA(name, (A) a, (A) b, arguments, ctx);
}
final @Nullable A audience = forwardingFilter(a);
if (audience == null) {
return null;
}
final @Nullable A relationalAudience = forwardingFilter(b);
if (relationalAudience == null) {
return null;
}
return this.resolveA(name, audience, relationalAudience, arguments, ctx);
}
private @Nullable Tag resolveA(
final String name,
final A audience,
final A relationalAudience,
final ArgumentQueue arguments,
final Context ctx
) {
return this.has(name)
? resolver.tag(audience, relationalAudience, arguments, ctx)
: null;
}
@SuppressWarnings("OverrideOnly")
private @Nullable A forwardingFilter(final Pointered source) {
//noinspection DataFlowIssue
if (targetClass.isInstance(source)) {
return targetClass.cast(source);
}
if (source instanceof final ForwardingAudience.Single forward) {
return forwardingFilter(forward.audience());
}
return null;
}
@Override
public boolean has(final String name) {
return key.equalsIgnoreCase(name);
}
@Override
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof final RelationalPlaceholder<?> that)) return false;
return that.key.equalsIgnoreCase(this.key);
}
@Override
public int hashCode() {
return Objects.hash(key);
}
@Override
public String toString() {
return "RelationalPlaceholder{" +
"key='" + key + '\'' +
'}';
}
}
@@ -1,4 +1,6 @@
/**
* Placeholders available based on information obtained from Audiences
* Placeholders Package.
*
* @since 3.0.0
*/
package io.github.miniplaceholders.api.placeholder;
package io.github.miniplaceholders.api.placeholder;
@@ -0,0 +1,27 @@
package io.github.miniplaceholders.api.provider;
import io.github.miniplaceholders.api.Expansion;
/**
* An expansion provider.
*
* @apiNote If necessary, you can obtain platform-dependent instances
* by adding a non-final field of the {@link PlatformData} class
* with the {@link team.unnamed.inject.Inject} annotation to your ExpansionProvider class.
*/
public interface ExpansionProvider {
/**
* Provides an expansion.
*
* @return an expansion
* @apiNote If used outside its MiniPlaceholders dynamic expansion loading context,
* you should always check that the loading requirements specified in {@link #loadRequirement} are met.
*/
Expansion provideExpansion();
/**
* Obtain the requirements that must be met for this expansion to load successfully.
* @return the load requirements of this expansion provider
*/
LoadRequirement loadRequirement();
}
@@ -0,0 +1,223 @@
package io.github.miniplaceholders.api.provider;
import io.github.miniplaceholders.api.types.Platform;
import org.intellij.lang.annotations.Pattern;
import org.jetbrains.annotations.ApiStatus;
import org.jspecify.annotations.NullMarked;
import java.util.Arrays;
import java.util.function.Predicate;
import static java.util.Objects.requireNonNull;
/**
* This class specifies the conditions that must be met
* in order to load an {@link io.github.miniplaceholders.api.Expansion} from an {@link ExpansionProvider}.
*
* @since 3.0.0
*/
public sealed interface LoadRequirement {
/**
* It means that there is no requirement to load an expansion.
*
* @return a LoadRequirement that does not perform any validation
* @since 3.0.0
*/
static LoadRequirement none() {
return NoneLoadRequirement.INSTANCE;
}
/**
* Requirement for a complement, whether a plugin or mod, to be present in order for an expansion to be loaded.<br>
* The ability to provide multiple strings is provided because names may vary on some platforms.
* For example, Velocity requires plugin IDs to be lowercase, such as {@code miniplaceholders},
* while Paper can contain uppercase letters, such as {@code MiniPlaceholders}.
*
* @param name the principal name of this complement
* @param aliases the platform aliases of a complement
* @return a load requirement that checks for an available complement
* @since 3.0.0
*/
static LoadRequirement requiredComplement(final String name, final String... aliases) {
requireNonNull(name);
requireNonNull(aliases);
return new AvailableComplementRequirement(name, aliases);
}
/**
* Multiple requirement, in case an expansion needs to depend on a platform
* as well as one or more add-ons that are installed.
*
* @param requirements the load requirements
* @return a load requirement of many load requirements
* @since 3.0.0
*/
static LoadRequirement allOf(LoadRequirement... requirements) {
requireNonNull(requirements);
assert requirements.length != 0;
return new MultiLoadRequirement(requirements);
}
/**
* Requirement that the current execution be on a specific platform.
*
* @param platforms the supported platforms
* @return a load requirement that checks for a supported platform
* @since 3.0.0
*/
static LoadRequirement platform(final Platform... platforms) {
requireNonNull(platforms);
assert platforms.length != 0;
return new PlatformRequirement(platforms);
}
/**
* Requirement that a specific class be present.
*
* @param clazz the specified class.
* @return a load requirement that checks for a present class
* @since 3.1.0
*/
static LoadRequirement requiredClass(
@Pattern("^([a-z_][a-z0-9_]*)(\\.[a-z_][a-z0-9_]*)*(\\.[A-Z][A-Za-z0-9_]*)$") final String clazz
) {
requireNonNull(clazz);
return new ClassRequirement(clazz);
}
/**
* This requirement checks whether any of the conditions presented are satisfied.
*
* @param requirements the requerimients
* @return a requirement that checks whether a condition is valid
* @since 3.1.0
*/
static LoadRequirement anyOf(LoadRequirement... requirements) {
requireNonNull(requirements);
assert requirements.length != 0;
return new AnyOfRequirement(requirements);
}
/**
* NoneLoadRequirement
*
* @since 3.0.0
*/
@ApiStatus.Internal
enum NoneLoadRequirement implements LoadRequirement {
/**
* NoneLoadRequirement instance
*/
INSTANCE
}
/**
* AvailableComplementRequirement
*
* @param name the main complement name
* @param platformAliases the complement aliases
* @since 3.0.0
*/
@ApiStatus.Internal
@NullMarked
record AvailableComplementRequirement(String name, String... platformAliases) implements LoadRequirement {
/**
* Checks if a complement is loaded
*
* @param platformComplementTester the checker predicate
* @return is this expansion should load
* @since 3.0.0
*/
public boolean shouldLoad(final Predicate<String> platformComplementTester) {
if (platformComplementTester.test(name)) {
return true;
}
for (String alias : platformAliases) {
if (platformComplementTester.test(alias)) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "AvailableComplementRequirement{" +
"complement='" + name + '\'' +
'}';
}
}
/**
* MultiLoadRequirement
*
* @param requirements the load requirements
* @since 3.0.0
*/
@ApiStatus.Internal
@NullMarked
record MultiLoadRequirement(LoadRequirement... requirements) implements LoadRequirement {
@Override
public String toString() {
return "MultiLoadRequirement{" +
"requirements=" + Arrays.toString(requirements) +
'}';
}
}
/**
* PlatformLoadRequirement
*
* @param platforms the platforms supported
* @since 3.0.0
*/
@ApiStatus.Internal
@NullMarked
record PlatformRequirement(Platform... platforms) implements LoadRequirement {
@Override
public String toString() {
return "PlatformRequirement{" +
"platforms=" + Arrays.toString(platforms()) +
'}';
}
}
/**
* ClassRequirement
*
* @param clazz a specified class
* @since 3.1.0
*/
@NullMarked
@ApiStatus.Internal
record ClassRequirement(String clazz) implements LoadRequirement {
public boolean shouldLoad() {
try {
Class.forName(clazz);
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}
/**
* AnyOfLoadRequirement
*
* @param requirements the requirements
* @since 3.1.0
*/
@ApiStatus.Internal
@NullMarked
record AnyOfRequirement(LoadRequirement... requirements) implements LoadRequirement {
@Override
public String toString() {
return "AnyOfRequirement{" +
"requirements=" + Arrays.toString(requirements) +
'}';
}
}
}
@@ -0,0 +1,21 @@
package io.github.miniplaceholders.api.provider;
import io.github.miniplaceholders.api.MiniPlaceholders;
/**
* Wrapper for platform-dependent instances.
*
* @param serverInstance The server instance.<br>
* In Paper it will be {@code org.bukkit.Server},<br>
* in Velocity it will be {@code com.velocitypowered.api.proxy.ProxyServer},<br>
* in Sponge it will be {@code org.spongepowered.api.Server},<br>
* and in Fabric it will be {@code net.minecraft.server.MinecraftServer}.
* @param complementInstance The main class of MiniPlaceholders, either as a plugin or mod.<br>
* In Paper it will be {@code org.bukkit.plugin.java.JavaPlugin},<br>
* in Velocity it will be {@code io.github.miniplaceholders.velocity.VelocityPlugin},<br>
* in Sponge it will be {@code io.github.miniplaceholders.sponge.SpongePlugin},<br>
* and in Fabric it will be {@code net.fabricmc.api.ModInitializer}.
* @see MiniPlaceholders#platform()
*/
public record PlatformData(Object serverInstance, Object complementInstance) {
}
@@ -0,0 +1,6 @@
/**
* Package responsible for providing tools to load expansions provided through installable files
*
* @since 3.0.0
*/
package io.github.miniplaceholders.api.provider;
@@ -0,0 +1,26 @@
package io.github.miniplaceholders.api.resolver;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.jspecify.annotations.Nullable;
/**
* Audience Placeholder based on an Audience
*
* @param <A> the audience type
*/
@FunctionalInterface
public interface AudienceTagResolver<A extends Audience> {
/**
* A Tag based on an Audience
* @param audience the audience
* @param queue the argument queue
* @param ctx the context
* @return a Tag
* @since 3.0.0
*/
@Nullable
Tag tag(final A audience, final ArgumentQueue queue, final Context ctx);
}
@@ -0,0 +1,23 @@
package io.github.miniplaceholders.api.resolver;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.jspecify.annotations.Nullable;
/**
* A GlobalResolver is responsible for providing information regardless of additional conditions such as an audience.
*/
@FunctionalInterface
public interface GlobalTagResolver {
/**
* A global tag.
*
* @param queue the argument queue
* @param context the parsing context
* @return a tag
* @since 3.0.0
*/
@Nullable
Tag tag(ArgumentQueue queue, Context context);
}
@@ -0,0 +1,30 @@
package io.github.miniplaceholders.api.resolver;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.jspecify.annotations.Nullable;
/**
* Relational Placeholder based on two Audiences.
*
* @param <A> the audiences type
*
* @since 3.0.0
*/
@FunctionalInterface
public interface RelationalTagResolver<A extends Audience> {
/**
* A Tag based on two audiences
*
* @param audience the principal audience
* @param relational the another audience
* @param queue the argument queue
* @param ctx the context
* @return a tag
* @since 3.0.0
*/
@Nullable
Tag tag(final A audience, final A relational, final ArgumentQueue queue, final Context ctx);
}
@@ -0,0 +1,4 @@
/**
* Resolvers available based on information obtained from Audiences
*/
package io.github.miniplaceholders.api.resolver;
@@ -0,0 +1,27 @@
package io.github.miniplaceholders.api.types;
/**
* Type of Placeholder.
*
* @since 3.0.0
*/
public enum PlaceholderType {
/**
* The global placeholder type.
* <br>
* It does not require any type of audience to operate.
*/
GLOBAL,
/**
* The audience placeholder type.
* <br>
* Obtains information from a provided audience.
*/
AUDIENCE,
/**
* The relational placeholder type.
* <br>
* Requires 2 audiences to work, these audiences need to be of the same type.
*/
RELATIONAL
}
@@ -0,0 +1,39 @@
package io.github.miniplaceholders.api.types;
/**
* Platforms on which MiniPlaceholders can be used.
*
* @since 1.0.0
*/
public enum Platform {
/**
* Paper Platform
*
* @since 1.0.0
*/
PAPER,
/**
* Velocity Platform
*
* @since 1.0.0
*/
VELOCITY,
/**
* Fabric Platform
*
* @since 2.1.0
*/
FABRIC,
/**
* Sponge Platform
*
* @since 2.2.0
*/
SPONGE,
/**
* Minestom Platform
*
* @since 3.2.0
*/
MINESTOM,
}
@@ -0,0 +1,34 @@
package io.github.miniplaceholders.api.types;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
import static java.util.Objects.requireNonNull;
/**
* A relationship between 2 Audiences.
*
* @param audience the principal audience
* @param relational the secondary audience, with which the relationship will be evaluated
* @param <A> the audiences type
* @since 3.0.0
*/
public record RelationalAudience<A extends Audience>(A audience, A relational) implements ForwardingAudience.Single {
public RelationalAudience {
requireNonNull(audience);
requireNonNull(relational);
}
/**
* Creates a new relation between two audiences.
*
* @param audience the principal audience
* @param relational the secondary audience, with which the relationship will be evaluated
* @return a new relation
* @param <A> the audiences type
* @since 3.0.0
*/
public static <A extends Audience> RelationalAudience<A> from(A audience, A relational) {
return new RelationalAudience<>(audience, relational);
}
}
@@ -0,0 +1,4 @@
/**
* Plugin types
*/
package io.github.miniplaceholders.api.types;
@@ -4,27 +4,33 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
/**Common components used in expansions */
/**
* Common components used in expansions
*/
public final class Components {
private Components(){}
/**
* "True" Component
* "True" Component.
*
* @since 1.1.0
*/
public static final TextComponent TRUE_COMPONENT = Component.text("true", NamedTextColor.GREEN);
/**
* False Component
* "False" Component.
*
* @since 1.1.0
*/
public static final TextComponent FALSE_COMPONENT = Component.text("false", NamedTextColor.RED);
/**
* "Yes" Component
* "Yes" Component.
*
* @since 1.1.0
*/
public static final TextComponent YES_COMPONENT = Component.text("yes", NamedTextColor.GREEN);
/**
* "No" Component
* "No" Component.
*
* @since 1.1.0
*/
public static final TextComponent NO_COMPONENT = Component.text("no", NamedTextColor.RED);
@@ -1,37 +1,78 @@
package io.github.miniplaceholders.api.utils;
import org.jspecify.annotations.Nullable;
import java.util.function.Supplier;
/** Checks required for the correct operation of the expansions*/
/**
* Checks required for the correct operation of the expansions
*
* @since 1.0.0
*/
public final class Conditions {
private Conditions(){}
private Conditions() {
}
/**
* Checks if a string is null or empty or consists of whitespace characters only
* @param string the string
* @param name the name supplier
* @return the string if it is not null or empty
* @since 1.0.0
*/
public static String nonNullOrEmptyString(String string, Supplier<String> name){
if (string == null)
throw new NullPointerException("the " + name.get() + " cannot be null");
if (string.isBlank())
throw new IllegalStateException("the " + name.get() + "cannot be an empty string");
return string;
}
/**
* Checks if a string is null or empty or consists of whitespace characters only.
*
* @param string the string
* @param name the name supplier
* @return the string if it is not null or empty
* @throws IllegalStateException if the provided string is empty
* @since 1.0.0
*/
public static String nonNullOrEmptyString(final @Nullable String string, final Supplier<String> name) {
if (string == null)
throw new NullPointerException(name.get() + " cannot be null");
if (string.isBlank())
throw new IllegalStateException(name.get() + "cannot be an empty string");
return string;
}
/**
* Checks if a string is null or empty or consists of whitespace characters only.
*
* @param string the string
* @param name the name
* @return the string if it is not null or empty
* @throws IllegalStateException if the provided string is empty
* @since 2.2.0
*/
public static String nonNullOrEmptyString(final @Nullable String string, final String name) {
if (string == null)
throw new NullPointerException(name + " cannot be null");
if (string.isBlank())
throw new IllegalStateException(name + "cannot be an empty string");
return string;
}
/**
* Check if a string is empty or consists of whitespace characters only.
*
* @param string the string
* @param reason the reason supplier
* @return the string if it not empty
* @throws IllegalStateException if the provided string is empty
* @since 1.0.0
*/
public static String nonEmptyString(final String string, final Supplier<String> reason) {
if (string.isBlank()) throw new IllegalStateException(reason.get());
return string;
}
/**
* Check if a string is empty or consists of whitespace characters only.
*
* @param string the string
* @param reason the reason
* @return the string if it not empty
* @throws IllegalStateException if the provided string is empty
* @since 2.2.0
*/
public static String nonEmptyString(final String string, final String reason) {
if (string.isBlank()) throw new IllegalStateException(reason);
return string;
}
/**
* Check if a string is empty or consists of whitespace characters only
* @param string the string
* @param reason the reason supplier
* @return the string if it not empty
* @since 1.0.0
*/
public static String nonEmptyString(String string, Supplier<String> reason){
if (string.isBlank())
throw new IllegalStateException(reason.get());
return string;
}
}
@@ -0,0 +1,165 @@
package io.github.miniplaceholders.api.utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.jspecify.annotations.Nullable;
import java.util.function.Function;
import static java.util.Objects.requireNonNull;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
/**
* Legacy String utilities.
*
* @since 3.0.0
*/
public final class LegacyStrings {
private LegacyStrings() {
}
/**
* Legacy serializer with hex support
* <p>Use this as the last available alternative,
* it is recommended to use MiniMessage instead of this serializer</p>
*
* @deprecated Legacy format “support” will be removed in future versions
*/
@Deprecated(since = "3.1.0")
public static final LegacyComponentSerializer LEGACY_HEX_SERIALIZER = LegacyComponentSerializer.builder()
.character('&')
.hexColors()
.build();
/**
* Parse a string with possible legacy Ampersand/Section symbols
* <br>
* <p><b>
* This method should only be used in case a String is provided from a legacy plugin/mod
* or legacy source, where it is very likely to get a legacy string.
* It is not recommended to use this method regularly in any sense
* </b></p>
*
* @param string the string
* @return a parsed string
* @since 1.0.0
*/
public static Component parsePossibleLegacy(@Nullable String string) {
if (string == null || string.isEmpty()) return Component.empty();
if (string.indexOf(LegacyComponentSerializer.SECTION_CHAR) != -1) {
string = string.replace(LegacyComponentSerializer.SECTION_CHAR, LegacyComponentSerializer.AMPERSAND_CHAR);
}
if (string.indexOf(LegacyComponentSerializer.AMPERSAND_CHAR) == -1) {
return miniMessage().deserialize(string);
}
return miniMessage().deserialize(
miniMessage().serialize(LEGACY_HEX_SERIALIZER.deserialize(string))
.replace("\\<", "<")
.replace("\\>", ">")
);
}
/**
* Parse a string with possible legacy Ampersand/Section symbols
* using a parsing Context
* <p><b>
* This method should only be used in case a String is provided from a legacy plugin/mod
* or legacy source, where it is very likely to get a legacy string.
* It is not recommended to use this method regularly in any sense
* </b></p>
*
* @param string the string
* @param context the provided parsing context
* @return a parsed string
* @since 2.2.1
*/
public static Component parsePossibleLegacy(@Nullable String string, final Context context) {
if (string == null || string.isEmpty()) return Component.empty();
if (string.indexOf(LegacyComponentSerializer.SECTION_CHAR) != -1) {
string = string.replace(LegacyComponentSerializer.SECTION_CHAR, LegacyComponentSerializer.AMPERSAND_CHAR);
}
if (string.indexOf(LegacyComponentSerializer.AMPERSAND_CHAR) == -1) {
return context.deserialize(string);
}
return context.deserialize(
miniMessage().serialize(LEGACY_HEX_SERIALIZER.deserialize(string))
.replace("\\<", "<")
.replace("\\>", ">")
);
}
/**
* Parse a string with possible legacy Ampersand/Section symbols
* using the provided resolver
* <p><b>
* This method should only be used in case a String is provided from a legacy plugin/mod
* or legacy source, where it is very likely to get a legacy string.
* It is not recommended to use this method regularly in any sense
* </b></p>
*
* @param string the string
* @param resolver a resolver
* @return a parsed string
* @since 2.2.1
*/
public static Component parsePossibleLegacy(@Nullable String string, final TagResolver resolver) {
if (string == null || string.isEmpty()) return Component.empty();
if (string.indexOf(LegacyComponentSerializer.SECTION_CHAR) != -1) {
string = string.replace(LegacyComponentSerializer.SECTION_CHAR, LegacyComponentSerializer.AMPERSAND_CHAR);
}
if (string.indexOf(LegacyComponentSerializer.AMPERSAND_CHAR) == -1) {
return miniMessage().deserialize(string, resolver);
}
return miniMessage().deserialize(
miniMessage().serialize(LEGACY_HEX_SERIALIZER.deserialize(string))
.replace("\\<", "<")
.replace("\\>", ">"),
resolver
);
}
/**
* Checks if the provided string contains legacy formatting.
*
* @param string the string input
* @return whether the string has legacy content
* @see LegacyComponentSerializer#AMPERSAND_CHAR
* @see LegacyComponentSerializer#SECTION_CHAR
* @since 2.3.0
*/
public static boolean hasLegacyFormat(final String string) {
requireNonNull(string, "string");
return string.indexOf(LegacyComponentSerializer.SECTION_CHAR) != -1
|| string.indexOf(LegacyComponentSerializer.AMPERSAND_CHAR) != -1;
}
/**
* Maps the input to a type depending on whether it contains legacy formatting or not.
*
* @param string the string input
* @param legacyMapping the mapping function in case the string contains legacy formatting
* @param modernMapping the mapping function in case the string does not contain any legacy character type,
* being safe to use with MiniMessage
* @param <R> the result type
* @return the mapped result
* @see LegacyComponentSerializer#AMPERSAND_CHAR
* @see LegacyComponentSerializer#SECTION_CHAR
* @see #hasLegacyFormat(String)
* @since 2.3.0
*/
public static <R> R mapLegacyOrElse(
final String string,
final Function<String, R> legacyMapping,
final Function<String, R> modernMapping
) {
requireNonNull(legacyMapping, "legacyMapping");
requireNonNull(modernMapping, "modernInput");
if (hasLegacyFormat(string)) {
return legacyMapping.apply(string);
} else {
return modernMapping.apply(string);
}
}
}
@@ -1,44 +0,0 @@
package io.github.miniplaceholders.api.utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
/**
* Legacy utils
*/
public final class LegacyUtils {
private LegacyUtils() {
}
/**
* Legacy serializer with hex support
* <p>Use this as the last available alternative,
* it is recommended to use MiniMessage instead of this serializer</p>
*/
public static final LegacyComponentSerializer LEGACY_HEX_SERIALIZER = LegacyComponentSerializer.builder()
.character('&')
.hexColors()
.build();
/**
* Parse a string with possible legacy symbols
*
* @param string the string
* @return a parsed string
* @since 1.0.0
*/
public static @NotNull Component parsePossibleLegacy(@Nullable String string) {
if (string == null || string.isBlank()) return Component.empty();
if (string.indexOf('&') != 0) {
return miniMessage().deserialize(
miniMessage().serialize(LEGACY_HEX_SERIALIZER.deserialize(string))
);
} else {
return miniMessage().deserialize(string);
}
}
}
@@ -1,11 +1,10 @@
package io.github.miniplaceholders.api.utils;
import org.jetbrains.annotations.NotNull;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
/**
* Class of utilities to manage TagResolvers
* Class of utilities to manage TagResolvers.
*
* @since 1.2.0
*/
public final class Resolvers {
@@ -13,33 +12,36 @@ public final class Resolvers {
/**
* Check if the TagResolver is an instance of TagResolver.empty(),
* that is, it will always return null
* that is, it will always return null.
*
* @param resolver the resolver to check
* @return true if the TagResolver is the same as TagResolver.empty(), else false
* @since 1.2.0
*/
public static boolean isEmpty(final @NotNull TagResolver resolver) {
public static boolean isEmpty(final TagResolver resolver) {
return resolver == TagResolver.empty();
}
/**
* Checks if the TagResolver provided is not a TagResolver.empty()
* Checks if the TagResolver provided is not a TagResolver.empty().
*
* @param resolver the resolver to check
* @return false if the TagResolver is the same as TagResolver.empty(), else true
* @since 1.2.0
*
*/
public static boolean isNotEmpty(final @NotNull TagResolver resolver) {
public static boolean isNotEmpty(final TagResolver resolver) {
return resolver != TagResolver.empty();
}
/**
* Applies a TagResolver to a TagResolver.Builder in case it is not a TagResolver.empty()
* Applies a TagResolver to a TagResolver.Builder in case it is not a TagResolver.empty().
*
* @param resolver the resolver to check
* @param builder the resolver that can be added to the builder
* @since 1.2.0
*/
public static void applyIfNotEmpty(final @NotNull TagResolver resolver, final @NotNull TagResolver.Builder builder) {
public static void applyIfNotEmpty(final TagResolver resolver, final TagResolver.Builder builder) {
if (isNotEmpty(resolver)) {
builder.resolver(resolver);
}
@@ -0,0 +1,66 @@
package io.github.miniplaceholders.api.utils;
import io.github.miniplaceholders.api.resolver.AudienceTagResolver;
import io.github.miniplaceholders.api.resolver.GlobalTagResolver;
import io.github.miniplaceholders.api.resolver.RelationalTagResolver;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
import org.jspecify.annotations.Nullable;
/**
* Tags basic instances.
*
* @since 3.0.0
*/
public final class Tags {
private Tags() {
}
/**
* Empty Tag
*
* @since 3.0.0
*/
public static final Tag EMPTY_TAG = Tag.selfClosingInserting(Component.empty());
/**
* Null Tag
*
* @since 3.0.0
*/
public static final @Nullable Tag NULL_TAG = null;
/**
* An Audience placeholder that returns a null Tag
*
* @param <A> the placeholder supported type
* @return an empty audience resolver
* @since 3.0.0
*/
public static <A extends Audience> AudienceTagResolver<A> emptyAudienceResolver() {
return (audience, queue, ctx) -> NULL_TAG;
}
/**
* A Relational placeholder that returns a null tag
*
* @param <A> the audience type supported
* @return an empty relational resolver
* @since 3.0.0
*/
public static <A extends Audience> RelationalTagResolver<A> emptyRelationalResolver() {
return (audience, relational, queue, ctx) -> NULL_TAG;
}
/**
* A Global placeholder that returns a null tag
*
* @since 3.0.0
* @return an empty global placeholder
*/
public static GlobalTagResolver emptyGlobalPlaceholder() {
return (queue, ctx) -> NULL_TAG;
}
}
@@ -1,58 +0,0 @@
package io.github.miniplaceholders.api.utils;
import io.github.miniplaceholders.api.placeholder.AudiencePlaceholder;
import io.github.miniplaceholders.api.placeholder.RelationalPlaceholder;
import org.jetbrains.annotations.NotNull;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
/**Tags utils */
public final class TagsUtils {
private TagsUtils(){}
/**
* Empty Tag
* @since 1.0.0
*/
public static final Tag EMPTY_TAG = Tag.selfClosingInserting(Component.empty());
/**
* Null Tag
* @since 1.1.0
*/
public static final Tag NULL_TAG = null;
/**
* An Audience placeholder that returns a null Tag
* @since 1.1.0
*/
public static final AudiencePlaceholder NULL_AUDIENCE_PLACEHOLDER = (aud, queue, ctx) -> NULL_TAG;
/**
* A Relational placeholder that returns a null tag
* @since 1.1.0
*/
public static final RelationalPlaceholder NULL_RELATIONAL_PLACEHOLDER = (aud, otheraud, queue, ctx) -> NULL_TAG;
/**
* Creates a new Tag based on a String
* @param string the string
* @return a new basic self closing Tag of a string
* @since 1.1.0
*/
public static @NotNull Tag staticTag(@NotNull String string) {
return Tag.selfClosingInserting(Component.text(string));
}
/**
* Creates a new basic Tag based on a Component
* @param component the component
* @return a new basic self closing Tag of a component
* @since 1.1.0
*/
public static @NotNull Tag staticTag(@NotNull Component component) {
return Tag.selfClosingInserting(component);
}
}
+22 -12
View File
@@ -1,14 +1,24 @@
/** MiniPlaceholders API Module */
open module io.github.miniplaceholders.api {
requires net.kyori.adventure;
requires net.kyori.adventure.text.minimessage;
requires net.kyori.examination.api;
requires static org.jetbrains.annotations;
requires io.github.miniplaceholders.connect;
requires net.kyori.adventure.text.serializer.legacy;
import org.jspecify.annotations.NullMarked;
exports io.github.miniplaceholders.api;
exports io.github.miniplaceholders.api.enums;
exports io.github.miniplaceholders.api.utils;
exports io.github.miniplaceholders.api.placeholder;
/**
* MiniPlaceholders API Module
*/
@NullMarked
open module io.github.miniplaceholders.api {
requires io.github.miniplaceholders.connect;
requires net.kyori.adventure;
requires net.kyori.adventure.text.minimessage;
requires net.kyori.adventure.text.serializer.legacy;
requires net.kyori.examination.api;
requires static org.jetbrains.annotations;
requires static org.jspecify;
exports io.github.miniplaceholders.api;
exports io.github.miniplaceholders.api.types;
exports io.github.miniplaceholders.api.utils;
exports io.github.miniplaceholders.api.resolver;
exports io.github.miniplaceholders.api.placeholder;
exports io.github.miniplaceholders.api.provider;
}
@@ -1,24 +1,65 @@
package io.github.miniplaceholders.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.placeholder.GlobalPlaceholder;
import io.github.miniplaceholders.api.types.PlaceholderType;
import io.github.miniplaceholders.api.utils.Tags;
import io.github.miniplaceholders.test.instances.TestAudience;
import net.kyori.adventure.text.minimessage.tag.Tag;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.TagsUtils;
import static org.junit.jupiter.api.Assertions.*;
class ExpansionsTest {
class ExpansionsTest implements MiniTest {
@Test
@DisplayName("Expansion Equality")
void equalsExpansions(){
final Expansion firstExpansion = Expansion.builder("equals")
.audiencePlaceholder("test", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.audiencePlaceholder("test", Tags.emptyAudienceResolver())
.build();
final Expansion secondExpansion = Expansion.builder("equals")
.audiencePlaceholder("test", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.audiencePlaceholder("test", Tags.emptyAudienceResolver())
.build();
assertEquals(firstExpansion, secondExpansion);
}
@Test
void placeholderRetrievalTest() {
final Expansion expansion = Expansion.builder("test")
.globalPlaceholder("some_placeholder", Tag.preProcessParsed("test"))
.build();
assertTrue(expansion.hasGlobalPlaceholder("some_placeholder"));
final GlobalPlaceholder somePlaceholder = expansion.globalPlaceholderByName("some_placeholder");
assertNotNull(somePlaceholder);
final var expansionResult = parse("Result: <test_some_placeholder>", expansion.globalPlaceholders());
final var placeholderResult = parse("Result: <test_some_placeholder>", somePlaceholder);
assertSimilarity("Result: test", expansionResult);
assertSimilarity("Result: test", placeholderResult);
}
@Test
void placeholdersByType() {
final Expansion expansion = Expansion.builder("idk")
.audiencePlaceholder(TestAudience.class, "test", Tags.emptyAudienceResolver())
.build();
var placeholders = expansion.placeholdersByType(PlaceholderType.AUDIENCE);
assertNotNull(placeholders);
assertEquals(placeholders, expansion.audiencePlaceholders());
}
@Test
void placeholdersByName() {
final Expansion expansion = Expansion.builder("test")
.globalPlaceholder("someexpansion", Tags.emptyGlobalPlaceholder())
.build();
final GlobalPlaceholder placeholder = expansion.globalPlaceholderByName("someexpansion");
assertNotNull(placeholder);
assertEquals("someexpansion", placeholder.name());
}
}
@@ -0,0 +1,42 @@
package io.github.miniplaceholders.test;
import io.github.miniplaceholders.api.utils.LegacyStrings;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Inserting;
import net.kyori.adventure.text.minimessage.tag.PreProcess;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class LegacyTest implements MiniTest {
@Test
void testLegacyParsing() {
final String string = "<rainbow>hello... i &8hate legacy format §bso much";
final Component parsed = LegacyStrings.parsePossibleLegacy(string);
final String result = PlainTextComponentSerializer.plainText().serialize(parsed);
final String expected = "hello... i hate legacy format so much";
assertEquals(expected, result);
}
@Test
void testMapLegacyOrElse() {
final String legacyInput = "&fhi <red>aaaa";
Tag legacyProcessedTag = LegacyStrings.mapLegacyOrElse(
legacyInput,
legacy -> Tag.inserting(LegacyStrings.parsePossibleLegacy(legacy)),
Tag::preProcessParsed
);
assertInstanceOf(Inserting.class, legacyProcessedTag);
final String modernInput = "<rainbow>aaaaaaaaaaaaa";
Tag modernProcessedTag = LegacyStrings.mapLegacyOrElse(
modernInput,
__ -> fail(),
Tag::preProcessParsed
);
assertInstanceOf(PreProcess.class, modernProcessedTag);
}
}
@@ -1,32 +1,28 @@
package io.github.miniplaceholders.test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.api.utils.TagsUtils;
import net.kyori.adventure.audience.Audience;
import io.github.miniplaceholders.api.utils.Tags;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class MiniPlaceholdersTest {
class MiniPlaceholdersTest implements MiniTest {
@Test
@Disabled("Cannot correctly calculate the equity of 2 TagResolvers obtained in different ways")
void methodEquality(){
Expansion.builder("equality")
.audiencePlaceholder("audience", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.globalPlaceholder("global", TagsUtils.EMPTY_TAG)
.audiencePlaceholder("audience", Tags.emptyAudienceResolver())
.globalPlaceholder("global", (queue, ctx) -> Tags.EMPTY_TAG)
.build()
.register();
assertEquals(
MiniPlaceholders.getAudienceGlobalPlaceholders(Audience.empty()),
MiniPlaceholders.audienceGlobalPlaceholders(),
TagResolver.resolver(
MiniPlaceholders.getAudiencePlaceholders(Audience.empty()),
MiniPlaceholders.getGlobalPlaceholders()
MiniPlaceholders.audiencePlaceholders(),
MiniPlaceholders.globalPlaceholders()
)
);
}
@@ -37,6 +33,8 @@ class MiniPlaceholdersTest {
.build();
expansion.register();
assertNotNull(MiniPlaceholders.expansionByName("testregistration"));
assertTrue(expansion.registered());
assertThrows(IllegalStateException.class, expansion::register);
@@ -0,0 +1,30 @@
package io.github.miniplaceholders.test;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public interface MiniTest {
default void assertContentEquals(Component first, Component second) {
String firstSerialized = PlainTextComponentSerializer.plainText().serialize(first);
String secondSerialized = PlainTextComponentSerializer.plainText().serialize(second);
assertEquals(firstSerialized, secondSerialized);
}
default void assertSimilarity(String string, Component component) {
final String serialized = PlainTextComponentSerializer.plainText().serializeOrNull(component);
assertNotNull(serialized);
assertEquals(string, serialized);
}
default Component parse(String string, TagResolver resolver) {
return MiniMessage.miniMessage().deserialize(string, resolver);
}
}
@@ -1,8 +1,11 @@
package io.github.miniplaceholders.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
import static org.junit.jupiter.api.Assertions.*;
import io.github.miniplaceholders.test.testobjects.TestAudience;
import io.github.miniplaceholders.api.types.RelationalAudience;
import io.github.miniplaceholders.test.instances.TestAudience;
import io.github.miniplaceholders.test.instances.TestAudienceHolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.DisplayName;
@@ -13,100 +16,136 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
class PlaceholderTest {
class PlaceholderTest implements MiniTest {
@Test
@DisplayName("Audience Placeholder Test")
void audienceExpansionPlaceholdersTest(){
TestAudience player = new TestAudience("4drian3d");
@Test
@DisplayName("Audience Placeholder Test")
void audienceExpansionPlaceholdersTest() {
TestAudience player = new TestAudience("4drian3d");
Expansion expansion = Expansion.builder("example")
.audiencePlaceholder("name", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((TestAudience)aud).name()))).build();
Expansion expansion = Expansion.builder("example")
.audiencePlaceholder("name", (aud, queue, ctx) -> {
TestAudience audience = (TestAudience) aud;
return Tag.selfClosingInserting(Component.text(audience.name()));
}).build();
final Component expected = Component.text("Player Name: 4drian3d");
final Component result = MiniMessage.miniMessage().deserialize("Player Name: <example_name>", expansion.audiencePlaceholders(player));
final Component expected = Component.text("Player Name: 4drian3d");
final Component result = miniMessage().deserialize("Player Name: <example_name>", player, expansion.audiencePlaceholders());
assertEquals(expected, result);
}
assertContentEquals(expected, result);
}
@Test
@DisplayName("Relational Placeholder Test")
void relationalExpansionPlaceholdersTest(){
Audience p1 = new TestAudience("PlayerOne");
Audience p2 = new TestAudience("PlayerTwo");
@Test
@DisplayName("Relational Placeholder Test")
void relationalExpansionPlaceholdersTest() {
Audience p1 = new TestAudience("PlayerOne");
Audience p2 = new TestAudience("PlayerTwo");
Expansion expansion = Expansion.builder("relational")
.relationalPlaceholder("enemy",
(aud, otheraud, queue, ctx) -> Tag.selfClosingInserting(this.isEnemy(((TestAudience)aud),((TestAudience)otheraud))
? Component.text("Enemy", NamedTextColor.RED)
: Component.text("Neutral", NamedTextColor.GREEN)
))
Expansion expansion = Expansion.builder("relational")
.relationalPlaceholder(TestAudience.class, "enemy",
(aud, relational, queue, ctx) ->
Tag.selfClosingInserting(this.isEnemy(aud, relational)
? Component.text("Enemy", NamedTextColor.RED)
: Component.text("Neutral", NamedTextColor.GREEN)
))
.build();
assertEquals(MiniMessage.miniMessage().deserialize("You are <red>Enemy"), MiniMessage.miniMessage().deserialize("You are <relational_rel_enemy>", expansion.relationalPlaceholders(p1, p2)));
}
assertEquals(
MiniMessage.miniMessage().deserialize("You are <red>Enemy"),
MiniMessage.miniMessage().deserialize("You are <relational_rel_enemy>",
RelationalAudience.from(p1, p2),
expansion.relationalPlaceholders()));
}
@Test
@DisplayName("Global Placeholder Test")
void globalExpansionPlaceholderTest(){
Expansion expansion = Expansion.builder("global")
@Test
@DisplayName("Global Placeholder Test")
void globalExpansionPlaceholderTest() {
Expansion expansion = Expansion.builder("global")
.globalPlaceholder("players", (queue, ctx) -> Tag.selfClosingInserting(Component.text(1305)))
.globalPlaceholder("servers", (queue, ctx) -> Tag.selfClosingInserting(Component.text(7)))
.build();
final Component expected = Component.text("Online players: 1305 | Servers: 7");
final Component actual = MiniMessage.miniMessage().deserialize("Online players: <global_players> | Servers: <global_servers>", expansion.globalPlaceholders());
final Component expected = Component.text("Online players: 1305 | Servers: 7");
final Component actual = MiniMessage.miniMessage().deserialize("Online players: <global_players> | Servers: <global_servers>",
expansion.globalPlaceholders());
assertEquals(expected, actual);
}
assertContentEquals(expected, actual);
}
@Test
@DisplayName("Registered Placeholders")
void instancePlaceholdersTest(){
Expansion.builder("instance")
@Test
@DisplayName("Registered Placeholders")
void instancePlaceholdersTest() {
Expansion.builder("instance")
.globalPlaceholder("hello", (queue, ctx) -> Tag.selfClosingInserting(Component.text("hello", NamedTextColor.RED)))
.build()
.register();
Component expected = Component.text("hello player", NamedTextColor.RED);
Component actual = MiniMessage.miniMessage().deserialize("<instance_hello> player", MiniPlaceholders.getGlobalPlaceholders());
Component expected = Component.text("hello player", NamedTextColor.RED);
Component actual = MiniMessage.miniMessage().deserialize("<instance_hello> player", MiniPlaceholders.globalPlaceholders());
assertContentEquals(expected, actual);
}
assertContentEquals(expected, actual);
}
@Test
@DisplayName("Filtered Expansion")
void filteredExpansion(){
Expansion expansion = Expansion.builder("filter")
.audiencePlaceholder("name", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((TestAudience)aud).name())))
.filter(TestAudience.class)
@Test
@DisplayName("Filtered Expansion")
void filteredExpansion() {
Expansion expansion = Expansion.builder("filter")
.audiencePlaceholder(TestAudience.class, "name",
(aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(aud.name())))
.build();
Audience player = new TestAudience("TestPlayer04");
Audience emptyAudience = Audience.empty();
Audience player = new TestAudience("TestPlayer04");
Audience emptyAudience = Audience.empty();
String string = "Player Name: <filter_name>";
String string = "Player Name: <filter_name>";
Component playerExpected = Component.text("Player Name: TestPlayer04");
Component emptyExpected = Component.text("Player Name: <filter_name>");
Component playerExpected = Component.text("Player Name: TestPlayer04");
Component emptyExpected = Component.text("Player Name: <filter_name>");
assertEquals(playerExpected, MiniMessage.miniMessage().deserialize(string, expansion.audiencePlaceholders(player)));
assertEquals(emptyExpected, MiniMessage.miniMessage().deserialize(string, expansion.audiencePlaceholders(emptyAudience)));
assertContentEquals(playerExpected, MiniMessage.miniMessage().deserialize(string, player, expansion.audiencePlaceholders()));
assertContentEquals(emptyExpected, MiniMessage.miniMessage().deserialize(string, emptyAudience, expansion.audiencePlaceholders()));
}
@Test
@DisplayName("Empty Arguments")
void testEmptyArguments() {
final Expansion expansion = Expansion.builder("test")
.globalPlaceholder("testing", (queue, ctx) -> {
int arguments = 0;
while (queue.hasNext()) {
arguments++;
Tag.Argument argument = queue.pop();
assertTrue(argument.value().isBlank());
}
return Tag.selfClosingInserting(Component.text("Arguments: " + arguments));
})
.build();
}
Component parsed = miniMessage().deserialize("<test_testing::>", expansion.globalPlaceholders());
void assertContentEquals(Component first, Component second){
String firstSerialized = PlainTextComponentSerializer.plainText().serialize(first);
String secondSerialized = PlainTextComponentSerializer.plainText().serialize(second);
assertContentEquals(parsed, Component.text("Arguments: 2"));
}
assertEquals(firstSerialized, secondSerialized);
}
@Test
@DisplayName("Forwarding Audience Parsing Test")
void forwardingAudienceTest() {
Expansion expansion = Expansion.builder("test")
.audiencePlaceholder(TestAudience.class, "testing",
(audience, queue, ctx) -> Tag.selfClosingInserting(Component.text("Name: " + audience.name())))
.build();
private boolean isEnemy(TestAudience a1, TestAudience a2){
return a1.name().equals("PlayerOne") && a2.name().equals("PlayerTwo");
}
TestAudience testAudience = new TestAudience("4drian3d");
Audience forward = new TestAudienceHolder(testAudience);
Component parsed = miniMessage().deserialize("<test_testing>.", forward, expansion.audiencePlaceholders());
Component expected = Component.text("Name: 4drian3d.");
assertContentEquals(parsed, expected);
}
private boolean isEnemy(TestAudience a1, TestAudience a2) {
return a1.name().equals("PlayerOne") && a2.name().equals("PlayerTwo");
}
}
@@ -0,0 +1,48 @@
package io.github.miniplaceholders.test;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Modifying;
import net.kyori.adventure.text.minimessage.tag.ParserDirective;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.jspecify.annotations.NonNull;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TagTest implements MiniTest {
@Test
void testTag() {
Expansion.builder("tags")
.globalPlaceholder("modifying", FilteringTag::new)
.globalPlaceholder("parser_directive", ParserDirective.RESET)
.build()
.register();
final TagResolver globalResolver = MiniPlaceholders.globalPlaceholders();
assertSimilarity("------ replacement ------", parse("------ <tags_modifying>test</tags_modifying> ------", globalResolver));
assertEquals(Component.text()
.append(Component.text("aaaaaa", NamedTextColor.RED), Component.text("aaaaaaa"))
.build(),
parse("<red>aaaaaa<tags_parser_directive>aaaaaaa", globalResolver));
}
public record FilteringTag(ArgumentQueue queue, Context context) implements Modifying {
@Override
public Component apply(@NonNull Component current, int depth) {
if (depth != 0) {
return Component.empty();
}
final String serialized = PlainTextComponentSerializer.plainText().serialize(current);
if (serialized.contains("test")) {
return Component.text(serialized.replace("test", "replacement"));
}
return current;
}
}
}
@@ -1,23 +1,17 @@
package io.github.miniplaceholders.test;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.resolver.GlobalTagResolver;
import io.github.miniplaceholders.api.utils.Tags;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.function.BiFunction;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.api.utils.TagsUtils;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
//yea... it is intended xd
@SuppressWarnings("DataFlowIssue")
class ThrowableTest {
class ThrowableTest implements MiniTest {
@Test
@DisplayName("Nullable Exception")
void throwOnNull(){
@@ -25,17 +19,8 @@ class ThrowableTest {
Expansion.Builder expansionTest = assertDoesNotThrow(() -> Expansion.builder("throwable"));
assertThrows(NullPointerException.class, () -> expansionTest.audiencePlaceholder(null, (aud, queue, ctx) -> TagsUtils.EMPTY_TAG));
assertThrows(NullPointerException.class, () -> expansionTest.globalPlaceholder("test", (BiFunction<ArgumentQueue, Context, Tag>)null));
Expansion.builder("testThrows")
.audiencePlaceholder("test", (aud, queue, ctx) -> TagsUtils.EMPTY_TAG)
.relationalPlaceholder("test2", (aud, aud2, queue, ctx) -> TagsUtils.EMPTY_TAG)
.build()
.register();
assertThrows(NullPointerException.class, () -> MiniPlaceholders.getAudiencePlaceholders(null));
assertThrows(NullPointerException.class, () -> MiniPlaceholders.getRelationalPlaceholders(null, null));
assertThrows(NullPointerException.class, () -> expansionTest.audiencePlaceholder(null, (aud, queue, ctx) -> Tags.EMPTY_TAG));
assertThrows(NullPointerException.class, () -> expansionTest.globalPlaceholder("test", (GlobalTagResolver) null));
}
@Test
@@ -43,9 +28,9 @@ class ThrowableTest {
void throwOnBlankString(){
Expansion.Builder builder = assertDoesNotThrow(() -> Expansion.builder("hello"));
assertThrows(IllegalStateException.class, () -> builder.audiencePlaceholder("", (aud, queue, ctx) -> TagsUtils.EMPTY_TAG));
assertThrows(IllegalStateException.class, () -> builder.globalPlaceholder(" ", (queue, ctx) -> TagsUtils.EMPTY_TAG));
assertThrows(IllegalStateException.class, () -> builder.audiencePlaceholder("", (aud, queue, ctx) -> Tags.EMPTY_TAG));
assertThrows(IllegalStateException.class, () -> builder.globalPlaceholder(" ", (queue, ctx) -> Tags.EMPTY_TAG));
assertDoesNotThrow(() -> builder.globalPlaceholder("hehe", (queue, ctx) -> TagsUtils.EMPTY_TAG));
assertDoesNotThrow(() -> builder.globalPlaceholder("hehe", (queue, ctx) -> Tags.EMPTY_TAG));
}
}
@@ -0,0 +1,7 @@
package io.github.miniplaceholders.test.instances;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NullMarked;
@NullMarked
public record TestAudience(String name) implements Audience {}
@@ -0,0 +1,12 @@
package io.github.miniplaceholders.test.instances;
import net.kyori.adventure.audience.ForwardingAudience;
import org.jspecify.annotations.NullMarked;
@NullMarked
public record TestAudienceHolder(TestAudience audience) implements ForwardingAudience.Single {
@Override
public TestAudience audience() {
return audience;
}
}
@@ -0,0 +1,21 @@
package io.github.miniplaceholders.test.loader;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.provider.ExpansionProvider;
import io.github.miniplaceholders.api.provider.LoadRequirement;
import io.github.miniplaceholders.api.types.Platform;
public class TestExpansionProvider implements ExpansionProvider {
@Override
public Expansion provideExpansion() {
return Expansion.builder("provided").build();
}
@Override
public LoadRequirement loadRequirement() {
return LoadRequirement.allOf(
LoadRequirement.platform(Platform.FABRIC, Platform.PAPER),
LoadRequirement.requiredComplement("luckperms", "LuckPerms")
);
}
}
@@ -1,7 +0,0 @@
package io.github.miniplaceholders.test.testobjects;
import org.jetbrains.annotations.NotNull;
import net.kyori.adventure.audience.Audience;
public record TestAudience(@NotNull String name) implements Audience {}
+2 -2
View File
@@ -5,7 +5,7 @@ plugins {
dependencies {
implementation(libs.plugin.shadow)
implementation(libs.plugin.kotlin)
implementation(libs.plugin.dokka)
implementation(libs.plugin.runtask)
}
repositories {
@@ -14,6 +14,6 @@ repositories {
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion = JavaLanguageVersion.of(25)
}
}
+4
View File
@@ -12,4 +12,8 @@ dependencyResolutionManagement {
from(files("../gradle/libs.versions.toml"))
}
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
@@ -0,0 +1,7 @@
import org.gradle.api.Project
val Project.capitalizeName: String
get() = this.name.substring(17)
.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
fun Project.simpleName(): String = this.name.substring(17)
@@ -0,0 +1,11 @@
plugins {
id("miniplaceholders.base")
}
tasks {
jar {
manifest {
attributes("Automatic-Module-Name" to "io.github.miniplaceholders.${project.simpleName()}")
}
}
}
@@ -0,0 +1,28 @@
import java.util.*
plugins {
java
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(25)
}
jar {
manifest {
attributes(
"Specification-Version" to project.version,
"Specification-Vendor" to "MiniPlaceholders",
"Implementation-Build-Date" to Date()
)
}
}
}
java{
toolchain{
languageVersion.set(JavaLanguageVersion.of(25))
vendor.set(JvmVendorSpec.AZUL)
}
}
@@ -1,80 +0,0 @@
plugins {
kotlin("jvm")
`java-library`
`maven-publish`
signing
id("org.jetbrains.dokka")
}
/*
val dokkaHtmlJar = tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
publishing {
publications {
create<MavenPublication>("maven") {
artifact(tasks["dokkaHtmlJar"])
repositories {
maven {
credentials(PasswordCredentials::class)
val central = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshots = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
if (project.version.toString().endsWith("SNAPSHOT")) {
name = "SonatypeSnapshots"
setUrl(snapshots)
} else {
name = "OSSRH"
setUrl(central)
}
}
}
from(components["java"])
pom {
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
licenses {
license {
name.set("GNU General Public License version 3 or later")
url.set("https://opensource.org/licenses/GPL-3.0")
}
}
scm {
connection.set("scm:git:https://github.com/MiniPlaceholders/MiniPlaceholders.git")
developerConnection.set("scm:git:ssh://git@github.com/MiniPlaceholders/MiniPlaceholders.git")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
}
developers {
developer {
id.set("4drian3d")
name.set("Adrian Gonzales")
email.set("adriangonzalesval@gmail.com")
}
}
issueManagement {
name.set("GitHub")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/issues")
}
ciManagement {
name.set("GitHub Actions")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/actions")
}
name.set(project.name)
description.set(project.description)
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
}
}
}
}
signing {
useGpgCmd()
sign(configurations.archives.get())
sign(publishing.publications["maven"])
sign(tasks["dokkaHtmlJar"])
}
java {
withSourcesJar()
}*/
@@ -1,71 +0,0 @@
plugins {
`java-library`
`maven-publish`
signing
}
/*
publishing {
publications {
create<MavenPublication>("maven") {
repositories {
maven {
credentials(PasswordCredentials::class)
val central = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshots = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
if (project.version.toString().endsWith("SNAPSHOT")) {
name = "SonatypeSnapshots"
setUrl(snapshots)
} else {
name = "OSSRH"
setUrl(central)
}
}
}
from(components["java"])
pom {
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
licenses {
license {
name.set("GNU General Public License version 3 or later")
url.set("https://opensource.org/licenses/GPL-3.0")
}
}
scm {
connection.set("scm:git:https://github.com/MiniPlaceholders/MiniPlaceholders.git")
developerConnection.set("scm:git:ssh://git@github.com/MiniPlaceholders/MiniPlaceholders.git")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
}
developers {
developer {
id.set("4drian3d")
name.set("Adrian Gonzales")
email.set("adriangonzalesval@gmail.com")
}
}
issueManagement {
name.set("GitHub")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/issues")
}
ciManagement {
name.set("GitHub Actions")
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/actions")
}
name.set(project.name)
description.set(project.description)
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
}
}
}
}
signing {
useGpgCmd()
sign(configurations.archives.get())
sign(publishing.publications["maven"])
}*/
java {
withSourcesJar()
}
@@ -0,0 +1,32 @@
import org.gradle.api.tasks.bundling.Jar
import xyz.jpenilla.runtask.task.RunWithPlugins
import java.nio.file.Files
import java.nio.file.StandardCopyOption
import kotlin.io.path.deleteIfExists
tasks {
withType<RunWithPlugins> {
val exampleExpansionProviderProject = project(":miniplaceholders-example-expansion-provider")
val exampleExpansionJarTask = exampleExpansionProviderProject.tasks.named<Jar>("jar")
dependsOn(exampleExpansionJarTask)
doFirst {
val folderName = if (project.name.contains("velocity")) "miniplaceholders" else "MiniPlaceholders"
val expansionsDirectory = runDirectory.get().file("plugins/$folderName/expansions").asFile.toPath()
if (Files.exists(expansionsDirectory)) {
Files.newDirectoryStream(expansionsDirectory).use {
it.forEach { file ->
file.deleteIfExists()
}
}
} else {
Files.createDirectories(expansionsDirectory)
}
val exampleExpansionFile = exampleExpansionJarTask.get().archiveFile.get().asFile.toPath()
Files.copy(
exampleExpansionFile,
expansionsDirectory.resolve(exampleExpansionFile.fileName),
StandardCopyOption.REPLACE_EXISTING
)
}
}
}
@@ -0,0 +1,19 @@
plugins {
id("miniplaceholders.base")
id("com.gradleup.shadow")
}
tasks {
shadowJar {
archiveBaseName.set("MiniPlaceholders-${project.capitalizeName}")
archiveClassifier.set("")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
relocate("net.william278.desertwell", "io.github.miniplaceholders.libs.desertwell")
relocate("org.bstats", "io.github.miniplaceholders.libs.bstats")
destinationDirectory.set(file("${project.rootDir}/jar"))
}
build {
dependsOn(shadowJar)
}
}
+3 -29
View File
@@ -1,35 +1,9 @@
plugins {
java
alias(libs.plugins.shadow)
kotlin("jvm") version "1.8.21" apply false
}
allprojects {
apply<JavaPlugin>()
repositories {
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.maven.apache.org/maven2/")
maven("https://jitpack.io") {
mavenContent {
includeGroup("net.william278")
}
}
}
}
dependencies {
implementation(projects.miniplaceholdersVelocity)
implementation(project(":miniplaceholders-paper", "reobf"))
implementation(projects.miniplaceholdersKrypton)
kotlin("jvm") version "2.3.20" apply false
}
tasks {
shadowJar {
archiveFileName.set("MiniPlaceholders-${project.version}.jar")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
relocate("net.william278.desertwell", "io.github.miniplaceholders.libs.desertwell")
}
build {
dependsOn(shadowJar)
delete {
delete("jar")
}
}
+12 -22
View File
@@ -1,38 +1,28 @@
plugins {
id("miniplaceholders.auto.module")
alias(libs.plugins.idea.ext)
alias(libs.plugins.blossom)
}
repositories {
maven("https://libraries.minecraft.net") {
mavenContent {
includeGroup("com.mojang")
}
}
}
dependencies {
implementation(projects.miniplaceholdersApi)
implementation(libs.desertwell) {
exclude("org.json")
}
implementation(libs.unnamedinject)
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.minimesssage)
compileOnly(libs.adventure.minimessage)
compileOnly(libs.jspecify)
compileOnly(libs.brigadier)
compileOnly(libs.bstats.core)
}
blossom{
replaceToken("{version}", project.version)
replaceTokenIn("src/main/java/io/github/miniplaceholders/common/PluginConstants.java")
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
jar {
manifest {
attributes("Automatic-Module-Name" to "io.github.miniplaceholders.common")
sourceSets {
main {
blossom {
javaSources {
property("version", project.version.toString())
}
}
}
}
@@ -0,0 +1,7 @@
package io.github.miniplaceholders.common;
public final class PluginConstants {
public static final String VERSION = "{{ version }}";
private PluginConstants() {}
}
@@ -1,212 +0,0 @@
package io.github.miniplaceholders.common;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode;
import io.github.miniplaceholders.api.MiniPlaceholders;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.builder.AbstractBuilder;
import net.kyori.adventure.permission.PermissionChecker;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.kyori.adventure.util.TriState;
import net.william278.desertwell.about.AboutMenu;
import net.william278.desertwell.util.Version;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.function.Supplier;
import static com.mojang.brigadier.arguments.StringArgumentType.*;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.CompletableFuture.supplyAsync;
import static net.kyori.adventure.text.Component.*;
import static net.kyori.adventure.text.format.NamedTextColor.RED;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
public final class PlaceholdersCommand<A> {
private final Supplier<Collection<String>> playersSuggestions;
private final Function<String, Audience> toAudience;
private final Function<A, Audience> sourceToAudience;
private final BiPredicate<A, String> hasPermission;
private PlaceholdersCommand(
final Supplier<Collection<String>> playersSuggestions,
final Function<String, Audience> toAudience,
final Function<A, Audience> sourceToAudience,
final BiPredicate<A, String> hasPermission
) {
this.playersSuggestions = playersSuggestions;
this.toAudience = toAudience;
this.sourceToAudience = sourceToAudience;
this.hasPermission = hasPermission;
}
private static final Component HELP = text()
.append(newline())
.append(miniMessage()
.deserialize("<gradient:aqua:white:aqua><st><b> </st> <gradient:#4d8bff:#a4ff96>MiniPlaceholders</gradient> <st><b> </st>"))
.append(newline())
.append(miniMessage()
.deserialize(
"<gradient:#9694ff:#5269ff>Commands:</gradient>"))
.append(newline())
.append(miniMessage()
.deserialize(
"<gradient:aqua:#94d1ff>/miniplaceholders</gradient> <aqua>help</aqua>"))
.append(newline())
.append(miniMessage()
.deserialize(
"<gradient:aqua:#94d1ff>/miniplaceholders</gradient> <aqua>parse</aqua> <#8fadff><player | me></#8fadff> <#99ffb6><player></#99ffb6>"))
.append(newline())
.append(miniMessage()
.deserialize("<gradient:aqua:white:aqua><st><b> "))
.build();
private static final Component INFO = AboutMenu.builder()
.title(miniMessage().deserialize("<gradient:#4d8bff:#a4ff96>MiniPlaceholders</gradient>"))
.description(text("MiniMessage Component-based Placeholders for PaperMC, Folia, Fabric, Velocity and Krypton platforms"))
.credits("Author", AboutMenu.Credit.of("4drian3d").url("https://github.com/4drian3d"))
.credits("Contributors", AboutMenu.Credit.of("Sliman4"))
.buttons(
AboutMenu.Link.of("https://github.com/MiniPlaceholders/MiniPlaceholders/wiki/User-Getting-Started").text("Documentation").icon("⛏"),
AboutMenu.Link.of("https://discord.gg/5NMMzK5mAn").text("Discord").color(TextColor.color(0x7289da)).icon("⭐"),
AboutMenu.Link.of("https://modrinth.com/plugin/miniplaceholders").text("Downloads").color(TextColor.color(0xff496e)).icon("↓")
).version(Version.fromString(PluginConstants.VERSION))
.build()
.toComponent();
public LiteralArgumentBuilder<A> asBuilder(String commandName){
return LiteralArgumentBuilder.<A>literal(commandName)
.requires(a -> permissionValue(a, "miniplaceholders.command") != TriState.FALSE)
.executes(cmd -> {
Audience source = getAudience(cmd.getSource());
source.sendMessage(INFO);
return Command.SINGLE_SUCCESS;
})
.then(LiteralArgumentBuilder.<A>literal("help")
.requires(src -> permissionValue(src, "miniplaceholders.command.help").toBooleanOrElse(false))
.executes(cmd -> {
getAudience(cmd.getSource()).sendMessage(HELP);
return Command.SINGLE_SUCCESS;
})
)
.then(LiteralArgumentBuilder.<A>literal("parse")
.requires(cmd -> permissionValue(cmd, "miniplaceholders.command.parse").toBooleanOrElse(false))
.then(LiteralArgumentBuilder.<A>literal("me")
.requires(cmd -> permissionValue(cmd, "miniplaceholders.command.parse.me").toBooleanOrElse(false))
.then(RequiredArgumentBuilder.<A, String>argument("string", string())
.executes(cmd -> {
final String toParse = getString(cmd, "string");
final Component parsed = parseGlobal(toParse, getAudience(cmd.getSource()));
getAudience(cmd.getSource()).sendMessage(parsed);
return Command.SINGLE_SUCCESS;
})
)
)
.then(LiteralArgumentBuilder.<A>literal("player")
.requires(cmd -> permissionValue(cmd, "miniplaceholders.command.parse.player").toBooleanOrElse(false))
.then(RequiredArgumentBuilder.<A, String>argument("source", word())
.suggests((argument, builder) -> supplyAsync(() -> {
playersSuggestions.get().forEach(builder::suggest);
return builder.build();
}))
.then(RequiredArgumentBuilder.<A, String>argument("string", string())
.executes(cmd -> {
final Audience objective = toAudience.apply(getString(cmd, "source"));
if (objective == null){
getAudience(cmd.getSource()).sendMessage(text("You must specify a valid player", RED));
return -1;
}
final String toParse = cmd.getArgument("string", String.class);
final Component parsed = parseGlobal(toParse, objective);
getAudience(cmd.getSource()).sendMessage(parsed);
return Command.SINGLE_SUCCESS;
})
)
)
)
);
}
public LiteralCommandNode<A> asNode(String command) {
return asBuilder(command).build();
}
private Component parseGlobal(final String string, final Audience audience) {
return miniMessage().deserialize(
string,
TagResolver.resolver(
MiniPlaceholders.getGlobalPlaceholders(),
MiniPlaceholders.getAudiencePlaceholders(audience)
)
);
}
private Audience getAudience(final A possibleAudience) {
if (possibleAudience instanceof Audience audience) {
return audience;
}
final Audience audience = sourceToAudience.apply(possibleAudience);
return audience != null ? audience : Audience.empty();
}
private TriState permissionValue(final A source, final String permission) {
if (hasPermission != null) {
return TriState.byBoolean(hasPermission.test(source, permission));
}
return getAudience(source)
.get(PermissionChecker.POINTER)
.map(checker -> checker.value(permission))
.orElse(TriState.FALSE);
}
public static <A> Builder<A> builder() {
return new Builder<>();
}
public final static class Builder<A> implements AbstractBuilder<PlaceholdersCommand<A>> {
private Supplier<Collection<String>> playersSuggestions;
private Function<String, Audience> toAudience;
private Function<A, Audience> fromAToAudience = a -> Audience.empty();
private BiPredicate<A, String> hasPermission;
private Builder() {}
public Builder<A> playerSuggestions(final Supplier<@NotNull Collection<@NotNull String>> playersSuggestions) {
this.playersSuggestions = playersSuggestions;
return this;
}
public Builder<A> toAudience(final @NotNull Function<@NotNull String, @Nullable Audience> argumentToAudience) {
this.toAudience = argumentToAudience;
return this;
}
public Builder<A> fromSourceToAudience(final @NotNull Function<@NotNull A, @Nullable Audience> sourceToAudience) {
this.fromAToAudience = sourceToAudience;
return this;
}
public Builder<A> hasPermissionCheck(final @NotNull BiPredicate<@NotNull A, @NotNull String> hasPermission) {
this.hasPermission = hasPermission;
return this;
}
@Override
public @NotNull PlaceholdersCommand<A> build() {
return new PlaceholdersCommand<>(
requireNonNull(playersSuggestions),
requireNonNull(toAudience),
requireNonNull(fromAToAudience),
hasPermission
);
}
}
}
@@ -1,7 +1,135 @@
package io.github.miniplaceholders.common;
public interface PlaceholdersPlugin {
void loadDefaultExpansions();
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.api.provider.ExpansionProvider;
import io.github.miniplaceholders.api.provider.LoadRequirement;
import io.github.miniplaceholders.api.provider.PlatformData;
import io.github.miniplaceholders.api.types.Platform;
import io.github.miniplaceholders.common.loader.ExpansionProviderLoader;
import io.github.miniplaceholders.common.loader.FailedToLoadExpansion;
import io.github.miniplaceholders.common.loader.ProviderLoadResult;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import team.unnamed.inject.Injector;
void registerPlatformCommand();
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public interface PlaceholdersPlugin {
default void registerPlatformCommand() {
}
default void loadProvidedExpansions(final Path providersFolderDirectory) throws Exception {
final List<Expansion> loadedExpansions = new ArrayList<>();
final PlatformData platformData = new PlatformData(this.platformServerInstance(), this);
final Injector injector = Injector.create(binder -> binder.bind(PlatformData.class).toInstance(platformData));
for (Class<?> providerClass : ExpansionProviderLoader.loadProvidersFromFolder(providersFolderDirectory)) {
final ExpansionProvider provider = (ExpansionProvider) injector.getInstance(providerClass);
final ProviderLoadResult loadResult = tryLoad(provider, provider.loadRequirement());
final ExpansionProvider loadedProvider = loadResult.provider();
if (loadedProvider != null) {
final Expansion loadedExpansion = loadedProvider.provideExpansion();
loadedExpansions.add(loadedExpansion);
loadedExpansion.register();
continue;
}
final FailedToLoadExpansion failedToLoad = loadResult.failed();
logError(Component.text("The expansion "
+ providerClass +
" could not be loaded because the requirement " + failedToLoad.requirement() + " could not be resolved",
NamedTextColor.RED));
}
if (loadedExpansions.isEmpty()) {
logInfo(Component.text("Not found expansions", NamedTextColor.GRAY));
return;
}
final Component expansionsInfo = loadedExpansions.stream()
.map(this::expansionInfo)
.collect(Component.toComponent(Component.text(", ", NamedTextColor.WHITE)));
logInfo(Component.text("Loaded expansions: ", NamedTextColor.GREEN).append(expansionsInfo));
}
private Component expansionInfo(Expansion expansion) {
final TextComponent.Builder builder = Component.text();
builder.append(Component.text(expansion.name(), NamedTextColor.AQUA));
final String author = expansion.author();
final String version = expansion.version();
if (author == null && version == null) {
return builder.build();
}
builder.append(Component.text('[', NamedTextColor.DARK_GRAY));
if (author != null) {
builder.append(
Component.text("Author", NamedTextColor.GRAY),
Component.text(':', NamedTextColor.WHITE),
Component.space(),
Component.text(author, TextColor.color(0xd4ff54))
);
}
if (version != null) {
if (author != null) {
builder.append(Component.text(", ", NamedTextColor.WHITE));
}
builder.append(
Component.text("Version", NamedTextColor.GRAY),
Component.text(':', NamedTextColor.WHITE),
Component.space(),
Component.text(version, TextColor.color(0xd4ff54))
);
}
builder.append(Component.text(']', NamedTextColor.DARK_GRAY));
return builder.build();
}
default ProviderLoadResult tryLoad(final ExpansionProvider provider, final LoadRequirement loadRequirement) {
return switch (loadRequirement) {
case LoadRequirement.PlatformRequirement platformRequirement -> {
for (final Platform supportedPlatform : platformRequirement.platforms()) {
if (supportedPlatform == MiniPlaceholders.platform()) {
yield ProviderLoadResult.ofLoaded(provider);
}
}
yield ProviderLoadResult.ofFailed(platformRequirement);
}
case LoadRequirement.AvailableComplementRequirement complementRequirement ->
complementRequirement.shouldLoad(this::platformHasComplementLoaded)
? ProviderLoadResult.ofLoaded(provider)
: ProviderLoadResult.ofFailed(complementRequirement);
case LoadRequirement.MultiLoadRequirement multiLoadRequirement -> {
ProviderLoadResult loadResult;
for (final LoadRequirement requirement : multiLoadRequirement.requirements()) {
if ((loadResult = this.tryLoad(provider, requirement)).failed() != null) {
yield loadResult;
}
}
yield ProviderLoadResult.ofLoaded(provider);
}
case LoadRequirement.ClassRequirement classRequirement -> classRequirement.shouldLoad()
? ProviderLoadResult.ofLoaded(provider) : ProviderLoadResult.ofFailed(classRequirement);
case LoadRequirement.AnyOfRequirement anyOfRequirement -> {
ProviderLoadResult loadResult;
for (final LoadRequirement requirement : anyOfRequirement.requirements()) {
if ((loadResult = this.tryLoad(provider, requirement)).provider() != null) {
yield loadResult;
}
}
yield ProviderLoadResult.ofFailed(anyOfRequirement);
}
case LoadRequirement.NoneLoadRequirement ignored -> ProviderLoadResult.ofLoaded(provider);
};
}
boolean platformHasComplementLoaded(String complementName);
void logError(Component component);
void logInfo(Component component);
Object platformServerInstance();
}
@@ -1,7 +0,0 @@
package io.github.miniplaceholders.common;
public final class PluginConstants {
public static final String VERSION = "{version}";
private PluginConstants(){}
}
@@ -0,0 +1,10 @@
package io.github.miniplaceholders.common.command;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
@FunctionalInterface
public interface AudienceConverter {
@Nullable Audience convert(@NonNull String string);
}
@@ -0,0 +1,10 @@
package io.github.miniplaceholders.common.command;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NullMarked;
@NullMarked
@FunctionalInterface
public interface AudienceExtractor<S> {
Audience extract(S source);
}
@@ -0,0 +1,104 @@
package io.github.miniplaceholders.common.command;
import com.google.common.base.Suppliers;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.api.types.Platform;
import io.github.miniplaceholders.common.PluginConstants;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import net.william278.desertwell.about.AboutMenu;
import net.william278.desertwell.util.Version;
import java.util.function.Supplier;
import static net.kyori.adventure.text.Component.newline;
import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
public final class CommandConstants {
// Global
public static final Component TITLE = miniMessage().deserialize("<b><gradient:#4d8bff:#a4ff96>MiniPlaceholders</b>");
public static final Component HEADER = miniMessage().deserialize(
"""
<gradient:aqua:white:aqua><st><b> </st> \
<title> \
<st><b> </st>""", Placeholder.component("title", TITLE));
public static final Component FOOTER = miniMessage().deserialize(
"<gradient:aqua:white:aqua><st><b> ");
// -- /miniplaceholders --
public static final Component INFO = AboutMenu.builder()
.title(TITLE)
.description(text("MiniMessage Component-based Placeholders API"))
.credits("Author", AboutMenu.Credit.of("4drian3d").url("https://github.com/4drian3d"))
.credits("Contributors",
AboutMenu.Credit.of("Sliman4"),
AboutMenu.Credit.of("Stampede2011"),
AboutMenu.Credit.of("powercasgamer"),
AboutMenu.Credit.of("fabianmakila"),
AboutMenu.Credit.of("Willsr71")
)
.buttons(
AboutMenu.Link.of("https://miniplaceholders.github.io/docs/category/user-guide").text("Documentation").icon("⛏"),
AboutMenu.Link.of("https://discord.gg/5NMMzK5mAn").text("Discord").color(TextColor.color(0x7289da)).icon("⭐"),
AboutMenu.Link.of("https://modrinth.com/plugin/miniplaceholders").text("Downloads").color(TextColor.color(0xff496e)).icon("↓")
).version(Version.fromString(PluginConstants.VERSION))
.build()
.toComponent();
// -- /miniplaceholders help --
public static final Supplier<Component> HELP = Suppliers.memoize(() -> {
final Platform platform = MiniPlaceholders.platform();
final String command = platform == Platform.VELOCITY ? "/vminiplaceholders" : "/miniplaceholders";
return text()
.append(newline(), HEADER)
.append(newline(), miniMessage().deserialize(
"<gradient:#9694ff:#5269ff>Commands:</gradient>")
)
.append(newline(), miniMessage().deserialize(
"<gradient:aqua:#94d1ff>" + command + "</gradient> <aqua>help</aqua>")
.clickEvent(ClickEvent.runCommand(command + " help"))
)
.append(newline(), miniMessage().deserialize(
"""
<gradient:aqua:#94d1ff>%s</gradient> \
<aqua>parse</aqua> \
<#8fadff><player | me | --null></#8fadff> \
<#99ffb6><message></#99ffb6>""".formatted(command))
.clickEvent(ClickEvent.suggestCommand(command + " parse "))
)
.append(newline(), miniMessage().deserialize(
"""
<gradient:aqua:#94d1ff>%s</gradient> \
<aqua>parserel</aqua> \
<#8fadff><player | me></#8fadff> \
<#8fadff><relational player | me></#8fadff> \
<#99ffb6><message></#99ffb6>""".formatted(command))
.clickEvent(ClickEvent.suggestCommand(command + " parserel "))
)
.append(newline(), miniMessage().deserialize(
"<gradient:aqua:#94d1ff>" + command + "</gradient> <aqua>expansions</aqua>")
.clickEvent(ClickEvent.runCommand(command + " expansions"))
)
.append(newline(), FOOTER)
.build();
});
// -- /miniplaceholders expansions --
public static final Component EXPANSIONS_TITLE = miniMessage().deserialize(
"""
<br><gradient:aqua:white:aqua><st><b> </st> \
<title> Expansions <st><b> \
</gradient><br>""", Placeholder.component("title", TITLE)
);
public static final Supplier<Component> NON_INSTALLED_EXPANSIONS = Suppliers.memoize(() -> miniMessage().deserialize(
"""
<aqua>It seems that you don't have any <#a1ff4a>Expansion</#a1ff4a> installed yet,
You can find the <#a1ff4a>Expansion</#a1ff4a> you want here <br>\
<blue><click:open_url:"https://miniplaceholders.github.io/docs/user-guide/Placeholders">\
<hover:show_text:"<gold>Search Expansions">[MiniPlaceholders Expansions]</blue>""")
);
}
@@ -0,0 +1,13 @@
package io.github.miniplaceholders.common.command;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.util.TriState;
import org.jspecify.annotations.NullMarked;
@NullMarked
@FunctionalInterface
public interface PermissionTester {
TriState permissionValue(Audience audience, String permission);
PermissionTester NO_OP = (audience, permission) -> TriState.NOT_SET;
}
@@ -0,0 +1,9 @@
package io.github.miniplaceholders.common.command;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NonNull;
@FunctionalInterface
public interface PlaceholderCommandExecutor {
void execute(@NonNull Audience audience);
}
@@ -0,0 +1,10 @@
package io.github.miniplaceholders.common.command;
import org.jspecify.annotations.NonNull;
import java.util.ArrayList;
@FunctionalInterface
public interface PlayersNameProvider {
@NonNull ArrayList<String> provide();
}
@@ -0,0 +1,97 @@
package io.github.miniplaceholders.common.command.brigadier;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.tree.LiteralCommandNode;
import io.github.miniplaceholders.common.command.*;
import io.github.miniplaceholders.common.command.node.*;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NullMarked;
@NullMarked
public final class BrigadierCommandProvider {
public static <A> LiteralCommandNode<A> provideCommand(
final String command,
final PlayersNameProvider playersSuggestions,
final AudienceConverter audienceConverter,
final AudienceExtractor<A> audienceExtractor,
final PermissionTester permissionChecker
) {
// Inspired by MiniMotd command implementation (MIT licenced)
class WrappingExecutor implements Command<A> {
private final PlaceholderCommandExecutor executor;
private WrappingExecutor(final PlaceholderCommandExecutor executor) {
this.executor = executor;
}
@Override
public int run(final CommandContext<A> commandContext) {
executor.execute(audienceExtractor.extract(commandContext.getSource()));
return Command.SINGLE_SUCCESS;
}
}
// Command Nodes
final RootNode rootNode = new RootNode(permissionChecker);
final ExpansionsNode expansionsNode = new ExpansionsNode(permissionChecker);
final HelpNode helpNode = new HelpNode(permissionChecker);
final ParseNode parseNode = new ParseNode(playersSuggestions, audienceConverter, permissionChecker);
final ParseRelNode parseRelNode = new ParseRelNode(playersSuggestions, audienceConverter, permissionChecker);
return LiteralArgumentBuilder.<A>literal(command)
.requires(src -> rootNode.hasPermission(audienceExtractor.extract(src)))
.executes(new WrappingExecutor(rootNode::execute))
.then(LiteralArgumentBuilder.<A>literal("expansions")
.requires(src -> expansionsNode.hasPermission(audienceExtractor.extract(src)))
.executes(new WrappingExecutor(expansionsNode::showExpansions))
.build()
)
.then(LiteralArgumentBuilder.<A>literal("help")
.executes(new WrappingExecutor(helpNode::execute))
.requires(src -> helpNode.hasPermission(audienceExtractor.extract(src)))
)
.then(LiteralArgumentBuilder.<A>literal("parse")
.requires(src -> parseNode.hasPermission(audienceExtractor.extract(src)))
.then(RequiredArgumentBuilder.<A, String>argument("source", StringArgumentType.word())
.suggests(new BrigadierSuggestionProvider<>(parseNode))
.then(RequiredArgumentBuilder.<A, String>argument("message", StringArgumentType.greedyString())
.executes(ctx -> {
final Audience audience = audienceExtractor.extract(ctx.getSource());
final String source = StringArgumentType.getString(ctx, "source");
final String message = StringArgumentType.getString(ctx, "message");
parseNode.parseString(audience, source, message);
return Command.SINGLE_SUCCESS;
})
)
)
)
.then(LiteralArgumentBuilder.<A>literal("parserel")
.requires(src -> parseRelNode.hasPermission(audienceExtractor.extract(src)))
.then(RequiredArgumentBuilder.<A, String>argument("source", StringArgumentType.word())
.suggests(new BrigadierSuggestionProvider<>(parseRelNode))
.then(RequiredArgumentBuilder.<A, String>argument("relational", StringArgumentType.word())
.suggests(new BrigadierSuggestionProvider<>(parseRelNode))
.then(RequiredArgumentBuilder.<A, String>argument("message", StringArgumentType.greedyString())
.executes(ctx -> {
final Audience audience = audienceExtractor.extract(ctx.getSource());
final String source = StringArgumentType.getString(ctx, "source");
final String relational = StringArgumentType.getString(ctx, "source");
final String message = StringArgumentType.getString(ctx, "message");
parseRelNode.parseString(audience, source, relational, message);
return Command.SINGLE_SUCCESS;
})
)
)
)
)
.build();
}
}
@@ -0,0 +1,19 @@
package io.github.miniplaceholders.common.command.brigadier;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import io.github.miniplaceholders.common.command.node.PlayerCompleterNode;
import org.jspecify.annotations.NullMarked;
import java.util.concurrent.CompletableFuture;
@NullMarked
public record BrigadierSuggestionProvider<A>(PlayerCompleterNode playerSuggestions) implements SuggestionProvider<A> {
@Override
public CompletableFuture<Suggestions> getSuggestions(final CommandContext<A> context, final SuggestionsBuilder builder) {
this.playerSuggestions.providePlayerSuggestions().forEach(builder::suggest);
return builder.buildFuture();
}
}
@@ -0,0 +1,65 @@
package io.github.miniplaceholders.common.command.node;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.common.command.PermissionTester;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import org.jspecify.annotations.NullMarked;
import java.util.Collection;
import static io.github.miniplaceholders.common.command.CommandConstants.*;
@NullMarked
public record ExpansionsNode(PermissionTester permissionTester) implements Node {
public void showExpansions(final Audience audience) {
final TextComponent.Builder builder = Component.text()
.append(EXPANSIONS_TITLE);
final Collection<Expansion> expansions = MiniPlaceholders.expansionsAvailable();
if (expansions.isEmpty()) {
// In virtually all installations, there will always be some expansion installed,
// so there is no need to cache this component in that case
builder.append(NON_INSTALLED_EXPANSIONS.get());
} else {
builder.append(expansions.stream()
.map(expansion -> {
final TextComponent.Builder expansionMetaBuilder = Component.text();
final String expansionName = expansion.name();
final String expansionAuthor = expansion.author();
final String expansionVersion = expansion.version();
expansionMetaBuilder.append(Component.text(expansionName, NamedTextColor.GRAY));
if (expansionAuthor != null) {
expansionMetaBuilder.appendNewline()
.append(Component.text("Author: ", TextColor.color(0x29fbff)))
.append(Component.text(expansionAuthor, NamedTextColor.GRAY));
}
if (expansionVersion != null) {
expansionMetaBuilder.appendNewline()
.append(Component.text("Version: ", TextColor.color(0xff7b61)))
.append(Component.text(expansionVersion, NamedTextColor.GRAY));
}
return Component.text()
.content(expansion.name())
.hoverEvent(expansionMetaBuilder.build())
.build();
}).collect(Component.toComponent(Component.text(" | ", NamedTextColor.DARK_GRAY))));
}
builder.appendNewline().append(FOOTER);
audience.sendMessage(builder.build());
}
@Override
public boolean hasPermission(Audience audience) {
return permissionTester.permissionValue(audience, permission()).toBooleanOrElse(false);
}
@Override
public String permission() {
return "miniplaceholders.command.expansions";
}
}
@@ -0,0 +1,24 @@
package io.github.miniplaceholders.common.command.node;
import io.github.miniplaceholders.common.command.PermissionTester;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NullMarked;
import static io.github.miniplaceholders.common.command.CommandConstants.HELP;
@NullMarked
public record HelpNode(PermissionTester permissionChecker) implements Node {
public void execute(final Audience audience) {
audience.sendMessage(HELP.get());
}
@Override
public boolean hasPermission(Audience audience) {
return permissionChecker.permissionValue(audience, permission()).toBooleanOrElse(false);
}
@Override
public String permission() {
return "miniplaceholders.command.help";
}
}
@@ -0,0 +1,11 @@
package io.github.miniplaceholders.common.command.node;
import net.kyori.adventure.audience.Audience;
import org.jspecify.annotations.NullMarked;
@NullMarked
public sealed interface Node permits ExpansionsNode, HelpNode, ParseNode, ParseRelNode, RootNode {
boolean hasPermission(Audience audience);
String permission();
}
@@ -0,0 +1,59 @@
package io.github.miniplaceholders.common.command.node;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.common.command.AudienceConverter;
import io.github.miniplaceholders.common.command.PermissionTester;
import io.github.miniplaceholders.common.command.PlayersNameProvider;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jspecify.annotations.NullMarked;
import java.util.List;
import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.format.NamedTextColor.RED;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
@NullMarked
public record ParseNode(
PlayersNameProvider playersNameProvider,
AudienceConverter audienceConverter,
PermissionTester permissionChecker
) implements Node, PlayerCompleterNode {
public void parseString(final Audience sender, final String providedSource, final String providedString) {
final Audience source = switch (providedSource) {
case "me" -> sender;
case "--null" -> Audience.empty();
default -> audienceConverter.convert(providedSource);
};
if (source == null) {
sender.sendMessage(text("You must specify a valid player", RED));
return;
}
final TagResolver resolver = source == Audience.empty()
? MiniPlaceholders.globalPlaceholders()
: MiniPlaceholders.audienceGlobalPlaceholders();
final Component parsed = miniMessage().deserialize(providedString, source, resolver);
sender.sendMessage(parsed);
}
@Override
public boolean hasPermission(final Audience audience) {
return permissionChecker.permissionValue(audience, permission()).toBooleanOrElse(false);
}
@Override
public String permission() {
return "miniplaceholders.command.parse";
}
@Override
public List<String> providePlayerSuggestions() {
final List<String> suggestions = PlayerCompleterNode.super.providePlayerSuggestions();
suggestions.add("--null");
return suggestions;
}
}
@@ -0,0 +1,59 @@
package io.github.miniplaceholders.common.command.node;
import io.github.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.api.types.RelationalAudience;
import io.github.miniplaceholders.common.command.AudienceConverter;
import io.github.miniplaceholders.common.command.PermissionTester;
import io.github.miniplaceholders.common.command.PlayersNameProvider;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import org.jspecify.annotations.NullMarked;
import static net.kyori.adventure.text.Component.text;
import static net.kyori.adventure.text.format.NamedTextColor.RED;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
@NullMarked
public record ParseRelNode(
PlayersNameProvider playersNameProvider,
AudienceConverter audienceConverter,
PermissionTester permissionChecker
) implements Node, PlayerCompleterNode {
public void parseString(final Audience sender, final String source, final String relational, final String toParse) {
final Audience senderTarget = "me".equals(source)
? sender
: audienceConverter.convert(source);
if (senderTarget == null) {
sender.sendMessage(text("You must specify a valid player", RED));
return;
}
final Audience relationalTarget = "me".equals(relational)
? sender
: audienceConverter.convert(relational);
if (relationalTarget == null) {
sender.sendMessage(text("You must specify a valid relational player", RED));
return;
}
final RelationalAudience<Audience> relationalAudience = RelationalAudience.from(senderTarget, relationalTarget);
final Component parsed = miniMessage().deserialize(
toParse,
relationalAudience,
MiniPlaceholders.relationalGlobalPlaceholders()
);
sender.sendMessage(parsed);
}
@Override
public boolean hasPermission(Audience audience) {
return permissionChecker.permissionValue(audience, permission()).toBooleanOrElse(false);
}
@Override
public String permission() {
return "miniplaceholders.command.parse";
}
}
@@ -0,0 +1,15 @@
package io.github.miniplaceholders.common.command.node;
import io.github.miniplaceholders.common.command.PlayersNameProvider;
import java.util.List;
public interface PlayerCompleterNode {
default List<String> providePlayerSuggestions() {
final List<String> suggestions = playersNameProvider().provide();
suggestions.add("me");
return suggestions;
}
PlayersNameProvider playersNameProvider();
}
@@ -0,0 +1,26 @@
package io.github.miniplaceholders.common.command.node;
import io.github.miniplaceholders.common.command.PermissionTester;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.util.TriState;
import org.jspecify.annotations.NullMarked;
import static io.github.miniplaceholders.common.command.CommandConstants.INFO;
@NullMarked
public record RootNode(PermissionTester permissionChecker) implements Node {
public void execute(Audience audience) {
audience.sendMessage(INFO);
}
@Override
public boolean hasPermission(Audience audience) {
return permissionChecker.permissionValue(audience, permission()) != TriState.FALSE;
}
@Override
public String permission() {
return "miniplaceholders.command";
}
}
@@ -0,0 +1,95 @@
package io.github.miniplaceholders.common.loader;
import io.github.miniplaceholders.api.provider.ExpansionProvider;
import org.jspecify.annotations.NullMarked;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
@NullMarked
public final class ExpansionProviderLoader {
public static List<Class<?>> loadProvidersFromFolder(final Path folferPath) throws Exception {
if (Files.notExists(folferPath)) {
try {
Files.createDirectories(folferPath);
} catch (IOException e) {
throw new RuntimeException("Unable to create expansions directory", e);
}
return List.of();
}
try (final DirectoryStream<Path> stream = Files.newDirectoryStream(folferPath,
filtered -> Files.isRegularFile(filtered) && filtered.toString().endsWith(".jar"))) {
final List<Class<?>> providerList = new ArrayList<>();
for (final Path possibleProviderPath : stream) {
loadPossibleProviderFromPath(possibleProviderPath, providerList);
}
return providerList;
}
}
private static void loadPossibleProviderFromPath(
final Path filePath,
final List<Class<?>> providers
) throws Exception {
String mainClassName = null;
try (final JarInputStream jarStream = new JarInputStream(Files.newInputStream(filePath))) {
JarEntry actualEntry;
while ((actualEntry = jarStream.getNextJarEntry()) != null) {
final String entryName = actualEntry.getName();
if (!Objects.equals(entryName, "expansion-provider.properties")) {
continue;
}
try (final Reader reader = new InputStreamReader(jarStream)) {
Properties properties = new Properties();
properties.load(reader);
mainClassName = properties.getProperty("provider-class");
break;
} catch (IOException e) {
throw new IOException("Unable to read expansion_provider.properties from " + filePath + "file", e);
}
}
}
if (mainClassName == null) {
return;
}
loadFoundProvider(mainClassName, providers, filePath);
}
private static void loadFoundProvider(
final String providerClass,
final List<Class<?>> providers,
final Path providerPath
) throws Exception {
//noinspection resource
final URLClassLoader classLoader = new URLClassLoader(
"MiniPlaceholders ClassLoader",
new URL[] { providerPath.toUri().toURL() },
ExpansionProviderLoader.class.getClassLoader()
);
Class<?> mainClass;
try {
mainClass = classLoader.loadClass(providerClass);
} catch (ClassNotFoundException e) {
throw new ClassNotFoundException("Unable to load main class from file " + providerPath, e);
}
if (!ExpansionProvider.class.isAssignableFrom(mainClass) || mainClass.isInterface()) {
return;
}
providers.add(mainClass);
}
}
@@ -0,0 +1,7 @@
package io.github.miniplaceholders.common.loader;
import io.github.miniplaceholders.api.provider.LoadRequirement;
import org.jspecify.annotations.NonNull;
public record FailedToLoadExpansion(@NonNull LoadRequirement requirement) {
}
@@ -0,0 +1,14 @@
package io.github.miniplaceholders.common.loader;
import io.github.miniplaceholders.api.provider.ExpansionProvider;
import io.github.miniplaceholders.api.provider.LoadRequirement;
public record ProviderLoadResult(ExpansionProvider provider, FailedToLoadExpansion failed) {
public static ProviderLoadResult ofLoaded(ExpansionProvider provider) {
return new ProviderLoadResult(provider, null);
}
public static ProviderLoadResult ofFailed(LoadRequirement requirement) {
return new ProviderLoadResult(null, new FailedToLoadExpansion(requirement));
}
}
@@ -0,0 +1,12 @@
package io.github.miniplaceholders.common.metrics;
import io.github.miniplaceholders.api.MiniPlaceholders;
import java.util.concurrent.Callable;
public final class LoadedExpansionsMetric implements Callable<Integer> {
@Override
public Integer call() {
return MiniPlaceholders.expansionsAvailable().size();
}
}
+2 -6
View File
@@ -1,7 +1,3 @@
java.toolchain.languageVersion.set(JavaLanguageVersion.of(11))
tasks.compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(11)
plugins {
id("miniplaceholders.base")
}
@@ -2,7 +2,8 @@ package io.github.miniplaceholders.connect;
public enum InternalPlatform {
PAPER, VELOCITY, KRYPTON, FABRIC;
PAPER, VELOCITY,
FABRIC, SPONGE, MINESTOM;
private static InternalPlatform actualPlatform;
@@ -0,0 +1,23 @@
plugins {
id("miniplaceholders.auto.module")
alias(libs.plugins.idea.ext)
alias(libs.plugins.blossom)
}
version = "1.4.0"
dependencies {
compileOnly(projects.miniplaceholdersApi)
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.minimessage)
}
sourceSets {
main {
blossom {
javaSources {
property("version", project.version.toString())
}
}
}
}
@@ -0,0 +1,7 @@
package io.github.miniplaceholders.provider.example;
public final class ExpansionConstants {
public static final String VERSION = "{{ version }}";
private ExpansionConstants() {}
}
@@ -0,0 +1,64 @@
package io.miniplaceholders.provider.example;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.provider.ExpansionProvider;
import io.github.miniplaceholders.api.provider.LoadRequirement;
import io.github.miniplaceholders.api.provider.PlatformData;
import io.github.miniplaceholders.api.types.Platform;
import io.github.miniplaceholders.provider.example.ExpansionConstants;
import net.kyori.adventure.text.minimessage.tag.Tag;
import team.unnamed.inject.Inject;
public record ExampleProvider(PlatformData platformData) implements ExpansionProvider {
@Inject
public ExampleProvider {}
@Override
public Expansion provideExpansion() {
return Expansion.builder("example")
.author("MiniPlaceholders Contributors")
.globalPlaceholder("test", (queue, context) ->
Tag.preProcessParsed("""
Platform Instance Class: %s
MiniPlaceholders Instance Class: %s
""".formatted(
platformData.serverInstance(),
platformData.complementInstance()
)))
.audiencePlaceholder("audience", (audience, queue, ctx) -> Tag.preProcessParsed("""
Audience Instance Class: %s
MiniPlaceholders Instance Class: %s
""".formatted(
audience,
platformData.complementInstance()
)))
.relationalPlaceholder("test", (audience, relational, queue, ctx) -> Tag.preProcessParsed("""
Audience Instance Class: %s
Relational Instance Class: %s
Is Audience equals Relational? %s
MiniPlaceholders Instance Class: %s
""".formatted(
audience,
relational,
audience.equals(relational),
platformData.complementInstance()
)))
.version(ExpansionConstants.VERSION)
.build();
}
@Override
public LoadRequirement loadRequirement() {
return LoadRequirement.anyOf(
LoadRequirement.platform(Platform.SPONGE),
LoadRequirement.allOf(
LoadRequirement.requiredComplement(
"MiniPlaceholders",
"miniplaceholders"
),
LoadRequirement.platform(Platform.PAPER)
),
LoadRequirement.requiredClass("io.github.miniplaceholders.common.command.node.PlayerCompleterNode")
);
}
}
@@ -0,0 +1 @@
provider-class=io.miniplaceholders.provider.example.ExampleProvider
+1
View File
@@ -0,0 +1 @@
/run
+68 -24
View File
@@ -1,54 +1,98 @@
import java.nio.file.Files
import java.nio.file.StandardCopyOption
import kotlin.io.path.deleteIfExists
plugins {
id("fabric-loom") version "1.2.5"
alias(libs.plugins.shadow)
alias(libs.plugins.fabric.loom)
id("miniplaceholders.auto.module")
}
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://central.sonatype.com/repository/maven-snapshots/") {
name = "sonatype-snapshots"
mavenContent {
snapshotsOnly()
}
}
maven("https://jitpack.io")
}
val shade: Configuration by configurations.creating
dependencies {
minecraft(libs.minecraft)
mappings(loom.officialMojangMappings())
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.api)
modImplementation(libs.adventure.platform.fabric)
include(libs.adventure.platform.fabric)
modImplementation(libs.luckopermissionsapi)
include(libs.luckopermissionsapi)
shadeModule(projects.miniplaceholdersCommon)
compileOnly(libs.fabric.loader)
compileOnly(libs.fabric.api)
includeDependency(libs.adventure.platform.fabric)
includeDependency(libs.adventure.serializer.legacy)
includeDependency(libs.adventure.minimessage)
includeDependency(libs.luckopermissionsapi)
includeDependency(libs.unnamedinject)
includeDependency(libs.desertwell)
shadeModule(projects.miniplaceholdersApi)
shadeModule(projects.miniplaceholdersCommon)
shadeModule(projects.miniplaceholdersConnect)
}
fun DependencyHandlerScope.shadeModule(module: ProjectDependency) {
shade(module)
implementation(module)
implementation(module) {
isTransitive = false
}
include(module) {
isTransitive = false
}
}
fun DependencyHandlerScope.includeDependency(dependency: Any) {
implementation(dependency)
include(dependency)
}
tasks {
val projectVersion = project.version
val rootDir = project.rootDir
processResources {
filteringCharset = Charsets.UTF_8.name()
filesMatching("fabric.mod.json") {
expand("version" to project.version)
expand("version" to projectVersion)
}
}
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
jar {
archiveFileName.set("MiniPlaceholders-Fabric-${projectVersion}.jar")
destinationDirectory.set(file("${rootDir}/jar"))
}
remapJar {
inputFile.set(shadowJar.get().archiveFile)
archiveFileName.set("MiniPlaceholders-Fabric-mc${libs.versions.minecraft.get()}-v${project.version}.jar")
}
shadowJar {
configurations = listOf(shade)
// I know it's exactly the same logic for all modules,
// but for some reason in this module it only works
// if it's declared in the same project configuration
// and not with a plugin like with all other projects...
// ¯\_(ツ)_/¯
runServer {
val exampleExpansionProviderProject = project(":miniplaceholders-example-expansion-provider")
val exampleExpansionJarTask = exampleExpansionProviderProject.tasks.named<Jar>("jar")
dependsOn(exampleExpansionJarTask)
doFirst {
val expansionsDirectory = projectDir.resolve("run/config/miniplaceholders/expansions").toPath()
if (Files.exists(expansionsDirectory)) {
Files.newDirectoryStream(expansionsDirectory).use {
it.forEach { file ->
file.deleteIfExists()
}
}
} else {
Files.createDirectories(expansionsDirectory)
}
val exampleExpansionFile = exampleExpansionJarTask.get().archiveFile.get().asFile.toPath()
Files.copy(
exampleExpansionFile,
expansionsDirectory.resolve(exampleExpansionFile.fileName),
StandardCopyOption.REPLACE_EXISTING
)
}
}
}
java {
withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
@@ -1,105 +1,88 @@
package io.github.miniplaceholders.fabric;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.common.PlaceholdersCommand;
import com.mojang.brigadier.tree.LiteralCommandNode;
import io.github.miniplaceholders.common.PlaceholdersPlugin;
import io.github.miniplaceholders.common.command.brigadier.BrigadierCommandProvider;
import io.github.miniplaceholders.connect.InternalPlatform;
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
import net.kyori.adventure.util.TriState;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.packs.PackResources;
import net.minecraft.world.entity.Entity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class FabricMod implements ModInitializer, PlaceholdersPlugin {
private final Logger logger = LoggerFactory.getLogger("miniplaceholders");
private static final DecimalFormat MSPT_FORMAT = new DecimalFormat("###.###");
public final class FabricMod implements DedicatedServerModInitializer, PlaceholdersPlugin {
private final ComponentLogger componentLogger = ComponentLogger.logger("miniplaceholders");
private MinecraftServer minecraftServer;
private final TickManager tickManager = new TickManager();
private MinecraftServer minecraftServer;
@Override
public void onInitializeServer() {
componentLogger.info("Starting MiniPlaceholders Fabric");
InternalPlatform.platform(InternalPlatform.FABRIC);
@Override
public void onInitialize() {
logger.info("Starting MiniPlaceholders Fabric");
InternalPlatform.platform(InternalPlatform.FABRIC);
ServerLifecycleEvents.SERVER_STARTING.register(minecraftServer -> {
this.minecraftServer = minecraftServer;
try {
final Path expansionsFolder = FabricLoader.getInstance().getConfigDir()
.resolve("miniplaceholders").resolve("expansions");
this.loadProvidedExpansions(expansionsFolder);
} catch (Throwable e) {
componentLogger.error("Unable to load expansion providers", e);
}
});
ServerLifecycleEvents.SERVER_STARTING.register(minecraftServer -> {
this.minecraftServer = minecraftServer;
this.loadDefaultExpansions();
});
this.registerPlatformCommand();
}
this.registerPlatformCommand();
}
@Override
public void registerPlatformCommand() {
final LiteralCommandNode<CommandSourceStack> node = BrigadierCommandProvider.provideCommand(
"miniplaceholders",
() -> new ArrayList<>(List.of(this.minecraftServer.getPlayerNames())),
string -> this.minecraftServer.getPlayerList().getPlayerByName(string),
aud -> aud,
(audience, permission) -> {
final CommandSourceStack commandSourceStack = (CommandSourceStack) audience;
return switch (Permissions.getPermissionValue(commandSourceStack, permission)) {
case TRUE -> TriState.TRUE;
case FALSE -> TriState.FALSE;
case DEFAULT -> commandSourceStack.permissions()
.hasPermission(net.minecraft.server.permissions.Permissions.COMMANDS_GAMEMASTER)
? TriState.TRUE : TriState.NOT_SET;
};
}
);
CommandRegistrationCallback.EVENT.register(
(dispatcher, ctx, selection) ->
dispatcher.getRoot().addChild(node)
);
}
@Override
public void loadDefaultExpansions() {
Expansion.builder("server")
.globalPlaceholder("name", Tag.selfClosingInserting(Component.text(this.minecraftServer.getServerModName())))
.globalPlaceholder("online", (queue, ctx) -> Tag.preProcessParsed(Integer.toString(this.minecraftServer.getPlayerCount())))
.globalPlaceholder("version", (ctx, queue) -> Tag.selfClosingInserting(Component.text(this.minecraftServer.getServerVersion())))
.globalPlaceholder("max_players", (ctx, queue) -> Tag.selfClosingInserting(Component.text(this.minecraftServer.getMaxPlayers())))
.globalPlaceholder("unique_joins", (queue, ctx) -> Tag.preProcessParsed(Integer.toString(this.minecraftServer.getProfileCache().load().size())))
.globalPlaceholder("tps_1m", (ctx, queue) -> Tag.preProcessParsed(tickManager.getTps1m().formattedAverage()))
.globalPlaceholder("tps_5m", (ctx, queue) -> Tag.preProcessParsed(tickManager.getTps5m().formattedAverage()))
//.globalPlaceholder("tps_15m", (ctx, queue) -> Tag.preProcessParsed(tickManager.getTps15m().formattedAverage()))
.globalPlaceholder("tick_count", (queue, ctx) -> Tag.selfClosingInserting(Component.text(this.minecraftServer.getTickCount())))
.globalPlaceholder("has_whitelist", (queue, ctx) -> Tag.preProcessParsed(Boolean.toString(this.minecraftServer.getPlayerList().isUsingWhitelist())))
.globalPlaceholder("total_chunks", (queue, ctx) -> {
int chunks = 0;
for (final ServerLevel level : this.minecraftServer.getAllLevels()) {
chunks += level.getChunkSource().getLoadedChunksCount();
}
return Tag.preProcessParsed(Integer.toString(chunks));
})
.globalPlaceholder("total_entities", (queue, ctx) -> {
int entities = 0;
for (final ServerLevel level : this.minecraftServer.getAllLevels()) {
for (final Entity ignored : level.getAllEntities()) {
entities++;
}
}
return Tag.preProcessParsed(Integer.toString(entities));
})
.globalPlaceholder("mspt", (queue, ctx) -> Tag.preProcessParsed(MSPT_FORMAT.format(this.minecraftServer.getAverageTickTime())))
.globalPlaceholder("datapack_list", (queue, ctx) ->
Tag.selfClosingInserting(this.minecraftServer.getResourceManager()
.listPacks()
.map(PackResources::packId)
.map(id -> Component.text()
.content("[")
.append(Component.text(id))
.append(Component.text("]"))
.build())
.collect(Component.toComponent(Component.space())))
)
.globalPlaceholder("datapack_count", (queue, ctx) ->
Tag.preProcessParsed(Long.toString(this.minecraftServer.getResourceManager()
.listPacks()
.count()))
)
.build()
.register();
}
@Override
public boolean platformHasComplementLoaded(String complementName) {
return FabricLoader.getInstance().isModLoaded(complementName);
}
@Override
public void registerPlatformCommand() {
CommandRegistrationCallback.EVENT.register((dispatcher, commandBuildContext, commandSelection) ->
dispatcher.register(PlaceholdersCommand.<CommandSourceStack>builder()
.hasPermissionCheck((source, permission) -> Permissions.check(source, permission, 4))
.toAudience(string -> this.minecraftServer.getPlayerList().getPlayerByName(string))
.playerSuggestions(() -> Arrays.asList(this.minecraftServer.getPlayerNames()))
.build()
.asBuilder("miniplaceholders"))
);
}
@Override
public void logError(Component component) {
componentLogger.error(component);
}
@Override
public void logInfo(Component component) {
componentLogger.info(component);
}
@Override
public Object platformServerInstance() {
return this.minecraftServer;
}
}
@@ -1,59 +0,0 @@
package io.github.miniplaceholders.fabric;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
/**
* Based on the MIT licensed Paper-Server patch "Further improve server tick loop".
*
* @author Daniel Ennis/Aikar
*/
final class RollingAverage {
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("###.##");
static { TPS_FORMAT.setRoundingMode(RoundingMode.HALF_UP); }
private static final int TPS = 20;
private static final long SEC_IN_NANO = 1000000000;
private final int size;
private final BigDecimal[] samples;
private final long[] times;
private long time;
private BigDecimal total;
private int index = 0;
RollingAverage(final int size) {
this.size = size;
this.samples = new BigDecimal[size];
this.times = new long[size];
this.time = size * SEC_IN_NANO;
this.total = dec(TPS).multiply(dec(SEC_IN_NANO)).multiply(dec(size));
for (int i = 0; i < size; i++) {
this.samples[i] = dec(TPS);
this.times[i] = SEC_IN_NANO;
}
}
private static BigDecimal dec(final long t) {
return new BigDecimal(t);
}
void add(final BigDecimal x, final long t) {
this.time -= this.times[this.index];
this.total = this.total.subtract(this.samples[this.index].multiply(dec(this.times[this.index])));
this.samples[this.index] = x;
this.times[this.index] = t;
this.time += t;
this.total = this.total.add(x.multiply(dec(t)));
if (++this.index == this.size) {
this.index = 0;
}
}
double average() {
return this.total.divide(dec(this.time), 30, RoundingMode.HALF_UP).doubleValue();
}
String formattedAverage() {
return TPS_FORMAT.format(average());
}
}
@@ -1,45 +0,0 @@
package io.github.miniplaceholders.fabric;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import java.math.BigDecimal;
import java.math.RoundingMode;
final class TickManager {
private static final int TICK_DURATION = 20;
private static final BigDecimal TPS_BASE = new BigDecimal(1E9).multiply(new BigDecimal(TICK_DURATION));
private final RollingAverage tps1m = new RollingAverage(60);
private final RollingAverage tps5m = new RollingAverage(60 * 5);
private final RollingAverage tps15m = new RollingAverage(60 * 15);
private long lastStartTick = 0;
private long lastEndTick = 0;
TickManager() {
ServerTickEvents.START_SERVER_TICK.register(server -> this.lastStartTick = System.nanoTime());
ServerTickEvents.END_SERVER_TICK.register(server -> {
if (server.getTickCount() % TICK_DURATION == 0) {
final long diff = lastStartTick - lastEndTick;
final BigDecimal currentTps = TPS_BASE.divide(new BigDecimal(diff), 30, RoundingMode.HALF_UP);
this.tps1m.add(currentTps, diff);
this.tps5m.add(currentTps, diff);
this.tps15m.add(currentTps, diff);
this.lastEndTick = System.nanoTime();
}
});
}
public RollingAverage getTps1m() {
return tps1m;
}
public RollingAverage getTps5m() {
return tps5m;
}
public RollingAverage getTps15m() {
return tps15m;
}
}
+10 -9
View File
@@ -3,27 +3,28 @@
"id": "miniplaceholders",
"version": "${version}",
"name": "MiniPlaceholders",
"description": "MiniMessage Component-based Placeholders for PaperMC, Fabric, Krypton and Velocity platforms",
"description": "MiniMessage Component-based Placeholders API",
"authors": [
"4drian3d"
],
"contact": {
"homepage": "https://github.com/MiniPlaceholders/MiniPlaceholders",
"homepage": "https://miniplaceholders.github.io/",
"sources": "https://github.com/MiniPlaceholders/MiniPlaceholders",
"issues": "https://github.com/MiniPlaceholders/MiniPlaceholders/issues"
},
"license": "GPL",
"license": "Apache-2",
"environment": "server",
"entrypoints": {
"main": [
"server": [
"io.github.miniplaceholders.fabric.FabricMod"
]
},
"depends": {
"fabricloader": ">=0.14.19",
"fabric": "*",
"java": ">=17",
"minecraft": "~1.19.4",
"fabric-permissions-api-v0": "*"
"fabricloader": ">=0.18.0",
"fabric-api": "*",
"java": ">=25",
"adventure-platform-fabric": ">6.8.0",
"minecraft": ">=26.1",
"fabric-permissions-api-v0": ">=0.7.0"
}
}
+6 -3
View File
@@ -1,5 +1,8 @@
group = io.github.miniplaceholders
version = 2.1.0
description = MiniMessage Component-based Placeholders for PaperMC, Krypton and Velocity platforms
version = 3.2.0
description = MiniMessage Component-based Placeholders API
org.gradle.jvmargs=-Xmx2G
org.gradle.jvmargs=-Xmx2G
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
#org.gradle.configuration-cache=true
+52 -41
View File
@@ -2,64 +2,75 @@ metadata.format.version = "1.1"
[versions]
velocity = "3.2.0-SNAPSHOT"
paper = "1.19.4-R0.1-SNAPSHOT"
krypton = "cbfaff4aa4"
minecraft = "1.19.4"
# Platform
minecraft = "26.1"
paper = "1.21.11-R0.1-SNAPSHOT"
velocity = "3.5.0-SNAPSHOT"
minestom = "2026.03.03-1.21.11"
fabric-loader = "0.18.5"
fabric-api = "0.144.3+26.1"
runtask = "2.1.0"
pluginyml = "0.5.3"
userdev = "1.5.4"
blossom = "1.3.1"
indra = "3.0.1"
shadow = "8.1.1"
jmh = "0.7.1"
dokka = "1.8.10"
# Libraries
kotlin = "2.3.20"
adventure = "4.26.1"
adventureModded = "6.9.0-SNAPSHOT"
desertwell = "2.0.4"
bstats = "3.2.1"
jspecify = "1.0.0"
adventure = "4.13.1"
adventurefabric = "5.8.0"
brigadier = "1.0.500"
kotlin="1.8.21"
fabric-api = "0.79.0+1.20"
fabric-loader = "0.14.19"
desertwell = "2.0.2"
# Gradle Plugins
runtask = "3.0.2"
blossom = "2.2.0"
shadow = "9.4.0"
jmh = "0.7.3"
dokka = "2.2.0"
[libraries]
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
krypton-server = { group = "org.kryptonmc", name = "krypton-server", version.ref = "krypton" }
# Platforms
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
minestom = { group = "net.minestom", name = "minestom", version.ref = "minestom" }
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
luckopermissionsapi = { group = "me.lucko", name = "fabric-permissions-api", version = "0.2-SNAPSHOT" }
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
# Adventure
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
adventure-minimesssage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
adventure-platform-fabric = { group = "net.kyori", name = "adventure-platform-fabric", version.ref = "adventurefabric" }
adventure-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
adventure-platform-fabric = { group = "net.kyori", name = "adventure-platform-fabric", version.ref = "adventureModded" }
adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
adventure-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
brigadier = { group = "com.mojang", name = "brigadier", version.ref = "brigadier" }
krypton-annotation = { group = "org.kryptonmc", name = "krypton-annotation-processor", version.ref = "krypton" }
plugin-shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
plugin-indra-common = { module = "net.kyori:indra-common", version.ref = "indra" }
plugin-indra-spotless = { module = "net.kyori:indra-licenser-spotless", version.ref = "indra" }
plugin-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10"
# Build-Logic Gradle Plugins
plugin-shadow = { module = "com.gradleup.shadow:shadow-gradle-plugin", version.ref = "shadow" }
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
plugin-runtask = { module = "xyz.jpenilla.run-velocity:xyz.jpenilla.run-velocity.gradle.plugin", version.ref = "runtask" }
# Libraries
desertwell = { group = "net.william278", name = "DesertWell", version.ref = "desertwell" }
junit-bom = "org.junit:junit-bom:6.0.3"
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
luckopermissionsapi = { group = "me.lucko", name = "fabric-permissions-api", version = "0.7.0" }
unnamedinject = "team.unnamed:inject:2.0.1"
brigadier = "com.mojang:brigadier:1.0.500"
# Bstats
bstats-core = { group = "org.bstats", name = "bstats-base", version.ref = "bstats" }
bstats-velocity = { group = "org.bstats", name = "bstats-velocity", version.ref = "bstats" }
bstats-sponge = { group = "org.bstats", name = "bstats-sponge", version.ref = "bstats" }
bstats-bukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" }
[plugins]
pluginyml = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" }
userdev = { id = "io.papermc.paperweight.userdev", version.ref = "userdev" }
# Platform Plugins
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runtask" }
runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
fabric-loom = { id = "net.fabricmc.fabric-loom", version = "1.15.5"}
spongegradle = { id = "org.spongepowered.gradle.plugin", version = "2.3.0" }
# General Plugins
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
jmh = { id = "me.champeau.jmh", version.ref = "jmh" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
idea-ext = { id = "org.jetbrains.gradle.plugin.idea-ext", version = "1.4.1" }
Binary file not shown.
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff. Show more