mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 05:17:05 +02:00
Compare commits
42 Commits
developmen
...
feature/mo
Author | SHA1 | Date | |
---|---|---|---|
|
46f91f5f11 | ||
|
9ae44a3954 | ||
|
883f1c1edf | ||
|
37c39ab734 | ||
|
35c47a8745 | ||
|
fadf14a316 | ||
|
1388a5278f | ||
|
bb149811d4 | ||
|
350a2be0ed | ||
|
b73d72cec7 | ||
|
7afb8ee36d | ||
|
1241c33ba0 | ||
|
fe8d865657 | ||
|
50d4e14333 | ||
|
666ab468a1 | ||
|
cd9074203c | ||
|
38d77ff4ca | ||
|
3ccbbe9c20 | ||
|
358a3bcab3 | ||
|
ca088227c3 | ||
|
850633e792 | ||
|
348b075ac5 | ||
|
ce18d3b597 | ||
|
9d66d9d9a1 | ||
|
5fe9389dda | ||
|
e25a28b2a5 | ||
|
cfd289939e | ||
|
d168be94b1 | ||
|
511717a8d6 | ||
|
18fb194ce6 | ||
|
e11d551071 | ||
|
020f14d82c | ||
|
acb5728e65 | ||
|
cc235cfc01 | ||
|
31deef2a62 | ||
|
3ba29f1147 | ||
|
e969f37405 | ||
|
38099198d6 | ||
|
fe0bb12d53 | ||
|
721904335d | ||
|
d79f9725bd | ||
|
b4f6831e54 |
12
.github/label-commenter-config.yml
vendored
12
.github/label-commenter-config.yml
vendored
@@ -38,8 +38,9 @@ labels:
|
||||
- Currently used Versions of your server and PlaceholderAPI
|
||||
- Currently installed Expansions
|
||||
- Currently installed Plugins
|
||||
- Any additional information requested by users in this issue.
|
||||
|
||||
The easiest way to provide those information is through the `/papi dumb` command which posts the required information to https://paste.helpch.at and gives a URL to share.
|
||||
The easiest way to provide those information is through the `/papi dump` command which posts the required information to https://paste.helpch.at and gives a URL to share.
|
||||
unlabeled:
|
||||
issue:
|
||||
body: |-
|
||||
@@ -76,6 +77,15 @@ labels:
|
||||
|
||||
Don't hesitate to ask us any questions.
|
||||
action: close
|
||||
- name: 'Type: Invalid (Wiki)'
|
||||
labeled:
|
||||
pr:
|
||||
body: |-
|
||||
Your Wiki Pull request has been marked as **invalid**.
|
||||
|
||||
Pull requests targeting the wiki need to be based of and target the `docs/wiki` branch of this repository.
|
||||
More information can be found on the [Wiki README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md).
|
||||
action: close
|
||||
- name: 'Target: Wiki'
|
||||
labeled:
|
||||
issue:
|
||||
|
@@ -28,9 +28,9 @@
|
||||
# Information
|
||||
[PlaceholderAPI][spigot] is a plugin for Spigot servers that allows server owners to display information from various plugins with a uniform format.
|
||||
|
||||
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 150+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
|
||||
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 240+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
|
||||
|
||||
PlaceholderAPI has been downloaded over 750,000 times and has been used concurrently on over 35,000 servers, which makes it a must-have for a server of any type or scale.
|
||||
PlaceholderAPI has been downloaded over 1,000,000 times and has been used concurrently on over 40,000 servers, which makes it a must-have for a server of any type or scale.
|
||||
|
||||
## Contribute
|
||||
If you would like to contribute towards PlaceholderAPI should you take a look at our [Contributing file][contributing] for the ins and outs on how you can do that and what you need to keep in mind.
|
||||
|
23
build.gradle
23
build.gradle
@@ -3,12 +3,12 @@ import org.apache.tools.ant.filters.ReplaceTokens
|
||||
plugins {
|
||||
id "java"
|
||||
id "maven-publish"
|
||||
id "org.cadixdev.licenser" version "0.6.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "org.cadixdev.licenser" version "0.6.1"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||
}
|
||||
|
||||
group "me.clip"
|
||||
version "2.10.10-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||
version "2.11.2-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||
|
||||
description "An awesome placeholder provider!"
|
||||
|
||||
@@ -18,23 +18,22 @@ repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
|
||||
maven({ url = "https://repo.codemc.org/repository/maven-public" })
|
||||
maven({ url = "https://repo.codemc.org/repository/maven-public/" })
|
||||
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.bstats:bstats-bukkit:2.2.1"
|
||||
implementation "net.kyori:adventure-platform-bukkit:4.0.1"
|
||||
|
||||
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"
|
||||
compileOnly "org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT"
|
||||
compileOnly "org.jetbrains:annotations:22.0.0"
|
||||
|
||||
compileOnly "org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT"
|
||||
compileOnly "org.jetbrains:annotations:19.0.0"
|
||||
testImplementation "org.openjdk.jmh:jmh-core:1.32"
|
||||
testImplementation "org.openjdk.jmh:jmh-generator-annprocess:1.32"
|
||||
|
||||
testImplementation "org.openjdk.jmh:jmh-core:1.23"
|
||||
testImplementation "org.openjdk.jmh:jmh-generator-annprocess:1.23"
|
||||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.8.2"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.1"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
269
gradlew
vendored
269
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright <20> 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,67 +17,101 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions <20>$var<61>, <20>${var}<7D>, <20>${var:-default}<7D>, <20>${var+SET}<7D>,
|
||||
# <20>${var#prefix}<7D>, <20>${var%suffix}<7D>, and <20>$( cmd )<29>;
|
||||
# * compound commands having a testable exit status, especially <20>case<73>;
|
||||
# * various built-in commands including <20>command<6E>, <20>set<65>, and <20>ulimit<69>.
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -106,80 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -22,6 +22,7 @@ package me.clip.placeholderapi;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -81,7 +82,7 @@ public final class PlaceholderAPI {
|
||||
*/
|
||||
@NotNull
|
||||
public static List<String> setPlaceholders(final OfflinePlayer player,
|
||||
@NotNull final List<@NotNull String> text) {
|
||||
@NotNull final List<String> text) {
|
||||
return text.stream().map(line -> setPlaceholders(player, line)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ public final class PlaceholderAPI {
|
||||
*/
|
||||
@NotNull
|
||||
public static List<String> setBracketPlaceholders(final OfflinePlayer player,
|
||||
@NotNull final List<@NotNull String> text) {
|
||||
@NotNull final List<String> text) {
|
||||
return text.stream().map(line -> setBracketPlaceholders(player, line))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@@ -185,7 +186,7 @@ public final class PlaceholderAPI {
|
||||
continue;
|
||||
}
|
||||
|
||||
String identifier = format.substring(0, index).toLowerCase();
|
||||
String identifier = format.substring(0, index).toLowerCase(Locale.ROOT);
|
||||
String params = format.substring(index + 1);
|
||||
final PlaceholderExpansion expansion = PlaceholderAPIPlugin.getInstance()
|
||||
.getLocalExpansionManager().getExpansion(identifier);
|
||||
@@ -292,14 +293,14 @@ public final class PlaceholderAPI {
|
||||
// === Deprecated API ===
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static boolean registerExpansion(PlaceholderExpansion expansion)
|
||||
{
|
||||
return expansion.register();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static boolean unregisterExpansion(PlaceholderExpansion expansion)
|
||||
{
|
||||
return expansion.unregister();
|
||||
@@ -313,7 +314,7 @@ public final class PlaceholderAPI {
|
||||
* @return Map of registered placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static Map<String, PlaceholderHook> getPlaceholders() {
|
||||
return PlaceholderAPIPlugin.getInstance().getLocalExpansionManager()
|
||||
.getExpansions().stream()
|
||||
@@ -329,7 +330,7 @@ public final class PlaceholderAPI {
|
||||
* @return always false
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static boolean registerPlaceholderHook(Plugin plugin, PlaceholderHook placeholderHook) {
|
||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
|
||||
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!"
|
||||
@@ -347,7 +348,7 @@ public final class PlaceholderAPI {
|
||||
* @return always false
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static boolean registerPlaceholderHook(String identifier,
|
||||
PlaceholderHook placeholderHook) {
|
||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
|
||||
@@ -363,7 +364,7 @@ public final class PlaceholderAPI {
|
||||
* @return always false
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static boolean unregisterPlaceholderHook(Plugin plugin) {
|
||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
|
||||
+ " is attempting to unregister placeholders via the PlaceholderAPI class which is no longer supported!"
|
||||
@@ -380,7 +381,7 @@ public final class PlaceholderAPI {
|
||||
* @return always false
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static boolean unregisterPlaceholderHook(String identifier) {
|
||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
|
||||
+ " is attempting to unregister placeholders through the PlaceholderAPI class which is no longer supported!");
|
||||
@@ -393,7 +394,7 @@ public final class PlaceholderAPI {
|
||||
* @return Set of registered identifiers
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static Set<String> getRegisteredPlaceholderPlugins() {
|
||||
return getRegisteredIdentifiers();
|
||||
}
|
||||
@@ -404,7 +405,7 @@ public final class PlaceholderAPI {
|
||||
* @return always null
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static Set<String> getExternalPlaceholderPlugins() {
|
||||
return null;
|
||||
}
|
||||
@@ -419,7 +420,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setPlaceholders(OfflinePlayer player,
|
||||
String text, Pattern pattern, boolean colorize) {
|
||||
return setPlaceholders(player, text);
|
||||
@@ -435,7 +436,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setPlaceholders(OfflinePlayer player,
|
||||
List<String> text, Pattern pattern, boolean colorize) {
|
||||
return setPlaceholders(player, text);
|
||||
@@ -450,7 +451,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
|
||||
boolean colorize) {
|
||||
return setPlaceholders(player, text);
|
||||
@@ -465,7 +466,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
|
||||
Pattern pattern) {
|
||||
return setPlaceholders(player, text);
|
||||
@@ -479,7 +480,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setPlaceholders(Player player, String text, boolean colorize) {
|
||||
return setPlaceholders(player, text);
|
||||
}
|
||||
@@ -493,7 +494,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setPlaceholders(Player player, List<String> text, boolean colorize) {
|
||||
return setPlaceholders(player, text);
|
||||
}
|
||||
@@ -507,7 +508,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setPlaceholders(OfflinePlayer player, String text, boolean colorize) {
|
||||
return setPlaceholders(player, text);
|
||||
}
|
||||
@@ -521,7 +522,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setPlaceholders(OfflinePlayer player, String text, Pattern pattern) {
|
||||
return setPlaceholders(player, text);
|
||||
}
|
||||
@@ -535,7 +536,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setBracketPlaceholders(OfflinePlayer player, List<String> text,
|
||||
boolean colorize) {
|
||||
return setBracketPlaceholders(player, text);
|
||||
@@ -550,7 +551,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setBracketPlaceholders(OfflinePlayer player, String text, boolean colorize) {
|
||||
return setBracketPlaceholders(player, text);
|
||||
}
|
||||
@@ -564,7 +565,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setBracketPlaceholders(Player player, String text, boolean colorize) {
|
||||
return setBracketPlaceholders(player, text);
|
||||
}
|
||||
@@ -578,7 +579,7 @@ public final class PlaceholderAPI {
|
||||
* @return String with the parsed placeholders
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setBracketPlaceholders(Player player, List<String> text,
|
||||
boolean colorize) {
|
||||
return setBracketPlaceholders(player, text);
|
||||
@@ -596,7 +597,7 @@ public final class PlaceholderAPI {
|
||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static String setRelationalPlaceholders(Player one, Player two, String text,
|
||||
boolean colorize) {
|
||||
return setRelationalPlaceholders(one, two, text);
|
||||
@@ -614,7 +615,7 @@ public final class PlaceholderAPI {
|
||||
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public static List<String> setRelationalPlaceholders(Player one, Player two, List<String> text,
|
||||
boolean colorize) {
|
||||
return setRelationalPlaceholders(one, two, text);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -33,7 +33,6 @@ import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
||||
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.serializer.craftbukkit.MinecraftComponentSerializer;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.AdvancedPie;
|
||||
import org.bstats.charts.SimplePie;
|
||||
@@ -249,7 +248,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
||||
try {
|
||||
Class.forName("org.bukkit.event.server.ServerLoadEvent");
|
||||
new ServerLoadEventListener(this);
|
||||
} catch (final ExceptionInInitializerError | ClassNotFoundException ignored) {
|
||||
} catch (final ClassNotFoundException ignored) {
|
||||
Bukkit.getScheduler()
|
||||
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -25,9 +25,22 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Deprecated
|
||||
public abstract class PlaceholderHook {
|
||||
|
||||
/**
|
||||
* Please see {@link me.clip.placeholderapi.expansion.PlaceholderExpansion#parsePlaceholders(OfflinePlayer, String) PlaceholderExpansion#parsePlaceholder(OfflinePlayer, String)}
|
||||
* for a full description of what this method is used for.
|
||||
*
|
||||
* @param player Possibly-null OfflinePlayer instance to use.
|
||||
* @param params String after {@code %<expansion>_} and before the second percent symbol.
|
||||
* @return Possibly-null String depending on the Expansions returned value.
|
||||
* @deprecated Planned for removal in 2.14.0
|
||||
* <br>Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion#parsePlaceholders(OfflinePlayer, String) parsePlaceholders(OfflinePlayer, String)}
|
||||
* instead
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
|
||||
if (player != null && player.isOnline()) {
|
||||
return onPlaceholderRequest((Player) player, params);
|
||||
@@ -36,7 +49,20 @@ public abstract class PlaceholderHook {
|
||||
return onPlaceholderRequest(null, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Please see {@link me.clip.placeholderapi.expansion.PlaceholderExpansion#parsePlaceholders(Player, String) PlaceholderExpansion#parsePlaceholder(Player, String)}
|
||||
* for a full description of what this method is used for.
|
||||
*
|
||||
* @param player Possibly-null Player instance to use.
|
||||
* @param params String after {@code %<expansion>_} and before the second percent symbol.
|
||||
* @return Possibly-null String depending on the Expansions returned value.
|
||||
*
|
||||
* @deprecated Planned for removal in 2.14.0
|
||||
* <br>Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion#parsePlaceholders(Player, String) parsePlaceholders(Player, String)}
|
||||
* instead
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
public String onPlaceholderRequest(final Player player, @NotNull final String params) {
|
||||
return null;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -23,6 +23,7 @@ package me.clip.placeholderapi.commands;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
@@ -61,7 +62,7 @@ public abstract class PlaceholderCommand {
|
||||
if (parameter == null) {
|
||||
possible.forEach(suggestions::add);
|
||||
} else {
|
||||
possible.filter(suggestion -> suggestion.toLowerCase().startsWith(parameter.toLowerCase()))
|
||||
possible.filter(suggestion -> suggestion.toLowerCase(Locale.ROOT).startsWith(parameter.toLowerCase(Locale.ROOT)))
|
||||
.forEach(suggestions::add);
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -27,6 +27,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
@@ -95,7 +96,7 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
|
||||
return true;
|
||||
}
|
||||
|
||||
final String search = args[0].toLowerCase();
|
||||
final String search = args[0].toLowerCase(Locale.ROOT);
|
||||
final PlaceholderCommand target = commands.get(search);
|
||||
|
||||
if (target == null) {
|
||||
@@ -121,10 +122,10 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
|
||||
final List<String> suggestions = new ArrayList<>();
|
||||
|
||||
if (args.length > 1) {
|
||||
final PlaceholderCommand target = this.commands.get(args[0].toLowerCase());
|
||||
final PlaceholderCommand target = this.commands.get(args[0].toLowerCase(Locale.ROOT));
|
||||
|
||||
if (target != null) {
|
||||
target.complete(plugin, sender, args[0].toLowerCase(),
|
||||
target.complete(plugin, sender, args[0].toLowerCase(Locale.ROOT),
|
||||
Arrays.asList(Arrays.copyOfRange(args, 1, args.length)), suggestions);
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -24,6 +24,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
@@ -100,7 +101,7 @@ public final class CommandECloud extends PlaceholderCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
final String search = params.get(0).toLowerCase();
|
||||
final String search = params.get(0).toLowerCase(Locale.ROOT);
|
||||
final PlaceholderCommand target = commands.get(search);
|
||||
|
||||
if (target == null) {
|
||||
@@ -136,7 +137,7 @@ public final class CommandECloud extends PlaceholderCommand {
|
||||
return; // send sub commands
|
||||
}
|
||||
|
||||
final String search = params.get(0).toLowerCase();
|
||||
final String search = params.get(0).toLowerCase(Locale.ROOT);
|
||||
final PlaceholderCommand target = commands.get(search);
|
||||
|
||||
if (target == null) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -87,7 +87,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
||||
@NotNull
|
||||
private static Collection<CloudExpansion> getExpansions(@NotNull final String target,
|
||||
@NotNull final PlaceholderAPIPlugin plugin) {
|
||||
switch (target.toLowerCase()) {
|
||||
switch (target.toLowerCase(Locale.ROOT)) {
|
||||
case "all":
|
||||
return plugin.getCloudExpansionManager().getCloudExpansions().values();
|
||||
case "installed":
|
||||
@@ -112,7 +112,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
||||
|
||||
public static void addExpansionTitle(@NotNull final StringBuilder builder,
|
||||
@NotNull final String target, final int page) {
|
||||
switch (target.toLowerCase()) {
|
||||
switch (target.toLowerCase(Locale.ROOT)) {
|
||||
case "all":
|
||||
builder.append("&bAll Expansions");
|
||||
break;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -21,6 +21,8 @@
|
||||
package me.clip.placeholderapi.commands.impl.cloud;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
@@ -41,7 +43,7 @@ public final class CommandECloudToggle extends PlaceholderCommand {
|
||||
final boolean desiredState;
|
||||
final boolean currentState = plugin.getPlaceholderAPIConfig().isCloudEnabled();
|
||||
|
||||
switch (alias.toLowerCase()) {
|
||||
switch (alias.toLowerCase(Locale.ROOT)) {
|
||||
case "enable":
|
||||
desiredState = true;
|
||||
break;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -23,6 +23,7 @@ package me.clip.placeholderapi.commands.impl.cloud;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -128,7 +129,7 @@ public final class CommandECloudUpdate extends PlaceholderCommand {
|
||||
installed.removeIf(expansion -> !expansion.shouldUpdate());
|
||||
|
||||
if (!installed.isEmpty() && (params.isEmpty() || "all"
|
||||
.startsWith(params.get(0).toLowerCase()))) {
|
||||
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
|
||||
suggestions.add("all");
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -165,7 +165,7 @@ public final class CommandDump extends PlaceholderCommand {
|
||||
|
||||
final String[] jars = plugin.getLocalExpansionManager()
|
||||
.getExpansionsFolder()
|
||||
.list((dir, name) -> name.toLowerCase().endsWith(".jar"));
|
||||
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
|
||||
|
||||
for (final String jar : jars) {
|
||||
builder.append(" ")
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -45,9 +45,9 @@ public final class CommandHelp extends PlaceholderCommand {
|
||||
Msg.msg(sender,
|
||||
"&b&lPlaceholderAPI &8- &7Help Menu &8- &7(&f" + description.getVersion() + "&7)",
|
||||
" ",
|
||||
"&b/papi &fbcparse &9<me/player name> <message>",
|
||||
"&b/papi &fbcparse &9<me|--null|player name> <message>",
|
||||
" &7&oParse a message with placeholders and broadcast it",
|
||||
"&b/papi &fcmdparse &9<me/player> <command with placeholders>",
|
||||
"&b/papi &fcmdparse &9<me|player> <command with placeholders>",
|
||||
" &7&oParse a message with relational placeholders",
|
||||
"&b/papi &fdump",
|
||||
" &7&oDump all relevant information needed to help debug issues into a paste link.",
|
||||
@@ -55,7 +55,7 @@ public final class CommandHelp extends PlaceholderCommand {
|
||||
" &7&oView information for a specific expansion",
|
||||
"&b/papi &flist",
|
||||
" &7&oList active expansions",
|
||||
"&b/papi &fparse &9<me/player name> <message>",
|
||||
"&b/papi &fparse &9<me|--null|player name> <message>",
|
||||
" &7&oParse a message with placeholders",
|
||||
"&b/papi &fparserel &9<player one> <player two> <message>",
|
||||
" &7&oParse a message with relational placeholders",
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -22,6 +22,7 @@ package me.clip.placeholderapi.commands.impl.local;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
@@ -49,7 +50,7 @@ public final class CommandParse extends PlaceholderCommand {
|
||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||
@NotNull @Unmodifiable final List<String> params) {
|
||||
switch (alias.toLowerCase()) {
|
||||
switch (alias.toLowerCase(Locale.ROOT)) {
|
||||
case "parserel":
|
||||
evaluateParseRelation(sender, params);
|
||||
break;
|
||||
@@ -69,7 +70,7 @@ public final class CommandParse extends PlaceholderCommand {
|
||||
public void complete(@NotNull final PlaceholderAPIPlugin plugin,
|
||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
||||
switch (alias.toLowerCase()) {
|
||||
switch (alias.toLowerCase(Locale.ROOT)) {
|
||||
case "parserel":
|
||||
completeParseRelation(params, suggestions);
|
||||
break;
|
||||
@@ -92,7 +93,7 @@ public final class CommandParse extends PlaceholderCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
@NotNull final OfflinePlayer player;
|
||||
OfflinePlayer player;
|
||||
|
||||
if ("me".equalsIgnoreCase(params.get(0))) {
|
||||
if (!(sender instanceof Player)) {
|
||||
@@ -101,6 +102,8 @@ public final class CommandParse extends PlaceholderCommand {
|
||||
}
|
||||
|
||||
player = ((Player) sender);
|
||||
} else if ("--null".equalsIgnoreCase(params.get(0))) {
|
||||
player = null;
|
||||
} else {
|
||||
final OfflinePlayer target = resolvePlayer(params.get(0));
|
||||
if (target == null) {
|
||||
@@ -161,10 +164,14 @@ public final class CommandParse extends PlaceholderCommand {
|
||||
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
||||
if (params.size() <= 1) {
|
||||
if (sender instanceof Player && (params.isEmpty() || "me"
|
||||
.startsWith(params.get(0).toLowerCase()))) {
|
||||
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
|
||||
suggestions.add("me");
|
||||
}
|
||||
|
||||
if ("--null".startsWith(params.get(0).toLowerCase(Locale.ROOT))) {
|
||||
suggestions.add("--null");
|
||||
}
|
||||
|
||||
final Stream<String> names = Bukkit.getOnlinePlayers().stream().map(Player::getName);
|
||||
suggestByParameter(names, suggestions, params.isEmpty() ? null : params.get(0));
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -27,8 +27,11 @@ import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Indicates that a {@link PlaceholderExpansion} has been registered by
|
||||
* PlaceholderAPI.
|
||||
* This event indicates that a <b>single</b> {@link PlaceholderExpansion PlaceholderExpansion} has
|
||||
* been registered in PlaceholderAPI.
|
||||
*
|
||||
* <p>To know when <b>all</b> Expansions have been registered, use the
|
||||
* {@link me.clip.placeholderapi.events.ExpansionsLoadedEvent ExpansionsLoadedEvent} instead.
|
||||
*/
|
||||
public final class ExpansionRegisterEvent extends Event implements Cancellable {
|
||||
|
||||
@@ -48,15 +51,25 @@ public final class ExpansionRegisterEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link PlaceholderExpansion expansion} that was registered.
|
||||
* The {@link PlaceholderExpansion PlaceholderExpansion} that was registered in PlaceholderAPI.
|
||||
* <br>The PlaceholderExpansion will be available for use when the event
|
||||
* {@link #isCancelled() was not cancelled}!
|
||||
*
|
||||
* @return The {@link PlaceholderExpansion} instance.
|
||||
* @return Current instance of the registered {@link PlaceholderExpansion PlaceholderExpansion}
|
||||
*/
|
||||
@NotNull
|
||||
public PlaceholderExpansion getExpansion() {
|
||||
return expansion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if this event was cancelled or not.
|
||||
* <br>A cancelled Event will result in the {@link #getExpansion() PlaceholderExpansion} NOT
|
||||
* being added to PlaceholderAPI's internal list and will therefore be considered not registered
|
||||
* anymore.
|
||||
*
|
||||
* @return Whether the event has been cancelled or not.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -26,15 +26,19 @@ import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Indicates that a {@link PlaceholderExpansion} had been unregistered by
|
||||
* PlaceholderAPI.
|
||||
* This event indicates that a {@link PlaceholderExpansion PlaceholderExpansion} has been
|
||||
* unregistered by PlaceholderAPI.
|
||||
*
|
||||
* <p>Note that this event is triggered <b>before</b> the PlaceholderExpansion is completely
|
||||
* removed.
|
||||
* <br>This includes removing any Listeners, stopping active tasks and clearing the cache of
|
||||
* the PlaceholderExpansion.
|
||||
*/
|
||||
public final class ExpansionUnregisterEvent extends Event {
|
||||
|
||||
@NotNull
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
|
||||
|
||||
@NotNull
|
||||
private final PlaceholderExpansion expansion;
|
||||
|
||||
@@ -48,9 +52,9 @@ public final class ExpansionUnregisterEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@link PlaceholderExpansion expansion} that was unregistered.
|
||||
* The {@link PlaceholderExpansion PlaceholderExpansion} that was unregistered.
|
||||
*
|
||||
* @return The {@link PlaceholderExpansion} instance.
|
||||
* @return The {@link PlaceholderExpansion PlaceholderExpansion} instance.
|
||||
*/
|
||||
@NotNull
|
||||
public PlaceholderExpansion getExpansion() {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -21,18 +21,42 @@
|
||||
package me.clip.placeholderapi.events;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Indicates that <b>all</b> {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlayceholderExpansions}
|
||||
* have been loaded.
|
||||
* <br/>This event is fired on Server load and when reloading the
|
||||
* confiuration.
|
||||
* This event indicated that <b>all</b> {@link PlaceholderExpansion PlaceholderExpansions} have
|
||||
* been registered in PlaceholderAPI and can now be used.
|
||||
* <br>This even will also be triggered whenever PlaceholderAPI gets reloaded.
|
||||
*
|
||||
* <p>All PlaceholderExpansions, except for those loaded by plugins, are loaded
|
||||
* after Spigot triggered its ServerLoadEvent (1.13+), or after PlaceholderAPI has been enabled.
|
||||
*/
|
||||
public class ExpansionsLoadedEvent extends Event {
|
||||
|
||||
private final List<PlaceholderExpansion> expansions;
|
||||
|
||||
public ExpansionsLoadedEvent(List<PlaceholderExpansion> expansions) {
|
||||
this.expansions = Collections.unmodifiableList(expansions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unmodifiable list of {@link PlaceholderExpansion PlaceholderExpansions} that
|
||||
* have been registered by PlaceholderAPI.
|
||||
*
|
||||
* <p><b>This list does not include manually registered PlaceholderExpansions.</b>
|
||||
*
|
||||
* @return List of {@link PlaceholderExpansion registered PlaceholderExpansions}.
|
||||
*/
|
||||
@NotNull
|
||||
public final List<PlaceholderExpansion> getExpansions(){
|
||||
return expansions;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -21,9 +21,11 @@
|
||||
package me.clip.placeholderapi.expansion;
|
||||
|
||||
/**
|
||||
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the clear
|
||||
* method called when the implementing expansion is unregistered from PlaceholderAPI. This is useful
|
||||
* if we want to do things when the implementing hook is unregistered
|
||||
* Classes implementing this interface will have a {@link #clear() clear void} that is called
|
||||
* by PlaceholderAPI whenever the {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
|
||||
* is unregistered.
|
||||
*
|
||||
* <p>This allows you to execute things such as clearing internal caches, saving data to files, etc.
|
||||
*
|
||||
* @author Ryan McCarthy
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -23,9 +23,11 @@ package me.clip.placeholderapi.expansion;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the cleanup
|
||||
* method called every time a player leaves the server. This is useful if we want to clean up after
|
||||
* the player
|
||||
* Classes implementing this interface will have a {@link #cleanup(Player) cleanup void} that is
|
||||
* called by PlaceholderAPI whenever a Player leaves the server.
|
||||
*
|
||||
* <p>This can be useful for cases where you keep data of the player in a cache or similar
|
||||
* and want to free up space whenever they leave.
|
||||
*
|
||||
* @author Ryan McCarthy
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -23,18 +23,32 @@ package me.clip.placeholderapi.expansion;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Any {@link PlaceholderExpansion} class which implements configurable will have any options listed
|
||||
* in the {@link #getDefaults()} map automatically added to the PlaceholderAPI config.yml file
|
||||
* Implementing this interface allows {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansions}
|
||||
* to set a list of default configuration values through the {@link #getDefaults() getDefaults method}
|
||||
* that should be added to the config.yml of PlaceholderAPI.
|
||||
*
|
||||
* <p>The entries will be added under {@code expansions} as their own section.
|
||||
* <h2>Example:</h2>
|
||||
* returning a Map with key {@code foo} and value {@code bar} will result in the following config entry:
|
||||
*
|
||||
* <pre><code>
|
||||
* expansions:
|
||||
* myexpansion:
|
||||
* foo: "bar"
|
||||
* </code></pre>
|
||||
*
|
||||
* <p><b>The configuration is set before the PlaceholderExpansion is registered!</b>
|
||||
*
|
||||
* @author Ryan McCarthy
|
||||
*/
|
||||
public interface Configurable {
|
||||
|
||||
/**
|
||||
* This method will be called before the implementing class is registered to obtain a map of
|
||||
* configuration options that the implementing class needs These paths and values will be added to
|
||||
* the PlaceholderAPI config.yml in the configuration section expansions.(placeholder
|
||||
* identifier).(your key): (your value)
|
||||
* The map returned by this method will be used to set config options in PlaceholderAPI's config.yml.
|
||||
*
|
||||
* <p>The key and value pairs are set under a section named after your
|
||||
* {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion} in the
|
||||
* {@code expansions} section of the config.
|
||||
*
|
||||
* @return Map of config path / values which need to be added / removed from the PlaceholderAPI
|
||||
* config.yml file
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -42,7 +42,8 @@ public enum NMSVersion {
|
||||
SPIGOT_1_16_R1("v1_16_R1"),
|
||||
SPIGOT_1_16_R2("v1_16_R2"),
|
||||
SPIGOT_1_16_R3("v1_16_R3"),
|
||||
SPIGOT_1_17_R1("v1_17_R1");
|
||||
SPIGOT_1_17_R1("v1_17_R1"),
|
||||
SPIGOT_1_18_R1("v1_18_R1");
|
||||
|
||||
private final String version;
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -22,10 +22,13 @@ package me.clip.placeholderapi.expansion;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.PlaceholderHook;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -275,7 +278,6 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
* @param def The default boolean to return when the ConfigurationSection is null
|
||||
* @return boolean from the provided path or the default one provided
|
||||
*/
|
||||
@NotNull
|
||||
public final boolean getBoolean(@NotNull final String path, final boolean def) {
|
||||
final ConfigurationSection section = getConfigSection();
|
||||
return section == null ? def : section.getBoolean(path, def);
|
||||
@@ -294,6 +296,71 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
return section != null && section.contains(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the provided message with the provided Level in the console.
|
||||
* <br>The message will be prefixed with {@link #getName() <code>[<expansion name>]</code>}
|
||||
*
|
||||
* @param level The Level at which the message should be logged with
|
||||
* @param msg The message to log
|
||||
*/
|
||||
public void log(Level level, String msg) {
|
||||
getPlaceholderAPI().getLogger().log(level, "[" + getName() + "] " + msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the provided message and Throwable with the provided Level in the console.
|
||||
* <br>The message will be prefixed with {@link #getName() <code>[<expansion name>]</code>}
|
||||
*
|
||||
* @param level The Level at which the message should be logged with
|
||||
* @param msg The message to log
|
||||
* @param throwable The Throwable to log
|
||||
*/
|
||||
public void log(Level level, String msg, Throwable throwable) {
|
||||
getPlaceholderAPI().getLogger().log(level, "[" + getName() + "] " + msg, throwable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the provided message with Level "info".
|
||||
* <br>The message will be prefixed with {@link #getName() <code>[<expansion name>]</code>}
|
||||
*
|
||||
* @param msg The message to log
|
||||
*/
|
||||
public void info(String msg) {
|
||||
log(Level.INFO, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the provided message with Level "warning".
|
||||
* <br>The message will be prefixed with {@link #getName() <code>[<expansion name>]</code>}
|
||||
*
|
||||
* @param msg The message to log
|
||||
*/
|
||||
public void warning(String msg) {
|
||||
log(Level.WARNING, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the provided message with Level "severe" (error).
|
||||
* <br>The message will be prefixed with {@link #getName() <code>[<expansion name>]</code>}
|
||||
*
|
||||
* @param msg The message to log
|
||||
*/
|
||||
public void severe(String msg) {
|
||||
log(Level.SEVERE, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the provided message and Throwable with Level "severe" (error).
|
||||
* <br>The message will be prefixed with {@link #getName() <code>[<expansion name>]</code>}
|
||||
*
|
||||
* @param msg The message to log
|
||||
* @param throwable The Throwable to log
|
||||
*/
|
||||
public void severe(String msg, Throwable throwable) {
|
||||
log(Level.SEVERE, msg, throwable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Whether the provided Object is an instance of this PlaceholderExpansion.
|
||||
* <br>This method will perform the following checks in order:
|
||||
@@ -333,6 +400,62 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
getAuthor(), getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called first whenever PlaceholderAPI finds a valid placeholder with a matching expansion.
|
||||
* <br>When called, the provided OfflinePlayer instance can be one of 3 possible states:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Not null and online</li>
|
||||
* <li>Not null and offline</li>
|
||||
* <li>Null</li>
|
||||
* </ul>
|
||||
*
|
||||
* When not overridden by the called expansion will the method as of now call
|
||||
* {@link PlaceholderHook#onRequest(OfflinePlayer, String) PlaceholderHook#onRequest(OfflinePlayer, String)}.
|
||||
* <br>This behaviour will change in a future version to call {@link #parsePlaceholders(Player, String) parsePlaceholders(Player, String)}
|
||||
* with the OfflinePlayer either being casted to a Player (When online), or {@link null}.
|
||||
*
|
||||
* <p>To use this method in your PlaceholderExpansion, override it and return either a String or {@code null}.
|
||||
* <br>When {@code null} is returned will PlaceholderAPI see it as an "invalid placeholder" and return
|
||||
* the content as-is in the final String.
|
||||
*
|
||||
* @param player The OfflinePlayer to use.
|
||||
* @param params The parameters of the placeholder, right after the first underscore.
|
||||
* @return Parsed placeholder, or null depending on the Expansion's handling of it.
|
||||
*/
|
||||
@Nullable
|
||||
public String parsePlaceholders(@Nullable OfflinePlayer player, @NotNull String params) {
|
||||
return this.onRequest(player, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called whenever PlaceholderAPI finds a valid placeholder with a matching expansion
|
||||
* AND {@link #parsePlaceholders(OfflinePlayer, String) parsePlaceholder(OfflinePlayer, String)} isn't
|
||||
* overridden by the expansion in question.
|
||||
* <br>When called, the provided Player instance can be one of 2 possible states:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Not null and online</li>
|
||||
* <li>Null</li>
|
||||
* </ul>
|
||||
*
|
||||
* When not overridden by the called expansion will the method as of now call
|
||||
* {@link PlaceholderHook#onPlaceholderRequest(Player, String) PlaceholderHook#onPlaceholderRequest(Player, String)}.
|
||||
* <br>This behaviour will change in a future version to instead return {@code null}.
|
||||
*
|
||||
* <p>To use this method in your PlaceholderExpansion, override it and return either a String or {@code null}.
|
||||
* <br>When {@code null} is returned will PlaceholderAPI see it as an "invalid placeholder" and return
|
||||
* the content as-is in the final String.
|
||||
*
|
||||
* @param player The Player to use. May be null
|
||||
* @param params The parameters of the placeholder, right after the first underscore.
|
||||
* @return Parsed placeholder, or null depending on the Expansion's handling of it.
|
||||
*/
|
||||
@Nullable
|
||||
public String parsePlaceholders(@Nullable Player player, @NotNull String params){
|
||||
return this.onPlaceholderRequest(player, params);
|
||||
}
|
||||
|
||||
// === Deprecated API ===
|
||||
|
||||
/**
|
||||
@@ -341,7 +464,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
* @return The plugin name.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public String getPlugin() {
|
||||
return null;
|
||||
}
|
||||
@@ -352,7 +475,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
* @return The description of the expansion.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
@@ -363,7 +486,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||
* @return The link for the expansion.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||
public String getLink() {
|
||||
return null;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -21,8 +21,29 @@
|
||||
package me.clip.placeholderapi.expansion;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* This interface should be used when your {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
|
||||
* should support relational placeholders.
|
||||
*
|
||||
* <p>The difference between relational placeholders and normal ones is, that relational ones start
|
||||
* with a {@code rel_} prefix and have two Players provided, instead of one.
|
||||
* <br>The main purpose is to return a String based on the "relationship" between the two players
|
||||
* (i.e. if both are within the same world).
|
||||
*/
|
||||
public interface Relational {
|
||||
|
||||
String onPlaceholderRequest(Player one, Player two, String identifier);
|
||||
/**
|
||||
* This method will be called whenever a valid placeholder in the format {@code %rel_<expansion>_<identifier>%}
|
||||
* is found.
|
||||
*
|
||||
* @param one The first player to use for comparison.
|
||||
* @param two The second player to use for comparison
|
||||
* @param identifier String right after {@code %rel_<expansion>_} and before the second percent symbol.
|
||||
* @return Possibly-null String, depending on what the expansion returns.
|
||||
*/
|
||||
@Nullable
|
||||
String onPlaceholderRequest(Player one, Player two, @NotNull String identifier);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -20,18 +20,24 @@
|
||||
|
||||
package me.clip.placeholderapi.expansion;
|
||||
|
||||
|
||||
/**
|
||||
* Implementing this interface adds the {@link #start() start} and {@link #stop() stop} void
|
||||
* methods to your {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}.
|
||||
*
|
||||
* <p>This can be used to execute methods and tasks whenever the PlaceholderExpansion has been
|
||||
* successfully (un)registered.
|
||||
*/
|
||||
public interface Taskable {
|
||||
|
||||
/**
|
||||
* Called when the implementing class has successfully been registered to the placeholder map
|
||||
* Tasks that need to be performed when this expansion is registered should go here
|
||||
* Called when the implementing class has successfully been registered to the placeholder map.
|
||||
* <br>Tasks that need to be performed when this expansion is registered should go here
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Called when the implementing class has been unregistered from PlaceholderAPI Tasks that need to
|
||||
* be performed when this expansion has unregistered should go here
|
||||
* Called when the implementing class has been unregistered from PlaceholderAPI.
|
||||
* <br>Tasks that need to be performed when this expansion has unregistered should go here
|
||||
*/
|
||||
void stop();
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -171,7 +171,7 @@ public class CloudExpansion {
|
||||
this.versions = versions;
|
||||
}
|
||||
|
||||
public class Version {
|
||||
public static class Version {
|
||||
|
||||
private String url, version, release_notes;
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -37,6 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
@@ -88,7 +89,7 @@ public final class CloudExpansionManager {
|
||||
|
||||
@NotNull
|
||||
private static String toIndexName(@NotNull final String name) {
|
||||
return name.toLowerCase().replace(' ', '_');
|
||||
return name.toLowerCase(Locale.ROOT).replace(' ', '_');
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -125,7 +125,7 @@ public final class LocalExpansionManager implements Listener {
|
||||
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
|
||||
expansionsLock.lock();
|
||||
try {
|
||||
return expansions.get(identifier.toLowerCase());
|
||||
return expansions.get(identifier.toLowerCase(Locale.ROOT));
|
||||
} finally {
|
||||
expansionsLock.unlock();
|
||||
}
|
||||
@@ -161,6 +161,10 @@ public final class LocalExpansionManager implements Listener {
|
||||
try {
|
||||
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
|
||||
|
||||
if(expansion == null){
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!");
|
||||
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
|
||||
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
|
||||
@@ -189,7 +193,7 @@ public final class LocalExpansionManager implements Listener {
|
||||
|
||||
@ApiStatus.Internal
|
||||
public boolean register(@NotNull final PlaceholderExpansion expansion) {
|
||||
final String identifier = expansion.getIdentifier().toLowerCase();
|
||||
final String identifier = expansion.getIdentifier().toLowerCase(Locale.ROOT);
|
||||
|
||||
if (!expansion.canRegister()) {
|
||||
return false;
|
||||
@@ -259,7 +263,8 @@ public final class LocalExpansionManager implements Listener {
|
||||
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Successfully registered expansion: " + expansion.getIdentifier());
|
||||
plugin.getLogger().info("Successfully registered expansion: " + expansion.getIdentifier() +
|
||||
" [" + expansion.getVersion() + "]");
|
||||
|
||||
if (expansion instanceof Taskable) {
|
||||
((Taskable) expansion).start();
|
||||
@@ -320,17 +325,36 @@ public final class LocalExpansionManager implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
final long registered = classes.stream()
|
||||
final List<PlaceholderExpansion> registered = classes.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.map(this::register)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final long needsUpdate = registered.stream()
|
||||
.map(expansion -> plugin.getCloudExpansionManager().findCloudExpansionByName(expansion.getName()).orElse(null))
|
||||
.filter(Objects::nonNull)
|
||||
.filter(CloudExpansion::shouldUpdate)
|
||||
.count();
|
||||
|
||||
Msg.msg(sender,
|
||||
registered == 0 ? "&6No expansions were registered!"
|
||||
: registered + "&a placeholder hooks successfully registered!");
|
||||
StringBuilder message = new StringBuilder(registered.size() == 0 ? "&6" : "&a")
|
||||
.append(registered.size())
|
||||
.append(' ')
|
||||
.append("placeholder hook(s) registered!");
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent());
|
||||
if (needsUpdate > 0) {
|
||||
message.append(' ')
|
||||
.append("&6")
|
||||
.append(needsUpdate)
|
||||
.append(' ')
|
||||
.append("placeholder hook(s) have an update available.");
|
||||
}
|
||||
|
||||
|
||||
Msg.msg(sender, message.toString());
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -346,7 +370,12 @@ public final class LocalExpansionManager implements Listener {
|
||||
|
||||
@NotNull
|
||||
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
||||
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
|
||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
|
||||
if(files == null){
|
||||
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||
}
|
||||
|
||||
return Arrays.stream(files)
|
||||
.map(this::findExpansionInFile)
|
||||
.collect(Futures.collector());
|
||||
}
|
||||
|
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* This file is part of PlaceholderAPI
|
||||
*
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlaceholderAPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package me.clip.placeholderapi.expansion.manager;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -39,16 +39,6 @@ public final class ServerLoadEventListener implements Listener {
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be called when the server is first loaded
|
||||
* <p>
|
||||
* The goal of the method is to register all the expansions as soon as possible especially before
|
||||
* players can join
|
||||
* <p>
|
||||
* This will ensure no issues with expansions and hooks.
|
||||
*
|
||||
* @param event the server load event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onServerLoad(@NotNull final ServerLoadEvent event) {
|
||||
HandlerList.unregisterAll(this);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
package me.clip.placeholderapi.replacer;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -50,56 +51,13 @@ public final class CharsReplacer implements Replacer {
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
final char l = chars[i];
|
||||
|
||||
if (l == '&' && ++i < chars.length) {
|
||||
final char c = Character.toLowerCase(chars[i]);
|
||||
|
||||
if (c != '0' && c != '1' && c != '2' && c != '3' && c != '4' && c != '5' && c != '6'
|
||||
&& c != '7' && c != '8' && c != '9' && c != 'a' && c != 'b' && c != 'c' && c != 'd'
|
||||
&& c != 'e' && c != 'f' && c != 'k' && c != 'l' && c != 'm' && c != 'n' && c != 'o' && c != 'r'
|
||||
&& c != 'x') {
|
||||
builder.append(l).append(chars[i]);
|
||||
} else {
|
||||
builder.append(ChatColor.COLOR_CHAR);
|
||||
|
||||
if (c != 'x') {
|
||||
builder.append(chars[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((i > 1 && chars[i - 2] == '\\') /*allow escaping &x*/) {
|
||||
builder.setLength(builder.length() - 2);
|
||||
builder.append('&').append(chars[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.append(c);
|
||||
|
||||
int j = 0;
|
||||
while (++j <= 6) {
|
||||
if (i + j >= chars.length) {
|
||||
break;
|
||||
}
|
||||
|
||||
final char x = chars[i + j];
|
||||
builder.append(ChatColor.COLOR_CHAR).append(x);
|
||||
}
|
||||
|
||||
if (j == 7) {
|
||||
i += 6;
|
||||
} else {
|
||||
builder.setLength(builder.length() - (j * 2)); // undo &x parsing
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (l != closure.head || i + 1 >= chars.length) {
|
||||
builder.append(l);
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean identified = false;
|
||||
boolean oopsitsbad = true;
|
||||
boolean invalid = true;
|
||||
boolean hadSpace = false;
|
||||
|
||||
while (++i < chars.length) {
|
||||
@@ -110,7 +68,7 @@ public final class CharsReplacer implements Replacer {
|
||||
break;
|
||||
}
|
||||
if (p == closure.tail) {
|
||||
oopsitsbad = false;
|
||||
invalid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -126,13 +84,14 @@ public final class CharsReplacer implements Replacer {
|
||||
}
|
||||
}
|
||||
|
||||
final String identifierString = identifier.toString().toLowerCase();
|
||||
final String identifierString = identifier.toString();
|
||||
final String lowercaseIdentifierString = identifierString.toLowerCase(Locale.ROOT);
|
||||
final String parametersString = parameters.toString();
|
||||
|
||||
identifier.setLength(0);
|
||||
parameters.setLength(0);
|
||||
|
||||
if (oopsitsbad) {
|
||||
if (invalid) {
|
||||
builder.append(closure.head).append(identifierString);
|
||||
|
||||
if (identified) {
|
||||
@@ -145,7 +104,7 @@ public final class CharsReplacer implements Replacer {
|
||||
continue;
|
||||
}
|
||||
|
||||
final PlaceholderExpansion placeholder = lookup.apply(identifierString);
|
||||
final PlaceholderExpansion placeholder = lookup.apply(lowercaseIdentifierString);
|
||||
if (placeholder == null) {
|
||||
builder.append(closure.head).append(identifierString);
|
||||
|
||||
@@ -157,7 +116,7 @@ public final class CharsReplacer implements Replacer {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String replacement = placeholder.onRequest(player, parametersString);
|
||||
final String replacement = placeholder.parsePlaceholders(player, parametersString);
|
||||
if (replacement == null) {
|
||||
builder.append(closure.head).append(identifierString);
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -61,7 +61,7 @@ public final class RegexReplacer implements Replacer {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String requested = expansion.onRequest(player, parameters);
|
||||
final String requested = expansion.parsePlaceholders(player, parameters);
|
||||
matcher.appendReplacement(builder, requested != null ? requested : matcher.group(0));
|
||||
}
|
||||
while (matcher.find());
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
@@ -50,7 +50,7 @@ public final class Format {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String buildFormat(@NotNull final Align align, @NotNull final int[] spacing) {
|
||||
private static String buildFormat(@NotNull final Align align, final int[] spacing) {
|
||||
return stream(spacing)
|
||||
.mapToObj(space -> "%" + (align == Align.LEFT ? "-" : "") + (space + 2) + "s")
|
||||
.collect(joining());
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* PlaceholderAPI
|
||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||
*
|
||||
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
@@ -88,12 +88,4 @@ public final class ReplacerUnitTester {
|
||||
assertEquals(text, Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCharsReplacerHandlesEscapedHex() {
|
||||
final String text = "\\&xffffffThis should not change.";
|
||||
|
||||
assertEquals(text.substring(1),
|
||||
Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user