mirror of
https://github.com/MiniPlaceholders/MiniPlaceholders.git
synced 2026-11-05 01:00:06 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a2ba24f3d | ||
|
|
38592abaa3 | ||
|
|
2628ef6279 | ||
|
|
6bf9c23e09 | ||
|
|
e99ae1a6fd | ||
|
|
e552a0e90d | ||
|
|
7146b1d348 | ||
|
|
e91b6796cb | ||
|
|
6e528c5d6b | ||
|
|
9c029ab519 | ||
|
|
114b38ba5b | ||
|
|
288a5ae5e0 | ||
|
|
ae720f3dce | ||
|
|
57df8615dc | ||
|
|
b00e37131d | ||
|
|
34c2330af8 | ||
|
|
6bc35b3e16 | ||
|
|
1eea547f7a | ||
|
|
68f8ce504c | ||
|
|
007b10e0c3 | ||
|
|
4c556c4925 | ||
|
|
39b20b1827 | ||
|
|
8206b99d00 | ||
|
|
35b3c31341 | ||
|
|
075cca14b0 | ||
|
|
4fb84b3ddc | ||
|
|
f9df6ddd1a | ||
|
|
6557d0c99d | ||
|
|
fbaada216a | ||
|
|
c97f2c2dc5 | ||
|
|
97f6561724 | ||
|
|
98835a90b2 | ||
|
|
a03ee83d54 | ||
|
|
7433aa0394 | ||
|
|
c392a112e5 | ||
|
|
4d8673aeeb | ||
|
|
b60ea1a9a9 | ||
|
|
ecfee088cd | ||
|
|
39b0e12c49 | ||
|
|
8c4158eee8 | ||
|
|
f425afc2bb | ||
|
|
373fc7f757 | ||
|
|
05619a4939 | ||
|
|
968c930060 | ||
|
|
b1bc70bba7 | ||
|
|
5c412ba2ff | ||
|
|
366f9b43a6 | ||
|
|
e699e48ae3 | ||
|
|
bc018cfb2d | ||
|
|
1c299e6595 | ||
|
|
510ca51111 | ||
|
|
a466dbd378 | ||
|
|
029b528669 | ||
|
|
a3f371105e | ||
|
|
f6fae9b54b | ||
|
|
5828f8d1ff | ||
|
|
88a27c40e6 | ||
|
|
34a33a0f44 | ||
|
|
c27bf3a907 | ||
|
|
7b332154bc | ||
|
|
132c1f8fac | ||
|
|
009873b5e9 | ||
|
|
0d27f10575 | ||
|
|
519d131a16 | ||
|
|
5e9da46f8c | ||
|
|
207a4e8db3 | ||
|
|
ad17ce84bd | ||
|
|
4aa9524cfd | ||
|
|
097203729f | ||
|
|
13cc13539d | ||
|
|
53bc542588 | ||
|
|
5f20e679c6 | ||
|
|
7fe01d729c | ||
|
|
42976b576a | ||
|
|
f50d95aa07 | ||
|
|
961f8d33ff | ||
|
|
2c1b24c586 | ||
|
|
c29774fb78 | ||
|
|
6524d599f2 | ||
|
|
dab817a653 | ||
|
|
06c908a2cc | ||
|
|
21a67c2d85 | ||
|
|
e7974dfbca | ||
|
|
bd80c435c0 | ||
|
|
c85e2cd1ac | ||
|
|
dbf167412d | ||
|
|
d17883962e | ||
|
|
f41e1e672a | ||
|
|
31355fa183 | ||
|
|
30ce81cf67 | ||
|
|
aeaa712d8c | ||
|
|
061d483f20 | ||
|
|
408c225b5d | ||
|
|
562e42c220 | ||
|
|
2e36e96d7f | ||
|
|
98ee83e714 | ||
|
|
34d33b2b81 | ||
|
|
882723c155 | ||
|
|
80fa0c07d0 | ||
|
|
fbc48c4c5c | ||
|
|
095228cce8 | ||
|
|
775d62233c | ||
|
|
67cb025d0f | ||
|
|
e296bf8a90 | ||
|
|
9f9950de70 | ||
|
|
ffe0e0f5d8 | ||
|
|
b5063d9a02 | ||
|
|
e0e0b4fe3e | ||
|
|
eeb756d1fc | ||
|
|
4c173ae8ee | ||
|
|
0dc6d85cdb | ||
|
|
944fef34f6 | ||
|
|
0c7e327323 | ||
|
|
17aef8b922 | ||
|
|
94baa536a4 | ||
|
|
f7a59f1279 | ||
|
|
9b314854a2 | ||
|
|
1579b264a8 | ||
|
|
17cc2016fe | ||
|
|
ea3a80a0bd | ||
|
|
2dee5f0d66 | ||
|
|
4efed28253 | ||
|
|
45b1a0da5d | ||
|
|
c4002e0a3d | ||
|
|
eb4fba66eb | ||
|
|
9dd473092a | ||
|
|
9139d2260f |
No files matched your search
@@ -8,24 +8,24 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up JDK 21
|
||||
- name: Set up JDK 25
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: 21
|
||||
distribution: 'temurin'
|
||||
java-version: 25
|
||||
distribution: 'zulu'
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Build with Gradle
|
||||
uses: nick-invision/retry@v3
|
||||
uses: nick-invision/retry@v4
|
||||
with:
|
||||
timeout_minutes: 10
|
||||
max_attempts: 2
|
||||
command: gradle build
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: MiniPlaceholders
|
||||
path: jar/MiniPlaceholders-*.jar
|
||||
@@ -2,6 +2,22 @@
|
||||
MiniPlaceholders Changelog
|
||||
-->
|
||||
|
||||
## 3.2.0 (unreleased)
|
||||
|
||||
### Features
|
||||
|
||||
- Added support to Fabric 26.1+
|
||||
- Added Minestom support
|
||||
|
||||
|
||||
### Fixes
|
||||
|
||||
|
||||
|
||||
### API Additions
|
||||
|
||||
|
||||
|
||||
## 3.1.0 (10/10/2025)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -12,9 +12,10 @@ MiniMessage Component-based Placeholders API for Minecraft Platforms.
|
||||
|
||||
## Compatibility
|
||||
- Paper 1.21+
|
||||
- Velocity 3.4+
|
||||
- Fabric 1.21.6+
|
||||
- Velocity 3.5+
|
||||
- Fabric 26.1+
|
||||
- Sponge API 12+
|
||||
- Minestom 1.21.11+
|
||||
|
||||
## User Usage
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ tasks {
|
||||
o.links(
|
||||
"https://jd.advntr.dev/api/${libs.versions.adventure.get()}/",
|
||||
"https://jd.advntr.dev/text-minimessage/${libs.versions.adventure.get()}/",
|
||||
"https://javadoc.io/doc/org.jspecify/jspecify/latest/index.html"
|
||||
"https://javadoc.io/doc/org.jspecify/jspecify/latest/"
|
||||
)
|
||||
o.tags(
|
||||
"apiNote:a:API Note:",
|
||||
|
||||
@@ -45,6 +45,7 @@ public final class MiniPlaceholders {
|
||||
case VELOCITY -> Platform.VELOCITY;
|
||||
case FABRIC -> Platform.FABRIC;
|
||||
case SPONGE -> Platform.SPONGE;
|
||||
case MINESTOM -> Platform.MINESTOM;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -29,5 +29,11 @@ public enum Platform {
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
SPONGE
|
||||
SPONGE,
|
||||
/**
|
||||
* Minestom Platform
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
MINESTOM,
|
||||
}
|
||||
@@ -14,6 +14,6 @@ repositories {
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
languageVersion = JavaLanguageVersion.of(25)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import java.util.Date
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
java
|
||||
@@ -7,7 +7,7 @@ plugins {
|
||||
tasks {
|
||||
compileJava {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(21)
|
||||
options.release.set(25)
|
||||
}
|
||||
jar {
|
||||
manifest {
|
||||
@@ -22,7 +22,7 @@ tasks {
|
||||
|
||||
java{
|
||||
toolchain{
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
languageVersion.set(JavaLanguageVersion.of(25))
|
||||
vendor.set(JvmVendorSpec.AZUL)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.2.20" apply false
|
||||
kotlin("jvm") version "2.3.20" apply false
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public final class CommandConstants {
|
||||
)
|
||||
.append(newline(), miniMessage().deserialize(
|
||||
"<gradient:aqua:#94d1ff>" + command + "</gradient> <aqua>expansions</aqua>")
|
||||
.clickEvent(ClickEvent.runCommand(command + " help"))
|
||||
.clickEvent(ClickEvent.runCommand(command + " expansions"))
|
||||
)
|
||||
.append(newline(), FOOTER)
|
||||
.build();
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.github.miniplaceholders.connect;
|
||||
public enum InternalPlatform {
|
||||
|
||||
PAPER, VELOCITY,
|
||||
FABRIC, SPONGE;
|
||||
FABRIC, SPONGE, MINESTOM;
|
||||
|
||||
private static InternalPlatform actualPlatform;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ plugins {
|
||||
alias(libs.plugins.blossom)
|
||||
}
|
||||
|
||||
version = "1.3.5"
|
||||
version = "1.4.0"
|
||||
|
||||
dependencies {
|
||||
compileOnly(projects.miniplaceholdersApi)
|
||||
|
||||
+18
@@ -25,6 +25,24 @@ public record ExampleProvider(PlatformData platformData) implements ExpansionPro
|
||||
platformData.serverInstance(),
|
||||
platformData.complementInstance()
|
||||
)))
|
||||
.audiencePlaceholder("audience", (audience, queue, ctx) -> Tag.preProcessParsed("""
|
||||
Audience Instance Class: %s
|
||||
MiniPlaceholders Instance Class: %s
|
||||
""".formatted(
|
||||
audience,
|
||||
platformData.complementInstance()
|
||||
)))
|
||||
.relationalPlaceholder("test", (audience, relational, queue, ctx) -> Tag.preProcessParsed("""
|
||||
Audience Instance Class: %s
|
||||
Relational Instance Class: %s
|
||||
Is Audience equals Relational? %s
|
||||
MiniPlaceholders Instance Class: %s
|
||||
""".formatted(
|
||||
audience,
|
||||
relational,
|
||||
audience.equals(relational),
|
||||
platformData.complementInstance()
|
||||
)))
|
||||
.version(ExpansionConstants.VERSION)
|
||||
.build();
|
||||
}
|
||||
|
||||
+18
-14
@@ -3,25 +3,33 @@ import java.nio.file.StandardCopyOption
|
||||
import kotlin.io.path.deleteIfExists
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.fabric.loom)
|
||||
id("miniplaceholders.auto.module")
|
||||
id("quiet-fabric-loom")
|
||||
alias(libs.plugins.shadow)
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://central.sonatype.com/repository/maven-snapshots/") {
|
||||
name = "sonatype-snapshots"
|
||||
mavenContent {
|
||||
snapshotsOnly()
|
||||
}
|
||||
}
|
||||
maven("https://jitpack.io")
|
||||
}
|
||||
|
||||
val shade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
minecraft(libs.minecraft)
|
||||
mappings(loom.officialMojangMappings())
|
||||
modImplementation(libs.fabric.loader)
|
||||
modImplementation(libs.fabric.api)
|
||||
compileOnly(libs.fabric.loader)
|
||||
compileOnly(libs.fabric.api)
|
||||
|
||||
includeDependency(libs.adventure.platform.fabric)
|
||||
includeDependency(libs.adventure.serializer.legacy)
|
||||
includeDependency(libs.adventure.minimessage)
|
||||
includeDependency(libs.luckopermissionsapi)
|
||||
includeDependency(libs.desertwell)
|
||||
includeDependency(libs.unnamedinject)
|
||||
includeDependency(libs.desertwell)
|
||||
|
||||
shadeModule(projects.miniplaceholdersApi)
|
||||
shadeModule(projects.miniplaceholdersCommon)
|
||||
@@ -29,16 +37,16 @@ dependencies {
|
||||
}
|
||||
|
||||
fun DependencyHandlerScope.shadeModule(module: ProjectDependency) {
|
||||
shade(module) {
|
||||
implementation(module) {
|
||||
isTransitive = false
|
||||
}
|
||||
implementation(module) {
|
||||
include(module) {
|
||||
isTransitive = false
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandlerScope.includeDependency(dependency: Any) {
|
||||
modImplementation(dependency)
|
||||
implementation(dependency)
|
||||
include(dependency)
|
||||
}
|
||||
|
||||
@@ -51,14 +59,10 @@ tasks {
|
||||
expand("version" to projectVersion)
|
||||
}
|
||||
}
|
||||
remapJar {
|
||||
inputFile.set(shadowJar.get().archiveFile)
|
||||
jar {
|
||||
archiveFileName.set("MiniPlaceholders-Fabric-${projectVersion}.jar")
|
||||
destinationDirectory.set(file("${rootDir}/jar"))
|
||||
}
|
||||
shadowJar {
|
||||
configurations = listOf(shade)
|
||||
}
|
||||
// I know it's exactly the same logic for all modules,
|
||||
// but for some reason in this module it only works
|
||||
// if it's declared in the same project configuration
|
||||
|
||||
@@ -54,7 +54,9 @@ public final class FabricMod implements DedicatedServerModInitializer, Placehold
|
||||
return switch (Permissions.getPermissionValue(commandSourceStack, permission)) {
|
||||
case TRUE -> TriState.TRUE;
|
||||
case FALSE -> TriState.FALSE;
|
||||
case DEFAULT -> commandSourceStack.hasPermission(3) ? TriState.TRUE : TriState.NOT_SET;
|
||||
case DEFAULT -> commandSourceStack.permissions()
|
||||
.hasPermission(net.minecraft.server.permissions.Permissions.COMMANDS_GAMEMASTER)
|
||||
? TriState.TRUE : TriState.NOT_SET;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.19",
|
||||
"fabric": "*",
|
||||
"java": ">=21",
|
||||
"adventure-platform-fabric": "~6.6.0",
|
||||
"minecraft": ">=1.21.6 <=1.21.8",
|
||||
"fabric-permissions-api-v0": "~0.4.1"
|
||||
"fabricloader": ">=0.18.0",
|
||||
"fabric-api": "*",
|
||||
"java": ">=25",
|
||||
"adventure-platform-fabric": ">6.8.0",
|
||||
"minecraft": ">=26.1",
|
||||
"fabric-permissions-api-v0": ">=0.7.0"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
group = io.github.miniplaceholders
|
||||
version = 3.1.0
|
||||
version = 3.2.0
|
||||
description = MiniMessage Component-based Placeholders API
|
||||
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
+38
-29
@@ -2,55 +2,60 @@ metadata.format.version = "1.1"
|
||||
|
||||
[versions]
|
||||
|
||||
velocity = "3.4.0-SNAPSHOT"
|
||||
paper = "1.21.8-R0.1-SNAPSHOT"
|
||||
minecraft = "1.21.8"
|
||||
|
||||
runtask = "3.0.1"
|
||||
blossom = "2.1.0"
|
||||
shadow = "9.2.2"
|
||||
jmh = "0.7.3"
|
||||
dokka = "2.0.0"
|
||||
|
||||
adventure = "4.24.0"
|
||||
adventureModded = "6.6.0"
|
||||
kotlin = "2.2.20"
|
||||
|
||||
fabric-api = "0.134.0+1.21.8"
|
||||
fabric-loader = "0.17.3"
|
||||
# Platform
|
||||
minecraft = "26.1"
|
||||
paper = "1.21.11-R0.1-SNAPSHOT"
|
||||
velocity = "3.5.0-SNAPSHOT"
|
||||
minestom = "2026.03.03-1.21.11"
|
||||
fabric-loader = "0.18.5"
|
||||
fabric-api = "0.144.3+26.1"
|
||||
|
||||
# Libraries
|
||||
kotlin = "2.3.20"
|
||||
adventure = "4.26.1"
|
||||
adventureModded = "6.9.0-SNAPSHOT"
|
||||
desertwell = "2.0.4"
|
||||
bstats = "3.1.0"
|
||||
bstats = "3.2.1"
|
||||
jspecify = "1.0.0"
|
||||
|
||||
# Gradle Plugins
|
||||
runtask = "3.0.2"
|
||||
blossom = "2.2.0"
|
||||
shadow = "9.4.0"
|
||||
jmh = "0.7.3"
|
||||
dokka = "2.2.0"
|
||||
|
||||
[libraries]
|
||||
|
||||
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
||||
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
||||
# Platforms
|
||||
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
|
||||
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
||||
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
||||
minestom = { group = "net.minestom", name = "minestom", version.ref = "minestom" }
|
||||
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||
luckopermissionsapi = { group = "me.lucko", name = "fabric-permissions-api", version = "0.4.1" }
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
|
||||
# Adventure
|
||||
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
||||
adventure-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
|
||||
adventure-platform-fabric = { group = "net.kyori", name = "adventure-platform-fabric", version.ref = "adventureModded" }
|
||||
adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
|
||||
adventure-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
|
||||
|
||||
# Build-Logic Gradle Plugins
|
||||
plugin-shadow = { module = "com.gradleup.shadow:shadow-gradle-plugin", version.ref = "shadow" }
|
||||
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
plugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
||||
plugin-runtask = { module = "xyz.jpenilla.run-velocity:xyz.jpenilla.run-velocity.gradle.plugin", version.ref = "runtask" }
|
||||
|
||||
# Libraries
|
||||
desertwell = { group = "net.william278", name = "DesertWell", version.ref = "desertwell" }
|
||||
|
||||
junit-bom = "org.junit:junit-bom:6.0.0"
|
||||
jspecify = "org.jspecify:jspecify:1.0.0"
|
||||
|
||||
junit-bom = "org.junit:junit-bom:6.0.3"
|
||||
jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
|
||||
luckopermissionsapi = { group = "me.lucko", name = "fabric-permissions-api", version = "0.7.0" }
|
||||
unnamedinject = "team.unnamed:inject:2.0.1"
|
||||
brigadier = "com.mojang:brigadier:1.0.500"
|
||||
|
||||
# Bstats
|
||||
bstats-core = { group = "org.bstats", name = "bstats-base", version.ref = "bstats" }
|
||||
bstats-velocity = { group = "org.bstats", name = "bstats-velocity", version.ref = "bstats" }
|
||||
bstats-sponge = { group = "org.bstats", name = "bstats-sponge", version.ref = "bstats" }
|
||||
@@ -58,10 +63,14 @@ bstats-bukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "b
|
||||
|
||||
[plugins]
|
||||
|
||||
# Platform Plugins
|
||||
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runtask" }
|
||||
runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
|
||||
fabric-loom = { id = "net.fabricmc.fabric-loom", version = "1.15.5"}
|
||||
spongegradle = { id = "org.spongepowered.gradle.plugin", version = "2.3.0" }
|
||||
|
||||
# General Plugins
|
||||
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
|
||||
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||
jmh = { id = "me.champeau.jmh", version.ref = "jmh" }
|
||||
idea-ext = { id = "org.jetbrains.gradle.plugin.idea-ext", version = "1.3" }
|
||||
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||
idea-ext = { id = "org.jetbrains.gradle.plugin.idea-ext", version = "1.4.1" }
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import com.vanniktech.maven.publish.KotlinJvm
|
||||
import com.vanniktech.maven.publish.JavadocJar
|
||||
import com.vanniktech.maven.publish.SourcesJar
|
||||
import java.time.LocalDate
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("com.vanniktech.maven.publish")
|
||||
id("org.jetbrains.dokka") version "2.0.0"
|
||||
alias(libs.plugins.dokka)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -18,7 +19,7 @@ dependencies {
|
||||
kotlin {
|
||||
explicitApi()
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
languageVersion.set(JavaLanguageVersion.of(25))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,12 +76,8 @@ mavenPublishing {
|
||||
}
|
||||
}
|
||||
configure(KotlinJvm(
|
||||
// configures the -javadoc artifact, possible values:
|
||||
// - `JavadocJar.None()` don't publish this artifact
|
||||
// - `JavadocJar.Empty()` publish an empty jar
|
||||
// - `JavadocJar.Dokka("dokkaHtml")` when using Kotlin with Dokka, where `dokkaHtml` is the name of the Dokka task that should be used as input
|
||||
javadocJar = JavadocJar.Dokka("dokkaGeneratePublicationHtml"),
|
||||
sourcesJar = true,
|
||||
sourcesJar = SourcesJar.Sources(),
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#run minestom files
|
||||
/run
|
||||
/test
|
||||
@@ -0,0 +1,82 @@
|
||||
import java.time.LocalDate
|
||||
|
||||
plugins {
|
||||
id("miniplaceholders.shadow")
|
||||
id("miniplaceholders.auto.module")
|
||||
id("miniplaceholders.runtask")
|
||||
id("com.vanniktech.maven.publish")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.minestom)
|
||||
compileOnly(libs.adventure.api)
|
||||
annotationProcessor(libs.minestom)
|
||||
implementation(projects.miniplaceholdersCommon)
|
||||
implementation(projects.miniplaceholdersApi)
|
||||
implementation(projects.miniplaceholdersConnect)
|
||||
|
||||
testImplementation(libs.minestom)
|
||||
testImplementation(libs.adventure.api)
|
||||
testImplementation(libs.adventure.minimessage)
|
||||
testImplementation("ch.qos.logback:logback-classic:1.5.32") // logger
|
||||
testImplementation("com.google.guava:guava:33.5.0-jre")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
failOnNoDiscoveredTests = false
|
||||
}
|
||||
|
||||
mavenPublishing {
|
||||
publishToMavenCentral()
|
||||
signAllPublications()
|
||||
coordinates(project.group as String, "miniplaceholders-minestom", project.version as String)
|
||||
|
||||
pom {
|
||||
name.set(project.name)
|
||||
description.set(project.description)
|
||||
inceptionYear.set(LocalDate.now().year.toString())
|
||||
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
|
||||
licenses {
|
||||
license {
|
||||
name.set("The Apache License, Version 2.0")
|
||||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("4drian3d")
|
||||
name.set("Adrian Gonzales")
|
||||
email.set("adriangonzalesval@gmail.com")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection.set("scm:git:https://github.com/MiniPlaceholders/MiniPlaceholders.git")
|
||||
developerConnection.set("scm:git:ssh://git@github.com/MiniPlaceholders/MiniPlaceholders.git")
|
||||
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders")
|
||||
}
|
||||
ciManagement {
|
||||
name.set("GitHub Actions")
|
||||
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/actions")
|
||||
}
|
||||
issueManagement {
|
||||
name.set("GitHub")
|
||||
url.set("https://github.com/MiniPlaceholders/MiniPlaceholders/issues")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
named("runtimeElements") {
|
||||
outgoing {
|
||||
artifacts.clear()
|
||||
artifact(tasks.shadowJar)
|
||||
}
|
||||
}
|
||||
named("apiElements") {
|
||||
outgoing {
|
||||
artifacts.clear()
|
||||
artifact(tasks.shadowJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package io.github.miniplaceholders.minestom;
|
||||
|
||||
import io.github.miniplaceholders.common.PlaceholdersPlugin;
|
||||
import io.github.miniplaceholders.common.command.PermissionTester;
|
||||
import io.github.miniplaceholders.connect.InternalPlatform;
|
||||
import io.github.miniplaceholders.minestom.command.MinestomCommand;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public final class MinestomMiniPlaceholders implements PlaceholdersPlugin {
|
||||
private static final ComponentLogger LOGGER = ComponentLogger.logger("miniplaceholders");
|
||||
private final PermissionTester permissionTester;
|
||||
|
||||
private MinestomMiniPlaceholders(PermissionTester permissionTester) {
|
||||
this.permissionTester = permissionTester;
|
||||
}
|
||||
|
||||
public static MinestomMiniPlaceholders initialize(Path dataDirectory, PermissionTester permissionTester) {
|
||||
InternalPlatform.platform(InternalPlatform.MINESTOM);
|
||||
LOGGER.info(Component.text("Initializing MiniPlaceholders", NamedTextColor.GREEN));
|
||||
final MinestomMiniPlaceholders miniPlaceholders = new MinestomMiniPlaceholders(permissionTester);
|
||||
miniPlaceholders.registerPlatformCommand();
|
||||
|
||||
try {
|
||||
miniPlaceholders.loadProvidedExpansions(dataDirectory.resolve("expansions"));
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error("Unable to load expansion providers", e);
|
||||
}
|
||||
|
||||
return miniPlaceholders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes MiniPlaceholders with a default no-op permission tester.
|
||||
* This is not recommended for production use!
|
||||
*/
|
||||
public static MinestomMiniPlaceholders initialize(final Path dataDirectory) {
|
||||
return MinestomMiniPlaceholders.initialize(dataDirectory, PermissionTester.NO_OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPlatformCommand() {
|
||||
MinecraftServer.getCommandManager().register(new MinestomCommand(permissionTester));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean platformHasComplementLoaded(String complementName) {
|
||||
return false; // Minestom doesn't plugins.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object platformServerInstance() {
|
||||
return MinecraftServer.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logInfo(Component component) {
|
||||
LOGGER.info(component);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logError(Component component) {
|
||||
LOGGER.error(component);
|
||||
}
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package io.github.miniplaceholders.minestom.command;
|
||||
|
||||
import io.github.miniplaceholders.common.command.AudienceConverter;
|
||||
import io.github.miniplaceholders.common.command.PermissionTester;
|
||||
import io.github.miniplaceholders.common.command.PlaceholderCommandExecutor;
|
||||
import io.github.miniplaceholders.common.command.PlayersNameProvider;
|
||||
import io.github.miniplaceholders.common.command.node.*;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.command.CommandSender;
|
||||
import net.minestom.server.command.builder.Command;
|
||||
import net.minestom.server.command.builder.CommandContext;
|
||||
import net.minestom.server.command.builder.CommandExecutor;
|
||||
import net.minestom.server.command.builder.arguments.Argument;
|
||||
import net.minestom.server.command.builder.arguments.ArgumentType;
|
||||
import net.minestom.server.command.builder.condition.CommandCondition;
|
||||
import net.minestom.server.command.builder.suggestion.SuggestionEntry;
|
||||
import net.minestom.server.entity.Player;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MinestomCommand extends Command {
|
||||
private final PermissionTester permissionTester;
|
||||
private final PlayersNameProvider playerSuggestions;
|
||||
private final AudienceConverter audienceConverter;
|
||||
|
||||
public MinestomCommand(PermissionTester permissionTester) {
|
||||
super("miniplaceholders");
|
||||
|
||||
this.permissionTester = permissionTester;
|
||||
this.playerSuggestions = () -> MinecraftServer.getConnectionManager().getOnlinePlayers()
|
||||
.stream()
|
||||
.map(Player::getName)
|
||||
.map(PlainTextComponentSerializer.plainText()::serialize)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
this.audienceConverter = string -> MinecraftServer.getConnectionManager().getOnlinePlayerByUsername(string);
|
||||
|
||||
final RootNode rootNode = new RootNode(permissionTester);
|
||||
|
||||
this.setCondition(new WrappingCondition(rootNode::hasPermission));
|
||||
this.setDefaultExecutor(new WrappingExecutor(rootNode::execute));
|
||||
|
||||
this.addSubcommands(new ExpansionsCommand(), new HelpCommand(), new ParseCommand(), new ParseRelCommand());
|
||||
}
|
||||
|
||||
private class ExpansionsCommand extends Command {
|
||||
public ExpansionsCommand() {
|
||||
super("expansions");
|
||||
|
||||
final ExpansionsNode expansionsNode = new ExpansionsNode(permissionTester);
|
||||
|
||||
this.setCondition(new WrappingCondition(expansionsNode::hasPermission));
|
||||
this.setDefaultExecutor(new WrappingExecutor(expansionsNode::showExpansions));
|
||||
}
|
||||
}
|
||||
|
||||
private class HelpCommand extends Command {
|
||||
public HelpCommand() {
|
||||
super("help");
|
||||
|
||||
final HelpNode helpNode = new HelpNode(permissionTester);
|
||||
|
||||
this.setCondition(new WrappingCondition(helpNode::hasPermission));
|
||||
this.setDefaultExecutor(new WrappingExecutor(helpNode::execute));
|
||||
}
|
||||
}
|
||||
|
||||
private class ParseCommand extends Command {
|
||||
public ParseCommand() {
|
||||
super("parse");
|
||||
|
||||
final ParseNode parseNode = new ParseNode(playerSuggestions, audienceConverter, permissionTester);
|
||||
final Argument<String> sourceArgument = ArgumentType.String("source")
|
||||
.setSuggestionCallback((_, _, suggestion) -> parseNode.providePlayerSuggestions()
|
||||
.stream()
|
||||
.filter(s -> {
|
||||
final String[] args = suggestion.getInput().replace("\0", "").split(" ");
|
||||
return args.length < 3 || s.toLowerCase().startsWith(args[2].toLowerCase());
|
||||
})
|
||||
.map(SuggestionEntry::new)
|
||||
.forEach(suggestion::addEntry));
|
||||
final Argument<String[]> messageArgument = ArgumentType.StringArray("message");
|
||||
|
||||
this.setCondition(new WrappingCondition(parseNode::hasPermission));
|
||||
this.addSyntax((sender, context) -> {
|
||||
final String source = context.get(sourceArgument);
|
||||
final String[] message = context.get(messageArgument);
|
||||
|
||||
parseNode.parseString(sender, source, String.join(" ", message));
|
||||
}, sourceArgument, messageArgument);
|
||||
}
|
||||
}
|
||||
|
||||
private class ParseRelCommand extends Command {
|
||||
public ParseRelCommand() {
|
||||
super("parserel");
|
||||
|
||||
final ParseRelNode parseRelNode = new ParseRelNode(playerSuggestions, audienceConverter, permissionTester);
|
||||
final Argument<String> sourceArgument = ArgumentType.String("source")
|
||||
.setSuggestionCallback((_, _, suggestion) -> parseRelNode.providePlayerSuggestions()
|
||||
.stream()
|
||||
.filter(s -> {
|
||||
final String[] args = suggestion.getInput().replace("\0", "").split(" ");
|
||||
return args.length < 3 || s.toLowerCase().startsWith(args[2].toLowerCase());
|
||||
})
|
||||
.map(SuggestionEntry::new)
|
||||
.forEach(suggestion::addEntry));
|
||||
final Argument<String> relationalSourceArgument = ArgumentType.String("relational")
|
||||
.setSuggestionCallback((_, _, suggestion) -> parseRelNode.providePlayerSuggestions()
|
||||
.stream()
|
||||
.filter(s -> {
|
||||
final String[] args = suggestion.getInput().replace("\0", "").split(" ");
|
||||
return args.length < 4 || s.toLowerCase().startsWith(args[3].toLowerCase());
|
||||
})
|
||||
.map(SuggestionEntry::new)
|
||||
.forEach(suggestion::addEntry));
|
||||
final Argument<String[]> messageArgument = ArgumentType.StringArray("message");
|
||||
|
||||
this.setCondition(new WrappingCondition(parseRelNode::hasPermission));
|
||||
this.addSyntax((sender, context) -> {
|
||||
final String source = context.get(sourceArgument);
|
||||
final String relationalSource = context.get(relationalSourceArgument);
|
||||
final String[] message = context.get(messageArgument);
|
||||
|
||||
parseRelNode.parseString(sender, source, relationalSource, String.join(" ", message));
|
||||
}, sourceArgument, relationalSourceArgument, messageArgument);
|
||||
}
|
||||
}
|
||||
|
||||
private record WrappingCondition(Predicate<Audience> predicate) implements CommandCondition {
|
||||
@Override
|
||||
public boolean canUse(@NonNull CommandSender sender, @Nullable String commandString) {
|
||||
return predicate.test(sender);
|
||||
}
|
||||
}
|
||||
|
||||
private record WrappingExecutor(PlaceholderCommandExecutor executor) implements CommandExecutor {
|
||||
@Override
|
||||
public void apply(@NonNull CommandSender sender, @NonNull CommandContext context) {
|
||||
executor.execute(sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package io.github.miniplaceholders.minestom;
|
||||
|
||||
import io.github.miniplaceholders.minestom.listener.AsyncPlayerConfigurationListener;
|
||||
import net.kyori.adventure.util.TriState;
|
||||
import net.minestom.server.Auth;
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.extras.lan.OpenToLAN;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.time.Duration;
|
||||
|
||||
public class MinestomServer {
|
||||
|
||||
private static final Path MINIPLACEHOLDERS_TEST_FOLDER = Path.of("minestom", "test", "miniplaceholders");
|
||||
private static final Path TEST_EXPANSION_FOLDER = Path.of("example-expansion-provider", "build", "libs");
|
||||
|
||||
static void main() throws IOException {
|
||||
final MinecraftServer server = MinecraftServer.init(new Auth.Online());
|
||||
MinecraftServer.getGlobalEventHandler().addListener(new AsyncPlayerConfigurationListener());
|
||||
MinestomServer.copyTestExpansion();
|
||||
|
||||
MinestomMiniPlaceholders.initialize(
|
||||
MINIPLACEHOLDERS_TEST_FOLDER,
|
||||
(_, _) -> TriState.TRUE
|
||||
);
|
||||
|
||||
OpenToLAN.open();
|
||||
server.start("0.0.0.0", 25565);
|
||||
|
||||
Thread.ofPlatform().start(() -> {
|
||||
try {
|
||||
Thread.sleep(Duration.ofMinutes(2));
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
private static void copyTestExpansion() throws IOException {
|
||||
if (!Files.exists(TEST_EXPANSION_FOLDER)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Path expansionsFolder = MINIPLACEHOLDERS_TEST_FOLDER.resolve("expansions");
|
||||
// Delete previous expansions files
|
||||
try (DirectoryStream<Path> stream = Files.newDirectoryStream(
|
||||
expansionsFolder,
|
||||
file -> file.getFileName().toString().endsWith(".jar"))
|
||||
) {
|
||||
stream.forEach(file -> {
|
||||
try {
|
||||
Files.delete(file);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Copy latest example expansion file
|
||||
try (final DirectoryStream<Path> stream = Files.newDirectoryStream(
|
||||
TEST_EXPANSION_FOLDER,
|
||||
file -> file.getFileName()
|
||||
.toString().startsWith("miniplaceholders-example-expansion-provider"))
|
||||
) {
|
||||
stream.forEach(file -> {
|
||||
if (!Files.exists(expansionsFolder)) {
|
||||
try {
|
||||
Files.createDirectories(expansionsFolder);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
Files.copy(file, expansionsFolder.resolve(file.getFileName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
System.out.println("An error occurred while loading expansion provider" + e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package io.github.miniplaceholders.minestom.listener;
|
||||
|
||||
import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.coordinate.Pos;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.event.EventListener;
|
||||
import net.minestom.server.event.player.AsyncPlayerConfigurationEvent;
|
||||
import net.minestom.server.instance.Instance;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
public class AsyncPlayerConfigurationListener implements EventListener<AsyncPlayerConfigurationEvent> {
|
||||
|
||||
private final Instance instance;
|
||||
|
||||
public AsyncPlayerConfigurationListener() {
|
||||
this.instance = MinecraftServer.getInstanceManager().createInstanceContainer();
|
||||
instance.setGenerator(unit -> unit.modifier().fillHeight(0, 32, Block.GRASS_BLOCK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Class<AsyncPlayerConfigurationEvent> eventType() {
|
||||
return AsyncPlayerConfigurationEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Result run(AsyncPlayerConfigurationEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
event.setSpawningInstance(instance);
|
||||
player.setRespawnPoint(new Pos(0, 33, 0));
|
||||
return Result.SUCCESS;
|
||||
}
|
||||
}
|
||||
+5
-16
@@ -16,31 +16,19 @@ pluginManagement {
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
maven("https://central.sonatype.com/repository/maven-snapshots/") {
|
||||
name = "sonatype-snapshots"
|
||||
mavenContent {
|
||||
snapshotsOnly()
|
||||
}
|
||||
}
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://repo.maven.apache.org/maven2/")
|
||||
maven("https://repo.spongepowered.org/repository/")
|
||||
maven("https://jitpack.io") {
|
||||
mavenContent {
|
||||
includeGroup("net.william278")
|
||||
}
|
||||
}
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.jpenilla.xyz/snapshots/")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("quiet-fabric-loom") version "1.11.325"
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
id("com.vanniktech.maven.publish") version "0.34.0" apply false
|
||||
kotlin("jvm") version "2.2.20" apply false
|
||||
id("com.vanniktech.maven.publish") version "0.36.0" apply false
|
||||
kotlin("jvm") version "2.3.20" apply false
|
||||
}
|
||||
|
||||
arrayOf(
|
||||
@@ -49,6 +37,7 @@ arrayOf(
|
||||
"kotlin-ext",
|
||||
"common",
|
||||
"paper",
|
||||
"minestom",
|
||||
"velocity",
|
||||
"fabric",
|
||||
"sponge",
|
||||
@@ -56,4 +45,4 @@ arrayOf(
|
||||
).forEach {
|
||||
include("miniplaceholders-$it")
|
||||
project(":miniplaceholders-$it").projectDir = file(it)
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import kotlin.io.path.deleteIfExists
|
||||
plugins {
|
||||
id("miniplaceholders.auto.module")
|
||||
id("miniplaceholders.shadow")
|
||||
id("org.spongepowered.gradle.plugin") version "2.3.0"
|
||||
alias(libs.plugins.spongegradle)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
Reference in new issue
Block a user