Compare commits

..

No commits in common. "master" and "2.10.9" have entirely different histories.

96 changed files with 8904 additions and 2259 deletions

4
.github/CODEOWNERS vendored
View File

@ -1,9 +1,9 @@
#
# Assigns extendedclip and PiggyPiglet for any PR unless a check below matches.
#
* @PiggyPiglet @darbyjack
* @extendedclip @PiggyPiglet
#
# Assigns Andre601 to any PR that targets the wiki folder.
#
*.md @Andre601
/wiki/ @Andre601

View File

@ -1,67 +1,64 @@
[issue]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new
[discord]: https://helpch.at/discord
[code of conduct]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/CODE_OF_CONDUCT.md
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki
[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
[issue]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=change_request_placeholderapi.md
[Discord]: https://helpch.at/discord
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
# Contributing Guidelines
We welcome everyone to contribute towards the PlaceholderAPI Project, but doing so will require you to follow specific rules to keep a consistent and welcoming way of contributing.
# Contributing
If you have any questions about contributions towards the project, feel free to contact us on our [Discord Server][discord].
When contributing to this repository, please first discuss the change you wish to make via [issue] or through [Discord] with the owners of this repository before making a change.
## Issues
Like any other project can you encounter bugs or a feature is missing for you in the plugin.
For that, you can open an [issue] to report a bug, or suggest a new feature to be added.
Please note we have a code of conduct, please follow it in all your interactions with the project.
When doing so, make sure you follow rules below:
## Pull Request Process
### Follow the template
We have issue templates to help us get the required information more easily. Please follow the provided template when either filing a bug report or feature request.
Your issue may be closed without warning for not following the template.
### Use the latest version
When it comes to bug reports should you always check first, that you're using the latest release of PlaceholderAPI.
Often the bug you've encountered, is fixed in a newer version.
The same rules apply when making a feature request.
### No duplicate issue
Make sure that there aren't any existing issues relating to the problem, which are still open, or are closed with a solution/explanation.
Opening a separate issue for a bug report or feature request, that already exists on the issue tracker only slows down the process of fixing the bug or implementing the feature.
If an issue with the bug or feature you want to report/suggest exists, comment on it with your info (bug reports) or give it a :thumbsup: (Feature Request) to show that this is important for you.
### Issue isn't caused by external source
PlaceholderAPI provides a feature to have expansions (separate jar files) for placeholders. This gives it a possability that an issue you encounter is caused by said expansions or a separate plugin that uses those expansions.
In those cases should you report the issue to the issue tracker of the expansion or plugin.
## Pull requests
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.
> [!IMPORTANT]
> 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
> **Source and Target Branch:** [`master`][master]
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.
You can find the necessary files in the [`config/style`][style] directory of this repository.
### 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:** [`wiki`][docs-wiki]
The Wiki of PlaceholderAPI is located on its own dedicated branch, hosting all the assets and files that get used to create it through the usage of GitHub Actions and GitHub Pages.
We welcome contributions that update outdated information, add new expansions/plugins supporting PlaceholderAPI or even correct spelling mistakes and typos.
1. Update the README.md with details of changes if it is affected by those changes.
2. Try to prevent any breaking changes affecting the end-user (Developers using the API).
Mention any breaking changes that could affect the end-user.
3. Document any public methods that the end-user might use.
## Code of Conduct
We have a [Code of Conduct] to maintain a welcoming atmosphere in this project.
If your contributions go against the Code of Conduct, linked above, we reserve the right to deny or revert your contributions.
### Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at our [Discord]. All
complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

43
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,43 @@
---
name: Bug Report
about: Report bugs of PlaceholderAPI with this template
---
<!--
### Please read ###
This template is only for reporting bugs of PlaceholderAPI!
If you want to request changes to the code of PlaceholderAPI, use the "Request change (PlaceholderAPI)" template.
For changes to the wiki consider making a Pull request towards the "wiki" folder containing your changes.
Please also make sure that you use the latest Spigot release or the latest developement build and that your bug isn't already reported on the issues page.
You may get Releases from following sources:
- Spigot: https://www.spigotmc.org/resources/6245/
- Jenkins: http://ci.extendedclip.com/job/PlaceholderAPI/
NOTE:
PLEASE REPORT ISSUES WITH EXPANSIONS AND/OR PLACEHOLDERS TO THEIR CORRESPONDING REPOSITORY/ISSUE TRACKER.
THIS REPOSITORY IS NOT FOR SUCH ISSUES.
-->
## Bug Report
### Issue
<!-- What is the issue? Describe it like you would tell a friend. -->
### Expected behaviour
<!-- What should PlaceholderAPI do? -->
### Actual behaviour
<!-- What does PlaceholderAPI actually do? -->
### How to reproduce
<!-- What steps did you made, to get this bug? -->
1.
### `/papi dump` output
<!-- Please provide the URL that was generated when using /papi dump -->

View File

@ -1,103 +0,0 @@
name: Bug Report
description: Found a Bug about PlaceholderAPI? Use this template to report it!
labels:
- "Type: Issue (Unconfirmed)"
body:
- type: markdown
attributes:
value: |-
Thank you for taking your time and opening a Bug Report.
In order for us to process this Bug Report as fast and efficient as possible do we ask you to read the form carefully and provide any requested information.
Required fields are marked with an asterisk symbol (`*`)
Also, always make sure to use the latest Release from [Spigot](https://www.spigotmc.org/resources/6245/) or the latest Development Build from our [Jenkins Server](http://ci.extendedclip.com/job/PlaceholderAPI/) to make sure that your issue isn't already fixed.
**DO NOT REPORT ISSUES WITH EXPANSIONS AND/OR PLACEHOLDERS. USE THE APPROPRIATE ISSUE TRACKER FOR THOSE!**
- type: checkboxes
attributes:
label: Confirmation
description: Please make sure to have followed the following checks.
options:
- label: My issue isn't already found on the Issue tracker.
required: true
- label: My issue is about **PlaceholderAPI** and not any expansion or external plugin
required: true
- label: The issue isn't already fixed in a Spigot Release or Development Build.
required: true
- label: The [Common Issues](https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Common-Issues) page doesn't mention this issue.
required: true
- type: dropdown
attributes:
label: "Type"
description: |-
What kind of Bug do you encounter?
- `Plugin Bug`: PlaceholderAPI doesn't startup properly.
- `API Bug`: A method you use didn't work or has an unexpected result.
- `Plugin/Server Incompatability`: PlaceholderAPI either doesn't support a specific Server Type/Version or has conflicts with another plugin.
multiple: false
options:
- "Plugin Bug"
- "API Bug"
- "Plugin/Server Incompatability"
validations:
required: true
- type: textarea
attributes:
label: "What happens?"
description: "What bug are you encountering? Try to explain it as detailed as possible."
placeholder: "PlaceholderAPI does this when I do that..."
validations:
required: true
- type: textarea
attributes:
label: "Expected Behaviour"
description: "What behaviour did you expect from PlaceholderAPI?"
placeholder: "PlaceholderAPI should actually do..."
validations:
required: true
- type: textarea
attributes:
label: "How to Reproduce"
description: |-
List the steps on how to reproduce this Bug.
Post any Code-examples in the `Additional Information` field below when you selected `API Bug`.
placeholder: |-
1. Do this
2. ...
3. Profit!
validations:
required: true
- type: input
id: "dump"
attributes:
label: "`/papi dump` Output"
description: |-
Please execute the `/papi dump` command and provide the generated URL from it.
If you can't execute the command (i.e. PlaceholderAPI doesn't start up) can you put N/A here and mention the issue in the `Additional Information` field.
placeholder: "https://paste.helpch.at/dump.log"
validations:
required: true
- type: input
id: "console"
attributes:
label: "Console Log"
description: |-
Get the latest content of your `latest.log` file an upload it to https://paste.helpch.at
Take the generated URL and paste it into this field.
placeholder: "https://paste.helpch.at/latest.log"
- type: input
id: "error"
attributes:
label: "Errors"
description: |-
Upload any errors you find to https://paste.helpch.at and post the link in the field below.
placeholder: "https://paste.helpch.at/error.log"
- type: textarea
attributes:
label: "Additional Info"
description: |-
Add any extra info you think is nessesary for this Bug report.
- If you selected `API Bug` will you need to include code-examples here to reproduce the issue.
- If you selected `Plugin/Server Incompatability` should you include extra Server info such as a Timings or Spark-Report or info about the plugin in question.
placeholder: "Put any extra info you like into this field..."

View File

@ -12,6 +12,3 @@ contact_links:
- name: Update Wiki
url: https://github.com/PlaceholderAPI/PlaceholderAPI/pulls
about: Please make a Pull request towards the "wiki" folder to update the wiki.
- name: Questions
url: https://github.com/PlaceholderAPI/PlaceholderAPI/discussions
about: If you have any questions, ask them in our Discussions Page.

View File

@ -0,0 +1,31 @@
---
name: Feature Request
about: Request a update/change of the PlaceholderAPI-code
---
<!--
### Please read ###
Before suggesting any new features, make sure that it wasn't suggested before and that no open issue with it exists already.
If possible would we suggest to create a Pull request instead.
When doing so, make sure to follow our Contributing Guidelines: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md
-->
## Feature Request
### Type
<!-- What kind of request is this? (Multiple selections possible) -->
<!-- To select an option change the [ ] to [x] -->
- [ ] New function for PlaceholderAPI.
A new function that developers could use.
- [ ] Change to code (Internal).
Changes to code that won't affect the end-user.
- [ ] Change to code (External).
Changes to code that will affect the end-user (breaks stuff).
- [ ] Other: __________ <!-- Use this if none of the above matches your request -->
### Description
<!-- Describe what this suggested change should do and why it would be useful -->
<!-- When possible, add some code-examples to better illustrate the change -->

View File

@ -1,62 +0,0 @@
name: Feature Request
description: Suggest a new Feature for PlaceholderAPI
labels:
- "Type: Enhancement"
body:
- type: markdown
attributes:
value: |-
Thank you for taking the time in creating this Feature Request.
In order to process your feature request as fast and efficiently as possible do we ask you to fill out any required fields (Indicated with a red asterisk (`*`)) with the requested information.
If you have any further questions should you either [join our Discord Server](https://helpch.at/discord) or [ask in our Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
- type: checkboxes
attributes:
label: Confirmation
description: Please make sure to have followed the following checks.
options:
- label: I checked the Issues and Pull request tab for any existing issues or PRs.
required: true
- label: My Feature Request is for **PlaceholderAPI** and not any expansion or other plugin.
required: true
- type: dropdown
attributes:
label: "Type"
description: "What type is your Suggestion? Select all that match."
multiple: true
options:
- "New API feature"
- "New config option"
- "Minor Code improvement (Won't affect Servers)"
- "Major Code improvement (Will affect Servers)"
validations:
required: true
- type: textarea
attributes:
label: "Description"
description: |-
Give a detailed explanation about your Feature request and why it would be beneficial for PlaceholderAPI.
Just saying "It's cool!" or "I need it" don't count as valid reasons. It needs to have a clear benefit for **other** players too.
validations:
required: true
- type: textarea
attributes:
label: "Code Example"
description: |-
Do you have any Code Snippets that you want to share with us? Paste it here!
Note that the input will automatically be rendered as Java code, so you won't need to put it into a code block yourself.
render: java
- type: input
attributes:
label: "Jar file"
description: |-
If you already have a PlaceholderAPI Jar with the requested changes would we love to get a download link for it.
If you don't have a download link can you leave this field empty or provide "N/A" as a response.
placeholder: "https://cdn.discordapp.com/..."
- type: textarea
attributes:
label: "Additional Information"
description: |-
Add any extra info you think is nessesary for this Feature request.
- When you selected `Major Code improvement (Will affect Servers)` should you mention what will break when people update.
placeholder: "Put any extra info you like into this field..."

View File

@ -25,4 +25,4 @@ Closes N/A <!-- If your PR is based on an issue, change "N/A" the the issue ID (
<!-- DO NOT ALTER ANYTHING BELOW THIS LINE! -->
[Wiki]: https://wiki.placeholderapi.com
[Wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki

View File

@ -1,145 +0,0 @@
comment:
footer: "\
----\n\n
> [!NOTE]\n
> *This is an automated response created by a **GitHub Action***<br>
> *Mentioning the bot won't have any effect!*
"
labels:
- name: 'Type: Issue (Expansion)'
labeled:
issue:
body: |-
Hello @{{ issue.user.login }},
The issue you encountered is caused by an Expansion and not PlaceholderAPI itself.
This issue-tracker is reserved for Bug reports and feature requests towards PlaceholderAPI.
Please report this issue to the Expansion's main issue-tracker.
A list of known Expansion repositories and their issue trackers can be found [here](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/510#discussion-63812).
action: close
- name: 'Type: Duplicate'
labeled:
issue:
body: |-
Your issue is already known and a separate issue with the exact same report/feature request already exist.
Please comment on the already existing issue with your information instead of opening your own.
action: close
- name: 'Problem: More info required'
labeled:
issue:
body: |-
Hello @{{ issue.user.login }},
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:
- Currently used Versions of your server (`/version`) and PlaceholderAPI (`/version PlaceholderAPI`)
- Currently installed Expansions (`/papi list`)
- Currently installed Plugins (`/pl`)
- Any additional information requested by users in this issue.
The easiest way to provide those information is through the `/papi dump` command which posts the required information to https://paste.helpch.at and gives a URL to share.
unlabeled:
issue:
body: |-
Thank you for providing additional information.
We will take a look at the issue you encounter and come back to you with a possible solution.
- name: 'Type: Invalid'
labeled:
issue:
body: |-
Your issue has beeen marked as invalid.
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.
Currently available Templates are:
- [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?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).
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 a faster response compared to the issue tracker here.
Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
action: close
pr:
body: |-
Your Pull request has been marked as **invalid**.
This means that it doesn't follow our [Contributing Guidelines](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md).
Here is a small summary of what you should know:
- Pull requests for PlaceholderAPI should target the `master` branch.
- Pull requests for the Wiki should target the `wiki` branch.
Don't hesitate to ask us any questions.
action: close
- name: 'Type: Invalid (Wiki)'
labeled:
pr:
body: |-
Your Wiki Pull request has been marked as **invalid**.
Pull requests targeting the Wiki need to 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'
labeled:
issue:
body: |-
Hello @{{ issue.user.login }},
Thank you for reaching out to us about the wiki.
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:
- The Pull request is based on AND targets the [`wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/wiki) branch of the Repository.
- You followed the general Styling Guidelines mentioned in the wiki's [README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/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.
- name: 'Type: Not a bug'
labeled:
issue:
body: |-
The issue you encounter is not considered a bug and rather an intentional behaviour of PlaceholderAPI and/or one of its expansions.
If you still believe that it is a bug, provide more information and a maintainer of this repository may look at it more closely.
Before providing more info, always make sure to use the latest version of PlaceholderAPI, as the issue you encounter might already be fixed in a newer version.
Optionally can you also try out [development builds](https://ci.extendedclip.com/job/PlaceholderAPI/) and see if the issue was fixed there.
action: close
unlabeled:
issue:
body: After further investigation is the issue you encounter indeed considered a bug and we will try to fix it as soon as possible.
action: open
- name: 'Status: Inactive'
labeled:
issue:
body: |-
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.
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!**
action: close
unlabeled:
issue:
body: The issue received a response from the Author who confirms this to still be prominent and has therefore been reopened.
action: open
- name: 'Type: Question'
labeled:
issue:
body: |-
Hello @{{ issue.user.login }},
Thank you for reaching out to us for getting Support with PlaceholderAPI.
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.
Remember to first read the [READ ME](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/507) post to not face any issues.
For questions do we recommend to use the [(2) Support](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/categories/-2-support) category.
You can also use the Discussion to submit Feature requests (Feature requests through issues are still accepted tho).

24
.github/release.yml vendored
View File

@ -1,24 +0,0 @@
#
# This file is used to automatically draft new release changelogs in GitHub.
# Read more: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
#
changelog:
exclude:
labels:
- 'Action: No Changelog'
categories:
- title: 'Breaking Changes'
labels:
- 'Type: Breaking'
- title: 'Additions'
labels:
- 'Type: New Feature'
- title: 'Changes'
labels:
- 'Type: Enhancement'
- title: 'Fixes'
labels:
- 'Type: Bugfix'
- title: 'Other changes'
labels:
- '*' # Catch every other PR not labeled with an "exclude" label.

View File

@ -1,25 +0,0 @@
name: Comment
on:
issues:
types:
- labeled
- unlabeled
pull_request_target:
types:
- labeled
- unlabeled
jobs:
give_comment:
if: github.event.issue.state == 'open' || github.event.pull_request.state == 'open'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: master
- name: Send Issue/Pull request comment
uses: peaceiris/actions-label-commenter@v1.8.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,31 +0,0 @@
name: "Test compiling against Java 8, 11 and 16"
on:
pull_request:
branches:
- development
paths:
- "src/**"
- "build.gradle"
jobs:
testBuilds:
strategy:
fail-fast: false
max-parallel: 4
matrix:
java-version: [8, 11, 16]
name: "Compile jar against ${{ matrix.java-version }}"
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v2
- name: "Prepare Java ${{ matrix.java-version }}"
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "${{ matrix.java-version }}"
- name: "Make build.gradle executable"
run: "chmod +x gradlew"
- name: "Build jar with Java ${{ matrix.java-version }}"
run: "./gradlew shadowJar"

52
.github/workflows/wiki.yml vendored Normal file
View File

@ -0,0 +1,52 @@
#
# 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: docker://decathlon/wiki-page-creator-action:latest
env:
#
# We can use the E-Mail and Name of the GitHub Actions account
# for our convenience.
#
ACTION_MAIL: 'actions@github.com'
ACTION_NAME: 'github-actions[bot]'
#
# We (sadly) have to use a PAT (Personal Access Token) for this action.
#
GH_PAT: '${{ secrets.WORKFLOWPAT }}'
OWNER: 'PlaceholderAPI'
REPO_NAME: 'PlaceholderAPI'
#
# We only want to target files in the wiki folder
#
MD_FOLDER: 'wiki'
WIKI_PUSH_MESSAGE: '${{ github.event.commits[0].message }}'
#
# We skip/ignore the README.md file in the Wiki folder
#
SKIP_MD: README.md

View File

@ -1,51 +0,0 @@
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[discord]: https://helpch.at/discord
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team on their [discord server][discord]. All
complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

View File

@ -7,8 +7,6 @@
[discord]: https://helpch.at/discord
[spigot]: https://www.spigotmc.org/resources/6245/
[hangar]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
[bbb]: https://builtbybit.com/resources/placeholderapi.24306
[Expansions cloud]: https://api.extendedclip.com/home
[placeholder list]: https://helpch.at/placeholders
[statistics]: https://bstats.org/plugin/bukkit/PlaceholderAPI
@ -17,10 +15,7 @@
[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
[logo]: https://wiki.placeholderapi.com/assets/img/papi-logo.png
[contributing]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md
[placeholderexpansion]: https://wiki.placeholderapi.com/developers/creating-a-placeholderexpansion/
[logo]: https://i.imgur.com/Ea4PURv.png
<!-- The stuff above isn't visible in the readme -->
[![logo]][spigot]
@ -30,15 +25,12 @@
# Information
[PlaceholderAPI][spigot] is a plugin for Spigot servers that allows server owners to display information from various plugins with a uniform format.
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 240+ 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 150+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
PlaceholderAPI has been downloaded over 1,600,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.
PlaceholderAPI has been downloaded over 400,000 times and has been used concurrently on over 20,000 servers, which makes it a must-have for a server of any type or scale.
## Contribute
If you would like to contribute towards PlaceholderAPI should you take a look at our [Contributing file][contributing] for the ins and outs on how you can do that and what you need to keep in mind.
## Create an Expansion
If you would like to create your own Placeholder Expansion for PlaceholderAPI, take a look at our [Wiki][placeholderexpansion] which contains a detailed tutorial on how you can achieve this.
<!-- TODO: Add contributing section -->
<!-- TODO: Add expansion creation section (possibly add to a wiki?) -->
## Support
- [Issue Tracker][issues]
@ -46,9 +38,7 @@ If you would like to create your own Placeholder Expansion for PlaceholderAPI, t
## Quick Links
- [CI Server][ci]
- [Expansions Cloud]
- [Expansions cloud]
- [Placeholder List]
- [Spigot Page][spigot]
- [Hangar Page][hangar]
- [BuiltByBit Page][bbb]
- [Plugin Statistics][statistics]

117
build.gradle Normal file
View File

@ -0,0 +1,117 @@
plugins {
id "java"
id "maven-publish"
id "net.minecrell.licenser" version "0.4.1"
id "com.github.johnrengelman.shadow" version "6.0.0"
}
group "me.clip"
version "2.10.9"
description "An awesome placeholder provider!"
repositories {
mavenCentral()
maven({ url = "https://repo.codemc.org/repository/maven-public" })
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
}
dependencies {
implementation "com.google.code.gson:gson:2.8.6"
implementation "org.bstats:bstats-bukkit:1.5"
compileOnly "org.spigotmc:spigot-api:1.16.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"
testCompile "org.junit.jupiter:junit-jupiter-engine:5.6.2"
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.6.2"
}
processResources {
from(sourceSets.main.resources.srcDirs) {
filter org.apache.tools.ant.filters.ReplaceTokens, tokens: [name: rootProject.name, version: project.version.toString(), description: project.description]
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
shadowJar {
archiveClassifier.set("")
relocate "org.bstats", "me.clip.placeholderapi.metrics"
relocate "com.google.gson", "me.clip.placeholderapi.libs.gson"
}
license {
include '**/*.java'
matching('**/*.java') {
header = file('config/headers/main.txt')
}
matching('**/JSONMessage.java') {
header = file('config/headers/jsonmessage.txt')
}
ext {
year = 2020
}
}
test {
useJUnitPlatform()
}
sourceSets {
test.compileClasspath += configurations.compileOnly
test.runtimeClasspath += configurations.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 {
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

View File

@ -1,130 +0,0 @@
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.7-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.2")
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
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_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
license {
header = rootProject.file("config/headers/main.txt")
include("**/*.java")
mapping("java", "JAVADOC_STYLE")
encoding = "UTF-8"
ext {
set("year", 2024)
}
}
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")
exclude("META-INF/versions/**")
}
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())
}
}

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2024 Peter Blood
Copyright (c) 2018-2020 Peter Blood
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Binary file not shown.

View File

@ -1,5 +1,6 @@
#Tue Jul 14 23:27:02 AWST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

259
gradlew vendored Executable file → Normal file
View File

@ -1,7 +1,7 @@
#!/bin/sh
#!/usr/bin/env sh
#
# Copyright © 2015-2021 the original authors.
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,101 +17,67 @@
#
##############################################################################
#
# 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 «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# 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/.
#
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
MAX_FD="maximum"
warn () {
echo "$*"
} >&2
}
die () {
echo
echo "$*"
echo
exit 1
} >&2
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -121,9 +87,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD=$JAVA_HOME/bin/java
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -132,7 +98,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@ -140,95 +106,80 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# 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" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
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
# 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
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.
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
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' ' '
)" '"$@"'
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

21
gradlew.bat vendored
View File

@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,6 +64,21 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
@ -71,7 +86,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'PlaceholderAPI'

View File

@ -1 +0,0 @@
rootProject.name = "PlaceholderAPI"

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,7 +22,6 @@ package me.clip.placeholderapi;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
@ -30,7 +29,6 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.Relational;
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
import me.clip.placeholderapi.replacer.CharsReplacer;
import me.clip.placeholderapi.replacer.Replacer;
import me.clip.placeholderapi.replacer.Replacer.Closure;
@ -82,7 +80,7 @@ public final class PlaceholderAPI {
*/
@NotNull
public static List<String> setPlaceholders(final OfflinePlayer player,
@NotNull final List<String> text) {
@NotNull final List<@NotNull String> text) {
return text.stream().map(line -> setPlaceholders(player, line)).collect(Collectors.toList());
}
@ -137,38 +135,22 @@ public final class PlaceholderAPI {
*/
@NotNull
public static List<String> setBracketPlaceholders(final OfflinePlayer player,
@NotNull final List<String> text) {
@NotNull final List<@NotNull String> text) {
return text.stream().map(line -> setBracketPlaceholders(player, line))
.collect(Collectors.toList());
}
/**
* Translates all placeholders into their corresponding values.
* <br>The pattern of a valid placeholder is {@literal {<identifier>_<params>}}.
*
* @param player Player to parse the placeholders against
* @param text Text to set the placeholder values in
* @return String containing all translated placeholders
*/
public static String setBracketPlaceholders(Player player, String text) {
return setBracketPlaceholders((OfflinePlayer) player, text);
}
/**
* Translates all placeholders into their corresponding values.
* <br>The pattern of a valid placeholder is {@literal {<identifier>_<params>}}.
*
* @param player Player to parse the placeholders against
* @param text List of Strings to set the placeholder values in
* @return String containing all translated placeholders
*/
public static List<String> setBracketPlaceholders(Player player, List<String> text) {
return setBracketPlaceholders((OfflinePlayer) player, text);
return setPlaceholders((OfflinePlayer) player, text);
}
/**
* set relational placeholders in the text specified placeholders are matched with the pattern
* {@literal %<rel_(identifier)_(params)>%} when set with this method
* %<rel_(identifier)_(params)>% when set with this method
*
* @param one First player to compare
* @param two Second player to compare
@ -186,7 +168,7 @@ public final class PlaceholderAPI {
continue;
}
String identifier = format.substring(0, index).toLowerCase(Locale.ROOT);
String identifier = format.substring(0, index).toLowerCase();
String params = format.substring(index + 1);
final PlaceholderExpansion expansion = PlaceholderAPIPlugin.getInstance()
.getLocalExpansionManager().getExpansion(identifier);
@ -202,7 +184,7 @@ public final class PlaceholderAPI {
}
}
return text;
return Msg.color(text);
}
/**
@ -233,7 +215,7 @@ public final class PlaceholderAPI {
/**
* Get all registered placeholder identifiers
*
* @return A Set of type String containing the identifiers of all registered expansions.
* @return All registered placeholder identifiers
*/
@NotNull
public static Set<String> getRegisteredIdentifiers() {
@ -243,8 +225,6 @@ public final class PlaceholderAPI {
/**
* Get the normal placeholder pattern.
*
* @return Regex Pattern of {@literal [%]([^%]+)[%]}
*/
public static Pattern getPlaceholderPattern() {
return PLACEHOLDER_PATTERN;
@ -252,8 +232,6 @@ public final class PlaceholderAPI {
/**
* Get the bracket placeholder pattern.
*
* @return Regex Pattern of {@literal [{]([^{}]+)[}]}
*/
public static Pattern getBracketPlaceholderPattern() {
return BRACKET_PLACEHOLDER_PATTERN;
@ -261,8 +239,6 @@ public final class PlaceholderAPI {
/**
* Get the relational placeholder pattern.
*
* @return Regex Pattern of {@literal [%](rel_)([^%]+)[%]}
*/
public static Pattern getRelationalPlaceholderPattern() {
return RELATIONAL_PLACEHOLDER_PATTERN;
@ -292,29 +268,15 @@ public final class PlaceholderAPI {
// === Deprecated API ===
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean registerExpansion(PlaceholderExpansion expansion)
{
return expansion.register();
}
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean unregisterExpansion(PlaceholderExpansion expansion)
{
return expansion.unregister();
}
/**
* Get map of registered placeholders
*
* @deprecated Use {@link LocalExpansionManager#getExpansions()} instead.
*
* @return Map of registered placeholders
* @deprecated Use {@link me.clip.placeholderapi.PlaceholderAPIPlugin().getLocalExpansionManager()
* .getExpansions()} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static Map<String, PlaceholderHook> getPlaceholders() {
return PlaceholderAPIPlugin.getInstance().getLocalExpansionManager()
.getExpansions().stream()
@ -322,104 +284,81 @@ public final class PlaceholderAPI {
}
/**
* @deprecated Please use {@link PlaceholderExpansion} to
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
* register placeholders instead
*
* @param plugin The Plugin to register with this {@link PlaceholderHook}
* @param placeholderHook The {@link PlaceholderHook} to register
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static boolean registerPlaceholderHook(Plugin plugin, PlaceholderHook placeholderHook) {
Msg.warn("Nag author(s) %s of plugin %s about their usage of the deprecated PlaceholderHook"
+ " class! This class will be removed in v2.13.0!", plugin.getDescription().getAuthors(),
plugin.getName());
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!"
+ " Please reach out to " + plugin.getDescription().getAuthors().toString()
+ " and let them know that they need to update ASAP!");
return false;
}
/**
* @deprecated Please use {@link PlaceholderExpansion} to
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
* register placeholders instead
*
* @param identifier The identifier to use for the {@link PlaceholderHook}
* @param placeholderHook The {@link PlaceholderHook} to register
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static boolean registerPlaceholderHook(String identifier,
PlaceholderHook placeholderHook) {
Msg.warn("%s is attempting to register placeholders via deprecated PlaceholderHook class."
+ " This class is no longer supported and will be removed in v2.13.0!", identifier);
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!");
return false;
}
/**
* @deprecated Please use {@link PlaceholderExpansion} to
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
* unregister placeholders instead
*
* @param plugin The plugin to unregister
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static boolean unregisterPlaceholderHook(Plugin plugin) {
Msg.warn("Nag author(s) %s of plugin %s about their usage of the PlaceholderAPI class."
+ " This way of unregistering placeholders is no longer supported and will be removed"
+ " in v2.13.0!", plugin.getDescription().getAuthors(), plugin.getName());
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
+ " is attempting to unregister placeholders via the PlaceholderAPI class which is no longer supported!"
+ " Please reach out to " + plugin.getDescription().getAuthors().toString()
+ " and let them know that they need to update ASAP!");
return false;
}
/**
* @deprecated Please use {@link PlaceholderExpansion} to
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
* unregister placeholders instead
*
* @param identifier The identifier to unregister
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static boolean unregisterPlaceholderHook(String identifier) {
Msg.warn("%s is attempting to unregister placeholders via PlaceholderAPI class."
+ " This way of unregistering placeholders is no longer supported and will be removed"
+ " in v2.13.0!", identifier);
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
+ " is attempting to unregister placeholders through the PlaceholderAPI class which is no longer supported!");
return false;
}
/**
* @deprecated Will be removed in a future release.
*
* @return Set of registered identifiers
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static Set<String> getRegisteredPlaceholderPlugins() {
return getRegisteredIdentifiers();
}
/**
* @deprecated Will be removed in a future release.
*
* @return always null
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static Set<String> getExternalPlaceholderPlugins() {
return null;
}
/**
* @deprecated Please use {@link #setPlaceholders(OfflinePlayer, String)} instead
*
* @param player The offline player to parse the placeholders against
* @param text The text to parse
* @param pattern The Pattern to use
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setPlaceholders(OfflinePlayer player,
String text, Pattern pattern, boolean colorize) {
return setPlaceholders(player, text);
@ -427,15 +366,9 @@ public final class PlaceholderAPI {
/**
* @deprecated Please use {@link #setPlaceholders(OfflinePlayer, List)} instead
*
* @param player The offline player to parse the placeholders against
* @param text The List of text to parse
* @param pattern The Pattern to use
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setPlaceholders(OfflinePlayer player,
List<String> text, Pattern pattern, boolean colorize) {
return setPlaceholders(player, text);
@ -443,14 +376,9 @@ public final class PlaceholderAPI {
/**
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, List)} instead.
*
* @param player The offline player to parse the placeholders against
* @param text The List of text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
boolean colorize) {
return setPlaceholders(player, text);
@ -458,84 +386,54 @@ public final class PlaceholderAPI {
/**
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, List)} instead.
*
* @param player The offline player to parse the placeholders against
* @param text The List of text to parse
* @param pattern The Pattern to use
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
Pattern pattern) {
return setPlaceholders(player, text);
}
/**
* @deprecated Will be removed in a future release.
*
* @param player The offline player to parse the placeholders against
* @param text The text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setPlaceholders(Player player, String text, boolean colorize) {
return setPlaceholders(player, text);
}
/**
* @deprecated Will be removed in a future release.
*
* @param player The offline player to parse the placeholders against
* @param text The List of text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setPlaceholders(Player player, List<String> text, boolean colorize) {
return setPlaceholders(player, text);
}
/**
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
*
* @param player The offline player to parse the placeholders against
* @param text The text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setPlaceholders(OfflinePlayer player, String text, boolean colorize) {
return setPlaceholders(player, text);
}
/**
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
*
* @param player The offline player to parse the placeholders against
* @param text The text to parse
* @param pattern The Pattern to use
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setPlaceholders(OfflinePlayer player, String text, Pattern pattern) {
return setPlaceholders(player, text);
}
/**
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, List)} instead.
*
* @param player The offline player to parse the placeholders against
* @param text The List of text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setBracketPlaceholders(OfflinePlayer player, List<String> text,
boolean colorize) {
return setBracketPlaceholders(player, text);
@ -543,42 +441,27 @@ public final class PlaceholderAPI {
/**
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
*
* @param player The offline player to parse the placeholders against
* @param text The text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setBracketPlaceholders(OfflinePlayer player, String text, boolean colorize) {
return setBracketPlaceholders(player, text);
}
/**
* @deprecated Will be removed in a future release.
*
* @param player The offline player to parse the placeholders against
* @param text The text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setBracketPlaceholders(Player player, String text, boolean colorize) {
return setBracketPlaceholders(player, text);
}
/**
* @deprecated Will be removed in a future release.
*
* @param player The offline player to parse the placeholders against
* @param text The List of text to parse
* @param colorize If PlaceholderAPI should also parse color codes
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setBracketPlaceholders(Player player, List<String> text,
boolean colorize) {
return setBracketPlaceholders(player, text);
@ -586,17 +469,17 @@ public final class PlaceholderAPI {
/**
* set relational placeholders in the text specified placeholders are matched with the pattern
* {@literal %<rel_(identifier)_(params)>%} when set with this method
* %<rel_(identifier)_(params)>% when set with this method
*
* @param one Player to compare
* @param two Player to compare
* @param text Text to parse the placeholders in
* @param colorize If color codes ({@literal &[0-1a-fk-o]}) should be translated
* @param colorize If color codes (&[0-1a-fk-o]) should be translated
* @return The text containing the parsed relational placeholders
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static String setRelationalPlaceholders(Player one, Player two, String text,
boolean colorize) {
return setRelationalPlaceholders(one, two, text);
@ -609,12 +492,12 @@ public final class PlaceholderAPI {
* @param one First player to compare
* @param two Second player to compare
* @param text Text to parse the placeholders in
* @param colorize If color codes ({@literal &[0-1a-fk-o]}) should be translated
* @param colorize If color codes (&[0-1a-fk-o]) should be translated
* @return The text containing the parsed relational placeholders
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List)} instead.
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List<String>)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public static List<String> setRelationalPlaceholders(Player one, Player two, List<String> text,
boolean colorize) {
return setRelationalPlaceholders(one, two, text);

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -21,9 +21,9 @@
package me.clip.placeholderapi;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import me.clip.placeholderapi.commands.PlaceholderCommandRouter;
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
@ -32,11 +32,7 @@ import me.clip.placeholderapi.expansion.manager.CloudExpansionManager;
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
import me.clip.placeholderapi.updatechecker.UpdateChecker;
import me.clip.placeholderapi.util.Msg;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.AdvancedPie;
import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
@ -56,17 +52,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
private static PlaceholderAPIPlugin instance;
static {
String version = Bukkit.getServer().getBukkitVersion().split("-")[0];
String suffix;
if (version.chars()
.filter(c -> c == '.')
.count() == 1) {
suffix = "R1";
version = 'v' + version.replace('.', '_') + '_' + suffix;
} else {
int minor = Integer.parseInt(version.split("\\.")[2].charAt(0) + "");
version = 'v' + version.replace('.', '_').replace("_" + minor, "") + '_' + "R" + (minor - 1);
}
final String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
boolean isSpigot;
try {
@ -87,8 +73,6 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
@NotNull
private final CloudExpansionManager cloudExpansionManager = new CloudExpansionManager(this);
private BukkitAudiences adventure;
/**
* Gets the static instance of the main class for PlaceholderAPI. This class is not the actual API
* class, this is the main class that extends JavaPlugin. For most API methods, use static methods
@ -132,13 +116,11 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
try {
return new SimpleDateFormat(getInstance().getPlaceholderAPIConfig().dateFormat());
} catch (final IllegalArgumentException ex) {
Msg.warn("Configured date format ('%s') is invalid! Defaulting to 'MM/dd/yy HH:mm:ss'",
ex, getInstance().getPlaceholderAPIConfig().dateFormat());
getInstance().getLogger().log(Level.WARNING, "configured date format is invalid", ex);
return new SimpleDateFormat("MM/dd/yy HH:mm:ss");
}
}
@Deprecated
public static Version getServerVersion() {
return VERSION;
}
@ -156,8 +138,6 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
setupMetrics();
setupExpansions();
adventure = BukkitAudiences.create(this);
if (config.isCloudEnabled()) {
getCloudExpansionManager().load();
}
@ -176,9 +156,6 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
Bukkit.getScheduler().cancelTasks(this);
adventure.close();
adventure = null;
instance = null;
}
@ -206,15 +183,6 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
return cloudExpansionManager;
}
@NotNull
public BukkitAudiences getAdventure() {
if(adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return adventure;
}
/**
* Obtain the configuration class for PlaceholderAPI.
*
@ -237,13 +205,14 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
}
private void setupMetrics() {
final Metrics metrics = new Metrics(this, 438);
metrics.addCustomChart(new SimplePie("using_expansion_cloud",
final Metrics metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.SimplePie("using_expansion_cloud",
() -> getPlaceholderAPIConfig().isCloudEnabled() ? "yes" : "no"));
metrics.addCustomChart(new SimplePie("using_spigot", () -> getServerVersion().isSpigot() ? "yes" : "no"));
metrics.addCustomChart(
new Metrics.SimplePie("using_spigot", () -> getServerVersion().isSpigot() ? "yes" : "no"));
metrics.addCustomChart(new AdvancedPie("expansions_used", () -> {
metrics.addCustomChart(new Metrics.AdvancedPie("expansions_used", () -> {
final Map<String, Integer> values = new HashMap<>();
for (final PlaceholderExpansion expansion : getLocalExpansionManager().getExpansions()) {
@ -261,7 +230,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
try {
Class.forName("org.bukkit.event.server.ServerLoadEvent");
new ServerLoadEventListener(this);
} catch (final ClassNotFoundException ignored) {
} catch (final ExceptionInInitializerError | ClassNotFoundException ignored) {
Bukkit.getScheduler()
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,19 +23,17 @@ package me.clip.placeholderapi;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class PlaceholderHook {
@Nullable
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
if (player != null && player.isOnline()) {
return onPlaceholderRequest(player.getPlayer(), params);
return onPlaceholderRequest((Player) player, params);
}
return onPlaceholderRequest(null, params);
}
@Nullable
public String onPlaceholderRequest(final Player player, @NotNull final String params) {
return null;
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,7 +23,6 @@ package me.clip.placeholderapi.commands;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
@ -62,7 +61,7 @@ public abstract class PlaceholderCommand {
if (parameter == null) {
possible.forEach(suggestions::add);
} else {
possible.filter(suggestion -> suggestion.toLowerCase(Locale.ROOT).startsWith(parameter.toLowerCase(Locale.ROOT)))
possible.filter(suggestion -> suggestion.toLowerCase().startsWith(parameter.toLowerCase()))
.forEach(suggestions::add);
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -27,7 +27,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
@ -96,7 +95,7 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
return true;
}
final String search = args[0].toLowerCase(Locale.ROOT);
final String search = args[0].toLowerCase();
final PlaceholderCommand target = commands.get(search);
if (target == null) {
@ -122,10 +121,10 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
final List<String> suggestions = new ArrayList<>();
if (args.length > 1) {
final PlaceholderCommand target = this.commands.get(args[0].toLowerCase(Locale.ROOT));
final PlaceholderCommand target = this.commands.get(args[0].toLowerCase());
if (target != null) {
target.complete(plugin, sender, args[0].toLowerCase(Locale.ROOT),
target.complete(plugin, sender, args[0].toLowerCase(),
Arrays.asList(Arrays.copyOfRange(args, 1, args.length)), suggestions);
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,6 +22,10 @@ package me.clip.placeholderapi.commands.impl.cloud;
import com.google.common.collect.ImmutableList;
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.commands.PlaceholderCommand;
import me.clip.placeholderapi.util.Msg;
@ -29,17 +33,12 @@ import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
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 {
@Unmodifiable
private static final List<PlaceholderCommand> COMMANDS = ImmutableList
.of(new CommandECloudClear(),
new CommandECloudToggle(),
new CommandECloudStatus(),
new CommandECloudUpdate(),
new CommandECloudRefresh(),
@ -79,6 +78,8 @@ public final class CommandECloud extends PlaceholderCommand {
Msg.msg(sender,
"&b&lPlaceholderAPI &8- &7eCloud Help Menu &8- ",
" ",
"&b/papi &fenable/disable/toggle",
" &7&oEnable or disable the eCloud",
"&b/papi &fecloud status",
" &7&oView status of the eCloud",
"&b/papi &fecloud list <all/{author}/installed> {page}",
@ -99,7 +100,7 @@ public final class CommandECloud extends PlaceholderCommand {
return;
}
final String search = params.get(0).toLowerCase(Locale.ROOT);
final String search = params.get(0).toLowerCase();
final PlaceholderCommand target = commands.get(search);
if (target == null) {
@ -113,8 +114,10 @@ public final class CommandECloud extends PlaceholderCommand {
return;
}
if (!plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
Msg.msg(sender, "&cThe eCloud Manager is not enabled! To enable it, set 'cloud_enabled' to true and reload the plugin.");
if (!(target instanceof CommandECloudToggle) && !plugin.getPlaceholderAPIConfig()
.isCloudEnabled()) {
Msg.msg(sender,
"&cThe eCloud Manager is not enabled!");
return;
}
@ -133,7 +136,7 @@ public final class CommandECloud extends PlaceholderCommand {
return; // send sub commands
}
final String search = params.get(0).toLowerCase(Locale.ROOT);
final String search = params.get(0).toLowerCase();
final PlaceholderCommand target = commands.get(search);
if (target == null) {

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -20,7 +20,6 @@
package me.clip.placeholderapi.commands.impl.cloud;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
@ -38,16 +37,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
super("download");
}
private boolean isBlockedExpansion(String name) {
String env = System.getenv("PAPI_BLOCKED_EXPANSIONS");
if (env == null) {
return false;
}
return Arrays.stream(env.split(","))
.anyMatch(s -> s.equalsIgnoreCase(name));
}
@Override
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@ -58,12 +47,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
return;
}
if (isBlockedExpansion(params.get(0))) {
Msg.msg(sender,
"&cThis expansion can't be downloaded.");
return;
}
final CloudExpansion expansion = plugin.getCloudExpansionManager()
.findCloudExpansionByName(params.get(0)).orElse(null);
if (expansion == null) {
@ -72,11 +55,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
return;
}
if (!expansion.isVerified()) {
Msg.msg(sender, "&cThe expansion '&f" + params.get(0) + "&c' is not verified and can only be downloaded manually from &fhttps://placeholderapi.com/ecloud");
return;
}
final CloudExpansion.Version version;
if (params.size() < 2) {
version = expansion.getVersion(expansion.getLatestVersion());
@ -108,7 +86,9 @@ public final class CommandECloudDownload extends PlaceholderCommand {
.getVersion() + "] &ato file: &f" + file.getName(),
"&aMake sure to type &f/papi reload &ato enable your new expansion!");
plugin.getCloudExpansionManager().load();
plugin.getCloudExpansionManager().clean();
plugin.getCloudExpansionManager()
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
});
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -26,7 +26,14 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.primitives.Ints;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -36,22 +43,15 @@ import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.configuration.ExpansionSort;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
import me.clip.placeholderapi.libs.JSONMessage;
import me.clip.placeholderapi.util.Format;
import me.clip.placeholderapi.util.Msg;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
import static net.kyori.adventure.text.Component.*;
import static net.kyori.adventure.text.format.NamedTextColor.*;
public final class CommandECloudExpansionList extends PlaceholderCommand {
private static final int PAGE_SIZE = 10;
@ -87,7 +87,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
@NotNull
private static Collection<CloudExpansion> getExpansions(@NotNull final String target,
@NotNull final PlaceholderAPIPlugin plugin) {
switch (target.toLowerCase(Locale.ROOT)) {
switch (target.toLowerCase()) {
case "all":
return plugin.getCloudExpansionManager().getCloudExpansions().values();
case "installed":
@ -112,7 +112,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
public static void addExpansionTitle(@NotNull final StringBuilder builder,
@NotNull final String target, final int page) {
switch (target.toLowerCase(Locale.ROOT)) {
switch (target.toLowerCase()) {
case "all":
builder.append("&bAll Expansions");
break;
@ -132,81 +132,77 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
builder.append(" &bPage&7: &a")
.append(page)
.append("&r");
.append("&r")
.append('\n');
}
private static Component getMessage(@NotNull final List<CloudExpansion> expansions,
@NotNull
private static JSONMessage getMessage(@NotNull final List<CloudExpansion> expansions,
final int page, final int limit, @NotNull final String target) {
final SimpleDateFormat format = PlaceholderAPIPlugin.getDateFormat();
final TextComponent.Builder message = text();
final StringBuilder tooltip = new StringBuilder();
final JSONMessage message = JSONMessage.create();
for (int index = 0; index < expansions.size(); index++) {
final CloudExpansion expansion = expansions.get(index);
final TextComponent.Builder line = text();
final int expansionNumber = index + ((page - 1) * PAGE_SIZE) + 1;
line.append(text(expansionNumber + ". ", DARK_GRAY));
tooltip.append("&bClick to download this expansion!")
.append('\n')
.append('\n')
.append("&bAuthor: &f")
.append(expansion.getAuthor())
.append('\n')
.append("&bVerified: ")
.append(expansion.isVerified() ? "&a&l✔&r" : "&c&l❌&r")
.append('\n')
.append("&bLatest Version: &f")
.append(expansion.getLatestVersion())
.append('\n')
.append("&bReleased: &f")
.append(format.format(expansion.getLastUpdate()));
final NamedTextColor expansionColour;
if (expansion.shouldUpdate()) {
expansionColour = GOLD;
} else {
if (expansion.hasExpansion()) {
expansionColour = GREEN;
} else {
expansionColour = GRAY;
}
final String description = expansion.getDescription();
if (description != null && !description.isEmpty()) {
tooltip.append('\n')
.append('\n')
.append("&f")
.append(description.replace("\r", "").trim());
}
line.append(text(expansion.getName(), expansionColour));
message.then(Msg.color(
"&8" + (index + ((page - 1) * PAGE_SIZE) + 1) + ".&r " + (expansion.shouldUpdate() ? "&6"
: expansion.hasExpansion() ? "&a" : "&7") + expansion.getName()));
line.clickEvent(ClickEvent.suggestCommand("/papi ecloud download " + expansion.getName()));
message.tooltip(Msg.color(tooltip.toString()));
message.suggestCommand("/papi ecloud download " + expansion.getName());
final TextComponent.Builder hoverText = text("Click to download this expansion!", AQUA)
.append(newline()).append(newline())
.append(text("Author: ", AQUA)).append(text(expansion.getAuthor(), WHITE))
.append(newline())
.append(text("Verified: ", AQUA)).append(text(expansion.isVerified() ? "" : "", expansion.isVerified() ? GREEN : RED, TextDecoration.BOLD))
.append(newline())
.append(text("Released: ", AQUA)).append(text(format.format(expansion.getLastUpdate()), WHITE))
.toBuilder();
Optional.ofNullable(expansion.getDescription())
.filter(description -> !description.isEmpty())
.ifPresent(description -> hoverText.append(newline()).append(newline())
.append(text(description.replace("\r", "").trim(), WHITE))
);
line.hoverEvent(HoverEvent.showText(hoverText.build()));
if (index != expansions.size() - 1) {
line.append(newline());
if (index < expansions.size() - 1) {
message.newline();
}
message.append(line.build());
tooltip.setLength(0);
}
if (limit > 1) {
message.append(newline());
final TextComponent.Builder left = text("", page > 1 ? GRAY : DARK_GRAY).toBuilder();
message.newline();
message.then("")
.color(page > 1 ? ChatColor.GRAY : ChatColor.DARK_GRAY);
if (page > 1) {
left.clickEvent(ClickEvent.runCommand("/papi ecloud list " + target + " " + (page - 1)));
message.runCommand("/papi ecloud list " + target + " " + (page - 1));
}
final TextComponent.Builder right = text("", page < limit ? GRAY : DARK_GRAY).toBuilder();
message.then(" " + page + " ").color(ChatColor.GREEN);
message.then("")
.color(page < limit ? ChatColor.GRAY : ChatColor.DARK_GRAY);
if (page < limit) {
right.clickEvent(ClickEvent.runCommand("/papi ecloud list " + target + " " + (page + 1)));
message.runCommand("/papi ecloud list " + target + " " + (page + 1));
}
message.append(left, text(" " + page + " ", GREEN), right);
}
return message.build();
return message;
}
private static void addExpansionTable(@NotNull final List<CloudExpansion> expansions,
@ -325,8 +321,8 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
final int limit = (int) Math.ceil((double) expansions.size() / PAGE_SIZE);
final Component message = getMessage(values, page, limit, params.get(0));
plugin.getAdventure().player((Player) sender).sendMessage(message);
final JSONMessage message = getMessage(values, page, limit, params.get(0));
message.send(((Player) sender));
}
@Override

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -38,7 +38,9 @@ public final class CommandECloudRefresh extends PlaceholderCommand {
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params) {
plugin.getCloudExpansionManager().load();
plugin.getCloudExpansionManager().clean();
plugin.getCloudExpansionManager()
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
Msg.msg(sender,
"&aThe eCloud manager has been refreshed!");

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -54,7 +54,7 @@ public final class CommandECloudStatus extends PlaceholderCommand {
if (updateCount > 0) {
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.");
}

View File

@ -0,0 +1,72 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2020 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.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"));
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,7 +23,6 @@ package me.clip.placeholderapi.commands.impl.cloud;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@ -129,7 +128,7 @@ public final class CommandECloudUpdate extends PlaceholderCommand {
installed.removeIf(expansion -> !expansion.shouldUpdate());
if (!installed.isEmpty() && (params.isEmpty() || "all"
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
.startsWith(params.get(0).toLowerCase()))) {
suggestions.add("all");
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -21,17 +21,7 @@
package me.clip.placeholderapi.commands.impl.local;
import com.google.common.io.CharStreams;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.util.Msg;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -51,15 +41,20 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.logging.Level;
import java.util.stream.Collectors;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.util.Msg;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
public final class CommandDump extends PlaceholderCommand {
@NotNull
private static final String URL = "https://paste.helpch.at/";
@NotNull
private static final Gson gson = new Gson();
@NotNull
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter
.ofLocalizedDateTime(FormatStyle.LONG)
@ -106,8 +101,10 @@ public final class CommandDump extends PlaceholderCommand {
}
try (final InputStream stream = connection.getInputStream()) {
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
//noinspection UnstableApiUsage
final String json = CharStreams
.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
return JsonParser.parseString(json).getAsJsonObject().get("key").getAsString();
}
} catch (final IOException ex) {
throw new CompletionException(ex);
@ -133,15 +130,18 @@ public final class CommandDump extends PlaceholderCommand {
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
.getExpansions()
.stream()
.sorted(
Comparator.comparing(PlaceholderExpansion::getIdentifier)
.thenComparing(PlaceholderExpansion::getAuthor)
)
.sorted(Comparator.comparing(PlaceholderExpansion::getIdentifier))
.sorted(Comparator.comparing(PlaceholderExpansion::getAuthor))
.collect(Collectors.toList());
int size = expansions.stream().map(e -> e.getIdentifier().length())
.max(Integer::compareTo)
.orElse(0);
int size = 0;
for (final String name : expansions.stream().map(PlaceholderExpansion::getIdentifier)
.collect(Collectors.toList())) {
if (name.length() > size) {
size = name.length();
}
}
for (final PlaceholderExpansion expansion : expansions) {
builder.append(" ")
@ -161,17 +161,12 @@ public final class CommandDump extends PlaceholderCommand {
final String[] jars = plugin.getLocalExpansionManager()
.getExpansionsFolder()
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
.list((dir, name) -> name.toLowerCase().endsWith(".jar"));
if (jars == null) {
builder.append(" ¨[Warning]: Could not load jar files from expansions folder.");
} else {
for (final String jar : jars) {
builder.append(" ")
.append(jar)
.append('\n');
}
for (final String jar : jars) {
builder.append(" ")
.append(jar)
.append('\n');
}
builder.append('\n');
@ -180,10 +175,6 @@ public final class CommandDump extends PlaceholderCommand {
.append(plugin.getServer().getBukkitVersion())
.append('/')
.append(plugin.getServer().getVersion())
.append("\n");
builder.append("Java Version: ")
.append(System.getProperty("java.version"))
.append("\n\n");
builder.append("Plugin Info:")
@ -192,17 +183,18 @@ public final class CommandDump extends PlaceholderCommand {
List<Plugin> plugins = Arrays.stream(plugin.getServer().getPluginManager().getPlugins())
.sorted(Comparator.comparing(Plugin::getName))
.collect(Collectors.toList());
size = plugins.stream().map(pl -> pl.getName().length())
.max(Integer::compareTo)
.orElse(0);
for (final String pluginName : plugins.stream().map(Plugin::getName)
.collect(Collectors.toList())) {
if (pluginName.length() > size) {
size = pluginName.length();
}
}
for (final Plugin other : plugins) {
builder.append(" ")
.append(String.format("%-" + size + "s", other.getName()))
.append(" [Authors: [")
.append(String.join(", ", other.getDescription().getAuthors()))
.append("], Version: ")
.append(" [Version: ")
.append(other.getDescription().getVersion())
.append("]")
.append("\n");

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -54,7 +54,7 @@ public final class CommandExpansionRegister extends PlaceholderCommand {
final LocalExpansionManager manager = plugin.getLocalExpansionManager();
final File file = new File(manager.getExpansionsFolder(), params.get(0));
if (!file.exists() || !file.getParentFile().equals(manager.getExpansionsFolder())) {
if (!file.exists()) {
Msg.msg(sender,
"&cThe file &f" + file.getName() + "&c doesn't exist!");
return;

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -45,9 +45,9 @@ public final class CommandHelp extends PlaceholderCommand {
Msg.msg(sender,
"&b&lPlaceholderAPI &8- &7Help Menu &8- &7(&f" + description.getVersion() + "&7)",
" ",
"&b/papi &fbcparse &9<me|--null|player name> <message>",
"&b/papi &fbcparse &9<me/player name> <message>",
" &7&oParse a message with placeholders and broadcast it",
"&b/papi &fcmdparse &9<me|player> <command with placeholders>",
"&b/papi &fcmdparse &9<me/player> <command with placeholders>",
" &7&oParse a message with relational placeholders",
"&b/papi &fdump",
" &7&oDump all relevant information needed to help debug issues into a paste link.",
@ -55,7 +55,7 @@ public final class CommandHelp extends PlaceholderCommand {
" &7&oView information for a specific expansion",
"&b/papi &flist",
" &7&oList active expansions",
"&b/papi &fparse &9<me|--null|player name> <message>",
"&b/papi &fparse &9<me/player name> <message>",
" &7&oParse a message with placeholders",
"&b/papi &fparserel &9<player one> <player two> <message>",
" &7&oParse a message with relational placeholders",

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -47,7 +47,7 @@ public final class CommandInfo extends PlaceholderCommand {
}
final PlaceholderExpansion expansion = plugin.getLocalExpansionManager()
.findExpansionByIdentifier(params.get(0)).orElse(null);
.findExpansionByName(params.get(0)).orElse(null);
if (expansion == null) {
Msg.msg(sender,
"&cThere is no expansion loaded with the identifier: &f" + params.get(0));

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,7 +22,6 @@ package me.clip.placeholderapi.commands.impl.local;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPI;
@ -30,6 +29,7 @@ import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.util.Msg;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@ -49,7 +49,7 @@ public final class CommandParse extends PlaceholderCommand {
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params) {
switch (alias.toLowerCase(Locale.ROOT)) {
switch (alias.toLowerCase()) {
case "parserel":
evaluateParseRelation(sender, params);
break;
@ -69,7 +69,7 @@ public final class CommandParse extends PlaceholderCommand {
public void complete(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
switch (alias.toLowerCase(Locale.ROOT)) {
switch (alias.toLowerCase()) {
case "parserel":
completeParseRelation(params, suggestions);
break;
@ -87,13 +87,12 @@ public final class CommandParse extends PlaceholderCommand {
final boolean command) {
if (params.size() < 2) {
Msg.msg(sender,
"&cYou must provide a target and message: &b/papi "
+ (command ? "cmdparse" : (broadcast ? "bcparse" : "parse"))
"&cYou must supply a target, and a message: &b/papi " + (broadcast ? "bcparse" : "parse")
+ " &7{target} &a{message}");
return;
}
OfflinePlayer player;
@NotNull final OfflinePlayer player;
if ("me".equalsIgnoreCase(params.get(0))) {
if (!(sender instanceof Player)) {
@ -102,8 +101,6 @@ public final class CommandParse extends PlaceholderCommand {
}
player = ((Player) sender);
} else if ("--null".equalsIgnoreCase(params.get(0))) {
player = null;
} else {
final OfflinePlayer target = resolvePlayer(params.get(0));
if (target == null) {
@ -123,9 +120,13 @@ public final class CommandParse extends PlaceholderCommand {
}
if (broadcast) {
Bukkit.broadcastMessage(message);
Msg.broadcast(message);
} else {
sender.sendMessage(message);
if (!(sender instanceof Player)) {
Msg.msg(sender, message);
} else {
((Player) sender).spigot().sendMessage(TextComponent.fromLegacyText(message));
}
}
}
@ -133,52 +134,26 @@ public final class CommandParse extends PlaceholderCommand {
@NotNull @Unmodifiable final List<String> params) {
if (params.size() < 3) {
Msg.msg(sender,
"&cYou must supply two targets, and a message: &b/papi parserel &7{target one} "
+ "{target two} &a{message}");
"&cYou must supply two targets, and a message: &b/papi parserel &7{target one} {target two} &a{message}");
return;
}
OfflinePlayer playerOne;
if ("me".equalsIgnoreCase(params.get(0))) {
if (!(sender instanceof Player)) {
Msg.msg(sender, "&cYou must be a player to use &7me&c as a target!");
return;
}
playerOne = ((Player) sender);
} else {
playerOne = resolvePlayer(params.get(0));
}
if (playerOne == null || !playerOne.isOnline()) {
final OfflinePlayer targetOne = resolvePlayer(params.get(0));
if (targetOne == null || !targetOne.isOnline()) {
Msg.msg(sender, "&cFailed to find player: &f" + params.get(0));
return;
}
OfflinePlayer playerTwo;
if ("me".equalsIgnoreCase(params.get(1))) {
if (!(sender instanceof Player)) {
Msg.msg(sender, "&cYou must be a player to use &7me&c as a target!");
return;
}
playerTwo = ((Player) sender);
} else {
playerTwo = resolvePlayer(params.get(1));
}
if (playerTwo == null || !playerTwo.isOnline()) {
final OfflinePlayer targetTwo = resolvePlayer(params.get(1));
if (targetTwo == null || !targetTwo.isOnline()) {
Msg.msg(sender, "&cFailed to find player: &f" + params.get(1));
return;
}
final String message = PlaceholderAPI
.setRelationalPlaceholders((Player) playerOne, (Player) playerTwo,
.setRelationalPlaceholders(((Player) targetOne), ((Player) targetTwo),
String.join(" ", params.subList(2, params.size())));
sender.sendMessage(message);
Msg.msg(sender, message);
}
@ -186,14 +161,10 @@ public final class CommandParse extends PlaceholderCommand {
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
if (params.size() <= 1) {
if (sender instanceof Player && (params.isEmpty() || "me"
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
.startsWith(params.get(0).toLowerCase()))) {
suggestions.add("me");
}
if ("--null".startsWith(params.get(0).toLowerCase(Locale.ROOT))) {
suggestions.add("--null");
}
final Stream<String> names = Bukkit.getOnlinePlayers().stream().map(Player::getName);
suggestByParameter(names, suggestions, params.isEmpty() ? null : params.get(0));
@ -240,16 +211,13 @@ public final class CommandParse extends PlaceholderCommand {
@Nullable
private OfflinePlayer resolvePlayer(@NotNull final String name) {
OfflinePlayer target = Bukkit.getPlayerExact(name);
OfflinePlayer target = Bukkit.getPlayer(name);
if (target == null) {
// Not the best option, but Spigot doesn't offer a good replacement (as usual)
target = Bukkit.getOfflinePlayer(name);
return target.hasPlayedBefore() ? target : null;
target = Bukkit.getOfflinePlayer(name); // this is probably not a great idea.
}
return target;
return target.hasPlayedBefore() ? target : null;
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -38,6 +38,10 @@ public final class PlaceholderAPIConfig {
return plugin.getConfig().getBoolean("check_updates");
}
public boolean cloudAllowUnverifiedExpansions() {
return plugin.getConfig().getBoolean("cloud_allow_unverified_expansions");
}
public boolean isCloudEnabled() {
return plugin.getConfig().getBoolean("cloud_enabled");

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -26,13 +26,6 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* This event indicates that a <b>single</b> {@link PlaceholderExpansion PlaceholderExpansion} has
* been registered in PlaceholderAPI.
*
* <p>To know when <b>all</b> Expansions have been registered, use the
* {@link me.clip.placeholderapi.events.ExpansionsLoadedEvent ExpansionsLoadedEvent} instead.
*/
public final class ExpansionRegisterEvent extends Event implements Cancellable {
@NotNull
@ -49,27 +42,12 @@ public final class ExpansionRegisterEvent extends Event implements Cancellable {
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* 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 Current instance of the registered {@link PlaceholderExpansion PlaceholderExpansion}
*/
@NotNull
public PlaceholderExpansion getExpansion() {
return expansion;
}
/**
* Indicates if this event was cancelled or not.
* <br>A cancelled Event will result in the {@link #getExpansion() PlaceholderExpansion} NOT
* being added to PlaceholderAPI's internal list and will therefore be considered not registered
* anymore.
*
* @return Whether the event has been cancelled or not.
*/
@Override
public boolean isCancelled() {
return cancelled;

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -25,20 +25,12 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* This event indicates that a {@link PlaceholderExpansion PlaceholderExpansion} has been
* unregistered by PlaceholderAPI.
*
* <p>Note that this event is triggered <b>before</b> the PlaceholderExpansion is completely
* removed.
* <br>This includes removing any Listeners, stopping active tasks and clearing the cache of
* the PlaceholderExpansion.
*/
public final class ExpansionUnregisterEvent extends Event {
@NotNull
private static final HandlerList HANDLERS = new HandlerList();
@NotNull
private final PlaceholderExpansion expansion;
@ -50,12 +42,7 @@ public final class ExpansionUnregisterEvent extends Event {
public static HandlerList getHandlerList() {
return HANDLERS;
}
/**
* The {@link PlaceholderExpansion PlaceholderExpansion} that was unregistered.
*
* @return The {@link PlaceholderExpansion PlaceholderExpansion} instance.
*/
@NotNull
public PlaceholderExpansion getExpansion() {
return expansion;

View File

@ -1,73 +0,0 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 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.events;
import java.util.Collections;
import java.util.List;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* This event indicated that <b>all</b> {@link PlaceholderExpansion PlaceholderExpansions} have
* been registered in PlaceholderAPI and can now be used.
* <br>This even will also be triggered whenever PlaceholderAPI gets reloaded.
*
* <p>All PlaceholderExpansions, except for those loaded by plugins, are loaded
* after Spigot triggered its ServerLoadEvent (1.13+), or after PlaceholderAPI has been enabled.
*/
public class ExpansionsLoadedEvent extends Event {
private final List<PlaceholderExpansion> expansions;
public ExpansionsLoadedEvent(List<PlaceholderExpansion> expansions) {
this.expansions = Collections.unmodifiableList(expansions);
}
/**
* Returns a unmodifiable list of {@link PlaceholderExpansion PlaceholderExpansions} that
* have been registered by PlaceholderAPI.
*
* <p><b>This list does not include manually registered PlaceholderExpansions.</b>
*
* @return List of {@link PlaceholderExpansion registered PlaceholderExpansions}.
*/
@NotNull
public final List<PlaceholderExpansion> getExpansions(){
return expansions;
}
@NotNull
private static final HandlerList HANDLERS = new HandlerList();
@NotNull
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
@NotNull
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -21,11 +21,9 @@
package me.clip.placeholderapi.expansion;
/**
* Classes implementing this interface will have a {@link #clear() clear void} that is called
* by PlaceholderAPI whenever the {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
* is unregistered.
*
* <p>This allows you to execute things such as clearing internal caches, saving data to files, etc.
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the clear
* method called when the implementing expansion is unregistered from PlaceholderAPI. This is useful
* if we want to do things when the implementing hook is unregistered
*
* @author Ryan McCarthy
*/

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,11 +23,9 @@ package me.clip.placeholderapi.expansion;
import org.bukkit.entity.Player;
/**
* Classes implementing this interface will have a {@link #cleanup(Player) cleanup void} that is
* called by PlaceholderAPI whenever a Player leaves the server.
*
* <p>This can be useful for cases where you keep data of the player in a cache or similar
* and want to free up space whenever they leave.
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the cleanup
* method called every time a player leaves the server. This is useful if we want to clean up after
* the player
*
* @author Ryan McCarthy
*/

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,32 +23,18 @@ package me.clip.placeholderapi.expansion;
import java.util.Map;
/**
* Implementing this interface allows {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansions}
* to set a list of default configuration values through the {@link #getDefaults() getDefaults method}
* that should be added to the config.yml of PlaceholderAPI.
*
* <p>The entries will be added under {@code expansions} as their own section.
* <h2>Example:</h2>
* returning a Map with key {@code foo} and value {@code bar} will result in the following config entry:
*
* <pre><code>
* expansions:
* myexpansion:
* foo: "bar"
* </code></pre>
*
* <p><b>The configuration is set before the PlaceholderExpansion is registered!</b>
* Any {@link PlaceholderExpansion} class which implements configurable will have any options listed
* in the getDefaults map automatically added to the PlaceholderAPI config.yml file
*
* @author Ryan McCarthy
*/
public interface Configurable {
/**
* The map returned by this method will be used to set config options in PlaceholderAPI's config.yml.
*
* <p>The key and value pairs are set under a section named after your
* {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion} in the
* {@code expansions} section of the config.
* This method will be called before the implementing class is registered to obtain a map of
* configuration options that the implementing class needs These paths and values will be added to
* the PlaceholderAPI config.yml in the configuration section expansions.(placeholder
* identifier).(your key): (your value)
*
* @return Map of config path / values which need to be added / removed from the PlaceholderAPI
* config.yml file

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -39,18 +39,7 @@ public enum NMSVersion {
SPIGOT_1_13_R2("v1_13_R2"),
SPIGOT_1_14_R1("v1_14_R1"),
SPIGOT_1_15_R1("v1_15_R1"),
SPIGOT_1_16_R1("v1_16_R1"),
SPIGOT_1_16_R2("v1_16_R2"),
SPIGOT_1_16_R3("v1_16_R3"),
SPIGOT_1_17_R1("v1_17_R1"),
SPIGOT_1_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"),
SPIGOT_1_20_R1("v1_20_R1"),
SPIGOT_1_20_R2("v1_20_R2"),
SPIGOT_1_20_R3("v1_20_R3"),
SPIGOT_1_20_R4("v1_20_R4");
SPIGOT_1_16_R1("v1_16_R1");
private final String version;

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,7 +22,7 @@ package me.clip.placeholderapi.expansion;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.Objects;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.PlaceholderHook;
import org.bukkit.Bukkit;
@ -32,25 +32,10 @@ import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Any class extending this will be able to get registered as a PlaceholderExpansion.
* <br>The registration either happens automatically when the jar file containing a
* class extending this one is located under the {@code PlaceholderAPI/expansions}
* directory or when the {@link #register()} method is called by said class.
*/
public abstract class PlaceholderExpansion extends PlaceholderHook {
/**
* The type is {@link Type#INTERNAL} by default.
* For external expansions, the type is updated on {@link me.clip.placeholderapi.expansion.manager.LocalExpansionManager#register(Class) register}.
* @since 2.11.4
*/
@ApiStatus.Internal
protected Type expansionType = Type.INTERNAL;
/**
* The placeholder identifier of this expansion. May not contain {@literal %},
* {@literal {}} or _
* The placeholder identifier of this expansion
*
* @return placeholder identifier that is associated with this expansion
*/
@ -167,239 +152,59 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
return PlaceholderAPIPlugin.getInstance();
}
/**
* Get the type of the expansion
*
* @return the type of the expansion
* @since 2.11.4
*/
@ApiStatus.Internal
public Type getExpansionType() {
return expansionType;
}
/**
* Set the type of the expansion
* @param expansionType the new type
* @since 2.11.4
*/
@ApiStatus.Internal
public void setExpansionType(Type expansionType) {
this.expansionType = expansionType;
}
// === Configuration ===
/**
* Gets the ConfigurationSection of the expansion located in the config.yml of PlaceholderAPI or
* null when not specified.
* <br>You may use the {@link Configurable} interface to define default values set
*
* @return ConfigurationSection that this expansion has.
*/
@Nullable
public final ConfigurationSection getConfigSection() {
return getPlaceholderAPI().getConfig().getConfigurationSection("expansions." + getIdentifier());
}
/**
* Gets the ConfigurationSection relative to the {@link #getConfigSection() default one} set
* by the expansion or null when the default ConfigurationSection is null
*
* @param path The path to get the ConfigurationSection from. This is relative to the default section
* @return ConfigurationSection relative to the default section
*/
@Nullable
public final ConfigurationSection getConfigSection(@NotNull final String path) {
final ConfigurationSection section = getConfigSection();
return section == null ? null : section.getConfigurationSection(path);
}
/**
* Gets the Object relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or the provided Default Object, when the default ConfigurationSection is null
*
* @param path The path to get the Object from. This is relative to the default section
* @param def The default Object to return when the ConfigurationSection returns null
* @return Object from the provided path or the default one provided
*/
@Nullable
@Contract("_, !null -> !null")
public final Object get(@NotNull final String path, final Object def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.get(path, def);
}
/**
* Gets the int relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or the provided Default int, when the default ConfigurationSection is null
*
* @param path The path to get the int from. This is relative to the default section
* @param def The default int to return when the ConfigurationSection returns null
* @return int from the provided path or the default one provided
*/
public final int getInt(@NotNull final String path, final int def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.getInt(path, def);
}
/**
* Gets the long relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or the provided Default long, when the default ConfigurationSection is null
*
* @param path The path to get the long from. This is relative to the default section
* @param def The default long to return when the ConfigurationSection returns null
* @return long from the provided path or the default one provided
*/
public final long getLong(@NotNull final String path, final long def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.getLong(path, def);
}
/**
* Gets the double relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or the provided Default double, when the default ConfigurationSection is null
*
* @param path The path to get the double from. This is relative to the default section
* @param def The default double to return when the ConfigurationSection returns null
* @return double from the provided path or the default one provided
*/
public final double getDouble(@NotNull final String path, final double def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.getDouble(path, def);
}
/**
* Gets the String relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or the provided Default String, when the default ConfigurationSection is null
*
* @param path The path to get the String from. This is relative to the default section
* @param def The default String to return when the ConfigurationSection returns null. Can be null
* @return String from the provided path or the default one provided
*/
@Nullable
@Contract("_, !null -> !null")
public final String getString(@NotNull final String path, @Nullable final String def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.getString(path, def);
}
/**
* Gets a String List relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or an empty List, when the default ConfigurationSection is null
*
* @param path The path to get the String list from. This is relative to the default section
* @return String list from the provided path or an empty list
*/
@NotNull
public final List<String> getStringList(@NotNull final String path) {
final ConfigurationSection section = getConfigSection();
return section == null ? Collections.emptyList() : section.getStringList(path);
}
/**
* Gets the boolean relative to the {@link #getConfigSection() default ConfigurationSection} set
* by the expansion or the default boolean, when the default ConfigurationSection is null
*
* @param path The path to get the boolean from. This is relative to the default section
* @param def The default boolean to return when the ConfigurationSection is null
* @return boolean from the provided path or the default one provided
*/
public final boolean getBoolean(@NotNull final String path, final boolean def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.getBoolean(path, def);
}
/**
* Whether the {@link #getConfigSection() default ConfigurationSection} contains the provided path
* or not. This will return {@code false} when either the default section is null, or doesn't
* contain the provided path
*
* @param path The path to check
* @return true when the default ConfigurationSection is not null and contains the path, false otherwise
*/
public final boolean configurationContains(@NotNull final String path) {
final ConfigurationSection section = getConfigSection();
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>[&lt;expansion name&gt;]</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>[&lt;expansion name&gt;]</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>[&lt;expansion name&gt;]</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>[&lt;expansion name&gt;]</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>[&lt;expansion name&gt;]</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>[&lt;expansion name&gt;]</code>}
*
* @param msg The message to log
* @param throwable The Throwable to log
*/
public void severe(String msg, Throwable throwable) {
log(Level.SEVERE, msg, throwable);
}
/**
* Whether the provided Object is an instance of this PlaceholderExpansion.
* <br>This method will perform the following checks in order:
* <br><ul>
* <li>Checks if Object equals the class. Returns true when equal and continues otherwise</li>
* <li>Checks if the Object is an instance of a PlaceholderExpansion. Returns false if not</li>
* <li>Checks if the Object's Identifier, Author and version equal the one of this class</li>
* </ul>
*
* @param o The Object to check
* @return true or false depending on the above mentioned checks
*/
@Override
public final boolean equals(final Object o) {
if (this == o) {
@ -415,65 +220,45 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
getAuthor().equals(expansion.getAuthor()) &&
getVersion().equals(expansion.getVersion());
}
/**
* Returns a String containing the Expansion's name, author and version
*
* @return String containing name, author and version of the expansion
*/
@Override
public final int hashCode() {
return Objects.hash(getIdentifier(), getAuthor(), getVersion());
}
@Override
public final String toString() {
return String.format("PlaceholderExpansion[name: '%s', author: '%s', version: '%s', type: '%s']", getName(),
getAuthor(), getVersion(), getExpansionType());
return String.format("PlaceholderExpansion[name: '%s', author: '%s', version: '%s']", getName(),
getAuthor(), getVersion());
}
// === Deprecated API ===
/**
* @deprecated As of versions greater than 2.8.7, use {@link #getRequiredPlugin()}
*
* @return The plugin name.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public String getPlugin() {
return null;
}
/**
* @deprecated As of versions greater than 2.8.7, use the expansion cloud to show a description
*
* @return The description of the expansion.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public String getDescription() {
return null;
}
/**
* @deprecated As of versions greater than 2.8.7, use the expansion cloud to display a link
*
* @return The link for the expansion.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
public String getLink() {
return null;
}
public enum Type {
/**
* An expansion provided by a plugin is considered internal
*/
INTERNAL,
/**
* An expansion loaded from the expansions folder is considered external
*/
EXTERNAL
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,22 +22,7 @@ package me.clip.placeholderapi.expansion;
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 {
/**
* 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);
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -20,24 +20,18 @@
package me.clip.placeholderapi.expansion;
/**
* Implementing this interface adds the {@link #start() start} and {@link #stop() stop} void
* methods to your {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}.
*
* <p>This can be used to execute methods and tasks whenever the PlaceholderExpansion has been
* successfully (un)registered.
*/
public interface Taskable {
/**
* Called when the implementing class has successfully been registered to the placeholder map.
* <br>Tasks that need to be performed when this expansion is registered should go here
* Called when the implementing class has successfully been registered to the placeholder map
* Tasks that need to be performed when this expansion is registered should go here
*/
void start();
/**
* Called when the implementing class has been unregistered from PlaceholderAPI.
* <br>Tasks that need to be performed when this expansion has unregistered should go here
* Called when the implementing class has been unregistered from PlaceholderAPI Tasks that need to
* be performed when this expansion has unregistered should go here
*/
void stop();
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -20,7 +20,6 @@
package me.clip.placeholderapi.expansion;
@Deprecated
public final class Version {
private final boolean isSpigot;

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -27,18 +27,13 @@ package me.clip.placeholderapi.expansion;
* with that version.
*
* @author Ryan McCarthy
*
* @deprecated Will be removed in a future release.
*/
@Deprecated
public interface VersionSpecific {
/**
* This method is called before the expansion is attempted to be registered The server version
* will be passed to this method so you know what version the server is currently running.
*
* @param v The {@link Version} to check against
*
* @return true if your expansion is compatible with the version the server is running.
*/
boolean isCompatibleWith(Version v);

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -171,7 +171,7 @@ public class CloudExpansion {
this.versions = versions;
}
public static class Version {
public class Version {
private String url, version, release_notes;

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,7 +22,6 @@ package me.clip.placeholderapi.expansion.manager;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.Resources;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
@ -33,19 +32,14 @@ import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.stream.Collector;
@ -53,7 +47,6 @@ import java.util.stream.Collectors;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
import me.clip.placeholderapi.util.Msg;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
@ -80,9 +73,6 @@ public final class CloudExpansionManager {
@NotNull
private final Map<String, CompletableFuture<File>> await = new ConcurrentHashMap<>();
private final ExecutorService ASYNC_EXECUTOR =
Executors.newCachedThreadPool(
new ThreadFactoryBuilder().setNameFormat("placeholderapi-io-#%1$d").build());
public CloudExpansionManager(@NotNull final PlaceholderAPIPlugin plugin) {
this.plugin = plugin;
@ -90,7 +80,7 @@ public final class CloudExpansionManager {
@NotNull
private static String toIndexName(@NotNull final String name) {
return name.toLowerCase(Locale.ROOT).replace(' ', '_');
return name.toLowerCase().replace(' ', '_');
}
@NotNull
@ -100,7 +90,7 @@ public final class CloudExpansionManager {
public void load() {
clean();
fetch();
fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
}
public void kill() {
@ -170,71 +160,61 @@ public final class CloudExpansionManager {
await.clear();
}
public void fetch() {
public void fetch(final boolean allowUnverified) {
plugin.getLogger().info("Fetching available expansion information...");
ASYNC_EXECUTOR.submit(
() -> {
// a defence tactic! use ConcurrentHashMap instead of normal HashMap
Map<String, CloudExpansion> values = new ConcurrentHashMap<>();
try {
//noinspection UnstableApiUsage
String json = Resources.toString(new URL(API_URL), StandardCharsets.UTF_8);
values.putAll(GSON.fromJson(json, TYPE));
CompletableFuture<Map<String, CloudExpansion>> future = CompletableFuture.supplyAsync(() -> {
final Map<String, CloudExpansion> values = new HashMap<>();
List<String> toRemove = new ArrayList<>();
try {
//noinspection UnstableApiUsage
final String json = Resources.toString(new URL(API_URL), StandardCharsets.UTF_8);
values.putAll(GSON.fromJson(json, TYPE));
} catch (final IOException ex) {
throw new CompletionException(ex);
}
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
CloudExpansion expansion = entry.getValue();
if (expansion.getLatestVersion() == null
|| expansion.getVersion(expansion.getLatestVersion()) == null) {
toRemove.add(entry.getKey());
}
}
values.values().removeIf(value -> value.getLatestVersion() == null
|| value.getVersion(value.getLatestVersion()) == null);
for (String name : toRemove) {
values.remove(name);
}
} catch (Throwable e) {
// ugly swallowing of every throwable, but we have to be defensive
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
}
return values;
});
// loop through what's left on the main thread
plugin
.getServer()
.getScheduler()
.runTask(
plugin,
() -> {
try {
for (Map.Entry<String, CloudExpansion> entry : values.entrySet()) {
String name = entry.getKey();
CloudExpansion expansion = entry.getValue();
if (!allowUnverified) {
future = future.thenApplyAsync((values) -> {
values.values().removeIf(expansion -> !expansion.isVerified());
return values;
});
}
expansion.setName(name);
future = future.thenApplyAsync((values) -> {
Optional<PlaceholderExpansion> localOpt =
plugin.getLocalExpansionManager().findExpansionByName(name);
if (localOpt.isPresent()) {
PlaceholderExpansion local = localOpt.get();
if (local.isRegistered()) {
expansion.setHasExpansion(true);
expansion.setShouldUpdate(
!local.getVersion().equalsIgnoreCase(expansion.getLatestVersion()));
}
}
values.forEach((name, expansion) -> {
expansion.setName(name);
cache.put(toIndexName(expansion), expansion);
}
} catch (Throwable e) {
// ugly swallowing of every throwable, but we have to be defensive
plugin
.getLogger()
.log(Level.WARNING, "Failed to download expansion information", e);
}
});
});
final Optional<PlaceholderExpansion> local = plugin.getLocalExpansionManager()
.findExpansionByName(name);
if (local.isPresent() && local.get().isRegistered()) {
expansion.setHasExpansion(true);
expansion.setShouldUpdate(!local.get().getVersion().equals(expansion.getLatestVersion()));
}
});
return values;
});
future.whenComplete((expansions, exception) -> {
if (exception != null) {
plugin.getLogger()
.log(Level.WARNING, "failed to download expansion information", exception);
return;
}
for (final CloudExpansion expansion : expansions.values()) {
this.cache.put(toIndexName(expansion), expansion);
}
});
}
public boolean isDownloading(@NotNull final CloudExpansion expansion) {
@ -260,15 +240,16 @@ public final class CloudExpansionManager {
throw new CompletionException(ex);
}
return file;
}, ASYNC_EXECUTOR);
});
download.whenCompleteAsync((value, exception) -> {
await.remove(toIndexName(expansion));
if (exception != null) {
Msg.severe("Failed to download %s:%s", exception, expansion.getName(), expansion.getVersion());
plugin.getLogger().log(Level.SEVERE,
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
}
}, ASYNC_EXECUTOR);
});
await.put(toIndexName(expansion), download);

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -20,28 +20,22 @@
package me.clip.placeholderapi.expansion.manager;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
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.HashMap;
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 java.util.logging.Level;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
import me.clip.placeholderapi.events.ExpansionsLoadedEvent;
import me.clip.placeholderapi.expansion.Cacheable;
import me.clip.placeholderapi.expansion.Cleanable;
import me.clip.placeholderapi.expansion.Configurable;
@ -71,11 +65,6 @@ public final class LocalExpansionManager implements Listener {
@NotNull
private static final String EXPANSIONS_FOLDER_NAME = "expansions";
@NotNull
private static final Set<MethodSignature> ABSTRACT_EXPANSION_METHODS = Arrays.stream(PlaceholderExpansion.class.getDeclaredMethods())
.filter(method -> Modifier.isAbstract(method.getModifiers()))
.map(method -> new MethodSignature(method.getName(), method.getParameterTypes()))
.collect(Collectors.toSet());
@NotNull
private final File folder;
@ -83,8 +72,7 @@ public final class LocalExpansionManager implements Listener {
private final PlaceholderAPIPlugin plugin;
@NotNull
private final Map<String, PlaceholderExpansion> expansions = new ConcurrentHashMap<>();
private final ReentrantLock expansionsLock = new ReentrantLock();
private final Map<String, PlaceholderExpansion> expansions = new HashMap<>();
public LocalExpansionManager(@NotNull final PlaceholderAPIPlugin plugin) {
@ -92,7 +80,7 @@ public final class LocalExpansionManager implements Listener {
this.folder = new File(plugin.getDataFolder(), EXPANSIONS_FOLDER_NAME);
if (!this.folder.exists() && !folder.mkdirs()) {
Msg.warn("Failed to create expansions folder!");
plugin.getLogger().log(Level.WARNING, "failed to create expansions folder!");
}
}
@ -110,54 +98,31 @@ public final class LocalExpansionManager implements Listener {
return folder;
}
public int getExpansionsCount() {
return expansions.size();
}
@NotNull
@Unmodifiable
public Collection<String> getIdentifiers() {
expansionsLock.lock();
try {
return ImmutableSet.copyOf(expansions.keySet());
} finally {
expansionsLock.unlock();
}
return ImmutableSet.copyOf(expansions.keySet());
}
@NotNull
@Unmodifiable
public Collection<PlaceholderExpansion> getExpansions() {
expansionsLock.lock();
try {
return ImmutableSet.copyOf(expansions.values());
} finally {
expansionsLock.unlock();
}
return ImmutableSet.copyOf(expansions.values());
}
@Nullable
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
expansionsLock.lock();
try {
return expansions.get(identifier.toLowerCase(Locale.ROOT));
} finally {
expansionsLock.unlock();
}
return ImmutableMap.copyOf(expansions).get(identifier.toLowerCase());
}
@NotNull
public Optional<PlaceholderExpansion> findExpansionByName(@NotNull final String name) {
expansionsLock.lock();
try {
PlaceholderExpansion bestMatch = null;
for (Map.Entry<String, PlaceholderExpansion> entry : expansions.entrySet()) {
PlaceholderExpansion expansion = entry.getValue();
if (expansion.getName().equalsIgnoreCase(name)) {
bestMatch = expansion;
break;
}
}
return Optional.ofNullable(bestMatch);
} finally {
expansionsLock.unlock();
}
return getExpansions().stream().filter(expansion -> name.equalsIgnoreCase(expansion.getName())).findFirst();
}
@NotNull
@ -171,65 +136,31 @@ public final class LocalExpansionManager implements Listener {
@NotNull final Class<? extends PlaceholderExpansion> clazz) {
try {
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
if(expansion == null){
return Optional.empty();
}
Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!");
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
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();
}
}
expansion.setExpansionType(PlaceholderExpansion.Type.EXTERNAL);
if (!expansion.register()) {
Msg.warn("Cannot load expansion %s due to an unknown issue.", expansion.getIdentifier());
if (expansion == null || !expansion.register()) {
return Optional.empty();
}
return Optional.of(expansion);
} catch (LinkageError | NullPointerException ex) {
final String reason;
if (ex instanceof LinkageError) {
reason = " (Is a dependency missing?)";
} else {
reason = " - One of its properties is null which is not allowed!";
}
Msg.severe("Failed to load expansion class %s%s", ex, clazz.getSimpleName(), reason);
} catch (final LinkageError ex) {
plugin.getLogger().severe("expansion class " + clazz.getSimpleName() + " is outdated: \n" +
"Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use " + ex
.getMessage());
}
return Optional.empty();
}
/**
* Attempt to register a {@link PlaceholderExpansion}
* @param expansion the expansion to register
* @return if the expansion was registered
* Do not call this method yourself, use {@link PlaceholderExpansion#register()}
*/
@ApiStatus.Internal
public boolean register(@NotNull final PlaceholderExpansion expansion) {
final String identifier = expansion.getIdentifier().toLowerCase(Locale.ROOT);
final String identifier = expansion.getIdentifier().toLowerCase();
if (!expansion.canRegister()) {
return false;
}
// Avoid loading two external expansions with the same identifier
if (expansion.getExpansionType() == PlaceholderExpansion.Type.EXTERNAL && expansions.containsKey(identifier)) {
Msg.warn("Failed to load external expansion %s. Identifier is already in use.", expansion.getIdentifier());
return false;
}
if (expansion instanceof Configurable) {
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
String pre = "expansions." + identifier + ".";
@ -265,13 +196,14 @@ public final class LocalExpansionManager implements Listener {
if (expansion instanceof VersionSpecific) {
VersionSpecific nms = (VersionSpecific) expansion;
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
Msg.warn("Your server version is incompatible with expansion %s %s",
expansion.getIdentifier(), expansion.getVersion());
plugin.getLogger().info(
"Your server version is not compatible with expansion: " + expansion.getIdentifier()
+ " version: " + expansion.getVersion());
return false;
}
}
final PlaceholderExpansion removed = getExpansion(identifier);
final PlaceholderExpansion removed = expansions.get(identifier);
if (removed != null && !removed.unregister()) {
return false;
}
@ -283,44 +215,37 @@ public final class LocalExpansionManager implements Listener {
return false;
}
expansionsLock.lock();
try {
expansions.put(identifier, expansion);
} finally {
expansionsLock.unlock();
}
expansions.put(identifier, expansion);
if (expansion instanceof Listener) {
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
}
Msg.info(
"Successfully registered %s expansion: %s [%s]",
expansion.getExpansionType().name().toLowerCase(),
expansion.getIdentifier(),
expansion.getVersion()
);
plugin.getLogger().info("Successfully registered expansion: " + expansion.getIdentifier());
if (expansion instanceof Taskable) {
((Taskable) expansion).start();
}
// Check eCloud for updates only if the expansion is external
if (plugin.getPlaceholderAPIConfig().isCloudEnabled() && expansion.getExpansionType() == PlaceholderExpansion.Type.EXTERNAL) {
final Optional<CloudExpansion> cloudExpansionOptional = plugin.getCloudExpansionManager().findCloudExpansionByName(identifier);
if (cloudExpansionOptional.isPresent()) {
CloudExpansion cloudExpansion = cloudExpansionOptional.get();
cloudExpansion.setHasExpansion(true);
cloudExpansion.setShouldUpdate(!cloudExpansion.getLatestVersion().equals(expansion.getVersion()));
if (plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
final Optional<CloudExpansion> cloudExpansion = plugin.getCloudExpansionManager()
.findCloudExpansionByName(identifier);
if (cloudExpansion.isPresent()) {
cloudExpansion.get().setHasExpansion(true);
cloudExpansion.get().setShouldUpdate(
!cloudExpansion.get().getLatestVersion().equals(expansion.getVersion()));
}
}
return true;
}
/**
* Do not call this method yourself, use {@link PlaceholderExpansion#unregister()}
*/
@ApiStatus.Internal
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
if (expansions.remove(expansion.getIdentifier().toLowerCase(Locale.ROOT)) == null) {
if (expansions.remove(expansion.getIdentifier()) == null) {
return false;
}
@ -349,45 +274,22 @@ public final class LocalExpansionManager implements Listener {
return true;
}
private void registerAll(@NotNull final CommandSender sender) {
Msg.info("Placeholder expansion registration initializing...");
plugin.getLogger().info("Placeholder expansion registration initializing...");
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
if (exception != null) {
Msg.severe("Failed to load class files of expansion.", exception);
plugin.getLogger().log(Level.SEVERE, "failed to load class files of expansions", exception);
return;
}
final List<PlaceholderExpansion> registered = classes.stream()
.filter(Objects::nonNull)
.map(this::register)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
final long needsUpdate = registered.stream()
.map(expansion -> plugin.getCloudExpansionManager().findCloudExpansionByName(expansion.getName()).orElse(null))
.filter(Objects::nonNull)
.filter(CloudExpansion::shouldUpdate)
final long registered = classes.stream().map(this::register).filter(Optional::isPresent)
.count();
StringBuilder message = new StringBuilder(registered.size() == 0 ? "&6" : "&a")
.append(registered.size())
.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(registered));
Msg.msg(sender,
registered == 0 ? "&6No expansions were registered!"
: registered + "&a placeholder hooks successfully registered!");
});
}
@ -401,14 +303,10 @@ public final class LocalExpansionManager implements Listener {
}
}
@NotNull
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
if (files == null) {
return CompletableFuture.completedFuture(Collections.emptyList());
}
return Arrays.stream(files)
public CompletableFuture<@NotNull List<@NotNull Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
.map(this::findExpansionInFile)
.collect(Futures.collector());
}
@ -418,29 +316,14 @@ public final class LocalExpansionManager implements Listener {
@NotNull final File file) {
return CompletableFuture.supplyAsync(() -> {
try {
final Class<? extends PlaceholderExpansion> expansionClass = FileUtil.findClass(file, PlaceholderExpansion.class);
if (expansionClass == null) {
Msg.severe("Failed to load expansion %s, as it does not have a class which"
+ " extends PlaceholderExpansion", file.getName());
return null;
}
Set<MethodSignature> expansionMethods = Arrays.stream(expansionClass.getDeclaredMethods())
.map(method -> new MethodSignature(method.getName(), method.getParameterTypes()))
.collect(Collectors.toSet());
if (!expansionMethods.containsAll(ABSTRACT_EXPANSION_METHODS)) {
Msg.severe("Failed to load expansion %s, as it does not have the required"
+ " methods declared for a PlaceholderExpansion.", file.getName());
return null;
}
return expansionClass;
} catch (VerifyError | NoClassDefFoundError e) {
Msg.severe("Failed to load expansion %s (is a dependency missing?)", e, file.getName());
return FileUtil.findClass(file, PlaceholderExpansion.class);
} catch (final VerifyError ex) {
plugin.getLogger().severe("expansion file " + file.getName() + " is outdated: \n" +
"Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use" + ex
.getMessage().substring(ex.getMessage().lastIndexOf(' ')));
return null;
} catch (Exception e) {
throw new CompletionException(e.getMessage() + " (expansion file: " + file.getAbsolutePath() + ")", e);
} catch (final Exception ex) {
throw new CompletionException(ex);
}
});
}
@ -455,8 +338,10 @@ public final class LocalExpansionManager implements Listener {
if (ex.getCause() instanceof LinkageError) {
throw ((LinkageError) ex.getCause());
}
Msg.warn("There was an issue with loading an expansion.");
plugin.getLogger()
.log(Level.SEVERE, "Failed to load placeholder expansion from class: " + clazz.getName(),
ex);
return null;
}
}
@ -486,8 +371,7 @@ public final class LocalExpansionManager implements Listener {
}
expansion.unregister();
Msg.info("Unregistered placeholder expansion %s", expansion.getIdentifier());
Msg.info("Reason: required plugin %s was disabled.", name);
plugin.getLogger().info("Unregistered placeholder expansion: " + expansion.getName());
}
}

View File

@ -1,57 +0,0 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlaceholderAPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.clip.placeholderapi.expansion.manager;
import java.util.Arrays;
import java.util.Objects;
public final class MethodSignature {
private final String name;
private final Class<?>[] params;
protected MethodSignature(String name, Class<?>[] params) {
this.name = name;
this.params = params;
}
public String getName() {
return name;
}
public Class<?>[] getParams() {
return params;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MethodSignature that = (MethodSignature) o;
return Objects.equals(name, that.name) && Arrays.equals(params, that.params);
}
@Override
public int hashCode() {
int result = Objects.hash(name);
result = 31 * result + Arrays.hashCode(params);
return result;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -39,6 +39,16 @@ public final class ServerLoadEventListener implements Listener {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
/**
* This method will be called when the server is first loaded
* <p>
* The goal of the method is to register all the expansions as soon as possible especially before
* players can join
* <p>
* This will ensure no issues with expansions and hooks.
*
* @param event the server load event
*/
@EventHandler
public void onServerLoad(@NotNull final ServerLoadEvent event) {
HandlerList.unregisterAll(this);

View File

@ -1,137 +1,174 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 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.replacer;
import java.util.Locale;
import java.util.function.Function;
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 CharsReplacer implements Replacer {
@NotNull
private final Closure closure;
public CharsReplacer(@NotNull final Closure closure) {
this.closure = closure;
}
@NotNull
@Override
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
final char[] chars = text.toCharArray();
final StringBuilder builder = new StringBuilder(text.length());
final StringBuilder identifier = new StringBuilder();
final StringBuilder parameters = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
final char l = chars[i];
if (l != closure.head || i + 1 >= chars.length) {
builder.append(l);
continue;
}
boolean identified = false;
boolean invalid = true;
boolean hadSpace = false;
while (++i < chars.length) {
final char p = chars[i];
if (p == ' ' && !identified) {
hadSpace = true;
break;
}
if (p == closure.tail) {
invalid = false;
break;
}
if (p == '_' && !identified) {
identified = true;
continue;
}
if (identified) {
parameters.append(p);
} else {
identifier.append(p);
}
}
final String identifierString = identifier.toString();
final String lowercaseIdentifierString = identifierString.toLowerCase(Locale.ROOT);
final String parametersString = parameters.toString();
identifier.setLength(0);
parameters.setLength(0);
if (invalid) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_').append(parametersString);
}
if (hadSpace) {
builder.append(' ');
}
continue;
}
final PlaceholderExpansion placeholder = lookup.apply(lowercaseIdentifierString);
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(replacement);
}
return builder.toString();
}
}
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2020 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.replacer;
import java.util.function.Function;
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 CharsReplacer implements Replacer {
@NotNull
private final Closure closure;
public CharsReplacer(@NotNull final Closure closure) {
this.closure = closure;
}
@NotNull
@Override
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
final char[] chars = text.toCharArray();
final StringBuilder builder = new StringBuilder(text.length());
final StringBuilder identifier = new StringBuilder();
final StringBuilder parameters = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
final char l = chars[i];
if (l == '&' && ++i < chars.length) {
final char c = Character.toLowerCase(chars[i]);
if (c != '0' && c != '1' && c != '2' && c != '3' && c != '4' && c != '5' && c != '6'
&& c != '7' && c != '8' && c != '9' && c != 'a' && c != 'b' && c != 'c' && c != 'd'
&& c != 'e' && c != 'f' && c != 'k' && c != 'l' && c != 'm' && c != 'n' && c != 'o' && c != 'r'
&& c != 'x') {
builder.append(l).append(chars[i]);
} else {
builder.append(ChatColor.COLOR_CHAR);
if (c != 'x') {
builder.append(chars[i]);
continue;
}
if ((i > 1 && chars[i - 2] == '\\') /*allow escaping &x*/) {
builder.setLength(builder.length() - 2);
builder.append('&').append(chars[i]);
continue;
}
builder.append(c);
int j = 0;
while (++j <= 6) {
if (i + j >= chars.length) {
break;
}
final char x = chars[i + j];
builder.append(ChatColor.COLOR_CHAR).append(x);
}
if (j == 7) {
i += 6;
} else {
builder.setLength(builder.length() - (j * 2)); // undo &x parsing
}
}
continue;
}
if (l != closure.head || i + 1 >= chars.length) {
builder.append(l);
continue;
}
boolean identified = false;
boolean oopsitsbad = true;
while (++i < chars.length) {
final char p = chars[i];
if (p == ' ' && !identified) {
break;
}
if (p == closure.tail) {
oopsitsbad = false;
break;
}
if (p == '_' && !identified) {
identified = true;
continue;
}
if (identified) {
parameters.append(p);
} else {
identifier.append(p);
}
}
final String identifierString = identifier.toString().toLowerCase();
final String parametersString = parameters.toString();
identifier.setLength(0);
parameters.setLength(0);
if (oopsitsbad) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_').append(parametersString);
}
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();
}
}

View File

@ -0,0 +1,72 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2020 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.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());
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,7 +23,6 @@ package me.clip.placeholderapi.updatechecker;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Arrays;
import javax.net.ssl.HttpsURLConnection;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.util.Msg;
@ -91,24 +90,17 @@ public class UpdateChecker implements Listener {
return false;
}
int[] plV = toReadable(pluginVersion);
int[] spV = toReadable(spigotVersion);
if (plV[0] < spV[0]) {
return true;
} else if ((plV[1] < spV[1])) {
return true;
} else {
return plV[2] < spV[2];
}
String plV = toReadable(pluginVersion);
String spV = toReadable(spigotVersion);
return plV.compareTo(spV) < 0;
}
private int[] toReadable(String version) {
if (version.contains("-DEV")) {
version = version.split("-DEV")[0];
private String toReadable(String version) {
if (version.contains("-DEV-")) {
version = version.split("-DEV-")[0];
}
return Arrays.stream(version.split("\\.")).mapToInt(Integer::parseInt).toArray();
return version.replaceAll("\\.", "");
}
@EventHandler(priority = EventPriority.MONITOR)

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -20,9 +20,6 @@
package me.clip.placeholderapi.util;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
import java.net.URL;
@ -31,6 +28,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class FileUtil {
@ -42,15 +41,17 @@ public class FileUtil {
}
final URL jar = file.toURI().toURL();
final URLClassLoader loader = new URLClassLoader(new URL[]{jar}, clazz.getClassLoader());
final List<String> matches = new ArrayList<>();
final List<Class<? extends T>> classes = new ArrayList<>();
try (final JarInputStream stream = new JarInputStream(jar.openStream())) {
try (final JarInputStream stream = new JarInputStream(
jar.openStream()); final URLClassLoader loader = new URLClassLoader(new URL[]{jar},
clazz.getClassLoader())) {
JarEntry entry;
while ((entry = stream.getNextJarEntry()) != null) {
final String name = entry.getName();
if (name.isEmpty() || !name.endsWith(".class")) {
if (name == null || name.isEmpty() || !name.endsWith(".class")) {
continue;
}
@ -67,11 +68,8 @@ public class FileUtil {
}
}
}
if (classes.isEmpty()) {
loader.close();
return null;
}
return classes.get(0);
return classes.isEmpty() ? null : classes.get(0);
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -50,7 +50,7 @@ public final class Format {
}
@NotNull
private static String buildFormat(@NotNull final Align align, final int[] spacing) {
private static String buildFormat(@NotNull final Align align, @NotNull final int[] spacing) {
return stream(spacing)
.mapToObj(space -> "%" + (align == Align.LEFT ? "-" : "") + (space + 2) + "s")
.collect(joining());

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -21,40 +21,14 @@
package me.clip.placeholderapi.util;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.stream.Collectors;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
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) {
if (messages.length == 0) {
return;

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -22,75 +22,150 @@ package me.clip.placeholderapi.util;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.StringJoiner;
public class TimeUtil {
public static String getRemaining(final int seconds, final TimeFormat type) {
return getRemaining((long) seconds, type);
public static String getRemaining(int seconds, TimeFormat type) {
if (seconds < 60) {
switch (type) {
case DAYS:
case HOURS:
case MINUTES:
return "0";
case SECONDS:
return String.valueOf(seconds);
}
return String.valueOf(seconds);
}
int minutes = seconds / 60;
int s = 60 * minutes;
int secondsLeft = seconds - s;
if (minutes < 60) {
switch (type) {
case DAYS:
case HOURS:
return "0";
case MINUTES:
return String.valueOf(minutes);
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
}
if (minutes < 1440) {
int hours = minutes / 60;
int inMins = 60 * hours;
int leftOver = minutes - inMins;
switch (type) {
case DAYS:
return "0";
case HOURS:
return String.valueOf(hours);
case MINUTES:
return String.valueOf(leftOver);
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
}
int days = minutes / 1440;
int inMins = 1440 * days;
int leftOver = minutes - inMins;
if (leftOver < 60) {
switch (type) {
case DAYS:
return String.valueOf(days);
case HOURS:
return String.valueOf(0);
case MINUTES:
return String.valueOf(leftOver);
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
} else {
int hours = leftOver / 60;
int hoursInMins = 60 * hours;
int minsLeft = leftOver - hoursInMins;
switch (type) {
case DAYS:
return String.valueOf(days);
case HOURS:
return String.valueOf(hours);
case MINUTES:
return String.valueOf(minsLeft);
case SECONDS:
return String.valueOf(secondsLeft);
}
return String.valueOf(seconds);
}
}
public static String getRemaining(final long seconds, final TimeFormat type) {
switch (type) {
default:
return String.valueOf(seconds);
case SECONDS:
return String.valueOf(seconds % 60);
case MINUTES:
return String.valueOf((seconds / 60) % 60);
case HOURS:
return String.valueOf((seconds / 3600) % 24);
case DAYS:
return String.valueOf(seconds / 86400);
}
public static String getTime(int seconds) {
return getTime(Duration.ofSeconds(seconds));
}
/**
* Format the given value with s, m, h and d (seconds, minutes, hours and days)
*
* @param duration {@link Duration} (eg, Duration.of(20, {@link ChronoUnit#SECONDS}) for 20
* seconds)
* seconds)
* @return formatted time
*/
public static String getTime(final Duration duration) {
return getTime(duration.getSeconds());
}
public static String getTime(final int seconds) {
return getTime((long) seconds);
}
public static String getTime(long seconds) {
final StringJoiner joiner = new StringJoiner(" ");
final StringBuilder builder = new StringBuilder();
long seconds = duration.getSeconds();
long minutes = seconds / 60;
long hours = minutes / 60;
final long days = hours / 24;
long days = hours / 24;
seconds %= 60;
minutes %= 60;
hours %= 24;
hours %= 60;
days %= 24;
if (days > 0) {
joiner.add(days + "d");
}
if (hours > 0) {
joiner.add(hours + "h");
if (seconds > 0) {
builder.insert(0, seconds + "s");
}
if (minutes > 0) {
joiner.add(minutes + "m");
if (builder.length() > 0) {
builder.insert(0, ' ');
}
builder.insert(0, minutes + "m");
}
if (seconds > 0) {
joiner.add(seconds + "s");
if (hours > 0) {
if (builder.length() > 0) {
builder.insert(0, ' ');
}
builder.insert(0, hours + "h");
}
return joiner.toString();
if (days > 0) {
if (builder.length() > 0) {
builder.insert(0, ' ');
}
builder.insert(0, days + "d");
}
return builder.toString();
}
}

View File

@ -1,16 +1,17 @@
# PlaceholderAPI
# Version: ${version}
# Version: @version@
# Created by: extended_clip
# Contributors: https://github.com/PlaceholderAPI/PlaceholderAPI/graphs/contributors
# Issues: https://github.com/PlaceholderAPI/PlaceholderAPI/issues
# Expansions: https://placeholderapi.com/ecloud
# Wiki: https://wiki.placeholderapi.com/
# Expansions: https://api.extendedclip.com/all/
# Wiki: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
# Discord: https://helpch.at/discord
# No placeholders are provided with this plugin by default.
# Download placeholders: /papi ecloud
check_updates: true
cloud_enabled: true
cloud_sorting: "name"
cloud_allow_unverified_expansions: false
boolean:
'true': 'yes'
'false': 'no'

View File

@ -1,11 +1,11 @@
name: PlaceholderAPI
name: "@name@"
main: "me.clip.placeholderapi.PlaceholderAPIPlugin"
version: ${version}
version: "@version@"
author: HelpChat
api-version: "1.13"
description: "An awesome placeholder provider!"
description: "@description@"
commands:
placeholderapi:
@ -37,6 +37,7 @@ permissions:
placeholderapi.ecloud.info: true
placeholderapi.ecloud.list: true
placeholderapi.ecloud.clear: true
placeholderapi.ecloud.toggle: true
placeholderapi.ecloud.status: true
placeholderapi.ecloud.update: true
placeholderapi.ecloud.refresh: true
@ -81,6 +82,9 @@ permissions:
placeholderapi.ecloud.clear:
default: "op"
description: "Allows you to clear the local eCloud expansion cache"
placeholderapi.ecloud.toggle:
default: "op"
description: "Allows you to toggle/enable/disable the eCloud manager"
placeholderapi.ecloud.status:
default: "op"
description: "Allows you to view the status of eCloud expansions"
@ -95,4 +99,4 @@ permissions:
description: "Allows you to download an expansion from the eCloud"
placeholderapi.ecloud.placeholders:
default: "op"
description: "Allows you to view the placeholders of a eCloud expansion"
description: "Allows you to view the placeholders of a eCloud expansion"

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -23,6 +23,7 @@ package me.clip.placeholderapi;
import com.google.common.collect.ImmutableMap;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.replacer.CharsReplacer;
import me.clip.placeholderapi.replacer.RegexReplacer;
import me.clip.placeholderapi.replacer.Replacer;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
@ -39,6 +40,7 @@ public interface Values {
Replacer CHARS_REPLACER = new CharsReplacer(Replacer.Closure.PERCENT);
Replacer REGEX_REPLACER = new RegexReplacer(Replacer.Closure.PERCENT);
final class MockPlayerPlaceholderExpansion extends PlaceholderExpansion {

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -30,9 +30,19 @@ public class ReplacerBenchmarks {
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
public void measureCharsReplacerLargeText() {
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);
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
* Copyright (c) 2015 - 2020 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
@ -37,6 +37,12 @@ public final class ReplacerUnitTester {
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
void testCharsReplacerProducesExpectedSentence() {
assertEquals(String.format(
@ -45,14 +51,36 @@ public final class ReplacerUnitTester {
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
void testResultsAreTheSameAsReplacement() {
final String resultChars = Values.CHARS_REPLACER
.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);
}
@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
void testCharsReplacerIgnoresMalformed() {
final String text = "10% and %hello world 15%";
@ -60,4 +88,12 @@ public final class ReplacerUnitTester {
assertEquals(text, Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
}
@Test
void testCharsReplacerHandlesEscapedHex() {
final String text = "\\&xffffffThis should not change.";
assertEquals(text.substring(1),
Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
}
}

239
wiki/Commands.md Normal file
View File

@ -0,0 +1,239 @@
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 reload`](#papi-reload)
----
### 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 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.

67
wiki/Expansion-cloud.md Normal file
View File

@ -0,0 +1,67 @@
## 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.

22
wiki/FAQ.md Normal file
View File

@ -0,0 +1,22 @@
Here are frequently asked questions about stuff related to PlaceholderAPI.
## It only shows %placeholder% and not the variable
Make sure, that you've tried the following steps:
- PlaceholderAPI is installed and running (Shows green in `/pl` and responds to the `/papi` command)
- You downloaded the expansion with `/papi ecloud download [expansion]`
A list of available expansions and their placeholders can be found [[here|Placeholders]]!
Also note that not all placeholders are in a seperate expansion. Some are "hardcoded" into a plugin.
- You reloaded PlaceholderAPI with `/papi reload` after downloading an expansion.
- Any possible dependency for the expansion (Plugin) is installed and running.
- The placeholder doesn't contain any typos.
- The plugin that should use the placeholder actually supports PlaceholderAPI.
For a list of plugins supporting PlaceholderAPI go [[here|Plugins-using-PlaceholderAPI]].
## 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]]!

78
wiki/Home.md Normal file
View File

@ -0,0 +1,78 @@
<p align="center">
<img src="https://i.imgur.com/puadJ8Z.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|Hook-into-PlaceholderAPI#adding-placeholders-to-placeholderapi]]
- [[PlaceholderExpansion]]
- [[Without an external plugin|PlaceholderExpansion#without-an-external-plugin]]
- [[With external plugin|PlaceholderExpansion#with-external-plugin]]
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
### Other
**[[Commands]]**
**[[Expansion cloud]]**
**[[FAQ]]**
**[[Plugins using PlaceholderAPI]]**
**[[Placeholders]]**
- [[PAPI-placeholders|Placeholders#papi-placeholders-1]]
- [[Advancements|Placeholders#advancements]]
- [[Animations|Placeholders#animations]]
- [[Armor|Placeholders#armor]]
- [[ASCII|Placeholders#ASCII]]
- [[BungeeCord|Placeholders#bungeecord]]
- [[CheckItem|Placeholders#checkitem]]
- [[CooldownBar|Placeholders#cooldownbar]]
- [[Formatter|Placeholders#formatter]]
- [[Javascript|Placeholders#javascript]]
- [[ListPlayers|Placeholders#listplayer]]
- [[LocalTime|Placeholders#localtime]]
- [[Math|Placeholders#math]]
- [[MVdW placeholders|Placeholders#mvdw-placeholders]]
- [[OtherPlayer|Placeholders#otherplayer]]
- [[ParseNear|Placeholders#parsenear]]
- [[ParseOther|Placeholders#parseother]]
- [[Pinger|Placeholders#pinger]]
- [[Player|Placeholders#player]]
- [[PlayerList|Placeholders#playerlist]]
- [[Plugin|Placeholders#plugin]]
- [[Progress|Placeholders#progress]]
- [[RainbowColor|Placeholders#rainbowcolor]]
- [[RandomColor|Placeholders#randomcolor]]
- [[RedisBungee|Placeholders#redisbungee]]
- [[RelCon|Placeholders#relcon]]
- [[ScoreboardObjectives|Placeholders#scoreboardobjectives]]
- [[Server|Placeholders#server]]
- [[Sound|Placeholders#sound]]
- [[Spectators|Placeholders#spectators]]
- [[Statistic|Placeholders#statistic]]
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
- [[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]]
- [[Z|Placeholders#z]]

View File

@ -0,0 +1,142 @@
[APIBadge]: https://img.shields.io/nexus/r/http/repo.extendedclip.com/me.clip/placeholderapi.svg?label=API-Version
[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(withPlaceholdersSet);
}
}
```

View File

@ -0,0 +1,411 @@
## Overview
This page covers how you can use the `PlaceholderExpansion` to add own placeholders to PlaceholderAPI, which then can be used by other plugins.
PlaceholderAPI is using Expansions for its placeholders, with PlaceholderAPI providing the core. Users can download Expansions from the cloud server using commands in-game or by going [here](https://api.extendedclip.com/home/) if they want to use the placeholder.
## Note
You can either make a separate jar file, to upload it to the expansion-cloud (recommended) or have it as a local class inside your plugin.
## Examples
There are multiple methods and ways you can use the PlaceholderExpansion.
Those depend on what you want to display through the placeholders in the end.
* [Without external plugin](#without-external-plugin)
* [With external plugin](#with-external-plugin)
* [Separate jar](#separate-jar)
* [Internal class](#internal-class)
### Without an external plugin
This part here covers how you create an expansion that doesn't require any external/additional plugins to function.
Examples of such expansions are:
- [Player expansion](/PlaceholderAPI/Player-Expansion)
- [Math expansion](https://github.com/Andre601/Math-Expansion)
- [Statistics expansion](/PlaceholderAPI/Statistics-Expansion)
Since it would be weird (and also make no real sense) to have this inside your plugin, we assume you make a separate jar-file as an expansion.
To begin, first make the class extend the `PlaceholderExpansion` and add the required methods:
```java
package at.helpch.placeholderapi.example.expansions;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
/**
* This class will automatically register as a placeholder expansion
* when a jar including this class is added to the directory
* {@code /plugins/PlaceholderAPI/expansions} on your server.
* <br>
* <br>If you create such a class inside your own plugin, you have to
* register it manually in your plugins {@code onEnable()} by using
* {@code new YourExpansionClass().register();}
*/
public class SomeExpansion extends PlaceholderExpansion {
/**
* This method should always return true unless we
* have a dependency we need to make sure is on the server
* for our placeholders to work!
*
* @return always true since we do not have any dependencies.
*/
@Override
public boolean canRegister(){
return true;
}
/**
* The name of the person who created this expansion should go here.
*
* @return The name of the author as a String.
*/
@Override
public String getAuthor(){
return "someauthor";
}
/**
* The placeholder identifier should go here.
* <br>This is what tells PlaceholderAPI to call our onRequest
* method to obtain a value if a placeholder starts with our
* identifier.
* <br>This must be unique and can not contain % or _
*
* @return The identifier in {@code %<identifier>_<value>%} as String.
*/
@Override
public String getIdentifier(){
return "example";
}
/**
* This is the version of this expansion.
* <br>You don't have to use numbers, since it is set as a String.
*
* @return The version as a String.
*/
@Override
public String getVersion(){
return "1.0.0";
}
/**
* This is the method called when a placeholder with our identifier
* is found and needs a value.
* <br>We specify the value identifier in this method.
* <br>Since version 2.9.1 can you use OfflinePlayers in your requests.
*
* @param player
* A {@link org.bukkit.OfflinePlayer OfflinePlayer}.
* @param identifier
* A String containing the identifier/value.
*
* @return Possibly-null String of the requested identifier.
*/
@Override
public String onRequest(OfflinePlayer player, String identifier){
// %example_placeholder1%
if(identifier.equals("placeholder1")){
return "placeholder1 works";
}
// %example_placeholder2%
if(identifier.equals("placeholder2")){
return "placeholder2 works";
}
// We return null if an invalid placeholder (f.e. %example_placeholder3%)
// was provided
return null;
}
}
```
----
### With external plugin
Those examples here applies to people who want to provide information from their own plugin through placeholders from PlaceholderAPI.
There exists a repository showcasing an [example-expansion](/PlaceholderAPI/Example-Expansion) with what you can/should do.
In our examples do we have the plugin `SomePlugin` and want to show certain placeholders with it.
There are two ways to actually get information from your plugin and they only are different in if you have the expansion as a separate jar-file or as an internal class.
#### Separate jar
In our separate jar do we have to make some checks, to be sure, that the required plugin is installed and running.
The below code shows how the class can look like in case the plugin doesn't have a public and easy to access API.
```java
package at.helpch.placeholderapi.example.expansions;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import at.helpch.placeholderapi.example.SomePlugin;
/**
* This class will automatically register as a placeholder expansion
* when a jar including this class is added to the directory
* {@code /plugins/PlaceholderAPI/expansions} on your server.
* <br>
* <br>If you create such a class inside your own plugin, you have to
* register it manually in your plugins {@code onEbale()} by using
* {@code new YourExpansionClass().register();}
*/
public class SomeExpansion extends PlaceholderExpansion {
// We get an instance of the plugin later.
private SomePlugin plugin;
/**
* Since this expansion requires api access to the plugin "SomePlugin"
* we must check if said plugin is on the server or not.
*
* @return true or false depending on if the required plugin is installed.
*/
@Override
public boolean canRegister(){
return (plugin = (SomePlugin) Bukkit.getPluginManager().getPlugin(getRequiredPlugin())) != null;
}
/**
* The name of the person who created this expansion should go here.
*
* @return The name of the author as a String.
*/
@Override
public String getAuthor(){
return "someauthor";
}
/**
* The placeholder identifier should go here.
* <br>This is what tells PlaceholderAPI to call our onRequest
* method to obtain a value if a placeholder starts with our
* identifier.
* <br>This must be unique and can not contain % or _
*
* @return The identifier in {@code %<identifier>_<value>%} as String.
*/
@Override
public String getIdentifier(){
return "someplugin";
}
/**
* if the expansion requires another plugin as a dependency, the
* proper name of the dependency should go here.
* <br>Set this to {@code null} if your placeholders do not require
* another plugin to be installed on the server for them to work.
* <br>
* <br>This is extremely important to set your plugin here, since if
* you don't do it, your expansion will throw errors.
*
* @return The name of our dependency.
*/
@Override
public String getRequiredPlugin(){
return "SomePlugin";
}
/**
* This is the version of this expansion.
* <br>You don't have to use numbers, since it is set as a String.
*
* @return The version as a String.
*/
@Override
public String getVersion(){
return "1.0.0";
}
/**
* This is the method called when a placeholder with our identifier
* is found and needs a value.
* <br>We specify the value identifier in this method.
* <br>Since version 2.9.1 can you use OfflinePlayers in your requests.
*
* @param player
* A {@link org.bukkit.Player Player}.
* @param identifier
* A String containing the identifier/value.
*
* @return possibly-null String of the requested identifier.
*/
@Override
public String onPlaceholderRequest(Player player, String identifier){
if(p == null){
return "";
}
// %someplugin_placeholder1%
if(identifier.equals("placeholder1")){
return plugin.getConfig().getString("placeholder1", "value doesnt exist");
}
// %someplugin_placeholder2%
if(identifier.equals("placeholder2")){
return plugin.getConfig().getString("placeholder2", "value doesnt exist");
}
// We return null if an invalid placeholder (f.e. %someplugin_placeholder3%)
// was provided
return null;
}
}
```
----
#### Internal class
You can have the class inside your plugin.
This has some advantages but can also have some disadvantages.
If you include a PlaceholderExpansion class in your plugin, you MUST add an override the persist() method to return true
otherwise, if PlaceholderAPI is reloaded, your expansion will be unregistered and lost forever.
```java
package at.helpch.placeholderapi.example.expansions;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import at.helpch.placeholderapi.example.SomePlugin;
/**
* This class will be registered through the register-method in the
* plugins onEnable-method.
*/
public class SomeExpansion extends PlaceholderExpansion {
private SomePlugin plugin;
/**
* Since we register the expansion inside our own plugin, we
* can simply use this method here to get an instance of our
* plugin.
*
* @param plugin
* The instance of our plugin.
*/
public SomeExpansion(SomePlugin plugin){
this.plugin = plugin;
}
/**
* Because this is an internal class,
* you must override this method to let PlaceholderAPI know to not unregister your expansion class when
* PlaceholderAPI is reloaded
*
* @return true to persist through reloads
*/
@Override
public boolean persist(){
return true;
}
/**
* Because this is a internal class, this check is not needed
* and we can simply return {@code true}
*
* @return Always true since it's an internal class.
*/
@Override
public boolean canRegister(){
return true;
}
/**
* The name of the person who created this expansion should go here.
* <br>For convienience do we return the author from the plugin.yml
*
* @return The name of the author as a String.
*/
@Override
public String getAuthor(){
return plugin.getDescription().getAuthors().toString();
}
/**
* The placeholder identifier should go here.
* <br>This is what tells PlaceholderAPI to call our onRequest
* method to obtain a value if a placeholder starts with our
* identifier.
* <br>This must be unique and can not contain % or _
*
* @return The identifier in {@code %<identifier>_<value>%} as String.
*/
@Override
public String getIdentifier(){
return "someplugin";
}
/**
* This is the version of the expansion.
* <br>You don't have to use numbers, since it is set as a String.
*
* For convienience do we return the version from the plugin.yml
*
* @return The version as a String.
*/
@Override
public String getVersion(){
return plugin.getDescription().getVersion();
}
/**
* This is the method called when a placeholder with our identifier
* is found and needs a value.
* <br>We specify the value identifier in this method.
* <br>Since version 2.9.1 can you use OfflinePlayers in your requests.
*
* @param player
* A {@link org.bukkit.Player Player}.
* @param identifier
* A String containing the identifier/value.
*
* @return possibly-null String of the requested identifier.
*/
@Override
public String onPlaceholderRequest(Player player, String identifier){
if(player == null){
return "";
}
// %someplugin_placeholder1%
if(identifier.equals("placeholder1")){
return plugin.getConfig().getString("placeholder1", "value doesnt exist");
}
// %someplugin_placeholder2%
if(identifier.equals("placeholder2")){
return plugin.getConfig().getString("placeholder2", "value doesnt exist");
}
// We return null if an invalid placeholder (f.e. %someplugin_placeholder3%)
// was provided
return null;
}
}
```
As you can see is this method pretty similar to the one without any external plugins, since we can get an instance of our plugin much easier and also have a 100% guarantee that the plugin is installed and running.
Our final step now is to register the class and its placeholders. The plugin doesn't do this on its own.
To achieve this, add the following to your `onEnable()` section (Use your expansion name of course):
```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();
}
}
}
```

4316
wiki/Placeholders.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,947 @@
This here is a list of all plugins supporting PlaceholderAPI by either having their own placeholders added, or just allowing other placeholders to be used.
If your plugin isn't shown here and you want it to be added, [open an issue](/PlaceholderAPI/PlaceholderAPI/issues/new?template=change_request_wiki.md) and we will add it!
## Plugins
* **[A](#a)**
* **[B](#b)**
* **[C](#c)**
* **[D](#d)**
* **[E](#e)**
* **[F](#f)**
* **[G](#g)**
* **[H](#h)**
* **[I](#i)**
* **[J](#j)**
* **[K](#k)**
* **[L](#l)**
* **[M](#m)**
* **[N](#n)**
* **[O](#o)**
* **[P](#p)**
* **[Q](#q)**
* **[R](#r)**
* **[S](#s)**
* **[T](#t)**
* **[U](#u)**
* **[V](#v)**
* **[W](#w)**
* **[X](#X)**
----
## A
- **[AAC - AdvancedAntiCheat](https://www.spigotmc.org/resources/6442/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#aac]]**]
- **[AbstractMenus](https://www.spigotmc.org/resources/75107/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#abstractmenus]]**]
- **[AcidIsland](https://www.spigotmc.org/resources/581/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#acidisland]]**]
- **[Advanced Abilities](https://www.spigotmc.org/resources/21983/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#advanced-abilities]]**]
- **[Advanced Achievements](https://www.spigotmc.org/resources/6239/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[AdvancedAFK](https://www.spigotmc.org/resources/60761/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#advancedafk]]**]
- **[AdvancedCustomMenu+](https://www.spigotmc.org/resources/47945/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#advancedcustommenu]]**]
- **[AdvancedLottery](https://www.spigotmc.org/resources/43668/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#advancedlottery]]**]
- **[AdvancedModReq](https://www.spigotmc.org/resources/40528/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#advancedmodreq]]**]
- **[Advance Tab](https://www.spigotmc.org/resources/21958/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ajParkour](https://www.spigotmc.org/resources/60909/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ajparkour]]**]
- **[AnimatedBoard](https://www.spigotmc.org/resources/13632/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[AnimatedScoreboard](https://www.spigotmc.org/resources/20848/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Animated Menu](https://www.spigotmc.org/resources/4690/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#amimated-menu]]**]
- **[AnimatedSpecialBar](https://www.spigotmc.org/resources/24654/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[AnnouncementsEverywhere](https://www.spigotmc.org/resources/59510/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[AParkour](https://www.spigotmc.org/resources/30923/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#aparkour]]**]
- **[ASkyBlock](https://www.spigotmc.org/resources/1220/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#askyblock]]**]
- **[AsyncKeepAlive](https://www.spigotmc.org/resources/64676/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#asynckeepalive]]**]
- **[AutoCommandsPlus](https://www.spigotmc.org/resources/11083/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[AutoRank](https://www.spigotmc.org/resources/3239/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#autorank]]**]
- **[AutoSell](https://www.spigotmc.org/resources/2157/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#autosell]]**]
----
## B
- **[BankSystem](https://www.spigotmc.org/resources/61580/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#banksystem]]**]
- **[BannerBoard](https://www.spigotmc.org/resources/20435/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[BattleLevels](https://www.spigotmc.org/resources/2218/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#battlelevels]]**]
- **[BeautyQuests](https://www.spigotmc.org/resources/39255/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#beautyquests]]**]
- **[BedWars1058](https://www.spigotmc.org/resources/50942/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#bedwars1058]]**]
- **[BentoBox](https://github.com/BentoBoxWorld/BentoBox)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#bentobox]]**]
- **[Big Doors Opener](https://www.spigotmc.org/resources/80805/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[BlockParty](https://www.spigotmc.org/resources/7264/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#blockparty]]**]
- **[BlockQuests](https://www.spigotmc.org/resources/32729/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#blockquests]]**]
- **[BookStats](https://www.spigotmc.org/resources/4313/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[BossBarSet](https://www.spigotmc.org/resources/26963/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[BossVote](https://www.spigotmc.org/resources/16497/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Broadcaster Plugin](https://dev.bukkit.org/projects/broadcaster-plugin)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[BuildBattlePro](https://www.spigotmc.org/resources/49587/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#buildbattlepro]]**]
- **[BungeePerms](https://www.spigotmc.org/resources/25/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#bungeeperms]]**]
----
## C
- **[CarlTheCreeper](https://www.spigotmc.org/resources/18008/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#carlthecreeper]]**]
- **[Characters Premium](https://www.spigotmc.org/resources/45142/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ChatBot](https://www.spigotmc.org/resources/55642/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ChatColor+](https://www.spigotmc.org/resources/1546/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#chatcolor]]**]
- **[ChatColor+ Premium](https://www.spigotmc.org/resources/54093/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#chatcolor-premium]]**]
- **[ChatControl Pro](https://www.spigotmc.org/resources/10258/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Chat Format](https://www.spigotmc.org/resources/11780/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [**[[Link|Placeholders#chat-format]]**]
- **[ChatManager](https://www.spigotmc.org/resources/52245/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ChatReaction](https://www.spigotmc.org/resources/3748/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#chatreaction]]**]
- **[CheckNameHistory](https://www.spigotmc.org/resources/3768/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#checknamehistory]]**]
- **[ChestCommands](https://dev.bukkit.org/projects/chest-commands)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CitizensBooks](https://www.spigotmc.org/resources/37465/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [**[[Link|Placeholders#citizensbooks]]**]
- **[Clans-API for Spigot/Clan tag in chat](https://www.spigotmc.org/resources/31547/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#clans-api-for-spigotclan-tag-in-chat]]**]
- **[Clans](https://www.spigotmc.org/resources/34696/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#clans]]**]
- **[Clans](https://www.spigotmc.org/resources/78415/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#clans-1]]**]
- **[ClicksPerSecond](https://www.spigotmc.org/resources/57214/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CMI](https://www.spigotmc.org/resources/3742/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CombatLogX](https://www.spigotmc.org/resources/31689/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#combatlogx]]**]
- **[CommandConditions](https://www.spigotmc.org/resources/41736/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Compassance](https://www.spigotmc.org/resources/18327/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#compassance]]**]
- **[Country on Join](https://www.spigotmc.org/resources/34275/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#country-on-join]]**]
- **[CraftConomy](https://www.spigotmc.org/resources/2395/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#craftconomy]]**]
- **[CraftingStore.net](https://www.spigotmc.org/resources/31331/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#craftingstorenet]]**]
- **[CTSNC](https://www.spigotmc.org/resources/10714/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CursedVIP](https://www.spigotmc.org/resources/67068/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#cursedvip]]**]
- **[CustomCommands](https://www.spigotmc.org/resources/14363/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CustomGUI (Free)](https://www.spigotmc.org/resources/58440/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CustomGUI (Paid)](https://www.spigotmc.org/resources/7386/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[CustomHelp](https://www.spigotmc.org/resources/20606/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Custom Items](https://www.spigotmc.org/resources/63848/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#custom-items]]**]
- **[CustomSigns](https://www.spigotmc.org/resources/63569/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
----
## D
- **[Daily Rewards](https://www.spigotmc.org/resources/16708)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#daily-rewards]]**]
- **[DeliveryMan](https://www.spigotmc.org/resources/14131/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#deliveryman]]**]
- **[DeluxeChat](https://www.spigotmc.org/resources/1277/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#deluxechat]]**]
- **[DeluxeCombat](https://www.spigotmc.org/resources/63970/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#deluxecombat]]**]
- **[DeluxeCommands](https://www.spigotmc.org/resources/8033/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[DeluxeMenus](https://www.spigotmc.org/resources/11734/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[DeluxeTags](https://www.spigotmc.org/resources/4390/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#deluxetags]]**]
- **[Depinezen](/DenizenScript/Depenizen-For-Bukkit/blob/master/README.md) (For [Denizen](https://www.spigotmc.org/resources/21039/))**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#denizen]]**]
- **[DiscordSRV](https://www.spigotmc.org/resources/18494/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#discordsrv]]**]
- **[Disease](https://www.spigotmc.org/resources/3911/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#disease]]**]
- **DonationParty**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#donationparty]]**]
- **[Donations Holograms](https://www.spigotmc.org/resources/1956/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#donations-holograms]]**]
- **[DragonSlayer](https://www.spigotmc.org/resources/36250/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#dragonslayer]]**]
- **[DungeonsXL](https://www.spigotmc.org/resources/9488/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#dungeonsxl]]**]
----
## E
- **[Economy Bank](https://www.spigotmc.org/resources/7674/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#economy-bank]]**]
- **[Enjin & DonationCraft 2.x](https://dev.bukkit.org/projects/emp)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#enjin--donationcraft-2x]]**]
- **[Enhanced BalTop](https://www.spigotmc.org/resources/20168/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Envoys](https://www.spigotmc.org/resources/20357/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#envoys]]**]
- **[EpicCraftingsPlus](https://www.spigotmc.org/resources/39967/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[EpicFriends](https://www.spigotmc.org/resources/11294/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#epicfriends]]**]
- **[EpicLevels](https://songoda.com/marketplace/product/44)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#epiclevels]]**]
- **[Ersatz](https://www.spigotmc.org/resources/49433/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[essCore](https://www.spigotmc.org/resources/37766/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#esscore]]**]
- **[Essentials](https://ci.ender.zone/job/EssentialsX/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#essentials]]**]
- **[EZBlocks](https://www.spigotmc.org/resources/1499/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ezblocks]]**]
- **[EzChat](https://www.spigotmc.org/resources/75048/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
- **[EZPrestige](https://www.spigotmc.org/resources/1794/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ezprestige]]**]
- **[EZRanksPro](https://www.spigotmc.org/resources/10731/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ezrankspro]]**]
----
## F
- **[FactionMapScoreboard](https://www.spigotmc.org/resources/23071/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Factions MCore](https://www.spigotmc.org/resources/1900/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#factions-mcore]]**]
- **[FactionsUUID](https://www.spigotmc.org/resources/1035/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#factionsuuid]]**]
- **[FunnyGuilds](https://github.com/FunnyGuilds/FunnyGuilds)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#funnyguilds]]**]
- **[FriendReferral](https://www.spigotmc.org/resources/21626/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
----
## G
- **[GangsPlus](https://www.spigotmc.org/resources/2604/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#gangsplus]]**]
- **[GemsEconomy](https://www.spigotmc.org/resources/19655/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#gemseconomy]]**]
- **[GriefDefender](https://www.spigotmc.org/resources/68900/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#griefdefender]]**]
- **[GriefPrevention](https://www.spigotmc.org/resources/1884/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#griefprevention]]**]
- **[Guilds](https://www.spigotmc.org/resources/48920/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#guilds]]**]
- **[GUIPlus](https://www.spigotmc.org/resources/38664/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
----
## H
- **[Hawn - Hub/Lobby Management](https://www.spigotmc.org/resources/66907/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Head Database](https://www.spigotmc.org/resources/14280/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#head-database]]**]
- **[HelpGUI](https://www.spigotmc.org/resources/33245/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[HeroChat Premium]()**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [**[[Link|Placeholders#herochat-premium]]**]
- **[Heroes](https://www.spigotmc.org/resources/305/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#heroes]]**]
- **[HoloBlock](https://www.spigotmc.org/resources/43192/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#holoblock]]**]
- **[HPWizard](https://www.spigotmc.org/resources/26821/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#hpwizard]]**]
- **[Hugs](https://www.spigotmc.org/resources/hugs.39722/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#hugs]]**]
----
## I
- **[InteractionVisualizer](https://www.spigotmc.org/resources/77050/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#interactionvisualizer]]**]
- **[IslandRate (ASkyBlock Addon)](https://www.spigotmc.org/resources/53519/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#islandrate-askyblock-addon]]**]
- **[IslandRate (AcidIsland Addon)](https://www.spigotmc.org/resources/54913/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#islandrate-acidisland-addon]]**]
- **[ItemJoin](https://www.spigotmc.org/resources/12661/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
----
## J
- **[Jobs Reborn](https://www.spigotmc.org/resources/4216/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#jobs-reborn]]**]
- **[JSONChat](https://www.spigotmc.org/resources/17744/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
----
## K
- **[Karma](https://www.spigotmc.org/resources/71156/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#karma]]**]
- **[KillStats](http://dev.bukkit.org/bukkit-plugins/killstats-v1-0/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#killstats]]**]
- **[KitPvP](https://www.spigotmc.org/resources/27107/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#kitpvp]]**]
- **[Kingdoms+](https://www.spigotmc.org/resources/11833/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#kingdoms]]**]
- **[KP-PVP](https://www.spigotmc.org/resources/50969/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#kp-pvp]]**]
----
## L
- **[LastLoginAPI](https://www.spigotmc.org/resources/66348/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#lastloginapi]]**]
- **[LeaderHeads](https://www.spigotmc.org/resources/2079/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#leaderheads]]**]
- **[Leak Parkour](https://www.spigotmc.org/resources/12852/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
- **[LegendQuest](https://www.spigotmc.org/resources/2120/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#legendquest]]**]
- **[LemonMobCoins](https://www.spigotmc.org/resources/59402/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#lemonmobcoins]]**]
- **[LuckPerms](https://www.spigotmc.org/resources/28140/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#luckperms]]**]
- **[LWC (Modern LWC)](https://www.spigotmc.org/resources/2162/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#lwc]]**]
----
## M
- **[Marcely's Bedwars](https://www.spigotmc.org/resources/13622/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#marcelys-bedwars]]**]
- **[Marriage](https://www.spigotmc.org/resources/81807/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#marriage]]**]
- **[Marriage (reloaded)](https://www.spigotmc.org/resources/18998/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#marriage-reloaded]]**]
- **[MarriageMaster](http://dev.bukkit.org/bukkit-plugins/marriage-master/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#marriagemaster]]**]
- **[MCInfected](https://www.spigotmc.org/resources/2133/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mcinfected]]**]
- **[MCInfected-Ranks](https://www.spigotmc.org/resources/2826/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mcinfected-ranks]]**]
- **[McJobs](https://dev.bukkit.org/projects/mcjobs/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mcjobs]]**]
- **[McMMO](https://www.spigotmc.org/resources/2445/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mcmmo]]**]
- **[Menu](https://www.spigotmc.org/resources/50658/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[MineChess](https://www.spigotmc.org/resources/74178/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#minechess]]**]
- **[Minecord](https://www.spigotmc.org/resources/44055/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#minecord]]**]
- **[MineCrates](https://www.spigotmc.org/resources/4685/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#minecrates]]**]
- **[MinetopiaSDB](https://www.spigotmc.org/resources/28830/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[MixStepManager](https://www.spigotmc.org/resources/23531/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[MobHunting](https://www.spigotmc.org/resources/3582/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mobhunting]]**]
- **[MultiChat](https://www.spigotmc.org/resources/26204/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[MultiClan 2.0](https://www.spigotmc.org/resources/23927/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Multiverse-Core](https://www.spigotmc.org/resources/390/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#multiverse-core]]**]
- **[MurderMystery 2](https://www.spigotmc.org/resources/36894/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[MyCommand](http://dev.bukkit.org/bukkit-plugins/mycommand/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mycommand]]**]
- **[MyPet](https://www.spigotmc.org/resources/12725/) [[Premium](https://www.spigotmc.org/resources/17566/)]**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#mypet-premium]]**]
- **[MyPrefixSystem](https://www.spigotmc.org/resources/46244/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#myprefixsystem]]**]
----
## N
- **[Nameless Plugin](https://www.spigotmc.org/resources/59032/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#nameless-plugin]]**]
- **[Nicknamer](https://www.spigotmc.org/resources/5341/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#nicknamer]]**]
- **[NickReloaded](https://www.spigotmc.org/resources/46335/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#nickreloaded]]**]
- **[Nicky](https://www.spigotmc.org/resources/590/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#nicky]]**]
----
## O
- **[OnePlayerSleep](https://www.spigotmc.org/resources/76534/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#oneplayersleep]]**]
- **[OneTimeUse](https://www.spigotmc.org/resources/13907/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[OnTime](http://dev.bukkit.org/bukkit-plugins/ontime/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ontime]]**]
- **[OreAnnouncer](https://www.spigotmc.org/resources/33464/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#oreannouncer]]**]
- **[Outpost](https://www.spigotmc.org/resources/38657/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#outpost]]**]
----
## P
- **[Paintball Battle](https://www.spigotmc.org/resources/76676/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#paintball-battle]]**]
- **[Parkour](https://www.spigotmc.org/resources/23685/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#parkour]]**]
- **[Parties](https://www.spigotmc.org/resources/3709/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#parties]]**]
- **[Party and Friends](https://www.spigotmc.org/resources/11633/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#party-and-friends]]**]
- **[PingTest](https://www.spigotmc.org/resources/69580/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
- **[PixelVip](https://www.spigotmc.org/resources/30438/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#pixelvip]]**]
- **[Plan](https://www.spigotmc.org/resources/32536/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#plan]]**]
- **[PlayerBalancerAddon](https://www.spigotmc.org/resources/51220/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[PlayTime](https://www.spigotmc.org/resources/26016/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#playtime]]**]
- **[PlayerPoints](http://dev.bukkit.org/bukkit-plugins/playerpoints/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#playerpoints]]**]
- **[PlotSquared](https://www.spigotmc.org/resources/1177/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#plotsquared]]**]
- **[PointsAPI](https://www.spigotmc.org/resources/13957/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#pointsapi]]**]
- **[Potatoes](https://www.spigotmc.org/resources/12353/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[PowerRanks](https://www.spigotmc.org/resources/64696/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#powerranks]]**]
- **[PremiumVanish](https://www.spigotmc.org/resources/14404/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#premiumvanish]]**]
- **[PrisonMines](https://www.spigotmc.org/resources/4046/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#prisonmines]]**]
- **[PrisonRanksX](https://www.spigotmc.org/resources/55899/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#prisonranksx]]**]
- **[ProCosmetics](https://www.spigotmc.org/resources/49106/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#procosmetics]]**]
- **[ProdigyGadget](https://www.spigotmc.org/resources/1335/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ProfessionalBans](https://www.spigotmc.org/resources/63657/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#professionalbans]]**]
- **[ProQuest](https://www.spigotmc.org/resources/18249/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#proquest]]**]
- **[ProtectionStones](https://www.spigotmc.org/resources/61797/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#protectionstones]]**]
- **[PurpleIRC](https://www.spigotmc.org/resources/2836/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[PvPLevels](https://www.spigotmc.org/resources/20807/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#pvplevels]]**]
- **[PvP Stats](http://dev.bukkit.org/bukkit-plugins/pvp-stats/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#pvp-stats]]**]
- **[PvPStats Plugin](https://www.spigotmc.org/resources/69984/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#pvpstats-plugin]]**]
- **[PyrCore](https://www.spigotmc.org/resources/24180/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
----
## Q
- **[Quests](https://www.spigotmc.org/resources/3711/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#quests]]**]
- **[QuestCreator](https://www.spigotmc.org/resources/38734/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#questcreator]]**]
- **[QuickBoard](https://www.spigotmc.org/resources/15057/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[QuickSell](https://www.spigotmc.org/resources/6107/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#quicksell]]**]
----
## R
- **[RabbitsVSPenguins](https://www.spigotmc.org/resources/65277/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#rabbitsvspenguins]]**]
- **[RageMode](https://www.spigotmc.org/resources/69169/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ragemode]]**]
- **[RankedHelp](https://www.spigotmc.org/resources/61919/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Rankup](https://www.spigotmc.org/resources/17933/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#rankup]]**]
- **[RawMSG](https://www.spigotmc.org/resources/35864/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
- **[RecentFind (Treasures Add-on)](https://www.spigotmc.org/resources/33366/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#recentfind]]**]
- **[RedProtect](http://spigotmc.org/resources/15841/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#redprotect]]**]
- **[ReporterGUI](https://www.spigotmc.org/resources/8596/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[RestrictedDimensions](http://spigotmc.org/resources/80574/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#restricteddimensions]]**]
- **[RogueParkour](https://www.spigotmc.org/resources/26563/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#rogueparkour]]**]
- **[RoyalCommands](https://www.spigotmc.org/resources/4113/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#royalcommands]]**]
- **[ReferralSystem](https://www.spigotmc.org/resources/29709/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#referralsystem]]**]
- **[Residence](https://www.spigotmc.org/resources/11480/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[RPGInventory](https://www.spigotmc.org/resources/12498/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#rpginventory]]**]
----
## S
- **[Scoreboard Sidebar API](https://www.spigotmc.org/resources/21042/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ScrollBoard](https://www.spigotmc.org/resources/24697/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Skellett (Skript Add-on)](https://forums.skunity.com/resources/24/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SellAll](https://www.spigotmc.org/resources/1221/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#sellall]]**]
- **[Server List/Staff List](https://www.spigotmc.org/resources/15119/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ServerSelectorX](https://www.spigotmc.org/resources/32853/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SignLink](https://www.spigotmc.org/resources/39593/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#signlink]]**]
- **[SimpleBoard](https://www.spigotmc.org/resources/39597/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SimpleClans](https://www.spigotmc.org/resources/5269/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#simpleclans]]**]
- **[SimpleCoinsAPI](https://www.spigotmc.org/resources/1432/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#simplecoinsapi]]**]
- **[SimpleKillTracker](https://www.spigotmc.org/resources/17651/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#simplekilltracker]]**]
- **[SimplePrefix](http://dev.bukkit.org/bukkit-plugins/simple-prefix/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#simpleprefix]]**]
- **[Simple Suffix](http://dev.bukkit.org/bukkit-plugins/simple-suffix/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#simple-suffix]]**]
- **[SkillAPI](https://www.spigotmc.org/resources/4824/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#skillapi]]**]
- **[Skript](https://github.com/bensku/Skript)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#skript]]**]
- **[SkyWars](https://www.spigotmc.org/resources/6525/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SkyWarsReloaded](https://www.spigotmc.org/resources/3796/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#skywarsreloaded]]**]
- **[Spark](https://github.com/lucko/spark)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#spark]]**]
- **[SpigotBoard](https://www.spigotmc.org/resources/47497/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SpigotLib](https://www.spigotmc.org/resources/5925/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SpigotLobby](https://www.spigotmc.org/resources/58797/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SQLPerms](https://www.spigotmc.org/resources/1462/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#sqlperms]]**]
- **[SQLTokens](https://www.spigotmc.org/resources/3482/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#sqltokens]]**]
- **[sTablist](https://www.spigotmc.org/resources/12234/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Staff Facilities](https://www.spigotmc.org/resources/13097/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#staff-facilities]]**]
- **[Statz](https://www.spigotmc.org/resources/25969/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#statz]]**]
- **[StrikePractice 2](https://www.spigotmc.org/resources/46906/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#strikepractice-2]]**]
- **[stTitles](https://www.spigotmc.org/resources/8310/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#sttitles]]**]
- **[SubServers](https://github.com/ME1312/SubServers-2)**
- [ ] Supports Placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#subservers]]**]
- **[SuperbVote](https://www.spigotmc.org/resources/11626/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#superbvote]]**]
- **[SuperCredits](https://www.spigotmc.org/resources/31074/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#supercredits]]**]
- **[SuperScratch](https://www.spigotmc.org/resources/12250/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[SuperVanish](https://www.spigotmc.org/resources/1331/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#supervanish]]**]
----
## T
- **[TakaAntiCheat](https://www.spigotmc.org/resources/45167/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[The Time](https://www.spigotmc.org/resources/25146/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#the-time]]**]
- **[ThemePark](https://www.spigotmc.org/resources/48648/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#themepark]]**]
- **[Thirst](https://www.spigotmc.org/resources/3316/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#thirst]]**]
- **[Timed Rewards](https://www.spigotmc.org/resources/34008/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#timed-rewards]]**]
- **[Time Tokens](https://www.spigotmc.org/resources/75441/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#time-tokens]]**]
- **[TNTRun_Reloaded](https://www.spigotmc.org/resources/53359/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#tntrun_reloaded]]**]
- **[TokenEnchant](https://www.spigotmc.org/resources/2287/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#tokenenchant]]**]
- **[TokenManager](https://www.spigotmc.org/resources/8610/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#tokenmanager]]**]
- **[Tokens](https://www.spigotmc.org/resources/71941/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#tokens]]**]
- **[Towny](https://github.com/TownyAdvanced/Towny)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#towny]]**]
- **[TownyChat](https://github.com/TownyAdvanced/TownyChat)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#townychat]]**]
- **[TransmuteIt](https://www.spigotmc.org/resources/76287/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#transmuteIt]]**]
- **[Treasures](https://www.spigotmc.org/resources/14178/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#treasures]]**]
- **[Trey's Double Jump](https://www.spigotmc.org/resources/19630/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#treys-double-jump]]**]
- **[TrickOrTreat](https://www.spigotmc.org/resources/61370/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#trickortreat]]**]
----
## U
- **[UChat](https://www.spigotmc.org/resources/23767/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[UltimateAnnounce+](https://www.spigotmc.org/resources/7459/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[UltimateBossBar](https://www.spigotmc.org/resources/19303/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
- **[UltimateSigns](https://www.spigotmc.org/resources/72462/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
- **[UltraChatFormat](https://www.spigotmc.org/resources/57929/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[UltraMenu](https://www.spigotmc.org/resources/27856/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Ultra Permissions](https://www.spigotmc.org/resources/42678/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Ultra Simple Staff Chat](https://www.spigotmc.org/resources/22064/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[USkyBlock](https://www.spigotmc.org/resources/2280/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#uskyblock]]**]
- **[UltimateChat](https://www.spigotmc.org/resources/uchat.23767/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ultimatechat]]**]
- **[UltimateVotes](https://www.spigotmc.org/resources/516)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#ultimatevote]]**]
- **[UnityGen](https://www.spigotmc.org/resources/26218/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#unitygen]]**]
----
## V
- **[VariableTriggers](https://dev.bukkit.org/projects/variabletriggers)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[Vault](http://dev.bukkit.org/bukkit-plugins/vault/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#vault]]**]
- **[VentureChat](https://www.spigotmc.org/resources/771/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[ViaVersion](https://www.spigotmc.org/resources/19254/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#viaversion]]**]
- **[VoteParty](https://www.spigotmc.org/resources/987/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#voteparty]]**]
- **[VoteRoulette](http://dev.bukkit.org/bukkit-plugins/voteroulette/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#voteroulette]]**]
- **[VotingPlugin](https://www.spigotmc.org/resources/15358/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#votingplugin]]**]
----
## W
- **[WickedSkyWars](https://www.spigotmc.org/resources/556/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#wickedskywars]]**]
- **[WonderHUD](https://www.spigotmc.org/resources/12220/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders. [Link]
- **[WorldGuard](https://dev.bukkit.org/bukkit-plugins/worldguard/)**
- [ ] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#worldguard]]**]
- **[WorldJoin](https://www.spigotmc.org/resources/63892/)**
- [x] Supports placeholders.
- [ ] Provides own placeholders.
----
## X
- **[XLTournaments](https://www.spigotmc.org/resources/70630/)**
- [x] Supports placeholders.
- [x] Provides own placeholders. [**[[Link|Placeholders#xltournaments]]**]

82
wiki/README.md Normal file
View File

@ -0,0 +1,82 @@
[Wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
[Placeholders]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
[Plugins using PlaceholderAPI]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
# Wiki
This is the wiki folder. It contains all pages that you can find in our [Wiki].
It allows you to suggest changes through Pull request while keeping a simple way for us to maintain the wiki, without granting everyone push rights to it.
If you want to contribute towards the wiki would we highly recommend to follow the below contributing Guidelines, to keep the overal style of the wiki intact.
## Adding your resource(s)
If you have one or multiple resources that support PlaceholderAPI (being it by just supporting placeholders from other plugins, or providing your own) can you add them to the wiki in the following ways.
### [Plugins using PlaceholderAPI]
You should always add your resource to this page, no matter if it only supports placeholders or also provides its own.
The format of a plugin is always as follows:
```md
- **[:name](:url)**
- [?] Supports placeholders.
- [?] Provides own placeholders. [:link]
```
A quick summary over the different parts:
- `:name` is the name of your resource. The resources are ordered by alphabet and if yours has the same name as another one listed, add it __below__ the other resource.
- `:url` should be replaced with a URL to your resource page (Spigot, dev.bukkit, etc.). If you use Spigot, make sure to remove any text after the `/resources/` and only leave the ID. For example will https://www.spigotmc.org/resources/placeholderapi.6245/ become https://www.spigotmc.org/resources/6245/.
If you don't have your resource on any resource page can you either ommit the URL (Just provide the name) or provide a link to its source, if available.
- `?` should be replaced with either an `x` or a space depending on wether your plugin supports the option or not. So the `[?]` becomes either `[x]` or `[ ]`
- `:link` depends on wether your plugin provides own placeholders or not. If it doesn't, then you can just give `Link`. If it does provide placeholders, make sure to provide `[[Link|Placeholders#:name]]` where `:name` would be the name of your resource in the [Placeholders] page.
### [Placeholders]
If your plugin provides its own placeholders through an extension is it recommendet to add this extension to the [Placeholders] page.
This page is split up into two sections: PAPI Placeholders and Plugin Placeholders.
PAPI Placeholders are extensions that don't require an external plugin or other dependency to function normally. Common examples are the Player or Server extensions.
The Plugin Placeholders are extensions that require a plugin or other dependency to function. They are often used to provide values from one pluging (e.g. Vault) to another plugin through the help of PlaceholderAPI.
The overall structure of an entry is always the same:
````md
- ### **[:name](:url)**
> :command
```
:placeholders
```
----
````
- `:name` is the name of your resource. The resources are ordered by alphabet and if yours has the same name as another one listed, add it __below__ the other resource.
- `:url` should be replaced with a URL to your resource page (Spigot, dev.bukkit, etc.). If you use Spigot, make sure to remove any text after the `/resources/` and only leave the ID. For example will https://www.spigotmc.org/resources/placeholderapi.6245/ become https://www.spigotmc.org/resources/6245/.
If you don't have your resource on any resource page can you either ommit the URL (Just provide the name) or provide a link to its source, if available.
- `:command` depends on if your extension is available on the eCloud or is build into your resource. If you have it on the eCloud should you provide `/papi ecloud download :name` where `:name` is the name your expansion has on the eCloud.
If your extension is build into your resource can you just set `NO DOWNLOAD COMMAND` instead.
- `:placeholders` would be a list of all placeholders that your extension offers (Sorted by alphabet). If your placeholders support multiple variables like item names, should you use either `<text>` or `[text]` depending on if it is required or optional.
Always keep an empty line in between the `----` and the next entry below it.
If your extension is at the very bottom of the page can you ommit the `----`.
You will also need to add your extension's name to the list at the very top in the format `- **[:name](#:name)**` where `:name` is the extension name.
## Other Wiki pages
Please follow these general guidelines when editing any other pages.
### Linking
Linking should always be done through either the reference option or through the Wiki link option.
When the link leads to a page on the wiki should you use either `[[:page]]` or `[[:name|:page]]` where `:page` would be the name of the Wiki page (Case sensitive) and `:name` the text that would be displayed instead.
When linking to a section within a Wiki page should you link to it using a hashtag (`#`). For example would linking to the player extension result in `[[Placeholders#player]]` (Always have the section lowercase.
However, when you link to a section in the same wiki page should you do it in the format `[:name](#:section)` where `:name` is the text to display and `:section` is the name of the section.
When you link to an external page that isn't part of the wiki should you do it as a reference link (Exception is the above mentioned cases for resources and extensions).
You do this by adding `[:name]: :url` at the top of the page where `:name` is the reference name to use and `:url` is the url to link to.
You can then just use either `[:name]` or `[:display_text][:name]` to link to the url you set (`:display_text` could be any text (including spaces) to display).
Reference links are case-insensitive.
This system allows us to easly maintain the links without the need to update a URL on several places within the page.
### Lists
Lists should always be started with a hyphen (`-`) to better distinguish it from other formatting characters like the asterisk (`*`) used for bold or italic text.

16
wiki/_Footer.md Normal file
View File

@ -0,0 +1,16 @@
[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/r/http/repo.extendedclip.com/me.clip/placeholderapi.svg?label=API-Version
[plugin-page]: https://spigotmc.org/resources/6245
> Thanks for using PlaceholderAPI.
>
> **[Plugin-page]** | **[[Placeholders]]** | **[[Plugins using PlaceholderAPI]]** | **[[Hook into PlaceholderAPI]]**
![versionImg] [![jenkinsImg]][jenkins] [![licenseImg]][license] [![issuesImg]][issues] [![discordImg]][discord]

78
wiki/_Sidebar.md Normal file
View File

@ -0,0 +1,78 @@
<p align="center">
<img src="https://i.imgur.com/Adp7xdh.png" alt="PlaceholderAPI">
</p>
**[[Main page|Home]]**
### Setup
**[[Hook into PlaceholderAPI]]**
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
- [[Adding placeholders to PlaceholderAPI|Hook-into-PlaceholderAPI#adding-placeholders-to-placeholderapi]]
- [[PlaceholderExpansion]]
- [[Without an external plugin|PlaceholderExpansion#without-an-external-plugin]]
- [[With external plugin|PlaceholderExpansion#with-external-plugin]]
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
### Other
**[[Commands]]**
**[[Expansion cloud]]**
**[[FAQ]]**
**[[Plugins using PlaceholderAPI]]**
**[[Placeholders]]**
- [[PAPI-placeholders|Placeholders#papi-placeholders-1]]
- [[Advancements|Placeholders#advancements]]
- [[Animations|Placeholders#animations]]
- [[Armor|Placeholders#armor]]
- [[ASCII|Placeholders#ASCII]]
- [[BungeeCord|Placeholders#bungeecord]]
- [[CheckItem|Placeholders#checkitem]]
- [[CooldownBar|Placeholders#cooldownbar]]
- [[Formatter|Placeholders#formatter]]
- [[Javascript|Placeholders#javascript]]
- [[ListPlayers|Placeholders#listplayer]]
- [[LocalTime|Placeholders#localtime]]
- [[Math|Placeholders#math]]
- [[MVdW placeholders|Placeholders#mvdw-placeholders]]
- [[OtherPlayer|Placeholders#otherplayer]]
- [[ParseNear|Placeholders#parsenear]]
- [[ParseOther|Placeholders#parseother]]
- [[Pinger|Placeholders#pinger]]
- [[Player|Placeholders#player]]
- [[PlayerList|Placeholders#playerlist]]
- [[Plugin|Placeholders#plugin]]
- [[Progress|Placeholders#progress]]
- [[RainbowColor|Placeholders#rainbowcolor]]
- [[RandomColor|Placeholders#randomcolor]]
- [[RedisBungee|Placeholders#redisbungee]]
- [[RelCon|Placeholders#relcon]]
- [[ScoreboardObjectives|Placeholders#scoreboardobjectives]]
- [[Server|Placeholders#server]]
- [[Sound|Placeholders#sound]]
- [[Spectators|Placeholders#spectators]]
- [[Statistic|Placeholders#statistic]]
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
- [[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]]
- [[Z|Placeholders#z]]