Compare commits
12
Commits
2.0.1
...
feat/fabric
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbc80800f0 | ||
|
|
9236a4f01d | ||
|
|
741882d723 | ||
|
|
6788e43c8f | ||
|
|
ba54223de6 | ||
|
|
3108f531aa | ||
|
|
033069b2db | ||
|
|
1d931a9228 | ||
|
|
c1cc41ff09 | ||
|
|
2ec76033e9 | ||
|
|
00e309c335 | ||
|
|
4d6b792918 |
No files matched your search
@@ -16,14 +16,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '17'
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
cache: 'gradle'
|
||||
- name: Build with Gradle
|
||||
uses: nick-invision/retry@v2
|
||||
uses: nick-invision/retry@v3
|
||||
with:
|
||||
timeout_minutes: 5
|
||||
max_attempts: 2
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
# PlaceholderAdapter-Expansion
|
||||
PlaceholderAdapter Expansion for MiniPlaceholders
|
||||
|
||||
## Supported Platforms
|
||||
This expansion provides support for multiple placeholder plugins so that they can be used in MiniPlaceholders
|
||||
|
||||
- Paper
|
||||
- Velocity
|
||||
## Supported Placeholder Providers
|
||||
|
||||
### If you are using Velocity
|
||||
- [PlaceholderAPI](https://modrinth.com/plugin/placeholderapi) (Bukkit/Paper)
|
||||
- [TextPlaceholderAPI](https://modrinth.com/mod/placeholder-api) (Fabric)
|
||||
- [PAPIProxyBridge](https://modrinth.com/plugin/papiproxybridge) (Velocity)
|
||||
|
||||
In order to use PlaceholderAPI placeholders with MiniPlaceholders Velocity,
|
||||
you must install [PAPIProxyBridge](https://modrinth.com/plugin/papiproxybridge) according to its installation guide
|
||||
|
||||
On Velocity there is an additional optional `expiry` parameter for how long the placeholder should be cached. This value is in milliseconds.
|
||||
> [!IMPORTANT]
|
||||
> If you are using Velocity, in order to use PlaceholderAPI placeholders with MiniPlaceholders Velocity,
|
||||
> you must install [PAPIProxyBridge](https://modrinth.com/plugin/papiproxybridge) according to its installation guide
|
||||
>
|
||||
> On Velocity there is an additional optional `expiry` parameter for how long the placeholder should be cached. This value is in milliseconds.
|
||||
|
||||
## Placeholders
|
||||
|
||||
### Global
|
||||
|
||||
- `<placeholder-adapter_global:(placeholder)>`
|
||||
Velocity:
|
||||
- `<placeholder-adapter_global:(placeholder):(expiry)>`
|
||||
@@ -22,6 +26,8 @@ Velocity:
|
||||
This placeholder does not require any player to work.
|
||||
Its operation would be similar to running the command `/papi parse --null (placeholders)`
|
||||
|
||||
### Audience
|
||||
|
||||
- `<placeholder-adapter_player:(placeholder)>`
|
||||
Velocity:
|
||||
- `<placeholder-adapter_player:(placeholder):(expiry)>`
|
||||
@@ -29,6 +35,11 @@ Velocity:
|
||||
This placeholder requires an online player to function.
|
||||
Its operation would be similar to running the `/papi parse me (placeholders)` command
|
||||
|
||||
### Relational
|
||||
|
||||
> [!NOTE]
|
||||
> This type of placeholder is not supported by TextPlaceholderAPI, so it will only be available in Paper and Velocity
|
||||
|
||||
- `<placeholder-adapter_relational:(placeholder)>`
|
||||
Velocity:
|
||||
- `<placeholder-adapter_relational:(placeholder):(expiry)>`
|
||||
@@ -36,11 +47,9 @@ Velocity:
|
||||
This placeholder requires two online players to work.
|
||||
The functioning of this placeholder depends on whether the plugin in which it is used has relational placeholder support
|
||||
|
||||
## Nesting
|
||||
|
||||
If you want to nest the result of the placeholder inside another placeholder, add the string argument.
|
||||
For example:
|
||||
- `<placeholder-adapter_papi_player:%player_name%:string>`
|
||||
- `<placeholder-adapter_player:%player_name%:string:30000>`
|
||||
|
||||
## Downloads
|
||||
|
||||
[](https://modrinth.com/plugin/miniplaceholders-placeholderapi-expansion)
|
||||
+6
-2
@@ -4,9 +4,13 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.adventure.api)
|
||||
compileOnly(libs.miniplaceholders)
|
||||
implementation(projects.placeholderapiExpansionPaper)
|
||||
implementation(projects.placeholderapiExpansionVelocity)
|
||||
implementation(projects.placeholderAdapterExpansionPaper)
|
||||
implementation(projects.placeholderAdapterExpansionVelocity)
|
||||
implementation(projects.placeholderAdapterExpansionFabric) {
|
||||
isTransitive = false
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
plugins {
|
||||
id("fabric-loom")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.miniplaceholders)
|
||||
minecraft(libs.minecraft)
|
||||
mappings(loom.officialMojangMappings())
|
||||
modImplementation(libs.fabric.loader)
|
||||
modImplementation(libs.fabric.api)
|
||||
modImplementation(libs.adventure.platform.fabric)
|
||||
modImplementation(libs.placeholderapi.fabric)
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package io.github.miniplaceholders.expansion.placeholderadapter.fabric;
|
||||
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
import eu.pb4.placeholders.api.Placeholders;
|
||||
import io.github.miniplaceholders.api.Expansion;
|
||||
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
|
||||
|
||||
public class FabricPlatform {
|
||||
public static Expansion.Builder provideBuilder(Object platformInstance) {
|
||||
final MinecraftServer server = (MinecraftServer) platformInstance;
|
||||
final MinecraftServerAudiences serverAudiences = MinecraftServerAudiences.of(server);
|
||||
return Expansion.builder("placeholder-adapter")
|
||||
.globalPlaceholder("global", (queue, ctx) -> {
|
||||
final String argument = queue.popOr("You need to provide a placeholder").value();
|
||||
final Component papiParsed = serverAudiences.asAdventure(
|
||||
Placeholders.parseText(net.minecraft.network.chat.Component.literal(argument), PlaceholderContext.of(server))
|
||||
);
|
||||
if (parseString(queue)) {
|
||||
return Tag.preProcessParsed(miniMessage().serialize(papiParsed));
|
||||
} else {
|
||||
return Tag.selfClosingInserting(papiParsed);
|
||||
}
|
||||
})
|
||||
.audiencePlaceholder(ServerPlayer.class, "player", (player, queue, ctx) -> {
|
||||
final String argument = queue.popOr("You need to provide a placeholder").value();
|
||||
final Component papiParsed = serverAudiences.asAdventure(
|
||||
Placeholders.parseText(net.minecraft.network.chat.Component.literal(argument), PlaceholderContext.of(player))
|
||||
);
|
||||
if (parseString(queue)) {
|
||||
return Tag.preProcessParsed(miniMessage().serialize(papiParsed));
|
||||
} else {
|
||||
return Tag.selfClosingInserting(papiParsed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean parseString(ArgumentQueue queue) {
|
||||
return queue.hasNext() && queue.pop().lowerValue().equals("string");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
group = io.github.miniplaceholders
|
||||
version = 2.0.1
|
||||
version = 2.1.0-SNAPSHOT
|
||||
description = PlaceholderAdapter-Expansion
|
||||
@@ -9,15 +9,29 @@ blossom = "2.1.0"
|
||||
shadow = "9.0.2"
|
||||
runtask = "2.3.1"
|
||||
|
||||
miniplaceholders = "3.0.0"
|
||||
adventure = "4.13.1"
|
||||
miniplaceholders = "3.0.1"
|
||||
|
||||
adventure = "4.24.0"
|
||||
adventurefabric = "6.6.0"
|
||||
|
||||
fabric-loader = "0.17.2"
|
||||
fabric-api = "0.131.0+1.21.8"
|
||||
minecraft = "1.21.8"
|
||||
|
||||
[libraries]
|
||||
|
||||
miniplaceholders = { group = "io.github.miniplaceholders", name = "miniplaceholders-api", version.ref = "miniplaceholders" }
|
||||
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
||||
adventure-platform-fabric = { group = "net.kyori", name = "adventure-platform-fabric", version.ref = "adventurefabric" }
|
||||
|
||||
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
|
||||
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
|
||||
paper-api = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
|
||||
miniplaceholders = { group = "io.github.miniplaceholders", name = "miniplaceholders-api", version.ref = "miniplaceholders" }
|
||||
placeholderapi = { group = "me.clip", name = "placeholderapi", version = "2.11.6" }
|
||||
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
|
||||
placeholderapi-bukkit = { group = "me.clip", name = "placeholderapi", version = "2.11.6" }
|
||||
placeholderapi-fabric = { group = "eu.pb4", name = "placeholder-api", version = "2.7.2+1.21.8" }
|
||||
proxybridge = "net.william278:papiproxybridge:1.8.4"
|
||||
|
||||
[plugins]
|
||||
|
||||
@@ -5,5 +5,5 @@ plugins {
|
||||
dependencies {
|
||||
compileOnly(libs.paper.api)
|
||||
compileOnly(libs.miniplaceholders)
|
||||
compileOnly(libs.placeholderapi)
|
||||
compileOnly(libs.placeholderapi.bukkit)
|
||||
}
|
||||
+2
-3
@@ -14,7 +14,7 @@ import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializ
|
||||
@SuppressWarnings("unused")
|
||||
public final class PaperPlatform {
|
||||
|
||||
public static Expansion provideExpansion() {
|
||||
public static Expansion.Builder provideBuilder() {
|
||||
return Expansion.builder("placeholder-adapter")
|
||||
.globalPlaceholder("global", (queue, ctx) -> {
|
||||
final String argument = queue.popOr("You need to provide a placeholder").value();
|
||||
@@ -55,8 +55,7 @@ public final class PaperPlatform {
|
||||
} else {
|
||||
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
|
||||
}
|
||||
})
|
||||
.build();
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean parseString(ArgumentQueue queue) {
|
||||
|
||||
+13
-3
@@ -11,17 +11,27 @@ dependencyResolutionManagement {
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.william278.net/releases/")
|
||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||
maven("https://maven.nucleoid.xyz/") { name = "Nucleoid" }
|
||||
}
|
||||
}
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
id("fabric-loom") version "1.11.7"
|
||||
}
|
||||
|
||||
arrayOf("paper", "velocity").forEach {
|
||||
include("placeholderapi-expansion-$it")
|
||||
arrayOf("paper", "velocity", "fabric").forEach {
|
||||
include("placeholder-adapter-expansion-$it")
|
||||
|
||||
project(":placeholderapi-expansion-$it").projectDir = file(it)
|
||||
project(":placeholder-adapter-expansion-$it").projectDir = file(it)
|
||||
}
|
||||
|
||||
+23
-5
@@ -4,25 +4,43 @@ import io.github.miniplaceholders.api.Expansion;
|
||||
import io.github.miniplaceholders.api.MiniPlaceholders;
|
||||
import io.github.miniplaceholders.api.provider.ExpansionProvider;
|
||||
import io.github.miniplaceholders.api.provider.LoadRequirement;
|
||||
import io.github.miniplaceholders.api.provider.PlatformData;
|
||||
import io.github.miniplaceholders.api.types.Platform;
|
||||
import io.github.miniplaceholders.expansion.placeholderadapter.velocity.VelocityPlatform;
|
||||
import io.github.miniplaceholders.expansion.placeholderadapter.paper.PaperPlatform;
|
||||
import io.github.miniplaceholders.expansion.placeholderadapter.fabric.FabricPlatform;
|
||||
import team.unnamed.inject.Inject;
|
||||
|
||||
public final class AdapterExpansionProvider implements ExpansionProvider {
|
||||
@Inject
|
||||
private PlatformData platformData;
|
||||
|
||||
@Override
|
||||
public Expansion provideExpansion() {
|
||||
return switch (MiniPlaceholders.platform()) {
|
||||
case PAPER -> PaperPlatform.provideExpansion();
|
||||
case VELOCITY -> VelocityPlatform.provideExpansion();
|
||||
final Expansion.Builder builder = switch (MiniPlaceholders.platform()) {
|
||||
case PAPER -> PaperPlatform.provideBuilder();
|
||||
case VELOCITY -> VelocityPlatform.provideBuilder();
|
||||
case FABRIC -> FabricPlatform.provideBuilder(platformData.serverInstance());
|
||||
default -> throw new UnsupportedOperationException("Unsupported Platform");
|
||||
};
|
||||
|
||||
return builder.author("MiniPlaceholders Contributors")
|
||||
.version("2.1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoadRequirement loadRequirement() {
|
||||
return LoadRequirement.allOf(
|
||||
LoadRequirement.platform(Platform.PAPER, Platform.VELOCITY),
|
||||
LoadRequirement.requiredComplement("placeholderapi", "PlaceholderAPI", "papiproxybridge")
|
||||
LoadRequirement.platform(Platform.PAPER, Platform.VELOCITY, Platform.FABRIC),
|
||||
LoadRequirement.requiredComplement(
|
||||
// Paper
|
||||
"placeholderapi", "PlaceholderAPI",
|
||||
// Velocity
|
||||
"papiproxybridge",
|
||||
// Fabric
|
||||
"placeholder-api"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -36,7 +36,7 @@ public final class VelocityPlatform {
|
||||
});
|
||||
}
|
||||
|
||||
public static Expansion provideExpansion() {
|
||||
public static Expansion.Builder provideBuilder() {
|
||||
return Expansion.builder("placeholder-adapter")
|
||||
.globalPlaceholder("global", (queue, ctx) -> {
|
||||
final String argument = queue.popOr("You need to provide a placeholder").value();
|
||||
@@ -85,8 +85,7 @@ public final class VelocityPlatform {
|
||||
} else {
|
||||
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
|
||||
}
|
||||
})
|
||||
.build();
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean parseString(ArgumentQueue queue) {
|
||||
|
||||
Reference in new issue
Block a user