26 Commits
Author SHA1 Message Date
Adrian Gonzales dbc80800f0 ci: Updated jdk used 2025-08-30 12:33:37 -05:00
Adrian Gonzales 9236a4f01d misc: expansion 2025-08-30 12:32:00 -05:00
Adrian Gonzales 741882d723 misc: Removed Download link 2025-08-30 12:30:38 -05:00
Adrian Gonzales 6788e43c8f misc: Updated README 2025-08-30 12:30:06 -05:00
Adrian Gonzales ba54223de6 Merge branch 'main' into feat/fabric
# Conflicts:
#	gradle/libs.versions.toml
2025-08-30 11:47:01 -05:00
Adrian Gonzales 3108f531aa feat(fabric): Added support for TextPlaceholderAPI 2025-08-30 11:43:33 -05:00
Adrian 033069b2db Merge pull request #27 from MiniPlaceholders/renovate/nick-invision-retry-3.x
chore(deps): update nick-invision/retry action to v3
2025-08-28 14:33:44 -05:00
renovate[bot] 1d931a9228 chore(deps): update nick-invision/retry action to v3 2025-08-28 19:26:25 +00:00
Adrian c1cc41ff09 Merge pull request #37 from MiniPlaceholders/renovate/actions-setup-java-5.x
chore(deps): update actions/setup-java action to v5
2025-08-25 15:23:29 -05:00
Adrian 2ec76033e9 Merge pull request #38 from MiniPlaceholders/renovate/miniplaceholders
fix(deps): update dependency io.github.miniplaceholders:miniplaceholders-api to v3.0.1
2025-08-25 15:23:21 -05:00
Adrian Gonzales 1ba0bcc3c7 fix: Fixed papiproxybridge compatibility 2025-08-24 03:59:44 -05:00
renovate[bot] 00e309c335 fix(deps): update dependency io.github.miniplaceholders:miniplaceholders-api to v3.0.1 2025-08-23 06:08:56 +00:00
Adrian 22f4c06b0b Merge pull request #36 from MiniPlaceholders/renovate/miniplaceholders
fix(deps): update dependency io.github.miniplaceholders:miniplaceholders-api to v3.0.0
2025-08-21 15:01:44 -05:00
renovate[bot] 4d6b792918 chore(deps): update actions/setup-java action to v5 2025-08-21 05:46:09 +00:00
renovate[bot] 92c451a66d fix(deps): update dependency io.github.miniplaceholders:miniplaceholders-api to v3.0.0 2025-08-21 05:46:02 +00:00
Adrian df54aa012b Merge pull request #26 from MiniPlaceholders/renovate/net.william278-papiproxybridge-1.x
fix(deps): update dependency net.william278:papiproxybridge to v1.8.4
2025-08-20 21:28:06 -05:00
Adrian 71240bbe1c Merge pull request #28 from MiniPlaceholders/renovate/runtask
chore(deps): update dependency xyz.jpenilla.run-velocity to v2.3.1
2025-08-20 21:27:49 -05:00
Adrian d1c22f97b6 Merge pull request #34 from MiniPlaceholders/renovate/actions-checkout-5.x
chore(deps): update actions/checkout action to v5
2025-08-20 21:27:41 -05:00
renovate[bot] 1ad79cb356 fix(deps): update dependency net.william278:papiproxybridge to v1.8.4 2025-08-21 02:08:43 +00:00
Adrian 85d81f917d Merge pull request #32 from MiniPlaceholders/renovate/me.clip-placeholderapi-2.x
fix(deps): update dependency me.clip:placeholderapi to v2.11.6
2025-08-20 21:08:20 -05:00
renovate[bot] 1e41f17d91 chore(deps): update dependency xyz.jpenilla.run-velocity to v2.3.1 2025-08-20 07:08:25 +00:00
Adrian 3869ee4aa6 Merge pull request #35 from MiniPlaceholders/renovate/shadow
chore(deps): update dependency com.gradleup.shadow to v9.0.2
2025-08-20 02:07:59 -05:00
renovate[bot] 3ed2bc908a fix(deps): update dependency me.clip:placeholderapi to v2.11.6 2025-08-20 00:59:28 +00:00
renovate[bot] f1a0b1e3b9 chore(deps): update dependency com.gradleup.shadow to v9.0.2 2025-08-15 04:24:39 +00:00
renovate[bot] d2ce09cf94 chore(deps): update actions/checkout action to v5 2025-08-14 06:53:59 +00:00
Adrian Gonzales 87f19e62b0 feat!: Updated to MiniPlaceholders v3 2025-08-14 01:52:53 -05:00
21 changed files with 399 additions and 129 deletions

No files matched your search

-1
View File
@@ -1 +0,0 @@
.gitea/CODEOWNERS linguist-detectable=false
-3
View File
@@ -1,3 +0,0 @@
# Pull requests request review from the eligible staff team(s).
# One approval from either an Admin or Developer satisfies branch protection.
* @trueog/Admins @trueog/Developers
+30
View File
@@ -0,0 +1,30 @@
name: Java CI with Gradle
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
uses: nick-invision/retry@v3
with:
timeout_minutes: 5
max_attempts: 2
command: gradle build
+33 -16
View File
@@ -1,38 +1,55 @@
# PlaceholderAPI-Expansion
1.19.4 branch of PlaceholderAPI Expansion for MiniPlaceholders
# 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
## Supported Placeholder Providers
- [PlaceholderAPI](https://modrinth.com/plugin/placeholderapi) (Bukkit/Paper)
- [TextPlaceholderAPI](https://modrinth.com/mod/placeholder-api) (Fabric)
- [PAPIProxyBridge](https://modrinth.com/plugin/papiproxybridge) (Velocity)
> [!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
- `<placeholderapi_global:(placeholder)>`
### Global
- `<placeholder-adapter_global:(placeholder)>`
Velocity:
- `<placeholderapi_global:(placeholder):(expiry)>`
- `<placeholder-adapter_global:(placeholder):(expiry)>`
This placeholder does not require any player to work.
Its operation would be similar to running the command `/papi parse --null (placeholders)`
- `<placeholderapi_player:(placeholder)>`
### Audience
- `<placeholder-adapter_player:(placeholder)>`
Velocity:
- `<placeholderapi_player:(placeholder):(expiry)>`
- `<placeholder-adapter_player:(placeholder):(expiry)>`
This placeholder requires an online player to function.
Its operation would be similar to running the `/papi parse me (placeholders)` command
- `<placeholderapi_relational:(placeholder)>`
### 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:
- `<placeholderapi_relational:(placeholder):(expiry)>`
- `<placeholder-adapter_relational:(placeholder):(expiry)>`
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:
- `<placeholderapi_player:%player_name%:string>`
- `<placeholderapi_player:%player_name%:string:30000>`
## Downloads
[![](https://raw.githubusercontent.com/Prospector/badges/master/modrinth-badge-72h-padded.png)](https://modrinth.com/plugin/miniplaceholders-placeholderapi-expansion)
- `<placeholder-adapter_papi_player:%player_name%:string>`
- `<placeholder-adapter_player:%player_name%:string:30000>`
+19 -3
View File
@@ -1,12 +1,28 @@
plugins {
java
alias(libs.plugins.shadow)
eclipse
}
dependencies {
implementation(projects.placeholderapiExpansionPaper)
compileOnly(libs.adventure.api)
compileOnly(libs.miniplaceholders)
implementation(projects.placeholderAdapterExpansionPaper)
implementation(projects.placeholderAdapterExpansionVelocity)
implementation(projects.placeholderAdapterExpansionFabric) {
isTransitive = false
}
}
allprojects {
apply<JavaPlugin>()
tasks {
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(21)
}
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
tasks {
+13
View File
@@ -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)
}
@@ -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");
}
}
+2 -2
View File
@@ -1,3 +1,3 @@
group = io.github.miniplaceholders
version = 1.2.0
description = PlaceholderAPI-Expansion
version = 2.1.0-SNAPSHOT
description = PlaceholderAdapter-Expansion
+24 -10
View File
@@ -2,23 +2,37 @@ metadata.format.version = "1.1"
[versions]
velocity = "3.2.0-SNAPSHOT"
paper = "1.19.4-R0.1-SNAPSHOT"
velocity = "3.4.0-SNAPSHOT"
paper = "1.21.8-R0.1-SNAPSHOT"
blossom = "1.3.1"
shadow = "8.3.6"
runtask = "2.2.3"
blossom = "2.1.0"
shadow = "9.0.2"
runtask = "2.3.1"
miniplaceholders = "2.2.3"
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" }
proxybridge = "net.william278:papiproxybridge:1.4.2"
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]
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored Executable → Regular
+11 -14
View File
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -57,7 +55,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/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/.
@@ -85,8 +83,7 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +111,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -147,7 +144,7 @@ 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
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -155,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -204,16 +201,16 @@ fi
# 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, 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.
# 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.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
Vendored
+12 -14
View File
@@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
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
@@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
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=
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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%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
+1 -20
View File
@@ -2,27 +2,8 @@ plugins {
java
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
dependencies {
compileOnly(libs.paper.api)
compileOnly(libs.miniplaceholders)
compileOnly(libs.placeholderapi)
compileOnly(libs.placeholderapi.bukkit)
}
tasks {
processResources {
filesMatching("paper-plugin.yml") {
expand("version" to project.version)
}
}
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
@@ -1,26 +1,21 @@
package io.github.miniplaceholders.expansion.placeholderapi.paper;
import io.github.miniplaceholders.api.utils.LegacyUtils;
import me.clip.placeholderapi.PlaceholderAPI;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
package io.github.miniplaceholders.expansion.placeholderadapter.paper;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.LegacyStrings;
import me.clip.placeholderapi.PlaceholderAPI;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import org.bukkit.entity.Player;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.*;
import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.AMPERSAND_CHAR;
import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.SECTION_CHAR;
@SuppressWarnings("unused")
public final class PaperPlugin extends JavaPlugin {
public final class PaperPlatform {
@Override
public void onEnable(){
this.getSLF4JLogger().info("Starting PlaceholderAPI Expansion for MiniPlaceholders Paper");
Expansion.builder("placeholderapi")
.filter(Player.class)
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();
final String papiParsed = PlaceholderAPI.setPlaceholders(
@@ -29,43 +24,41 @@ public final class PaperPlugin extends JavaPlugin {
).replace(SECTION_CHAR, AMPERSAND_CHAR);
if (parseString(queue)) {
return Tag.preProcessParsed(miniMessage().serialize(LegacyUtils.parsePossibleLegacy(papiParsed)));
return Tag.preProcessParsed(miniMessage().serialize(LegacyStrings.parsePossibleLegacy(papiParsed)));
} else {
return Tag.selfClosingInserting(LegacyUtils.parsePossibleLegacy(papiParsed));
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
}
})
.audiencePlaceholder("player", (aud, queue, ctx) -> {
.audiencePlaceholder(Player.class, "player", (player, queue, ctx) -> {
final String argument = queue.popOr("You need to provide a placeholder").value();
final String papiParsed = PlaceholderAPI.setPlaceholders(
(Player)aud,
player,
argument
).replace(SECTION_CHAR, AMPERSAND_CHAR);
if (parseString(queue)) {
return Tag.preProcessParsed(miniMessage().serialize(LegacyUtils.parsePossibleLegacy(papiParsed)));
return Tag.preProcessParsed(miniMessage().serialize(LegacyStrings.parsePossibleLegacy(papiParsed)));
} else {
return Tag.selfClosingInserting(LegacyUtils.parsePossibleLegacy(papiParsed));
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
}
})
.relationalPlaceholder("relational", (player, toShow, queue, ctx) -> {
.relationalPlaceholder(Player.class, "relational", (player, toShow, queue, ctx) -> {
final String argument = queue.popOr("You need to provide a placeholder").value();
final String papiParsed = PlaceholderAPI.setRelationalPlaceholders(
(Player) player,
(Player) toShow,
player,
toShow,
argument
).replace(SECTION_CHAR, AMPERSAND_CHAR);
if (parseString(queue)) {
return Tag.preProcessParsed(miniMessage().serialize(LegacyUtils.parsePossibleLegacy(papiParsed)));
return Tag.preProcessParsed(miniMessage().serialize(LegacyStrings.parsePossibleLegacy(papiParsed)));
} else {
return Tag.selfClosingInserting(LegacyUtils.parsePossibleLegacy(papiParsed));
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
}
})
.build()
.register();
});
}
private boolean parseString(ArgumentQueue queue) {
private static boolean parseString(ArgumentQueue queue) {
return queue.hasNext() && queue.pop().lowerValue().equals("string");
}
}
-11
View File
@@ -1,11 +0,0 @@
name: PlaceholderAPI-Expansion
version: '${version}'
author: 4drian3d
main: io.github.miniplaceholders.expansion.placeholderapi.paper.PaperPlugin
api-version: '1.19'
folia-supported: true
dependencies:
- name: MiniPlaceholders
required: true
- name: PlaceholderAPI
required: true
+27 -4
View File
@@ -1,14 +1,37 @@
@file:Suppress("UnstableApiUsage")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
rootProject.name = "PlaceholderAdapter-Expansion"
dependencyResolutionManagement {
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://central.sonatype.com/repository/maven-snapshots/")
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 "0.8.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
id("fabric-loom") version "1.11.7"
}
arrayOf("paper").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)
}
@@ -0,0 +1,46 @@
package io.github.miniplaceholders.expansion.placeholderadapter;
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() {
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, Platform.FABRIC),
LoadRequirement.requiredComplement(
// Paper
"placeholderapi", "PlaceholderAPI",
// Velocity
"papiproxybridge",
// Fabric
"placeholder-api"
)
);
}
}
@@ -0,0 +1 @@
provider-class=io.github.miniplaceholders.expansion.placeholderadapter.AdapterExpansionProvider
+12
View File
@@ -0,0 +1,12 @@
plugins {
java
alias(libs.plugins.blossom)
}
dependencies {
compileOnly(libs.proxybridge)
compileOnly(libs.miniplaceholders)
compileOnly(libs.velocity.api)
annotationProcessor(libs.velocity.api)
}
@@ -0,0 +1,97 @@
package io.github.miniplaceholders.expansion.placeholderadapter.velocity;
import com.google.common.collect.Maps;
import com.velocitypowered.api.proxy.Player;
import io.github.miniplaceholders.api.Expansion;
import io.github.miniplaceholders.api.utils.LegacyStrings;
import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
import net.william278.papiproxybridge.api.PlaceholderAPI;
import java.util.OptionalInt;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import static net.kyori.adventure.text.minimessage.MiniMessage.miniMessage;
import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.AMPERSAND_CHAR;
import static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.SECTION_CHAR;
public final class VelocityPlatform {
private static final UUID NULL_UUID = UUID.randomUUID();
private static final PlaceholderAPI instance = PlaceholderAPI.createInstance();
private static final ConcurrentMap<Long, PlaceholderAPI> cachedInstances = Maps.newConcurrentMap();
private static PlaceholderAPI getAPI(ArgumentQueue queue) {
if (!queue.hasNext()) return instance;
OptionalInt optExpiry = queue.pop().asInt();
if (optExpiry.isEmpty()) return instance;
Long expiry = (long) optExpiry.getAsInt();
return cachedInstances.computeIfAbsent(expiry, (key) -> {
PlaceholderAPI api = PlaceholderAPI.createInstance();
api.setCacheExpiry(key);
return api;
});
}
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();
boolean isString = parseString(queue);
PlaceholderAPI api = getAPI(queue);
final String papiParsed = api
.formatPlaceholders(argument, NULL_UUID)
.completeOnTimeout(argument, 100, TimeUnit.MILLISECONDS)
.join()
.replace(SECTION_CHAR, AMPERSAND_CHAR);
if (isString) {
return Tag.preProcessParsed(miniMessage().serialize(LegacyStrings.parsePossibleLegacy(papiParsed)));
} else {
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
}
})
.audiencePlaceholder(Player.class, "player", (player, queue, ctx) -> {
final String argument = queue.popOr("You need to provide a placeholder").value();
boolean isString = parseString(queue);
PlaceholderAPI api = getAPI(queue);
final String papiParsed = api
.formatPlaceholders(argument, player.getUniqueId())
.completeOnTimeout(argument, 100, TimeUnit.MILLISECONDS)
.join()
.replace(SECTION_CHAR, AMPERSAND_CHAR);
if (isString) {
return Tag.preProcessParsed(miniMessage().serialize(LegacyStrings.parsePossibleLegacy(papiParsed)));
} else {
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
}
})
.relationalPlaceholder(Player.class, "relational", (player, playerToShow, queue, ctx) -> {
final String argument = queue.popOr("You need to provide a placeholder").value();
boolean isString = parseString(queue);
PlaceholderAPI api = getAPI(queue);
final String papiParsed = api
.formatPlaceholders(argument, player.getUniqueId(), playerToShow.getUniqueId())
.completeOnTimeout(argument, 100, TimeUnit.MILLISECONDS)
.join()
.replace(SECTION_CHAR, AMPERSAND_CHAR);
if (isString) {
return Tag.preProcessParsed(miniMessage().serialize(LegacyStrings.parsePossibleLegacy(papiParsed)));
} else {
return Tag.selfClosingInserting(LegacyStrings.parsePossibleLegacy(papiParsed));
}
});
}
private static boolean parseString(ArgumentQueue queue) {
//noinspection DataFlowIssue
boolean isString = queue.hasNext() && queue.peek().lowerValue().equals("string");
if (isString) queue.pop();
return isString;
}
}