Compare commits

..
317 Commits
Author SHA1 Message Date
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
Adrian 373d15a115 release: Version 2.1.0 2023-04-25 12:09:36 -05:00
Adrian 67e1de9334 ci: Adjusted upload action to also upload Fabric version 2023-04-25 11:39:45 -05:00
Adrian 07c780411f Merge remote-tracking branch 'origin/main' 2023-04-25 11:04:03 -05:00
Adrian c678931a31 misc: Improved command feedback design 2023-04-25 11:03:37 -05:00
Adrian 2511a0f2df Merge pull request #65 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v1.8.21
2023-04-25 07:50:33 -05:00
renovate[bot] 27ff27caf6 fix(deps): update kotlin monorepo to v1.8.21 2023-04-25 05:12:17 +00:00
Adrian 547f9a1788 Merge pull request #62 from MiniPlaceholders/renovate/runtask
chore(deps): update runtask to v2.1.0
2023-04-24 14:11:57 -05:00
Adrian 12a407585b Merge pull request #64 from MiniPlaceholders/renovate/org.gradle.toolchains.foojay-resolver-convention-0.x
chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.5.0
2023-04-24 14:11:49 -05:00
renovate[bot] 60796df402 chore(deps): update plugin org.gradle.toolchains.foojay-resolver-convention to v0.5.0 2023-04-24 17:32:44 +00:00
Adrian 56fd8557c6 Merge pull request #63 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.79.0+1.20
2023-04-24 08:34:04 -05:00
renovate[bot] fa4305682a fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.79.0+1.20 2023-04-24 09:25:05 +00:00
renovate[bot] 08f0c8871b chore(deps): update runtask to v2.1.0 2023-04-24 04:23:07 +00:00
Adrian 8dfaa35b16 [ci skip] chore: Improved README documentation 2023-04-23 12:05:39 -05:00
Adrian 3137a87095 Merge pull request #60 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.2.5
2023-04-23 09:36:11 -05:00
renovate[bot] 423275e11d chore(deps): update plugin fabric-loom to v1.2.5 2023-04-23 13:50:41 +00:00
Adrian 21b876c13a Merge pull request #59 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.2.4
2023-04-23 08:49:50 -05:00
renovate[bot] 3fedc67356 chore(deps): update plugin fabric-loom to v1.2.4 2023-04-23 12:53:50 +00:00
Adrian 63a8ef9e02 Merge pull request #57 from MiniPlaceholders/renovate/fabric-api
fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.78.1+1.20
2023-04-22 12:35:57 -05:00
Adrian 4666531bb8 Merge pull request #58 from MiniPlaceholders/renovate/fabric-loom-1.x
chore(deps): update plugin fabric-loom to v1.2.2
2023-04-22 12:35:16 -05:00
renovate[bot] abf476c368 chore(deps): update plugin fabric-loom to v1.2.2 2023-04-22 17:18:52 +00:00
renovate[bot] d213a20df6 fix(deps): update dependency net.fabricmc.fabric-api:fabric-api to v0.78.1+1.20 2023-04-22 17:18:47 +00:00
Adrian 8f5a81c17e feat(platform): Added Fabric Implementation (#53) 2023-04-22 12:16:20 -05:00
Adrian dd0e895513 Merge branch 'main' into feat/platform/fabric 2023-04-21 23:14:30 -05:00
Adrian 8f42950ef3 ci: Increased compile timeout in GitHub Actions 2023-04-21 21:54:14 -05:00
Adrian 4043a578e1 feat(fabric): Finished server placeholders implementation 2023-04-21 19:48:44 -05:00
Adrian 1c06b1bee4 Merge pull request #56 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.1.1
2023-04-21 08:38:33 -05:00
renovate[bot] 5c6b3f4e43 chore(deps): update dependency gradle to v8.1.1 2023-04-21 13:20:37 +00:00
Adrian 8df4e70032 Merge pull request #55 from MiniPlaceholders/renovate/jmh
chore(deps): update dependency me.champeau.jmh to v0.7.1
2023-04-17 15:41:39 -05:00
renovate[bot] 432267b567 chore(deps): update dependency me.champeau.jmh to v0.7.1 2023-04-17 20:10:21 +00:00
Adrian 28090463b8 fix(fabric): Fixed meta file name 2023-04-16 22:29:31 -05:00
Adrian fff437a60b fix: Fixed project compilation 2023-04-16 21:10:40 -05:00
Adrian 00e0bdcaf3 feat(platform): Added Fabric support 2023-04-16 16:23:48 -05:00
Adrian 1c9ff78b4c feat(api): Added some utils methods to Expansions and MiniPlaceholders
- `Expansion#registered`
- `Expansion#unregister`
- `MiniPlaceholders#getExpansionByName`
2023-04-16 12:08:36 -05:00
Adrian 0aa037d1af feat(api): Added some utils methods to Expansions and MiniPlaceholders class
- Expansion#registered
- Expansion#unregister
- MiniPlaceholders#getExpansionByName

closes #51
2023-04-16 10:20:42 -05:00
Adrian 1440d19663 [ci skip] chore: Removed unused jitpack file 2023-04-15 23:54:08 -05:00
Adrian 20daf60534 fix(deps): Manually updated Krypton version
closes #42
closes #38
2023-04-15 23:52:03 -05:00
Adrian dd36c10a0f perf(api): Changed internal Set implementation from a synchronizedSet to a ConcurrentHashMap based Set 2023-04-15 23:42:40 -05:00
Adrian 0caddf5b44 [ci skip] chore: Update FUNDING.yml 2023-04-14 16:12:43 -05:00
Adrian 7ca4536dc5 Merge pull request #50 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.1
2023-04-14 09:32:21 -05:00
renovate[bot] e9ecd3aebf chore(deps): update dependency gradle to v8.1 2023-04-12 15:22:19 +00:00
Adrian 5adadcbbcb release: Version 2.0.2 2023-04-11 11:41:50 -05:00
Adrian 4c1739f3b0 feat: Added Folia Support 2023-04-11 11:38:52 -05:00
Adrian dcfd2a6fe1 Merge pull request #49 from MiniPlaceholders/renovate/net.kyori-adventure-text-serializer-plain-4.x
fix(deps): update dependency net.kyori:adventure-text-serializer-plain to v4.13.1
2023-04-09 21:38:18 -05:00
renovate[bot] b7a56198f4 fix(deps): update dependency net.kyori:adventure-text-serializer-plain to v4.13.1 2023-04-10 02:18:01 +00:00
Adrian 2d9fdaccc2 Merge pull request #48 from MiniPlaceholders/renovate/net.kyori-adventure-text-serializer-legacy-4.x
fix(deps): update dependency net.kyori:adventure-text-serializer-legacy to v4.13.1
2023-04-09 21:17:49 -05:00
Adrian 4f63f55d11 Merge pull request #47 from MiniPlaceholders/renovate/adventure
fix(deps): update adventure to v4.13.1
2023-04-09 21:17:33 -05:00
renovate[bot] 5495f5f57a fix(deps): update dependency net.kyori:adventure-text-serializer-legacy to v4.13.1 2023-04-10 01:56:07 +00:00
renovate[bot] d33e98714a fix(deps): update adventure to v4.13.1 2023-04-10 01:56:02 +00:00
Adrian e6e98c9852 Merge pull request #45 from MiniPlaceholders/renovate/kotlin-monorepo
fix(deps): update kotlin monorepo to v1.8.20
2023-04-06 18:16:14 -05:00
renovate[bot] 6f9abbefc9 fix(deps): update kotlin monorepo to v1.8.20 2023-04-06 23:06:12 +00:00
Adrian 7ee6dcb1b7 Merge pull request #46 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.4
2023-04-04 22:44:55 -05:00
renovate[bot] db37d4ae66 chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.4 2023-04-05 02:25:46 +00:00
Adrian 38b707d091 Merge pull request #43 from MiniPlaceholders/renovate/shadow
chore(deps): update shadow to v8.1.1
2023-03-20 17:50:22 -05:00
renovate[bot] 6737e63232 chore(deps): update shadow to v8.1.1 2023-03-20 21:45:41 +00:00
Adrian 5f9c42c5d7 release: version 2.0.1 2023-03-15 15:59:07 -05:00
Adrian f97665fe47 fix: updated to Paper 1.19.4 2023-03-15 15:56:12 -05:00
Adrian 202782e053 Merge pull request #41 from MiniPlaceholders/renovate/net.kyori-adventure-text-serializer-plain-4.x
fix(deps): update dependency net.kyori:adventure-text-serializer-plain to v4.13.0
2023-03-14 12:21:38 -05:00
Adrian 20da844129 Merge pull request #40 from MiniPlaceholders/renovate/net.kyori-adventure-text-serializer-legacy-4.x
fix(deps): update dependency net.kyori:adventure-text-serializer-legacy to v4.13.0
2023-03-14 12:21:30 -05:00
renovate[bot] e98b222250 fix(deps): update dependency net.kyori:adventure-text-serializer-plain to v4.13.0 2023-03-14 12:40:00 +00:00
Adrian 430c483f39 Merge pull request #39 from MiniPlaceholders/renovate/adventure
fix(deps): update adventure to v4.13.0
2023-03-14 07:39:26 -05:00
renovate[bot] 92798a38c7 fix(deps): update dependency net.kyori:adventure-text-serializer-legacy to v4.13.0 2023-03-14 09:30:17 +00:00
renovate[bot] 5f491e9553 fix(deps): update adventure to v4.13.0 2023-03-14 09:30:11 +00:00
Adrian 1a862fce44 Merge pull request #37 from MiniPlaceholders/renovate/org.jetbrains.dokka
fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.8.10
2023-03-04 11:43:25 -05:00
Adrian da965a7b4a Merge pull request #36 from MiniPlaceholders/renovate/dokka
chore(deps): update dependency org.jetbrains.dokka to v1.8.10
2023-03-04 11:43:14 -05:00
renovate[bot] d3cd42c076 fix(deps): update dependency org.jetbrains.dokka:dokka-gradle-plugin to v1.8.10 2023-03-04 08:51:25 +00:00
renovate[bot] 4a3572d39c chore(deps): update dependency org.jetbrains.dokka to v1.8.10 2023-03-04 08:51:19 +00:00
Adrian 8f5baf7757 Merge pull request #35 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.3
2023-03-03 22:56:36 -05:00
Adrian 5a98d82c49 Merge pull request #34 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8.0.2
2023-03-03 22:56:28 -05:00
renovate[bot] 984ef05ffb chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.3 2023-03-04 03:17:51 +00:00
renovate[bot] db2a723c57 chore(deps): update dependency gradle to v8.0.2 2023-03-04 03:17:45 +00:00
Adrian 5187a74a06 [ci skip] fix(deps): also ignore krypton-server 2023-03-02 12:18:29 -05:00
Adrian 4b7a003c27 fix(deps): ignore renovate krypton updates
The Krypton versioning system is based on commits, so Renovate does not work correctly
2023-03-02 12:16:59 -05:00
Adrian 1a673997e0 Merge remote-tracking branch 'origin/main' 2023-03-02 11:58:58 -05:00
Adrian 2364f306a8 fix(deps): manually updated shadow plugin
closes #33
2023-03-02 11:58:31 -05:00
Adrian 23b21eb921 Merge pull request #29 from MiniPlaceholders/renovate/brigadier
fix(deps): update dependency com.mojang:brigadier to v1.0.500
2023-03-02 11:41:45 -05:00
Adrian 6e71e33bf8 Merge remote-tracking branch 'origin/main' 2023-03-02 11:35:28 -05:00
Adrian 1164d4551f feat: improved command registration
fix: fixed player argument
2023-03-02 11:30:51 -05:00
Adrian de562d1bae Merge pull request #32 from MiniPlaceholders/renovate/userdev
chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.2
2023-03-01 17:40:36 -05:00
renovate[bot] 9c117b156b fix(deps): update dependency com.mojang:brigadier to v1.0.500 2023-03-01 22:35:26 +00:00
renovate[bot] 4a9b90ed95 chore(deps): update dependency io.papermc.paperweight.userdev to v1.5.2 2023-03-01 22:35:21 +00:00
Adrian de095dd900 chore: updated javadocs link 2023-03-01 17:07:02 -05:00
Adrian 05af305d50 release: version 2.0.0 2023-03-01 16:46:15 -05:00
Adrian c9a9783e8a chore: added kotlin examples 2023-03-01 16:34:30 -05:00
Adrian 5835fb3d45 chore: updated readme 2023-03-01 16:30:35 -05:00
Adrian 914275b16d feat: migrate to paper plugins
fix: fixed permission check on paper
2023-03-01 16:30:12 -05:00
Adrian a98aa93fb4 fix: fixed krypton annotation processor 2023-03-01 14:55:46 -05:00
Adrian f0fd8148ad feat: updated krypton module 2023-03-01 14:50:34 -05:00
Adrian 045cb01911 feat: publish extra kotlin javadocs
feat: implement build logic
2023-03-01 14:20:08 -05:00
Adrian 40ba7593a6 refactor!: changed package
bump to 2.0.0
2023-02-26 11:00:20 -05:00
Adrian 978e63c8dc build: migrate to versions catalog 2023-02-26 10:46:52 -05:00
Adrian 9b04b58f50 Merge pull request #20 from MiniPlaceholders/renovate/xyz.jpenilla.run-paper-2.x
chore(deps): update plugin xyz.jpenilla.run-paper to v2
2023-02-26 10:24:05 -05:00
renovate[bot] 9f7eaf1614 chore(deps): update plugin xyz.jpenilla.run-paper to v2 2023-02-26 15:18:45 +00:00
Adrian 9286751bd0 Merge pull request #27 from MiniPlaceholders/renovate/xyz.jpenilla.run-paper-1.x
chore(deps): update plugin xyz.jpenilla.run-paper to v1.1.0
2023-02-26 10:18:21 -05:00
Adrian 16783494ad Merge pull request #26 from MiniPlaceholders/renovate/me.champeau.jmh-0.x
chore(deps): update plugin me.champeau.jmh to v0.7.0
2023-02-26 10:17:23 -05:00
Adrian 9050aed7a3 Merge pull request #25 from MiniPlaceholders/renovate/gradle-8.x
chore(deps): update dependency gradle to v8
2023-02-26 10:17:14 -05:00
renovate[bot] 9ef9b1b3c6 chore(deps): update plugin xyz.jpenilla.run-paper to v1.1.0 2023-02-26 14:49:29 +00:00
renovate[bot] 8290c946df chore(deps): update plugin me.champeau.jmh to v0.7.0 2023-02-26 14:49:23 +00:00
Adrian 5057fe4817 Merge pull request #16 from MiniPlaceholders/renovate/kotlin-monorepo
chore(deps): update plugin org.jetbrains.kotlin.jvm to v1.8.10
2023-02-26 09:48:59 -05:00
renovate[bot] c43debe9bb chore(deps): update plugin org.jetbrains.kotlin.jvm to v1.8.10 2023-02-26 13:51:48 +00:00
Adrian 15d9f527eb Merge pull request #19 from MiniPlaceholders/renovate/com.github.johnrengelman.shadow-8.x
chore(deps): update plugin com.github.johnrengelman.shadow to v8
2023-02-26 08:51:21 -05:00
renovate[bot] 68dd632c69 chore(deps): update dependency gradle to v8 2023-02-26 13:51:15 +00:00
Adrian b0da895025 Merge pull request #21 from MiniPlaceholders/renovate/io.papermc.paperweight.userdev-1.x
chore(deps): update plugin io.papermc.paperweight.userdev to v1.5.1
2023-02-26 08:50:28 -05:00
Adrian 29dcd5bcdf Merge pull request #22 from MiniPlaceholders/renovate/junit5-monorepo
fix(deps): update dependency org.junit:junit-bom to v5.9.2
2023-02-26 08:49:56 -05:00
Adrian f156f48c54 Merge pull request #23 from MiniPlaceholders/renovate/actions-checkout-3.x
chore(deps): update actions/checkout action to v3
2023-02-26 08:49:06 -05:00
Adrian a1b1118aa2 Merge pull request #24 from MiniPlaceholders/renovate/actions-setup-java-3.x
chore(deps): update actions/setup-java action to v3
2023-02-26 08:48:48 -05:00
renovate[bot] 5e716cb6d9 chore(deps): update actions/setup-java action to v3 2023-02-26 13:43:53 +00:00
renovate[bot] ebe04a3ede chore(deps): update actions/checkout action to v3 2023-02-26 13:43:47 +00:00
renovate[bot] 5e97666be7 fix(deps): update dependency org.junit:junit-bom to v5.9.2 2023-02-26 13:43:41 +00:00
renovate[bot] aa8a36c92b chore(deps): update plugin io.papermc.paperweight.userdev to v1.5.1 2023-02-26 13:43:35 +00:00
renovate[bot] c3fac7a11a chore(deps): update plugin com.github.johnrengelman.shadow to v8 2023-02-26 13:42:58 +00:00
Adrian a12c37bc97 Merge pull request #15 from MiniPlaceholders/renovate/configure
Configure Renovate
2023-02-26 08:39:59 -05:00
Adrian e83bc3d8f6 Merge branch 'main' into renovate/configure 2023-02-26 08:33:36 -05:00
Adrian e0767d9bff Merge pull request #14 from MiniPlaceholders/feat/kotlin
Implement Kotlin Extensions
2023-02-26 08:32:47 -05:00
Adrian 70e8d8925d fix: update plugin-yml plugin 2023-02-26 00:10:44 -05:00
Adrian ea9213bf2d fix: removed version catalog declaration 2023-02-26 00:06:24 -05:00
Adrian fc6bc5c728 fix: fixed actions compilation 2023-02-25 23:55:16 -05:00
Adrian 007fe3279d feat: publish to maven central 2023-02-25 23:53:36 -05:00
Adrian 9976b9bf89 chore: updated gradle wrapper 2023-02-25 23:48:18 -05:00
renovate[bot] b9035fe504 Add renovate.json 2023-02-26 04:25:38 +00:00
Adrian cff2aee3d6 feat: Test KDocs javadoc format 2023-02-02 16:35:15 -05:00
Adrian b45d8be1e5 feat: Update to Kotlin 1.8.10 2023-02-02 16:25:39 -05:00
Adrian b4fcf85b07 chore: Some format changes 2023-02-02 16:10:20 -05:00
Adrian 7363571d91 feat: Improved javadocs 2023-02-02 16:09:20 -05:00
4drian3d d6c883edf4 misc: Bump Snapshot version 2022-12-08 17:06:49 -05:00
4drian3d 6a011c0699 feat(kotlin-ext): Replace javadocs with KDocs 2022-12-08 16:45:47 -05:00
4drian3d 4779fb9f69 fix(kotlin-ext): Fixed javadoc publication 2022-12-08 16:28:04 -05:00
4drian3d f97650ef1f fix(kotlin-ext): Fixed maven publication 2022-12-08 15:50:25 -05:00
4drian3d 98e280e01b feat(kotlin-ext): Correctly Implemented Dokka 2022-12-08 15:36:08 -05:00
4drian3d d35892d964 feat: Implement kotlin-ext module 2022-12-08 14:35:21 -05:00
4drian3d 9263698139 misc: Migrate KryptonPlugin implementation to Kotlin 2022-12-08 10:46:34 -05:00
4drian3d 194801df6b release: 1.3.1 Version 2022-08-26 17:09:36 +00:00
4drian3d 06e927045e fix: Fixed subcommands permissions
resolves #13
2022-08-26 17:09:10 +00:00
4drian3d 5e8a881b51 release: 1.3.0 Version
misc(paper): Removed unnecesary Listener implementation
2022-08-25 14:13:16 +00:00
4drian3d 8bb9bafb8b feat(krypton): Implement TPS and MSPT placeholders 2022-08-25 00:57:52 +00:00
Adrian 74f14f139c Merge pull request #8 from MiniPlaceholders/feat/krypton-implementation 2022-08-24 16:10:15 -05:00
Adrian 45b2fbe977 Merge branch 'main' into feat/krypton-implementation 2022-08-24 16:08:01 -05:00
4drian3d df04f51d60 feat: Finish Krypton implementation 2022-08-24 21:04:51 +00:00
4drian3d 5b35094d27 release: Version 1.2.1 2022-08-22 15:06:24 +00:00
Adrian3d04 e8635bc6c8 test: Remove unnecesary public modifier 2022-08-18 02:17:22 +00:00
Adrian3d04 a1e95295cc feat: Added java 9 Modules Support 2022-08-18 02:16:50 +00:00
Adrian3d04 927563f749 feat(krypton): Try Kotlin plugin implementation 2022-07-31 17:36:57 +00:00
Adrian3d04 225bafeaaa feat: Implement Krypton Platform 2022-07-30 21:15:11 +00:00
88 changed files with 2491 additions and 1028 deletions

No files matched your search

+2 -13
View File
@@ -1,13 +1,2 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: https://paypal.me/4drian3d # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
github: 4drian3d
custom: https://paypal.me/4drian3d
+5 -5
View File
@@ -8,10 +8,10 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
@@ -20,12 +20,12 @@ jobs:
- name: Build with Gradle
uses: nick-invision/retry@v2
with:
timeout_minutes: 4
timeout_minutes: 10
max_attempts: 2
command: gradle build
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: MiniPlaceholders
path: build/libs/MiniPlaceholders.jar
path: jar/MiniPlaceholders-*.jar
+1
View File
@@ -2,6 +2,7 @@
/.idea/
build/
bin/
jar/
# Visual Studio Code
+81 -7
View File
@@ -1,13 +1,87 @@
# MiniPlaceholders
MiniMessage Component-based Placeholders for PaperMC and Velocity platforms
[![WorkFlow](https://img.shields.io/github/actions/workflow/status/MiniPlaceholders/MiniPlaceholders/build.yml?style=flat-square)](https://github.com/MiniPlaceholders/MiniPlaceholders/actions)
![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 Paper, Fabric, Sponge, Folia and Velocity platforms
## Compatibility
- Paper 1.19.3, 1.19.4+
- Folia 1.19.4+
- Velocity 3.1.2+
- Fabric 1.19.4+
- Sponge API 8+
## Commands
## Commands:
### Velocity
`/vminiplaceholders <parse|help> <me|player> <player-to-parse>`
### Paper
`/miniplaceholders <parse|help> <me|player> <player-to-parse>`
- `/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>"`
## User Usage
Check our user usage wiki [here](https://github.com/MiniPlaceholders/MiniPlaceholders/wiki/User-Getting-Started)
## API
Check the available javadocs [here](https://javadoc.jitpack.io/com/github/4drian3d/MiniPlaceholders/latest/javadoc/index.html)
Or check the wiki [here](https://github.com/4drian3d/MiniPlaceholders/wiki)
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)
### Java
```java
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;
return Tag.selfClosingInserting(player.getName());
})
.globalPlaceholder("tps", (ctx, queue) ->
Tag.selfClosingInserting(Component.text(Bukkit.getTps()[0]))
).build;
expansion.register();
Player player;
final TagResolver playerResolver = MiniPlaceholders.getAudiencePlaceholders(player);
player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", playerResolver));
}
}
```
### Kotlin
```kotlin
fun register() {
val expansion = expansion("my-expansion") {
audiencePlaceholder("name") { aud, _, _ ->
aud.getName().asClosingTag()
}
globalPlaceholder("tps") { _, _ ->
Component.text(Bukkit.getTps()[0]).asInsertingTag()
}
}
expansion.register()
val player: Player
val playerResolver = MiniPlaceholders.getAudiencePlaceholders(player)
player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", playerResolver))
}
```
+30 -50
View File
@@ -1,27 +1,22 @@
plugins {
id("me.champeau.jmh") version "0.6.6"
`maven-publish`
id("miniplaceholders.base")
alias(libs.plugins.jmh)
id("miniplaceholders.publish")
}
dependencies {
compileOnly("net.kyori:adventure-api:4.11.0")
compileOnly("net.kyori:adventure-text-minimessage:4.11.0")
compileOnly("net.kyori:adventure-text-serializer-legacy:4.11.0")
compileOnly(project(":miniplaceholders-connect"))
testImplementation(platform("org.junit:junit-bom:5.8.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("net.kyori:adventure-api:4.11.0")
testImplementation("net.kyori:adventure-text-minimessage:4.11.0")
testImplementation("net.kyori:adventure-text-serializer-plain:4.11.0")
}
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.minimesssage)
compileOnly(libs.adventure.serializer.legacy)
compileOnly(projects.miniplaceholdersConnect)
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.minimesssage)
testImplementation(libs.adventure.serializer.plain)
testImplementation(libs.adventure.serializer.legacy)
}
jmh {
@@ -31,42 +26,27 @@ jmh {
}
java {
withSourcesJar()
withJavadocJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
val projectGroup: String = project.group as String
val projectVersion: String = project.version as String
publishing {
publications {
create<MavenPublication>("maven") {
groupId = projectGroup
artifactId = project.name
version = projectVersion
from(components["java"])
}
}
}
tasks.withType<Javadoc> {
(options as StandardJavadocDocletOptions).links(
"https://jd.adventure.kyori.net/api/4.10.0/",
"https://jd.adventure.kyori.net/text-minimessage/4.11.0/"
)
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(11)
}
javadoc {
options.encoding = Charsets.UTF_8.name()
}
processResources {
filteringCharset = Charsets.UTF_8.name()
}
javadoc {
options.encoding = Charsets.UTF_8.name()
(options as StandardJavadocDocletOptions).links(
"https://jd.advntr.dev/api/${libs.versions.adventure.get()}/",
"https://jd.advntr.dev/text-minimessage/${libs.versions.adventure.get()}/"
)
}
compileTestJava {
options.encoding = Charsets.UTF_8.name()
}
test {
useJUnitPlatform()
testLogging {
events("passed", "failed")
}
}
}
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders;
package io.github.miniplaceholders.jmh;
import java.util.UUID;
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders;
package io.github.miniplaceholders.jmh;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
@@ -9,8 +9,8 @@ import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.MiniPlaceholders;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
@State(Scope.Benchmark)
public class PlaceholderBenchmark {
@@ -1,5 +1,7 @@
package me.dreamerzero.miniplaceholders.api;
package io.github.miniplaceholders.api;
import io.github.miniplaceholders.api.placeholder.AudiencePlaceholder;
import io.github.miniplaceholders.api.placeholder.RelationalPlaceholder;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -7,8 +9,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import me.dreamerzero.miniplaceholders.api.placeholder.AudiencePlaceholder;
import me.dreamerzero.miniplaceholders.api.placeholder.RelationalPlaceholder;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.builder.AbstractBuilder;
import net.kyori.adventure.text.minimessage.Context;
@@ -35,7 +35,7 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
*
* @since 1.0.0
*/
public interface Expansion {
public sealed interface Expansion permits ExpansionImpl {
/**
* Get the expansion name
* @return the expansion name
@@ -49,7 +49,6 @@ public interface Expansion {
* @return A TagResolver with variable placeholders of an Audience
* @since 1.0.0
*/
@Contract("null -> fail; !null -> !null")
@NotNull TagResolver audiencePlaceholders(final @NotNull Audience audience);
/**
@@ -63,7 +62,6 @@ public interface Expansion {
* @return A TagResolver with variable placeholders between 2 {@link Audience}s
* @since 1.0.0
*/
@Contract("_, null -> fail, null, _ -> fail; !null, !null -> !null")
@NotNull TagResolver relationalPlaceholders(final @NotNull Audience audience, final @NotNull Audience otherAudience);
/**
@@ -76,16 +74,33 @@ public interface Expansion {
/**
* Register this expansion
* @since 1.0.0
* @throws IllegalStateException if the expansion you are trying to register is already registered
* @see Expansion#registered()
*/
void register();
/**
* Unregisters this expansion
* @since 2.1.0
* @throws IllegalStateException if the expansion you are trying to unregister is not registered
* @see Expansion#registered()
*/
void unregister();
/**
* Get the registration status of this expansion
* @return true if the expansion is registered, otherwise false
* @since 2.1.0
*/
boolean registered();
/**
* Creates a new Expansion Builder
* @param name the expansion name
* @return a new expansion builder
* @since 1.0.0
*/
public static @NotNull Expansion.Builder builder(final @NotNull String name){
static @NotNull Expansion.Builder builder(final @NotNull String name){
return new ExpansionImpl.Builder(name);
}
@@ -111,7 +126,7 @@ public interface Expansion {
*
* @since 1.0.0
*/
public static interface Builder extends AbstractBuilder<Expansion> {
interface Builder extends AbstractBuilder<Expansion> {
/**
* Adds an audience placeholder
*
@@ -119,16 +134,16 @@ 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 audiencePlaceholder the single placeholder
* @return the {@link Builder} itself
* @since 1.0.0
*/
@Contract("null, _ -> fail; _, null -> fail; !null, !null -> this")
@NotNull Builder audiencePlaceholder(final @NotNull String key, final @NotNull AudiencePlaceholder audiencePlaceholder);
/**
* Adds an Relational Placeholder based on two audiences
* Adds a Relational Placeholder based on two audiences
*
* <p>This type of placeholder allows you to create
* components based on a 2-audiences relationship,
@@ -138,12 +153,12 @@ 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 relationalPlaceholder the relational placeholder
* @return the {@link Builder} itself
* @since 1.0.0
*/
@Contract("null, _ -> fail; _, null -> fail; !null, !null -> this")
@NotNull Builder relationalPlaceholder(final @NotNull String key, final @NotNull RelationalPlaceholder relationalPlaceholder);
/**
@@ -156,19 +171,17 @@ public interface Expansion {
* @return the {@link Builder} itself
* @since 1.0.0
*/
@Contract("null, _ -> fail; _, null -> fail; !null, !null -> this")
@NotNull Builder globalPlaceholder(final @NotNull String key, final @NotNull BiFunction<@NotNull ArgumentQueue, @NotNull Context, @Nullable Tag> function);
/**
* Adds a global placeholder
*
* <p>This placeholder is not cached and is inmutable</p>
* <p>This placeholder is not cached and is immutable</p>
* @param key the placeholder key, cannot be an empty or black string
* @param tag the tag of this placeholder
* @return the {@link Builder} itself
* @since 1.1.0
*/
@Contract("null, _ -> fail; _, null -> fail; !null, !null -> this")
@NotNull Builder globalPlaceholder(final @NotNull String key, final @NotNull Tag tag);
/**
@@ -180,6 +193,7 @@ public interface 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
* @return the {@link Builder} itself
* @since 1.0.0
@@ -191,15 +205,17 @@ public interface Expansion {
* 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))
* Expansion.builder("example")
* .filter(aud -> aud instanceof Player player{@literal &&} isInProtectedServer(player)
* .audiencePlaceholder("hello", (aud, queue, ctx) -> Tag.selfInsertingClosing(Component.text("you are in protected server")))
* .build();
* </pre>
*
* @param predicate the check to realize
* @return the {@link Builder} itself
* @since 1.0.0
*/
@Contract("_ -> this")
@NotNull Builder filter(final @Nullable Predicate<Audience> predicate);
@NotNull Builder filter(final @Nullable Predicate<@NotNull Audience> predicate);
}
}
@@ -0,0 +1,226 @@
package io.github.miniplaceholders.api;
import io.github.miniplaceholders.api.placeholder.AudiencePlaceholder;
import io.github.miniplaceholders.api.placeholder.RelationalPlaceholder;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
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.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import static io.github.miniplaceholders.api.utils.Conditions.nonNullOrEmptyString;
import static java.util.Objects.requireNonNull;
final class ExpansionImpl implements Expansion {
private static final Tags.Single[] EMPTY_SINGLE_AUDIENCE = new Tags.Single[0];
private static final Tags.Relational[] EMPTY_RELATIONAL_AUDIENCE = new Tags.Relational[0];
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;
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(EMPTY_SINGLE_AUDIENCE)
: EMPTY_SINGLE_AUDIENCE;
this.relationalPlaceholders = relationalPlaceholders != null
? relationalPlaceholders.toArray(EMPTY_RELATIONAL_AUDIENCE)
: EMPTY_RELATIONAL_AUDIENCE;
this.globalPlaceholders = globalPlaceholders;
this.filterClass = filterClass;
this.predicateFilter = predicateFilter;
}
@Override
public @NotNull String name(){
return this.name;
}
@Override
public @NotNull TagResolver audiencePlaceholders(@NotNull Audience audience) {
if (audiencePlaceholders.length == 0) return TagResolver.empty();
requireNonNull(audience, "the audience cannot be null");
if ((audience = expansionFilter(audience)) == null) return TagResolver.empty();
final TagResolver.Builder placeholders = TagResolver.builder();
for (final Tags.Single pl : this.audiencePlaceholders) {
placeholders.resolver(pl.of(audience));
}
return placeholders.build();
}
@SuppressWarnings("OverrideOnly")
private Audience expansionFilter(final Audience audience) {
if (audience == null || filterClass == null && predicateFilter == null) {
return audience;
}
final boolean eligible = filterClass != null && filterClass.isInstance(audience)
|| predicateFilter != null && predicateFilter.test(audience);
if (eligible) {
return audience;
}
if (audience instanceof final ForwardingAudience.Single forward) {
return expansionFilter(forward.audience());
}
return null;
}
@Override
public @NotNull TagResolver relationalPlaceholders(@NotNull Audience audience, @NotNull Audience otherAudience){
if (relationalPlaceholders.length == 0) return TagResolver.empty();
requireNonNull(audience, "the audience cannot be null");
requireNonNull(otherAudience, "the other audience cannot be null");
audience = expansionFilter(audience);
otherAudience = expansionFilter(otherAudience);
if (audience == null || otherAudience == null) {
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();
}
@Override
public @NotNull TagResolver globalPlaceholders(){
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);
}
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;
Builder(@NotNull final String name){
this.expansionName = nonNullOrEmptyString(name, "Expansion name")
.toLowerCase(Locale.ROOT).concat("_");
}
@Override
public @NotNull Builder audiencePlaceholder(@NotNull final String key, @NotNull final AudiencePlaceholder audiencePlaceholder){
nonNullOrEmptyString(key, "Placeholder key");
requireNonNull(audiencePlaceholder, "the audience placeholder cannot be null");
if (this.audiencePlaceholders == null) this.audiencePlaceholders = new HashSet<>();
this.audiencePlaceholders.add(Tags.single(expansionName+key, audiencePlaceholder));
return this;
}
@Override
public @NotNull Builder relationalPlaceholder(@NotNull final String key, @NotNull final RelationalPlaceholder relationalPlaceholder){
nonNullOrEmptyString(key, "Placeholder key");
requireNonNull(relationalPlaceholder, "the relational placeholder cannot be null");
if (this.relationalPlaceholders == null) this.relationalPlaceholders = new HashSet<>();
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){
nonNullOrEmptyString(key, "Placeholder key");
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){
nonNullOrEmptyString(key, "Placeholder key");
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() : TagResolver.empty(),
this.filterClass,
this.predicateFilter
);
}
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (!(o instanceof Expansion that)) return false;
return that.name().equalsIgnoreCase(this.name());
}
@Override
public int hashCode(){
return Objects.hash(name.hashCode());
}
}
@@ -1,18 +1,18 @@
package me.dreamerzero.miniplaceholders.api;
package io.github.miniplaceholders.api;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import me.dreamerzero.miniplaceholders.api.enums.Platform;
import me.dreamerzero.miniplaceholders.api.utils.Resolvers;
import me.dreamerzero.miniplaceholders.connect.InternalPlatform;
import io.github.miniplaceholders.api.enums.Platform;
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.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import static io.github.miniplaceholders.api.utils.Resolvers.applyIfNotEmpty;
import static java.util.Objects.requireNonNull;
/**
* MiniPlaceholders
@@ -27,8 +27,8 @@ import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
* @since 1.0.0
*/
public final class MiniPlaceholders {
private MiniPlaceholders(){}
static final Set<Expansion> expansions = Collections.synchronizedSet(new HashSet<>());
private MiniPlaceholders() {}
static final Set<Expansion> expansions = ConcurrentHashMap.newKeySet();
/**
* Get the platform
@@ -36,9 +36,13 @@ public final class MiniPlaceholders {
* @since 1.0.0
*/
public static @NotNull Platform getPlatform() {
return InternalPlatform.platform() == InternalPlatform.PAPER
? Platform.PAPER
: Platform.VELOCITY;
return switch (InternalPlatform.platform()) {
case PAPER -> Platform.PAPER;
case VELOCITY -> Platform.VELOCITY;
case KRYPTON -> Platform.KRYPTON;
case FABRIC -> Platform.FABRIC;
case SPONGE -> Platform.SPONGE;
};
}
/**
@@ -47,7 +51,7 @@ public final class MiniPlaceholders {
* <pre>TagResolver resolver = MiniPlaceholders.getGlobalPlaceholders();
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);</pre>
*
* @return global placeholders independient of any audience
* @return global placeholders independent of any audience
* @see TagResolver
* @since 1.0.0
*/
@@ -71,21 +75,19 @@ public final class MiniPlaceholders {
* @return {@link TagResolver} with placeholders based on an audience
* @since 1.0.0
*/
@Contract("null -> fail, !null -> !null")
public static @NotNull TagResolver getAudiencePlaceholders(final @NotNull Audience audience) {
Objects.requireNonNull(audience, () -> "audience cannot be null");
requireNonNull(audience, "audience cannot be null");
final TagResolver.Builder resolvers = TagResolver.builder();
for (Expansion expansion : expansions) {
final TagResolver resolver = expansion.audiencePlaceholders(audience);
if (resolver != TagResolver.empty())
resolvers.resolver(resolver);
applyIfNotEmpty(resolver, resolvers);
}
return resolvers.build();
}
/**
* Get the relationals placeholders based on two audiences
* Get the relational placeholders based on two audiences
*
* <pre>TagResolver resolver = MiniPlaceholders.getRelationalPlaceholders({@link Audience}, {@link Audience});
* Component messageParsed = MiniMessage.miniMessage().deserialize({@link String}, resolver);</pre>
@@ -95,14 +97,13 @@ public final class MiniPlaceholders {
* @return placeholders based on two audiences
* @since 1.0.0
*/
@Contract("_, null -> fail; null, _ -> fail; !null, !null -> !null")
public static @NotNull TagResolver getRelationalPlaceholders(final @NotNull Audience audience, final @NotNull Audience otherAudience) {
Objects.requireNonNull(audience, () -> "audience cannot be null");
Objects.requireNonNull(otherAudience, () -> "otherAudience cannot be null");
requireNonNull(audience, "audience cannot be null");
requireNonNull(otherAudience, "otherAudience cannot be null");
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
Resolvers.applyIfNotEmpty(
applyIfNotEmpty(
expansion.relationalPlaceholders(audience, otherAudience),
builder
);
@@ -129,21 +130,20 @@ public final class MiniPlaceholders {
* @return {@link TagResolver} with placeholders based on an audience and the global placeholders
* @since 1.1.0
*/
@Contract("_, null -> fail; null, _ -> fail; !null, !null -> !null")
public static @NotNull TagResolver getAudienceGlobalPlaceholders(final @NotNull Audience audience) {
Objects.requireNonNull(audience, () -> "audience cannot be null");
requireNonNull(audience, "audience cannot be null");
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
Resolvers.applyIfNotEmpty(expansion.audiencePlaceholders(audience), builder);
Resolvers.applyIfNotEmpty(expansion.globalPlaceholders(), builder);
applyIfNotEmpty(expansion.audiencePlaceholders(audience), builder);
applyIfNotEmpty(expansion.globalPlaceholders(), builder);
}
return builder.build();
}
/**
* Get the relationals placeholders based on two audiences, based on the first audience,
* Get the relational placeholders based on two audiences, based on the first audience,
* and the global placeholders
*
* <pre>
@@ -163,24 +163,23 @@ public final class MiniPlaceholders {
* @return the placeholders based on two audiences, placeholders based on the first audience and the global placeholders
* @since 1.1.0
*/
@Contract("_, null -> fail; null, _ -> fail; !null, !null -> !null")
public static @NotNull TagResolver getRelationalGlobalPlaceholders(final @NotNull Audience audience, final @NotNull Audience otherAudience) {
Objects.requireNonNull(audience, () -> "audience cannot be null");
Objects.requireNonNull(otherAudience, () -> "otherAudience cannot be null");
requireNonNull(audience, "audience cannot be null");
requireNonNull(otherAudience, "otherAudience cannot be null");
final TagResolver.Builder builder = TagResolver.builder();
for (final Expansion expansion : expansions) {
Resolvers.applyIfNotEmpty(expansion.audiencePlaceholders(audience), builder);
Resolvers.applyIfNotEmpty(expansion.relationalPlaceholders(audience, otherAudience), builder);
Resolvers.applyIfNotEmpty(expansion.globalPlaceholders(), builder);
applyIfNotEmpty(expansion.audiencePlaceholders(audience), builder);
applyIfNotEmpty(expansion.relationalPlaceholders(audience, otherAudience), builder);
applyIfNotEmpty(expansion.globalPlaceholders(), builder);
}
return builder.build();
}
/**
* Get the ammount of expansion registered
* @return the ammount of expansions registered
* Get the amount of expansion registered
* @return the amount of expansions registered
* @since 1.0.0
*/
public static int getExpansionCount(){
@@ -188,14 +187,25 @@ public final class MiniPlaceholders {
}
/**
* Set the platform
* @param platform the platform
* @deprecated dont use this, INTERNAL
* @since 1.0.0
* Get a specific expansion by name
* <p>The name of each expansion is set when the expansion is created</p>
* <pre>
* Expansion expansion = Expansion.builder("example").build();
* expansion.register();
*
* assertThat(MiniPlaceholders.getExpansionByName("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
*/
@Deprecated(forRemoval = true, since = "1.1.0")
@org.jetbrains.annotations.ApiStatus.Internal
public static void setPlatform(Platform platform){
throw new UnsupportedOperationException("Cannot set platform twice");
public static @Nullable Expansion getExpansionByName(final @NotNull String name) {
for (final Expansion expansion : expansions) {
if (Objects.equals(expansion.name(), name)) {
return expansion;
}
}
return null;
}
}
@@ -1,12 +1,12 @@
package me.dreamerzero.miniplaceholders.api;
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 me.dreamerzero.miniplaceholders.api.placeholder.AudiencePlaceholder;
import me.dreamerzero.miniplaceholders.api.placeholder.RelationalPlaceholder;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.minimessage.Context;
import net.kyori.adventure.text.minimessage.ParsingException;
@@ -15,7 +15,7 @@ import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
final class Tags {
private Tags(){}
private Tags() {}
static Relational relational(@NotNull final String name, @NotNull final RelationalPlaceholder relationalPlaceholder){
return new Tags.Relational(name, relationalPlaceholder);
@@ -35,7 +35,7 @@ final class Tags {
}
TagResolver of(@NotNull final Audience audience, @NotNull final Audience otherAudience){
return new TagResolver(){
return new TagResolver() {
@Override
public @Nullable Tag resolve(@NotNull String name, @NotNull ArgumentQueue arguments,
@NotNull Context ctx) throws ParsingException {
@@ -53,10 +53,10 @@ final class Tags {
}
@Override
public boolean equals(Object o){
if(o == this) return true;
if(!(o instanceof Relational)) return false;
return ((Relational)o).key.equals(this.key);
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof final Relational that)) return false;
return that.key.equalsIgnoreCase(this.key);
}
@Override
@@ -93,10 +93,10 @@ final class Tags {
}
@Override
public boolean equals(Object o){
if(o == this) return true;
if(!(o instanceof Single)) return false;
return ((Single)o).key.equals(this.key);
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof final Single that)) return false;
return that.key.equalsIgnoreCase(this.key);
}
@Override
@@ -0,0 +1,15 @@
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,
/**Sponge Platform */
SPONGE
}
@@ -0,0 +1,2 @@
/**Plugin enums */
package io.github.miniplaceholders.api.enums;
@@ -0,0 +1,4 @@
/**
* MiniPlaceholders core package
*/
package io.github.miniplaceholders.api;
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders.api.placeholder;
package io.github.miniplaceholders.api.placeholder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders.api.placeholder;
package io.github.miniplaceholders.api.placeholder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -1,4 +1,4 @@
/**
* Placeholders available based on information obtained from Audiences
*/
package me.dreamerzero.miniplaceholders.api.placeholder;
package io.github.miniplaceholders.api.placeholder;
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders.api.utils;
package io.github.miniplaceholders.api.utils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
@@ -0,0 +1,74 @@
package io.github.miniplaceholders.api.utils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.Supplier;
/** Checks required for the correct operation of the expansions*/
public final class 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
* @throws IllegalStateException if the provided string is empty
*/
public static String nonNullOrEmptyString(@Nullable String string, @NotNull Supplier<@NotNull 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
* @since 2.2.0
* @throws IllegalStateException if the provided string is empty
*/
public static String nonNullOrEmptyString(@Nullable String string, @NotNull 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
* @since 1.0.0
* @throws IllegalStateException if the provided string is empty
*/
public static String nonEmptyString(@NotNull String string, @NotNull Supplier<@NotNull 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
* @since 2.2.0
* @throws IllegalStateException if the provided string is empty
*/
public static String nonEmptyString(@NotNull String string, @NotNull String reason){
if (string.isBlank()) throw new IllegalStateException(reason);
return string;
}
}
@@ -0,0 +1,115 @@
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.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 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 @NotNull 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 @NotNull Component parsePossibleLegacy(@Nullable String string, @NotNull 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 @NotNull Component parsePossibleLegacy(@Nullable String string, @NotNull 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
);
}
}
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders.api.utils;
package io.github.miniplaceholders.api.utils;
import org.jetbrains.annotations.NotNull;
@@ -1,9 +1,9 @@
package me.dreamerzero.miniplaceholders.api.utils;
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 me.dreamerzero.miniplaceholders.api.placeholder.AudiencePlaceholder;
import me.dreamerzero.miniplaceholders.api.placeholder.RelationalPlaceholder;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
@@ -2,4 +2,4 @@
* General Utilities
* Here you will find utilities that will help you in the development of expansions
*/
package me.dreamerzero.miniplaceholders.api.utils;
package io.github.miniplaceholders.api.utils;
@@ -1,202 +0,0 @@
package me.dreamerzero.miniplaceholders.api;
import java.util.Collection;
import java.util.HashSet;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import me.dreamerzero.miniplaceholders.api.placeholder.AudiencePlaceholder;
import me.dreamerzero.miniplaceholders.api.placeholder.RelationalPlaceholder;
import me.dreamerzero.miniplaceholders.api.utils.Conditions;
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;
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;
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;
}
@Override
public String name(){
return this.name;
}
@Override
public @NotNull TagResolver audiencePlaceholders(@NotNull final Audience audience){
if(audiencePlaceholders.length == 0) return TagResolver.empty();
Objects.requireNonNull(audience, () -> "the audience cannot be null");
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);
}
@Override
public @NotNull TagResolver relationalPlaceholders(@NotNull final Audience audience, @NotNull final Audience otherAudience){
if(relationalPlaceholders.length == 0) return TagResolver.empty();
Objects.requireNonNull(audience, () -> "the audience cannot be null");
Objects.requireNonNull(otherAudience, () -> "the other audience cannot be null");
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));
}
@Override
public @NotNull TagResolver globalPlaceholders(){
return this.globalPlaceholders;
}
@Override
public void register(){
MiniPlaceholders.expansions.add(this);
}
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;
Builder(@NotNull final String name){
this.expansionName = Conditions.nonNullOrEmptyString(name, () -> "expansion name")
.toLowerCase(Locale.ROOT).concat("_");
}
@Override
public 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 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 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 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 Builder filter(@Nullable final Class<? extends Audience> clazz) {
this.filterClass = clazz;
return this;
}
@Override
public 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());
}
}
@@ -1,9 +0,0 @@
package me.dreamerzero.miniplaceholders.api.enums;
/**Platforms on which MiniPlaceholders can be used */
public enum Platform {
/**Paper Platform */
PAPER,
/**Velocity Platform */
VELOCITY
}
@@ -1,2 +0,0 @@
/**Plugin enums */
package me.dreamerzero.miniplaceholders.api.enums;
@@ -1,4 +0,0 @@
/**
* MiniPlaceholders core package
*/
package me.dreamerzero.miniplaceholders.api;
@@ -1,37 +0,0 @@
package me.dreamerzero.miniplaceholders.api.utils;
import java.util.function.Supplier;
/** Checks required for the correct operation of the expansions*/
public final class 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;
}
/**
* 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;
}
}
@@ -1,44 +0,0 @@
package me.dreamerzero.miniplaceholders.api.utils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
/**
* Legacy utils
*/
public final class LegacyUtils {
private LegacyUtils(){}
/**
* Legacy serializer with hex support
*
* Use this as the last available alternative,
* it is recommended to use MiniMessage instead of this serializer
*/
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);
}
}
}
+16
View File
@@ -0,0 +1,16 @@
/** MiniPlaceholders API Module */
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;
exports io.github.miniplaceholders.api;
exports io.github.miniplaceholders.api.enums;
exports io.github.miniplaceholders.api.utils;
exports io.github.miniplaceholders.api.placeholder;
}
@@ -0,0 +1,45 @@
package io.github.miniplaceholders.test;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.TagsUtils;
import io.github.miniplaceholders.test.testobjects.TestAudienceHolder;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static io.github.miniplaceholders.test.PlaceholderTest.assertContentEquals;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
class ExpansionsTest {
@Test
@DisplayName("Expansion Equality")
void equalsExpansions(){
final Expansion firstExpansion = Expansion.builder("equals")
.audiencePlaceholder("test", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.build();
final Expansion secondExpansion = Expansion.builder("equals")
.audiencePlaceholder("test", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.build();
assertEquals(firstExpansion, secondExpansion);
}
@Test
void nullForwardedAudience() {
TestAudienceHolder audience = new TestAudienceHolder(null);
final Expansion expansion = Expansion.builder("test")
.filter(aud -> aud.toString().isBlank())
.audiencePlaceholder("testing", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(aud.toString())))
.build();
Component result = assertDoesNotThrow(
() -> miniMessage().deserialize("<test_testing>", expansion.audiencePlaceholders(audience))
);
assertContentEquals(result, Component.text("<test_testing>"));
}
}
@@ -0,0 +1,20 @@
package io.github.miniplaceholders.test;
import io.github.miniplaceholders.api.utils.LegacyUtils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class LegacyTest {
@Test
void testLegacyParsing() {
final String string = "<rainbow>hello... i &8hate legacy format §bso much";
final Component parsed = LegacyUtils.parsePossibleLegacy(string);
final String result = PlainTextComponentSerializer.plainText().serialize(parsed);
final String expected = "hello... i hate legacy format so much";
assertEquals(expected, result);
}
}
@@ -1,17 +1,17 @@
package me.dreamerzero.miniplaceholders;
import static org.junit.jupiter.api.Assertions.assertEquals;
package io.github.miniplaceholders.test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.MiniPlaceholders;
import me.dreamerzero.miniplaceholders.api.utils.TagsUtils;
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 net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
public class MiniPlaceholdersTest {
import static org.junit.jupiter.api.Assertions.*;
class MiniPlaceholdersTest {
@Test
@Disabled("Cannot correctly calculate the equity of 2 TagResolvers obtained in different ways")
void methodEquality(){
@@ -30,4 +30,16 @@ public class MiniPlaceholdersTest {
)
);
}
@Test
void registrationTest() {
Expansion expansion = Expansion.builder("testregistration")
.build();
expansion.register();
assertTrue(expansion.registered());
assertThrows(IllegalStateException.class, expansion::register);
assertDoesNotThrow(expansion::unregister);
}
}
@@ -1,13 +1,15 @@
package me.dreamerzero.miniplaceholders;
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.test.testobjects.TestAudienceHolder;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.DisplayName;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.MiniPlaceholders;
import me.dreamerzero.miniplaceholders.testobjects.TestAudience;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.MiniPlaceholders;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
@@ -15,7 +17,7 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
public class PlaceholderTest {
class PlaceholderTest {
@Test
@DisplayName("Audience Placeholder Test")
@@ -23,12 +25,15 @@ public class PlaceholderTest {
TestAudience player = new TestAudience("4drian3d");
Expansion expansion = Expansion.builder("example")
.audiencePlaceholder("name", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((TestAudience)aud).getName()))).build();
.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 result = miniMessage().deserialize("Player Name: <example_name>", expansion.audiencePlaceholders(player));
assertEquals(expected, result);
assertContentEquals(expected, result);
}
@Test
@@ -59,7 +64,7 @@ public class PlaceholderTest {
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
@@ -80,7 +85,7 @@ public class PlaceholderTest {
@DisplayName("Filtered Expansion")
void filteredExpansion(){
Expansion expansion = Expansion.builder("filter")
.audiencePlaceholder("name", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((TestAudience)aud).getName())))
.audiencePlaceholder("name", (aud, queue, ctx) -> Tag.selfClosingInserting(Component.text(((TestAudience)aud).name())))
.filter(TestAudience.class)
.build();
@@ -92,13 +97,50 @@ public class PlaceholderTest {
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, expansion.audiencePlaceholders(player)));
assertContentEquals(emptyExpected, MiniMessage.miniMessage().deserialize(string, expansion.audiencePlaceholders(emptyAudience)));
}
void assertContentEquals(Component first, Component second){
@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());
assertContentEquals(parsed, Component.text("Arguments: 2"));
}
@Test
@DisplayName("Forwarding Audience Parsing Test")
void forwardingAudienceTest() {
Expansion expansion = Expansion.builder("test")
.filter(TestAudience.class)
.audiencePlaceholder("testing", (audience, queue, ctx) -> {
TestAudience testAudience = (TestAudience) audience;
return Tag.selfClosingInserting(Component.text("Name: "+testAudience.name()));
}).build();
TestAudience testAudience = new TestAudience("4drian3d");
Audience forward = new TestAudienceHolder(testAudience);
Component parsed = miniMessage().deserialize("<test_testing>.", expansion.audiencePlaceholders(forward));
Component expected = Component.text("Name: 4drian3d.");
assertContentEquals(parsed, expected);
}
static void assertContentEquals(Component first, Component second){
String firstSerialized = PlainTextComponentSerializer.plainText().serialize(first);
String secondSerialized = PlainTextComponentSerializer.plainText().serialize(second);
@@ -106,7 +148,7 @@ public class PlaceholderTest {
}
private boolean isEnemy(TestAudience a1, TestAudience a2){
return a1.getName().equals("PlayerOne") && a2.getName().equals("PlayerTwo");
return a1.name().equals("PlayerOne") && a2.name().equals("PlayerTwo");
}
}
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders;
package io.github.miniplaceholders.test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -8,14 +8,16 @@ import java.util.function.BiFunction;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.MiniPlaceholders;
import me.dreamerzero.miniplaceholders.api.utils.TagsUtils;
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;
public class ThrowableTest {
//yea... it is intended xd
@SuppressWarnings("DataFlowIssue")
class ThrowableTest {
@Test
@DisplayName("Nullable Exception")
void throwOnNull(){
@@ -0,0 +1,7 @@
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 {}
@@ -0,0 +1,11 @@
package io.github.miniplaceholders.test.testobjects;
import net.kyori.adventure.audience.ForwardingAudience;
import org.jetbrains.annotations.NotNull;
public record TestAudienceHolder(TestAudience audience) implements ForwardingAudience.Single {
@Override
public @NotNull TestAudience audience() {
return audience;
}
}
@@ -1,24 +0,0 @@
package me.dreamerzero.miniplaceholders;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.utils.TagsUtils;
public class ExpansionsTest {
@Test
@DisplayName("Expansion Equality")
void equalsExpansions(){
final Expansion firstExpansion = Expansion.builder("equals")
.audiencePlaceholder("test", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.build();
final Expansion secondExpansion = Expansion.builder("equals")
.audiencePlaceholder("test", TagsUtils.NULL_AUDIENCE_PLACEHOLDER)
.build();
assertEquals(firstExpansion, secondExpansion);
}
}
@@ -1,16 +0,0 @@
package me.dreamerzero.miniplaceholders.testobjects;
import org.jetbrains.annotations.NotNull;
import net.kyori.adventure.audience.Audience;
public final class TestAudience implements Audience {
private final String name;
public TestAudience(String name) {
this.name = name;
}
public @NotNull String getName(){
return this.name;
}
}
+19
View File
@@ -0,0 +1,19 @@
plugins {
`kotlin-dsl`
}
dependencies {
implementation(libs.plugin.shadow)
implementation(libs.plugin.kotlin)
implementation(libs.plugin.dokka)
}
repositories {
gradlePluginPortal()
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
+19
View File
@@ -0,0 +1,19 @@
rootProject.name = "build-logic"
dependencyResolutionManagement {
@Suppress("UnstableApiUsage")
repositories {
gradlePluginPortal()
mavenCentral()
}
versionCatalogs {
register("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
@@ -0,0 +1,7 @@
import org.gradle.api.Project
import org.gradle.configurationcache.extensions.capitalized
val Project.capitalizeName: String
get() = this.name.substring(17).capitalized()
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.Date
plugins {
java
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
jar {
manifest {
attributes(
"Specification-Version" to project.version,
"Specification-Vendor" to "MiniPlaceholders",
"Implementation-Build-Date" to Date()
)
}
}
}
java{
toolchain{
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
}
@@ -0,0 +1,80 @@
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()
}*/
@@ -0,0 +1,71 @@
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,21 @@
plugins {
id("miniplaceholders.base")
id("com.github.johnrengelman.shadow")
}
tasks {
shadowJar {
archiveBaseName.set("MiniPlaceholders-${project.capitalizeName}")
archiveClassifier.set("")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
relocate("net.william278.desertwell", "io.github.miniplaceholders.libs.desertwell")
relocate("cloud.commandframework", "io.github.miniplaceholders.libs.cloud")
if (project.simpleName() != "sponge") {
relocate("io.leangen.geantyref", "io.github.miniplaceholders.libs.geantyref")
}
destinationDirectory.set(file("${project.rootDir}/jar"))
}
build {
dependsOn(shadowJar)
}
}
+3 -34
View File
@@ -1,40 +1,9 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
java
id("com.github.johnrengelman.shadow") version "7.1.2"
}
allprojects {
apply(plugin = "java")
group = "me.dreamerzero.miniplaceholders"
version = "1.2.0"
description = "MiniPlaceholders"
}
dependencies {
shadow(project(":miniplaceholders-connect"))
shadow(project(":miniplaceholders-api"))
shadow(project(":miniplaceholders-common"))
shadow(project(":miniplaceholders-velocity"))
shadow(project(":miniplaceholders-paper", "reobf"))
}
subprojects {
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.maven.apache.org/maven2/")
}
kotlin("jvm") version "1.9.20" apply false
}
tasks {
shadowJar {
archiveFileName.set("MiniPlaceholders.jar")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations = listOf(project.configurations.shadow.get())
}
build {
dependsOn(shadowJar)
delete {
delete("jar")
}
}
+23 -22
View File
@@ -1,27 +1,28 @@
plugins {
id("net.kyori.blossom") version "1.3.1"
}
repositories {
maven("https://libraries.minecraft.net");
id("miniplaceholders.auto.module")
alias(libs.plugins.idea.ext)
alias(libs.plugins.blossom)
}
dependencies {
implementation(project(":miniplaceholders-api"))
compileOnly("net.kyori:adventure-api:4.11.0")
compileOnly("net.kyori:adventure-text-minimessage:4.11.0")
compileOnly("com.mojang:brigadier:1.0.18")
}
blossom{
replaceToken("{version}", version)
replaceTokenIn("src/main/java/me/dreamerzero/miniplaceholders/common/PluginConstants.java")
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
implementation(projects.miniplaceholdersApi)
implementation(libs.desertwell) {
exclude("org.json")
}
}
implementation(libs.cloud.core)
implementation(libs.cloud.extras) {
isTransitive = false
}
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.minimesssage)
}
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() {}
}
@@ -0,0 +1,198 @@
package io.github.miniplaceholders.common;
import cloud.commandframework.ArgumentDescription;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.standard.StringArgument;
import cloud.commandframework.minecraft.extras.AudienceProvider;
import cloud.commandframework.minecraft.extras.MinecraftExceptionHandler;
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.Placeholder;
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.ArrayList;
import java.util.List;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.function.Supplier;
import static java.util.Objects.requireNonNull;
import static net.kyori.adventure.text.Component.newline;
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;
public final class PlaceholdersCommand<A extends Audience> {
private final Supplier<ArrayList<String>> playersSuggestions;
private final Function<String, Audience> toAudience;
private final BiPredicate<A, String> hasPermission;
private final String command;
private final CommandManager<A> commandManager;
private PlaceholdersCommand(
final Supplier<ArrayList<String>> playersSuggestions,
final Function<String, Audience> toAudience,
final BiPredicate<A, String> hasPermission,
final String command,
final CommandManager<A> commandManager
) {
this.playersSuggestions = playersSuggestions;
this.toAudience = toAudience;
this.hasPermission = hasPermission;
this.command = command;
this.commandManager = commandManager;
}
private static final Component TITLE = miniMessage().deserialize("<gradient:#4d8bff:#a4ff96>MiniPlaceholders</gradient>");
private static final Component HELP = text()
.append(newline(), miniMessage().deserialize(
"<gradient:aqua:white:aqua><st><b> </st> <title> <st><b> </st>", Placeholder.component("title", TITLE)))
.append(newline(), miniMessage().deserialize(
"<gradient:#9694ff:#5269ff>Commands:</gradient>"))
.append(newline(), miniMessage().deserialize(
"<gradient:aqua:#94d1ff>/miniplaceholders</gradient> <aqua>help</aqua>"))
.append(newline(), miniMessage().deserialize(
"<gradient:aqua:#94d1ff>/miniplaceholders</gradient> <aqua>parse</aqua> <#8fadff><player | me></#8fadff> <#99ffb6><player></#99ffb6>"))
.append(newline(), miniMessage().deserialize(
"<gradient:aqua:white:aqua><st><b> "))
.build();
private static final Component INFO = AboutMenu.builder()
.title(TITLE)
.description(text("MiniMessage Component-based Placeholders for Paper, Folia, Fabric, Velocity, Sponge 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();
private Command.Builder<A> rootBuilder() {
return commandManager.commandBuilder(command);
}
public void register() {
new MinecraftExceptionHandler<A>()
.withDefaultHandlers()
.withDecorator(component -> Component.text().append(TITLE).appendSpace().append(component).build())
.apply(commandManager, AudienceProvider.nativeAudience());
commandManager.command(rootBuilder()
.permission(src -> {
if (hasPermission != null) {
return hasPermission.test(src, "miniplaceholders.command");
}
return src
.get(PermissionChecker.POINTER)
.map(checker -> checker.value("miniplaceholders.command"))
.orElse(TriState.FALSE) != TriState.FALSE;
})
.handler(handler -> handler.getSender().sendMessage(INFO)));
final CommandArgument<A, String> sourceArgument = StringArgument.<A>builder("source")
.single()
.withDefaultDescription(ArgumentDescription.of("The source from which the message will be parsed"))
.withSuggestionsProvider((ctx, st) -> {
final List<String> suggestions = playersSuggestions.get();
suggestions.add("me");
return suggestions;
})
.build();
final CommandArgument<A, String> stringArgument = StringArgument.<A>builder("message")
.greedy()
.withDefaultDescription(ArgumentDescription.of("Message to be parsed"))
.build();
commandManager.command(
rootBuilder().literal("parse")
.argument(sourceArgument)
.argument(stringArgument)
.permission("miniplaceholders.command.parse")
.handler(handler -> {
final String source = handler.get(sourceArgument);
final Audience objective = "me".equals(source)
? handler.getSender()
: toAudience.apply(source);
if (objective == null){
handler.getSender().sendMessage(text("You must specify a valid player", RED));
return;
}
final String toParse = handler.get(stringArgument);
final Component parsed = miniMessage().deserialize(
toParse,
MiniPlaceholders.getAudienceGlobalPlaceholders(objective)
);
handler.getSender().sendMessage(parsed);
})
);
commandManager.command(
rootBuilder().literal("help")
.permission("miniplaceholders.command.help")
.handler(handler -> handler.getSender().sendMessage(HELP))
);
}
public static <A extends Audience> Builder<A> builder() {
return new Builder<>();
}
public final static class Builder<A extends Audience> implements AbstractBuilder<PlaceholdersCommand<A>> {
private Supplier<ArrayList<String>> playersSuggestions;
private Function<String, Audience> toAudience;
private BiPredicate<A, String> hasPermission;
private String command;
private CommandManager<A> commandManager;
private Builder() {}
public Builder<A> playerSuggestions(final Supplier<@NotNull ArrayList<@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> hasPermissionCheck(final @NotNull BiPredicate<@NotNull A, @NotNull String> hasPermission) {
this.hasPermission = hasPermission;
return this;
}
public Builder<A> command(final String command) {
this.command = command;
return this;
}
public Builder<A> manager(CommandManager<A> commandManager) {
this.commandManager = commandManager;
return this;
}
@Override
public @NotNull PlaceholdersCommand<A> build() {
return new PlaceholdersCommand<>(
requireNonNull(playersSuggestions),
requireNonNull(toAudience),
hasPermission,
command,
commandManager
);
}
}
}
@@ -1,4 +1,4 @@
package me.dreamerzero.miniplaceholders.common;
package io.github.miniplaceholders.common;
public interface PlaceholdersPlugin {
void loadDefaultExpansions();
@@ -1,143 +0,0 @@
package me.dreamerzero.miniplaceholders.common;
import java.util.Collection;
import java.util.function.Function;
import java.util.function.Supplier;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.MiniPlaceholders;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.permission.PermissionChecker;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
public class PlaceholdersCommand<A> {
private final @NotNull Supplier<@NotNull Collection<@NotNull String>> playersSuggestions;
private final @NotNull Function<@NotNull String, @Nullable Audience> toAudience;
private Function<A, Audience> fromAToAudience = a -> Audience.empty();
private final Expansion commandExpansion = Expansion.builder("placeholders")
.globalPlaceholder("count", (queue, ctx) -> Tag.selfClosingInserting(Component.text(MiniPlaceholders.getExpansionCount())))
.globalPlaceholder("version", (queue, ctx) -> Tag.selfClosingInserting(Component.text(PluginConstants.VERSION)))
.build();
public PlaceholdersCommand(Supplier<Collection<String>> playersSuggestions, Function<@NotNull String, @Nullable Audience> toAudience){
this.playersSuggestions = playersSuggestions;
this.toAudience = toAudience;
}
public PlaceholdersCommand(Supplier<Collection<String>> playersSuggestions, Function<@NotNull String, @Nullable Audience> toAudience, Function<A, Audience> fromAToAudience){
this(playersSuggestions, toAudience);
this.fromAToAudience = fromAToAudience;
}
private static final Component HEADER = miniMessage().deserialize("<gradient:aqua:white:aqua>---------- <gradient:#4d8bff:#a4ff96>MiniPlaceholders</gradient> -----------</gradient>");
private static final Component FOOTER = miniMessage().deserialize("<gradient:aqua:white:aqua> --------------- ---------------</gradient>");
public LiteralArgumentBuilder<A> placeholderTestBuilder(String commandName){
return LiteralArgumentBuilder.<A>literal(commandName)
.requires(a -> getAudience(a).pointers().supports(PermissionChecker.POINTER))
.executes(cmd -> {
Audience source = getAudience(cmd.getSource());
if(source.pointers().get(PermissionChecker.POINTER).orElse(null).test("miniplaceholders.command")){
source.sendMessage(
Component.text()
.append(HEADER).append(Component.newline())
.append(miniMessage().deserialize("<gradient:aqua:#918fff>Placeholders Available:</gradient> <aqua><placeholders_count></aqua>", commandExpansion.globalPlaceholders())).append(Component.newline())
.append(FOOTER)
.build()
);
} else {
source.sendMessage(
Component.text()
.append(HEADER).append(Component.newline())
.append(miniMessage().deserialize("<gradient:red:dark_red>Version: <placeholders_version>", commandExpansion.globalPlaceholders())).append(Component.newline())
.append(FOOTER)
.build()
);
}
return 1;
})
.then(LiteralArgumentBuilder.<A>literal("help")
.executes(cmd -> {
getAudience(cmd.getSource()).sendMessage(
Component.text()
.append(HEADER).append(Component.newline())
.append(miniMessage().deserialize("<gradient:#9694ff:#5269ff>Commands:</gradient>")).append(Component.newline())
.append(miniMessage().deserialize("<gradient:aqua:#94d1ff>/miniplaceholders</gradient> <aqua>help</aqua>")).append(Component.newline())
.append(miniMessage().deserialize("<gradient:aqua:#94d1ff>/miniplaceholders</gradient> <aqua>parse</aqua> <color:#8fadff><player:me></color> <color:#99ffb6><player></color>")).append(Component.newline())
.append(FOOTER)
.build()
);
return 1;
})
)
.then(LiteralArgumentBuilder.<A>literal("parse")
.then(LiteralArgumentBuilder.<A>literal("me")
.then(RequiredArgumentBuilder.<A, String>argument("selfStringToParse", StringArgumentType.string())
.executes(cmd -> {
String stringToParse = cmd.getArgument("selfStringToParse", String.class);
Component parsed = this.parseGlobal(stringToParse, getAudience(cmd.getSource()));
getAudience(cmd.getSource()).sendMessage(parsed);
return 1;
})
)
)
.then(LiteralArgumentBuilder.<A>literal("player")
.then(RequiredArgumentBuilder.<A, String>argument("source", StringArgumentType.word())
.suggests((argument, builder) -> {
playersSuggestions.get().forEach(builder::suggest);
return builder.buildFuture();
})
.then(RequiredArgumentBuilder.<A, String>argument("playerStringToParse", StringArgumentType.string())
.executes(cmd -> {
Audience objetive = toAudience.apply(cmd.getArgument("source", String.class));
if(objetive == null){
getAudience(cmd.getSource()).sendMessage(Component.text("You must specify a valid player", NamedTextColor.RED));
return 1;
}
String stringToParse = cmd.getArgument("playerStringToParse", String.class);
Component parsed = this.parseGlobal(stringToParse, objetive);
getAudience(cmd.getSource()).sendMessage(parsed);
return 1;
})
)
)
)
);
}
public LiteralCommandNode<A> placeholderTestCommand(String command){
return this.placeholderTestBuilder(command).build();
}
private Component parseGlobal(String string, Audience audience){
return miniMessage().deserialize(
string,
TagResolver.resolver(
MiniPlaceholders.getGlobalPlaceholders(),
MiniPlaceholders.getAudiencePlaceholders(audience)
)
);
}
private Audience getAudience(A possibleAudience){
if(possibleAudience instanceof Audience audience){
return audience;
}
Audience audience = fromAToAudience.apply(possibleAudience);
return audience != null ? audience : Audience.empty();
}
}
@@ -1,7 +0,0 @@
package me.dreamerzero.miniplaceholders.common;
public final class PluginConstants {
public static final String VERSION = "{version}";
private PluginConstants(){}
}
+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")
}
@@ -1,8 +1,8 @@
package me.dreamerzero.miniplaceholders.connect;
package io.github.miniplaceholders.connect;
public enum InternalPlatform {
PAPER, VELOCITY;
PAPER, VELOCITY, KRYPTON, FABRIC, SPONGE;
private static InternalPlatform actualPlatform;
+3
View File
@@ -0,0 +1,3 @@
module io.github.miniplaceholders.connect {
exports io.github.miniplaceholders.connect;
}
+1
View File
@@ -0,0 +1 @@
/run
+61
View File
@@ -0,0 +1,61 @@
plugins {
id("miniplaceholders.auto.module")
id("fabric-loom")
alias(libs.plugins.shadow)
}
val shade: Configuration by configurations.creating
dependencies {
minecraft(libs.minecraft)
mappings(loom.officialMojangMappings())
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.api)
includeDependency(libs.adventure.platform.fabric)
includeDependency(libs.adventure.serializer.legacy)
includeDependency(libs.luckopermissionsapi)
includeDependency(libs.cloud.fabric)
includeDependency(libs.cloud.core)
includeDependency(libs.cloud.extras)
includeDependency(libs.desertwell)
shadeModule(projects.miniplaceholdersApi)
shadeModule(projects.miniplaceholdersCommon)
shadeModule(projects.miniplaceholdersConnect)
}
fun DependencyHandlerScope.shadeModule(module: ProjectDependency) {
shade(module) {
isTransitive = false
}
implementation(module) {
isTransitive = false
}
}
fun DependencyHandlerScope.includeDependency(dependency: Any) {
modImplementation(dependency)
include(dependency)
}
tasks {
processResources {
filteringCharset = Charsets.UTF_8.name()
filesMatching("fabric.mod.json") {
expand("version" to project.version)
}
}
remapJar {
inputFile.set(shadowJar.get().archiveFile)
archiveFileName.set("MiniPlaceholders-Fabric-${project.version}.jar")
destinationDirectory.set(file("${project.rootDir}/jar"))
}
shadowJar {
configurations = listOf(shade)
}
}
java {
withSourcesJar()
}
@@ -0,0 +1,113 @@
package io.github.miniplaceholders.fabric;
import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator;
import cloud.commandframework.fabric.FabricServerCommandManager;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.common.PlaceholdersCommand;
import io.github.miniplaceholders.common.PlaceholdersPlugin;
import io.github.miniplaceholders.connect.InternalPlatform;
import me.lucko.fabric.api.permissions.v0.Permissions;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
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.ArrayList;
import java.util.List;
import java.util.function.Function;
public class FabricMod implements ModInitializer, PlaceholdersPlugin {
private final Logger logger = LoggerFactory.getLogger("miniplaceholders");
private static final DecimalFormat MSPT_FORMAT = new DecimalFormat("###.###");
private final TickManager tickManager = new TickManager();
private MinecraftServer minecraftServer;
@Override
public void onInitialize() {
logger.info("Starting MiniPlaceholders Fabric");
InternalPlatform.platform(InternalPlatform.FABRIC);
ServerLifecycleEvents.SERVER_STARTING.register(minecraftServer -> {
this.minecraftServer = minecraftServer;
this.loadDefaultExpansions();
});
this.registerPlatformCommand();
}
@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 void registerPlatformCommand() {
final FabricServerCommandManager<CommandSourceStack> commandManager = new FabricServerCommandManager<>(
AsynchronousCommandExecutionCoordinator.simpleCoordinator(),
Function.identity(),
Function.identity()
);
PlaceholdersCommand.<CommandSourceStack>builder()
.hasPermissionCheck((source, permission) -> Permissions.check(source, permission, 4))
.toAudience(string -> this.minecraftServer.getPlayerList().getPlayerByName(string))
.playerSuggestions(() -> new ArrayList<>(List.of(this.minecraftServer.getPlayerNames())))
.manager(commandManager)
.command("miniplaceholders")
.build()
.register();
}
}
@@ -0,0 +1,59 @@
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());
}
}
@@ -0,0 +1,45 @@
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;
}
}
+29
View File
@@ -0,0 +1,29 @@
{
"schemaVersion": 1,
"id": "miniplaceholders",
"version": "${version}",
"name": "MiniPlaceholders",
"description": "MiniMessage Component-based Placeholders for PaperMC, Fabric, Krypton and Velocity platforms",
"authors": [
"4drian3d"
],
"contact": {
"homepage": "https://github.com/MiniPlaceholders/MiniPlaceholders",
"sources": "https://github.com/MiniPlaceholders/MiniPlaceholders",
"issues": "https://github.com/MiniPlaceholders/MiniPlaceholders/issues"
},
"license": "GPL",
"environment": "server",
"entrypoints": {
"main": [
"io.github.miniplaceholders.fabric.FabricMod"
]
},
"depends": {
"fabricloader": ">=0.14.19",
"fabric": "*",
"java": ">=17",
"minecraft": ">=1.19.4",
"fabric-permissions-api-v0": "*"
}
}
+5
View File
@@ -0,0 +1,5 @@
group = io.github.miniplaceholders
version = 2.2.2
description = MiniMessage Component-based Placeholders for Paper, Fabric, Sponge, Folia and Velocity platforms
org.gradle.jvmargs=-Xmx2G
+79
View File
@@ -0,0 +1,79 @@
metadata.format.version = "1.1"
[versions]
velocity = "3.2.0-SNAPSHOT"
paper = "1.20.2-R0.1-SNAPSHOT"
krypton = "7796647145"
minecraft = "1.20.2"
runtask = "2.2.0"
pluginyml = "0.6.0"
userdev = "1.5.9"
blossom = "2.1.0"
indra = "3.1.3"
shadow = "8.1.1"
jmh = "0.7.2"
dokka = "1.9.10"
cloud = "1.8.4"
adventure = "4.14.0"
adventurefabric = "5.10.0"
brigadier = "1.0.500"
kotlin="1.9.20"
fabric-api = "0.90.1+1.20.3"
fabric-loader = "0.14.24"
desertwell = "2.0.4"
[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" }
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
luckopermissionsapi = { group = "me.lucko", name = "fabric-permissions-api", version = "0.2-SNAPSHOT" }
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-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" }
cloud-core = { group = "cloud.commandframework", name = "cloud-core", version.ref = "cloud" }
cloud-annotations = { group = "cloud.commandframework", name = "cloud-annotations", version.ref = "cloud" }
cloud-velocity = { group = "cloud.commandframework", name = "cloud-velocity", version.ref = "cloud" }
cloud-paper = { group = "cloud.commandframework", name = "cloud-paper", version.ref = "cloud" }
cloud-fabric = { group = "cloud.commandframework", name = "cloud-fabric", version.ref = "cloud" }
cloud-sponge = { group = "cloud.commandframework", name = "cloud-sponge", version = "1.8.0-SNAPSHOT" }
cloud-extras = { group = "cloud.commandframework", name = "cloud-minecraft-extras", version.ref = "cloud" }
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.9.10"
desertwell = { group = "net.william278", name = "DesertWell", version.ref = "desertwell" }
junit-bom = "org.junit:junit-bom:5.10.0"
[plugins]
pluginyml = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" }
userdev = { id = "io.papermc.paperweight.userdev", version.ref = "userdev" }
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runtask" }
runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
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.1.7" }
Binary file not shown.
+3 -1
View File
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+33 -18
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
@@ -205,6 +214,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Vendored
+92 -89
View File
@@ -1,89 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
-2
View File
@@ -1,2 +0,0 @@
jdk:
- openjdk17
+19
View File
@@ -0,0 +1,19 @@
plugins {
kotlin("jvm")
id("miniplaceholders.kotlin.publish")
}
dependencies {
compileOnly(kotlin("stdlib"))
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.minimesssage)
compileOnlyApi(projects.miniplaceholdersApi)
}
kotlin {
explicitApi()
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
@@ -0,0 +1,16 @@
package io.github.miniplaceholders.kotlin
import io.github.miniplaceholders.api.Expansion
/**
* Create a new Expansion
*
* @param name the expansion name
* @param builder a builder-like function to create an Expansion from a builder
* @return a new expansion
* @since 1.4.0
* @see Expansion.builder
* @see Expansion.Builder.build
* */
public fun expansion(name: String, builder: Expansion.Builder.() -> Expansion.Builder): Expansion
= builder(Expansion.builder(name)).build()
@@ -0,0 +1,25 @@
package io.github.miniplaceholders.kotlin
import net.kyori.adventure.text.ComponentLike
import net.kyori.adventure.text.minimessage.tag.Tag
/**
* Converts a [ComponentLike] to a [Tag] of type selfClosingInserting
*
* @see Tag.selfClosingInserting
*/
public fun ComponentLike.asClosingTag(): Tag = Tag.selfClosingInserting(this)
/**
* Converts a [ComponentLike] to a [Tag] of type inserting
*
* @see Tag.inserting
*/
public fun ComponentLike.asInsertingTag(): Tag = Tag.inserting(this)
/**
* Converts a [ComponentLike] to a [Tag] of type preProcessParsed
*
* @see Tag.preProcessParsed
*/
public fun String.asPreProcessTag(): Tag = Tag.preProcessParsed(this)
@@ -0,0 +1,32 @@
package io.github.miniplaceholders.kotlin
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver
/**
* Check if this TagResolver is an instance of TagResolver.empty(),
* that is, it will always return null
* @return true if the TagResolver is the same as TagResolver.empty(), else false
* @since 1.4.0
* @see TagResolver.empty
*/
public fun TagResolver.isEmpty(): Boolean = this == TagResolver.empty()
/**
* Checks if this TagResolver is not a TagResolver.empty()
* @return false if the TagResolver is the same as TagResolver.empty(), else true
* @since 1.4.0
* @see TagResolver.empty
*/
public fun TagResolver.isNotEmpty(): Boolean = this != TagResolver.empty()
/**
* Applies a TagResolver to a TagResolver.Builder in case it is not a TagResolver.empty()
* @param resolver the resolver to check
* @since 1.4.0
* @see TagResolver.isNotEmpty
*/
public fun TagResolver.Builder.applyIfNotEmpty(resolver: TagResolver) {
if (resolver.isNotEmpty()) {
resolver(resolver)
}
}
+27
View File
@@ -0,0 +1,27 @@
plugins {
kotlin("jvm")
kotlin("kapt")
alias(libs.plugins.shadow)
}
repositories {
maven("https://repo.kryptonmc.org/releases")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://repo.kryptonmc.org/snapshots")
}
dependencies {
compileOnly(libs.krypton.server)
compileOnly(kotlin("stdlib"))
kapt(libs.krypton.annotation)
implementation(projects.miniplaceholdersCommon)
implementation(projects.miniplaceholdersApi)
implementation(projects.miniplaceholdersConnect)
implementation(projects.miniplaceholdersKotlinExt)
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
@@ -0,0 +1,85 @@
package io.github.miniplaceholders.krypton
import com.google.inject.Inject
import io.github.miniplaceholders.api.utils.TagsUtils
import io.github.miniplaceholders.common.PlaceholdersCommand
import io.github.miniplaceholders.common.PlaceholdersPlugin
import io.github.miniplaceholders.common.PluginConstants
import io.github.miniplaceholders.connect.InternalPlatform
import io.github.miniplaceholders.kotlin.asClosingTag
import io.github.miniplaceholders.kotlin.expansion
import net.kyori.adventure.text.Component
import org.apache.logging.log4j.Logger
import org.kryptonmc.api.command.BrigadierCommand
import org.kryptonmc.api.command.CommandExecutionContext
import org.kryptonmc.api.event.Listener
import org.kryptonmc.api.event.server.ServerStartEvent
import org.kryptonmc.api.plugin.annotation.Plugin
import org.kryptonmc.krypton.KryptonServer
import org.kryptonmc.krypton.command.KryptonCommandMeta
@Plugin(
name = "MiniPlaceholders",
id = "miniplaceholders",
version = PluginConstants.VERSION,
authors = ["4drian3d"]
)
class KotlinKryptonPlugin @Inject constructor(
private val server: KryptonServer,
private val logger: Logger
) : PlaceholdersPlugin {
init {
InternalPlatform.platform(InternalPlatform.KRYPTON)
}
@Listener
@Suppress("UNUSED")
fun onServerStart(event: ServerStartEvent) {
logger.info("Starting MiniPlaceholders Krypton")
this.loadDefaultExpansions()
this.registerPlatformCommand()
}
override fun loadDefaultExpansions() {
expansion("server") {
globalPlaceholder("total_entities") { _, _ ->
var entityCount = 0
for ((_, value) in server.worldManager.worlds) {
entityCount += value.entities.size
}
Component.text(entityCount).asClosingTag()
}
globalPlaceholder("total_chunks") { _, _ ->
var chunkCount = 0
for ((_, value) in server.worldManager.worlds) {
chunkCount += value.chunks.size
}
Component.text(chunkCount).asClosingTag()
}
globalPlaceholder("name", TagsUtils.staticTag(server.platform.name))
globalPlaceholder("online") { queue, _ ->
if (queue.hasNext()) {
val worldName = queue.pop().value()
val players = server.players.filter { it.world.name == worldName }
return@globalPlaceholder Component.text(players.joinToString(", ")).asClosingTag()
}
Component.text(server.players.size).asClosingTag()
}
globalPlaceholder("version", TagsUtils.staticTag(server.platform.version))
globalPlaceholder("max_players", Component.text(server.config.maxPlayers).asClosingTag())
}.register()
}
override fun registerPlatformCommand() {
/*val command = PlaceholdersCommand.builder<CommandExecutionContext>()
.fromSourceToAudience { it.sender }
.playerSuggestions { server.players.map { it.name } }
.toAudience { server.getPlayer(it) }
.build()
val brigadierCMD = BrigadierCommand.of(command.asNode("miniplaceholders"))
val meta = KryptonCommandMeta.Builder("miniplaceholders").build()
server.commandManager.register(brigadierCMD, meta)*/
}
}
+14 -29
View File
@@ -1,40 +1,25 @@
plugins {
id("net.minecrell.plugin-yml.bukkit") version "0.5.2"
id("io.papermc.paperweight.userdev") version "1.3.8"
id("xyz.jpenilla.run-paper") version "1.0.6"
id("miniplaceholders.auto.module")
id("miniplaceholders.shadow")
alias(libs.plugins.runpaper)
}
dependencies {
compileOnly(project(":miniplaceholders-common"))
compileOnly(project(":miniplaceholders-api"))
compileOnly(project(":miniplaceholders-connect"))
paperDevBundle("1.19.1-R0.1-SNAPSHOT")
compileOnly(libs.paper)
implementation(projects.miniplaceholdersCommon)
implementation(projects.miniplaceholdersApi)
implementation(projects.miniplaceholdersConnect)
implementation(libs.cloud.paper)
}
val pluginVersion: String = version as String
bukkit {
name = "MiniPlaceholders"
main = "me.dreamerzero.miniplaceholders.paper.PaperPlugin"
apiVersion = "1.18"
website = "https://github.com/4drian3d/MiniPlaceholders"
authors = listOf("4drian3d")
version = pluginVersion
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
tasks {
assemble {
dependsOn(reobfJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
runServer {
minecraftVersion("1.19.1")
minecraftVersion("1.20.2")
}
processResources {
filesMatching("paper-plugin.yml") {
expand("version" to project.version)
}
}
}
@@ -1,38 +1,42 @@
package me.dreamerzero.miniplaceholders.paper;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
package io.github.miniplaceholders.paper;
import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator;
import cloud.commandframework.paper.PaperCommandManager;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.TagsUtils;
import io.github.miniplaceholders.common.PlaceholdersCommand;
import io.github.miniplaceholders.common.PlaceholdersPlugin;
import io.github.miniplaceholders.connect.InternalPlatform;
import io.papermc.paper.datapack.Datapack;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.utils.TagsUtils;
import me.dreamerzero.miniplaceholders.common.PlaceholdersCommand;
import me.dreamerzero.miniplaceholders.common.PlaceholdersPlugin;
import me.dreamerzero.miniplaceholders.connect.InternalPlatform;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
import org.bukkit.plugin.java.JavaPlugin;
public final class PaperPlugin extends JavaPlugin implements PlaceholdersPlugin, Listener {
private final DecimalFormat tpsFormat = new DecimalFormat("###.##");
private final DecimalFormat msptFormat = new DecimalFormat("###.###");
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.function.Function;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public final class PaperPlugin extends JavaPlugin implements PlaceholdersPlugin {
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("###.##");
private static final DecimalFormat MSPT_FORMAT = new DecimalFormat("###.###");
static {
InternalPlatform.platform(InternalPlatform.PAPER);
TPS_FORMAT.setRoundingMode(RoundingMode.HALF_UP);
MSPT_FORMAT.setRoundingMode(RoundingMode.HALF_UP);
}
@Override
public void onEnable(){
this.getSLF4JLogger().info("Starting MiniPlaceholders Paper");
InternalPlatform.platform(InternalPlatform.PAPER);
this.getServer().getPluginManager().registerEvents(this, this);
tpsFormat.setRoundingMode(RoundingMode.HALF_UP);
msptFormat.setRoundingMode(RoundingMode.HALF_UP);
this.loadDefaultExpansions();
this.registerPlatformCommand();
}
@@ -45,28 +49,28 @@ public final class PaperPlugin extends JavaPlugin implements PlaceholdersPlugin,
.globalPlaceholder("version", TagsUtils.staticTag(this.getServer().getVersion()))
.globalPlaceholder("max_players", (queue, ctx) -> TagsUtils.staticTag(Component.text(this.getServer().getMaxPlayers())))
.globalPlaceholder("unique_joins", (queue, ctx) -> TagsUtils.staticTag(Component.text(this.getServer().getOfflinePlayers().length)))
.globalPlaceholder("tps_1", (queue, ctx) -> TagsUtils.staticTag(tpsFormat.format(this.getServer().getTPS()[0])))
.globalPlaceholder("tps_5", (queue, ctx) -> TagsUtils.staticTag(tpsFormat.format(this.getServer().getTPS()[1])))
.globalPlaceholder("tps_15", (queue, ctx) -> TagsUtils.staticTag(tpsFormat.format(this.getServer().getTPS()[2])))
.globalPlaceholder("tps_1", (queue, ctx) -> TagsUtils.staticTag(TPS_FORMAT.format(this.getServer().getTPS()[0])))
.globalPlaceholder("tps_5", (queue, ctx) -> TagsUtils.staticTag(TPS_FORMAT.format(this.getServer().getTPS()[1])))
.globalPlaceholder("tps_15", (queue, ctx) -> TagsUtils.staticTag(TPS_FORMAT.format(this.getServer().getTPS()[2])))
.globalPlaceholder("has_whitelist", (queue, ctx) -> TagsUtils.staticTag(Component.text(this.getServer().hasWhitelist())))
.globalPlaceholder("total_chunks", (queue, ctx) -> {
int chunkCount = 0;
for(World world : this.getServer().getWorlds()){
for (World world : this.getServer().getWorlds()){
chunkCount += world.getLoadedChunks().length;
}
return TagsUtils.staticTag(Component.text(chunkCount));
})
.globalPlaceholder("total_entities", (queue, ctx) -> {
int entityCount = 0;
for(World world : this.getServer().getWorlds()){
for (World world : this.getServer().getWorlds()){
entityCount += world.getEntityCount();
}
return TagsUtils.staticTag(Component.text(entityCount));
})
.globalPlaceholder("mspt", (queue, ctx) -> TagsUtils.staticTag(msptFormat.format(this.getServer().getAverageTickTime())))
.globalPlaceholder("mspt", (queue, ctx) -> TagsUtils.staticTag(MSPT_FORMAT.format(this.getServer().getAverageTickTime())))
.globalPlaceholder("datapack_list", (queue, ctx) -> {
TextComponent.Builder builder = Component.text();
for(Datapack datapack : this.getServer().getDatapackManager().getEnabledPacks()){
final TextComponent.Builder builder = Component.text();
for (Datapack datapack : this.getServer().getDatapackManager().getEnabledPacks()){
builder.append(Component.text("[").append(Component.text(datapack.getName()).append(Component.text("] "))));
}
return Tag.selfClosingInserting(builder.build());
@@ -77,16 +81,30 @@ public final class PaperPlugin extends JavaPlugin implements PlaceholdersPlugin,
}
@Override
@SuppressWarnings({"sonarlint(java:s1874)", "deprecation", /*TODO: replace with Java(536871800) */ "all"})
@SuppressWarnings({"sonarlint(java:s1874)"})
public void registerPlatformCommand() {
MinecraftServer.getServer()
.vanillaCommandDispatcher
.getDispatcher()
.register(new PlaceholdersCommand<>(
() -> this.getServer().getOnlinePlayers().stream().map(Player::getName).toList(),
(String st) -> this.getServer().getPlayer(st),
CommandSourceStack::getBukkitSender
).placeholderTestBuilder("miniplaceholders")
try {
PaperCommandManager<CommandSender> commandManager = new PaperCommandManager<>(
this,
AsynchronousCommandExecutionCoordinator.simpleCoordinator(),
Function.identity(),
Function.identity()
);
commandManager.registerBrigadier();
PlaceholdersCommand.<CommandSender>builder()
.playerSuggestions(() -> getServer().getOnlinePlayers()
.stream()
.map(Player::getName)
.collect(Collectors.toCollection(ArrayList::new)))
.toAudience(st -> getServer().getPlayer(st))
.hasPermissionCheck(Permissible::hasPermission)
.manager(commandManager)
.command("miniplaceholders")
.build()
.register();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@@ -0,0 +1,6 @@
name: MiniPlaceholders
version: '${version}'
main: io.github.miniplaceholders.paper.PaperPlugin
description: MiniMessage Component-based Placeholders for PaperMC, Krypton and Velocity platforms
api-version: '1.19'
folia-supported: true
+7
View File
@@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"ignoreDeps": ["krypton", "krypton-api", "krypton-annotation-processor", "krypton-server"]
}
+44 -9
View File
@@ -1,16 +1,51 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://papermc.io/repo/repository/maven-public/")
}
}
@file:Suppress("UnstableApiUsage")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "miniplaceholders-parent"
val modules = listOf("connect", "api", "common", "paper", "velocity")
pluginManagement {
includeBuild("build-logic")
repositories {
gradlePluginPortal()
mavenCentral()
maven("https://maven.fabricmc.net/")
maven("https://maven.quiltmc.org/repository/release/")
}
}
modules.forEach {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.maven.apache.org/maven2/")
maven("https://jitpack.io") {
mavenContent {
includeGroup("net.william278")
}
}
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://repo.jpenilla.xyz/snapshots/")
}
}
plugins {
id("fabric-loom") version "1.4.4"
id("org.spongepowered.gradle.plugin") version "2.2.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
arrayOf(
"connect",
"api",
"kotlin-ext",
"common",
"paper",
"velocity",
//"krypton",
"fabric",
"sponge"
).forEach {
include("miniplaceholders-$it")
project(":miniplaceholders-$it").projectDir = file(it)
}
+2
View File
@@ -0,0 +1,2 @@
# run-paper files
/run
+47
View File
@@ -0,0 +1,47 @@
import org.spongepowered.gradle.plugin.config.PluginLoaders
import org.spongepowered.plugin.metadata.model.PluginDependency
plugins {
id("miniplaceholders.auto.module")
id("miniplaceholders.shadow")
id("org.spongepowered.gradle.plugin")
}
dependencies {
implementation(projects.miniplaceholdersCommon)
implementation(projects.miniplaceholdersApi)
implementation(projects.miniplaceholdersConnect)
implementation(libs.cloud.sponge)
}
sponge {
apiVersion("8.1.0")
license("GPL-3")
loader {
name(PluginLoaders.JAVA_PLAIN)
version("1.0")
}
plugin("miniplaceholders") {
displayName("MiniPlaceholders")
entrypoint("io.github.miniplaceholders.sponge.SpongePlugin")
description(project.description)
links {
homepage("https://github.com/MiniPlaceholders/MiniPlaceholders")
source("https://github.com/MiniPlaceholders/MiniPlaceholders")
issues("https://github.com/MiniPlaceholders/MiniPlaceholders/issues")
}
contributor("4drian3d") {
description("Lead Developer")
}
dependency("spongeapi") {
loadOrder(PluginDependency.LoadOrder.AFTER)
optional(false)
}
}
}
tasks {
shadowJar {
exclude("io/leangen/geantyref/**")
}
}
@@ -0,0 +1,116 @@
package io.github.miniplaceholders.sponge;
import cloud.commandframework.execution.CommandExecutionCoordinator;
import cloud.commandframework.sponge.SpongeCommandManager;
import com.google.inject.Inject;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.TagsUtils;
import io.github.miniplaceholders.common.PlaceholdersCommand;
import io.github.miniplaceholders.common.PlaceholdersPlugin;
import io.github.miniplaceholders.connect.InternalPlatform;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience;
import net.kyori.adventure.text.Component;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.api.Server;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.command.CommandCause;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.lifecycle.RegisterCommandEvent;
import org.spongepowered.api.event.lifecycle.StartingEngineEvent;
import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.plugin.PluginContainer;
import org.spongepowered.plugin.builtin.jvm.Plugin;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Plugin("miniplaceholders")
public class SpongePlugin implements PlaceholdersPlugin {
@Inject
private PluginContainer pluginContainer;
@Inject
private Logger logger;
private Server server;
@Listener
public void onServerStart(final StartingEngineEvent<Server> event) {
this.server = event.engine();
logger.info("Starting MiniPlaceholders Sponge");
InternalPlatform.platform(InternalPlatform.SPONGE);
this.loadDefaultExpansions();
}
private final AtomicInteger registration = new AtomicInteger(0);
@Listener
public void onCommandRegister(final RegisterCommandEvent<Command.Parameterized> event) {
if (registration.getAndIncrement() == 0) {
this.registerPlatformCommand();
}
}
@Override
public void loadDefaultExpansions() {
Expansion.builder("server")
.globalPlaceholder("name", TagsUtils.staticTag("Sponge"))
.globalPlaceholder("online", (queue, ctx) -> TagsUtils.staticTag(Component.text(server.onlinePlayers().size())))
.globalPlaceholder("max_players", (queue, ctx) -> TagsUtils.staticTag(Component.text(server.maxPlayers())))
.globalPlaceholder("unique_joins", (queue, ctx) -> TagsUtils.staticTag(Component.text(server.userManager().streamAll().count())))
.globalPlaceholder("has_whitelist", (queue, ctx) -> TagsUtils.staticTag(Component.text(server.isWhitelistEnabled())))
.globalPlaceholder("total_chunks", (queue, ctx) -> {
int chunkCount = 0;
for (ServerWorld world : server.worldManager().worlds()){
chunkCount += world.entities().size();
}
return TagsUtils.staticTag(Component.text(chunkCount));
})
.globalPlaceholder("total_entities", (queue, ctx) -> {
int entityCount = 0;
for (ServerWorld world : server.worldManager().worlds()){
entityCount += world.entities().size();
}
return TagsUtils.staticTag(Component.text(entityCount));
})
.globalPlaceholder("mspt", (queue, ctx) -> TagsUtils.staticTag(Component.text(server.averageTickTime())))
.build()
.register();
}
@Override
public void registerPlatformCommand() {
final SpongeCommandManager<AudienceHolder> commandManager = new SpongeCommandManager<>(
pluginContainer,
CommandExecutionCoordinator.simpleCoordinator(),
AudienceHolder::cause,
AudienceHolder::new
);
PlaceholdersCommand.<AudienceHolder>builder()
.manager(commandManager)
.command("miniplaceholders")
.playerSuggestions(() -> server.onlinePlayers()
.stream()
.map(ServerPlayer::name)
.collect(Collectors.toCollection(ArrayList::new)))
.toAudience(st -> server.player(st).orElse(null))
.hasPermissionCheck((holder, permission) -> holder.cause.hasPermission(permission))
.build()
.register();
}
record AudienceHolder(@NotNull CommandCause cause) implements ForwardingAudience.Single {
@Override
public @NotNull Audience audience() {
return cause.audience();
}
}
}
+2
View File
@@ -0,0 +1,2 @@
#run velocity files
/run
+17 -12
View File
@@ -1,15 +1,20 @@
dependencies {
compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
compileOnly(project(":miniplaceholders-common"))
compileOnly(project(":miniplaceholders-api"))
compileOnly(project(":miniplaceholders-connect"))
plugins {
id("miniplaceholders.shadow")
id("miniplaceholders.auto.module")
alias(libs.plugins.runvelocity)
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
dependencies {
compileOnly(libs.velocity)
annotationProcessor(libs.velocity)
implementation(projects.miniplaceholdersCommon)
implementation(projects.miniplaceholdersApi)
implementation(projects.miniplaceholdersConnect)
implementation(libs.cloud.velocity)
}
tasks.compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
tasks {
runVelocity {
velocityVersion(libs.versions.velocity.get())
}
}
@@ -0,0 +1,102 @@
package io.github.miniplaceholders.velocity;
import cloud.commandframework.execution.CommandExecutionCoordinator;
import cloud.commandframework.velocity.CloudInjectionModule;
import cloud.commandframework.velocity.VelocityCommandManager;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.Components;
import io.github.miniplaceholders.api.utils.TagsUtils;
import io.github.miniplaceholders.common.PlaceholdersCommand;
import io.github.miniplaceholders.common.PlaceholdersPlugin;
import io.github.miniplaceholders.common.PluginConstants;
import io.github.miniplaceholders.connect.InternalPlatform;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.function.Function;
import java.util.stream.Collectors;
@Plugin(
name = "MiniPlaceholders",
id = "miniplaceholders",
version = PluginConstants.VERSION,
authors = {"4drian3d"}
)
public final class VelocityPlugin implements PlaceholdersPlugin {
private final Logger logger;
private final ProxyServer proxy;
@Inject
private Injector injector;
@Inject
public VelocityPlugin(final Logger logger, final ProxyServer proxy) {
this.logger = logger;
this.proxy = proxy;
}
@Subscribe
public void onProxyInitialize(final ProxyInitializeEvent event) {
logger.info("Starting MiniPlaceholders Velocity");
InternalPlatform.platform(InternalPlatform.VELOCITY);
this.loadDefaultExpansions();
this.registerPlatformCommand();
}
@Override
public void loadDefaultExpansions() {
Expansion.builder("proxy")
.globalPlaceholder("online_players", (queue, ctx) -> {
if (queue.hasNext()) {
String server = queue.pop().value();
return Tag.selfClosingInserting(Component.text(proxy.getServer(server).map(sv -> sv.getPlayersConnected().size()).orElse(0)));
}
return Tag.selfClosingInserting(Component.text(proxy.getPlayerCount()));
})
.globalPlaceholder("server_count", (queue, ctx) -> Tag.selfClosingInserting(Component.text(proxy.getAllServers().size())))
.globalPlaceholder("is_player_online", (queue, ctx) -> {
String playerName = queue.popOr(() -> "you need to introduce an argument").value();
return TagsUtils.staticTag(proxy.getPlayer(playerName).isPresent() ? Components.YES_COMPONENT : Components.NO_COMPONENT);
})
.globalPlaceholder("version", TagsUtils.staticTag(proxy.getVersion().getVersion()))
.build()
.register();
}
@Override
public void registerPlatformCommand() {
injector = injector.createChildInjector(
new CloudInjectionModule<>(
CommandSource.class,
CommandExecutionCoordinator.simpleCoordinator(),
Function.identity(),
Function.identity()
)
);
final VelocityCommandManager<CommandSource> commandManager = injector.getInstance(
Key.get(new TypeLiteral<>() {})
);
PlaceholdersCommand.<CommandSource>builder()
.playerSuggestions(() -> proxy.getAllPlayers()
.stream()
.map(Player::getUsername)
.collect(Collectors.toCollection(ArrayList::new)))
.toAudience(st -> proxy.getPlayer(st).orElse(null))
.command("vminiplaceholders")
.manager(commandManager)
.build().register();
}
}
@@ -1,79 +0,0 @@
package me.dreamerzero.miniplaceholders.velocity;
import com.google.inject.Inject;
import com.velocitypowered.api.command.BrigadierCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import org.slf4j.Logger;
import me.dreamerzero.miniplaceholders.api.Expansion;
import me.dreamerzero.miniplaceholders.api.utils.Components;
import me.dreamerzero.miniplaceholders.api.utils.TagsUtils;
import me.dreamerzero.miniplaceholders.common.PlaceholdersCommand;
import me.dreamerzero.miniplaceholders.common.PlaceholdersPlugin;
import me.dreamerzero.miniplaceholders.common.PluginConstants;
import me.dreamerzero.miniplaceholders.connect.InternalPlatform;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag;
@Plugin(
name = "MiniPlaceholders",
id = "miniplaceholders",
version = PluginConstants.VERSION,
authors = {"4drian3d"}
)
public final class VelocityPlugin implements PlaceholdersPlugin {
private final Logger logger;
private final ProxyServer proxy;
@Inject
public VelocityPlugin(final Logger logger, final ProxyServer proxy) {
this.logger = logger;
this.proxy = proxy;
}
@Subscribe
public void onProxyInitialize(final ProxyInitializeEvent event) {
logger.info("Starting MiniPlaceholders Velocity");
InternalPlatform.platform(InternalPlatform.VELOCITY);
this.loadDefaultExpansions();
this.registerPlatformCommand();
}
@Override
public void loadDefaultExpansions() {
Expansion.builder("proxy")
.globalPlaceholder("online_players", (queue, ctx) -> {
if(queue.hasNext()){
String server = queue.pop().value();
return Tag.selfClosingInserting(Component.text(proxy.getServer(server).map(sv -> sv.getPlayersConnected().size()).orElse(0)));
}
return Tag.selfClosingInserting(Component.text(proxy.getPlayerCount()));
})
.globalPlaceholder("server_count", (queue, ctx) -> Tag.selfClosingInserting(Component.text(proxy.getAllServers().size())))
.globalPlaceholder("is_player_online", (queue, ctx) -> {
String playerName = queue.popOr(() -> "you need to introduce an argument").value();
return TagsUtils.staticTag(proxy.getPlayer(playerName).isPresent() ? Components.YES_COMPONENT : Components.NO_COMPONENT);
})
.globalPlaceholder("version", TagsUtils.staticTag(proxy.getVersion().getVersion()))
.build()
.register();
}
@Override
public void registerPlatformCommand() {
final BrigadierCommand brigadierCMD = new BrigadierCommand(
new PlaceholdersCommand<CommandSource>(
() -> proxy.getAllPlayers().stream().map(Player::getUsername).toList(),
(String st) -> proxy.getPlayer(st).orElse(null))
.placeholderTestCommand("vminiplaceholders"));
proxy.getCommandManager().register(brigadierCMD);
}
}