mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 05:17:05 +02:00
Compare commits
99 Commits
developmen
...
feature/fo
Author | SHA1 | Date | |
---|---|---|---|
|
95786e32d2 | ||
|
e862abe0b4 | ||
|
2d946646f0 | ||
|
5ab61e0cd3 | ||
|
81ef464dad | ||
|
0ae0ddc9cb | ||
|
3d00d48106 | ||
|
7e902cae66 | ||
|
f4e4433b16 | ||
|
d5c371004c | ||
|
e246473782 | ||
|
4afad7f7b0 | ||
|
a0b177bdd8 | ||
|
40b1fe8d68 | ||
|
9ee4afa1e9 | ||
|
1cf66b130c | ||
|
c3cfc82eb3 | ||
|
3afb634e58 | ||
|
d888d9754b | ||
|
4c228ca4fb | ||
|
6cf987586e | ||
|
46d9a69534 | ||
|
af8cc09fca | ||
|
452c8ccd42 | ||
|
054c780fd1 | ||
|
83261eee49 | ||
|
3fca78626a | ||
|
a2456c582d | ||
|
b987916328 | ||
|
23ef4ecb62 | ||
|
8b7a217796 | ||
|
74ebb0bec0 | ||
|
794c8890e5 | ||
|
013e566a85 | ||
|
5a4a8c2e7e | ||
|
0b068470ac | ||
|
f3cb7635c2 | ||
|
8e21a76118 | ||
|
1dad2381e5 | ||
|
9767811cb9 | ||
|
e6fb6d5ec6 | ||
|
1acc621f2e | ||
|
d9bab03e3b | ||
|
9baf5f58ae | ||
|
077d64dc68 | ||
|
b8d5886cad | ||
|
52119682f3 | ||
|
651e14a797 | ||
|
0ac62d6b63 | ||
|
0be6b721cf | ||
|
0e0e36476a | ||
|
a56b3b62b9 | ||
|
883f1c1edf | ||
|
bfc30a8703 | ||
|
37c39ab734 | ||
|
35c47a8745 | ||
|
fadf14a316 | ||
|
1388a5278f | ||
|
3bc6ad0f06 | ||
|
bb149811d4 | ||
|
350a2be0ed | ||
|
b73d72cec7 | ||
|
7afb8ee36d | ||
|
1241c33ba0 | ||
|
631609af74 | ||
|
fe8d865657 | ||
|
50d4e14333 | ||
|
666ab468a1 | ||
|
151fb08db8 | ||
|
cd9074203c | ||
|
38d77ff4ca | ||
|
3ccbbe9c20 | ||
|
358a3bcab3 | ||
|
ca088227c3 | ||
|
69fd180c9b | ||
|
38e6e02e1b | ||
|
a71b8657f1 | ||
|
850633e792 | ||
|
348b075ac5 | ||
|
ce18d3b597 | ||
|
9d66d9d9a1 | ||
|
5fe9389dda | ||
|
e25a28b2a5 | ||
|
cfd289939e | ||
|
d168be94b1 | ||
|
511717a8d6 | ||
|
18fb194ce6 | ||
|
e11d551071 | ||
|
020f14d82c | ||
|
acb5728e65 | ||
|
cc235cfc01 | ||
|
31deef2a62 | ||
|
3ba29f1147 | ||
|
e969f37405 | ||
|
38099198d6 | ||
|
fe0bb12d53 | ||
|
721904335d | ||
|
d79f9725bd | ||
|
b4f6831e54 |
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Assigns extendedclip and PiggyPiglet for any PR unless a check below matches.
|
# Assigns extendedclip and PiggyPiglet for any PR unless a check below matches.
|
||||||
#
|
#
|
||||||
* @extendedclip @PiggyPiglet
|
* @PiggyPiglet @darbyjack
|
||||||
|
|
||||||
#
|
#
|
||||||
# Assigns Andre601 to any PR that targets the wiki folder.
|
# Assigns Andre601 to any PR that targets the wiki folder.
|
||||||
#
|
#
|
||||||
/wiki/ @Andre601
|
*.md @Andre601
|
||||||
|
30
.github/CONTRIBUTING.md
vendored
30
.github/CONTRIBUTING.md
vendored
@@ -2,7 +2,8 @@
|
|||||||
[discord]: https://helpch.at/discord
|
[discord]: https://helpch.at/discord
|
||||||
[code of conduct]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/CODE_OF_CONDUCT.md
|
[code of conduct]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/CODE_OF_CONDUCT.md
|
||||||
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki
|
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki
|
||||||
[dev]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/development
|
[master]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/master
|
||||||
|
[docs-wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki
|
||||||
[style]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/master/config/style
|
[style]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/master/config/style
|
||||||
|
|
||||||
# Contributing Guidelines
|
# Contributing Guidelines
|
||||||
@@ -37,15 +38,30 @@ PlaceholderAPI provides a feature to have expansions (separate jar files) for pl
|
|||||||
In those cases should you report the issue to the issue tracker of the expansion or plugin.
|
In those cases should you report the issue to the issue tracker of the expansion or plugin.
|
||||||
|
|
||||||
## Pull requests
|
## Pull requests
|
||||||
As an open source project are we welcoming all contributions to improve PlaceholderAPI, being it changes to its code like bug fixes or new features, or contributions to its documentation such as the [Wiki] or the Javadoc.
|
As an open source project are we welcoming all contributions to improve PlaceholderAPI, being it changes to its code, or contributions to its documentation such as the [Wiki] or the Javadocs.
|
||||||
|
|
||||||
|
**When contributing, make sure to both base of and target the mentioned branch. Pull requests targeting the wrong branch may get closed without a warning.**
|
||||||
|
|
||||||
### Code contributions
|
### Code contributions
|
||||||
Any contributions to PlaceholderAPI's code should be done towards the [`development`][dev] branch. Targeting the `master` branch in your Pull request may get it closed without warning.
|
> **Source and Target Branch:** [`master`][master]
|
||||||
Additionally should you follow the project's codestyle which you can find in the [`config/style`][style] directory.
|
|
||||||
|
|
||||||
### Wiki/Javadoc contributions
|
When contributing towards the code of PlaceholderAPI, be it new features or just bug fixes, your changes should follow the general code styling used in the project.
|
||||||
If your pull request only targets the [wiki] or only changes the javadoc comments of PlaceholderAPI (And not its actual code), it should be to `docs/wiki` branch.
|
You can find the necessary files in the [`config/style`][style] directory of this repository.
|
||||||
The develop branch should only be targeted when you also change some of PlaceholderAPI's code.
|
|
||||||
|
### Javadocs contributions
|
||||||
|
> **Source and Target Branch:** [`master`][master]*
|
||||||
|
|
||||||
|
Javadocs changes should usually be combined with [code contributions](#code-contributions) when possible, but if not, make sure the changes are significant enough to warrant a new build on our CI server.
|
||||||
|
|
||||||
|
\*This branch may change in the future.
|
||||||
|
|
||||||
|
### Wiki contributions
|
||||||
|
> **Source and Target Branch:** [`docs/wiki`][docs-wiki]
|
||||||
|
|
||||||
|
The Wiki of PlaceholderAPI has a unique quirk by having a dedicated [`wiki` folder][wiki] hosting the pages found on the actual wiki itself.
|
||||||
|
If you find outdated information, want to add missing expansions/plugins or just like to correct some wrong spelling should you both base of and target your contributions on the `docs/wiki` branch.
|
||||||
|
|
||||||
|
**Please only PR changes for the `wiki` folder on the `docs/wiki` branch! Pull requests not following this guidelines will be closed unnanounced.**
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
We have a [Code of Conduct] to maintain a welcoming atmosphere in this project.
|
We have a [Code of Conduct] to maintain a welcoming atmosphere in this project.
|
||||||
|
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -24,6 +24,8 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
- label: The issue isn't already fixed in a Spigot Release or Development Build.
|
- label: The issue isn't already fixed in a Spigot Release or Development Build.
|
||||||
required: true
|
required: true
|
||||||
|
- label: The [Common Issues](https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Common-Issues) page doesn't mention this issue.
|
||||||
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: "Type"
|
label: "Type"
|
||||||
|
44
.github/label-commenter-config.yml
vendored
44
.github/label-commenter-config.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
comment:
|
comment:
|
||||||
footer: "\
|
footer: "\
|
||||||
----\n\n
|
----\n\n
|
||||||
|
> **Note**\n
|
||||||
> *This is an automated response created by a **GitHub Action***\n
|
> *This is an automated response created by a **GitHub Action***\n
|
||||||
> *Mentioning the bot won't have any effect!*
|
> *Mentioning the bot won't have any effect!*
|
||||||
"
|
"
|
||||||
@@ -35,11 +36,12 @@ labels:
|
|||||||
Your issue unfortunately lacks certain information that we require in order to help you with your issue.
|
Your issue unfortunately lacks certain information that we require in order to help you with your issue.
|
||||||
Please make sure you provide the following information:
|
Please make sure you provide the following information:
|
||||||
|
|
||||||
- Currently used Versions of your server and PlaceholderAPI
|
- Currently used Versions of your server (`/version`) and PlaceholderAPI (`/version PlaceholderAPI`)
|
||||||
- Currently installed Expansions
|
- Currently installed Expansions (`/papi list`)
|
||||||
- Currently installed Plugins
|
- Currently installed Plugins (`/pl`)
|
||||||
|
- 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:
|
unlabeled:
|
||||||
issue:
|
issue:
|
||||||
body: |-
|
body: |-
|
||||||
@@ -50,18 +52,18 @@ labels:
|
|||||||
issue:
|
issue:
|
||||||
body: |-
|
body: |-
|
||||||
Your issue has beeen marked as invalid.
|
Your issue has beeen marked as invalid.
|
||||||
This means that it either doesn't follow any provided template, or isn't related to PlaceholderAPI in any way.
|
This means that it either doesn't follow any provided template, or isn't related to PlaceholderAPI.
|
||||||
|
|
||||||
Please make sure to use one of the issue templates and provide the requested information.
|
Please make sure to use one of the issue templates and provide the requested information.
|
||||||
Currently available Templates are:
|
Currently available Templates are:
|
||||||
|
|
||||||
- [Bug Report](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=bug_report.md)
|
- [Bug Report](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?labels=Type%3A+Issue+%28Unconfirmed%29&template=bug_report.yml)
|
||||||
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=feature_request.md)
|
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?labels=Type%3A+Enhancement&template=feature_request.yml)
|
||||||
|
|
||||||
If you want changes to be made towards the Wiki, would we encourage you to [Make a Pull request](https://github.com/PlaceholderAPI/PlaceholderAPI/pulls).
|
If you want changes to be made towards the Wiki, would we encourage you to [Make a Pull request](https://github.com/PlaceholderAPI/PlaceholderAPI/pulls).
|
||||||
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/wiki/README.md).
|
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md).
|
||||||
|
|
||||||
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive faster response compared to the issue tracker here.
|
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive a faster response compared to the issue tracker here.
|
||||||
Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
|
Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
|
||||||
action: close
|
action: close
|
||||||
pr:
|
pr:
|
||||||
@@ -71,11 +73,20 @@ labels:
|
|||||||
|
|
||||||
Here is a small summary of what you should know:
|
Here is a small summary of what you should know:
|
||||||
|
|
||||||
- Pull requests for PlaceholderAPI should target the `development` branch.
|
- Pull requests for PlaceholderAPI should target the `master` branch.
|
||||||
- Pull requests for the Wiki should target the `docs/wiki` branch.
|
- Pull requests for the Wiki should target the `wiki` branch.
|
||||||
|
|
||||||
Don't hesitate to ask us any questions.
|
Don't hesitate to ask us any questions.
|
||||||
action: close
|
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 target the `wiki` branch.
|
||||||
|
More information can be found on the [Wiki README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md).
|
||||||
|
action: close
|
||||||
- name: 'Target: Wiki'
|
- name: 'Target: Wiki'
|
||||||
labeled:
|
labeled:
|
||||||
issue:
|
issue:
|
||||||
@@ -83,12 +94,11 @@ labels:
|
|||||||
Hello @{{ issue.user.login }},
|
Hello @{{ issue.user.login }},
|
||||||
|
|
||||||
Thank you for reaching out to us about the wiki.
|
Thank you for reaching out to us about the wiki.
|
||||||
We would like to inform you, that you are now able to directly commit your changes to the wiki through a Pull request.
|
We would like to inform you, that you are able to directly commit your changes to the wiki through a Pull request.
|
||||||
When doing so, make sure you follow these steps:
|
When doing so, make sure you follow these steps:
|
||||||
|
|
||||||
- The Pull request is based on AND targets the [`docs/wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki) branch of the Repository.
|
- The Pull request is based on AND targets the [`wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/wiki) branch of the Repository.
|
||||||
- You only made changes to the files inside the [`wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki/wiki) folder.
|
- You followed the general Styling Guidelines mentioned in the wiki's [README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md) file.
|
||||||
- You followed the general Styling Guidelines mentioned in the wiki's [README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md) file.
|
|
||||||
|
|
||||||
If you have any questions about submitting a PR for the wiki or have any other questions don't hesitate to ask us about it.
|
If you have any questions about submitting a PR for the wiki or have any other questions don't hesitate to ask us about it.
|
||||||
- name: 'Type: Not a bug'
|
- name: 'Type: Not a bug'
|
||||||
@@ -112,7 +122,7 @@ labels:
|
|||||||
The issue has been marked as **inactive** which means it didn't recieve any responses from the Author ({{ issue.user.login }}) for a long period of time.
|
The issue has been marked as **inactive** which means it didn't recieve any responses from the Author ({{ issue.user.login }}) for a long period of time.
|
||||||
To keep the issue-tracker clean and up to date do we close issues that haven't received any responses for a long time.
|
To keep the issue-tracker clean and up to date do we close issues that haven't received any responses for a long time.
|
||||||
|
|
||||||
If you're the Author of this issue and the reported problem is still present, make sure to respond with additional info to this issue.
|
If you're the Author of this issue and the reported problem is still present, make sure to respond with additional info to this issue, so that we can reopen it.
|
||||||
**Do not create a new issue for the same problem!**
|
**Do not create a new issue for the same problem!**
|
||||||
action: close
|
action: close
|
||||||
unlabeled:
|
unlabeled:
|
||||||
@@ -126,7 +136,7 @@ labels:
|
|||||||
Hello @{{ issue.user.login }},
|
Hello @{{ issue.user.login }},
|
||||||
|
|
||||||
Thank you for reaching out to us for getting Support with PlaceholderAPI.
|
Thank you for reaching out to us for getting Support with PlaceholderAPI.
|
||||||
We would like to inform you, that we now have [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions) that you can use for asking questions.
|
We would like to inform you, that we have [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions) that you can use for asking questions.
|
||||||
Just head over there and click the "New discussion" button to create a new post.
|
Just head over there and click the "New discussion" button to create a new post.
|
||||||
|
|
||||||
Remember to first read the [READ ME](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/507) post to not face any issues.
|
Remember to first read the [READ ME](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/507) post to not face any issues.
|
||||||
|
36
.github/workflows/wiki.yml
vendored
36
.github/workflows/wiki.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
#
|
|
||||||
# This is a GitHub Action that allows us to auto-update the wiki
|
|
||||||
# when a Pull request changes specific files in a folder.
|
|
||||||
#
|
|
||||||
name: Update Wiki
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
#
|
|
||||||
# Only trigger when the push changes any files in the wiki-folder.
|
|
||||||
#
|
|
||||||
paths:
|
|
||||||
- 'wiki/**'
|
|
||||||
branches:
|
|
||||||
- 'docs/wiki'
|
|
||||||
#
|
|
||||||
# Releases cause this action to also fire.
|
|
||||||
# Using this prevents this problem.
|
|
||||||
#
|
|
||||||
tags-ignore:
|
|
||||||
- '**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: 'Checkout Code'
|
|
||||||
uses: actions/Checkout@v2
|
|
||||||
- name: 'Update Wiki'
|
|
||||||
uses: Andrew-Chen-Wang/github-wiki-action@v2
|
|
||||||
env:
|
|
||||||
WIKI_DIR: wiki/
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GH_MAIL: 'actions@github.com'
|
|
||||||
GH_NAME: 'github-actions[bot]'
|
|
||||||
EXCLUDED_FILES: 'README.md'
|
|
@@ -15,7 +15,7 @@
|
|||||||
[ciImg]: http://ci.extendedclip.com/buildStatus/icon?job=PlaceholderAPI
|
[ciImg]: http://ci.extendedclip.com/buildStatus/icon?job=PlaceholderAPI
|
||||||
|
|
||||||
[APIversionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
[APIversionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
||||||
[logo]: https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/master/wiki/img/papi-logo.png
|
[logo]: https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/wiki/img/papi-logo.png
|
||||||
|
|
||||||
[contributing]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md
|
[contributing]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md
|
||||||
[placeholderexpansion]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion
|
[placeholderexpansion]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
# Information
|
# Information
|
||||||
[PlaceholderAPI][spigot] is a plugin for Spigot servers that allows server owners to display information from various plugins with a uniform format.
|
[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
|
## 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.
|
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.
|
||||||
|
132
build.gradle
132
build.gradle
@@ -1,132 +0,0 @@
|
|||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
group "me.clip"
|
|
||||||
version "2.10.10-DEV-${System.getProperty("BUILD_NUMBER")}"
|
|
||||||
|
|
||||||
description "An awesome placeholder provider!"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven({ url = "https://oss.sonatype.org/content/repositories/snapshots/" })
|
|
||||||
|
|
||||||
mavenCentral()
|
|
||||||
mavenLocal()
|
|
||||||
|
|
||||||
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.0-SNAPSHOT"
|
|
||||||
|
|
||||||
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.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"
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
filter ReplaceTokens, tokens: [name: rootProject.name, version: project.version.toString(), description: project.description]
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
|
|
||||||
withJavadocJar()
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
failOnError false
|
|
||||||
options.addStringOption('Xdoclint:none', '-quiet')
|
|
||||||
options.addStringOption('encoding', 'UTF-8')
|
|
||||||
options.addStringOption('charSet', 'UTF-8')
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
archiveClassifier.set("")
|
|
||||||
|
|
||||||
relocate "org.bstats", "me.clip.placeholderapi.metrics"
|
|
||||||
relocate "net.kyori", "me.clip.placeholderapi.libs.kyori"
|
|
||||||
}
|
|
||||||
|
|
||||||
license {
|
|
||||||
include '**/*.java'
|
|
||||||
|
|
||||||
matching('**/*.java') {
|
|
||||||
header = file('config/headers/main.txt')
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
|
||||||
year = 2021
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
testImplementation {
|
|
||||||
extendsFrom(compileOnly)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
if (version.contains("-DEV")) {
|
|
||||||
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
|
|
||||||
} else {
|
|
||||||
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
|
||||||
}
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = System.getenv("JENKINS_USER")
|
|
||||||
password = System.getenv("JENKINS_PASS")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
artifactId = "placeholderapi"
|
|
||||||
|
|
||||||
from components.java
|
|
||||||
|
|
||||||
pom.withXml {
|
|
||||||
|
|
||||||
// some are having issues with bstats so we might need to add that to the pom as well
|
|
||||||
|
|
||||||
asNode().appendNode("packaging", "jar")
|
|
||||||
asNode().remove(asNode().get("dependencies"))
|
|
||||||
|
|
||||||
def dependenciesNode = asNode().appendNode("dependencies")
|
|
||||||
// jetbrains annotations
|
|
||||||
def jetbrainsAnnotations = dependenciesNode.appendNode("dependency")
|
|
||||||
jetbrainsAnnotations.appendNode("groupId", "org.jetbrains")
|
|
||||||
jetbrainsAnnotations.appendNode("artifactId", "annotations")
|
|
||||||
jetbrainsAnnotations.appendNode("version", "19.0.0")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publish.dependsOn clean, test, jar
|
|
128
build.gradle.kts
Normal file
128
build.gradle.kts
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`java-library`
|
||||||
|
`maven-publish`
|
||||||
|
id("com.github.hierynomus.license") version "0.16.1"
|
||||||
|
id("com.github.johnrengelman.shadow") version "8.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "me.clip"
|
||||||
|
version = "2.11.4-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||||
|
|
||||||
|
description = "An awesome placeholder provider!"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
|
||||||
|
maven("https://repo.codemc.org/repository/maven-public/")
|
||||||
|
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.bstats:bstats-bukkit:3.0.1")
|
||||||
|
implementation("net.kyori:adventure-platform-bukkit:4.3.0")
|
||||||
|
|
||||||
|
compileOnlyApi("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT") // this is temp
|
||||||
|
compileOnlyApi("org.jetbrains:annotations:23.0.0")
|
||||||
|
|
||||||
|
testImplementation("org.openjdk.jmh:jmh-core:1.32")
|
||||||
|
testImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.32")
|
||||||
|
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
||||||
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17 // this is temp
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17 // this is temp
|
||||||
|
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
license {
|
||||||
|
header = rootProject.file("config/headers/main.txt")
|
||||||
|
|
||||||
|
include("**/*.java")
|
||||||
|
mapping("java", "JAVADOC_STYLE")
|
||||||
|
|
||||||
|
encoding = "UTF-8"
|
||||||
|
|
||||||
|
ext {
|
||||||
|
set("year", 2021)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val javaComponent: SoftwareComponent = components["java"]
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
processResources {
|
||||||
|
eachFile { expand("version" to project.version) }
|
||||||
|
}
|
||||||
|
|
||||||
|
build {
|
||||||
|
dependsOn(named("shadowJar"))
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<Javadoc> {
|
||||||
|
isFailOnError = false
|
||||||
|
|
||||||
|
with(options as StandardJavadocDocletOptions) {
|
||||||
|
addStringOption("Xdoclint:none", "-quiet")
|
||||||
|
addStringOption("encoding", "UTF-8")
|
||||||
|
addStringOption("charSet", "UTF-8")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
withType<ShadowJar> {
|
||||||
|
archiveClassifier.set("")
|
||||||
|
|
||||||
|
relocate("org.bstats", "me.clip.placeholderapi.metrics")
|
||||||
|
relocate("net.kyori", "me.clip.placeholderapi.libs.kyori")
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
artifactId = "placeholderapi"
|
||||||
|
from(javaComponent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
if ("-DEV" in version.toString()) {
|
||||||
|
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
|
||||||
|
} else {
|
||||||
|
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||||
|
}
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("JENKINS_USER")
|
||||||
|
password = System.getenv("JENKINS_PASS")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publish.get().setDependsOn(listOf(build.get()))
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
testImplementation {
|
||||||
|
extendsFrom(compileOnly.get())
|
||||||
|
}
|
||||||
|
}
|
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
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with 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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
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.
|
# 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"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
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 [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
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."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
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.
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
@@ -106,80 +140,95 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit"
|
||||||
fi
|
esac
|
||||||
ulimit -n $MAX_FD
|
case $MAX_FD in #(
|
||||||
if [ $? -ne 0 ] ; then
|
'' | soft) :;; #(
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
*)
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
else
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
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" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --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
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
rootProject.name = 'PlaceholderAPI'
|
|
1
settings.gradle.kts
Normal file
1
settings.gradle.kts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "PlaceholderAPI"
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,6 +22,7 @@ package me.clip.placeholderapi;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@@ -81,7 +82,7 @@ public final class PlaceholderAPI {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<String> setPlaceholders(final OfflinePlayer player,
|
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());
|
return text.stream().map(line -> setPlaceholders(player, line)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +137,7 @@ public final class PlaceholderAPI {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<String> setBracketPlaceholders(final OfflinePlayer player,
|
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))
|
return text.stream().map(line -> setBracketPlaceholders(player, line))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -185,7 +186,7 @@ public final class PlaceholderAPI {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String identifier = format.substring(0, index).toLowerCase();
|
String identifier = format.substring(0, index).toLowerCase(Locale.ROOT);
|
||||||
String params = format.substring(index + 1);
|
String params = format.substring(index + 1);
|
||||||
final PlaceholderExpansion expansion = PlaceholderAPIPlugin.getInstance()
|
final PlaceholderExpansion expansion = PlaceholderAPIPlugin.getInstance()
|
||||||
.getLocalExpansionManager().getExpansion(identifier);
|
.getLocalExpansionManager().getExpansion(identifier);
|
||||||
@@ -201,7 +202,7 @@ public final class PlaceholderAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Msg.color(text);
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -292,14 +293,14 @@ public final class PlaceholderAPI {
|
|||||||
// === Deprecated API ===
|
// === Deprecated API ===
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static boolean registerExpansion(PlaceholderExpansion expansion)
|
public static boolean registerExpansion(PlaceholderExpansion expansion)
|
||||||
{
|
{
|
||||||
return expansion.register();
|
return expansion.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static boolean unregisterExpansion(PlaceholderExpansion expansion)
|
public static boolean unregisterExpansion(PlaceholderExpansion expansion)
|
||||||
{
|
{
|
||||||
return expansion.unregister();
|
return expansion.unregister();
|
||||||
@@ -313,7 +314,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return Map of registered placeholders
|
* @return Map of registered placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static Map<String, PlaceholderHook> getPlaceholders() {
|
public static Map<String, PlaceholderHook> getPlaceholders() {
|
||||||
return PlaceholderAPIPlugin.getInstance().getLocalExpansionManager()
|
return PlaceholderAPIPlugin.getInstance().getLocalExpansionManager()
|
||||||
.getExpansions().stream()
|
.getExpansions().stream()
|
||||||
@@ -329,12 +330,11 @@ public final class PlaceholderAPI {
|
|||||||
* @return always false
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static boolean registerPlaceholderHook(Plugin plugin, PlaceholderHook placeholderHook) {
|
public static boolean registerPlaceholderHook(Plugin plugin, PlaceholderHook placeholderHook) {
|
||||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
|
Msg.warn("Nag author(s) %s of plugin %s about their usage of the deprecated PlaceholderHook"
|
||||||
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!"
|
+ " class! This class will be removed in v2.13.0!", plugin.getDescription().getAuthors(),
|
||||||
+ " Please reach out to " + plugin.getDescription().getAuthors().toString()
|
plugin.getName());
|
||||||
+ " and let them know that they need to update ASAP!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,11 +347,11 @@ public final class PlaceholderAPI {
|
|||||||
* @return always false
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static boolean registerPlaceholderHook(String identifier,
|
public static boolean registerPlaceholderHook(String identifier,
|
||||||
PlaceholderHook placeholderHook) {
|
PlaceholderHook placeholderHook) {
|
||||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
|
Msg.warn("%s is attempting to register placeholders via deprecated PlaceholderHook class."
|
||||||
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!");
|
+ " This class is no longer supported and will be removed in v2.13.0!", identifier);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,12 +363,11 @@ public final class PlaceholderAPI {
|
|||||||
* @return always false
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static boolean unregisterPlaceholderHook(Plugin plugin) {
|
public static boolean unregisterPlaceholderHook(Plugin plugin) {
|
||||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
|
Msg.warn("Nag author(s) %s of plugin %s about their usage of the PlaceholderAPI class."
|
||||||
+ " is attempting to unregister placeholders via the PlaceholderAPI class which is no longer supported!"
|
+ " This way of unregistering placeholders is no longer supported and will be removed"
|
||||||
+ " Please reach out to " + plugin.getDescription().getAuthors().toString()
|
+ " in v2.13.0!", plugin.getDescription().getAuthors(), plugin.getName());
|
||||||
+ " and let them know that they need to update ASAP!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,10 +379,11 @@ public final class PlaceholderAPI {
|
|||||||
* @return always false
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static boolean unregisterPlaceholderHook(String identifier) {
|
public static boolean unregisterPlaceholderHook(String identifier) {
|
||||||
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
|
Msg.warn("%s is attempting to unregister placeholders via PlaceholderAPI class."
|
||||||
+ " is attempting to unregister placeholders through the PlaceholderAPI class which is no longer supported!");
|
+ " This way of unregistering placeholders is no longer supported and will be removed"
|
||||||
|
+ " in v2.13.0!", identifier);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return Set of registered identifiers
|
* @return Set of registered identifiers
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static Set<String> getRegisteredPlaceholderPlugins() {
|
public static Set<String> getRegisteredPlaceholderPlugins() {
|
||||||
return getRegisteredIdentifiers();
|
return getRegisteredIdentifiers();
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return always null
|
* @return always null
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static Set<String> getExternalPlaceholderPlugins() {
|
public static Set<String> getExternalPlaceholderPlugins() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -419,7 +419,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setPlaceholders(OfflinePlayer player,
|
public static String setPlaceholders(OfflinePlayer player,
|
||||||
String text, Pattern pattern, boolean colorize) {
|
String text, Pattern pattern, boolean colorize) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
@@ -435,7 +435,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static List<String> setPlaceholders(OfflinePlayer player,
|
public static List<String> setPlaceholders(OfflinePlayer player,
|
||||||
List<String> text, Pattern pattern, boolean colorize) {
|
List<String> text, Pattern pattern, boolean colorize) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
@@ -450,7 +450,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
|
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
|
||||||
boolean colorize) {
|
boolean colorize) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
@@ -465,7 +465,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
|
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
|
||||||
Pattern pattern) {
|
Pattern pattern) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
@@ -479,7 +479,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setPlaceholders(Player player, String text, boolean colorize) {
|
public static String setPlaceholders(Player player, String text, boolean colorize) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@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) {
|
public static List<String> setPlaceholders(Player player, List<String> text, boolean colorize) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
}
|
}
|
||||||
@@ -507,7 +507,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setPlaceholders(OfflinePlayer player, String text, boolean colorize) {
|
public static String setPlaceholders(OfflinePlayer player, String text, boolean colorize) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setPlaceholders(OfflinePlayer player, String text, Pattern pattern) {
|
public static String setPlaceholders(OfflinePlayer player, String text, Pattern pattern) {
|
||||||
return setPlaceholders(player, text);
|
return setPlaceholders(player, text);
|
||||||
}
|
}
|
||||||
@@ -535,7 +535,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static List<String> setBracketPlaceholders(OfflinePlayer player, List<String> text,
|
public static List<String> setBracketPlaceholders(OfflinePlayer player, List<String> text,
|
||||||
boolean colorize) {
|
boolean colorize) {
|
||||||
return setBracketPlaceholders(player, text);
|
return setBracketPlaceholders(player, text);
|
||||||
@@ -550,7 +550,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setBracketPlaceholders(OfflinePlayer player, String text, boolean colorize) {
|
public static String setBracketPlaceholders(OfflinePlayer player, String text, boolean colorize) {
|
||||||
return setBracketPlaceholders(player, text);
|
return setBracketPlaceholders(player, text);
|
||||||
}
|
}
|
||||||
@@ -564,7 +564,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setBracketPlaceholders(Player player, String text, boolean colorize) {
|
public static String setBracketPlaceholders(Player player, String text, boolean colorize) {
|
||||||
return setBracketPlaceholders(player, text);
|
return setBracketPlaceholders(player, text);
|
||||||
}
|
}
|
||||||
@@ -578,7 +578,7 @@ public final class PlaceholderAPI {
|
|||||||
* @return String with the parsed placeholders
|
* @return String with the parsed placeholders
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static List<String> setBracketPlaceholders(Player player, List<String> text,
|
public static List<String> setBracketPlaceholders(Player player, List<String> text,
|
||||||
boolean colorize) {
|
boolean colorize) {
|
||||||
return setBracketPlaceholders(player, text);
|
return setBracketPlaceholders(player, text);
|
||||||
@@ -596,7 +596,7 @@ public final class PlaceholderAPI {
|
|||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public static String setRelationalPlaceholders(Player one, Player two, String text,
|
public static String setRelationalPlaceholders(Player one, Player two, String text,
|
||||||
boolean colorize) {
|
boolean colorize) {
|
||||||
return setRelationalPlaceholders(one, two, text);
|
return setRelationalPlaceholders(one, two, text);
|
||||||
@@ -614,7 +614,7 @@ public final class PlaceholderAPI {
|
|||||||
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List)} instead.
|
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@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,
|
public static List<String> setRelationalPlaceholders(Player one, Player two, List<String> text,
|
||||||
boolean colorize) {
|
boolean colorize) {
|
||||||
return setRelationalPlaceholders(one, two, text);
|
return setRelationalPlaceholders(one, two, text);
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -23,7 +23,6 @@ package me.clip.placeholderapi;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommandRouter;
|
import me.clip.placeholderapi.commands.PlaceholderCommandRouter;
|
||||||
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
|
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
@@ -32,8 +31,8 @@ import me.clip.placeholderapi.expansion.manager.CloudExpansionManager;
|
|||||||
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||||
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
||||||
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
||||||
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.serializer.craftbukkit.MinecraftComponentSerializer;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bstats.charts.AdvancedPie;
|
import org.bstats.charts.AdvancedPie;
|
||||||
import org.bstats.charts.SimplePie;
|
import org.bstats.charts.SimplePie;
|
||||||
@@ -122,7 +121,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
return new SimpleDateFormat(getInstance().getPlaceholderAPIConfig().dateFormat());
|
return new SimpleDateFormat(getInstance().getPlaceholderAPIConfig().dateFormat());
|
||||||
} catch (final IllegalArgumentException ex) {
|
} catch (final IllegalArgumentException ex) {
|
||||||
getInstance().getLogger().log(Level.WARNING, "configured date format is invalid", ex);
|
Msg.warn("Configured date format ('%s') is invalid! Defaulting to 'MM/dd/yy HH:mm:ss'",
|
||||||
|
ex, getInstance().getPlaceholderAPIConfig().dateFormat());
|
||||||
return new SimpleDateFormat("MM/dd/yy HH:mm:ss");
|
return new SimpleDateFormat("MM/dd/yy HH:mm:ss");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getAsyncScheduler().cancelTasks(this); // this is hopefully temp
|
||||||
|
|
||||||
adventure.close();
|
adventure.close();
|
||||||
adventure = null;
|
adventure = null;
|
||||||
@@ -249,7 +249,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
Class.forName("org.bukkit.event.server.ServerLoadEvent");
|
Class.forName("org.bukkit.event.server.ServerLoadEvent");
|
||||||
new ServerLoadEventListener(this);
|
new ServerLoadEventListener(this);
|
||||||
} catch (final ExceptionInInitializerError | ClassNotFoundException ignored) {
|
} catch (final ClassNotFoundException ignored) {
|
||||||
Bukkit.getScheduler()
|
Bukkit.getScheduler()
|
||||||
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
|
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -26,7 +26,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class PlaceholderHook {
|
public abstract class PlaceholderHook {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
|
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
|
||||||
if (player != null && player.isOnline()) {
|
if (player != null && player.isOnline()) {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (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.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
@@ -61,7 +62,7 @@ public abstract class PlaceholderCommand {
|
|||||||
if (parameter == null) {
|
if (parameter == null) {
|
||||||
possible.forEach(suggestions::add);
|
possible.forEach(suggestions::add);
|
||||||
} else {
|
} else {
|
||||||
possible.filter(suggestion -> suggestion.toLowerCase().startsWith(parameter.toLowerCase()))
|
possible.filter(suggestion -> suggestion.toLowerCase(Locale.ROOT).startsWith(parameter.toLowerCase(Locale.ROOT)))
|
||||||
.forEach(suggestions::add);
|
.forEach(suggestions::add);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -27,6 +27,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
@@ -95,7 +96,7 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String search = args[0].toLowerCase();
|
final String search = args[0].toLowerCase(Locale.ROOT);
|
||||||
final PlaceholderCommand target = commands.get(search);
|
final PlaceholderCommand target = commands.get(search);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
@@ -121,10 +122,10 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
|
|||||||
final List<String> suggestions = new ArrayList<>();
|
final List<String> suggestions = new ArrayList<>();
|
||||||
|
|
||||||
if (args.length > 1) {
|
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) {
|
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);
|
Arrays.asList(Arrays.copyOfRange(args, 1, args.length)), suggestions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,10 +22,6 @@ package me.clip.placeholderapi.commands.impl.cloud;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
@@ -33,12 +29,17 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public final class CommandECloud extends PlaceholderCommand {
|
public final class CommandECloud extends PlaceholderCommand {
|
||||||
|
|
||||||
@Unmodifiable
|
@Unmodifiable
|
||||||
private static final List<PlaceholderCommand> COMMANDS = ImmutableList
|
private static final List<PlaceholderCommand> COMMANDS = ImmutableList
|
||||||
.of(new CommandECloudClear(),
|
.of(new CommandECloudClear(),
|
||||||
new CommandECloudToggle(),
|
|
||||||
new CommandECloudStatus(),
|
new CommandECloudStatus(),
|
||||||
new CommandECloudUpdate(),
|
new CommandECloudUpdate(),
|
||||||
new CommandECloudRefresh(),
|
new CommandECloudRefresh(),
|
||||||
@@ -78,8 +79,6 @@ public final class CommandECloud extends PlaceholderCommand {
|
|||||||
Msg.msg(sender,
|
Msg.msg(sender,
|
||||||
"&b&lPlaceholderAPI &8- &7eCloud Help Menu &8- ",
|
"&b&lPlaceholderAPI &8- &7eCloud Help Menu &8- ",
|
||||||
" ",
|
" ",
|
||||||
"&b/papi &fenable/disable/toggle",
|
|
||||||
" &7&oEnable or disable the eCloud",
|
|
||||||
"&b/papi &fecloud status",
|
"&b/papi &fecloud status",
|
||||||
" &7&oView status of the eCloud",
|
" &7&oView status of the eCloud",
|
||||||
"&b/papi &fecloud list <all/{author}/installed> {page}",
|
"&b/papi &fecloud list <all/{author}/installed> {page}",
|
||||||
@@ -100,7 +99,7 @@ public final class CommandECloud extends PlaceholderCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String search = params.get(0).toLowerCase();
|
final String search = params.get(0).toLowerCase(Locale.ROOT);
|
||||||
final PlaceholderCommand target = commands.get(search);
|
final PlaceholderCommand target = commands.get(search);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
@@ -114,10 +113,8 @@ public final class CommandECloud extends PlaceholderCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(target instanceof CommandECloudToggle) && !plugin.getPlaceholderAPIConfig()
|
if (!plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
|
||||||
.isCloudEnabled()) {
|
Msg.msg(sender, "&cThe eCloud Manager is not enabled! To enable it, set 'cloud_enabled' to true and reload the plugin.");
|
||||||
Msg.msg(sender,
|
|
||||||
"&cThe eCloud Manager is not enabled!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +133,7 @@ public final class CommandECloud extends PlaceholderCommand {
|
|||||||
return; // send sub commands
|
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);
|
final PlaceholderCommand target = commands.get(search);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -87,7 +87,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private static Collection<CloudExpansion> getExpansions(@NotNull final String target,
|
private static Collection<CloudExpansion> getExpansions(@NotNull final String target,
|
||||||
@NotNull final PlaceholderAPIPlugin plugin) {
|
@NotNull final PlaceholderAPIPlugin plugin) {
|
||||||
switch (target.toLowerCase()) {
|
switch (target.toLowerCase(Locale.ROOT)) {
|
||||||
case "all":
|
case "all":
|
||||||
return plugin.getCloudExpansionManager().getCloudExpansions().values();
|
return plugin.getCloudExpansionManager().getCloudExpansions().values();
|
||||||
case "installed":
|
case "installed":
|
||||||
@@ -112,7 +112,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
|||||||
|
|
||||||
public static void addExpansionTitle(@NotNull final StringBuilder builder,
|
public static void addExpansionTitle(@NotNull final StringBuilder builder,
|
||||||
@NotNull final String target, final int page) {
|
@NotNull final String target, final int page) {
|
||||||
switch (target.toLowerCase()) {
|
switch (target.toLowerCase(Locale.ROOT)) {
|
||||||
case "all":
|
case "all":
|
||||||
builder.append("&bAll Expansions");
|
builder.append("&bAll Expansions");
|
||||||
break;
|
break;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -54,7 +54,7 @@ public final class CommandECloudStatus extends PlaceholderCommand {
|
|||||||
|
|
||||||
if (updateCount > 0) {
|
if (updateCount > 0) {
|
||||||
builder.append("&eYou have &f").append(updateCount)
|
builder.append("&eYou have &f").append(updateCount)
|
||||||
.append(updateCount > 1 ? "&e expansions" : "&e expansion").append("installed that ")
|
.append(updateCount > 1 ? "&e expansions" : "&e expansion").append(" installed that ")
|
||||||
.append(updateCount > 1 ? "have an" : "has an").append(" update available.");
|
.append(updateCount > 1 ? "have an" : "has an").append(" update available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of PlaceholderAPI
|
|
||||||
*
|
|
||||||
* PlaceholderAPI
|
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
|
||||||
*
|
|
||||||
* PlaceholderAPI is 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.commands.impl.cloud;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
|
||||||
import me.clip.placeholderapi.util.Msg;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
|
||||||
|
|
||||||
public final class CommandECloudToggle extends PlaceholderCommand {
|
|
||||||
|
|
||||||
public CommandECloudToggle() {
|
|
||||||
super("toggle", "enable", "disable");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
|
||||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
|
||||||
@NotNull @Unmodifiable final List<String> params) {
|
|
||||||
final boolean desiredState;
|
|
||||||
final boolean currentState = plugin.getPlaceholderAPIConfig().isCloudEnabled();
|
|
||||||
|
|
||||||
switch (alias.toLowerCase()) {
|
|
||||||
case "enable":
|
|
||||||
desiredState = true;
|
|
||||||
break;
|
|
||||||
case "disable":
|
|
||||||
desiredState = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
desiredState = !currentState;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (desiredState == currentState) {
|
|
||||||
Msg.msg(sender, "&7The eCloud Manager is already " + (desiredState ? "enabled" : "disabled"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin.getPlaceholderAPIConfig().setCloudEnabled(desiredState);
|
|
||||||
|
|
||||||
if (desiredState) {
|
|
||||||
plugin.getCloudExpansionManager().load();
|
|
||||||
} else {
|
|
||||||
plugin.getCloudExpansionManager().kill();
|
|
||||||
}
|
|
||||||
|
|
||||||
Msg.msg(sender, "&aThe eCloud Manager has been " + (desiredState ? "enabled" : "disabled"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -23,6 +23,7 @@ package me.clip.placeholderapi.commands.impl.cloud;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -128,7 +129,7 @@ public final class CommandECloudUpdate extends PlaceholderCommand {
|
|||||||
installed.removeIf(expansion -> !expansion.shouldUpdate());
|
installed.removeIf(expansion -> !expansion.shouldUpdate());
|
||||||
|
|
||||||
if (!installed.isEmpty() && (params.isEmpty() || "all"
|
if (!installed.isEmpty() && (params.isEmpty() || "all"
|
||||||
.startsWith(params.get(0).toLowerCase()))) {
|
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
|
||||||
suggestions.add("all");
|
suggestions.add("all");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -106,7 +106,6 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try (final InputStream stream = connection.getInputStream()) {
|
try (final InputStream stream = connection.getInputStream()) {
|
||||||
//noinspection UnstableApiUsage
|
|
||||||
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||||
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
|
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
|
||||||
}
|
}
|
||||||
@@ -134,18 +133,15 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
|
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
|
||||||
.getExpansions()
|
.getExpansions()
|
||||||
.stream()
|
.stream()
|
||||||
.sorted(Comparator.comparing(PlaceholderExpansion::getIdentifier))
|
.sorted(
|
||||||
.sorted(Comparator.comparing(PlaceholderExpansion::getAuthor))
|
Comparator.comparing(PlaceholderExpansion::getIdentifier)
|
||||||
|
.thenComparing(PlaceholderExpansion::getAuthor)
|
||||||
|
)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
int size = 0;
|
int size = expansions.stream().map(e -> e.getIdentifier().length())
|
||||||
|
.max(Integer::compareTo)
|
||||||
for (final String name : expansions.stream().map(PlaceholderExpansion::getIdentifier)
|
.orElse(0);
|
||||||
.collect(Collectors.toList())) {
|
|
||||||
if (name.length() > size) {
|
|
||||||
size = name.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final PlaceholderExpansion expansion : expansions) {
|
for (final PlaceholderExpansion expansion : expansions) {
|
||||||
builder.append(" ")
|
builder.append(" ")
|
||||||
@@ -165,12 +161,17 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
|
|
||||||
final String[] jars = plugin.getLocalExpansionManager()
|
final String[] jars = plugin.getLocalExpansionManager()
|
||||||
.getExpansionsFolder()
|
.getExpansionsFolder()
|
||||||
.list((dir, name) -> name.toLowerCase().endsWith(".jar"));
|
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
|
||||||
|
|
||||||
for (final String jar : jars) {
|
|
||||||
builder.append(" ")
|
if (jars == null) {
|
||||||
.append(jar)
|
builder.append(" ¨[Warning]: Could not load jar files from expansions folder.");
|
||||||
.append('\n');
|
} else {
|
||||||
|
for (final String jar : jars) {
|
||||||
|
builder.append(" ")
|
||||||
|
.append(jar)
|
||||||
|
.append('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append('\n');
|
builder.append('\n');
|
||||||
@@ -191,13 +192,10 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
List<Plugin> plugins = Arrays.stream(plugin.getServer().getPluginManager().getPlugins())
|
List<Plugin> plugins = Arrays.stream(plugin.getServer().getPluginManager().getPlugins())
|
||||||
.sorted(Comparator.comparing(Plugin::getName))
|
.sorted(Comparator.comparing(Plugin::getName))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (final String pluginName : plugins.stream().map(Plugin::getName)
|
size = plugins.stream().map(pl -> pl.getName().length())
|
||||||
.collect(Collectors.toList())) {
|
.max(Integer::compareTo)
|
||||||
if (pluginName.length() > size) {
|
.orElse(0);
|
||||||
size = pluginName.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Plugin other : plugins) {
|
for (final Plugin other : plugins) {
|
||||||
builder.append(" ")
|
builder.append(" ")
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -45,9 +45,9 @@ public final class CommandHelp extends PlaceholderCommand {
|
|||||||
Msg.msg(sender,
|
Msg.msg(sender,
|
||||||
"&b&lPlaceholderAPI &8- &7Help Menu &8- &7(&f" + description.getVersion() + "&7)",
|
"&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",
|
" &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",
|
" &7&oParse a message with relational placeholders",
|
||||||
"&b/papi &fdump",
|
"&b/papi &fdump",
|
||||||
" &7&oDump all relevant information needed to help debug issues into a paste link.",
|
" &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",
|
" &7&oView information for a specific expansion",
|
||||||
"&b/papi &flist",
|
"&b/papi &flist",
|
||||||
" &7&oList active expansions",
|
" &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",
|
" &7&oParse a message with placeholders",
|
||||||
"&b/papi &fparserel &9<player one> <player two> <message>",
|
"&b/papi &fparserel &9<player one> <player two> <message>",
|
||||||
" &7&oParse a message with relational placeholders",
|
" &7&oParse a message with relational placeholders",
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,6 +22,7 @@ package me.clip.placeholderapi.commands.impl.local;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
@@ -29,7 +30,6 @@ import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
|||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -49,7 +49,7 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
||||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||||
@NotNull @Unmodifiable final List<String> params) {
|
@NotNull @Unmodifiable final List<String> params) {
|
||||||
switch (alias.toLowerCase()) {
|
switch (alias.toLowerCase(Locale.ROOT)) {
|
||||||
case "parserel":
|
case "parserel":
|
||||||
evaluateParseRelation(sender, params);
|
evaluateParseRelation(sender, params);
|
||||||
break;
|
break;
|
||||||
@@ -69,7 +69,7 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
public void complete(@NotNull final PlaceholderAPIPlugin plugin,
|
public void complete(@NotNull final PlaceholderAPIPlugin plugin,
|
||||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||||
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
||||||
switch (alias.toLowerCase()) {
|
switch (alias.toLowerCase(Locale.ROOT)) {
|
||||||
case "parserel":
|
case "parserel":
|
||||||
completeParseRelation(params, suggestions);
|
completeParseRelation(params, suggestions);
|
||||||
break;
|
break;
|
||||||
@@ -92,7 +92,7 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull final OfflinePlayer player;
|
OfflinePlayer player;
|
||||||
|
|
||||||
if ("me".equalsIgnoreCase(params.get(0))) {
|
if ("me".equalsIgnoreCase(params.get(0))) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
@@ -101,6 +101,8 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player = ((Player) sender);
|
player = ((Player) sender);
|
||||||
|
} else if ("--null".equalsIgnoreCase(params.get(0))) {
|
||||||
|
player = null;
|
||||||
} else {
|
} else {
|
||||||
final OfflinePlayer target = resolvePlayer(params.get(0));
|
final OfflinePlayer target = resolvePlayer(params.get(0));
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
@@ -120,13 +122,9 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (broadcast) {
|
if (broadcast) {
|
||||||
Msg.broadcast(message);
|
Bukkit.broadcastMessage(message);
|
||||||
} else {
|
} else {
|
||||||
if (!(sender instanceof Player)) {
|
sender.sendMessage(message);
|
||||||
Msg.msg(sender, message);
|
|
||||||
} else {
|
|
||||||
((Player) sender).spigot().sendMessage(TextComponent.fromLegacyText(message));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +151,8 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
final String message = PlaceholderAPI
|
final String message = PlaceholderAPI
|
||||||
.setRelationalPlaceholders(((Player) targetOne), ((Player) targetTwo),
|
.setRelationalPlaceholders(((Player) targetOne), ((Player) targetTwo),
|
||||||
String.join(" ", params.subList(2, params.size())));
|
String.join(" ", params.subList(2, params.size())));
|
||||||
Msg.msg(sender, message);
|
|
||||||
|
sender.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -161,10 +160,14 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
|
||||||
if (params.size() <= 1) {
|
if (params.size() <= 1) {
|
||||||
if (sender instanceof Player && (params.isEmpty() || "me"
|
if (sender instanceof Player && (params.isEmpty() || "me"
|
||||||
.startsWith(params.get(0).toLowerCase()))) {
|
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
|
||||||
suggestions.add("me");
|
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);
|
final Stream<String> names = Bukkit.getOnlinePlayers().stream().map(Player::getName);
|
||||||
suggestByParameter(names, suggestions, params.isEmpty() ? null : params.get(0));
|
suggestByParameter(names, suggestions, params.isEmpty() ? null : params.get(0));
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -27,8 +27,11 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that a {@link PlaceholderExpansion} has been registered by
|
* This event indicates that a <b>single</b> {@link PlaceholderExpansion PlaceholderExpansion} has
|
||||||
* PlaceholderAPI.
|
* 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 {
|
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
|
@NotNull
|
||||||
public PlaceholderExpansion getExpansion() {
|
public PlaceholderExpansion getExpansion() {
|
||||||
return expansion;
|
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
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -26,15 +26,19 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that a {@link PlaceholderExpansion} had been unregistered by
|
* This event indicates that a {@link PlaceholderExpansion PlaceholderExpansion} has been
|
||||||
* PlaceholderAPI.
|
* 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 {
|
public final class ExpansionUnregisterEvent extends Event {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final HandlerList HANDLERS = new HandlerList();
|
private static final HandlerList HANDLERS = new HandlerList();
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final PlaceholderExpansion expansion;
|
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
|
@NotNull
|
||||||
public PlaceholderExpansion getExpansion() {
|
public PlaceholderExpansion getExpansion() {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -21,18 +21,42 @@
|
|||||||
package me.clip.placeholderapi.events;
|
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.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that <b>all</b> {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlayceholderExpansions}
|
* This event indicated that <b>all</b> {@link PlaceholderExpansion PlaceholderExpansions} have
|
||||||
* have been loaded.
|
* been registered in PlaceholderAPI and can now be used.
|
||||||
* <br/>This event is fired on Server load and when reloading the
|
* <br>This even will also be triggered whenever PlaceholderAPI gets reloaded.
|
||||||
* confiuration.
|
*
|
||||||
|
* <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 {
|
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
|
@NotNull
|
||||||
private static final HandlerList HANDLERS = new HandlerList();
|
private static final HandlerList HANDLERS = new HandlerList();
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -21,9 +21,11 @@
|
|||||||
package me.clip.placeholderapi.expansion;
|
package me.clip.placeholderapi.expansion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the clear
|
* Classes implementing this interface will have a {@link #clear() clear void} that is called
|
||||||
* method called when the implementing expansion is unregistered from PlaceholderAPI. This is useful
|
* by PlaceholderAPI whenever the {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
|
||||||
* if we want to do things when the implementing hook is unregistered
|
* is unregistered.
|
||||||
|
*
|
||||||
|
* <p>This allows you to execute things such as clearing internal caches, saving data to files, etc.
|
||||||
*
|
*
|
||||||
* @author Ryan McCarthy
|
* @author Ryan McCarthy
|
||||||
*/
|
*/
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -23,9 +23,11 @@ package me.clip.placeholderapi.expansion;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the cleanup
|
* Classes implementing this interface will have a {@link #cleanup(Player) cleanup void} that is
|
||||||
* method called every time a player leaves the server. This is useful if we want to clean up after
|
* called by PlaceholderAPI whenever a Player leaves the server.
|
||||||
* the player
|
*
|
||||||
|
* <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
|
* @author Ryan McCarthy
|
||||||
*/
|
*/
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -23,18 +23,32 @@ package me.clip.placeholderapi.expansion;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any {@link PlaceholderExpansion} class which implements configurable will have any options listed
|
* Implementing this interface allows {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansions}
|
||||||
* in the {@link #getDefaults()} map automatically added to the PlaceholderAPI config.yml file
|
* 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
|
* @author Ryan McCarthy
|
||||||
*/
|
*/
|
||||||
public interface Configurable {
|
public interface Configurable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called before the implementing class is registered to obtain a map of
|
* The map returned by this method will be used to set config options in PlaceholderAPI's config.yml.
|
||||||
* 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
|
* <p>The key and value pairs are set under a section named after your
|
||||||
* identifier).(your key): (your value)
|
* {@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
|
* @return Map of config path / values which need to be added / removed from the PlaceholderAPI
|
||||||
* config.yml file
|
* config.yml file
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -42,7 +42,11 @@ public enum NMSVersion {
|
|||||||
SPIGOT_1_16_R1("v1_16_R1"),
|
SPIGOT_1_16_R1("v1_16_R1"),
|
||||||
SPIGOT_1_16_R2("v1_16_R2"),
|
SPIGOT_1_16_R2("v1_16_R2"),
|
||||||
SPIGOT_1_16_R3("v1_16_R3"),
|
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"),
|
||||||
|
SPIGOT_1_19_R1("v1_19_R1"),
|
||||||
|
SPIGOT_1_19_R2("v1_19_R2"),
|
||||||
|
SPIGOT_1_19_R3("v1_19_R3");
|
||||||
|
|
||||||
private final String version;
|
private final String version;
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,6 +22,7 @@ package me.clip.placeholderapi.expansion;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.PlaceholderHook;
|
import me.clip.placeholderapi.PlaceholderHook;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -275,7 +276,6 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
* @param def The default boolean to return when the ConfigurationSection is null
|
* @param def The default boolean to return when the ConfigurationSection is null
|
||||||
* @return boolean from the provided path or the default one provided
|
* @return boolean from the provided path or the default one provided
|
||||||
*/
|
*/
|
||||||
@NotNull
|
|
||||||
public final boolean getBoolean(@NotNull final String path, final boolean def) {
|
public final boolean getBoolean(@NotNull final String path, final boolean def) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section == null ? def : section.getBoolean(path, def);
|
return section == null ? def : section.getBoolean(path, def);
|
||||||
@@ -293,6 +293,71 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section != null && section.contains(path);
|
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.
|
* Whether the provided Object is an instance of this PlaceholderExpansion.
|
||||||
@@ -341,7 +406,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
* @return The plugin name.
|
* @return The plugin name.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public String getPlugin() {
|
public String getPlugin() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -352,7 +417,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
* @return The description of the expansion.
|
* @return The description of the expansion.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -363,7 +428,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
* @return The link for the expansion.
|
* @return The link for the expansion.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
|
||||||
public String getLink() {
|
public String getLink() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,7 +22,22 @@ package me.clip.placeholderapi.expansion;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementing this interface allows your {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
|
||||||
|
* to be used as a relational placeholder expansion.
|
||||||
|
*
|
||||||
|
* <p>Relational placeholders take two Players as input and are always prefixed with {@code rel_},
|
||||||
|
* so {@code %foo_bar%} becomes {@code %rel_foo_bar%}
|
||||||
|
*/
|
||||||
public interface Relational {
|
public interface Relational {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called whenever a placeholder starting with {@code rel_} is called.
|
||||||
|
*
|
||||||
|
* @param one The first player used for the placeholder.
|
||||||
|
* @param two The second player used for the placeholder.
|
||||||
|
* @param identifier The text right after the expansion's name (%expansion_<b>identifier</b>%)
|
||||||
|
* @return Parsed String from the expansion.
|
||||||
|
*/
|
||||||
String onPlaceholderRequest(Player one, Player two, String identifier);
|
String onPlaceholderRequest(Player one, Player two, String identifier);
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -20,18 +20,24 @@
|
|||||||
|
|
||||||
package me.clip.placeholderapi.expansion;
|
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 {
|
public interface Taskable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the implementing class has successfully been registered to the placeholder map
|
* 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
|
* <br>Tasks that need to be performed when this expansion is registered should go here
|
||||||
*/
|
*/
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the implementing class has been unregistered from PlaceholderAPI Tasks that need to
|
* Called when the implementing class has been unregistered from PlaceholderAPI.
|
||||||
* be performed when this expansion has unregistered should go here
|
* <br>Tasks that need to be performed when this expansion has unregistered should go here
|
||||||
*/
|
*/
|
||||||
void stop();
|
void stop();
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -171,7 +171,7 @@ public class CloudExpansion {
|
|||||||
this.versions = versions;
|
this.versions = versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Version {
|
public static class Version {
|
||||||
|
|
||||||
private String url, version, release_notes;
|
private String url, version, release_notes;
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -37,6 +37,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -52,6 +53,7 @@ import java.util.stream.Collectors;
|
|||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
@@ -88,7 +90,7 @@ public final class CloudExpansionManager {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static String toIndexName(@NotNull final String name) {
|
private static String toIndexName(@NotNull final String name) {
|
||||||
return name.toLowerCase().replace(' ', '_');
|
return name.toLowerCase(Locale.ROOT).replace(' ', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -201,40 +203,33 @@ public final class CloudExpansionManager {
|
|||||||
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop thru what's left on the main thread
|
//todo: Figure out why this was being scheduled back on the main thread
|
||||||
plugin
|
try {
|
||||||
.getServer()
|
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
||||||
.getScheduler()
|
String name = entry.getKey();
|
||||||
.runTask(
|
CloudExpansion expansion = entry.getValue();
|
||||||
plugin,
|
|
||||||
() -> {
|
|
||||||
try {
|
|
||||||
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
|
|
||||||
String name = entry.getKey();
|
|
||||||
CloudExpansion expansion = entry.getValue();
|
|
||||||
|
|
||||||
expansion.setName(name);
|
expansion.setName(name);
|
||||||
|
|
||||||
Optional<PlaceholderExpansion> localOpt =
|
Optional<PlaceholderExpansion> localOpt =
|
||||||
plugin.getLocalExpansionManager().findExpansionByName(name);
|
plugin.getLocalExpansionManager().findExpansionByName(name);
|
||||||
if (localOpt.isPresent()) {
|
if (localOpt.isPresent()) {
|
||||||
PlaceholderExpansion local = localOpt.get();
|
PlaceholderExpansion local = localOpt.get();
|
||||||
if (local.isRegistered()) {
|
if (local.isRegistered()) {
|
||||||
expansion.setHasExpansion(true);
|
expansion.setHasExpansion(true);
|
||||||
expansion.setShouldUpdate(
|
expansion.setShouldUpdate(
|
||||||
!local.getVersion().equalsIgnoreCase(expansion.getLatestVersion()));
|
!local.getVersion().equalsIgnoreCase(expansion.getLatestVersion()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.put(toIndexName(expansion), expansion);
|
cache.put(toIndexName(expansion), expansion);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// ugly swallowing of every throwable, but we have to be defensive
|
// ugly swallowing of every throwable, but we have to be defensive
|
||||||
plugin
|
plugin
|
||||||
.getLogger()
|
.getLogger()
|
||||||
.log(Level.WARNING, "Failed to download expansion information", e);
|
.log(Level.WARNING, "Failed to download expansion information", e);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,8 +262,7 @@ public final class CloudExpansionManager {
|
|||||||
await.remove(toIndexName(expansion));
|
await.remove(toIndexName(expansion));
|
||||||
|
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
plugin.getLogger().log(Level.SEVERE,
|
Msg.severe("Failed to download %s:%s", exception, expansion.getName(), expansion.getVersion());
|
||||||
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
|
|
||||||
}
|
}
|
||||||
}, ASYNC_EXECUTOR);
|
}, ASYNC_EXECUTOR);
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,11 +22,32 @@ package me.clip.placeholderapi.expansion.manager;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
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.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.CompletionException;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
|
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
|
||||||
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
||||||
import me.clip.placeholderapi.events.ExpansionsLoadedEvent;
|
import me.clip.placeholderapi.events.ExpansionsLoadedEvent;
|
||||||
import me.clip.placeholderapi.expansion.*;
|
import me.clip.placeholderapi.expansion.Cacheable;
|
||||||
|
import me.clip.placeholderapi.expansion.Cleanable;
|
||||||
|
import me.clip.placeholderapi.expansion.Configurable;
|
||||||
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
|
import me.clip.placeholderapi.expansion.Taskable;
|
||||||
|
import me.clip.placeholderapi.expansion.VersionSpecific;
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
import me.clip.placeholderapi.util.FileUtil;
|
import me.clip.placeholderapi.util.FileUtil;
|
||||||
import me.clip.placeholderapi.util.Futures;
|
import me.clip.placeholderapi.util.Futures;
|
||||||
@@ -45,16 +66,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.CompletionException;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public final class LocalExpansionManager implements Listener {
|
public final class LocalExpansionManager implements Listener {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -81,7 +92,7 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
this.folder = new File(plugin.getDataFolder(), EXPANSIONS_FOLDER_NAME);
|
this.folder = new File(plugin.getDataFolder(), EXPANSIONS_FOLDER_NAME);
|
||||||
|
|
||||||
if (!this.folder.exists() && !folder.mkdirs()) {
|
if (!this.folder.exists() && !folder.mkdirs()) {
|
||||||
plugin.getLogger().log(Level.WARNING, "failed to create expansions folder!");
|
Msg.warn("Failed to create expansions folder!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +136,7 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
|
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
|
||||||
expansionsLock.lock();
|
expansionsLock.lock();
|
||||||
try {
|
try {
|
||||||
return expansions.get(identifier.toLowerCase());
|
return expansions.get(identifier.toLowerCase(Locale.ROOT));
|
||||||
} finally {
|
} finally {
|
||||||
expansionsLock.unlock();
|
expansionsLock.unlock();
|
||||||
}
|
}
|
||||||
@@ -160,12 +171,25 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
@NotNull final Class<? extends PlaceholderExpansion> clazz) {
|
@NotNull final Class<? extends PlaceholderExpansion> clazz) {
|
||||||
try {
|
try {
|
||||||
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
|
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
|
||||||
|
|
||||||
|
if(expansion == null){
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!");
|
Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!");
|
||||||
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
|
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
|
||||||
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
|
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
|
||||||
|
|
||||||
|
if (expansion.getRequiredPlugin() != null && !expansion.getRequiredPlugin().isEmpty()) {
|
||||||
|
if (!Bukkit.getPluginManager().isPluginEnabled(expansion.getRequiredPlugin())) {
|
||||||
|
Msg.warn("Cannot load expansion %s due to a missing plugin: %s", expansion.getIdentifier(),
|
||||||
|
expansion.getRequiredPlugin());
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!expansion.register()) {
|
if (!expansion.register()) {
|
||||||
|
Msg.warn("Cannot load expansion %s due to an unknown issue.", expansion.getIdentifier());
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,10 +202,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
reason = " - One of its properties is null which is not allowed!";
|
reason = " - One of its properties is null which is not allowed!";
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLogger().severe("Failed to load expansion class " + clazz.getSimpleName() +
|
Msg.severe("Failed to load expansion class %s%s", ex, clazz.getSimpleName(), reason);
|
||||||
reason);
|
|
||||||
plugin.getLogger().log(Level.SEVERE, "", ex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@@ -189,11 +211,17 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public boolean register(@NotNull final PlaceholderExpansion expansion) {
|
public boolean register(@NotNull final PlaceholderExpansion expansion) {
|
||||||
final String identifier = expansion.getIdentifier().toLowerCase();
|
final String identifier = expansion.getIdentifier().toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
if (!expansion.canRegister()) {
|
if (!expansion.canRegister()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (expansions.containsKey(identifier)) {
|
||||||
|
Msg.warn("Failed to load expansion %s. Identifier is already in use.",
|
||||||
|
expansion.getIdentifier());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (expansion instanceof Configurable) {
|
if (expansion instanceof Configurable) {
|
||||||
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
||||||
@@ -230,8 +258,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
if (expansion instanceof VersionSpecific) {
|
if (expansion instanceof VersionSpecific) {
|
||||||
VersionSpecific nms = (VersionSpecific) expansion;
|
VersionSpecific nms = (VersionSpecific) expansion;
|
||||||
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
|
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
|
||||||
plugin.getLogger().warning("Your server version is not compatible with expansion " +
|
Msg.warn("Your server version is incompatible with expansion %s %s",
|
||||||
expansion.getIdentifier() + " " + expansion.getVersion());
|
expansion.getIdentifier(), expansion.getVersion());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,12 +269,13 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ExpansionRegisterEvent event = new ExpansionRegisterEvent(expansion);
|
// this is temp
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
// final ExpansionRegisterEvent event = new ExpansionRegisterEvent(expansion);
|
||||||
|
// Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
//
|
||||||
return false;
|
// if (event.isCancelled()) {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
expansionsLock.lock();
|
expansionsLock.lock();
|
||||||
try {
|
try {
|
||||||
@@ -258,8 +287,9 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
if (expansion instanceof Listener) {
|
if (expansion instanceof Listener) {
|
||||||
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
|
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLogger().info("Successfully registered expansion: " + expansion.getIdentifier());
|
Msg.info("Successfully registered expansion: %s [%s]", expansion.getIdentifier(),
|
||||||
|
expansion.getVersion());
|
||||||
|
|
||||||
if (expansion instanceof Taskable) {
|
if (expansion instanceof Taskable) {
|
||||||
((Taskable) expansion).start();
|
((Taskable) expansion).start();
|
||||||
@@ -281,7 +311,7 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
|
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
|
||||||
if (expansions.remove(expansion.getIdentifier()) == null) {
|
if (expansions.remove(expansion.getIdentifier().toLowerCase(Locale.ROOT)) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,27 +340,45 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void registerAll(@NotNull final CommandSender sender) {
|
private void registerAll(@NotNull final CommandSender sender) {
|
||||||
plugin.getLogger().info("Placeholder expansion registration initializing...");
|
Msg.info("Placeholder expansion registration initializing...");
|
||||||
|
|
||||||
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
|
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "failed to load class files of expansions", exception);
|
Msg.severe("Failed to load class files of expansion.", exception);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long registered = classes.stream()
|
final List<PlaceholderExpansion> registered = classes.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.map(this::register)
|
.map(this::register)
|
||||||
.filter(Optional::isPresent)
|
.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();
|
.count();
|
||||||
|
|
||||||
Msg.msg(sender,
|
StringBuilder message = new StringBuilder(registered.size() == 0 ? "&6" : "&a")
|
||||||
registered == 0 ? "&6No expansions were registered!"
|
.append(registered.size())
|
||||||
: registered + "&a placeholder hooks successfully registered!");
|
.append(' ')
|
||||||
|
.append("placeholder hook(s) registered!");
|
||||||
|
|
||||||
|
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());
|
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +394,12 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
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)
|
.map(this::findExpansionInFile)
|
||||||
.collect(Futures.collector());
|
.collect(Futures.collector());
|
||||||
}
|
}
|
||||||
@@ -359,8 +412,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
final Class<? extends PlaceholderExpansion> expansionClass = FileUtil.findClass(file, PlaceholderExpansion.class);
|
final Class<? extends PlaceholderExpansion> expansionClass = FileUtil.findClass(file, PlaceholderExpansion.class);
|
||||||
|
|
||||||
if (expansionClass == null) {
|
if (expansionClass == null) {
|
||||||
plugin.getLogger().severe("Failed to load Expansion: " + file.getName() + ", as it does not have" +
|
Msg.severe("Failed to load expansion %s, as it does not have a class which"
|
||||||
" a class which extends PlaceholderExpansion.");
|
+ " extends PlaceholderExpansion", file.getName());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,19 +421,17 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
.map(method -> new MethodSignature(method.getName(), method.getParameterTypes()))
|
.map(method -> new MethodSignature(method.getName(), method.getParameterTypes()))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
if (!expansionMethods.containsAll(ABSTRACT_EXPANSION_METHODS)) {
|
if (!expansionMethods.containsAll(ABSTRACT_EXPANSION_METHODS)) {
|
||||||
plugin.getLogger().severe("Failed to load Expansion: " + file.getName() + ", as it does not have the" +
|
Msg.severe("Failed to load expansion %s, as it does not have the required"
|
||||||
" required methods declared for a PlaceholderExpansion.");
|
+ " methods declared for a PlaceholderExpansion.", file.getName());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return expansionClass;
|
return expansionClass;
|
||||||
} catch (final VerifyError ex) {
|
} catch (VerifyError | NoClassDefFoundError e) {
|
||||||
plugin.getLogger().severe("Failed to load Expansion class " + file.getName() +
|
Msg.severe("Failed to load expansion %s (is a dependency missing?)", e, file.getName());
|
||||||
" (Is a dependency missing?)");
|
|
||||||
plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage());
|
|
||||||
return null;
|
return null;
|
||||||
} catch (final Exception ex) {
|
} catch (Exception e) {
|
||||||
throw new CompletionException(ex);
|
throw new CompletionException(e.getMessage() + " (expansion file: " + file.getAbsolutePath() + ")", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -395,9 +446,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
if (ex.getCause() instanceof LinkageError) {
|
if (ex.getCause() instanceof LinkageError) {
|
||||||
throw ((LinkageError) ex.getCause());
|
throw ((LinkageError) ex.getCause());
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLogger().warning("There was an issue with loading an expansion.");
|
|
||||||
|
|
||||||
|
Msg.warn("There was an issue with loading an expansion.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,7 +477,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expansion.unregister();
|
expansion.unregister();
|
||||||
plugin.getLogger().info("Unregistered placeholder expansion: " + expansion.getName());
|
Msg.info("Unregistered placeholder expansion %s", expansion.getIdentifier());
|
||||||
|
Msg.info("Reason: required plugin %s was disabled.", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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;
|
package me.clip.placeholderapi.expansion.manager;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -39,16 +39,6 @@ public final class ServerLoadEventListener implements Listener {
|
|||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
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
|
@EventHandler
|
||||||
public void onServerLoad(@NotNull final ServerLoadEvent event) {
|
public void onServerLoad(@NotNull final ServerLoadEvent event) {
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
|
@@ -1,178 +1,137 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* PlaceholderAPI is distributed in the hope that it will be useful,
|
* PlaceholderAPI is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package me.clip.placeholderapi.replacer;
|
package me.clip.placeholderapi.replacer;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.Locale;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import java.util.function.Function;
|
||||||
import org.bukkit.ChatColor;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.ChatColor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
public final class CharsReplacer implements Replacer {
|
|
||||||
|
public final class CharsReplacer implements Replacer {
|
||||||
@NotNull
|
|
||||||
private final Closure closure;
|
@NotNull
|
||||||
|
private final Closure closure;
|
||||||
public CharsReplacer(@NotNull final Closure closure) {
|
|
||||||
this.closure = closure;
|
public CharsReplacer(@NotNull final Closure closure) {
|
||||||
}
|
this.closure = closure;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@NotNull
|
||||||
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
|
@Override
|
||||||
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
|
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
|
||||||
final char[] chars = text.toCharArray();
|
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
|
||||||
final StringBuilder builder = new StringBuilder(text.length());
|
final char[] chars = text.toCharArray();
|
||||||
|
final StringBuilder builder = new StringBuilder(text.length());
|
||||||
final StringBuilder identifier = new StringBuilder();
|
|
||||||
final StringBuilder parameters = new StringBuilder();
|
final StringBuilder identifier = new StringBuilder();
|
||||||
|
final StringBuilder parameters = new StringBuilder();
|
||||||
for (int i = 0; i < chars.length; i++) {
|
|
||||||
final char l = chars[i];
|
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 (l != closure.head || i + 1 >= chars.length) {
|
||||||
|
builder.append(l);
|
||||||
if (c != '0' && c != '1' && c != '2' && c != '3' && c != '4' && c != '5' && c != '6'
|
continue;
|
||||||
&& 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') {
|
boolean identified = false;
|
||||||
builder.append(l).append(chars[i]);
|
boolean invalid = true;
|
||||||
} else {
|
boolean hadSpace = false;
|
||||||
builder.append(ChatColor.COLOR_CHAR);
|
|
||||||
|
while (++i < chars.length) {
|
||||||
if (c != 'x') {
|
final char p = chars[i];
|
||||||
builder.append(chars[i]);
|
|
||||||
continue;
|
if (p == ' ' && !identified) {
|
||||||
}
|
hadSpace = true;
|
||||||
|
break;
|
||||||
if ((i > 1 && chars[i - 2] == '\\') /*allow escaping &x*/) {
|
}
|
||||||
builder.setLength(builder.length() - 2);
|
if (p == closure.tail) {
|
||||||
builder.append('&').append(chars[i]);
|
invalid = false;
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append(c);
|
if (p == '_' && !identified) {
|
||||||
|
identified = true;
|
||||||
int j = 0;
|
continue;
|
||||||
while (++j <= 6) {
|
}
|
||||||
if (i + j >= chars.length) {
|
|
||||||
break;
|
if (identified) {
|
||||||
}
|
parameters.append(p);
|
||||||
|
} else {
|
||||||
final char x = chars[i + j];
|
identifier.append(p);
|
||||||
builder.append(ChatColor.COLOR_CHAR).append(x);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j == 7) {
|
final String identifierString = identifier.toString();
|
||||||
i += 6;
|
final String lowercaseIdentifierString = identifierString.toLowerCase(Locale.ROOT);
|
||||||
} else {
|
final String parametersString = parameters.toString();
|
||||||
builder.setLength(builder.length() - (j * 2)); // undo &x parsing
|
|
||||||
}
|
identifier.setLength(0);
|
||||||
}
|
parameters.setLength(0);
|
||||||
continue;
|
|
||||||
}
|
if (invalid) {
|
||||||
|
builder.append(closure.head).append(identifierString);
|
||||||
if (l != closure.head || i + 1 >= chars.length) {
|
|
||||||
builder.append(l);
|
if (identified) {
|
||||||
continue;
|
builder.append('_').append(parametersString);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean identified = false;
|
if (hadSpace) {
|
||||||
boolean oopsitsbad = true;
|
builder.append(' ');
|
||||||
boolean hadSpace = false;
|
}
|
||||||
|
continue;
|
||||||
while (++i < chars.length) {
|
}
|
||||||
final char p = chars[i];
|
|
||||||
|
final PlaceholderExpansion placeholder = lookup.apply(lowercaseIdentifierString);
|
||||||
if (p == ' ' && !identified) {
|
if (placeholder == null) {
|
||||||
hadSpace = true;
|
builder.append(closure.head).append(identifierString);
|
||||||
break;
|
|
||||||
}
|
if (identified) {
|
||||||
if (p == closure.tail) {
|
builder.append('_');
|
||||||
oopsitsbad = false;
|
}
|
||||||
break;
|
|
||||||
}
|
builder.append(parametersString).append(closure.tail);
|
||||||
|
continue;
|
||||||
if (p == '_' && !identified) {
|
}
|
||||||
identified = true;
|
|
||||||
continue;
|
final String replacement = placeholder.onRequest(player, parametersString);
|
||||||
}
|
if (replacement == null) {
|
||||||
|
builder.append(closure.head).append(identifierString);
|
||||||
if (identified) {
|
|
||||||
parameters.append(p);
|
if (identified) {
|
||||||
} else {
|
builder.append('_');
|
||||||
identifier.append(p);
|
}
|
||||||
}
|
|
||||||
}
|
builder.append(parametersString).append(closure.tail);
|
||||||
|
continue;
|
||||||
final String identifierString = identifier.toString().toLowerCase();
|
}
|
||||||
final String parametersString = parameters.toString();
|
|
||||||
|
builder.append(replacement);
|
||||||
identifier.setLength(0);
|
}
|
||||||
parameters.setLength(0);
|
|
||||||
|
return builder.toString();
|
||||||
if (oopsitsbad) {
|
}
|
||||||
builder.append(closure.head).append(identifierString);
|
|
||||||
|
}
|
||||||
if (identified) {
|
|
||||||
builder.append('_').append(parametersString);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hadSpace) {
|
|
||||||
builder.append(' ');
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final PlaceholderExpansion placeholder = lookup.apply(identifierString);
|
|
||||||
if (placeholder == null) {
|
|
||||||
builder.append(closure.head).append(identifierString);
|
|
||||||
|
|
||||||
if (identified) {
|
|
||||||
builder.append('_');
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(parametersString).append(closure.tail);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String replacement = placeholder.onRequest(player, parametersString);
|
|
||||||
if (replacement == null) {
|
|
||||||
builder.append(closure.head).append(identifierString);
|
|
||||||
|
|
||||||
if (identified) {
|
|
||||||
builder.append('_');
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(parametersString).append(closure.tail);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(ChatColor.translateAlternateColorCodes('&', replacement));
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of PlaceholderAPI
|
|
||||||
*
|
|
||||||
* PlaceholderAPI
|
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
|
||||||
*
|
|
||||||
* PlaceholderAPI is 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.replacer;
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public final class RegexReplacer implements Replacer {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private final Pattern pattern;
|
|
||||||
|
|
||||||
public RegexReplacer(@NotNull final Closure closure) {
|
|
||||||
this.pattern = Pattern.compile(String
|
|
||||||
.format("\\%s((?<identifier>[a-zA-Z0-9]+)_)(?<parameters>[^%s%s]+)\\%s", closure.head,
|
|
||||||
closure.head, closure.tail, closure.tail));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
|
|
||||||
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
|
|
||||||
final Matcher matcher = pattern.matcher(text);
|
|
||||||
if (!matcher.find()) {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
final StringBuffer builder = new StringBuffer();
|
|
||||||
|
|
||||||
do {
|
|
||||||
final String identifier = matcher.group("identifier");
|
|
||||||
final String parameters = matcher.group("parameters");
|
|
||||||
|
|
||||||
final PlaceholderExpansion expansion = lookup.apply(identifier);
|
|
||||||
if (expansion == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String requested = expansion.onRequest(player, parameters);
|
|
||||||
matcher.appendReplacement(builder, requested != null ? requested : matcher.group(0));
|
|
||||||
}
|
|
||||||
while (matcher.find());
|
|
||||||
|
|
||||||
return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(builder).toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -24,6 +24,7 @@ import java.io.BufferedReader;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
@@ -54,35 +55,43 @@ public class UpdateChecker implements Listener {
|
|||||||
return spigotVersion;
|
return spigotVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo: Figure out a better approach for this?
|
||||||
public void fetch() {
|
public void fetch() {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
CompletableFuture<Boolean> update = new CompletableFuture<>();
|
||||||
|
CompletableFuture.supplyAsync(() -> {
|
||||||
try {
|
try {
|
||||||
HttpsURLConnection con = (HttpsURLConnection) new URL(
|
HttpsURLConnection con = (HttpsURLConnection) new URL(
|
||||||
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
|
"https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID).openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
spigotVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
spigotVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
plugin.getLogger().info("Failed to check for updates on spigot.");
|
plugin.getLogger().info("Failed to check for updates on spigot.");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spigotVersion == null || spigotVersion.isEmpty()) {
|
if (spigotVersion == null || spigotVersion.isEmpty()) {
|
||||||
return;
|
plugin.getLogger().info("Failed to check for updates on spigot.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAvailable = spigotIsNewer();
|
updateAvailable = spigotIsNewer();
|
||||||
|
|
||||||
if (!updateAvailable) {
|
if (!updateAvailable) {
|
||||||
return;
|
plugin.getLogger().info("PlaceholderAPI is up to date.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
update.whenComplete((result, error) -> {
|
||||||
|
if (result) {
|
||||||
plugin.getLogger()
|
plugin.getLogger()
|
||||||
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
|
.info("An update for PlaceholderAPI (v" + getSpigotVersion() + ") is available at:");
|
||||||
plugin.getLogger()
|
plugin.getLogger()
|
||||||
.info("https://www.spigotmc.org/resources/placeholderapi." + RESOURCE_ID + "/");
|
.info("https://www.spigotmc.org/resources/placeholderapi." + RESOURCE_ID + "/");
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
Bukkit.getPluginManager().registerEvents(UpdateChecker.this, plugin);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -50,7 +50,7 @@ public final class Format {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@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)
|
return stream(spacing)
|
||||||
.mapToObj(space -> "%" + (align == Align.LEFT ? "-" : "") + (space + 2) + "s")
|
.mapToObj(space -> "%" + (align == Align.LEFT ? "-" : "") + (space + 2) + "s")
|
||||||
.collect(joining());
|
.collect(joining());
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -40,11 +40,7 @@ public final class Futures {
|
|||||||
@NotNull final CompletableFuture<T> future,
|
@NotNull final CompletableFuture<T> future,
|
||||||
@NotNull final BiConsumer<T, Throwable> consumer) {
|
@NotNull final BiConsumer<T, Throwable> consumer) {
|
||||||
future.whenComplete((value, exception) -> {
|
future.whenComplete((value, exception) -> {
|
||||||
if (Bukkit.isPrimaryThread()) {
|
consumer.accept(value, exception);
|
||||||
consumer.accept(value, exception);
|
|
||||||
} else {
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(value, exception));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -21,14 +21,40 @@
|
|||||||
package me.clip.placeholderapi.util;
|
package me.clip.placeholderapi.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public final class Msg {
|
public final class Msg {
|
||||||
|
|
||||||
|
public static void log(Level level, String msg, Object... args) {
|
||||||
|
PlaceholderAPIPlugin.getInstance().getLogger().log(level, String.format(msg, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(String msg, Object... args) {
|
||||||
|
log(Level.INFO, msg, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warn(String msg, Object... args) {
|
||||||
|
log(Level.WARNING, msg, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warn(String msg, Throwable throwable, Object... args){
|
||||||
|
PlaceholderAPIPlugin.getInstance().getLogger().log(Level.WARNING, String.format(msg, args), throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void severe(String msg, Object... args) {
|
||||||
|
log(Level.SEVERE, msg, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void severe(String msg, Throwable throwable, Object... args) {
|
||||||
|
PlaceholderAPIPlugin.getInstance().getLogger().log(Level.SEVERE, String.format(msg, args), throwable);
|
||||||
|
}
|
||||||
|
|
||||||
public static void msg(@NotNull final CommandSender sender, @NotNull final String... messages) {
|
public static void msg(@NotNull final CommandSender sender, @NotNull final String... messages) {
|
||||||
if (messages.length == 0) {
|
if (messages.length == 0) {
|
||||||
return;
|
return;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
name: "@name@"
|
name: PlaceholderAPI
|
||||||
main: "me.clip.placeholderapi.PlaceholderAPIPlugin"
|
main: "me.clip.placeholderapi.PlaceholderAPIPlugin"
|
||||||
|
|
||||||
version: "@version@"
|
version: ${version}
|
||||||
author: HelpChat
|
author: HelpChat
|
||||||
|
|
||||||
|
folia-supported: true
|
||||||
|
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
description: "@description@"
|
description: "An awesome placeholder provider!"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
placeholderapi:
|
placeholderapi:
|
||||||
|
@@ -23,7 +23,6 @@ package me.clip.placeholderapi;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.replacer.CharsReplacer;
|
import me.clip.placeholderapi.replacer.CharsReplacer;
|
||||||
import me.clip.placeholderapi.replacer.RegexReplacer;
|
|
||||||
import me.clip.placeholderapi.replacer.Replacer;
|
import me.clip.placeholderapi.replacer.Replacer;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -40,7 +39,6 @@ public interface Values {
|
|||||||
|
|
||||||
|
|
||||||
Replacer CHARS_REPLACER = new CharsReplacer(Replacer.Closure.PERCENT);
|
Replacer CHARS_REPLACER = new CharsReplacer(Replacer.Closure.PERCENT);
|
||||||
Replacer REGEX_REPLACER = new RegexReplacer(Replacer.Closure.PERCENT);
|
|
||||||
|
|
||||||
|
|
||||||
final class MockPlayerPlaceholderExpansion extends PlaceholderExpansion {
|
final class MockPlayerPlaceholderExpansion extends PlaceholderExpansion {
|
||||||
|
@@ -30,19 +30,9 @@ public class ReplacerBenchmarks {
|
|||||||
Values.CHARS_REPLACER.apply(Values.SMALL_TEXT, null, Values.PLACEHOLDERS::get);
|
Values.CHARS_REPLACER.apply(Values.SMALL_TEXT, null, Values.PLACEHOLDERS::get);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
|
||||||
public void measureRegexReplacerSmallText() {
|
|
||||||
Values.REGEX_REPLACER.apply(Values.SMALL_TEXT, null, Values.PLACEHOLDERS::get);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void measureCharsReplacerLargeText() {
|
public void measureCharsReplacerLargeText() {
|
||||||
Values.CHARS_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get);
|
Values.CHARS_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
|
||||||
public void measureRegexReplacerLargeText() {
|
|
||||||
Values.REGEX_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@@ -37,12 +37,6 @@ public final class ReplacerUnitTester {
|
|||||||
Values.CHARS_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
|
Values.CHARS_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testRegexReplacerProducesExpectedSingleValue() {
|
|
||||||
assertEquals(PLAYER_NAME,
|
|
||||||
Values.REGEX_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCharsReplacerProducesExpectedSentence() {
|
void testCharsReplacerProducesExpectedSentence() {
|
||||||
assertEquals(String.format(
|
assertEquals(String.format(
|
||||||
@@ -51,36 +45,14 @@ public final class ReplacerUnitTester {
|
|||||||
Values.CHARS_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get));
|
Values.CHARS_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testRegexReplacerProducesExpectedSentence() {
|
|
||||||
assertEquals(String.format(
|
|
||||||
"My name is %s and my location is (%s, %s, %s), this placeholder is invalid %%server_name%%",
|
|
||||||
PLAYER_NAME, PLAYER_X, PLAYER_Y, PLAYER_Z),
|
|
||||||
Values.REGEX_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testResultsAreTheSameAsReplacement() {
|
void testResultsAreTheSameAsReplacement() {
|
||||||
final String resultChars = Values.CHARS_REPLACER
|
final String resultChars = Values.CHARS_REPLACER
|
||||||
.apply("%player_name%", null, Values.PLACEHOLDERS::get);
|
.apply("%player_name%", null, Values.PLACEHOLDERS::get);
|
||||||
final String resultRegex = Values.REGEX_REPLACER
|
|
||||||
.apply("%player_name%", null, Values.PLACEHOLDERS::get);
|
|
||||||
|
|
||||||
assertEquals(resultChars, resultRegex);
|
|
||||||
|
|
||||||
assertEquals(PLAYER_NAME, resultChars);
|
assertEquals(PLAYER_NAME, resultChars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testResultsAreTheSameNoReplacement() {
|
|
||||||
final String resultChars = Values.CHARS_REPLACER
|
|
||||||
.apply("%player_location%", null, Values.PLACEHOLDERS::get);
|
|
||||||
final String resultRegex = Values.REGEX_REPLACER
|
|
||||||
.apply("%player_location%", null, Values.PLACEHOLDERS::get);
|
|
||||||
|
|
||||||
assertEquals(resultChars, resultRegex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCharsReplacerIgnoresMalformed() {
|
void testCharsReplacerIgnoresMalformed() {
|
||||||
final String text = "10% and %hello world 15%";
|
final String text = "10% and %hello world 15%";
|
||||||
@@ -88,12 +60,4 @@ public final class ReplacerUnitTester {
|
|||||||
assertEquals(text, Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
|
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
239
wiki/Commands.md
239
wiki/Commands.md
@@ -1,239 +0,0 @@
|
|||||||
This page shows all commands, including with a detailed description of what every command does.
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
- **[Parse Commands](#parse-commands)**
|
|
||||||
- [`/papi bcparse <player|me> <string>`](#papi-bcparse)
|
|
||||||
- [`/papi cmdparse <player|me> <string>`](#papi-cmdparse)
|
|
||||||
- [`/papi parse <player|me> <string>`](#papi-parse)
|
|
||||||
- [`/papi parserel <player> <player> <string>`](#papi-parserel)
|
|
||||||
|
|
||||||
- **[eCloud Commands](#ecloud-commands)**
|
|
||||||
- [`/papi ecloud clear`](#papi-ecloud-clear)
|
|
||||||
- [`/papi ecloud disable`](#papi-ecloud-disable)
|
|
||||||
- [`/papi ecloud download <expansion> [version]`](#papi-ecloud-download)
|
|
||||||
- [`/papi ecloud enable`](#papi-ecloud-enable)
|
|
||||||
- [`/papi ecloud info <expansion> [version]`](#papi-ecloud-info)
|
|
||||||
- [`/papi ecloud list <all|<author>|installed>`](#papi-ecloud-list)
|
|
||||||
- [`/papi ecloud placeholders <expansion>`](#papi-ecloud-placeholders)
|
|
||||||
- [`/papi ecloud refresh`](#papi-ecloud-refresh)
|
|
||||||
- [`/papi ecloud status`](#papi-ecloud-status)
|
|
||||||
|
|
||||||
- **[Expansion Commands](#expansion-commands)**
|
|
||||||
- [`/papi info <expansion>`](#papi-info)
|
|
||||||
- [`/papi list`](#papi-list)
|
|
||||||
- [`/papi register <jar file>`](#papi-register)
|
|
||||||
- [`/papi unregister <jar file>`](#papi-unregister)
|
|
||||||
|
|
||||||
- **[Other Commands](#other-commands)**
|
|
||||||
- [`/papi dump`](#papi-dump)
|
|
||||||
- [`/papi help`](#papi-help)
|
|
||||||
- [`/papi reload`](#papi-reload)
|
|
||||||
- [`/papi version`](#papi-version)
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
### Parse Commands
|
|
||||||
These commands are used to parse placeholders into their respective values. Useful for debugging.
|
|
||||||
|
|
||||||
- #### `/papi bcparse`
|
|
||||||
**Description**:
|
|
||||||
Parses placeholders of a String and broadcasts the result to all players.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
* `<player|me>` - The Player to parse values of the placeholder (Use `me` for yourself).
|
|
||||||
* `<Text with placeholders>` - The text to parse.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi bcparse funnycube My name is %player_name%!
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi cmdparse`
|
|
||||||
**Description**:
|
|
||||||
Parses placeholders of a String and executes it as a command.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<player|me>` - The player to parse placeholders against. Use `me` for yourself.
|
|
||||||
- `<Command with placeholders>` - The Text to parse and execute as command. Please leave away the `/` of the command.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi cmdparse funnycube say My name is %player_name%!
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi parse`
|
|
||||||
**Description**:
|
|
||||||
Parses the placeholders in a given text and shows the result.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
* `<player|me>` - The Player to parse values of the placeholder (Use `me` for yourself).
|
|
||||||
* `<Text with placeholders>` - The text to parse.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi parse funnycube My group is %vault_group%
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi parserel`
|
|
||||||
**Description**:
|
|
||||||
Parses a relational placeholder.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
* `<player1>` - The first player.
|
|
||||||
* `<player2>` - the second player to compare with.
|
|
||||||
* `<Text with placeholders>` - The actual placeholder to parse.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi parserel funnycube extended_clip %placeholder%
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
### eCloud Commands
|
|
||||||
These commands all start with `/papi ecloud` and are used for things related about the [[Expansion Cloud]].
|
|
||||||
|
|
||||||
- #### `/papi ecloud clear`
|
|
||||||
**Description**:
|
|
||||||
Clears the cache for the eCloud.
|
|
||||||
|
|
||||||
- #### `/papi ecloud disable`
|
|
||||||
**Description**:
|
|
||||||
Disables the connection to the eCloud.
|
|
||||||
|
|
||||||
- #### `/papi ecloud download`
|
|
||||||
**Description**:
|
|
||||||
Allows you to download an expansion from the eCloud
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<expansion>` - The expansion to download.
|
|
||||||
- `[version]` - The specific version of the expansion to download (Optional)
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi ecloud download Vault
|
|
||||||
/papi ecloud download Vault 1.5.2
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi ecloud enable`
|
|
||||||
**Description**:
|
|
||||||
Enables the connection to the eCloud
|
|
||||||
|
|
||||||
- #### `/papi ecloud info`
|
|
||||||
**Description**:
|
|
||||||
Gives information about a specific Expansion.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<expansion>` - The Expansion to retrieve information from.
|
|
||||||
- `[version]` - The Expansion's version to get information from.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi ecloud info Vault
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi ecloud list`
|
|
||||||
**Description**:
|
|
||||||
Lists either all Expansions on the eCloud, only those by a specific author or only those that you have [installed](#papi-ecloud-download).
|
|
||||||
Installed Expansions show as green in the list and Expansions that are installed and have an update available show as gold.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<all|<author>|installed>` - List all Expansions, Expansions of a specific author or all Expnansions you have installed.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi ecloud list all
|
|
||||||
/papi ecloud list clip
|
|
||||||
/papi ecloud list installed
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi ecloud placeholders`
|
|
||||||
**Description**:
|
|
||||||
List all placeholders of an Expansion.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<expansion>` - The Expansion to list placeholders of.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi ecloud placeholders Vault
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi ecloud refresh`
|
|
||||||
**Description**:
|
|
||||||
Refresh the cached data from the eCloud.
|
|
||||||
|
|
||||||
- #### `/papi ecloud status`
|
|
||||||
**Description**:
|
|
||||||
Displays the actual Status of the eCloud.
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
### Expansion Commands
|
|
||||||
These commands can be used to manage the expansions that you have currently installed.
|
|
||||||
|
|
||||||
- #### `/papi info`
|
|
||||||
**Description**:
|
|
||||||
Gives you information about the specified Expansion.
|
|
||||||
|
|
||||||
**Argument(s)**:
|
|
||||||
- `<expansion>` - The Expansion to get info from (Needs to be registered and active).
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi info Vault
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi list`
|
|
||||||
**Description**:
|
|
||||||
Lists all active/registered expansions.
|
|
||||||
This is different to [/papi ecloud list installed](#papi-ecloud-list) in the fact, that it also includes expansions that were installed through a plugin (That aren't a separate jar-file) and it also doesn't show which one have updates available.
|
|
||||||
|
|
||||||
- #### `/papi register`
|
|
||||||
**Description**:
|
|
||||||
Registers an expansion from a specified filename.
|
|
||||||
This is useful in cases, where you downloaded the expansion manually and don't want to restart the server.
|
|
||||||
The file needs to be inside `/plugins/PlaceholderAPI/expansions`.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<filename>` - The file to register (including the file-extension).
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi register MyExpansion.jar
|
|
||||||
```
|
|
||||||
|
|
||||||
- #### `/papi unregister`
|
|
||||||
**Description**:
|
|
||||||
Unregisters the specified expansion.
|
|
||||||
|
|
||||||
**Arguments**:
|
|
||||||
- `<filename>` - The expansion to unregister.
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
```
|
|
||||||
/papi unregister MyExpansion.jar
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
### Other Commands
|
|
||||||
These are other commands of PlaceholderAPI that don't fit any of the above categories.
|
|
||||||
|
|
||||||
- #### `/papi dump`
|
|
||||||
**Description**:
|
|
||||||
Pastes useful information from PlaceholderAPI such as plugin version, server version and installed expansions to https://paste.helpch.at for simple sharing and support.
|
|
||||||
|
|
||||||
- #### `/papi help`
|
|
||||||
**Description**:
|
|
||||||
Displays all the commands PlaceholderAPI currently offers.
|
|
||||||
|
|
||||||
- #### `/papi reload`
|
|
||||||
**Description**:
|
|
||||||
Reloads the config settings.
|
|
||||||
You need to use this command after [downloading Expansions](#papi-ecloud-download) from the eCloud or they won't be properly registered.
|
|
||||||
|
|
||||||
- #### `/papi version`
|
|
||||||
**Description**:
|
|
||||||
Shows the current version and authors of PlaceholderAPI.
|
|
@@ -1,67 +0,0 @@
|
|||||||
## About
|
|
||||||
PlaceholderAPI uses an expansion-cloud (A website that has all kinds of expansions stored), to download jar-files, that contain the placeholders for it to use.
|
|
||||||
|
|
||||||
The expansion-cloud can be seen under https://api.extendedclip.com/home
|
|
||||||
|
|
||||||
## How it works
|
|
||||||
PlaceholderAPI connects to the ecloud on startup of your server, to check if the cloud is available and how many expansions are available on it.
|
|
||||||
If you run `/papi ecloud download <expansion>` PlaceholderAPI will connect to the site to first check if the specified expansion exists and then downloads it if it does.
|
|
||||||
Note that not all listed expansions are on the ecloud. Some are in the corresponding plugin itself and are registered on the startup of the server.
|
|
||||||
|
|
||||||
You can disable the connection to the cloud by setting `cloud_enabled` in the config.yml to false.
|
|
||||||
|
|
||||||
## Adding your own expansion
|
|
||||||
You can add your own expansion to the expansion-cloud for others to use.
|
|
||||||
In order to do that, you have to follow those steps:
|
|
||||||
1. Make sure you have created a seperate jar-file like explained on the page [[PlaceholderExpansion]].
|
|
||||||
2. Create an account on the site, or log in, if you already have one.
|
|
||||||
3. Click on `Expansions` and then on [`Upload New`](https://api.extendedclip.com/manage/add/).
|
|
||||||
4. Fill out the required information. `Source URL` and `Dependency URL` are optional.
|
|
||||||
5. Click on the button that says `Choose an file...` and select the jar of your expansion.
|
|
||||||
* **Important**! Make sure, that the name of the jar-file contains the same version like you set in the version-field!
|
|
||||||
6. Click on `Submit Expansion`
|
|
||||||
|
|
||||||
Your expansion is now uploaded and will be reviewed by a moderator.
|
|
||||||
If everything is ok will your expansion be approved and will be available on the ecloud for PlaceholderAPI*.
|
|
||||||
|
|
||||||
> *You can only download verified Expansions through PlaceholderAPIs command, unless you enable the option `cloud_allow_unverified_expansions` in the config.yml
|
|
||||||
> Unverified expansions can be downloaded manually by going to the site and download it yourself.
|
|
||||||
|
|
||||||
## Updating your expansion
|
|
||||||
Before you update, please note the following:
|
|
||||||
If you aren't a verified dev and you upload an update, your expansion will become **unverified** until a moderator reviews the update and approves it!
|
|
||||||
It is recommended to only update the expansion, if it contains huge changes or bug fixes.
|
|
||||||
|
|
||||||
To update your expansion, you first have to go to the list of [your expansions](https://api.extendedclip.com/manage/).
|
|
||||||
For that click on `Expansions` and select `Your Expansions`.
|
|
||||||
After that, follow those steps:
|
|
||||||
1. Click the name of the expansion, that you want to update.
|
|
||||||
2. Click on the button that says `Version`
|
|
||||||
3. Click on `Add Version`
|
|
||||||
4. Fill out the fields and upload the new jar.
|
|
||||||
* **Important**! Make sure, that the name of the jar-file contains the same version like you set in the version-field!
|
|
||||||
5. Click on `Save Changes`
|
|
||||||
|
|
||||||
If you're a verified dev, your version will be approved and is available directly.
|
|
||||||
If you aren't a verified dev, you have to wait until a moderator approves the update.
|
|
||||||
|
|
||||||
## Downloading a specific expansion version
|
|
||||||
In some cases, you may want to use a specific, older version of expansion. Such a case could be for example, when you run an old server version and the newest version of an expansion uses methods that aren't available on that particular server version.
|
|
||||||
For that case is there a way, to download a specific version of expansion. You can download the expansion either manually, or through PlaceholderAPI itself.
|
|
||||||
Here is how you can do it for each.
|
|
||||||
|
|
||||||
### Download with PlaceholderAPI
|
|
||||||
This is the easiest of both methods since it requires the least amount of effort.
|
|
||||||
Run the following command in-game or in your console to download a specific version:
|
|
||||||
`/papi ecloud download <expansion> [version]`
|
|
||||||
|
|
||||||
To find out, what versions are available for the expansion, run `/papi ecloud info <expansion>`
|
|
||||||
You can then run `/papi ecloud versioninfo <expansion> <version>` to receive more infor about a specific version.
|
|
||||||
|
|
||||||
After you downloaded the specific version, run `/papi reload` to refresh the installed expansions.
|
|
||||||
|
|
||||||
### Download manually
|
|
||||||
To download an expansion manually, you first have to connect to the website and go to the expansion of your choice.
|
|
||||||
There, you click on the button that says `Version` and click on the download-icon of the version you want to download.
|
|
||||||
|
|
||||||
Finally, stop your server, upload the jar to the folder in `/plugins/PlaceholderAPI/expansions` (Make sure to delete the old jar, if there's already one) and start the server again.
|
|
55
wiki/FAQ.md
55
wiki/FAQ.md
@@ -1,55 +0,0 @@
|
|||||||
[readme]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md
|
|
||||||
|
|
||||||
Here are frequently asked questions about stuff related to PlaceholderAPI.
|
|
||||||
|
|
||||||
## It only shows `%placeholder%` and not the variable
|
|
||||||
When a plugin or `/papi parse me %placeholder%` only returns the placeholder itself and no value should you check for the following things:
|
|
||||||
|
|
||||||
### The expansion is actually installed.
|
|
||||||
In many cases is the cause that the expansion of the placeholder is missing.
|
|
||||||
Just execute `/papi ecloud download <name of expansion>` followed by `/papi reload` to activate it. You can find a list of Expansions and their Placeholders [[on this page|Placeholders]].
|
|
||||||
|
|
||||||
**NOTE!**
|
|
||||||
Not all placeholders come in their own expansion. Some plugins *hardcode* them in and load them on startup, when hooking into PlaceholderAPI.
|
|
||||||
|
|
||||||
### Plugin actualls supports PlaceholderAPI
|
|
||||||
It can happen that the plugin you use to display the placeholder in doesn't support PlaceholderAPI. In such a case check, if the parse command returns the actual value of a placeholder.
|
|
||||||
If that is the case while the plugin is still displaying the placeholder, can this be an indicator of the plugin not supporting PlaceholderAPI.
|
|
||||||
|
|
||||||
You can find a list of plugins supporting PlaceholderAPI [[here|Plugins-using-PlaceholderAPI]].
|
|
||||||
Just make sure that "Supports placeholders" has a check mark in front of it.
|
|
||||||
|
|
||||||
### No typo in the placeholder
|
|
||||||
Double-check that the placeholder you set doesn't contain a typo. You can use `/papi ecloud placeholders <expansion>` (replace `<expansion>` with the name of the expansion) to get a list of all the placeholders the expansion may have.
|
|
||||||
Keep in mind that this only works for separate expansions on the eCloud and not for those that are loaded by plugins.
|
|
||||||
|
|
||||||
### Plugin is enabled
|
|
||||||
If an expansion depends on a plugin, make sure you have the plugin installed and that it is enabled (Shows green in `/pl`).
|
|
||||||
|
|
||||||
## I can't download the expansion
|
|
||||||
Make sure, that the connection to the cloud (https://api.extendedclip.com) isn't blocked by a firewall or similar.
|
|
||||||
Next step would be to check if the expansion actually exists on the cloud. Not all plugins provide their placeholders through a separate jar on the cloud. Some have them build in and register them on startup.
|
|
||||||
|
|
||||||
If both checks failed, go to the cloud-page and download the jar manually. Put it then in the `expansions` folder of PlaceholderAPI (`/plugins/PlaceholderAPI/expansions`)
|
|
||||||
|
|
||||||
## How can other plugins use my placeholders with PlaceholderAPI?
|
|
||||||
A tutorial can be found [[here|Hook into PlaceholderAPI]]!
|
|
||||||
|
|
||||||
## Can I help on this wiki?
|
|
||||||
You sure can!
|
|
||||||
We welcome contributions to our wiki by everyone. If you found a typo or want to improve this wiki in another way, head over to the [Wiki's readme file][readme] to find out about how you can contribute towards this wiki.
|
|
||||||
|
|
||||||
## PlaceholderAPI is posting an error about an outdated expansion?
|
|
||||||
```
|
|
||||||
[00:00:01 ERROR]: [PlaceholderAPI] Failed to load Expansion class <expansion> (Is a dependency missing?)
|
|
||||||
[00:00:01 ERROR]: [PlaceholderAPI] Cause: NoClassDefFoundError <path>
|
|
||||||
```
|
|
||||||
|
|
||||||
If you receive the above error, try to do the following steps:
|
|
||||||
|
|
||||||
- Make sure any required dependency of the mentioned expansion (e.g. a plugin) is installed.
|
|
||||||
- Make sure you use the latest version supported for the server version you use.
|
|
||||||
- If you downloaded the jar from the ecloud, make sure it isn't malformed/corrupted.
|
|
||||||
|
|
||||||
If the issue persists after you've done those checks, report it to the author of the expansion.
|
|
||||||
In most cases is the issue that either a dependency is missing or that the expansion tries to use outdated methods from PlaceholderAPI.
|
|
77
wiki/Home.md
77
wiki/Home.md
@@ -1,77 +0,0 @@
|
|||||||
<p align="center">
|
|
||||||
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/master/wiki/img/wiki-logo.png" alt="PlaceholderAPI">
|
|
||||||
</p>
|
|
||||||
This wiki gives you information on how to create placeholders in your plugin that can be used in other plugins, how to use other placeholders inside your plugin, or how to make an expansion.
|
|
||||||
It also has a list with all available placeholders (Work in progress).
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
**[[Hook into PlaceholderAPI]]**
|
|
||||||
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
|
|
||||||
- [[Adding placeholders to PlaceholderAPI|PlaceholderExpansion]]
|
|
||||||
- [[Common Parts|PlaceholderExpansion#common-parts]]
|
|
||||||
- [[Without an external plugin|PlaceholderExpansion#without-a-plugin]]
|
|
||||||
- [[With an external Plugin (Separate Jar)|PlaceholderExpansion#with-a-plugin-external-jar]]
|
|
||||||
- [[With an external Plugin (Internal class)|PlaceholderExpansion#with-a-plugin-internal-class]]
|
|
||||||
- [[Relational Placeholders|PlaceholderExpansion#relational-placeholders]]
|
|
||||||
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
|
|
||||||
|
|
||||||
### Other
|
|
||||||
**[[Commands]]**
|
|
||||||
**[[Expansion cloud]]**
|
|
||||||
**[[FAQ]]**
|
|
||||||
**[[Plugins using PlaceholderAPI]]**
|
|
||||||
**[[Placeholders]]**
|
|
||||||
- [[Standalone|Placeholders#standalone]]
|
|
||||||
- [[A|Placeholders#a]]
|
|
||||||
- [[B|Placeholders#b]]
|
|
||||||
- [[C|Placeholders#c]]
|
|
||||||
- [[D|Placeholders#d]]
|
|
||||||
- [[E|Placeholders#e]]
|
|
||||||
- [[F|Placeholders#f]]
|
|
||||||
- [[G|Placeholders#g]]
|
|
||||||
- [[H|Placeholders#h]]
|
|
||||||
- [[I|Placeholders#i]]
|
|
||||||
- [[J|Placeholders#j]]
|
|
||||||
- [[K|Placeholders#k]]
|
|
||||||
- [[L|Placeholders#l]]
|
|
||||||
- [[M|Placeholders#m]]
|
|
||||||
- [[N|Placeholders#n]]
|
|
||||||
- [[O|Placeholders#o]]
|
|
||||||
- [[P|Placeholders#p]]
|
|
||||||
- [[Q|Placeholders#q]]
|
|
||||||
- [[R|Placeholders#r]]
|
|
||||||
- [[S|Placeholders#s]]
|
|
||||||
- [[T|Placeholders#t]]
|
|
||||||
- [[U|Placeholders#u]]
|
|
||||||
- [[V|Placeholders#v]]
|
|
||||||
- [[W|Placeholders#w]]
|
|
||||||
- [[X|Placeholders#x]]
|
|
||||||
- [[Y|Placeholders#y]]
|
|
||||||
- [[Z|Placeholders#z]]
|
|
||||||
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
|
|
||||||
- [[A|Placeholders#a-1]]
|
|
||||||
- [[B|Placeholders#b-1]]
|
|
||||||
- [[C|Placeholders#c-1]]
|
|
||||||
- [[D|Placeholders#d-1]]
|
|
||||||
- [[E|Placeholders#e-1]]
|
|
||||||
- [[F|Placeholders#f-1]]
|
|
||||||
- [[G|Placeholders#g-1]]
|
|
||||||
- [[H|Placeholders#h-1]]
|
|
||||||
- [[I|Placeholders#i-1]]
|
|
||||||
- [[J|Placeholders#j-1]]
|
|
||||||
- [[K|Placeholders#k-1]]
|
|
||||||
- [[L|Placeholders#l-1]]
|
|
||||||
- [[M|Placeholders#m-1]]
|
|
||||||
- [[N|Placeholders#n-1]]
|
|
||||||
- [[O|Placeholders#o-1]]
|
|
||||||
- [[P|Placeholders#p-1]]
|
|
||||||
- [[Q|Placeholders#q-1]]
|
|
||||||
- [[R|Placeholders#r-1]]
|
|
||||||
- [[S|Placeholders#s-1]]
|
|
||||||
- [[T|Placeholders#t-1]]
|
|
||||||
- [[U|Placeholders#u-1]]
|
|
||||||
- [[V|Placeholders#v-1]]
|
|
||||||
- [[W|Placeholders#w-1]]
|
|
||||||
- [[X|Placeholders#x-1]]
|
|
||||||
- [[Y|Placeholders#y-1]]
|
|
||||||
- [[Z|Placeholders#z-1]]
|
|
@@ -1,142 +0,0 @@
|
|||||||
[APIBadge]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
|
||||||
|
|
||||||
[SpigotBadge]: https://img.shields.io/spiget/version/6245?label=Spigot
|
|
||||||
[Spigot]: https://spigotmc.org/resources/6245
|
|
||||||
|
|
||||||
[GitHubBadge]: https://img.shields.io/github/v/release/PlaceholderAPI/PlaceholderAPI?label=GitHub%20Release
|
|
||||||
[GitHub]: /PlaceholderAPI/PlaceholderAPI/releases/latest
|
|
||||||
|
|
||||||
> [![SpigotBadge]][Spigot] [![GitHubBadge]][GitHub]
|
|
||||||
>
|
|
||||||
> ![APIBadge]
|
|
||||||
>
|
|
||||||
> *The GitHub release may be different from the spigot release*
|
|
||||||
|
|
||||||
This page is about using PlaceholderAPI in your own plugin, to either let other plugins use your plugin, or just use placeholders from other plugins in your own.
|
|
||||||
|
|
||||||
Please note, that the examples in this page are only available for **PlaceholderAPI 2.10.0 or higher**!
|
|
||||||
|
|
||||||
## First steps
|
|
||||||
Before you can actually make use of PlaceholderAPI, you first have to import it into your project.
|
|
||||||
|
|
||||||
### Import with Maven
|
|
||||||
To import PlaceholderAPI, simply add the following code to your **pom.xml**
|
|
||||||
Replace `{VERSION}` with the version listed at the top of this page.
|
|
||||||
```xml
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>placeholderapi</id>
|
|
||||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.clip</groupId>
|
|
||||||
<artifactId>placeholderapi</artifactId>
|
|
||||||
<version>{VERSION}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Import with Gradle
|
|
||||||
Here is how you can import PlaceholderAPI through gradle.
|
|
||||||
Put this into your **Gradle.build**.
|
|
||||||
Replace `{VERSION}` with the version listed at the top of this page.
|
|
||||||
```gradle
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'me.clip:placeholderapi:{VERSION}'
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Set PlaceholderAPI as (soft)depend
|
|
||||||
Next step is to go to your plugin.yml and add PlaceholderAPI as a depend or softdepend, depending (no pun intended) on if it is optional or not.
|
|
||||||
|
|
||||||
**Example Softdepend**:
|
|
||||||
```yaml
|
|
||||||
name: ExamplePlugin
|
|
||||||
version: 1.0
|
|
||||||
author: author
|
|
||||||
main: your.main.path.here
|
|
||||||
|
|
||||||
softdepend: [PlaceholderAPI] # This is used, if your plugin works without PlaceholderAPI.
|
|
||||||
```
|
|
||||||
|
|
||||||
**Example Depend**:
|
|
||||||
```yaml
|
|
||||||
name: ExamplePlugin
|
|
||||||
version: 1.0
|
|
||||||
author: author
|
|
||||||
main: your.main.path.here
|
|
||||||
|
|
||||||
depend: [PlaceholderAPI] # If your plugin requires PlaceholderAPI, to work, use this.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Adding placeholders to PlaceholderAPI
|
|
||||||
|
|
||||||
A full guide on how to create expansions can be found on the [[PlaceholderExpansion]] page of this wiki.
|
|
||||||
|
|
||||||
## Setting placeholders in your plugin
|
|
||||||
PlaceholderAPI offers the ability, to automatically parse placeholders from other plugins within your own plugin, giving the ability for your plugin to support thousands of other placeholders without depending on each plugin individually.
|
|
||||||
To use placeholders from other plugins in our own plugin, we simply have to [(soft)depend on PlaceholderAPI](#set-placeholderapi-as-softdepend) and use the `setPlaceholders` method.
|
|
||||||
|
|
||||||
It is also important to point out, that any required plugin/dependency for an expansion has to be on the server and enabled, or the `setPlaceholders` method will just return the placeholder itself (do nothing).
|
|
||||||
|
|
||||||
**Example**:
|
|
||||||
Let's assume we want to send an own join message that shows the group a player has.
|
|
||||||
To achieve that, we can do the following:
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi;
|
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
|
||||||
|
|
||||||
public class JoinExample extends JavaPlugin implements Listener {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
|
||||||
/*
|
|
||||||
* We register the EventListener here, when PlaceholderAPI is installed.
|
|
||||||
* Since all events are in the main class (this class), we simply use "this"
|
|
||||||
*/
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* We inform about the fact that PlaceholderAPI isn't installed and then
|
|
||||||
* disable this plugin to prevent issues.
|
|
||||||
*/
|
|
||||||
getLogger().warn("Could not find PlaceholderAPI! This plugin is required.");
|
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
|
||||||
public void onJoin(PlayerJoinEvent event) {
|
|
||||||
String joinText = "%player_name% &ajoined the server! They are rank &f%vault_rank%";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We parse the placeholders using "setPlaceholders"
|
|
||||||
* This would turn %vault_rank% into the name of the Group, that the
|
|
||||||
* joining player has.
|
|
||||||
*/
|
|
||||||
joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText);
|
|
||||||
|
|
||||||
event.setJoinMessage(joinText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
@@ -1,381 +0,0 @@
|
|||||||
[placeholderexpansion]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/expansion/PlaceholderExpansion.java
|
|
||||||
|
|
||||||
[playerexpansion]: https://github.com/PlaceholderAPI/Player-Expansion
|
|
||||||
[serverexpansion]: https://github.com/PlaceholderAPI/Server-Expansion
|
|
||||||
[mathexpansion]: https://github.com/Andre601/Math-expansion
|
|
||||||
|
|
||||||
[relational]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/expansion/Relational.java
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
This page will cover how you can create your own [`PlaceholderExpansion`][placeholderexpansion] which you can either [[Upload to the eCloud|Expansion cloud]] or integrate into your own plugin.
|
|
||||||
|
|
||||||
It's worth noting that PlaceholderAPI relies on expansions being installed. PlaceholderAPI only acts as the core replacing utility while the expansions allow other plugins to use any installed placeholder in their own messages.
|
|
||||||
You can download Expansions either directly from the eCloud yourself, or download them through the [[download command of PlaceholderAPI|Commands#papi-ecloud-download]].
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Getting started](#getting-started)
|
|
||||||
- [Common Parts](#common-parts)
|
|
||||||
- [Without a Plugin](#without-a-plugin)
|
|
||||||
- [With a Plugin (External Jar)](#with-a-plugin-external-jar)
|
|
||||||
- [With a Plugin (Internal Class)](#with-a-plugin-internal-class)
|
|
||||||
- [Register the Expansion](#register-the-expansion)
|
|
||||||
- [Relational Placeholders](#relational-placeholders)
|
|
||||||
- [Notes about Relational Placeholders](#notes-about-relational-placeholders)
|
|
||||||
|
|
||||||
## Getting started
|
|
||||||
For starters, you need to decide what type of [`PlaceholderExpansion`][placeholderexpansion] you want to create. There are various ways to create an expansion. This page will cover the most common ones.
|
|
||||||
|
|
||||||
### Common Parts
|
|
||||||
All shown examples will share the same common parts that belong to the [`PlaceholderExpansion`][placeholderexpansion] class.
|
|
||||||
In order to not repeat the same basic info for each method throughout this page, and to greatly reduce its overall length, we will cover the most basic/necessary ones here.
|
|
||||||
|
|
||||||
#### Basic PlaceholderExpansion Structure
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi.example.expansions;
|
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
|
|
||||||
public class SomeExpansion extends PlaceholderExpansion {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthor() {
|
|
||||||
return "someauthor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "example";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return "1.0.0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Let's quickly break down the different methods you have to implement.
|
|
||||||
|
|
||||||
- #### getAuthor
|
|
||||||
This method allows you to set the name of the expansion's author.
|
|
||||||
- #### getIdentifier
|
|
||||||
The identifier is the part in the placeholder that is between the first `%` (Or `{` if bracket placeholders are used) and the first `_`.
|
|
||||||
Because of that can you not use `%`, `{`, `}` or `_` in youd identifier.
|
|
||||||
|
|
||||||
If you still want to use those symbols can you override the `getName()` method to display a different name.
|
|
||||||
- #### getVersion
|
|
||||||
This is a string, which means it can contain more than just a number. This is used to determine if a new update is available or not when the expansion is shared on the eCloud.
|
|
||||||
For expansions that are part of a plugin, this does not really matter.
|
|
||||||
|
|
||||||
Those are all the neccessary parts for your PlaceholderExpansion.
|
|
||||||
Any other methods that are part of the [`PlaceholderExpansion`][placeholderexpansion] class are optional and will usually not be used, or will default to a specific value. Please read the Javadoc comments of those methods for more information.
|
|
||||||
|
|
||||||
You must choose between one of these two methods for handling the actual parsing of placeholders:
|
|
||||||
|
|
||||||
- #### onRequest(OfflinePlayer, String)
|
|
||||||
If not explicitly set, this will automatically call [`onPlaceholderRequest(Player, String)`](#onplaceholderrequestplayer-string).
|
|
||||||
This method is recommended as it allows the usage of `null` and can therefore be used in placeholders that don't require a valid player to be used.
|
|
||||||
- #### onPlaceholderRequest(Player, String)
|
|
||||||
If not set, this method will return `null` which PlaceholderAPI sees as an invalid placeholder.
|
|
||||||
|
|
||||||
----
|
|
||||||
## Without a Plugin
|
|
||||||
An expansion does not always need a plugin to rely on. If the placeholders it provides can return values from just the server itself or some other source (i.e. Java itself), then it can work independently.
|
|
||||||
|
|
||||||
Common examples of such Expansions are:
|
|
||||||
|
|
||||||
- [Player Expansion][playerexpansion]
|
|
||||||
- [Server Expansion][serverexpansion]
|
|
||||||
- [Math Expansion][mathexpansion]
|
|
||||||
|
|
||||||
These kinds of expansions don't require any additional plugins to function.
|
|
||||||
When creating such an expansion is it recommended to use [`onRequest(OfflinePlayer, String)`](#onrequestofflineplayer-string).
|
|
||||||
|
|
||||||
#### Full Example
|
|
||||||
Please see the [Common parts](#common-parts) section for info on the other methods.
|
|
||||||
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi.example.expansions;
|
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
|
|
||||||
public class SomeExpansion extends PlaceholderExpansion {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthor() {
|
|
||||||
return "someauthor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "example";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return "1.0.0";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String onRequest(OfflinePlayer player, String params) {
|
|
||||||
if(params.equalsIgnoreCase("name")) {
|
|
||||||
return player == null ? null : player.getName(); // "name" requires the player to be valid
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder1")) {
|
|
||||||
return "Placeholder Text 1";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder2")) {
|
|
||||||
return "Placeholder Text 2";
|
|
||||||
}
|
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the Expansion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
## With a Plugin (External Jar)
|
|
||||||
If your expansion relies on a plugin to provide its placeholder values, you will need to override a few more methods to make sure everything will work correctly.
|
|
||||||
|
|
||||||
Your expansion will need to override the `getRequiredPlugin()` method to return the name of the plugin your expansion depends on.
|
|
||||||
PlaceholderAPI automatically checks if this method will either return null, or if the name defined results in a non-null plugin.
|
|
||||||
|
|
||||||
It is worth noting that it is a bit more difficult to make a separate jar file that depends on a plugin, as it will require the plugin to have some sort of accessible API in order to get the required values.
|
|
||||||
One way to bypass this is to override the `canRegister()` method with the following code:
|
|
||||||
|
|
||||||
```java
|
|
||||||
private SomePlugin plugin = null; // This would be the plugin your expansion depends on
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canregister() {
|
|
||||||
// This sets plugin to the SomePlugin instance you get through the PluginManager
|
|
||||||
return (plugin = (SomePlugin) Bukkit.getPluginManager().getPlugin(getRequiredPlugin())) != null;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Using this code-snippet, you can get a direct instance of the plugin and access things such as config values.
|
|
||||||
With that said, it is recommended instead to use an API if one is available, as this kind of plugin access is a relatively poor approach.
|
|
||||||
|
|
||||||
#### Full Example
|
|
||||||
Please see the [Common parts](#common-parts) section for info on the other methods.
|
|
||||||
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi.example.expansions;
|
|
||||||
|
|
||||||
import at.helpch.placeholderapi.example.SomePlugin;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
|
|
||||||
public class SomeExpansion extends PlaceholderExpansion {
|
|
||||||
|
|
||||||
private SomePlugin plugin; // This instance is assigned in canRegister()
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthor() {
|
|
||||||
return "someauthor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "example";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return "1.0.0";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRequiredPlugin() {
|
|
||||||
return "SomePlugin";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canRegister() {
|
|
||||||
return (plugin = (SomePlugin) Bukkit.getPluginManager().getPlugin(getRequiredPlugin())) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String onRequest(OfflinePlayer player, String params) {
|
|
||||||
if(params.equalsIgnoreCase("placeholder1")){
|
|
||||||
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder2")){
|
|
||||||
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the expansion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
## With a Plugin (Internal Class)
|
|
||||||
The way expansions are handled when they are part of the plugin itself is fairly similar to when you [make an expansion without a plugin dependency](#without-a-plugin).
|
|
||||||
|
|
||||||
In fact, you don't even have to override the `getRequiredPlugin()` and `canRegister()` methods as it is always guaranteed that the plugin is available.
|
|
||||||
Something worth noting, however, is that you need to override the `persist()` method and make it return true. This ensures that the expansion won't be unregistered by PlaceholderAPI whenever it is reloaded.
|
|
||||||
|
|
||||||
Finally, you can also use dependency injection as an easier way to access a plugin's methods.
|
|
||||||
Here is a small code example of how dependency injection may look:
|
|
||||||
|
|
||||||
```java
|
|
||||||
public class SomeExpansion extends PlaceholderExpansion {
|
|
||||||
private final SomePlugin plugin; // The instance is created in the constructor and won't be modified, so it can be final
|
|
||||||
|
|
||||||
public SomeExpansion(SomePlugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Full Example
|
|
||||||
Please see the [Common parts](#common-parts) section for info on the other methods.
|
|
||||||
|
|
||||||
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi.example.expansions;
|
|
||||||
|
|
||||||
import at.helpch.placeholderapi.example.SomePlugin;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
|
|
||||||
public class SomeExpansion extends PlaceholderExpansion {
|
|
||||||
|
|
||||||
private final SomePlugin plugin;
|
|
||||||
|
|
||||||
public SomeExpansion(SomePlugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthor() {
|
|
||||||
return "someauthor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "example";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return "1.0.0";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean persist() {
|
|
||||||
return true; // This is required or else PlaceholderAPI will unregister the Expansion on reload
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String onRequest(OfflinePlayer player, String params) {
|
|
||||||
if(params.equalsIgnoreCase("placeholder1")){
|
|
||||||
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder2")) {
|
|
||||||
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the Expansion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Register the Expansion
|
|
||||||
To register the expansion, you will need to call the `register()` method yourself.
|
|
||||||
This should be done in your plugin's `onEnable()` method after you make sure that PlaceholderAPI is installed and enabled.
|
|
||||||
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi.example
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class SomePlugin extends JavaPlugin {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
// Small check to make sure that PlaceholderAPI is installed
|
|
||||||
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
|
||||||
new SomeExpansion(this).register();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
## Relational Placeholders
|
|
||||||
Relational Placeholders are a bit more specific compared to the previous examples.
|
|
||||||
While they do use the same [common parts](#common-parts) that the other examples do, they have a different method to return placeholders.
|
|
||||||
|
|
||||||
In order to use the relational placeholders feature, you will need to implement the [`Relational`][relational] interface, which in return adds the `onPlaceholderRequest(Player, Player, String)` method to use.
|
|
||||||
|
|
||||||
#### Full Example
|
|
||||||
Please see the [Common parts](#common-parts) section for info on the other methods.
|
|
||||||
|
|
||||||
In this example, we use the [Internal class setup](#with-a-plugin-internal-jar) and `SomePlugin` has an `areFriends(Player, Player)` method that returns true or false based on if the given players are friends.
|
|
||||||
|
|
||||||
```java
|
|
||||||
package at.helpch.placeholderapi.example.expansions;
|
|
||||||
|
|
||||||
import at.helpch.placeholderapi.example.SomePlugin;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Player;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
import me.clip.placeholderapi.expansion.Relational;
|
|
||||||
|
|
||||||
public class SomeExpansion extends PlaceholderExpansion implements Relational {
|
|
||||||
|
|
||||||
private final SomePlugin plugin;
|
|
||||||
|
|
||||||
public SomeExpansion(SomePlugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAuthor() {
|
|
||||||
return "someauthor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdentifier() {
|
|
||||||
return "example";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return "1.0.0";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean persist() {
|
|
||||||
return true; // This is required or else PlaceholderAPI will unregister the Expansion on reload
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String onPlaceholderRequest(Player one, Player two, String identifier) {
|
|
||||||
if(one == null || two == null)
|
|
||||||
return null; // We require both Players to be online
|
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("friend")) {
|
|
||||||
if(plugin.areFriends(one, two)) {
|
|
||||||
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are friends!";
|
|
||||||
} else {
|
|
||||||
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are not friends!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the Expansion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Notes about Relational Placeholders
|
|
||||||
Relational placeholders will always start with `%rel_` to properly identify them.
|
|
||||||
So in the above example, the full placeholder will look like `%rel_example_friend%`.
|
|
5567
wiki/Placeholders.md
5567
wiki/Placeholders.md
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
181
wiki/README.md
181
wiki/README.md
@@ -1,181 +0,0 @@
|
|||||||
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
|
|
||||||
|
|
||||||
[placeholders]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
|
|
||||||
[using_papi]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Plugins-using-PlaceholderAPI
|
|
||||||
|
|
||||||
[discord]: https://discord.gg/HelpChat
|
|
||||||
[discussion]: https://github.com/PlaceholderAPI/PlaceholderAPI/discussions
|
|
||||||
|
|
||||||
[andre]: https://github.com/Andre601
|
|
||||||
[andrew]: https://github.com/Andrew-Chen-Wang
|
|
||||||
[action]: https://github.com/Andrew-Chen-Wang/github-wiki-action
|
|
||||||
|
|
||||||
<!-- Images -->
|
|
||||||
[branch-selector]: https://user-images.githubusercontent.com/11576465/132779328-8571458a-d63d-4c25-b920-96aa16ae0058.png
|
|
||||||
[upstream_up-to-date]: https://user-images.githubusercontent.com/11576465/132779917-96f19239-077d-44ed-98e7-6a76f305b33a.png
|
|
||||||
[upstream_needs_update]: https://user-images.githubusercontent.com/11576465/132779798-1fe3dc72-a6c2-41eb-a8bc-95793671f384.png
|
|
||||||
[create_branch]: https://user-images.githubusercontent.com/11576465/132780127-45599156-1400-40c9-b865-351574786873.png
|
|
||||||
|
|
||||||
# Wiki
|
|
||||||
Welcome to the Wiki folder!
|
|
||||||
|
|
||||||
This folder contains all the files of the [PlaceholderAPI Wiki][wiki].
|
|
||||||
It allows you to contribute towards the wiki and us to have more control about what changes are commited to it.
|
|
||||||
|
|
||||||
## Contrbuting to the wiki
|
|
||||||
If you want to contribute towards the wiki, will you need to follow the below instructions to not get your Pull request closed without a warning.
|
|
||||||
|
|
||||||
### Fork the Repository (Not wiki!)
|
|
||||||
> Already having a fork? Skip to the [next Step](#select-target-branch)!
|
|
||||||
|
|
||||||
You need to make a fork of the PlaceholderAPI Repository to contribute towards the wiki.
|
|
||||||
To do this, click the "Fork" button on the top-right corner of the site and select the account you want your fork to be created on. This will also show you any already existing forks of this Repository that you may have.
|
|
||||||
|
|
||||||
The forking process should only take a few seconds and you should be redirected to your fork afterwards.
|
|
||||||
|
|
||||||
### Select target branch
|
|
||||||
All main changes to the wiki are made on the dedicated `docs/wiki` branch.
|
|
||||||
Before you try to make any changes should you make sure that you have the `docs/wiki` branch selected. To do that, check the button next to the `X branches` text. If it says anything other than `docs/wiki` will you need to click it and select the right branch.
|
|
||||||
|
|
||||||
![branch-selector]
|
|
||||||
|
|
||||||
### Fetch Changes from Upstream
|
|
||||||
This is only required when you already had a fork and didn't update it for some time.
|
|
||||||
|
|
||||||
While you're on the `docs/wiki` branch, click the `Fetch upstream` text located right below the green `Code` button.
|
|
||||||
Depending on the status of your branch can the prompt show different outcomes:
|
|
||||||
|
|
||||||
- `This branch is not behind the upstream PlaceholderAPI:docs/wiki`
|
|
||||||
Your fork's `docs/wiki` branch is up-to-date with the latest changes from Upstream (This Repository). You don't have to update anything.
|
|
||||||
![upstream_up-to-date]
|
|
||||||
- `Fetch and merge <number> upstream commits from PlaceholderAPI:docs/wiki`
|
|
||||||
This is shown when your fork's branch is outdated and upstream (This Repository) has changes. Click the `Fetch and merge` button to fetch the latest commits and update your fork's `docs/wiki` branch.
|
|
||||||
![upstream_needs_update]
|
|
||||||
|
|
||||||
### Commit changes
|
|
||||||
To commit changes will you need to choose, if you want to directly commit to your fork's `docs/wiki` branch, or make a dedicated branch for it.
|
|
||||||
|
|
||||||
#### Make separate branch (Optional)
|
|
||||||
If you want to have a dedicated branch for it, will you need to click the button saying `docs/wiki`, type in the small text field the name of the branch you want to use and click the text saying `Create branch: <branch> from 'docs/wiki'`
|
|
||||||
|
|
||||||
![create_branch]
|
|
||||||
|
|
||||||
After that should you now have a separate branch that is based of the `docs/wiki` branch and you can finally commit changes to it.
|
|
||||||
|
|
||||||
#### Formatting
|
|
||||||
The wiki uses normal Markdown formatting with some special design-rules you need to keep in mind.
|
|
||||||
These rules are as follows:
|
|
||||||
|
|
||||||
- Unordered lists need to start with a `-` and not `*`. This is to not get it confused with *italic text* which uses single `*` characters.
|
|
||||||
- New lines in lists need to keep their indends. This means you need to add two spaces at the start to keep the text in the same line.
|
|
||||||
Example:
|
|
||||||
```markdown
|
|
||||||
- Line 1
|
|
||||||
Line 2
|
|
||||||
```
|
|
||||||
- Use the `[[Page]]` and `[[Text|Page]]` format to link to other wiki pages. While those aren't rendered in the wiki folder will they render in the final wiki pages.
|
|
||||||
- External links should be set as Refernce Links, which means they are set as `[text]: link` at the top of the page and then used either through `[text]` or `[display text][text]` througout the page.
|
|
||||||
|
|
||||||
#### Adding new Expansion
|
|
||||||
When you add a new expansion to the wiki's [Placeholder page][placeholders] will you need to follow the following format:
|
|
||||||
````markdown
|
|
||||||
- ### [:name](:link)
|
|
||||||
> :command
|
|
||||||
|
|
||||||
:text
|
|
||||||
|
|
||||||
```
|
|
||||||
:placeholders
|
|
||||||
```
|
|
||||||
````
|
|
||||||
|
|
||||||
There are a few extra rules you need to also keep in mind:
|
|
||||||
|
|
||||||
- `:name` would be the name of your Expansion, not the plugin (Unless it is integrated into your plugin).
|
|
||||||
- Only embed a link, if your Expansion requires a plugin to function.
|
|
||||||
- When linking to a Spigot page, make sure to sanitze the link.
|
|
||||||
This means that f.e. https://www.spigotmc.org/resources/placeholderapi.6245/ becomes https://www.spigotmc.org/resources/6245/
|
|
||||||
- `:command` should be replaced with either the PlaceholderAPI command to download your expansion from the eCloud (`/papi ecloud download :name`) or with `NO DOWNLOAD COMMAND` if no separate download is available.
|
|
||||||
- `:text` is optional and should only be provided to link to additional documentation, your own placeholder list, or explain more complicated placeholders/features.
|
|
||||||
- `:placeholders` will be the list of placeholders your expansion provides.
|
|
||||||
Please avoid specific examples (i.e. `%placeholder_player_user123%`) and instead use `<>` and `[]` to mark required and optional options respecively (`%placeholder_player_<player>%`)
|
|
||||||
|
|
||||||
**Note:**
|
|
||||||
When your Expansion's entry is after and/or before other entries will you need to add `----` before or after it to separate it from other entries.
|
|
||||||
|
|
||||||
##### Example:
|
|
||||||
````markdown
|
|
||||||
- ### SomeExpansion
|
|
||||||
> NO DOWNLOAD COMMAND
|
|
||||||
|
|
||||||
```
|
|
||||||
%someexpansion_placeholder%
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
- ### YourExpansion
|
|
||||||
> NO DOWNLOAD COMMAND
|
|
||||||
|
|
||||||
```
|
|
||||||
%yourexpansion_placeholder%
|
|
||||||
```
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
- ### AnotherExpansion
|
|
||||||
> NO DOWNLOAD COMMAND
|
|
||||||
|
|
||||||
```
|
|
||||||
%anotherexpansion_placeholder%
|
|
||||||
```
|
|
||||||
````
|
|
||||||
|
|
||||||
After you added your expansion to this page will you also need to add an entry to the list at the top of the page.
|
|
||||||
You do so by adding `- **[:text](#:name)**` to the list, where `:text` is the text to display (Usually the name you set) and `:name` is the name you just set. If your expansion shares the exact same name as another entry on the page will you need to make sure that your expansion is listed **after** the other one AND that the list-entry has a `-1` appended to `#:name` (So f.e. `#expansion` becomes `#expansion-1`).
|
|
||||||
|
|
||||||
Finally can you now commit your changes and move forward to the [Plugins using PlaceholderAPI][using_papi] page in the wiki folder.
|
|
||||||
|
|
||||||
#### Adding new plugin
|
|
||||||
This step is only required if you either add a new plugin to the list, or you added an Expansion that is included in your own plugin.
|
|
||||||
|
|
||||||
Similar to the [Placeholders page][placeholders] does this page follow a specific format which we will explain real quick.
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
- [:name](:link)
|
|
||||||
- [?] Supports placeholders.
|
|
||||||
- [?] Provides own placeholders. [:page]
|
|
||||||
```
|
|
||||||
|
|
||||||
Here are the following rules:
|
|
||||||
|
|
||||||
- `:name` needs to be replaced with the Name of your plugin.
|
|
||||||
- `:link` needs to be the link of the plugin's resource page.
|
|
||||||
- If no resource page is available can a GitHub repository be linked (if available) or the link omited altogether)
|
|
||||||
- When linking to a Spigot page, make sure to sanitze the link.
|
|
||||||
This means that f.e. https://www.spigotmc.org/resources/placeholderapi.6245/ becomes https://www.spigotmc.org/resources/6245/
|
|
||||||
- `[?]` needs to be replaced with either `[ ]` or `[x]` depending on whether the mentioned option is supported or not.
|
|
||||||
- `:page` needs to replace with the right value, depending on the conditions.
|
|
||||||
- If your plugin provides own Placeholders for other plugins to use can you set `**[[Link|Placeholders#:name]]**` where `:name` is the title you set in the placeholders page.
|
|
||||||
- If your plugin does not provide own placeholders will you need to set `Link`.
|
|
||||||
|
|
||||||
### Make a Pull request
|
|
||||||
After you made your changes is it time to make a Pull request.
|
|
||||||
|
|
||||||
When you go to the upstream repository, should GitHub already show you a notification that you have commits to PR. Click the `Compare & pull request` button to proceed.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
By default will GitHub select the `master` branch as the target, which is not what we want. To fix this, click the button saying `base:master` and select the `docs/wiki` branch.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Finally, fill out the Pull request template and submit the Pull request.
|
|
||||||
Congratulations! You've successfully made a Pull request for the wiki.
|
|
||||||
|
|
||||||
### Questions?
|
|
||||||
If you have any questions, do not hesitate to ask in the [HelpChat Discord][discord] or [open a new discussion][discussion] in this repository. We will be happy to help you.
|
|
||||||
|
|
||||||
### Credits
|
|
||||||
- The Wiki is maintained by [Andre601][andre].
|
|
||||||
- We use the [GitHub Wiki Action][action] by [Andrew-Chen-Wang][andrew] to update the PlaceholderAPI wiki through GitHub Actions.
|
|
@@ -1,23 +0,0 @@
|
|||||||
[papi]: https://placeholderapi.com
|
|
||||||
|
|
||||||
[discordImg]: https://img.shields.io/discord/164280494874165248.svg?logo=discord&label=Discord&colorB=7289DA
|
|
||||||
[discord]: https://helpch.at/discord
|
|
||||||
|
|
||||||
[jenkinsImg]: https://img.shields.io/badge/Download%20from-Jenkins-brightgreen.svg
|
|
||||||
[jenkins]: http://ci.extendedclip.com/job/PlaceholderAPI/
|
|
||||||
|
|
||||||
[licenseImg]: https://img.shields.io/github/license/PlaceholderAPI/PlaceholderAPI.svg
|
|
||||||
[license]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/LICENSE
|
|
||||||
|
|
||||||
[issuesImg]: https://img.shields.io/github/issues-raw/PlaceholderAPI/PlaceholderAPI.svg?logo=github&logoColor=white
|
|
||||||
[issues]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues
|
|
||||||
|
|
||||||
[versionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
|
||||||
[plugin-page]: https://spigotmc.org/resources/6245
|
|
||||||
|
|
||||||
> © 2015 - 2021 [PlaceholderAPI Team][papi]
|
|
||||||
> Thanks for using PlaceholderAPI.
|
|
||||||
>
|
|
||||||
> **[Plugin-page]** | **[[Placeholders]]** | **[[Plugins using PlaceholderAPI]]** | **[[Hook into PlaceholderAPI]]**
|
|
||||||
>
|
|
||||||
> ![versionImg] [![jenkinsImg]][jenkins] [![licenseImg]][license] [![issuesImg]][issues] [![discordImg]][discord]
|
|
@@ -1,77 +0,0 @@
|
|||||||
<p align="center">
|
|
||||||
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/docs/wiki/wiki/img/icon.png" alt="PlaceholderAPI">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
**[[Main page|Home]]**
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
**[[Hook into PlaceholderAPI]]**
|
|
||||||
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
|
|
||||||
- [[Adding placeholders to PlaceholderAPI|PlaceholderExpansion]]
|
|
||||||
- [[Common Parts|PlaceholderExpansion#common-parts]]
|
|
||||||
- [[Without an external plugin|PlaceholderExpansion#without-a-plugin]]
|
|
||||||
- [[With an external Plugin (Separate Jar)|PlaceholderExpansion#with-a-plugin-external-jar]]
|
|
||||||
- [[With an external Plugin (Internal class)|PlaceholderExpansion#with-a-plugin-internal-class]]
|
|
||||||
- [[Relational Placeholders|PlaceholderExpansion#relational-placeholders]]
|
|
||||||
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
|
|
||||||
|
|
||||||
### Other
|
|
||||||
**[[Commands]]**
|
|
||||||
**[[Expansion cloud]]**
|
|
||||||
**[[FAQ]]**
|
|
||||||
**[[Plugins using PlaceholderAPI]]**
|
|
||||||
**[[Placeholders]]**
|
|
||||||
- [[Standalone|Placeholders#standalone]]
|
|
||||||
- [[A|Placeholders#a]]
|
|
||||||
- [[B|Placeholders#b]]
|
|
||||||
- [[C|Placeholders#c]]
|
|
||||||
- [[D|Placeholders#d]]
|
|
||||||
- [[E|Placeholders#e]]
|
|
||||||
- [[F|Placeholders#f]]
|
|
||||||
- [[G|Placeholders#g]]
|
|
||||||
- [[H|Placeholders#h]]
|
|
||||||
- [[I|Placeholders#i]]
|
|
||||||
- [[J|Placeholders#j]]
|
|
||||||
- [[K|Placeholders#k]]
|
|
||||||
- [[L|Placeholders#l]]
|
|
||||||
- [[M|Placeholders#m]]
|
|
||||||
- [[N|Placeholders#n]]
|
|
||||||
- [[O|Placeholders#o]]
|
|
||||||
- [[P|Placeholders#p]]
|
|
||||||
- [[Q|Placeholders#q]]
|
|
||||||
- [[R|Placeholders#r]]
|
|
||||||
- [[S|Placeholders#s]]
|
|
||||||
- [[T|Placeholders#t]]
|
|
||||||
- [[U|Placeholders#u]]
|
|
||||||
- [[V|Placeholders#v]]
|
|
||||||
- [[W|Placeholders#w]]
|
|
||||||
- [[X|Placeholders#x]]
|
|
||||||
- [[Y|Placeholders#y]]
|
|
||||||
- [[Z|Placeholders#z]]
|
|
||||||
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
|
|
||||||
- [[A|Placeholders#a-1]]
|
|
||||||
- [[B|Placeholders#b-1]]
|
|
||||||
- [[C|Placeholders#c-1]]
|
|
||||||
- [[D|Placeholders#d-1]]
|
|
||||||
- [[E|Placeholders#e-1]]
|
|
||||||
- [[F|Placeholders#f-1]]
|
|
||||||
- [[G|Placeholders#g-1]]
|
|
||||||
- [[H|Placeholders#h-1]]
|
|
||||||
- [[I|Placeholders#i-1]]
|
|
||||||
- [[J|Placeholders#j-1]]
|
|
||||||
- [[K|Placeholders#k-1]]
|
|
||||||
- [[L|Placeholders#l-1]]
|
|
||||||
- [[M|Placeholders#m-1]]
|
|
||||||
- [[N|Placeholders#n-1]]
|
|
||||||
- [[O|Placeholders#o-1]]
|
|
||||||
- [[P|Placeholders#p-1]]
|
|
||||||
- [[Q|Placeholders#q-1]]
|
|
||||||
- [[R|Placeholders#r-1]]
|
|
||||||
- [[S|Placeholders#s-1]]
|
|
||||||
- [[T|Placeholders#t-1]]
|
|
||||||
- [[U|Placeholders#u-1]]
|
|
||||||
- [[V|Placeholders#v-1]]
|
|
||||||
- [[W|Placeholders#w-1]]
|
|
||||||
- [[X|Placeholders#x-1]]
|
|
||||||
- [[Y|Placeholders#y-1]]
|
|
||||||
- [[Z|Placeholders#z-1]]
|
|
Binary file not shown.
Before Width: | Height: | Size: 96 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user