Fix build
This commit is contained in:
1 parent
e2ac33849d
commit
3f3071444a
10 files changed
+37
-185
No files matched your search
+2
-1
@@ -1,11 +1,12 @@
|
||||
plugins {
|
||||
java
|
||||
alias(libs.plugins.shadow)
|
||||
eclipse
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.placeholderapiExpansionPaper)
|
||||
implementation(projects.placeholderapiExpansionVelocity)
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -3,10 +3,10 @@ metadata.format.version = "1.1"
|
||||
[versions]
|
||||
|
||||
velocity = "3.2.0-SNAPSHOT"
|
||||
paper = "1.19.3-R0.1-SNAPSHOT"
|
||||
paper = "1.19.4-R0.1-SNAPSHOT"
|
||||
|
||||
blossom = "1.3.1"
|
||||
shadow = "8.1.1"
|
||||
shadow = "8.3.6"
|
||||
runtask = "2.2.3"
|
||||
|
||||
miniplaceholders = "2.2.3"
|
||||
@@ -17,12 +17,12 @@ adventure = "4.13.1"
|
||||
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.5" }
|
||||
placeholderapi = { group = "me.clip", name = "placeholderapi", version = "2.11.6" }
|
||||
proxybridge = "net.william278:papiproxybridge:1.4.2"
|
||||
|
||||
[plugins]
|
||||
|
||||
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
|
||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||
runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
|
||||
runpaper = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
|
||||
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-8.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/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/.
|
||||
@@ -83,7 +85,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# 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
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -111,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -144,7 +147,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=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +155,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=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -201,16 +204,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 $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.
|
||||
# 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.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+14
-12
@@ -13,6 +13,8 @@
|
||||
@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 ##########################################################################
|
||||
@@ -43,11 +45,11 @@ 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.
|
||||
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
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,22 +59,22 @@ 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.
|
||||
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
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%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" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
||||
|
||||
arrayOf("paper", "velocity").forEach {
|
||||
arrayOf("paper").forEach {
|
||||
include("placeholderapi-expansion-$it")
|
||||
|
||||
project(":placeholderapi-expansion-$it").projectDir = file(it)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
alias(libs.plugins.blossom)
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://jitpack.io")
|
||||
maven("https://repo.william278.net/releases/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.proxybridge)
|
||||
compileOnly(libs.miniplaceholders)
|
||||
compileOnly(libs.velocity.api)
|
||||
annotationProcessor(libs.velocity.api)
|
||||
}
|
||||
|
||||
tasks {
|
||||
compileJava {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(17)
|
||||
}
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
|
||||
blossom {
|
||||
replaceTokenIn("src/main/java/io/github/miniplaceholders/expansion/placeholderapi/velocity/VelocityPlugin.java")
|
||||
replaceToken("{version}", project.version)
|
||||
}
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
package io.github.miniplaceholders.expansion.placeholderapi.velocity;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
import com.velocitypowered.api.plugin.Dependency;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import io.github.miniplaceholders.api.Expansion;
|
||||
import io.github.miniplaceholders.api.utils.LegacyUtils;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.ArgumentQueue;
|
||||
import net.william278.papiproxybridge.api.PlaceholderAPI;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
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;
|
||||
|
||||
@Plugin(
|
||||
id = "placeholderapi-expansion",
|
||||
name = "PlaceholderAPI Expansion",
|
||||
version = "{version}",
|
||||
authors = { "4drian3d" },
|
||||
dependencies = {
|
||||
@Dependency(id = "miniplaceholders"),
|
||||
@Dependency(id = "papiproxybridge")
|
||||
}
|
||||
)
|
||||
public final class VelocityPlugin {
|
||||
@Inject
|
||||
private Logger logger;
|
||||
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 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;
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
this.logger.info("Starting PlaceholderAPI Expansion for MiniPlaceholders Velocity");
|
||||
|
||||
Expansion.builder("placeholderapi")
|
||||
.filter(Player.class)
|
||||
.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(LegacyUtils.parsePossibleLegacy(papiParsed)));
|
||||
} else {
|
||||
return Tag.selfClosingInserting(LegacyUtils.parsePossibleLegacy(papiParsed));
|
||||
}
|
||||
})
|
||||
.audiencePlaceholder("player", (aud, queue, ctx) -> {
|
||||
final String argument = queue.popOr("You need to provide a placeholder").value();
|
||||
final Player player = (Player)aud;
|
||||
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(LegacyUtils.parsePossibleLegacy(papiParsed)));
|
||||
} else {
|
||||
return Tag.selfClosingInserting(LegacyUtils.parsePossibleLegacy(papiParsed));
|
||||
}
|
||||
})
|
||||
.relationalPlaceholder("relational", (audience, audienceToShow, queue, ctx) -> {
|
||||
final String argument = queue.popOr("You need to provide a placeholder").value();
|
||||
final Player player = (Player) audience;
|
||||
final Player toShow = (Player) audienceToShow;
|
||||
boolean isString = parseString(queue);
|
||||
PlaceholderAPI api = getAPI(queue);
|
||||
final String papiParsed = api
|
||||
.formatPlaceholders(argument, player.getUniqueId(), toShow.getUniqueId())
|
||||
.completeOnTimeout(argument, 100, TimeUnit.MILLISECONDS)
|
||||
.join()
|
||||
.replace(SECTION_CHAR, AMPERSAND_CHAR);
|
||||
|
||||
if (isString) {
|
||||
return Tag.preProcessParsed(miniMessage().serialize(LegacyUtils.parsePossibleLegacy(papiParsed)));
|
||||
} else {
|
||||
return Tag.selfClosingInserting(LegacyUtils.parsePossibleLegacy(papiParsed));
|
||||
}
|
||||
})
|
||||
.build()
|
||||
.register();
|
||||
}
|
||||
|
||||
private boolean parseString(ArgumentQueue queue) {
|
||||
boolean isString = queue.hasNext() && queue.peek().lowerValue().equals("string");
|
||||
if (isString) queue.pop();
|
||||
return isString;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user