mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 17:27:05 +02:00
Compare commits
316 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5710972288 | ||
|
63955511a8 | ||
|
9a7790c808 | ||
|
3abc78ff64 | ||
|
c4789b7db0 | ||
|
d7a4acc2f5 | ||
|
dd7751332f | ||
|
fa7c30df80 | ||
|
89053354e9 | ||
|
ead63ca763 | ||
|
0fa592383f | ||
|
7df3a5c6e0 | ||
|
c4a2256fff | ||
|
9b6b558002 | ||
|
94bf5fea57 | ||
|
252802dcbe | ||
|
8932a92049 | ||
|
679ef90091 | ||
|
ac9b0c42b7 | ||
|
14d885392c | ||
|
0c102a1823 | ||
|
4c968f012d | ||
|
438a665b74 | ||
|
247a5cde8f | ||
|
af268c4941 | ||
|
4c4b1602d9 | ||
|
8c69a164b8 | ||
|
df8583df57 | ||
|
09e68e7510 | ||
|
71b5433326 | ||
|
748b9f33f7 | ||
|
d14f319eb4 | ||
|
0927760d76 | ||
|
91af12f575 | ||
|
5dbbe01b95 | ||
|
0c6dd5466c | ||
|
41275509b2 | ||
|
4e8b1b47d1 | ||
|
d0e62e6434 | ||
|
2086fcb299 | ||
|
3a31c5cb78 | ||
|
20b2a69b5e | ||
|
682717660f | ||
|
7b7bfb7306 | ||
|
8f796e3940 | ||
|
bf1527a40f | ||
|
ec127dbeb1 | ||
|
5d80119fcd | ||
|
f6c972c9a2 | ||
|
a0b256c17d | ||
|
a66cae9a6b | ||
|
7f6122f8b8 | ||
|
ee7257208a | ||
|
87ea46a4dd | ||
|
d221a3f38a | ||
|
f62980606a | ||
|
c2ab9f5b85 | ||
|
2c925983a8 | ||
|
375e743124 | ||
|
78f76c8343 | ||
|
33e4743e89 | ||
|
b9b7104f6b | ||
|
a45f420069 | ||
|
a7d92f569f | ||
|
73f55735b4 | ||
|
a15c6b4855 | ||
|
48f7ffe089 | ||
|
c607338003 | ||
|
66a7a6d199 | ||
|
1d7bf239ea | ||
|
43a5db7711 | ||
|
0e56ea9503 | ||
|
d640d801e6 | ||
|
b5c70dedcb | ||
|
a8bcf0e14d | ||
|
0c13004040 | ||
|
cc05a3508b | ||
|
458030c575 | ||
|
3b4641c26c | ||
|
9b03af17b6 | ||
|
72b2be4933 | ||
|
2f0f717d44 | ||
|
e3bef564f2 | ||
|
319be0e043 | ||
|
431483da89 | ||
|
d07376245c | ||
|
2aa6ac2b63 | ||
|
03a362817c | ||
|
2dc972423a | ||
|
4b43d35bcc | ||
|
350ec10186 | ||
|
0104e48b72 | ||
|
a88f7aab30 | ||
|
e91ed337cc | ||
|
32d5b7697d | ||
|
c23d35d219 | ||
|
6b04b6c39b | ||
|
021d5b1f47 | ||
|
b0f14c6e4e | ||
|
cd3a0f52d5 | ||
|
cc5835423f | ||
|
155fc0592a | ||
|
a163c72e93 | ||
|
562f6a852d | ||
|
bfb88781af | ||
|
ff4656bbe7 | ||
|
c44b08e2e9 | ||
|
4d14b583ff | ||
|
892f0727e8 | ||
|
3635ecb8b4 | ||
|
dd2981b13e | ||
|
ff60343089 | ||
|
fb77c42bba | ||
|
a65b9ad49e | ||
|
0ed32c7ddd | ||
|
f1350783fc | ||
|
5ac2efd9c6 | ||
|
a7247acbb3 | ||
|
0b3663ee87 | ||
|
ba9b38dd0e | ||
|
62bb68ee94 | ||
|
e96c6fb7ef | ||
|
c04c101de5 | ||
|
5ab2c05821 | ||
|
9b9e0e4b9e | ||
|
c3ee5bbdc0 | ||
|
fb70ba6403 | ||
|
f605db479b | ||
|
175308ecf5 | ||
|
2adf2845fd | ||
|
0438c67f7d | ||
|
47d6928b9f | ||
|
deee5a1c39 | ||
|
c9492564e0 | ||
|
0c826a288e | ||
|
093ba4d68c | ||
|
1478aabb5e | ||
|
07ac8e41c5 | ||
|
f0dccbd594 | ||
|
26fdedd989 | ||
|
d342c73f24 | ||
|
0a52ef7219 | ||
|
6a69ec833f | ||
|
b540127651 | ||
|
8fa0f73a46 | ||
|
077a221c3f | ||
|
301a1c9ac5 | ||
|
0db15f96ae | ||
|
9b2ea05875 | ||
|
27d8ae03e1 | ||
|
15e22ea115 | ||
|
f398854c68 | ||
|
29446c08b6 | ||
|
3d44f8ffdc | ||
|
61afb24d33 | ||
|
e8b5660eda | ||
|
d4744838ee | ||
|
32f3e21ab7 | ||
|
e6d57f81da | ||
|
818bf91c93 | ||
|
ac2c2b324e | ||
|
cf9d07a856 | ||
|
860239fa2b | ||
|
69f0ede0c6 | ||
|
480f13a3ce | ||
|
b99335e5b2 | ||
|
e83eba9226 | ||
|
278a5a4096 | ||
|
1cfa247f8c | ||
|
a3b2777d16 | ||
|
3c9f6ea520 | ||
|
15d2452b19 | ||
|
f582474fb1 | ||
|
b1662676f1 | ||
|
23943f41ad | ||
|
3cd665a159 | ||
|
4074192c0b | ||
|
59cd5982ad | ||
|
b3893c38db | ||
|
a3d6426084 | ||
|
30a194c75d | ||
|
6431bcdeca | ||
|
0d1978cece | ||
|
e7e9e81e85 | ||
|
ba22201311 | ||
|
f799835dd0 | ||
|
6f3dcf04fe | ||
|
6b03c38e40 | ||
|
f756fbb43b | ||
|
f84702e3b2 | ||
|
9c750f50a2 | ||
|
dcca454bad | ||
|
ffef826c94 | ||
|
15e0a293eb | ||
|
11ed822845 | ||
|
1e4af86172 | ||
|
5f9dffc3c7 | ||
|
93e83efb57 | ||
|
0d9485ddec | ||
|
1248010566 | ||
|
d68fe7067c | ||
|
e16497618c | ||
|
4cfd419565 | ||
|
f52bdbc458 | ||
|
433dd7020c | ||
|
4fef2dd82a | ||
|
1e6fb502a6 | ||
|
b56ab1408e | ||
|
5dae844181 | ||
|
329b46c042 | ||
|
e2dd16cf1c | ||
|
dc244849a1 | ||
|
736de5b633 | ||
|
b31767ba4a | ||
|
ae06fcd807 | ||
|
7108ffbb31 | ||
|
7a6b6d7ce4 | ||
|
549a30b502 | ||
|
c64946173b | ||
|
5bca9dc41f | ||
|
5c830d7102 | ||
|
400c0d5b5d | ||
|
c53d5b2abf | ||
|
a842095fff | ||
|
c6e36fec2c | ||
|
fa7eeb5852 | ||
|
b6bfe3f3ef | ||
|
d6cfc8beae | ||
|
83c35ced32 | ||
|
b9bdb3167a | ||
|
dfec6c4c8b | ||
|
35838aa229 | ||
|
ee0df86f84 | ||
|
0650de95d6 | ||
|
279f1d0c07 | ||
|
5a8738e711 | ||
|
00b95461b6 | ||
|
a74f78bd73 | ||
|
9d35f4c3e6 | ||
|
325cd2d284 | ||
|
d4f0eb91ef | ||
|
5ab228d1d8 | ||
|
64e0f7e500 | ||
|
7998d4d666 | ||
|
2a91d34a65 | ||
|
ac717c7600 | ||
|
e13b91cb22 | ||
|
fdfca9da42 | ||
|
1556e15a1a | ||
|
7691dd93ad | ||
|
2c13acfd30 | ||
|
40f1fcbce2 | ||
|
456958d647 | ||
|
7c404db56b | ||
|
18cfd438b8 | ||
|
d5e27252cf | ||
|
3fe0f0143c | ||
|
61a71b9e73 | ||
|
e542dabd52 | ||
|
9cde086436 | ||
|
fe02939466 | ||
|
f1c2315055 | ||
|
9681c518fc | ||
|
762bb409d3 | ||
|
0394ba284b | ||
|
3e9dcdb53c | ||
|
ddfaf4105d | ||
|
5b1df7c42a | ||
|
7555bb0f97 | ||
|
ab96120911 | ||
|
7371a576d6 | ||
|
5d5ceb5902 | ||
|
125d02fecd | ||
|
8c98a214f8 | ||
|
2a3e8dcec1 | ||
|
a996d9039e | ||
|
cfba92bf14 | ||
|
41f408226e | ||
|
58cfa92136 | ||
|
f3309b76d1 | ||
|
04bfa1e721 | ||
|
dc894c6212 | ||
|
7c7025fdbb | ||
|
97a4eca0a7 | ||
|
5e4110b1b3 | ||
|
d1e3047445 | ||
|
c72515912d | ||
|
eb5a93dce2 | ||
|
7cb3b3b7ec | ||
|
c648d6a541 | ||
|
2d72e274e3 | ||
|
b73d00e169 | ||
|
5065623ab0 | ||
|
8698449e5d | ||
|
722e987b93 | ||
|
a00cbf4be3 | ||
|
f235c60bef | ||
|
a1d69cd25f | ||
|
f7504b99ca | ||
|
02669e2435 | ||
|
3e6d10e203 | ||
|
f828857ce3 | ||
|
ec9d6295fb | ||
|
19a80c2d26 | ||
|
e3d71843ac | ||
|
c2dc51c728 | ||
|
cc02c126b5 | ||
|
b4a914314a | ||
|
f6ba24e46f | ||
|
745f7926a6 | ||
|
62c93465f2 | ||
|
c76baeae1c | ||
|
d12c746630 | ||
|
fbdd789dbe | ||
|
b521fe4a1f | ||
|
b24b127ad5 |
102
.github/CONTRIBUTING.md
vendored
102
.github/CONTRIBUTING.md
vendored
@@ -1,64 +1,52 @@
|
|||||||
[issue]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=change_request_placeholderapi.md
|
[issue]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new
|
||||||
[Discord]: https://helpch.at/discord
|
[discord]: https://helpch.at/discord
|
||||||
[homepage]: http://contributor-covenant.org
|
[code of conduct]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/CODE_OF_CONDUCT.md
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki
|
||||||
|
[dev]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/development
|
||||||
|
[style]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/master/config/style
|
||||||
|
|
||||||
# Contributing
|
# 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.
|
||||||
|
|
||||||
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.
|
If you have any questions about contributions towards the project, feel free to contact us on our [Discord Server][discord].
|
||||||
|
|
||||||
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
## 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.
|
||||||
|
|
||||||
## Pull Request Process
|
When doing so, make sure you follow rules below:
|
||||||
|
|
||||||
1. Update the README.md with details of changes if it is affected by those changes.
|
### Follow the template
|
||||||
2. Try to prevent any breaking changes affecting the end-user (Developers using the API).
|
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.
|
||||||
Mention any breaking changes that could affect the end-user.
|
Your issue may be closed without warning for not following the template.
|
||||||
3. Document any public methods that the end-user might use.
|
|
||||||
|
### 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 like bug fixes or new features, or contributions to its documentation such as the [Wiki] or the Javadoc.
|
||||||
|
|
||||||
|
### Code contributions
|
||||||
|
Any contributions to PlaceholderAPI's code should be done towards the [`development`][dev] branch. Targeting the `master` branch in your Pull request may get it closed without warning.
|
||||||
|
Additionally should you follow the project's codestyle which you can find in the [`config/style`][style] directory.
|
||||||
|
|
||||||
|
### Wiki/Javadoc contributions
|
||||||
|
If your pull request only targets the [wiki] or only changes the javadoc comments of PlaceholderAPI (And not its actual code), it should be to `docs/wiki` branch.
|
||||||
|
The develop branch should only be targeted when you also change some of PlaceholderAPI's code.
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
We have a [Code of Conduct] to maintain a welcoming atmosphere in this project.
|
||||||
### Our Pledge
|
If your contributions go against the Code of Conduct, linked above, we reserve the right to deny or revert your contributions.
|
||||||
|
|
||||||
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
43
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,43 +0,0 @@
|
|||||||
---
|
|
||||||
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 -->
|
|
101
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
101
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
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
|
||||||
|
- 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..."
|
3
.github/ISSUE_TEMPLATE/config.yml
vendored
3
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -12,3 +12,6 @@ contact_links:
|
|||||||
- name: Update Wiki
|
- name: Update Wiki
|
||||||
url: https://github.com/PlaceholderAPI/PlaceholderAPI/pulls
|
url: https://github.com/PlaceholderAPI/PlaceholderAPI/pulls
|
||||||
about: Please make a Pull request towards the "wiki" folder to update the wiki.
|
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.
|
||||||
|
31
.github/ISSUE_TEMPLATE/feature_request.md
vendored
31
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
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 -->
|
|
62
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
62
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
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..."
|
135
.github/label-commenter-config.yml
vendored
Normal file
135
.github/label-commenter-config.yml
vendored
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
comment:
|
||||||
|
footer: "\
|
||||||
|
----\n\n
|
||||||
|
> *This is an automated response created by a **GitHub Action***\n
|
||||||
|
> *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 and PlaceholderAPI
|
||||||
|
- Currently installed Expansions
|
||||||
|
- Currently installed Plugins
|
||||||
|
|
||||||
|
The easiest way to provide those information is through the `/papi dumb` command which posts the required information to https://paste.helpch.at and gives a URL to share.
|
||||||
|
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 in any way.
|
||||||
|
|
||||||
|
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?template=bug_report.md)
|
||||||
|
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=feature_request.md)
|
||||||
|
|
||||||
|
If you want changes to be made towards the Wiki, would we encourage you to [Make a Pull request](https://github.com/PlaceholderAPI/PlaceholderAPI/pulls).
|
||||||
|
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/wiki/README.md).
|
||||||
|
|
||||||
|
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive 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 `development` branch.
|
||||||
|
- Pull requests for the Wiki should target the `docs/wiki` branch.
|
||||||
|
|
||||||
|
Don't hesitate to ask us any questions.
|
||||||
|
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 now 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 targets the [`docs/wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki) branch of the Repository.
|
||||||
|
- You only made changes to the files inside the [`wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki/wiki) folder.
|
||||||
|
- You followed the general Styling Guidelines mentioned in the wiki's [README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md) file.
|
||||||
|
|
||||||
|
If you have any questions about submitting a PR for the wiki or have any other questions don't hesitate to ask us about it.
|
||||||
|
- 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.
|
||||||
|
**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 now 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).
|
25
.github/workflows/label_comment.yml
vendored
Normal file
25
.github/workflows/label_comment.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
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 }}
|
31
.github/workflows/pr_build_jars.yml
vendored
Normal file
31
.github/workflows/pr_build_jars.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: "Test compiling against Java 8, 11 and 16"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- development
|
||||||
|
paths:
|
||||||
|
- "src/**"
|
||||||
|
- "build.gradle"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
testBuilds:
|
||||||
|
name: "Test-compile against Java 8, 11 and 16"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
java-version: [8, 11, 16]
|
||||||
|
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"
|
51
CODE_OF_CONDUCT.md
Normal file
51
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
[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]
|
14
README.md
14
README.md
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
[APIversionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
[APIversionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
||||||
[logo]: https://i.imgur.com/Ea4PURv.png
|
[logo]: https://i.imgur.com/Ea4PURv.png
|
||||||
|
|
||||||
|
[contributing]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md
|
||||||
|
[placeholderexpansion]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion
|
||||||
<!-- The stuff above isn't visible in the readme -->
|
<!-- The stuff above isn't visible in the readme -->
|
||||||
|
|
||||||
[![logo]][spigot]
|
[![logo]][spigot]
|
||||||
@@ -27,10 +30,13 @@
|
|||||||
|
|
||||||
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 150+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
|
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 150+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
|
||||||
|
|
||||||
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.
|
PlaceholderAPI has been downloaded over 500,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.
|
||||||
|
|
||||||
<!-- TODO: Add contributing section -->
|
## Contribute
|
||||||
<!-- TODO: Add expansion creation section (possibly add to a wiki?) -->
|
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.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
- [Issue Tracker][issues]
|
- [Issue Tracker][issues]
|
||||||
@@ -38,7 +44,7 @@ PlaceholderAPI has been downloaded over 400,000 times and has been used concurre
|
|||||||
|
|
||||||
## Quick Links
|
## Quick Links
|
||||||
- [CI Server][ci]
|
- [CI Server][ci]
|
||||||
- [Expansions cloud]
|
- [Expansions Cloud]
|
||||||
- [Placeholder List]
|
- [Placeholder List]
|
||||||
- [Spigot Page][spigot]
|
- [Spigot Page][spigot]
|
||||||
- [Plugin Statistics][statistics]
|
- [Plugin Statistics][statistics]
|
||||||
|
59
build.gradle
59
build.gradle
@@ -1,54 +1,70 @@
|
|||||||
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "java"
|
id "java"
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
id "net.minecrell.licenser" version "0.4.1"
|
id "org.cadixdev.licenser" version "0.6.0"
|
||||||
id "com.github.johnrengelman.shadow" version "6.0.0"
|
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group "me.clip"
|
group "me.clip"
|
||||||
version "2.10.9"
|
version "2.10.10-DEV-${System.getProperty("BUILD_NUMBER")}"
|
||||||
|
|
||||||
description "An awesome placeholder provider!"
|
description "An awesome placeholder provider!"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
maven({ url = "https://oss.sonatype.org/content/repositories/snapshots/" })
|
||||||
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
|
||||||
maven({ url = "https://repo.codemc.org/repository/maven-public" })
|
maven({ url = "https://repo.codemc.org/repository/maven-public" })
|
||||||
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
|
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "com.google.code.gson:gson:2.8.6"
|
implementation "org.bstats:bstats-bukkit:2.2.1"
|
||||||
implementation "org.bstats:bstats-bukkit:1.5"
|
|
||||||
|
|
||||||
compileOnly "org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT"
|
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"
|
||||||
|
|
||||||
|
compileOnly "org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT"
|
||||||
compileOnly "org.jetbrains:annotations:19.0.0"
|
compileOnly "org.jetbrains:annotations:19.0.0"
|
||||||
|
|
||||||
testImplementation "org.openjdk.jmh:jmh-core:1.23"
|
testImplementation "org.openjdk.jmh:jmh-core:1.23"
|
||||||
testImplementation "org.openjdk.jmh:jmh-generator-annprocess:1.23"
|
testImplementation "org.openjdk.jmh:jmh-generator-annprocess:1.23"
|
||||||
|
|
||||||
testCompile "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
||||||
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
filter ReplaceTokens, tokens: [name: rootProject.name, version: project.version.toString(), description: project.description]
|
||||||
filter org.apache.tools.ant.filters.ReplaceTokens, tokens: [name: rootProject.name, version: project.version.toString(), description: project.description]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
tasks.withType(Javadoc) {
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
failOnError false
|
||||||
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
options.addStringOption('encoding', 'UTF-8')
|
||||||
|
options.addStringOption('charSet', 'UTF-8')
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveClassifier.set("")
|
archiveClassifier.set("")
|
||||||
|
|
||||||
relocate "org.bstats", "me.clip.placeholderapi.metrics"
|
relocate "org.bstats", "me.clip.placeholderapi.metrics"
|
||||||
relocate "com.google.gson", "me.clip.placeholderapi.libs.gson"
|
relocate "net.kyori", "me.clip.placeholderapi.libs.kyori"
|
||||||
}
|
}
|
||||||
|
|
||||||
license {
|
license {
|
||||||
@@ -58,12 +74,8 @@ license {
|
|||||||
header = file('config/headers/main.txt')
|
header = file('config/headers/main.txt')
|
||||||
}
|
}
|
||||||
|
|
||||||
matching('**/JSONMessage.java') {
|
|
||||||
header = file('config/headers/jsonmessage.txt')
|
|
||||||
}
|
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
year = 2020
|
year = 2021
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,15 +83,16 @@ test {
|
|||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
configurations {
|
||||||
test.compileClasspath += configurations.compileOnly
|
testImplementation {
|
||||||
test.runtimeClasspath += configurations.compileOnly
|
extendsFrom(compileOnly)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
if (version.contains("-DEV-")) {
|
if (version.contains("-DEV")) {
|
||||||
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
|
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
|
||||||
} else {
|
} else {
|
||||||
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||||
@@ -100,6 +113,8 @@ publishing {
|
|||||||
|
|
||||||
pom.withXml {
|
pom.withXml {
|
||||||
|
|
||||||
|
// some are having issues with bstats so we might need to add that to the pom as well
|
||||||
|
|
||||||
asNode().appendNode("packaging", "jar")
|
asNode().appendNode("packaging", "jar")
|
||||||
asNode().remove(asNode().get("dependencies"))
|
asNode().remove(asNode().get("dependencies"))
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2018-2020 Peter Blood
|
Copyright (c) 2018-2021 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:
|
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:
|
||||||
|
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
|||||||
#Tue Jul 14 23:27:02 AWST 2020
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
21
gradlew.bat
vendored
21
gradlew.bat
vendored
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
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_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
@@ -64,21 +64,6 @@ echo location of your Java installation.
|
|||||||
|
|
||||||
goto fail
|
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
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
@@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -29,6 +29,7 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.expansion.Relational;
|
import me.clip.placeholderapi.expansion.Relational;
|
||||||
|
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||||
import me.clip.placeholderapi.replacer.CharsReplacer;
|
import me.clip.placeholderapi.replacer.CharsReplacer;
|
||||||
import me.clip.placeholderapi.replacer.Replacer;
|
import me.clip.placeholderapi.replacer.Replacer;
|
||||||
import me.clip.placeholderapi.replacer.Replacer.Closure;
|
import me.clip.placeholderapi.replacer.Replacer.Closure;
|
||||||
@@ -140,17 +141,33 @@ public final class PlaceholderAPI {
|
|||||||
.collect(Collectors.toList());
|
.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) {
|
public static String setBracketPlaceholders(Player player, String text) {
|
||||||
return setBracketPlaceholders((OfflinePlayer) player, 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) {
|
public static List<String> setBracketPlaceholders(Player player, List<String> text) {
|
||||||
return setPlaceholders((OfflinePlayer) player, text);
|
return setBracketPlaceholders((OfflinePlayer) player, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set relational placeholders in the text specified placeholders are matched with the pattern
|
* set relational placeholders in the text specified placeholders are matched with the pattern
|
||||||
* %<rel_(identifier)_(params)>% when set with this method
|
* {@literal %<rel_(identifier)_(params)>%} when set with this method
|
||||||
*
|
*
|
||||||
* @param one First player to compare
|
* @param one First player to compare
|
||||||
* @param two Second player to compare
|
* @param two Second player to compare
|
||||||
@@ -215,7 +232,7 @@ public final class PlaceholderAPI {
|
|||||||
/**
|
/**
|
||||||
* Get all registered placeholder identifiers
|
* Get all registered placeholder identifiers
|
||||||
*
|
*
|
||||||
* @return All registered placeholder identifiers
|
* @return A Set of type String containing the identifiers of all registered expansions.
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static Set<String> getRegisteredIdentifiers() {
|
public static Set<String> getRegisteredIdentifiers() {
|
||||||
@@ -225,6 +242,8 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the normal placeholder pattern.
|
* Get the normal placeholder pattern.
|
||||||
|
*
|
||||||
|
* @return Regex Pattern of {@literal [%]([^%]+)[%]}
|
||||||
*/
|
*/
|
||||||
public static Pattern getPlaceholderPattern() {
|
public static Pattern getPlaceholderPattern() {
|
||||||
return PLACEHOLDER_PATTERN;
|
return PLACEHOLDER_PATTERN;
|
||||||
@@ -232,6 +251,8 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the bracket placeholder pattern.
|
* Get the bracket placeholder pattern.
|
||||||
|
*
|
||||||
|
* @return Regex Pattern of {@literal [{]([^{}]+)[}]}
|
||||||
*/
|
*/
|
||||||
public static Pattern getBracketPlaceholderPattern() {
|
public static Pattern getBracketPlaceholderPattern() {
|
||||||
return BRACKET_PLACEHOLDER_PATTERN;
|
return BRACKET_PLACEHOLDER_PATTERN;
|
||||||
@@ -239,6 +260,8 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the relational placeholder pattern.
|
* Get the relational placeholder pattern.
|
||||||
|
*
|
||||||
|
* @return Regex Pattern of {@literal [%](rel_)([^%]+)[%]}
|
||||||
*/
|
*/
|
||||||
public static Pattern getRelationalPlaceholderPattern() {
|
public static Pattern getRelationalPlaceholderPattern() {
|
||||||
return RELATIONAL_PLACEHOLDER_PATTERN;
|
return RELATIONAL_PLACEHOLDER_PATTERN;
|
||||||
@@ -268,12 +291,26 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
// === Deprecated API ===
|
// === Deprecated API ===
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
|
public static boolean registerExpansion(PlaceholderExpansion expansion)
|
||||||
|
{
|
||||||
|
return expansion.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
|
public static boolean unregisterExpansion(PlaceholderExpansion expansion)
|
||||||
|
{
|
||||||
|
return expansion.unregister();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get map of registered placeholders
|
* Get map of registered placeholders
|
||||||
*
|
*
|
||||||
|
* @deprecated Use {@link LocalExpansionManager#getExpansions()} instead.
|
||||||
|
*
|
||||||
* @return Map of registered placeholders
|
* @return Map of registered placeholders
|
||||||
* @deprecated Use {@link me.clip.placeholderapi.PlaceholderAPIPlugin().getLocalExpansionManager()
|
|
||||||
* .getExpansions()} instead.
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -284,8 +321,12 @@ public final class PlaceholderAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
|
* @deprecated Please use {@link PlaceholderExpansion} to
|
||||||
* register placeholders instead
|
* register placeholders instead
|
||||||
|
*
|
||||||
|
* @param plugin The Plugin to register with this {@link PlaceholderHook}
|
||||||
|
* @param placeholderHook The {@link PlaceholderHook} to register
|
||||||
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -298,8 +339,12 @@ public final class PlaceholderAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
|
* @deprecated Please use {@link PlaceholderExpansion} to
|
||||||
* register placeholders instead
|
* register placeholders instead
|
||||||
|
*
|
||||||
|
* @param identifier The identifier to use for the {@link PlaceholderHook}
|
||||||
|
* @param placeholderHook The {@link PlaceholderHook} to register
|
||||||
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -311,8 +356,11 @@ public final class PlaceholderAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
|
* @deprecated Please use {@link PlaceholderExpansion} to
|
||||||
* unregister placeholders instead
|
* unregister placeholders instead
|
||||||
|
*
|
||||||
|
* @param plugin The plugin to unregister
|
||||||
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -325,8 +373,11 @@ public final class PlaceholderAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link me.clip.placeholderapi.expansion.PlaceholderExpansion} to
|
* @deprecated Please use {@link PlaceholderExpansion} to
|
||||||
* unregister placeholders instead
|
* unregister placeholders instead
|
||||||
|
*
|
||||||
|
* @param identifier The identifier to unregister
|
||||||
|
* @return always false
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -338,6 +389,8 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Will be removed in a future release.
|
* @deprecated Will be removed in a future release.
|
||||||
|
*
|
||||||
|
* @return Set of registered identifiers
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -347,6 +400,8 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Will be removed in a future release.
|
* @deprecated Will be removed in a future release.
|
||||||
|
*
|
||||||
|
* @return always null
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -356,6 +411,12 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link #setPlaceholders(OfflinePlayer, String)} instead
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -366,6 +427,12 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link #setPlaceholders(OfflinePlayer, List)} instead
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -376,6 +443,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, List)} instead.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -386,6 +458,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, List)} instead.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -395,6 +472,11 @@ public final class PlaceholderAPI {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated Will be removed in a future release.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -404,6 +486,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Will be removed in a future release.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -413,6 +500,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -422,6 +514,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -431,6 +528,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, List)} instead.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -441,6 +543,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -450,6 +557,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Will be removed in a future release.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -459,6 +571,11 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Will be removed in a future release.
|
* @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
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -469,12 +586,12 @@ public final class PlaceholderAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* set relational placeholders in the text specified placeholders are matched with the pattern
|
* set relational placeholders in the text specified placeholders are matched with the pattern
|
||||||
* %<rel_(identifier)_(params)>% when set with this method
|
* {@literal %<rel_(identifier)_(params)>%} when set with this method
|
||||||
*
|
*
|
||||||
* @param one Player to compare
|
* @param one Player to compare
|
||||||
* @param two Player to compare
|
* @param two Player to compare
|
||||||
* @param text Text to parse the placeholders in
|
* @param text Text to parse the placeholders in
|
||||||
* @param colorize If color codes (&[0-1a-fk-o]) should be translated
|
* @param colorize If color codes ({@literal &[0-1a-fk-o]}) should be translated
|
||||||
* @return The text containing the parsed relational placeholders
|
* @return The text containing the parsed relational placeholders
|
||||||
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
|
||||||
*/
|
*/
|
||||||
@@ -492,9 +609,9 @@ public final class PlaceholderAPI {
|
|||||||
* @param one First player to compare
|
* @param one First player to compare
|
||||||
* @param two Second player to compare
|
* @param two Second player to compare
|
||||||
* @param text Text to parse the placeholders in
|
* @param text Text to parse the placeholders in
|
||||||
* @param colorize If color codes (&[0-1a-fk-o]) should be translated
|
* @param colorize If color codes ({@literal &[0-1a-fk-o]}) should be translated
|
||||||
* @return The text containing the parsed relational placeholders
|
* @return The text containing the parsed relational placeholders
|
||||||
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List<String>)} instead.
|
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List)} instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -32,7 +32,11 @@ import me.clip.placeholderapi.expansion.manager.CloudExpansionManager;
|
|||||||
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||||
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
|
||||||
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
import me.clip.placeholderapi.updatechecker.UpdateChecker;
|
||||||
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
|
import net.kyori.adventure.text.serializer.craftbukkit.MinecraftComponentSerializer;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
|
import org.bstats.charts.AdvancedPie;
|
||||||
|
import org.bstats.charts.SimplePie;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
@@ -73,6 +77,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final CloudExpansionManager cloudExpansionManager = new CloudExpansionManager(this);
|
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
|
* 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
|
* class, this is the main class that extends JavaPlugin. For most API methods, use static methods
|
||||||
@@ -138,6 +144,8 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
setupMetrics();
|
setupMetrics();
|
||||||
setupExpansions();
|
setupExpansions();
|
||||||
|
|
||||||
|
adventure = BukkitAudiences.create(this);
|
||||||
|
|
||||||
if (config.isCloudEnabled()) {
|
if (config.isCloudEnabled()) {
|
||||||
getCloudExpansionManager().load();
|
getCloudExpansionManager().load();
|
||||||
}
|
}
|
||||||
@@ -156,6 +164,9 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
|
|
||||||
|
adventure.close();
|
||||||
|
adventure = null;
|
||||||
|
|
||||||
instance = null;
|
instance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +194,15 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
return cloudExpansionManager;
|
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.
|
* Obtain the configuration class for PlaceholderAPI.
|
||||||
*
|
*
|
||||||
@@ -205,14 +225,13 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupMetrics() {
|
private void setupMetrics() {
|
||||||
final Metrics metrics = new Metrics(this);
|
final Metrics metrics = new Metrics(this, 438);
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("using_expansion_cloud",
|
metrics.addCustomChart(new SimplePie("using_expansion_cloud",
|
||||||
() -> getPlaceholderAPIConfig().isCloudEnabled() ? "yes" : "no"));
|
() -> getPlaceholderAPIConfig().isCloudEnabled() ? "yes" : "no"));
|
||||||
|
|
||||||
metrics.addCustomChart(
|
metrics.addCustomChart(new SimplePie("using_spigot", () -> getServerVersion().isSpigot() ? "yes" : "no"));
|
||||||
new Metrics.SimplePie("using_spigot", () -> getServerVersion().isSpigot() ? "yes" : "no"));
|
|
||||||
|
|
||||||
metrics.addCustomChart(new Metrics.AdvancedPie("expansions_used", () -> {
|
metrics.addCustomChart(new AdvancedPie("expansions_used", () -> {
|
||||||
final Map<String, Integer> values = new HashMap<>();
|
final Map<String, Integer> values = new HashMap<>();
|
||||||
|
|
||||||
for (final PlaceholderExpansion expansion : getLocalExpansionManager().getExpansions()) {
|
for (final PlaceholderExpansion expansion : getLocalExpansionManager().getExpansions()) {
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -26,14 +26,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
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.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -43,15 +36,22 @@ import me.clip.placeholderapi.commands.PlaceholderCommand;
|
|||||||
import me.clip.placeholderapi.configuration.ExpansionSort;
|
import me.clip.placeholderapi.configuration.ExpansionSort;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
import me.clip.placeholderapi.libs.JSONMessage;
|
|
||||||
import me.clip.placeholderapi.util.Format;
|
import me.clip.placeholderapi.util.Format;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import org.bukkit.ChatColor;
|
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.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
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 {
|
public final class CommandECloudExpansionList extends PlaceholderCommand {
|
||||||
|
|
||||||
private static final int PAGE_SIZE = 10;
|
private static final int PAGE_SIZE = 10;
|
||||||
@@ -132,77 +132,81 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
|||||||
|
|
||||||
builder.append(" &bPage&7: &a")
|
builder.append(" &bPage&7: &a")
|
||||||
.append(page)
|
.append(page)
|
||||||
.append("&r")
|
.append("&r");
|
||||||
.append('\n');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
private static Component getMessage(@NotNull final List<CloudExpansion> expansions,
|
||||||
private static JSONMessage getMessage(@NotNull final List<CloudExpansion> expansions,
|
|
||||||
final int page, final int limit, @NotNull final String target) {
|
final int page, final int limit, @NotNull final String target) {
|
||||||
final SimpleDateFormat format = PlaceholderAPIPlugin.getDateFormat();
|
final SimpleDateFormat format = PlaceholderAPIPlugin.getDateFormat();
|
||||||
|
|
||||||
final StringBuilder tooltip = new StringBuilder();
|
final TextComponent.Builder message = text();
|
||||||
final JSONMessage message = JSONMessage.create();
|
|
||||||
|
|
||||||
for (int index = 0; index < expansions.size(); index++) {
|
for (int index = 0; index < expansions.size(); index++) {
|
||||||
final CloudExpansion expansion = expansions.get(index);
|
final CloudExpansion expansion = expansions.get(index);
|
||||||
|
final TextComponent.Builder line = text();
|
||||||
|
|
||||||
tooltip.append("&bClick to download this expansion!")
|
final int expansionNumber = index + ((page - 1) * PAGE_SIZE) + 1;
|
||||||
.append('\n')
|
line.append(text(expansionNumber + ". ", DARK_GRAY));
|
||||||
.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 String description = expansion.getDescription();
|
final NamedTextColor expansionColour;
|
||||||
if (description != null && !description.isEmpty()) {
|
|
||||||
tooltip.append('\n')
|
if (expansion.shouldUpdate()) {
|
||||||
.append('\n')
|
expansionColour = GOLD;
|
||||||
.append("&f")
|
} else {
|
||||||
.append(description.replace("\r", "").trim());
|
if (expansion.hasExpansion()) {
|
||||||
|
expansionColour = GREEN;
|
||||||
|
} else {
|
||||||
|
expansionColour = GRAY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message.then(Msg.color(
|
line.append(text(expansion.getName(), expansionColour));
|
||||||
"&8" + (index + ((page - 1) * PAGE_SIZE) + 1) + ".&r " + (expansion.shouldUpdate() ? "&6"
|
|
||||||
: expansion.hasExpansion() ? "&a" : "&7") + expansion.getName()));
|
|
||||||
|
|
||||||
message.tooltip(Msg.color(tooltip.toString()));
|
line.clickEvent(ClickEvent.suggestCommand("/papi ecloud download " + expansion.getName()));
|
||||||
message.suggestCommand("/papi ecloud download " + expansion.getName());
|
|
||||||
|
|
||||||
if (index < expansions.size() - 1) {
|
final TextComponent.Builder hoverText = text("Click to download this expansion!", AQUA)
|
||||||
message.newline();
|
.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());
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip.setLength(0);
|
message.append(line.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit > 1) {
|
if (limit > 1) {
|
||||||
message.newline();
|
message.append(newline());
|
||||||
|
|
||||||
|
final TextComponent.Builder left = text("â—€", page > 1 ? GRAY : DARK_GRAY).toBuilder();
|
||||||
|
|
||||||
message.then("â—€")
|
|
||||||
.color(page > 1 ? ChatColor.GRAY : ChatColor.DARK_GRAY);
|
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
message.runCommand("/papi ecloud list " + target + " " + (page - 1));
|
left.clickEvent(ClickEvent.runCommand("/papi ecloud list " + target + " " + (page - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
message.then(" " + page + " ").color(ChatColor.GREEN);
|
final TextComponent.Builder right = text("â–¶", page < limit ? GRAY : DARK_GRAY).toBuilder();
|
||||||
|
|
||||||
message.then("â–¶")
|
|
||||||
.color(page < limit ? ChatColor.GRAY : ChatColor.DARK_GRAY);
|
|
||||||
if (page < limit) {
|
if (page < limit) {
|
||||||
message.runCommand("/papi ecloud list " + target + " " + (page + 1));
|
right.clickEvent(ClickEvent.runCommand("/papi ecloud list " + target + " " + (page + 1)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
message.append(left, text(" " + page + " ", GREEN), right);
|
||||||
|
}
|
||||||
|
|
||||||
|
return message.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addExpansionTable(@NotNull final List<CloudExpansion> expansions,
|
private static void addExpansionTable(@NotNull final List<CloudExpansion> expansions,
|
||||||
@@ -321,8 +325,8 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
|||||||
|
|
||||||
final int limit = (int) Math.ceil((double) expansions.size() / PAGE_SIZE);
|
final int limit = (int) Math.ceil((double) expansions.size() / PAGE_SIZE);
|
||||||
|
|
||||||
final JSONMessage message = getMessage(values, page, limit, params.get(0));
|
final Component message = getMessage(values, page, limit, params.get(0));
|
||||||
message.send(((Player) sender));
|
plugin.getAdventure().player((Player) sender).sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -21,7 +21,17 @@
|
|||||||
package me.clip.placeholderapi.commands.impl.local;
|
package me.clip.placeholderapi.commands.impl.local;
|
||||||
|
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
import com.google.gson.JsonParser;
|
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 java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@@ -41,20 +51,15 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
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 {
|
public final class CommandDump extends PlaceholderCommand {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final String URL = "https://paste.helpch.at/";
|
private static final String URL = "https://paste.helpch.at/";
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static final Gson gson = new Gson();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter
|
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter
|
||||||
.ofLocalizedDateTime(FormatStyle.LONG)
|
.ofLocalizedDateTime(FormatStyle.LONG)
|
||||||
@@ -102,9 +107,8 @@ public final class CommandDump extends PlaceholderCommand {
|
|||||||
|
|
||||||
try (final InputStream stream = connection.getInputStream()) {
|
try (final InputStream stream = connection.getInputStream()) {
|
||||||
//noinspection UnstableApiUsage
|
//noinspection UnstableApiUsage
|
||||||
final String json = CharStreams
|
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||||
.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
|
||||||
return JsonParser.parseString(json).getAsJsonObject().get("key").getAsString();
|
|
||||||
}
|
}
|
||||||
} catch (final IOException ex) {
|
} catch (final IOException ex) {
|
||||||
throw new CompletionException(ex);
|
throw new CompletionException(ex);
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -47,7 +47,7 @@ public final class CommandInfo extends PlaceholderCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PlaceholderExpansion expansion = plugin.getLocalExpansionManager()
|
final PlaceholderExpansion expansion = plugin.getLocalExpansionManager()
|
||||||
.findExpansionByName(params.get(0)).orElse(null);
|
.findExpansionByIdentifier(params.get(0)).orElse(null);
|
||||||
if (expansion == null) {
|
if (expansion == null) {
|
||||||
Msg.msg(sender,
|
Msg.msg(sender,
|
||||||
"&cThere is no expansion loaded with the identifier: &f" + params.get(0));
|
"&cThere is no expansion loaded with the identifier: &f" + params.get(0));
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -211,13 +211,16 @@ public final class CommandParse extends PlaceholderCommand {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private OfflinePlayer resolvePlayer(@NotNull final String name) {
|
private OfflinePlayer resolvePlayer(@NotNull final String name) {
|
||||||
OfflinePlayer target = Bukkit.getPlayer(name);
|
OfflinePlayer target = Bukkit.getPlayerExact(name);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
target = Bukkit.getOfflinePlayer(name); // this is probably not a great idea.
|
// Not the best option, but Spigot doesn't offer a good replacement (as usual)
|
||||||
}
|
target = Bukkit.getOfflinePlayer(name);
|
||||||
|
|
||||||
return target.hasPlayedBefore() ? target : null;
|
return target.hasPlayedBefore() ? target : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return target;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -26,6 +26,10 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that a {@link PlaceholderExpansion} has been registered by
|
||||||
|
* PlaceholderAPI.
|
||||||
|
*/
|
||||||
public final class ExpansionRegisterEvent extends Event implements Cancellable {
|
public final class ExpansionRegisterEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -43,6 +47,11 @@ public final class ExpansionRegisterEvent extends Event implements Cancellable {
|
|||||||
return HANDLERS;
|
return HANDLERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link PlaceholderExpansion expansion} that was registered.
|
||||||
|
*
|
||||||
|
* @return The {@link PlaceholderExpansion} instance.
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public PlaceholderExpansion getExpansion() {
|
public PlaceholderExpansion getExpansion() {
|
||||||
return expansion;
|
return expansion;
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -25,6 +25,10 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that a {@link PlaceholderExpansion} had been unregistered by
|
||||||
|
* PlaceholderAPI.
|
||||||
|
*/
|
||||||
public final class ExpansionUnregisterEvent extends Event {
|
public final class ExpansionUnregisterEvent extends Event {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -43,6 +47,11 @@ public final class ExpansionUnregisterEvent extends Event {
|
|||||||
return HANDLERS;
|
return HANDLERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link PlaceholderExpansion expansion} that was unregistered.
|
||||||
|
*
|
||||||
|
* @return The {@link PlaceholderExpansion} instance.
|
||||||
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public PlaceholderExpansion getExpansion() {
|
public PlaceholderExpansion getExpansion() {
|
||||||
return expansion;
|
return expansion;
|
||||||
|
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of PlaceholderAPI
|
||||||
|
*
|
||||||
|
* PlaceholderAPI
|
||||||
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
|
*
|
||||||
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PlaceholderAPI is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.clip.placeholderapi.events;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that <b>all</b> {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlayceholderExpansions}
|
||||||
|
* have been loaded.
|
||||||
|
* <br/>This event is fired on Server load and when reloading the
|
||||||
|
* confiuration.
|
||||||
|
*/
|
||||||
|
public class ExpansionsLoadedEvent extends Event {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static final HandlerList HANDLERS = new HandlerList();
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return HANDLERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return HANDLERS;
|
||||||
|
}
|
||||||
|
}
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -24,7 +24,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Any {@link PlaceholderExpansion} class which implements configurable will have any options listed
|
* Any {@link PlaceholderExpansion} class which implements configurable will have any options listed
|
||||||
* in the getDefaults map automatically added to the PlaceholderAPI config.yml file
|
* in the {@link #getDefaults()} map automatically added to the PlaceholderAPI config.yml file
|
||||||
*
|
*
|
||||||
* @author Ryan McCarthy
|
* @author Ryan McCarthy
|
||||||
*/
|
*/
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -39,7 +39,10 @@ public enum NMSVersion {
|
|||||||
SPIGOT_1_13_R2("v1_13_R2"),
|
SPIGOT_1_13_R2("v1_13_R2"),
|
||||||
SPIGOT_1_14_R1("v1_14_R1"),
|
SPIGOT_1_14_R1("v1_14_R1"),
|
||||||
SPIGOT_1_15_R1("v1_15_R1"),
|
SPIGOT_1_15_R1("v1_15_R1"),
|
||||||
SPIGOT_1_16_R1("v1_16_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");
|
||||||
|
|
||||||
private final String version;
|
private final String version;
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,7 +22,6 @@ package me.clip.placeholderapi.expansion;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.PlaceholderHook;
|
import me.clip.placeholderapi.PlaceholderHook;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -32,10 +31,17 @@ import org.jetbrains.annotations.Contract;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
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 {
|
public abstract class PlaceholderExpansion extends PlaceholderHook {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The placeholder identifier of this expansion
|
* The placeholder identifier of this expansion. May not contain {@literal %},
|
||||||
|
* {@literal {}} or _
|
||||||
*
|
*
|
||||||
* @return placeholder identifier that is associated with this expansion
|
* @return placeholder identifier that is associated with this expansion
|
||||||
*/
|
*/
|
||||||
@@ -154,17 +160,39 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
|
|
||||||
// === Configuration ===
|
// === 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 epxpansion has.
|
||||||
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public final ConfigurationSection getConfigSection() {
|
public final ConfigurationSection getConfigSection() {
|
||||||
return getPlaceholderAPI().getConfig().getConfigurationSection("expansions." + getIdentifier());
|
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
|
@Nullable
|
||||||
public final ConfigurationSection getConfigSection(@NotNull final String path) {
|
public final ConfigurationSection getConfigSection(@NotNull final String path) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section == null ? null : section.getConfigurationSection(path);
|
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
|
@Nullable
|
||||||
@Contract("_, !null -> !null")
|
@Contract("_, !null -> !null")
|
||||||
public final Object get(@NotNull final String path, final Object def) {
|
public final Object get(@NotNull final String path, final Object def) {
|
||||||
@@ -172,21 +200,53 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
return section == null ? def : section.get(path, def);
|
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) {
|
public final int getInt(@NotNull final String path, final int def) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section == null ? def : section.getInt(path, def);
|
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) {
|
public final long getLong(@NotNull final String path, final long def) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section == null ? def : section.getLong(path, def);
|
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) {
|
public final double getDouble(@NotNull final String path, final double def) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section == null ? def : section.getDouble(path, def);
|
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
|
@Nullable
|
||||||
@Contract("_, !null -> !null")
|
@Contract("_, !null -> !null")
|
||||||
public final String getString(@NotNull final String path, @Nullable final String def) {
|
public final String getString(@NotNull final String path, @Nullable final String def) {
|
||||||
@@ -194,17 +254,58 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
return section == null ? def : section.getString(path, def);
|
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
|
@NotNull
|
||||||
public final List<String> getStringList(@NotNull final String path) {
|
public final List<String> getStringList(@NotNull final String path) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section == null ? Collections.emptyList() : section.getStringList(path);
|
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
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
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) {
|
public final boolean configurationContains(@NotNull final String path) {
|
||||||
final ConfigurationSection section = getConfigSection();
|
final ConfigurationSection section = getConfigSection();
|
||||||
return section != null && section.contains(path);
|
return section != null && section.contains(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public final boolean equals(final Object o) {
|
public final boolean equals(final Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
@@ -221,11 +322,11 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
getVersion().equals(expansion.getVersion());
|
getVersion().equals(expansion.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public final int hashCode() {
|
* Returns a String containing the Expansion's name, author and version
|
||||||
return Objects.hash(getIdentifier(), getAuthor(), getVersion());
|
*
|
||||||
}
|
* @return String containing name, author and version of the expansion
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
return String.format("PlaceholderExpansion[name: '%s', author: '%s', version: '%s']", getName(),
|
return String.format("PlaceholderExpansion[name: '%s', author: '%s', version: '%s']", getName(),
|
||||||
@@ -236,6 +337,8 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated As of versions greater than 2.8.7, use {@link #getRequiredPlugin()}
|
* @deprecated As of versions greater than 2.8.7, use {@link #getRequiredPlugin()}
|
||||||
|
*
|
||||||
|
* @return The plugin name.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -245,6 +348,8 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated As of versions greater than 2.8.7, use the expansion cloud to show a description
|
* @deprecated As of versions greater than 2.8.7, use the expansion cloud to show a description
|
||||||
|
*
|
||||||
|
* @return The description of the expansion.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
@@ -254,11 +359,12 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated As of versions greater than 2.8.7, use the expansion cloud to display a link
|
* @deprecated As of versions greater than 2.8.7, use the expansion cloud to display a link
|
||||||
|
*
|
||||||
|
* @return The link for the expansion.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
|
||||||
public String getLink() {
|
public String getLink() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -34,6 +34,8 @@ public interface VersionSpecific {
|
|||||||
* This method is called before the expansion is attempted to be registered The server version
|
* 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.
|
* 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.
|
* @return true if your expansion is compatible with the version the server is running.
|
||||||
*/
|
*/
|
||||||
boolean isCompatibleWith(Version v);
|
boolean isCompatibleWith(Version v);
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,6 +22,7 @@ package me.clip.placeholderapi.expansion.manager;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -32,14 +33,18 @@ import java.net.URL;
|
|||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collector;
|
import java.util.stream.Collector;
|
||||||
@@ -73,6 +78,9 @@ public final class CloudExpansionManager {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final Map<String, CompletableFuture<File>> await = new ConcurrentHashMap<>();
|
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) {
|
public CloudExpansionManager(@NotNull final PlaceholderAPIPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@@ -163,57 +171,70 @@ public final class CloudExpansionManager {
|
|||||||
public void fetch(final boolean allowUnverified) {
|
public void fetch(final boolean allowUnverified) {
|
||||||
plugin.getLogger().info("Fetching available expansion information...");
|
plugin.getLogger().info("Fetching available expansion information...");
|
||||||
|
|
||||||
CompletableFuture<Map<String, CloudExpansion>> future = CompletableFuture.supplyAsync(() -> {
|
ASYNC_EXECUTOR.submit(
|
||||||
final Map<String, CloudExpansion> values = new HashMap<>();
|
() -> {
|
||||||
|
// a defence tactic! use ConcurrentHashMap instead of normal HashMap
|
||||||
|
Map<String, CloudExpansion> values = new ConcurrentHashMap<>();
|
||||||
try {
|
try {
|
||||||
//noinspection UnstableApiUsage
|
//noinspection UnstableApiUsage
|
||||||
final String json = Resources.toString(new URL(API_URL), StandardCharsets.UTF_8);
|
String json = Resources.toString(new URL(API_URL), StandardCharsets.UTF_8);
|
||||||
values.putAll(GSON.fromJson(json, TYPE));
|
values.putAll(GSON.fromJson(json, TYPE));
|
||||||
} catch (final IOException ex) {
|
|
||||||
throw new CompletionException(ex);
|
List<String> toRemove = new ArrayList<>();
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
if (!allowUnverified && !expansion.isVerified()) {
|
||||||
|
toRemove.add(entry.getKey());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
values.values().removeIf(value -> value.getLatestVersion() == null
|
for (String name : toRemove) {
|
||||||
|| value.getVersion(value.getLatestVersion()) == null);
|
values.remove(name);
|
||||||
|
}
|
||||||
return values;
|
} 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);
|
||||||
if (!allowUnverified) {
|
|
||||||
future = future.thenApplyAsync((values) -> {
|
|
||||||
values.values().removeIf(expansion -> !expansion.isVerified());
|
|
||||||
return values;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
future = future.thenApplyAsync((values) -> {
|
// loop thru 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();
|
||||||
|
|
||||||
values.forEach((name, expansion) -> {
|
|
||||||
expansion.setName(name);
|
expansion.setName(name);
|
||||||
|
|
||||||
final Optional<PlaceholderExpansion> local = plugin.getLocalExpansionManager()
|
Optional<PlaceholderExpansion> localOpt =
|
||||||
.findExpansionByName(name);
|
plugin.getLocalExpansionManager().findExpansionByName(name);
|
||||||
if (local.isPresent() && local.get().isRegistered()) {
|
if (localOpt.isPresent()) {
|
||||||
|
PlaceholderExpansion local = localOpt.get();
|
||||||
|
if (local.isRegistered()) {
|
||||||
expansion.setHasExpansion(true);
|
expansion.setHasExpansion(true);
|
||||||
expansion.setShouldUpdate(!local.get().getVersion().equals(expansion.getLatestVersion()));
|
expansion.setShouldUpdate(
|
||||||
|
!local.getVersion().equalsIgnoreCase(expansion.getLatestVersion()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +261,7 @@ public final class CloudExpansionManager {
|
|||||||
throw new CompletionException(ex);
|
throw new CompletionException(ex);
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
});
|
}, ASYNC_EXECUTOR);
|
||||||
|
|
||||||
download.whenCompleteAsync((value, exception) -> {
|
download.whenCompleteAsync((value, exception) -> {
|
||||||
await.remove(toIndexName(expansion));
|
await.remove(toIndexName(expansion));
|
||||||
@@ -249,7 +270,7 @@ public final class CloudExpansionManager {
|
|||||||
plugin.getLogger().log(Level.SEVERE,
|
plugin.getLogger().log(Level.SEVERE,
|
||||||
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
|
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
|
||||||
}
|
}
|
||||||
});
|
}, ASYNC_EXECUTOR);
|
||||||
|
|
||||||
await.put(toIndexName(expansion), download);
|
await.put(toIndexName(expansion), download);
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -20,28 +20,13 @@
|
|||||||
|
|
||||||
package me.clip.placeholderapi.expansion.manager;
|
package me.clip.placeholderapi.expansion.manager;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import java.io.File;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.CompletionException;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
|
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
|
||||||
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
||||||
import me.clip.placeholderapi.expansion.Cacheable;
|
import me.clip.placeholderapi.events.ExpansionsLoadedEvent;
|
||||||
import me.clip.placeholderapi.expansion.Cleanable;
|
import me.clip.placeholderapi.expansion.*;
|
||||||
import me.clip.placeholderapi.expansion.Configurable;
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
|
||||||
import me.clip.placeholderapi.expansion.Taskable;
|
|
||||||
import me.clip.placeholderapi.expansion.VersionSpecific;
|
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
import me.clip.placeholderapi.util.FileUtil;
|
import me.clip.placeholderapi.util.FileUtil;
|
||||||
import me.clip.placeholderapi.util.Futures;
|
import me.clip.placeholderapi.util.Futures;
|
||||||
@@ -60,11 +45,26 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.CompletionException;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public final class LocalExpansionManager implements Listener {
|
public final class LocalExpansionManager implements Listener {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final String EXPANSIONS_FOLDER_NAME = "expansions";
|
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
|
@NotNull
|
||||||
private final File folder;
|
private final File folder;
|
||||||
@@ -72,7 +72,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
private final PlaceholderAPIPlugin plugin;
|
private final PlaceholderAPIPlugin plugin;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Map<String, PlaceholderExpansion> expansions = new HashMap<>();
|
private final Map<String, PlaceholderExpansion> expansions = new ConcurrentHashMap<>();
|
||||||
|
private final ReentrantLock expansionsLock = new ReentrantLock();
|
||||||
|
|
||||||
|
|
||||||
public LocalExpansionManager(@NotNull final PlaceholderAPIPlugin plugin) {
|
public LocalExpansionManager(@NotNull final PlaceholderAPIPlugin plugin) {
|
||||||
@@ -98,31 +99,54 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getExpansionsCount() {
|
|
||||||
return expansions.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Unmodifiable
|
@Unmodifiable
|
||||||
public Collection<String> getIdentifiers() {
|
public Collection<String> getIdentifiers() {
|
||||||
|
expansionsLock.lock();
|
||||||
|
try {
|
||||||
return ImmutableSet.copyOf(expansions.keySet());
|
return ImmutableSet.copyOf(expansions.keySet());
|
||||||
|
} finally {
|
||||||
|
expansionsLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Unmodifiable
|
@Unmodifiable
|
||||||
public Collection<PlaceholderExpansion> getExpansions() {
|
public Collection<PlaceholderExpansion> getExpansions() {
|
||||||
|
expansionsLock.lock();
|
||||||
|
try {
|
||||||
return ImmutableSet.copyOf(expansions.values());
|
return ImmutableSet.copyOf(expansions.values());
|
||||||
|
} finally {
|
||||||
|
expansionsLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
|
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
|
||||||
return ImmutableMap.copyOf(expansions).get(identifier.toLowerCase());
|
expansionsLock.lock();
|
||||||
|
try {
|
||||||
|
return expansions.get(identifier.toLowerCase());
|
||||||
|
} finally {
|
||||||
|
expansionsLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public Optional<PlaceholderExpansion> findExpansionByName(@NotNull final String name) {
|
public Optional<PlaceholderExpansion> findExpansionByName(@NotNull final String name) {
|
||||||
return getExpansions().stream().filter(expansion -> name.equalsIgnoreCase(expansion.getName())).findFirst();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -136,23 +160,33 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
@NotNull final Class<? extends PlaceholderExpansion> clazz) {
|
@NotNull final Class<? extends PlaceholderExpansion> clazz) {
|
||||||
try {
|
try {
|
||||||
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
|
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
|
||||||
if (expansion == null || !expansion.register()) {
|
|
||||||
|
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.register()) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.of(expansion);
|
return Optional.of(expansion);
|
||||||
} catch (final LinkageError ex) {
|
} catch (LinkageError | NullPointerException ex) {
|
||||||
plugin.getLogger().severe("expansion class " + clazz.getSimpleName() + " is outdated: \n" +
|
final String reason;
|
||||||
"Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use " + ex
|
|
||||||
.getMessage());
|
if (ex instanceof LinkageError) {
|
||||||
|
reason = " (Is a dependency missing?)";
|
||||||
|
} else {
|
||||||
|
reason = " - One of its properties is null which is not allowed!";
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.getLogger().severe("Failed to load expansion class " + clazz.getSimpleName() +
|
||||||
|
reason);
|
||||||
|
plugin.getLogger().log(Level.SEVERE, "", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Do not call this method yourself, use {@link PlaceholderExpansion#register()}
|
|
||||||
*/
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public boolean register(@NotNull final PlaceholderExpansion expansion) {
|
public boolean register(@NotNull final PlaceholderExpansion expansion) {
|
||||||
final String identifier = expansion.getIdentifier().toLowerCase();
|
final String identifier = expansion.getIdentifier().toLowerCase();
|
||||||
@@ -196,14 +230,13 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
if (expansion instanceof VersionSpecific) {
|
if (expansion instanceof VersionSpecific) {
|
||||||
VersionSpecific nms = (VersionSpecific) expansion;
|
VersionSpecific nms = (VersionSpecific) expansion;
|
||||||
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
|
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
|
||||||
plugin.getLogger().info(
|
plugin.getLogger().warning("Your server version is not compatible with expansion " +
|
||||||
"Your server version is not compatible with expansion: " + expansion.getIdentifier()
|
expansion.getIdentifier() + " " + expansion.getVersion());
|
||||||
+ " version: " + expansion.getVersion());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlaceholderExpansion removed = expansions.get(identifier);
|
final PlaceholderExpansion removed = getExpansion(identifier);
|
||||||
if (removed != null && !removed.unregister()) {
|
if (removed != null && !removed.unregister()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -215,7 +248,12 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expansionsLock.lock();
|
||||||
|
try {
|
||||||
expansions.put(identifier, expansion);
|
expansions.put(identifier, expansion);
|
||||||
|
} finally {
|
||||||
|
expansionsLock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
if (expansion instanceof Listener) {
|
if (expansion instanceof Listener) {
|
||||||
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
|
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
|
||||||
@@ -228,21 +266,19 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
|
if (plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
|
||||||
final Optional<CloudExpansion> cloudExpansion = plugin.getCloudExpansionManager()
|
final Optional<CloudExpansion> cloudExpansionOptional =
|
||||||
.findCloudExpansionByName(identifier);
|
plugin.getCloudExpansionManager().findCloudExpansionByName(identifier);
|
||||||
if (cloudExpansion.isPresent()) {
|
if (cloudExpansionOptional.isPresent()) {
|
||||||
cloudExpansion.get().setHasExpansion(true);
|
CloudExpansion cloudExpansion = cloudExpansionOptional.get();
|
||||||
cloudExpansion.get().setShouldUpdate(
|
cloudExpansion.setHasExpansion(true);
|
||||||
!cloudExpansion.get().getLatestVersion().equals(expansion.getVersion()));
|
cloudExpansion.setShouldUpdate(
|
||||||
|
!cloudExpansion.getLatestVersion().equals(expansion.getVersion()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Do not call this method yourself, use {@link PlaceholderExpansion#unregister()}
|
|
||||||
*/
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
|
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
|
||||||
if (expansions.remove(expansion.getIdentifier()) == null) {
|
if (expansions.remove(expansion.getIdentifier()) == null) {
|
||||||
@@ -284,12 +320,17 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long registered = classes.stream().map(this::register).filter(Optional::isPresent)
|
final long registered = classes.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(this::register)
|
||||||
|
.filter(Optional::isPresent)
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
Msg.msg(sender,
|
Msg.msg(sender,
|
||||||
registered == 0 ? "&6No expansions were registered!"
|
registered == 0 ? "&6No expansions were registered!"
|
||||||
: registered + "&a placeholder hooks successfully registered!");
|
: registered + "&a placeholder hooks successfully registered!");
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,9 +344,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public CompletableFuture<@NotNull List<@NotNull Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
||||||
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
|
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
|
||||||
.map(this::findExpansionInFile)
|
.map(this::findExpansionInFile)
|
||||||
.collect(Futures.collector());
|
.collect(Futures.collector());
|
||||||
@@ -316,11 +356,28 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
@NotNull final File file) {
|
@NotNull final File file) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
try {
|
try {
|
||||||
return FileUtil.findClass(file, PlaceholderExpansion.class);
|
final Class<? extends PlaceholderExpansion> expansionClass = FileUtil.findClass(file, PlaceholderExpansion.class);
|
||||||
|
|
||||||
|
if (expansionClass == null) {
|
||||||
|
plugin.getLogger().severe("Failed to load Expansion: " + file.getName() + ", as it does not have" +
|
||||||
|
" a class which extends PlaceholderExpansion.");
|
||||||
|
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)) {
|
||||||
|
plugin.getLogger().severe("Failed to load Expansion: " + file.getName() + ", as it does not have the" +
|
||||||
|
" required methods declared for a PlaceholderExpansion.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return expansionClass;
|
||||||
} catch (final VerifyError ex) {
|
} catch (final VerifyError ex) {
|
||||||
plugin.getLogger().severe("expansion file " + file.getName() + " is outdated: \n" +
|
plugin.getLogger().severe("Failed to load Expansion class " + file.getName() +
|
||||||
"Failed to load due to a [" + ex.getClass().getSimpleName() + "], attempted to use" + ex
|
" (Is a dependency missing?)");
|
||||||
.getMessage().substring(ex.getMessage().lastIndexOf(' ')));
|
plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage());
|
||||||
return null;
|
return null;
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
throw new CompletionException(ex);
|
throw new CompletionException(ex);
|
||||||
@@ -339,9 +396,8 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
throw ((LinkageError) ex.getCause());
|
throw ((LinkageError) ex.getCause());
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLogger()
|
plugin.getLogger().warning("There was an issue with loading an expansion.");
|
||||||
.log(Level.SEVERE, "Failed to load placeholder expansion from class: " + clazz.getName(),
|
|
||||||
ex);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,37 @@
|
|||||||
|
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
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -100,11 +100,13 @@ public final class CharsReplacer implements Replacer {
|
|||||||
|
|
||||||
boolean identified = false;
|
boolean identified = false;
|
||||||
boolean oopsitsbad = true;
|
boolean oopsitsbad = true;
|
||||||
|
boolean hadSpace = false;
|
||||||
|
|
||||||
while (++i < chars.length) {
|
while (++i < chars.length) {
|
||||||
final char p = chars[i];
|
final char p = chars[i];
|
||||||
|
|
||||||
if (p == ' ' && !identified) {
|
if (p == ' ' && !identified) {
|
||||||
|
hadSpace = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p == closure.tail) {
|
if (p == closure.tail) {
|
||||||
@@ -137,7 +139,9 @@ public final class CharsReplacer implements Replacer {
|
|||||||
builder.append('_').append(parametersString);
|
builder.append('_').append(parametersString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hadSpace) {
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -23,6 +23,7 @@ package me.clip.placeholderapi.updatechecker;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.util.Msg;
|
import me.clip.placeholderapi.util.Msg;
|
||||||
@@ -90,17 +91,24 @@ public class UpdateChecker implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String plV = toReadable(pluginVersion);
|
int[] plV = toReadable(pluginVersion);
|
||||||
String spV = toReadable(spigotVersion);
|
int[] spV = toReadable(spigotVersion);
|
||||||
return plV.compareTo(spV) < 0;
|
|
||||||
|
if (plV[0] < spV[0]) {
|
||||||
|
return true;
|
||||||
|
} else if ((plV[1] < spV[1])) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return plV[2] < spV[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toReadable(String version) {
|
private int[] toReadable(String version) {
|
||||||
if (version.contains("-DEV-")) {
|
if (version.contains("-DEV")) {
|
||||||
version = version.split("-DEV-")[0];
|
version = version.split("-DEV")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return version.replaceAll("\\.", "");
|
return Arrays.stream(version.split("\\.")).mapToInt(Integer::parseInt).toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -20,6 +20,9 @@
|
|||||||
|
|
||||||
package me.clip.placeholderapi.util;
|
package me.clip.placeholderapi.util;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -28,8 +31,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarInputStream;
|
import java.util.jar.JarInputStream;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class FileUtil {
|
public class FileUtil {
|
||||||
|
|
||||||
@@ -41,17 +42,15 @@ public class FileUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final URL jar = file.toURI().toURL();
|
final URL jar = file.toURI().toURL();
|
||||||
|
final URLClassLoader loader = new URLClassLoader(new URL[]{jar}, clazz.getClassLoader());
|
||||||
final List<String> matches = new ArrayList<>();
|
final List<String> matches = new ArrayList<>();
|
||||||
final List<Class<? extends T>> classes = new ArrayList<>();
|
final List<Class<? extends T>> classes = new ArrayList<>();
|
||||||
|
|
||||||
try (final JarInputStream stream = new JarInputStream(
|
try (final JarInputStream stream = new JarInputStream(jar.openStream())) {
|
||||||
jar.openStream()); final URLClassLoader loader = new URLClassLoader(new URL[]{jar},
|
|
||||||
clazz.getClassLoader())) {
|
|
||||||
JarEntry entry;
|
JarEntry entry;
|
||||||
while ((entry = stream.getNextJarEntry()) != null) {
|
while ((entry = stream.getNextJarEntry()) != null) {
|
||||||
final String name = entry.getName();
|
final String name = entry.getName();
|
||||||
if (name == null || name.isEmpty() || !name.endsWith(".class")) {
|
if (name.isEmpty() || !name.endsWith(".class")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +67,11 @@ public class FileUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (classes.isEmpty()) {
|
||||||
return classes.isEmpty() ? null : classes.get(0);
|
loader.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return classes.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
@@ -22,100 +22,31 @@ package me.clip.placeholderapi.util;
|
|||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
public class TimeUtil {
|
public class TimeUtil {
|
||||||
|
|
||||||
public static String getRemaining(int seconds, TimeFormat type) {
|
public static String getRemaining(final int seconds, final TimeFormat type) {
|
||||||
if (seconds < 60) {
|
return getRemaining((long) seconds, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRemaining(final long seconds, final TimeFormat type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DAYS:
|
default:
|
||||||
case HOURS:
|
return String.valueOf(seconds);
|
||||||
case MINUTES:
|
|
||||||
return "0";
|
|
||||||
case SECONDS:
|
case SECONDS:
|
||||||
return String.valueOf(seconds);
|
return String.valueOf(seconds % 60);
|
||||||
}
|
|
||||||
|
|
||||||
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:
|
case MINUTES:
|
||||||
return String.valueOf(minutes);
|
return String.valueOf((seconds / 60) % 60);
|
||||||
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:
|
case HOURS:
|
||||||
return String.valueOf(hours);
|
return String.valueOf((seconds / 3600) % 24);
|
||||||
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:
|
case DAYS:
|
||||||
return String.valueOf(days);
|
return String.valueOf(seconds / 86400);
|
||||||
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 getTime(int seconds) {
|
|
||||||
return getTime(Duration.ofSeconds(seconds));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,46 +57,40 @@ public class TimeUtil {
|
|||||||
* @return formatted time
|
* @return formatted time
|
||||||
*/
|
*/
|
||||||
public static String getTime(final Duration duration) {
|
public static String getTime(final Duration duration) {
|
||||||
final StringBuilder builder = new StringBuilder();
|
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(" ");
|
||||||
|
|
||||||
long seconds = duration.getSeconds();
|
|
||||||
long minutes = seconds / 60;
|
long minutes = seconds / 60;
|
||||||
long hours = minutes / 60;
|
long hours = minutes / 60;
|
||||||
long days = hours / 24;
|
final long days = hours / 24;
|
||||||
|
|
||||||
seconds %= 60;
|
seconds %= 60;
|
||||||
minutes %= 60;
|
minutes %= 60;
|
||||||
hours %= 60;
|
hours %= 24;
|
||||||
days %= 24;
|
|
||||||
|
|
||||||
if (seconds > 0) {
|
if (days > 0) {
|
||||||
builder.insert(0, seconds + "s");
|
joiner.add(days + "d");
|
||||||
}
|
|
||||||
|
|
||||||
if (minutes > 0) {
|
|
||||||
if (builder.length() > 0) {
|
|
||||||
builder.insert(0, ' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.insert(0, minutes + "m");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hours > 0) {
|
if (hours > 0) {
|
||||||
if (builder.length() > 0) {
|
joiner.add(hours + "h");
|
||||||
builder.insert(0, ' ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.insert(0, hours + "h");
|
if (minutes > 0) {
|
||||||
|
joiner.add(minutes + "m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (days > 0) {
|
if (seconds > 0) {
|
||||||
if (builder.length() > 0) {
|
joiner.add(seconds + "s");
|
||||||
builder.insert(0, ' ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.insert(0, days + "d");
|
return joiner.toString();
|
||||||
}
|
|
||||||
|
|
||||||
return builder.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* This file is part of PlaceholderAPI
|
* This file is part of PlaceholderAPI
|
||||||
*
|
*
|
||||||
* PlaceholderAPI
|
* PlaceholderAPI
|
||||||
* Copyright (c) 2015 - 2020 PlaceholderAPI Team
|
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
|
||||||
*
|
*
|
||||||
* PlaceholderAPI free software: you can redistribute it and/or modify
|
* PlaceholderAPI free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
55
wiki/FAQ.md
55
wiki/FAQ.md
@@ -1,16 +1,30 @@
|
|||||||
|
[readme]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md
|
||||||
|
|
||||||
Here are frequently asked questions about stuff related to PlaceholderAPI.
|
Here are frequently asked questions about stuff related to PlaceholderAPI.
|
||||||
|
|
||||||
## It only shows %placeholder% and not the variable
|
## It only shows `%placeholder%` and not the variable
|
||||||
Make sure, that you've tried the following steps:
|
When a plugin or `/papi parse me %placeholder%` only returns the placeholder itself and no value should you check for the following things:
|
||||||
- PlaceholderAPI is installed and running (Shows green in `/pl` and responds to the `/papi` command)
|
|
||||||
- You downloaded the expansion with `/papi ecloud download [expansion]`
|
### The expansion is actually installed.
|
||||||
A list of available expansions and their placeholders can be found [[here|Placeholders]]!
|
In many cases is the cause that the expansion of the placeholder is missing.
|
||||||
Also note that not all placeholders are in a seperate expansion. Some are "hardcoded" into a plugin.
|
Just execute `/papi ecloud download <name of expansion>` followed by `/papi reload` to activate it. You can find a list of Expansions and their Placeholders [[on this page|Placeholders]].
|
||||||
- You reloaded PlaceholderAPI with `/papi reload` after downloading an expansion.
|
|
||||||
- Any possible dependency for the expansion (Plugin) is installed and running.
|
**NOTE!**
|
||||||
- The placeholder doesn't contain any typos.
|
Not all placeholders come in their own expansion. Some plugins *hardcode* them in and load them on startup, when hooking into PlaceholderAPI.
|
||||||
- The plugin that should use the placeholder actually supports PlaceholderAPI.
|
|
||||||
For a list of plugins supporting PlaceholderAPI go [[here|Plugins-using-PlaceholderAPI]].
|
### Plugin actualls supports PlaceholderAPI
|
||||||
|
It can happen that the plugin you use to display the placeholder in doesn't support PlaceholderAPI. In such a case check, if the parse command returns the actual value of a placeholder.
|
||||||
|
If that is the case while the plugin is still displaying the placeholder, can this be an indicator of the plugin not supporting PlaceholderAPI.
|
||||||
|
|
||||||
|
You can find a list of plugins supporting PlaceholderAPI [[here|Plugins-using-PlaceholderAPI]].
|
||||||
|
Just make sure that "Supports placeholders" has a check mark in front of it.
|
||||||
|
|
||||||
|
### No typo in the placeholder
|
||||||
|
Double-check that the placeholder you set doesn't contain a typo. You can use `/papi ecloud placeholders <expansion>` (replace `<expansion>` with the name of the expansion) to get a list of all the placeholders the expansion may have.
|
||||||
|
Keep in mind that this only works for separate expansions on the eCloud and not for those that are loaded by plugins.
|
||||||
|
|
||||||
|
### Plugin is enabled
|
||||||
|
If an expansion depends on a plugin, make sure you have the plugin installed and that it is enabled (Shows green in `/pl`).
|
||||||
|
|
||||||
## I can't download the expansion
|
## 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.
|
Make sure, that the connection to the cloud (https://api.extendedclip.com) isn't blocked by a firewall or similar.
|
||||||
@@ -20,3 +34,22 @@ If both checks failed, go to the cloud-page and download the jar manually. Put i
|
|||||||
|
|
||||||
## How can other plugins use my placeholders with PlaceholderAPI?
|
## How can other plugins use my placeholders with PlaceholderAPI?
|
||||||
A tutorial can be found [[here|Hook into PlaceholderAPI]]!
|
A tutorial can be found [[here|Hook into PlaceholderAPI]]!
|
||||||
|
|
||||||
|
## Can I help on this wiki?
|
||||||
|
You sure can!
|
||||||
|
We welcome contributions to our wiki by everyone. If you found a typo or want to improve this wiki in another way, head over to the [Wiki's readme file][readme] to find out about how you can contribute towards this wiki.
|
||||||
|
|
||||||
|
## PlaceholderAPI is posting an error about an outdated expansion?
|
||||||
|
```
|
||||||
|
[00:00:01 ERROR]: [PlaceholderAPI] Failed to load Expansion class <expansion> (Is a dependency missing?)
|
||||||
|
[00:00:01 ERROR]: [PlaceholderAPI] Cause: NoClassDefFoundError <path>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you receive the above error, try to do the following steps:
|
||||||
|
|
||||||
|
- Make sure any required dependency of the mentioned expansion (e.g. a plugin) is installed.
|
||||||
|
- Make sure you use the latest version supported for the server version you use.
|
||||||
|
- If you downloaded the jar from the ecloud, make sure it isn't malformed/corrupted.
|
||||||
|
|
||||||
|
If the issue persists after you've done those checks, report it to the author of the expansion.
|
||||||
|
In most cases is the issue that either a dependency is missing or that the expansion tries to use outdated methods from PlaceholderAPI.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://i.imgur.com/puadJ8Z.png" alt="PlaceholderAPI">
|
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/docs/wiki/wiki/img/logo.png" alt="PlaceholderAPI">
|
||||||
</p>
|
</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.
|
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).
|
It also has a list with all available placeholders (Work in progress).
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[APIBadge]: https://img.shields.io/nexus/r/http/repo.extendedclip.com/me.clip/placeholderapi.svg?label=API-Version
|
[APIBadge]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
||||||
|
|
||||||
[SpigotBadge]: https://img.shields.io/spiget/version/6245?label=Spigot
|
[SpigotBadge]: https://img.shields.io/spiget/version/6245?label=Spigot
|
||||||
[Spigot]: https://spigotmc.org/resources/6245
|
[Spigot]: https://spigotmc.org/resources/6245
|
||||||
@@ -136,7 +136,7 @@ public class JoinExample extends JavaPlugin implements Listener {
|
|||||||
*/
|
*/
|
||||||
joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText);
|
joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText);
|
||||||
|
|
||||||
event.setJoinMessage(withPlaceholdersSet);
|
event.setJoinMessage(joinText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@@ -69,7 +69,7 @@ public class SomeExpansion extends PlaceholderExpansion {
|
|||||||
* <br>This is what tells PlaceholderAPI to call our onRequest
|
* <br>This is what tells PlaceholderAPI to call our onRequest
|
||||||
* method to obtain a value if a placeholder starts with our
|
* method to obtain a value if a placeholder starts with our
|
||||||
* identifier.
|
* identifier.
|
||||||
* <br>This must be unique and can not contain % or _
|
* <br>The identifier has to be lowercase and can't contain _ or %
|
||||||
*
|
*
|
||||||
* @return The identifier in {@code %<identifier>_<value>%} as String.
|
* @return The identifier in {@code %<identifier>_<value>%} as String.
|
||||||
*/
|
*/
|
||||||
@@ -148,7 +148,7 @@ import at.helpch.placeholderapi.example.SomePlugin;
|
|||||||
* {@code /plugins/PlaceholderAPI/expansions} on your server.
|
* {@code /plugins/PlaceholderAPI/expansions} on your server.
|
||||||
* <br>
|
* <br>
|
||||||
* <br>If you create such a class inside your own plugin, you have to
|
* <br>If you create such a class inside your own plugin, you have to
|
||||||
* register it manually in your plugins {@code onEbale()} by using
|
* register it manually in your plugins {@code onEnable()} by using
|
||||||
* {@code new YourExpansionClass().register();}
|
* {@code new YourExpansionClass().register();}
|
||||||
*/
|
*/
|
||||||
public class SomeExpansion extends PlaceholderExpansion {
|
public class SomeExpansion extends PlaceholderExpansion {
|
||||||
@@ -182,7 +182,7 @@ public class SomeExpansion extends PlaceholderExpansion {
|
|||||||
* <br>This is what tells PlaceholderAPI to call our onRequest
|
* <br>This is what tells PlaceholderAPI to call our onRequest
|
||||||
* method to obtain a value if a placeholder starts with our
|
* method to obtain a value if a placeholder starts with our
|
||||||
* identifier.
|
* identifier.
|
||||||
* <br>This must be unique and can not contain % or _
|
* <br>The identifier has to be lowercase and can't contain _ or %
|
||||||
*
|
*
|
||||||
* @return The identifier in {@code %<identifier>_<value>%} as String.
|
* @return The identifier in {@code %<identifier>_<value>%} as String.
|
||||||
*/
|
*/
|
||||||
@@ -329,7 +329,7 @@ public class SomeExpansion extends PlaceholderExpansion {
|
|||||||
* <br>This is what tells PlaceholderAPI to call our onRequest
|
* <br>This is what tells PlaceholderAPI to call our onRequest
|
||||||
* method to obtain a value if a placeholder starts with our
|
* method to obtain a value if a placeholder starts with our
|
||||||
* identifier.
|
* identifier.
|
||||||
* <br>This must be unique and can not contain % or _
|
* <br>The identifier has to be lowercase and can't contain _ or %
|
||||||
*
|
*
|
||||||
* @return The identifier in {@code %<identifier>_<value>%} as String.
|
* @return The identifier in {@code %<identifier>_<value>%} as String.
|
||||||
*/
|
*/
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -62,6 +62,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[ajParkour](https://www.spigotmc.org/resources/60909/)**
|
- **[ajParkour](https://www.spigotmc.org/resources/60909/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#ajparkour]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#ajparkour]]**]
|
||||||
|
- **[AlonsoLevels](https://www.spigotmc.org/resources/83380/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#alonsolevels]]**]
|
||||||
- **[AnimatedBoard](https://www.spigotmc.org/resources/13632/)**
|
- **[AnimatedBoard](https://www.spigotmc.org/resources/13632/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
@@ -86,6 +89,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[AsyncKeepAlive](https://www.spigotmc.org/resources/64676/)**
|
- **[AsyncKeepAlive](https://www.spigotmc.org/resources/64676/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#asynckeepalive]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#asynckeepalive]]**]
|
||||||
|
- **[Ath](https://www.spigotmc.org/resources/87124/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#ath]]**]
|
||||||
- **[AutoCommandsPlus](https://www.spigotmc.org/resources/11083/)**
|
- **[AutoCommandsPlus](https://www.spigotmc.org/resources/11083/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
@@ -116,6 +122,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[BentoBox](https://github.com/BentoBoxWorld/BentoBox)**
|
- **[BentoBox](https://github.com/BentoBoxWorld/BentoBox)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#bentobox]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#bentobox]]**]
|
||||||
|
- **[BetonQuest](https://www.spigotmc.org/resources/2117/)
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#betonquest]]**]
|
||||||
- **[Big Doors Opener](https://www.spigotmc.org/resources/80805/)**
|
- **[Big Doors Opener](https://www.spigotmc.org/resources/80805/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
@@ -134,6 +143,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[BossVote](https://www.spigotmc.org/resources/16497/)**
|
- **[BossVote](https://www.spigotmc.org/resources/16497/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
|
- **[Boxing](https://www.spigotmc.org/resources/83879/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#boxing]]**]
|
||||||
- **[Broadcaster Plugin](https://dev.bukkit.org/projects/broadcaster-plugin)**
|
- **[Broadcaster Plugin](https://dev.bukkit.org/projects/broadcaster-plugin)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
@@ -188,9 +200,12 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[Clans](https://www.spigotmc.org/resources/34696/)**
|
- **[Clans](https://www.spigotmc.org/resources/34696/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#clans]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#clans]]**]
|
||||||
- **[Clans](https://www.spigotmc.org/resources/78415/)**
|
- **[ClansFree](https://www.spigotmc.org/resources/78415/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#clans-1]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#clansfree]]**]
|
||||||
|
- **[ClansPro](https://www.spigotmc.org/resources/87515/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#clanspro]]**]
|
||||||
- **[ClicksPerSecond](https://www.spigotmc.org/resources/57214/)**
|
- **[ClicksPerSecond](https://www.spigotmc.org/resources/57214/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
@@ -259,7 +274,7 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
- **[DeluxeMenus](https://www.spigotmc.org/resources/11734/)**
|
- **[DeluxeMenus](https://www.spigotmc.org/resources/11734/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [x] Provides own placeholders. [**[[Link|Placeholder#deluxemenus]]**]
|
||||||
- **[DeluxeTags](https://www.spigotmc.org/resources/4390/)**
|
- **[DeluxeTags](https://www.spigotmc.org/resources/4390/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#deluxetags]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#deluxetags]]**]
|
||||||
@@ -389,6 +404,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[HoloBlock](https://www.spigotmc.org/resources/43192/)**
|
- **[HoloBlock](https://www.spigotmc.org/resources/43192/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#holoblock]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#holoblock]]**]
|
||||||
|
- **[HoloMobHealth](https://www.spigotmc.org/resources/75975/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [ ] Provides own placeholders. [Link]
|
||||||
- **[HPWizard](https://www.spigotmc.org/resources/26821/)**
|
- **[HPWizard](https://www.spigotmc.org/resources/26821/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#hpwizard]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#hpwizard]]**]
|
||||||
@@ -401,6 +419,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[InteractionVisualizer](https://www.spigotmc.org/resources/77050/)**
|
- **[InteractionVisualizer](https://www.spigotmc.org/resources/77050/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#interactionvisualizer]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#interactionvisualizer]]**]
|
||||||
|
- **[InteractiveChat](https://www.spigotmc.org/resources/75870/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#interactivechat]]**]
|
||||||
- **[IslandRate (ASkyBlock Addon)](https://www.spigotmc.org/resources/53519/)**
|
- **[IslandRate (ASkyBlock Addon)](https://www.spigotmc.org/resources/53519/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#islandrate-askyblock-addon]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#islandrate-askyblock-addon]]**]
|
||||||
@@ -536,6 +557,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[Nameless Plugin](https://www.spigotmc.org/resources/59032/)**
|
- **[Nameless Plugin](https://www.spigotmc.org/resources/59032/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#nameless-plugin]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#nameless-plugin]]**]
|
||||||
|
- **[NameMC-API-ServersMC](https://www.spigotmc.org/resources/88871/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders##namemc-api-serversmc]]**]
|
||||||
- **[Nicknamer](https://www.spigotmc.org/resources/5341/)**
|
- **[Nicknamer](https://www.spigotmc.org/resources/5341/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#nicknamer]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#nicknamer]]**]
|
||||||
@@ -606,11 +630,14 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
- **[PowerRanks](https://www.spigotmc.org/resources/64696/)**
|
- **[PowerRanks](https://www.spigotmc.org/resources/64696/)**
|
||||||
- [ ] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#powerranks]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#powerranks]]**]
|
||||||
- **[PremiumVanish](https://www.spigotmc.org/resources/14404/)**
|
- **[PremiumVanish](https://www.spigotmc.org/resources/14404/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#premiumvanish]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#premiumvanish]]**]
|
||||||
|
- **[Prison](https://www.spigotmc.org/resources/1223/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#prison]]**]
|
||||||
- **[PrisonMines](https://www.spigotmc.org/resources/4046/)**
|
- **[PrisonMines](https://www.spigotmc.org/resources/4046/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#prisonmines]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#prisonmines]]**]
|
||||||
@@ -675,12 +702,18 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[RankedHelp](https://www.spigotmc.org/resources/61919/)**
|
- **[RankedHelp](https://www.spigotmc.org/resources/61919/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
|
- **[RankJoin](https://www.spigotmc.org/resources/67551/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [ ] Provides own placeholders. [Link]
|
||||||
- **[Rankup](https://www.spigotmc.org/resources/17933/)**
|
- **[Rankup](https://www.spigotmc.org/resources/17933/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#rankup]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#rankup]]**]
|
||||||
- **[RawMSG](https://www.spigotmc.org/resources/35864/)**
|
- **[RawMSG](https://www.spigotmc.org/resources/35864/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders.
|
- [ ] Provides own placeholders.
|
||||||
|
- **[RealisticWorldGenerator](https://www.spigotmc.org/resources/15905/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#realisticworldgenerator]]**]
|
||||||
- **[RecentFind (Treasures Add-on)](https://www.spigotmc.org/resources/33366/)**
|
- **[RecentFind (Treasures Add-on)](https://www.spigotmc.org/resources/33366/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#recentfind]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#recentfind]]**]
|
||||||
@@ -693,6 +726,12 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[RestrictedDimensions](http://spigotmc.org/resources/80574/)**
|
- **[RestrictedDimensions](http://spigotmc.org/resources/80574/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#restricteddimensions]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#restricteddimensions]]**]
|
||||||
|
- **[RocketJoin](https://www.spigotmc.org/resources/82520/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [ ] Provides own placeholders. [Link]
|
||||||
|
- **[RocketPlaceholders](https://www.spigotmc.org/resources/82678/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#rocketplaceholders]]**]
|
||||||
- **[RogueParkour](https://www.spigotmc.org/resources/26563/)**
|
- **[RogueParkour](https://www.spigotmc.org/resources/26563/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#rogueparkour]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#rogueparkour]]**]
|
||||||
@@ -720,6 +759,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[Skellett (Skript Add-on)](https://forums.skunity.com/resources/24/)**
|
- **[Skellett (Skript Add-on)](https://forums.skunity.com/resources/24/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [ ] Provides own placeholders. [Link]
|
- [ ] Provides own placeholders. [Link]
|
||||||
|
- **[Seasons](https://www.spigotmc.org/resources/39298/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#seasons]]**]
|
||||||
- **[SellAll](https://www.spigotmc.org/resources/1221/)**
|
- **[SellAll](https://www.spigotmc.org/resources/1221/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#sellall]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#sellall]]**]
|
||||||
@@ -738,6 +780,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[SimpleClans](https://www.spigotmc.org/resources/5269/)**
|
- **[SimpleClans](https://www.spigotmc.org/resources/5269/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#simpleclans]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#simpleclans]]**]
|
||||||
|
- **[SimpleCoins](https://dev.bukkit.org/projects/simplecoins)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#simplecoins]]**]
|
||||||
- **[SimpleCoinsAPI](https://www.spigotmc.org/resources/1432/)**
|
- **[SimpleCoinsAPI](https://www.spigotmc.org/resources/1432/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#simplecoinsapi]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#simplecoinsapi]]**]
|
||||||
@@ -753,6 +798,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[SkillAPI](https://www.spigotmc.org/resources/4824/)**
|
- **[SkillAPI](https://www.spigotmc.org/resources/4824/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#skillapi]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#skillapi]]**]
|
||||||
|
- **[SkinsRestorer](https://www.spigotmc.org/resources/2124/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#skinsrestorer]]**]
|
||||||
- **[Skript](https://github.com/bensku/Skript)**
|
- **[Skript](https://github.com/bensku/Skript)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#skript]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#skript]]**]
|
||||||
@@ -789,6 +837,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[Statz](https://www.spigotmc.org/resources/25969/)**
|
- **[Statz](https://www.spigotmc.org/resources/25969/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#statz]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#statz]]**]
|
||||||
|
- **[Streaming Drops](https://www.spigotmc.org/resources/76996/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#streaming-drops]]**]
|
||||||
- **[StrikePractice 2](https://www.spigotmc.org/resources/46906/)**
|
- **[StrikePractice 2](https://www.spigotmc.org/resources/46906/)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#strikepractice-2]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#strikepractice-2]]**]
|
||||||
@@ -825,9 +876,15 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[Thirst](https://www.spigotmc.org/resources/3316/)**
|
- **[Thirst](https://www.spigotmc.org/resources/3316/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#thirst]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#thirst]]**]
|
||||||
|
- **[TicketGUI](https://www.spigotmc.org/resources/68968/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#ticketgui]]**]
|
||||||
- **[Timed Rewards](https://www.spigotmc.org/resources/34008/)**
|
- **[Timed Rewards](https://www.spigotmc.org/resources/34008/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#timed-rewards]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#timed-rewards]]**]
|
||||||
|
- **[TimeManager](https://www.spigotmc.org/resources/44344/)**
|
||||||
|
- [ ] Supports placeholders.
|
||||||
|
- [x] Provides own placeholders. [**[[Link|Placeholders#timemanager]]**]
|
||||||
- **[Time Tokens](https://www.spigotmc.org/resources/75441/)**
|
- **[Time Tokens](https://www.spigotmc.org/resources/75441/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#time-tokens]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#time-tokens]]**]
|
||||||
@@ -849,6 +906,9 @@ If your plugin isn't shown here and you want it to be added, [open an issue](/Pl
|
|||||||
- **[TownyChat](https://github.com/TownyAdvanced/TownyChat)**
|
- **[TownyChat](https://github.com/TownyAdvanced/TownyChat)**
|
||||||
- [x] Supports placeholders.
|
- [x] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#townychat]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#townychat]]**]
|
||||||
|
- **[TpLogin](https://www.spigotmc.org/resources/21692/)**
|
||||||
|
- [x] Supports placeholders.
|
||||||
|
- [ ] Provides own placeholders. [Link]
|
||||||
- **[TransmuteIt](https://www.spigotmc.org/resources/76287/)**
|
- **[TransmuteIt](https://www.spigotmc.org/resources/76287/)**
|
||||||
- [ ] Supports placeholders.
|
- [ ] Supports placeholders.
|
||||||
- [x] Provides own placeholders. [**[[Link|Placeholders#transmuteIt]]**]
|
- [x] Provides own placeholders. [**[[Link|Placeholders#transmuteIt]]**]
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[Wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
|
[Wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
|
||||||
[Placeholders]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
|
[Placeholders]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
|
||||||
[Plugins using PlaceholderAPI]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
|
[Plugins using PlaceholderAPI]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Plugins-using-PlaceholderAPI
|
||||||
|
|
||||||
# Wiki
|
# Wiki
|
||||||
This is the wiki folder. It contains all pages that you can find in our [Wiki].
|
This is the wiki folder. It contains all pages that you can find in our [Wiki].
|
||||||
@@ -8,36 +8,43 @@ It allows you to suggest changes through Pull request while keeping a simple way
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
## Target branch
|
||||||
|
The wiki is handled on a separate branch called `docs/wiki`.
|
||||||
|
When making a Pull request, make sure to target this specific branch. Any PR not targeting this branch may either be closed or the target changed.
|
||||||
|
|
||||||
## Adding your resource(s)
|
## 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.
|
When you either have a plugin, which adds and/or uses placeholders or an expansion and you want to add it to the wiki should you follow the below steps.
|
||||||
|
|
||||||
|
- [Plugins using PlaceholderAPI](#plugins-using-placeholderapi)
|
||||||
|
- [Placeholders](#placeholders)
|
||||||
|
|
||||||
### [Plugins using PlaceholderAPI]
|
### [Plugins using PlaceholderAPI]
|
||||||
You should always add your resource to this page, no matter if it only supports placeholders or also provides its own.
|
This is only required for plugins.
|
||||||
|
If your plugin supports placeholders of other plugins and/or provides own placeholders through PlaceholderAPI should you always add it the the `Plugins using PlaceholderAPI` page.
|
||||||
|
|
||||||
The format of a plugin is always as follows:
|
Each entry on this page follows a specific format that you need to follow:
|
||||||
```md
|
```markdown
|
||||||
- **[:name](:url)**
|
- **[:name](:url)**
|
||||||
- [?] Supports placeholders.
|
- [?] Supports placeholders.
|
||||||
- [?] Provides own placeholders. [:link]
|
- [?] Provides own placeholders. [:link]
|
||||||
```
|
```
|
||||||
|
|
||||||
A quick summary over the different parts:
|
| Key | Description |
|
||||||
|
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
- `: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.
|
| `:name` | The name of the Plugin. Plugins are ordered by alphabet and if your plugin shares the same name as another one will you need to 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/.
|
| `:url` | The URL to your plugin. Spigot URLs should only contain the ID. E.g. https://www.spigotmc.org/resources/placeholderapi.6245/ becomes 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 if the option is supported. So the result is either `[x]` or `[ ]` |
|
||||||
- `?` 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` | If your plugin also provides own placeholders should you add it to the [Placeholders] page. In such a case should you use `[**[[Link\|Placeholders#:name]]**]` otherwhise just `[Link]` |
|
||||||
- `: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]
|
### [Placeholders]
|
||||||
If your plugin provides its own placeholders through an extension is it recommendet to add this extension to the [Placeholders] page.
|
This step is required if you either have a plugin or an expansion that provides their own placeholders. You should add your resource to the Placeholders page of the wiki.
|
||||||
This page is split up into two sections: PAPI Placeholders and Plugin Placeholders.
|
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.
|
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 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:
|
The syntax used for each entry is the same:
|
||||||
````md
|
````markdown
|
||||||
- ### **[:name](:url)**
|
- ### **[:name](:url)**
|
||||||
> :command
|
> :command
|
||||||
|
|
||||||
@@ -47,36 +54,51 @@ The overall structure of an entry is always the same:
|
|||||||
----
|
----
|
||||||
````
|
````
|
||||||
|
|
||||||
- `: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.
|
| Key | Description |
|
||||||
- `: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.
|
| `:name` | The name of the resource. Resources are ordered by alphabet and if your plugin shares the same name as another one will you need to add it **below** the other resource. |
|
||||||
- `: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.
|
| `:url` | The URL to your plugin. Spigot URLs should only contain the ID. E.g. https://www.spigotmc.org/resources/placeholderapi.6245/ becomes https://www.spigotmc.org/resources/6245/ |
|
||||||
If your extension is build into your resource can you just set `NO DOWNLOAD COMMAND` instead.
|
| `:command` | The download command. When your resource is an expansion on the ecloud would you need to add `/papi ecloud download :name`. If it isn't an expansion should you put `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.
|
| `:placeholders` | List of placeholders your plugin/expansion offers. The list should stay in alphabetical order. You can use `<>` and `[]` to indicate required and optional variables. |
|
||||||
|
|
||||||
Always keep an empty line in between the `----` and the next entry below it.
|
#### Extra notes
|
||||||
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.
|
- If your entry has another one below it will you need to add an empty line, followed by for hypthons (`----`) at the bottom of your entry to separate it.
|
||||||
|
- You are allowed to add a description between the `> :command` and the placeholder list. Keep in mind to keep an empty line after the command line to prevent wrong formatting. A description is only useful/required if your expansion/plugin offers specific placeholder values and/or features.
|
||||||
|
- Always add your entry's name to the list at the top of the page in the format `- [:name](#:name)`. Note that if your entry shares the same name as another one on the page and you added it below it, that you will need to append a `-1`, `-2`, ... to the name in the brackets, depending on how many entries with the same name there are.
|
||||||
|
|
||||||
|
----
|
||||||
## Other Wiki pages
|
## Other Wiki pages
|
||||||
Please follow these general guidelines when editing any other pages.
|
Please follow these general guidelines when editing any other pages.
|
||||||
|
|
||||||
### Linking
|
### Links
|
||||||
Linking should always be done through either the reference option or through the Wiki link option.
|
The wiki uses 3 types of links:
|
||||||
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.
|
|
||||||
|
|
||||||
|
- [Reference Links](#reference-links)
|
||||||
|
- [Wiki Links](#wiki-links)
|
||||||
|
- [Header Links](#header-links)
|
||||||
|
|
||||||
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).
|
#### Reference Links
|
||||||
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.
|
Reference Links are in the format `[:text]: :url` where `:text` is the name to use as reference and `:url` is the url.
|
||||||
|
These types of links are usually put at the top of the page and allow us easier updating of these links, by just altering the URL without the need to replace them in the entire file.
|
||||||
|
|
||||||
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).
|
To use a reference link, either use `[:text]` or `[:displayed_text][:text]` to link with a differently shown text.
|
||||||
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.
|
For example: With `[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki` will `[wiki]` become [wiki] and `[to the wiki][wiki]` becomes [to the wiki][wiki].
|
||||||
|
|
||||||
|
Always use reference links for URLs that point outside of the Wiki. Only exceptions are Links in the [Placeholders] and [Plugins using PlaceholderAPI] page (See above for details).
|
||||||
|
|
||||||
|
#### Wiki Links
|
||||||
|
Wiki links are used to link to other pages on the wiki.
|
||||||
|
These types of links are in the format `[[:pagename]]` or `[[:text|:pagename]]` to display a different text. `:pagename` is case-sensitive.
|
||||||
|
|
||||||
|
If you want to link to a header in another wiki page can you use `[[:text|:pagename#:header]]`.
|
||||||
|
|
||||||
|
#### Header Links
|
||||||
|
Header links are used to link to a section within the same wiki page.
|
||||||
|
The format is `[:text](#:header)`. The header name is case-insensitive but it's recommended to keep it lowercase.
|
||||||
|
|
||||||
|
----
|
||||||
### Lists
|
### 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.
|
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.
|
||||||
|
|
||||||
|
@@ -1,16 +1,23 @@
|
|||||||
|
[papi]: https://placeholderapi.com
|
||||||
|
|
||||||
[discordImg]: https://img.shields.io/discord/164280494874165248.svg?logo=discord&label=Discord&colorB=7289DA
|
[discordImg]: https://img.shields.io/discord/164280494874165248.svg?logo=discord&label=Discord&colorB=7289DA
|
||||||
[discord]: https://helpch.at/discord
|
[discord]: https://helpch.at/discord
|
||||||
|
|
||||||
[jenkinsImg]: https://img.shields.io/badge/Download%20from-Jenkins-brightgreen.svg
|
[jenkinsImg]: https://img.shields.io/badge/Download%20from-Jenkins-brightgreen.svg
|
||||||
[jenkins]: http://ci.extendedclip.com/job/PlaceholderAPI/
|
[jenkins]: http://ci.extendedclip.com/job/PlaceholderAPI/
|
||||||
|
|
||||||
[licenseImg]: https://img.shields.io/github/license/PlaceholderAPI/PlaceholderAPI.svg
|
[licenseImg]: https://img.shields.io/github/license/PlaceholderAPI/PlaceholderAPI.svg
|
||||||
[license]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/LICENSE
|
[license]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/LICENSE
|
||||||
|
|
||||||
[issuesImg]: https://img.shields.io/github/issues-raw/PlaceholderAPI/PlaceholderAPI.svg?logo=github&logoColor=white
|
[issuesImg]: https://img.shields.io/github/issues-raw/PlaceholderAPI/PlaceholderAPI.svg?logo=github&logoColor=white
|
||||||
[issues]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues
|
[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
|
|
||||||
|
[versionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
|
||||||
[plugin-page]: https://spigotmc.org/resources/6245
|
[plugin-page]: https://spigotmc.org/resources/6245
|
||||||
|
|
||||||
|
> © 2015 - 2021 [PlaceholderAPI Team][papi]
|
||||||
> Thanks for using PlaceholderAPI.
|
> Thanks for using PlaceholderAPI.
|
||||||
>
|
>
|
||||||
> **[Plugin-page]** | **[[Placeholders]]** | **[[Plugins using PlaceholderAPI]]** | **[[Hook into PlaceholderAPI]]**
|
> **[Plugin-page]** | **[[Placeholders]]** | **[[Plugins using PlaceholderAPI]]** | **[[Hook into PlaceholderAPI]]**
|
||||||
|
>
|
||||||
![versionImg] [![jenkinsImg]][jenkins] [![licenseImg]][license] [![issuesImg]][issues] [![discordImg]][discord]
|
> ![versionImg] [![jenkinsImg]][jenkins] [![licenseImg]][license] [![issuesImg]][issues] [![discordImg]][discord]
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://i.imgur.com/Adp7xdh.png" alt="PlaceholderAPI">
|
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/docs/wiki/wiki/img/icon.png" alt="PlaceholderAPI">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
**[[Main page|Home]]**
|
**[[Main page|Home]]**
|
||||||
@@ -49,7 +49,10 @@
|
|||||||
- [[Server|Placeholders#server]]
|
- [[Server|Placeholders#server]]
|
||||||
- [[Sound|Placeholders#sound]]
|
- [[Sound|Placeholders#sound]]
|
||||||
- [[Spectators|Placeholders#spectators]]
|
- [[Spectators|Placeholders#spectators]]
|
||||||
|
- [[SpeedPerSec|Placeholders#speedpersec]]
|
||||||
- [[Statistic|Placeholders#statistic]]
|
- [[Statistic|Placeholders#statistic]]
|
||||||
|
- [[Team|Placeholders#team]]
|
||||||
|
- [[World|Placeholders#world]]
|
||||||
|
|
||||||
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
|
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
|
||||||
- [[A|Placeholders#a]]
|
- [[A|Placeholders#a]]
|
||||||
|
BIN
wiki/img/icon.png
Normal file
BIN
wiki/img/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
wiki/img/logo.png
Normal file
BIN
wiki/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user