Compare commits

...

273 Commits

Author SHA1 Message Date
Andre_601 68f467ab29
Add 1.20.2 - 1.20.5 to NMSVersion.java (#1057) 2024-04-30 10:35:18 -05:00
PiggyPiglet 068b5a31b2
Fix #1034 & Deprecate VersionSpecific & update copyright (#1035)
Co-authored-by: Andre_601 <github@andre601.ch>
2024-04-30 10:34:43 -05:00
Gabriel Dumitru 882b7c5965
Merge pull request #1046 from PlaceholderAPI/feature/add-plugin-authors
Add Plugin Authors to /papi dump
2024-03-07 22:59:42 +02:00
Gabriel Dumitru 7a0be5edf8
Merge pull request #1040 from DevCyntrix/fix-class-cast-exception
Use the OfflinePlayer$getPlayer method instead of casting to Player class
2024-03-07 22:59:24 +02:00
Andre601 e94328935d
Add Plugin Authors to /papi dump 2024-02-25 14:42:48 +01:00
Andre_601 604fed36a4
Man, this file is outdated... 2024-02-25 00:14:41 +01:00
Ricardo Borutta 403622d205 Use the OfflinePlayer$getPlayer method instead of casting to Player class
You should use this to avoid a class cast exception if some other plugins uses an own Implementation of the offline player.
2024-01-29 10:21:24 +01:00
Funnycube 1cd4d93f7f
Merge pull request #1038 from Funny-cube/master
Update config.yml with papi domain for wiki and ecloud
2024-01-27 21:57:48 +11:00
Funnycube a83ef75bf9
Update config.yml 2024-01-27 20:45:10 +11:00
Andre_601 b96e535aaa
Update wiki link in PR template 2024-01-27 00:58:11 +01:00
Andre_601 2e67272aea
Fix logo and update link in README 2024-01-26 23:05:04 +01:00
Andre_601 2c7767e77d
fix github admonition blocks 2024-01-22 20:12:39 +01:00
Andre_601 c4a046ff24
Merge pull request #1006 from PlaceholderAPI/feature/add-new-download-pages
Add Hangar and BuiltByBit pages to readme
2023-11-26 16:58:08 +01:00
PiggyPiglet 57fa68c896
change version to .6-dev 2023-10-28 21:50:05 +08:00
PiggyPiglet b64f024eb2
fix config version variable and set release version 2023-10-28 21:49:39 +08:00
PiggyPiglet c7a4900aa3
remove ability to download unverified expansions 2023-10-28 21:42:18 +08:00
Andre_601 491abd6238
BuilT not BuilD 2023-09-25 15:11:49 +02:00
Andre_601 d3646a9874
Change Built By Bit to BuiltByBit Page 2023-09-25 15:07:13 +02:00
Andre_601 af0b475330
Add Hangar and BuiltByBit pages to readme 2023-09-25 14:58:30 +02:00
Funnycube d35a499e31
Update plugin.yml
remove unused toggle permissions
2023-09-24 13:49:40 +10:00
Funnycube c0f824450e
Update build.gradle.kts
start 2.11.5-DEV
2023-09-24 12:59:01 +10:00
Funnycube 5b1a8ef4ba
2.11.4 release 2023-09-24 12:40:46 +10:00
PiggyPiglet 5623a00f9b
Merge pull request #978 from JulianVennen/block-unverified-expansions
Add environment variable to override cloud_allowunverified_expansions
2023-09-21 17:38:54 +08:00
PiggyPiglet 4926907b47
Merge pull request #969 from PlaceholderAPI/feature/support-1.20
1.20 support
2023-09-04 17:26:11 +08:00
Andre_601 195158b18b
Use new format for note block [skip ci] 2023-08-01 03:27:15 +02:00
Gabriel Dumitru 36fa9ac96d
feat: distinguish expansions (external or internal) (fixes #945) (#953) 2023-07-24 11:48:29 +03:00
Julian 42cfe1dc80
simplify env values to true/false 2023-06-23 17:06:11 +02:00
Julian 92a7d54664
Add environment variable to override cloud_allowunverified_expansions
This adds the environment variable PAPI_ALLOW_UNVERIFIED_EXPANSIONS.
It allows overriding the option set in the config.yml.
2023-06-23 14:04:00 +02:00
Gabriel Dumitru f91b4e3752
feat: fetch all expansions (#952) 2023-06-21 21:26:52 +03:00
PiggyPiglet a497e05e55
Merge pull request #947 from JulianVennen/block-extensions-env
Add environment variable to block individual ecloud expansions.
2023-06-21 20:25:16 +08:00
Andre601 74d8fec6bd
Bump Spigot version 2023-06-10 18:13:10 +02:00
Andre601 28287c7fbd
1.20 NMS version support 2023-06-10 17:59:55 +02:00
Gabriel Dumitru 744cf6d8c0
Merge pull request #946 from JulianVennen/block-load-path-traversal
Prevent loading of extensions outside of the expansions folder using the register command
2023-04-04 17:28:00 +03:00
Julian ecd4c002c8
Add environment variable to block individual ecloud expansions.
This commit adds the environment variable "PAPI_BLOCKED_EXPANSIONS"
which can contain a case insensitive, comma separated list of blocked
expansions.
Expansions on this list can no longer be downloaded using commands.
2023-03-30 13:41:01 +02:00
Julian b4e60b7db5
Prevent loading of extensions outside of the expansions folder using the register command 2023-03-30 12:47:23 +02:00
darbyjack e862abe0b4
Start 2.11.4 DEV cycle 2023-03-17 20:07:24 -05:00
darbyjack 2d946646f0
Release 2.11.3 2023-03-17 20:03:47 -05:00
Glare 5ab61e0cd3
Update the NMS options up to the latest 1.19 R3 (#938) 2023-03-17 19:59:31 -05:00
Gabriel Dumitru 81ef464dad
fix: catch NoClassDefFoundError in order for the other expansions to be loaded (#936) 2023-03-17 15:44:41 -05:00
Gabriel Dumitru 0ae0ddc9cb
Merge pull request #935 from PlaceholderAPI/fix/kotlin-build-system 2023-03-17 22:16:10 +02:00
darbyjack 3d00d48106
Tell build to depend on shadowJar and publish for build 2023-03-17 14:13:49 -05:00
darbyjack 7e902cae66
Fixed variables in the plugin.yml not being created properly 2023-03-17 13:45:31 -05:00
Matt f4e4433b16
Feature/gradle kts (#934)
Co-authored-by: darbyjack <admin@glaremasters.me>
2023-03-17 13:25:47 -05:00
Andre_601 d5c371004c
Fix duplicate expansion loading (#866) 2023-03-17 12:47:27 -05:00
Glare e246473782
Merge pull request #933 from PlaceholderAPI/feature/update-adventure 2023-03-16 18:31:20 -05:00
Andre601 4afad7f7b0
Update Kyori Adventure to 4.3.0 2023-03-17 00:22:58 +01:00
PiggyPiglet a0b177bdd8
Merge pull request #869 from PlaceholderAPI/remove-ecloud-toggle-command
remove the eCloud toggle command
2023-02-23 21:29:06 +08:00
Gabriel Dumitru 40b1fe8d68
Merge pull request #901 from BlockyTheDev/fix-status-message 2023-02-23 13:36:05 +02:00
PiggyPiglet 9ee4afa1e9
Merge pull request #873 from PlaceholderAPI/fix/872-fix-inxonsisten-parsing
Fix inconsistent parsing command behaviour
2023-02-23 19:31:38 +08:00
BlockyTheDev 1cf66b130c
Add space to message 2022-12-25 21:31:55 +01:00
Andre601 c3cfc82eb3 Fix inconsistent parsing command behaviour 2022-08-14 16:30:22 +02:00
Gabriel Dumitru 3afb634e58
revert 4c228ca4fb 2022-08-10 16:01:41 +03:00
Gabriel Dumitru d888d9754b
remove from help 2022-08-09 01:20:04 +03:00
Gabriel Dumitru 4c228ca4fb make the eCloud disable by default 2022-08-09 01:08:45 +03:00
Gabriel Dumitru 6cf987586e remove the eCloud toggle command 2022-08-09 01:08:24 +03:00
Glare 46d9a69534
Merge pull request #862 from darbyjack/fix-ecloud-components
Updated Adventure
2022-07-26 18:49:45 -05:00
Glare af8cc09fca
Merge pull request #863 from darbyjack/bump-dev
Bump to 2.11.3-dev
2022-07-26 18:48:44 -05:00
darbyjack 452c8ccd42
Bump to 2.11.3-dev 2022-07-26 16:22:18 -05:00
darbyjack 054c780fd1
Updated Adventure 2022-07-26 12:57:11 -05:00
Andre_601 83261eee49
Update canned responses. 2022-07-03 20:12:45 +02:00
PiggyPiglet 3fca78626a
remove remaining colour shit and changed version so cube can release and we can be all happy and dandy 2022-07-03 20:34:12 +08:00
PiggyPiglet a2456c582d
Removed excess capitalisation 2022-07-02 21:45:53 +08:00
Andre_601 b987916328
Update Image link 2022-07-02 13:46:48 +02:00
Andre_601 23ef4ecb62
Remove wiki folder 2022-07-02 13:46:09 +02:00
PiggyPiglet 8b7a217796
Merge pull request #830 from montlikadani/improve-replacer-process
Remove regex replacer & associated tests
2022-07-01 23:33:35 +08:00
PiggyPiglet 74ebb0bec0
remove regex replacer & associated tests 2022-07-01 23:31:51 +08:00
Glare 794c8890e5
Merge pull request #801 from PlaceholderAPI/fix/papi-dump-expansion-order 2022-07-01 10:08:57 -05:00
Glare 013e566a85
Merge pull request #832 from PlaceholderAPI/feature/log-missing-plugin 2022-07-01 09:51:12 -05:00
Glare 5a4a8c2e7e
Merge pull request #793 from Rothes/master 2022-07-01 09:46:39 -05:00
Andre_601 0b068470ac
Update CODEOWNERS 2022-07-01 13:06:22 +02:00
Andre_601 f3cb7635c2
Update old links 2022-06-30 22:51:34 +02:00
Andre_601 8e21a76118
Update bug_report.yml 2022-06-30 22:26:13 +02:00
Andre_601 1dad2381e5
Delete wiki action (Not needed) 2022-06-30 22:16:06 +02:00
Andre_601 9767811cb9
Merge pull request #847 from JT122406/master
Gradle Bumps and stuff
2022-06-27 12:55:06 +02:00
J.T. McQuigg e6fb6d5ec6 Other small version bumps 2022-06-26 23:54:07 -04:00
J.T. McQuigg 1acc621f2e Bump Gradle from 7.3.1 to 7.4.2 2022-06-26 23:53:51 -04:00
Glare d9bab03e3b
Merge pull request #773 from PlaceholderAPI/feature/update-contributing 2022-06-25 15:47:54 -05:00
PiggyPiglet 9baf5f58ae
Merge pull request #844 from PlaceholderAPI/feature/1.19
1.19 support
2022-06-25 20:06:19 +08:00
Andre601 077d64dc68 Fix NMS version 2022-06-16 01:45:47 +02:00
Andre601 b8d5886cad 1.19 support 2022-06-16 01:31:33 +02:00
Andre_601 52119682f3
Use custom quote block in automatic replies 2022-05-20 17:04:38 +02:00
Andre601 651e14a797 Make plugin check before register to avoid possible exceptions 2022-05-19 02:46:40 +02:00
Andre601 0ac62d6b63 Log missing required plugin for expansion
+ some logger improvements
2022-05-18 21:11:09 +02:00
Andre601 0be6b721cf Use stream to get size padding 2022-05-04 18:36:46 +02:00
Andre601 0e0e36476a Change appended message for null jar array 2022-04-29 23:13:19 +02:00
Andre_601 a56b3b62b9
Update to v3 wiki action 2022-04-28 21:30:52 +02:00
Funnycube 883f1c1edf
One Million 🎉 2022-04-08 20:23:05 +10:00
Rothes bfc30a8703
`Locale.ROOT` param 2022-03-26 09:09:50 +08:00
Andre_601 37c39ab734
Update the flex 2022-03-26 01:36:07 +01:00
Glare 35c47a8745
Merge pull request #810 from PlaceholderAPI/feature/remove-escape-hex-test
Remove testCharsReplacerHandlesEscapedHex()
2022-03-13 05:48:30 -05:00
PiggyPiglet fadf14a316
Merge pull request #814 from PlaceholderAPI/fix/666-lowercasing
fix(replacer): Stop lowercasing replacements
2022-03-13 14:35:34 +08:00
Starmism 1388a5278f fix(replacer): Stop lowercasing replacements
This commit changes two lines but fixes the replacement of cased
    placeholders with non-cased ones that was accidentally happening.
    This was partially fixed in a few previous commits, but not fully as
    it was still replacing failed placeholder matches.
2022-03-12 12:42:56 -07:00
Andre_601 3bc6ad0f06
Also update label-commenter-config 2022-03-12 01:20:21 +01:00
Andre_601 bb149811d4
Update label-commenter-config.yml 2022-03-12 01:16:33 +01:00
Andre601 350a2be0ed Remove testCharsReplacerHandlesEscapedHex() 2022-02-22 11:48:51 +01:00
Gabriel Dumitru b73d72cec7
add missing java.util.Locale imports 2022-02-22 11:42:35 +02:00
Gabriel Dumitru 7afb8ee36d
Merge pull request #800 from PlaceholderAPI/feature/null-parse-option
Add --null argument for Parse command
2022-02-22 10:42:02 +02:00
Andre601 1241c33ba0 Add --null to command help 2022-02-05 20:55:48 +01:00
Andre601 631609af74 Improve expansion sorting in /papi dump 2022-02-05 14:08:43 +01:00
Andre601 fe8d865657 Add missing import 2022-02-05 13:57:30 +01:00
Andre601 50d4e14333 Add --null option for parse command 2022-02-05 13:57:05 +01:00
Andre_601 666ab468a1
Link to docs/wiki branch README 2022-01-30 12:03:42 +01:00
Rothes 151fb08db8
Fix PlaceholderExpansion may not unregistered 2022-01-28 13:40:39 +08:00
Andre_601 cd9074203c
Update label-commenter-config.yml 2022-01-03 00:19:58 +01:00
Andre_601 38d77ff4ca
Update label-commenter-config.yml 2022-01-03 00:17:23 +01:00
Glare 3ccbbe9c20
Bump to 2.11.2 DEV 2021-12-27 01:33:36 -08:00
Glare 358a3bcab3
Release 2.11.1 2021-12-27 01:32:00 -08:00
PiggyPiglet ca088227c3
Merge pull request #772 from PlaceholderAPI/fix/771-identifier-replacement
Fix #771
2021-12-27 15:21:30 +08:00
Andre_601 69fd180c9b
Update CONTRIBUTING.md 2021-12-25 16:55:05 +01:00
Andre_601 38e6e02e1b
Not sure how I missed that... 2021-12-25 15:53:07 +01:00
Andre_601 a71b8657f1
Update Contributing file 2021-12-25 15:50:17 +01:00
PiggyPiglet 850633e792
Fix #771 2021-12-24 12:34:36 +08:00
PiggyPiglet 348b075ac5
added glare's fancy pants dev string to ver 2021-12-24 12:32:01 +08:00
PiggyPiglet ce18d3b597
update licenses & bump deprecation ver 2021-12-24 12:26:22 +08:00
PiggyPiglet 9d66d9d9a1
bump ver 2021-12-24 12:24:40 +08:00
darbyjack 5fe9389dda
We're actually on 2.11.0 RELEASE 2021-12-19 18:59:38 -06:00
darbyjack e25a28b2a5
2.10.11 RELEASE 2021-12-19 18:53:25 -06:00
PiggyPiglet cfd289939e
Merge pull request #667 from PlaceholderAPI/fix/666-lowercase-issues
Fix issue with invalid placeholder pattern lowercasing text
2021-12-19 18:49:37 -06:00
PiggyPiglet d168be94b1
Merge pull request #752 from PlaceholderAPI/1.18
1.18 + Gradle Updates
2021-12-03 13:01:09 +08:00
PiggyPiglet 511717a8d6
Merge branch 'master' into 1.18 2021-12-03 13:01:02 +08:00
PiggyPiglet 18fb194ce6
Merge pull request #677 from PlaceholderAPI/feature/add-logging-options
Add logging options to PlaceholderExpansion
2021-12-03 13:00:15 +08:00
PiggyPiglet e11d551071
Merge pull request #717 from PlaceholderAPI/feature/log-expansio-version
Include version in registration message and other QOL changes
2021-12-03 12:59:20 +08:00
PiggyPiglet 020f14d82c
Merge branch 'master' into feature/log-expansio-version 2021-12-03 12:59:07 +08:00
darbyjack acb5728e65
1.18 + Gradle Updates 2021-12-02 21:55:12 -06:00
Andre_601 cc235cfc01
Merge Development into master (#758)
* Update development from master (#662)

* Add contributing and expansion section

* Start using new Issue template system

* Create bug_report.yml

* Rename feature_request.md to feature_request_old.md

* Create feature_request.yml

* fix unique name

* Update feature_request_old.md

* Add Checkboxes

* Add checkboxes

* disable default issue body

* Delete bug_report_old.md

* Delete feature_request_old.md

* Rename bug_report_new.yml to bug_report.yml

* Check if deleting this fixed the PR...

* Use description in favour of about

* improve feature_request.md

* Update bug_report.yml

* Assign "Type: Issue (Unconfirmed)" label

* Use lists and not comma-separated string

* Update feature_request.yml

* Use id option for error and dump fields

* Add field for logs

* Remove deprecated issue_body type

* Update feature_request.yml

* Improve description of bug_report.yml

* Initial 1.17 Changes

* add render

* Revert build.gradle dependencies change

* Fixed duplicate files

* Initial test on adventure

* started moving to pure adventure

* finished kyori impl

* added 1.17 to nmsversion (what does this even do)

* removed dev for release

* added dev back

Co-authored-by: PiggyPiglet <PiggyPiglet@users.noreply.github.com>
Co-authored-by: darbyjack <admin@glaremasters.me>
Co-authored-by: PiggyPiglet <noreply@piggypiglet.me>

* Update dependencies of PlaceholderAPI

* Add missing trailing /

Co-authored-by: PiggyPiglet <PiggyPiglet@users.noreply.github.com>
Co-authored-by: darbyjack <admin@glaremasters.me>
Co-authored-by: PiggyPiglet <noreply@piggypiglet.me>
2021-12-03 04:52:28 +01:00
PiggyPiglet 894dcd0a2f
Merge pull request #687 from PlaceholderAPI/java-version-dump
Add Java Version to /papi dump command
2021-12-03 11:40:11 +08:00
PiggyPiglet 41c9231664
Merge pull request #749 from itIsMaku/master
nullable annotation placeholderhook
2021-12-03 11:37:52 +08:00
Andre601 31deef2a62 Use completedFuture instead 2021-12-01 21:30:41 +01:00
Andre601 3ba29f1147 Fix possible NPE for findExpansionsOnDisk 2021-12-01 19:09:02 +01:00
Andre601 e969f37405 Improve StringBuilder and also fix possible NPE 2021-12-01 19:05:28 +01:00
Andre_601 b9a5f4445f
Merge pull request #731 from PlaceholderAPI/feature/automatic-release-drafting
Add release.yml for automatic release drafts
2021-11-29 01:36:03 +01:00
Adam Volkman (itIsMaku) 6f87955898
feat: nullable annotation placeholderhook 2021-11-17 14:10:19 +01:00
Andre_601 d68af58df5
Make name of job only show java version 2021-11-11 13:49:48 +01:00
Andre_601 6e1eb88585
Add release.yml for automatic release drafts 2021-10-09 18:39:13 +02:00
Andre_601 0798d94449
Update this flex too funnycube :) 2021-10-01 16:22:30 +02:00
Funnycube aa68a481ee
Update flex 2021-10-01 22:59:12 +10:00
Andre_601 6f5853746d
fix wiki action... again 2021-10-01 14:17:21 +02:00
Andre_601 416fbc0e3e
Merge branch 'docs/wiki' into master 2021-10-01 14:16:06 +02:00
Andre601 407714c13f Rename logo.png to wiki-logo.png 2021-10-01 14:14:41 +02:00
Andre_601 aa13ddf17e
Add files via upload 2021-10-01 14:10:19 +02:00
Andre_601 d9da5a706c
Update README.md 2021-10-01 14:01:59 +02:00
Andre_601 80446de15b
Merge pull request #718 from TheCashFire/patch-1
New Placeholder for %aach_total_commands%
2021-09-23 16:37:08 +02:00
Kris Stancy 0647f88de5
New Placeholder
Added %aach_total_commands% new placeholder to the total achievement placeholders section.
2021-09-19 22:06:01 -05:00
Andre601 38099198d6 Include version in registration message 2021-09-20 02:42:38 +02:00
Andre_601 6f2f1f1cf1
Update README.md 2021-09-12 02:17:58 +02:00
ThisKarolGajda 5e4d3f7135
Update Placeholders.md (#714) 2021-09-10 14:25:24 +02:00
Andre_601 327078d8dd
Update README.md 2021-09-10 03:30:03 +02:00
Andre_601 1b7fabf238
Update Wiki Readme... a lot 2021-09-10 03:23:11 +02:00
Andre_601 66025a6a1c
Update PlaceholderExpansion.md 2021-09-10 02:02:53 +02:00
Andre_601 04f2c85722
fix e-mail env 2021-09-10 01:58:46 +02:00
ThisKarolGajda 7b5ceb520f
Update Placeholders.md - OpEconomy (#713)
* Update Placeholders.md

* Add OpEconomy to "Plugins using PlaceholderAPI"

Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
2021-09-10 01:55:13 +02:00
Andre_601 f7dc184899
Update label-commenter-config.yml 2021-09-09 18:32:37 +02:00
Andre_601 4300bf7d1e
Pull latest changes from master into docs/wiki (#712)
* Update Javadoc documentation

* More comments... a lot more!

* Remove Gson

* Implemented working version for 1.8.8 - 1.16.3

* Improve ExpansionsLoadedEvent's docs

* 2021 🥳

* Add contributing and expansion section

* Fix invalid link tag

* Start using new Issue template system

* Create bug_report.yml

* Rename feature_request.md to feature_request_old.md

* Create feature_request.yml

* should it use setBracketPlaceholders??

* fix unique name

* Update feature_request_old.md

* Add Checkboxes

* Add checkboxes

* disable default issue body

* Delete bug_report_old.md

* Delete feature_request_old.md

* Rename bug_report_new.yml to bug_report.yml

* Check if deleting this fixed the PR...

* Use description in favour of about

* improve feature_request.md

* Update bug_report.yml

* Assign "Type: Issue (Unconfirmed)" label

* Use lists and not comma-separated string

* Update feature_request.yml

* Use id option for error and dump fields

* Add field for logs

* Update Copyright
~ Fixed a typo and updated missed files from #543

* Re-add removed code
That should actually NOT be here...

* Undo renaming of boolean

* Remove deprecated issue_body type

* Update feature_request.yml

* Improve description of bug_report.yml

* Build jars on PR (Compile and build validation)

* Initial 1.17 Changes

* Extracted URLClassLoader out of try-with-resources block

* Close URLClassLoader if Expansion class was not found

* Build against Java 8, 11 and 16

* adoPt

I always make that mistake...

* add render

* Cleanup build.gradle

(cherry picked from commit 7750ba7033)

* Remove the @NotNull's because they are overridden by expansion devs anyways, and it turns out people can make them null anyways. This adds a hashcode check and pretty error for it.

(cherry picked from commit f5386d4ca5)

* Fix version checker to compare the individual semver numbers instead of combining it together.

(cherry picked from commit ef5cd9d376)

* Update src/main/java/me/clip/placeholderapi/updatechecker/UpdateChecker.java

Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
(cherry picked from commit ccf4f59343)

* Re-add NotNull's

(cherry picked from commit 2bfd8e7e5e)

* Removed nullcheck from hashcode, and moved it up the chain.

* POJO to help with checking that expansions have all required methods implemented.

* Add method implementation checking and nullchecking for fields.

* Appease the Pigman

* Revert build.gradle dependencies change

* Fixed duplicate files

* Sync Dev with master (#659)

* Add contributing and expansion section

* Start using new Issue template system

* Create bug_report.yml

* Rename feature_request.md to feature_request_old.md

* Create feature_request.yml

* fix unique name

* Update feature_request_old.md

* Add Checkboxes

* Add checkboxes

* disable default issue body

* Delete bug_report_old.md

* Delete feature_request_old.md

* Rename bug_report_new.yml to bug_report.yml

* Check if deleting this fixed the PR...

* Use description in favour of about

* improve feature_request.md

* Update bug_report.yml

* Assign "Type: Issue (Unconfirmed)" label

* Use lists and not comma-separated string

* Update feature_request.yml

* Use id option for error and dump fields

* Add field for logs

* Remove deprecated issue_body type

* Update feature_request.yml

* Improve description of bug_report.yml

* Initial 1.17 Changes

* add render

* Revert build.gradle dependencies change

* Fixed duplicate files

Co-authored-by: PiggyPiglet <PiggyPiglet@users.noreply.github.com>
Co-authored-by: darbyjack <admin@glaremasters.me>

* Initial test on adventure

* started moving to pure adventure

* finished kyori impl

* added 1.17 to nmsversion (what does this even do)

* removed dev for release

* added dev back

* Switch to differen wiki action

Co-authored-by: darbyjack <admin@glaremasters.me>
Co-authored-by: ElijahRus250 <64851720+ElijahRus250@users.noreply.github.com>
Co-authored-by: PiggyPiglet <PiggyPiglet@users.noreply.github.com>
Co-authored-by: Huynh Tien <huynhqtienvtag@gmail.com>
Co-authored-by: Vaishnav Anil <vaishnavanil7th@gmail.com>
Co-authored-by: Starmism <iamstarmism@gmail.com>
Co-authored-by: PiggyPiglet <noreply@piggypiglet.me>
2021-09-09 18:31:29 +02:00
Andre_601 5412b484f8
Merge pull request #706 from NotMyFault/feature/wiki/update-plotsquared
Update PlotSquared placeholders
2021-09-03 02:05:39 +02:00
NotMyFault af2f625224
Update PlotSquared placeholders 2021-09-03 00:05:42 +02:00
Andre_601 d2a4f038d0
Merge pull request #705 from DailyStruggle/Add-RTP-Placeholders
add RTP placeholders
2021-09-01 13:39:13 +02:00
Andre_601 7e28dc0a41
Merge pull request #698 from PlaceholderAPI/feature/change-wiki-action
Switch to differen wiki action
2021-09-01 13:38:30 +02:00
Andre_601 b82948c87a
fix link 2021-09-01 13:38:15 +02:00
Andre_601 39c68e8f87
fix url and padding 2021-09-01 13:37:19 +02:00
Leaf26 5a24387f3d fix spacing 2021-08-31 22:39:02 -04:00
Leaf26 cd429bd7d7 adding a few more 2021-08-31 22:38:03 -04:00
Leaf26 a383a73b24 add RTP placeholders 2021-08-31 21:41:32 -04:00
Andre_601 7baaa5233d
Merge pull request #703 from PyvesB/patch-1
Update Advanced Achievements information
2021-08-30 13:06:35 +02:00
Pierre-Yves B b35035390e
Simplify link format
Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
2021-08-30 12:05:14 +01:00
Pierre-Yves B 1b0a3bc09d
Simplify link format
Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
2021-08-30 12:05:04 +01:00
Pierre-Yves B 3817f52158
Add Advanced Achievements placeholders 2021-08-30 11:44:47 +01:00
Pierre-Yves B 663f149d74
Add Advanced Achievements placeholders 2021-08-30 11:43:26 +01:00
Pierre-Yves B 3da8f00664
Update Advanced Achievements links 2021-08-30 11:18:11 +01:00
Andre_601 c24c75c8c0
Merge pull request #701 from LielAmar/docs/wiki
Added Two Factor Authentication to PlaceholderAPI's wiki
2021-08-27 16:19:13 +02:00
Liel c401adee86 Added Two Factor Authentication to PlaceholderAPI's wiki 2021-08-27 16:24:51 +03:00
Andre_601 1dd3e1fc0d
Switch to differen wiki action 2021-08-26 22:42:05 +02:00
Andre_601 1f53daf416
Some more corrections 2021-08-23 01:58:15 +02:00
Andre_601 8105beeee0
Improve grammar of PlaceholderExpansion.md 2021-08-23 01:52:10 +02:00
Andre_601 8c9a20c035
Merge pull request #696 from TeamVK/docs/wiki
added new placeholders for TokenEnchant
2021-08-22 12:17:49 +02:00
vk2gpz c1d2effe7e
added new placeholders for TokenEnchant
renamed rawcost to fullcost.
added costmax 
```%tokenenchant_<enchantment>_costmax% : cost to increment the enchantmnt level to its maax one from the current level 
%tokenenchant_<enchantment>_fullcostmax% : cost to enchant the max level from 0 level 
%tokenenchant_<enchantment>_fullcost_<X>% : cost to enchant the <X> level from 0 level
```
2021-08-22 09:42:02 +10:00
Andre_601 2eda4b1335
Add missing commands to wiki 2021-08-15 15:44:27 +02:00
Andre_601 ff72450d3f
Merge pull request #692 from BlitzOffline/docs/wiki
Added placeholders from the String expansion
2021-08-15 00:00:41 +02:00
BlitzOffline a654262196
Added placeholders frmo the String expansion 2021-08-15 00:04:17 +03:00
Andre_601 fa705e4572
Merge pull request #689 from TeamVK/docs/wiki
added missing baltop related placeholders and multiplier related placeholders.
2021-08-08 23:24:37 +02:00
vk2gpz e687a06d6e
added missing baltop related placeholders 2021-08-09 07:19:25 +10:00
darbyjack 08c43d25e7
Add Java Version to /papi dump command 2021-08-04 14:16:15 -05:00
Andre_601 48da25659d
Merge pull request #685 from AfkF24/docs/wiki
Update Placeholders.md
2021-07-31 16:46:22 +02:00
AfkF24 905c9e83ee
Apply suggestions from code review
Woop, thanks

Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
2021-07-31 16:44:46 +02:00
AfkF24 54ddc9fd4d
Update Placeholders.md
Swap Kingdoms+ for KingdomsX and add link to wiki
2021-07-31 16:23:25 +02:00
Andre601 fe0bb12d53 Add missing [<expansion>] prefix 2021-07-31 00:11:24 +02:00
Andre_601 e6da5f291e
Merge pull request #683 from TeamVK/docs/wiki
Update Placeholders.md
2021-07-29 00:36:40 +02:00
vk2gpz d674893312
Update Placeholders.md
added %levelup_pickaxe_block_count%, %levelup_bow_kill_count%, %levelup_sword_kill_count%
2021-07-29 07:27:27 +10:00
Andre_601 9da9e8c20f
Merge pull request #680 from BlitzOffline/docs/wiki
added changeoutput expansion placeholders
2021-07-24 14:01:29 +02:00
BlitzOffline 33c309ee8e
used inline code instead 2021-07-24 14:17:14 +03:00
BlitzOffline 62c3261a00
added changeoutput expansion placeholders 2021-07-24 14:00:42 +03:00
Funnycube c393392b85
Update Placeholders.md 2021-07-24 17:39:38 +10:00
Funnycube fbf91d6393
Merge pull request #679 from TeamVK/docs/wiki
added RandomNumber and LevelUp entries.
2021-07-24 17:30:49 +10:00
vk2gpz 8d30c4c99d
added RandomNumber and LevelUp entries. 2021-07-24 17:12:03 +10:00
Andre601 721904335d Add overload for Throwable 2021-07-22 23:56:29 +02:00
Andre601 d79f9725bd Add logging options to PlaceholderExpansion 2021-07-22 23:31:48 +02:00
Andre_601 eb2decb93d
Merge pull request #676 from M0diis/docs/wiki
Update Placeholders.md
2021-07-22 22:14:10 +02:00
M0dii d2192e3195
Update Plugins-using-PlaceholderAPI.md
Added VenturaCalendar.
2021-07-22 23:11:09 +03:00
M0dii c01acfba77
Update Placeholders.md
Change resource ID.
2021-07-22 21:54:44 +03:00
M0dii a494add04c
Update Placeholders.md 2021-07-22 21:48:38 +03:00
Andre_601 059047905f
Update formatter placeholders 2021-07-22 17:28:06 +02:00
Andre_601 fa717c34ef
fix code examples 2021-07-22 12:56:56 +02:00
Andre_601 e16287405b
Update nav entries (#674)
* Update nav entries

* Update Home.md
2021-07-22 01:36:43 +02:00
Andre_601 afdf80bf00
Rework PlaceholderExpansion page (#654)
* Rework PlaceholderExpansion page

* typo

* Implement suggestions of FunnyCube

* Apply suggestions from code review

Co-authored-by: Star <iamstarmism@gmail.com>

* Update wiki/PlaceholderExpansion.md

Co-authored-by: Star <iamstarmism@gmail.com>

* Rename "With a Plugin (Internal Jar)" to "With a Plugin (Internal Class)"

Co-authored-by: Star <iamstarmism@gmail.com>
2021-07-22 01:29:30 +02:00
Andre_601 ec7943fe0a
Fix formatting too 2021-07-17 22:23:28 +02:00
Andre_601 6493963d8a
Forgot the list-entry 2021-07-17 22:22:22 +02:00
Andre_601 c48e11bd70
Add OreMarket placeholders (#671)
* Add OreMarket placeholders

* Update Plugins-using-PlaceholderAPI.md

* Add URL
2021-07-17 22:18:53 +02:00
Andre_601 b4f6831e54
Update development from master (#662)
* Add contributing and expansion section

* Start using new Issue template system

* Create bug_report.yml

* Rename feature_request.md to feature_request_old.md

* Create feature_request.yml

* fix unique name

* Update feature_request_old.md

* Add Checkboxes

* Add checkboxes

* disable default issue body

* Delete bug_report_old.md

* Delete feature_request_old.md

* Rename bug_report_new.yml to bug_report.yml

* Check if deleting this fixed the PR...

* Use description in favour of about

* improve feature_request.md

* Update bug_report.yml

* Assign "Type: Issue (Unconfirmed)" label

* Use lists and not comma-separated string

* Update feature_request.yml

* Use id option for error and dump fields

* Add field for logs

* Remove deprecated issue_body type

* Update feature_request.yml

* Improve description of bug_report.yml

* Initial 1.17 Changes

* add render

* Revert build.gradle dependencies change

* Fixed duplicate files

* Initial test on adventure

* started moving to pure adventure

* finished kyori impl

* added 1.17 to nmsversion (what does this even do)

* removed dev for release

* added dev back

Co-authored-by: PiggyPiglet <PiggyPiglet@users.noreply.github.com>
Co-authored-by: darbyjack <admin@glaremasters.me>
Co-authored-by: PiggyPiglet <noreply@piggypiglet.me>
2021-07-11 01:37:09 +02:00
PiggyPiglet 6348c88c6f
added dev back 2021-07-10 12:17:08 +08:00
PiggyPiglet 5fb45d13da
removed dev for release 2021-07-10 12:16:37 +08:00
Andre_601 7b50453294
Add new Essentials placeholders 2021-07-03 17:56:32 +02:00
Andre_601 ba71486151
Merge pull request #655 from LOOHP/docs/wiki
Update InteractionVisualizer placeholders
2021-06-30 11:35:46 +02:00
LOOHP e1269d6c86 Update InteractionVisualizer placeholders 2021-06-30 13:48:22 +08:00
Andre_601 aa9ac65d02
Merge pull request #650 from SaltyAimbOtter/patch-1
update BetonQuest docs link
2021-06-25 23:34:36 +02:00
SaltyAimbOtter ba983f7fb3
update BetonQuest docs link 2021-06-25 23:23:04 +02:00
Andre_601 2c223ffc87
Merge pull request #647 from cj89898/docs/wiki
Added 2.3.0 Checkitem changes
2021-06-20 18:38:27 +02:00
cj89898 5571ba5d70
Added 2.3.0 Checkitem changes 2021-06-20 10:49:28 -05:00
Andre_601 b77b1b9649
Update Placeholders.md 2021-06-17 14:49:16 +02:00
Andre_601 bf9b34eb57
Merge pull request #645 from stumper66/docs/wiki
LevelledMobs Wiki Addition
2021-06-17 14:45:07 +02:00
Penal Buffalo 215fd7e3f0
Update wiki/Placeholders.md
Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
2021-06-17 07:44:14 -05:00
stumper66 aca624c2d3 LevelledMobs
Added LevelledMobs info to the wiki
2021-06-17 07:26:07 -05:00
Andre_601 5826390251
Merge pull request #642 from garagepoort/feature/add_staffplusplus_wiki
Add staff++ to the wiki
2021-06-15 21:59:55 +02:00
David Maes a91a5c85ba Better phrasing 2021-06-15 21:57:47 +02:00
David Maes 156243a549 Add staff++ to the wiki 2021-06-15 21:52:32 +02:00
Andre_601 eceb236121
Merge pull request #640 from cj89898/docs/wiki
Update Placeholders.md
2021-06-11 11:43:03 +02:00
cj89898 2c8314200f
Update Placeholders.md
Added 2.2.0 checkitem placeholder
2021-06-10 21:52:36 -05:00
Andre_601 0b70ea61aa
Merge pull request #639 from darbyjack/docs/wiki
Added in some missing placeholders for Player Expansion
2021-06-09 16:00:38 +02:00
darbyjack ac31e107ad
Added in some missing placeholders 2021-06-09 08:58:49 -05:00
Andre_601 b9230ef9c5
Merge pull request #631 from broken1arrow/docs/wiki
Docs/wiki
2021-05-13 14:58:20 +02:00
broken1arrow 06e6765870 Try for the 10 times to make it right
See if this work better
2021-05-13 14:45:46 +02:00
broken1arrow 5ac579e878 Revert "Has change and add descriptions"
This reverts commit a4d8009ce4.
2021-05-13 14:41:33 +02:00
broken1arrow a4d8009ce4 Has change and add descriptions
Try other way and see if this work better to pull uppdates.
2021-05-12 17:19:05 +02:00
Andre_601 0df265881a
Add CalculateNumbers 2021-05-12 00:03:34 +02:00
Andre_601 5dbd58076a
Add %rng_online_player% 2021-05-08 14:17:19 +02:00
Andre_601 c3922de323
Update Commands.md 2021-05-07 23:45:29 +02:00
Andre_601 0f118f12bc
Merge pull request #626 from Lorenzo0111/patch-1
Update RocketPlaceholders documentation url
2021-05-04 17:12:15 +02:00
Lorenzo edd3153acd
Update documentation url 2021-05-04 16:24:18 +02:00
Andre601 230e36c55e [Wiki] Add Lands 2021-04-23 00:08:00 +02:00
Andre_601 0f7294972e
Merge pull request #618 from PlaceholderAPI/feature/improve-placeholders-page
Redesign Placeholders page and other pages
2021-04-22 23:53:37 +02:00
Andre601 30b5abda19 Fix wrong links 2021-04-20 23:30:43 +02:00
Andre601 a8e996fa26 Redesign Placeholders page and other pages 2021-04-20 23:21:24 +02:00
Andre_601 3f83312454
Merge pull request #616 from Warriorrrr/update-towny-placeholders
Update Towny placeholders
2021-04-18 03:23:41 +02:00
Warrior 0b1bd1c265 Forgot the dot. 2021-04-18 02:40:30 +02:00
Warrior b747720f36 Update towny placeholders 2021-04-18 02:33:40 +02:00
Andre_601 be34f28fd3
Merge pull request #615 from Hempfest/docs/wiki
Docs/wiki
2021-04-17 11:45:31 +02:00
Hempfest 9843d84ac3
Updated Clans Pro Listing.
New placeholders.
2021-04-17 02:43:19 -07:00
Andre_601 37de42f4a7
Merge pull request #613 from MysteriousKyle/docs/wiki
Addition of a plugin using PalaceholderAPI
2021-04-14 18:01:05 +02:00
Kyle 5595bc144f Addition of a plugin using PalaceholderAPI 2021-04-14 10:56:27 -05:00
Andre_601 9b2e7bb3ca
Merge pull request #611 from thienbao860/patch-2
Update placeholders, clear Spectator expansion
2021-04-13 18:23:16 +02:00
thienbao860 8b5ead7a13
Update placeholders, clear Spectator expansion 2021-04-13 23:18:39 +07:00
Andre_601 b3ea920b41
Merge pull request #608 from CMPSCjg/patch-1
Add 2 New TokensPlus Placeholders
2021-04-12 17:52:22 +02:00
CMPSCjg 001fa6bcf2
Add 2 New TokensPlus Placeholders 2021-04-12 11:49:16 -04:00
Andre_601 09043c6aaf
Merge pull request #607 from RobinDeBaets/patch-1
Add %statistic_mob_kills%
2021-04-10 17:24:03 +02:00
RobinDeBaets f711500d80
Add %statistic_mob_kills% 2021-04-10 17:01:54 +02:00
Andre_601 8d6aa7c801
Merge pull request #606 from Lorenzo0111/patch-1
Edit RocketPlaceholders on the wiki
2021-04-02 19:36:09 +02:00
Lorenzo 04968cb437
Update Plugins-using-PlaceholderAPI.md 2021-04-02 17:01:52 +02:00
Andre_601 048c539fff
Merge pull request #604 from Paul19988/docs/wiki
Add entry for Expansion "TeamsExpansion"
2021-03-31 17:28:49 +02:00
Andre_601 501d1bbbdd
Add minor corrections 2021-03-31 17:28:14 +02:00
Paul Baird e4a6faa22a
Corrected ecloud link for name change 2021-03-31 16:09:15 +01:00
Paul Baird c3bdc90168
Corrected entry and added ecloud command 2021-03-31 15:59:44 +01:00
Paul Baird 79ec3c8f95
Added TeamExpansion in correct place 2021-03-31 15:29:46 +01:00
Paul Baird e9e4caf989
Add TeamsExpansion placeholder expansion 2021-03-31 15:24:25 +01:00
Andre_601 0b1a3ced9e
Merge pull request #602 from matahombres/patch-3
Update advancements placeholder
2021-03-27 17:14:34 +01:00
matahombres b55261a62f
Update advancements placeholder 2021-03-27 17:06:25 +01:00
Andre_601 8c633c8943
Merge pull request #600 from LOOHP/docs/wiki
Add %interactivechat_invdisplaylayout% placeholder
2021-03-26 14:58:56 +01:00
LOOHP 8757217fb6 Add %interactivechat_invdisplaylayout% placeholder 2021-03-26 21:53:43 +08:00
Andre_601 a65de95b16
Merge pull request #599 from Alpha018/wiki_update
modify: Change wiki to use new placeholder
2021-03-25 07:11:49 +01:00
Alpha018 fb8572313e modify: Change wiki to use new placeholder 2021-03-25 03:07:49 -03:00
vk2gpz 2fc28777b7
added %vkautopickup_autosmelt% and %vkautopickup_autoblock% to VKAutoPickup. 2021-03-25 12:56:26 +11:00
Andre_601 ffd493fea9
Merge pull request #597 from CMPSCjg/patch-2
Add TokensPlus Placeholder
2021-03-24 21:37:32 +01:00
Andre_601 b207cbf03e
Add plugin to Plugins using PlaceholderAPI page 2021-03-24 21:37:06 +01:00
CMPSCjg 72239801d8
Update Placeholders.md 2021-03-24 16:19:33 -04:00
CMPSCjg 33ff83d102
Update wiki/Placeholders.md
My bad, thought I updated the URL to reflect this format.

Co-authored-by: Andre_601 <11576465+Andre601@users.noreply.github.com>
2021-03-24 16:16:04 -04:00
CMPSCjg 031625e241
Add TokensPlus Placeholder 2021-03-24 15:58:13 -04:00
90 changed files with 1191 additions and 7996 deletions

4
.github/CODEOWNERS vendored
View File

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

View File

@ -1,8 +1,9 @@
[issue]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new
[discord]: https://helpch.at/discord
[code of conduct]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/CODE_OF_CONDUCT.md
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki
[dev]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/development
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki
[master]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/master
[docs-wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/docs/wiki
[style]: https://github.com/PlaceholderAPI/PlaceholderAPI/tree/master/config/style
# Contributing Guidelines
@ -37,15 +38,29 @@ PlaceholderAPI provides a feature to have expansions (separate jar files) for pl
In those cases should you report the issue to the issue tracker of the expansion or plugin.
## Pull requests
As an open source project are we welcoming all contributions to improve PlaceholderAPI, being it changes to its code like bug fixes or new features, or contributions to its documentation such as the [Wiki] or the Javadoc.
As an open source project are we welcoming all contributions to improve PlaceholderAPI, being it changes to its code, or contributions to its documentation such as the [Wiki] or the Javadocs.
> [!IMPORTANT]
> When contributing, make sure to both base of and target the mentioned branch. Pull requests targeting the wrong branch may get closed without a warning.
### Code contributions
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.
> **Source and Target Branch:** [`master`][master]
### 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.
When contributing towards the code of PlaceholderAPI, be it new features or just bug fixes, your changes should follow the general code styling used in the project.
You can find the necessary files in the [`config/style`][style] directory of this repository.
### Javadocs contributions
> **Source and Target Branch:** [`master`][master]*
Javadocs changes should usually be combined with [code contributions](#code-contributions) when possible, but if not, make sure the changes are significant enough to warrant a new build on our CI server.
\*This branch may change in the future.
### Wiki contributions
> **Source and Target Branch:** [`wiki`][docs-wiki]
The Wiki of PlaceholderAPI is located on its own dedicated branch, hosting all the assets and files that get used to create it through the usage of GitHub Actions and GitHub Pages.
We welcome contributions that update outdated information, add new expansions/plugins supporting PlaceholderAPI or even correct spelling mistakes and typos.
## Code of Conduct
We have a [Code of Conduct] to maintain a welcoming atmosphere in this project.

View File

@ -24,6 +24,8 @@ body:
required: true
- label: The issue isn't already fixed in a Spigot Release or Development Build.
required: true
- label: The [Common Issues](https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Common-Issues) page doesn't mention this issue.
required: true
- type: dropdown
attributes:
label: "Type"

View File

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

View File

@ -1,7 +1,8 @@
comment:
footer: "\
----\n\n
> *This is an automated response created by a **GitHub Action***\n
> [!NOTE]\n
> *This is an automated response created by a **GitHub Action***<br>
> *Mentioning the bot won't have any effect!*
"
@ -35,11 +36,12 @@ labels:
Your issue unfortunately lacks certain information that we require in order to help you with your issue.
Please make sure you provide the following information:
- Currently used Versions of your server and PlaceholderAPI
- Currently installed Expansions
- Currently installed Plugins
- Currently used Versions of your server (`/version`) and PlaceholderAPI (`/version PlaceholderAPI`)
- Currently installed Expansions (`/papi list`)
- Currently installed Plugins (`/pl`)
- Any additional information requested by users in this issue.
The easiest way to provide those information is through the `/papi dumb` command which posts the required information to https://paste.helpch.at and gives a URL to share.
The easiest way to provide those information is through the `/papi dump` command which posts the required information to https://paste.helpch.at and gives a URL to share.
unlabeled:
issue:
body: |-
@ -50,18 +52,18 @@ labels:
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.
This means that it either doesn't follow any provided template, or isn't related to PlaceholderAPI.
Please make sure to use one of the issue templates and provide the requested information.
Currently available Templates are:
- [Bug Report](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=bug_report.md)
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?template=feature_request.md)
- [Bug Report](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?labels=Type%3A+Issue+%28Unconfirmed%29&template=bug_report.yml)
- [Feature Request](https://github.com/PlaceholderAPI/PlaceholderAPI/issues/new?labels=Type%3A+Enhancement&template=feature_request.yml)
If you want changes to be made towards the Wiki, would we encourage you to [Make a Pull request](https://github.com/PlaceholderAPI/PlaceholderAPI/pulls).
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/wiki/README.md).
You can find more information about this process on the [Wiki's Readme](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md).
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive faster response compared to the issue tracker here.
It is recommended to [join our Discord Server](https://helpch.at/discord) as you often receive a faster response compared to the issue tracker here.
Questions about PlaceholderAPI should be asked in our [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions).
action: close
pr:
@ -71,11 +73,20 @@ labels:
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.
- Pull requests for PlaceholderAPI should target the `master` branch.
- Pull requests for the Wiki should target the `wiki` branch.
Don't hesitate to ask us any questions.
action: close
- name: 'Type: Invalid (Wiki)'
labeled:
pr:
body: |-
Your Wiki Pull request has been marked as **invalid**.
Pull requests targeting the Wiki need to target the `wiki` branch.
More information can be found on the [Wiki README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md).
action: close
- name: 'Target: Wiki'
labeled:
issue:
@ -83,12 +94,11 @@ labels:
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.
We would like to inform you, that you are able to directly commit your changes to the wiki through a Pull request.
When doing so, make sure you follow these steps:
- The Pull request 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.
- The Pull request is based on AND targets the [`wiki`](https://github.com/PlaceholderAPI/PlaceholderAPI/tree/wiki) branch of the Repository.
- You followed the general Styling Guidelines mentioned in the wiki's [README](https://github.com/PlaceholderAPI/PlaceholderAPI/blob/wiki/README.md) file.
If you have any questions about submitting a PR for the wiki or have any other questions don't hesitate to ask us about it.
- name: 'Type: Not a bug'
@ -112,7 +122,7 @@ labels:
The issue has been marked as **inactive** which means it didn't recieve any responses from the Author ({{ issue.user.login }}) for a long period of time.
To keep the issue-tracker clean and up to date do we close issues that haven't received any responses for a long time.
If you're the Author of this issue and the reported problem is still present, make sure to respond with additional info to this issue.
If you're the Author of this issue and the reported problem is still present, make sure to respond with additional info to this issue, so that we can reopen it.
**Do not create a new issue for the same problem!**
action: close
unlabeled:
@ -126,7 +136,7 @@ labels:
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.
We would like to inform you, that we have [Discussions](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions) that you can use for asking questions.
Just head over there and click the "New discussion" button to create a new post.
Remember to first read the [READ ME](https://github.com/PlaceholderAPI/PlaceholderAPI/discussions/507) post to not face any issues.

24
.github/release.yml vendored Normal file
View File

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

View File

@ -10,13 +10,13 @@ on:
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]
name: "Compile jar against ${{ matrix.java-version }}"
runs-on: ubuntu-latest
steps:
- name: "Checkout Code"
uses: actions/checkout@v2

View File

@ -1,52 +0,0 @@
#
# This is a GitHub Action that allows us to auto-update the wiki
# when a Pull request changes specific files in a folder.
#
name: Update Wiki
on:
push:
#
# Only trigger when the push changes any files in the wiki-folder.
#
paths:
- 'wiki/**'
branches:
- 'docs/wiki'
#
# Releases cause this action to also fire.
# Using this prevents this problem.
#
tags-ignore:
- '**'
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Code'
uses: actions/Checkout@v2
- name: 'Update Wiki'
uses: docker://decathlon/wiki-page-creator-action:latest
env:
#
# We can use the E-Mail and Name of the GitHub Actions account
# for our convenience.
#
ACTION_MAIL: 'actions@github.com'
ACTION_NAME: 'github-actions[bot]'
#
# We (sadly) have to use a PAT (Personal Access Token) for this action.
#
GH_PAT: '${{ secrets.WORKFLOWPAT }}'
OWNER: 'PlaceholderAPI'
REPO_NAME: 'PlaceholderAPI'
#
# We only want to target files in the wiki folder
#
MD_FOLDER: 'wiki'
WIKI_PUSH_MESSAGE: '${{ github.event.commits[0].message }}'
#
# We skip/ignore the README.md file in the Wiki folder
#
SKIP_MD: README.md

View File

@ -7,6 +7,8 @@
[discord]: https://helpch.at/discord
[spigot]: https://www.spigotmc.org/resources/6245/
[hangar]: https://hangar.papermc.io/HelpChat/PlaceholderAPI
[bbb]: https://builtbybit.com/resources/placeholderapi.24306
[Expansions cloud]: https://api.extendedclip.com/home
[placeholder list]: https://helpch.at/placeholders
[statistics]: https://bstats.org/plugin/bukkit/PlaceholderAPI
@ -15,10 +17,10 @@
[ciImg]: http://ci.extendedclip.com/buildStatus/icon?job=PlaceholderAPI
[APIversionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
[logo]: https://i.imgur.com/Ea4PURv.png
[logo]: https://wiki.placeholderapi.com/assets/img/papi-logo.png
[contributing]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/.github/CONTRIBUTING.md
[placeholderexpansion]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/PlaceholderExpansion
[placeholderexpansion]: https://wiki.placeholderapi.com/developers/creating-a-placeholderexpansion/
<!-- The stuff above isn't visible in the readme -->
[![logo]][spigot]
@ -28,9 +30,9 @@
# Information
[PlaceholderAPI][spigot] is a plugin for Spigot servers that allows server owners to display information from various plugins with a uniform format.
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 150+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
Support for specific plugins are provided either by the plugin itself or through expansions. The expansions may be downloaded in-game through the PAPI Expansion Cloud. There are currently over 240+ expansions that support a wide variety of plugins, such as Essentials, Factions, LuckPerms, and Vault.
PlaceholderAPI has been downloaded over 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.
PlaceholderAPI has been downloaded over 1,000,000 times and has been used concurrently on over 40,000 servers, which makes it a must-have for a server of any type or scale.
## Contribute
If you would like to contribute towards PlaceholderAPI should you take a look at our [Contributing file][contributing] for the ins and outs on how you can do that and what you need to keep in mind.
@ -47,4 +49,6 @@ If you would like to create your own Placeholder Expansion for PlaceholderAPI, t
- [Expansions Cloud]
- [Placeholder List]
- [Spigot Page][spigot]
- [Hangar Page][hangar]
- [BuiltByBit Page][bbb]
- [Plugin Statistics][statistics]

View File

@ -1,132 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id "java"
id "maven-publish"
id "org.cadixdev.licenser" version "0.6.0"
id "com.github.johnrengelman.shadow" version "7.0.0"
}
group "me.clip"
version "2.10.10-DEV-${System.getProperty("BUILD_NUMBER")}"
description "An awesome placeholder provider!"
repositories {
maven({ url = "https://oss.sonatype.org/content/repositories/snapshots/" })
mavenCentral()
mavenLocal()
maven({ url = "https://repo.codemc.org/repository/maven-public" })
maven({ url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" })
}
dependencies {
implementation "org.bstats:bstats-bukkit:2.2.1"
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"
compileOnly "org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT"
compileOnly "org.jetbrains:annotations:19.0.0"
testImplementation "org.openjdk.jmh:jmh-core:1.23"
testImplementation "org.openjdk.jmh:jmh-generator-annprocess:1.23"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.6.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
}
processResources {
filter ReplaceTokens, tokens: [name: rootProject.name, version: project.version.toString(), description: project.description]
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
failOnError false
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
shadowJar {
archiveClassifier.set("")
relocate "org.bstats", "me.clip.placeholderapi.metrics"
relocate "net.kyori", "me.clip.placeholderapi.libs.kyori"
}
license {
include '**/*.java'
matching('**/*.java') {
header = file('config/headers/main.txt')
}
ext {
year = 2021
}
}
test {
useJUnitPlatform()
}
configurations {
testImplementation {
extendsFrom(compileOnly)
}
}
publishing {
repositories {
maven {
if (version.contains("-DEV")) {
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
} else {
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
credentials {
username = System.getenv("JENKINS_USER")
password = System.getenv("JENKINS_PASS")
}
}
}
publications {
mavenJava(MavenPublication) {
artifactId = "placeholderapi"
from components.java
pom.withXml {
// some are having issues with bstats so we might need to add that to the pom as well
asNode().appendNode("packaging", "jar")
asNode().remove(asNode().get("dependencies"))
def dependenciesNode = asNode().appendNode("dependencies")
// jetbrains annotations
def jetbrainsAnnotations = dependenciesNode.appendNode("dependency")
jetbrainsAnnotations.appendNode("groupId", "org.jetbrains")
jetbrainsAnnotations.appendNode("artifactId", "annotations")
jetbrainsAnnotations.appendNode("version", "19.0.0")
}
}
}
}
publish.dependsOn clean, test, jar

128
build.gradle.kts Normal file
View File

@ -0,0 +1,128 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
`java-library`
`maven-publish`
id("com.github.hierynomus.license") version "0.16.1"
id("com.github.johnrengelman.shadow") version "8.1.0"
}
group = "me.clip"
version = "2.11.6-DEV-${System.getProperty("BUILD_NUMBER")}"
description = "An awesome placeholder provider!"
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/")
mavenCentral()
mavenLocal()
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
dependencies {
implementation("org.bstats:bstats-bukkit:3.0.1")
implementation("net.kyori:adventure-platform-bukkit:4.3.1")
compileOnly("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
compileOnlyApi("org.jetbrains:annotations:23.0.0")
testImplementation("org.openjdk.jmh:jmh-core:1.32")
testImplementation("org.openjdk.jmh:jmh-generator-annprocess:1.32")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}
license {
header = rootProject.file("config/headers/main.txt")
include("**/*.java")
mapping("java", "JAVADOC_STYLE")
encoding = "UTF-8"
ext {
set("year", 2024)
}
}
val javaComponent: SoftwareComponent = components["java"]
tasks {
processResources {
eachFile { expand("version" to project.version) }
}
build {
dependsOn(named("shadowJar"))
}
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Javadoc> {
isFailOnError = false
with(options as StandardJavadocDocletOptions) {
addStringOption("Xdoclint:none", "-quiet")
addStringOption("encoding", "UTF-8")
addStringOption("charSet", "UTF-8")
}
}
withType<ShadowJar> {
archiveClassifier.set("")
relocate("org.bstats", "me.clip.placeholderapi.metrics")
relocate("net.kyori", "me.clip.placeholderapi.libs.kyori")
}
test {
useJUnitPlatform()
}
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "placeholderapi"
from(javaComponent)
}
}
repositories {
maven {
if ("-DEV" in version.toString()) {
url = uri("https://repo.extendedclip.com/content/repositories/dev/")
} else {
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
credentials {
username = System.getenv("JENKINS_USER")
password = System.getenv("JENKINS_PASS")
}
}
}
}
publish.get().setDependsOn(listOf(build.get()))
}
configurations {
testImplementation {
extendsFrom(compileOnly.get())
}
}

View File

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

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

269
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright <EFBFBD> 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,67 +17,101 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions <20>$var<61>, <20>${var}<7D>, <20>${var:-default}<7D>, <20>${var+SET}<7D>,
# <20>${var#prefix}<7D>, <20>${var%suffix}<7D>, and <20>$( cmd )<29>;
# * compound commands having a testable exit status, especially <20>case<73>;
# * various built-in commands including <20>command<6E>, <20>set<65>, and <20>ulimit<69>.
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@ -106,80 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

View File

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

1
settings.gradle.kts Normal file
View File

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

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -22,6 +22,7 @@ package me.clip.placeholderapi;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
@ -81,7 +82,7 @@ public final class PlaceholderAPI {
*/
@NotNull
public static List<String> setPlaceholders(final OfflinePlayer player,
@NotNull final List<@NotNull String> text) {
@NotNull final List<String> text) {
return text.stream().map(line -> setPlaceholders(player, line)).collect(Collectors.toList());
}
@ -136,7 +137,7 @@ public final class PlaceholderAPI {
*/
@NotNull
public static List<String> setBracketPlaceholders(final OfflinePlayer player,
@NotNull final List<@NotNull String> text) {
@NotNull final List<String> text) {
return text.stream().map(line -> setBracketPlaceholders(player, line))
.collect(Collectors.toList());
}
@ -185,7 +186,7 @@ public final class PlaceholderAPI {
continue;
}
String identifier = format.substring(0, index).toLowerCase();
String identifier = format.substring(0, index).toLowerCase(Locale.ROOT);
String params = format.substring(index + 1);
final PlaceholderExpansion expansion = PlaceholderAPIPlugin.getInstance()
.getLocalExpansionManager().getExpansion(identifier);
@ -201,7 +202,7 @@ public final class PlaceholderAPI {
}
}
return Msg.color(text);
return text;
}
/**
@ -292,14 +293,14 @@ public final class PlaceholderAPI {
// === Deprecated API ===
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean registerExpansion(PlaceholderExpansion expansion)
{
return expansion.register();
}
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean unregisterExpansion(PlaceholderExpansion expansion)
{
return expansion.unregister();
@ -313,7 +314,7 @@ public final class PlaceholderAPI {
* @return Map of registered placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static Map<String, PlaceholderHook> getPlaceholders() {
return PlaceholderAPIPlugin.getInstance().getLocalExpansionManager()
.getExpansions().stream()
@ -329,12 +330,11 @@ public final class PlaceholderAPI {
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean registerPlaceholderHook(Plugin plugin, PlaceholderHook placeholderHook) {
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!"
+ " Please reach out to " + plugin.getDescription().getAuthors().toString()
+ " and let them know that they need to update ASAP!");
Msg.warn("Nag author(s) %s of plugin %s about their usage of the deprecated PlaceholderHook"
+ " class! This class will be removed in v2.13.0!", plugin.getDescription().getAuthors(),
plugin.getName());
return false;
}
@ -347,11 +347,11 @@ public final class PlaceholderAPI {
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean registerPlaceholderHook(String identifier,
PlaceholderHook placeholderHook) {
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
+ " is attempting to register placeholders via a PlaceholderHook class which is no longer supported!");
Msg.warn("%s is attempting to register placeholders via deprecated PlaceholderHook class."
+ " This class is no longer supported and will be removed in v2.13.0!", identifier);
return false;
}
@ -363,12 +363,11 @@ public final class PlaceholderAPI {
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean unregisterPlaceholderHook(Plugin plugin) {
PlaceholderAPIPlugin.getInstance().getLogger().warning(plugin.getName()
+ " is attempting to unregister placeholders via the PlaceholderAPI class which is no longer supported!"
+ " Please reach out to " + plugin.getDescription().getAuthors().toString()
+ " and let them know that they need to update ASAP!");
Msg.warn("Nag author(s) %s of plugin %s about their usage of the PlaceholderAPI class."
+ " This way of unregistering placeholders is no longer supported and will be removed"
+ " in v2.13.0!", plugin.getDescription().getAuthors(), plugin.getName());
return false;
}
@ -380,10 +379,11 @@ public final class PlaceholderAPI {
* @return always false
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static boolean unregisterPlaceholderHook(String identifier) {
PlaceholderAPIPlugin.getInstance().getLogger().warning(identifier
+ " is attempting to unregister placeholders through the PlaceholderAPI class which is no longer supported!");
Msg.warn("%s is attempting to unregister placeholders via PlaceholderAPI class."
+ " This way of unregistering placeholders is no longer supported and will be removed"
+ " in v2.13.0!", identifier);
return false;
}
@ -393,7 +393,7 @@ public final class PlaceholderAPI {
* @return Set of registered identifiers
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static Set<String> getRegisteredPlaceholderPlugins() {
return getRegisteredIdentifiers();
}
@ -404,7 +404,7 @@ public final class PlaceholderAPI {
* @return always null
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static Set<String> getExternalPlaceholderPlugins() {
return null;
}
@ -419,7 +419,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setPlaceholders(OfflinePlayer player,
String text, Pattern pattern, boolean colorize) {
return setPlaceholders(player, text);
@ -435,7 +435,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setPlaceholders(OfflinePlayer player,
List<String> text, Pattern pattern, boolean colorize) {
return setPlaceholders(player, text);
@ -450,7 +450,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
boolean colorize) {
return setPlaceholders(player, text);
@ -465,7 +465,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setPlaceholders(OfflinePlayer player, List<String> text,
Pattern pattern) {
return setPlaceholders(player, text);
@ -479,7 +479,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setPlaceholders(Player player, String text, boolean colorize) {
return setPlaceholders(player, text);
}
@ -493,7 +493,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setPlaceholders(Player player, List<String> text, boolean colorize) {
return setPlaceholders(player, text);
}
@ -507,7 +507,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setPlaceholders(OfflinePlayer player, String text, boolean colorize) {
return setPlaceholders(player, text);
}
@ -521,7 +521,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setPlaceholders(OfflinePlayer player, String text, Pattern pattern) {
return setPlaceholders(player, text);
}
@ -535,7 +535,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setBracketPlaceholders(OfflinePlayer player, List<String> text,
boolean colorize) {
return setBracketPlaceholders(player, text);
@ -550,7 +550,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setBracketPlaceholders(OfflinePlayer player, String text, boolean colorize) {
return setBracketPlaceholders(player, text);
}
@ -564,7 +564,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setBracketPlaceholders(Player player, String text, boolean colorize) {
return setBracketPlaceholders(player, text);
}
@ -578,7 +578,7 @@ public final class PlaceholderAPI {
* @return String with the parsed placeholders
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setBracketPlaceholders(Player player, List<String> text,
boolean colorize) {
return setBracketPlaceholders(player, text);
@ -596,7 +596,7 @@ public final class PlaceholderAPI {
* @deprecated Use {@link #setPlaceholders(OfflinePlayer, String)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static String setRelationalPlaceholders(Player one, Player two, String text,
boolean colorize) {
return setRelationalPlaceholders(one, two, text);
@ -614,7 +614,7 @@ public final class PlaceholderAPI {
* @deprecated Use {@link #setRelationalPlaceholders(Player, Player, List)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public static List<String> setRelationalPlaceholders(Player one, Player two, List<String> text,
boolean colorize) {
return setRelationalPlaceholders(one, two, text);

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -21,9 +21,9 @@
package me.clip.placeholderapi;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import me.clip.placeholderapi.commands.PlaceholderCommandRouter;
import me.clip.placeholderapi.configuration.PlaceholderAPIConfig;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
@ -32,8 +32,8 @@ import me.clip.placeholderapi.expansion.manager.CloudExpansionManager;
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
import me.clip.placeholderapi.listeners.ServerLoadEventListener;
import me.clip.placeholderapi.updatechecker.UpdateChecker;
import me.clip.placeholderapi.util.Msg;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.serializer.craftbukkit.MinecraftComponentSerializer;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.AdvancedPie;
import org.bstats.charts.SimplePie;
@ -56,7 +56,18 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
private static PlaceholderAPIPlugin instance;
static {
final String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
String version = Bukkit.getServer().getBukkitVersion().split("-")[0];
String suffix;
if (version.chars()
.filter(c -> c == '.')
.count() == 1) {
suffix = "R1";
version = 'v' + version.replace('.', '_') + '_' + suffix;
} else {
int minor = Integer.parseInt(version.split("\\.")[2].charAt(0) + "");
version = 'v' + version.replace('.', '_').replace("_" + minor, "") + '_' + "R" + (minor - 1);
}
boolean isSpigot;
try {
@ -122,11 +133,13 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
try {
return new SimpleDateFormat(getInstance().getPlaceholderAPIConfig().dateFormat());
} catch (final IllegalArgumentException ex) {
getInstance().getLogger().log(Level.WARNING, "configured date format is invalid", ex);
Msg.warn("Configured date format ('%s') is invalid! Defaulting to 'MM/dd/yy HH:mm:ss'",
ex, getInstance().getPlaceholderAPIConfig().dateFormat());
return new SimpleDateFormat("MM/dd/yy HH:mm:ss");
}
}
@Deprecated
public static Version getServerVersion() {
return VERSION;
}
@ -249,7 +262,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
try {
Class.forName("org.bukkit.event.server.ServerLoadEvent");
new ServerLoadEventListener(this);
} catch (final ExceptionInInitializerError | ClassNotFoundException ignored) {
} catch (final ClassNotFoundException ignored) {
Bukkit.getScheduler()
.runTaskLater(this, () -> getLocalExpansionManager().load(Bukkit.getConsoleSender()), 1);
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -23,17 +23,19 @@ package me.clip.placeholderapi;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class PlaceholderHook {
@Nullable
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
if (player != null && player.isOnline()) {
return onPlaceholderRequest((Player) player, params);
return onPlaceholderRequest(player.getPlayer(), params);
}
return onPlaceholderRequest(null, params);
}
@Nullable
public String onPlaceholderRequest(final Player player, @NotNull final String params) {
return null;
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -23,6 +23,7 @@ package me.clip.placeholderapi.commands;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
@ -61,7 +62,7 @@ public abstract class PlaceholderCommand {
if (parameter == null) {
possible.forEach(suggestions::add);
} else {
possible.filter(suggestion -> suggestion.toLowerCase().startsWith(parameter.toLowerCase()))
possible.filter(suggestion -> suggestion.toLowerCase(Locale.ROOT).startsWith(parameter.toLowerCase(Locale.ROOT)))
.forEach(suggestions::add);
}
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -27,6 +27,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
@ -95,7 +96,7 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
return true;
}
final String search = args[0].toLowerCase();
final String search = args[0].toLowerCase(Locale.ROOT);
final PlaceholderCommand target = commands.get(search);
if (target == null) {
@ -121,10 +122,10 @@ public final class PlaceholderCommandRouter implements CommandExecutor, TabCompl
final List<String> suggestions = new ArrayList<>();
if (args.length > 1) {
final PlaceholderCommand target = this.commands.get(args[0].toLowerCase());
final PlaceholderCommand target = this.commands.get(args[0].toLowerCase(Locale.ROOT));
if (target != null) {
target.complete(plugin, sender, args[0].toLowerCase(),
target.complete(plugin, sender, args[0].toLowerCase(Locale.ROOT),
Arrays.asList(Arrays.copyOfRange(args, 1, args.length)), suggestions);
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -22,10 +22,6 @@ package me.clip.placeholderapi.commands.impl.cloud;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.util.Msg;
@ -33,12 +29,17 @@ import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Stream;
public final class CommandECloud extends PlaceholderCommand {
@Unmodifiable
private static final List<PlaceholderCommand> COMMANDS = ImmutableList
.of(new CommandECloudClear(),
new CommandECloudToggle(),
new CommandECloudStatus(),
new CommandECloudUpdate(),
new CommandECloudRefresh(),
@ -78,8 +79,6 @@ public final class CommandECloud extends PlaceholderCommand {
Msg.msg(sender,
"&b&lPlaceholderAPI &8- &7eCloud Help Menu &8- ",
" ",
"&b/papi &fenable/disable/toggle",
" &7&oEnable or disable the eCloud",
"&b/papi &fecloud status",
" &7&oView status of the eCloud",
"&b/papi &fecloud list <all/{author}/installed> {page}",
@ -100,7 +99,7 @@ public final class CommandECloud extends PlaceholderCommand {
return;
}
final String search = params.get(0).toLowerCase();
final String search = params.get(0).toLowerCase(Locale.ROOT);
final PlaceholderCommand target = commands.get(search);
if (target == null) {
@ -114,10 +113,8 @@ public final class CommandECloud extends PlaceholderCommand {
return;
}
if (!(target instanceof CommandECloudToggle) && !plugin.getPlaceholderAPIConfig()
.isCloudEnabled()) {
Msg.msg(sender,
"&cThe eCloud Manager is not enabled!");
if (!plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
Msg.msg(sender, "&cThe eCloud Manager is not enabled! To enable it, set 'cloud_enabled' to true and reload the plugin.");
return;
}
@ -136,7 +133,7 @@ public final class CommandECloud extends PlaceholderCommand {
return; // send sub commands
}
final String search = params.get(0).toLowerCase();
final String search = params.get(0).toLowerCase(Locale.ROOT);
final PlaceholderCommand target = commands.get(search);
if (target == null) {

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

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

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -87,7 +87,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
@NotNull
private static Collection<CloudExpansion> getExpansions(@NotNull final String target,
@NotNull final PlaceholderAPIPlugin plugin) {
switch (target.toLowerCase()) {
switch (target.toLowerCase(Locale.ROOT)) {
case "all":
return plugin.getCloudExpansionManager().getCloudExpansions().values();
case "installed":
@ -112,7 +112,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
public static void addExpansionTitle(@NotNull final StringBuilder builder,
@NotNull final String target, final int page) {
switch (target.toLowerCase()) {
switch (target.toLowerCase(Locale.ROOT)) {
case "all":
builder.append("&bAll Expansions");
break;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -38,9 +38,7 @@ public final class CommandECloudRefresh extends PlaceholderCommand {
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params) {
plugin.getCloudExpansionManager().clean();
plugin.getCloudExpansionManager()
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
plugin.getCloudExpansionManager().load();
Msg.msg(sender,
"&aThe eCloud manager has been refreshed!");

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -54,7 +54,7 @@ public final class CommandECloudStatus extends PlaceholderCommand {
if (updateCount > 0) {
builder.append("&eYou have &f").append(updateCount)
.append(updateCount > 1 ? "&e expansions" : "&e expansion").append("installed that ")
.append(updateCount > 1 ? "&e expansions" : "&e expansion").append(" installed that ")
.append(updateCount > 1 ? "have an" : "has an").append(" update available.");
}

View File

@ -1,72 +0,0 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlaceholderAPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.clip.placeholderapi.commands.impl.cloud;
import java.util.List;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.util.Msg;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
public final class CommandECloudToggle extends PlaceholderCommand {
public CommandECloudToggle() {
super("toggle", "enable", "disable");
}
@Override
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params) {
final boolean desiredState;
final boolean currentState = plugin.getPlaceholderAPIConfig().isCloudEnabled();
switch (alias.toLowerCase()) {
case "enable":
desiredState = true;
break;
case "disable":
desiredState = false;
break;
default:
desiredState = !currentState;
break;
}
if (desiredState == currentState) {
Msg.msg(sender, "&7The eCloud Manager is already " + (desiredState ? "enabled" : "disabled"));
return;
}
plugin.getPlaceholderAPIConfig().setCloudEnabled(desiredState);
if (desiredState) {
plugin.getCloudExpansionManager().load();
} else {
plugin.getCloudExpansionManager().kill();
}
Msg.msg(sender, "&aThe eCloud Manager has been " + (desiredState ? "enabled" : "disabled"));
}
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -23,6 +23,7 @@ package me.clip.placeholderapi.commands.impl.cloud;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@ -128,7 +129,7 @@ public final class CommandECloudUpdate extends PlaceholderCommand {
installed.removeIf(expansion -> !expansion.shouldUpdate());
if (!installed.isEmpty() && (params.isEmpty() || "all"
.startsWith(params.get(0).toLowerCase()))) {
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
suggestions.add("all");
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -106,7 +106,6 @@ public final class CommandDump extends PlaceholderCommand {
}
try (final InputStream stream = connection.getInputStream()) {
//noinspection UnstableApiUsage
final String json = CharStreams.toString(new InputStreamReader(stream, StandardCharsets.UTF_8));
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
}
@ -134,18 +133,15 @@ public final class CommandDump extends PlaceholderCommand {
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
.getExpansions()
.stream()
.sorted(Comparator.comparing(PlaceholderExpansion::getIdentifier))
.sorted(Comparator.comparing(PlaceholderExpansion::getAuthor))
.sorted(
Comparator.comparing(PlaceholderExpansion::getIdentifier)
.thenComparing(PlaceholderExpansion::getAuthor)
)
.collect(Collectors.toList());
int size = 0;
for (final String name : expansions.stream().map(PlaceholderExpansion::getIdentifier)
.collect(Collectors.toList())) {
if (name.length() > size) {
size = name.length();
}
}
int size = expansions.stream().map(e -> e.getIdentifier().length())
.max(Integer::compareTo)
.orElse(0);
for (final PlaceholderExpansion expansion : expansions) {
builder.append(" ")
@ -165,12 +161,17 @@ public final class CommandDump extends PlaceholderCommand {
final String[] jars = plugin.getLocalExpansionManager()
.getExpansionsFolder()
.list((dir, name) -> name.toLowerCase().endsWith(".jar"));
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
for (final String jar : jars) {
builder.append(" ")
.append(jar)
.append('\n');
if (jars == null) {
builder.append(" ¨[Warning]: Could not load jar files from expansions folder.");
} else {
for (final String jar : jars) {
builder.append(" ")
.append(jar)
.append('\n');
}
}
builder.append('\n');
@ -179,6 +180,10 @@ public final class CommandDump extends PlaceholderCommand {
.append(plugin.getServer().getBukkitVersion())
.append('/')
.append(plugin.getServer().getVersion())
.append("\n");
builder.append("Java Version: ")
.append(System.getProperty("java.version"))
.append("\n\n");
builder.append("Plugin Info:")
@ -187,18 +192,17 @@ public final class CommandDump extends PlaceholderCommand {
List<Plugin> plugins = Arrays.stream(plugin.getServer().getPluginManager().getPlugins())
.sorted(Comparator.comparing(Plugin::getName))
.collect(Collectors.toList());
for (final String pluginName : plugins.stream().map(Plugin::getName)
.collect(Collectors.toList())) {
if (pluginName.length() > size) {
size = pluginName.length();
}
}
size = plugins.stream().map(pl -> pl.getName().length())
.max(Integer::compareTo)
.orElse(0);
for (final Plugin other : plugins) {
builder.append(" ")
.append(String.format("%-" + size + "s", other.getName()))
.append(" [Version: ")
.append(" [Authors: [")
.append(String.join(", ", other.getDescription().getAuthors()))
.append("], Version: ")
.append(other.getDescription().getVersion())
.append("]")
.append("\n");

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -54,7 +54,7 @@ public final class CommandExpansionRegister extends PlaceholderCommand {
final LocalExpansionManager manager = plugin.getLocalExpansionManager();
final File file = new File(manager.getExpansionsFolder(), params.get(0));
if (!file.exists()) {
if (!file.exists() || !file.getParentFile().equals(manager.getExpansionsFolder())) {
Msg.msg(sender,
"&cThe file &f" + file.getName() + "&c doesn't exist!");
return;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -45,9 +45,9 @@ public final class CommandHelp extends PlaceholderCommand {
Msg.msg(sender,
"&b&lPlaceholderAPI &8- &7Help Menu &8- &7(&f" + description.getVersion() + "&7)",
" ",
"&b/papi &fbcparse &9<me/player name> <message>",
"&b/papi &fbcparse &9<me|--null|player name> <message>",
" &7&oParse a message with placeholders and broadcast it",
"&b/papi &fcmdparse &9<me/player> <command with placeholders>",
"&b/papi &fcmdparse &9<me|player> <command with placeholders>",
" &7&oParse a message with relational placeholders",
"&b/papi &fdump",
" &7&oDump all relevant information needed to help debug issues into a paste link.",
@ -55,7 +55,7 @@ public final class CommandHelp extends PlaceholderCommand {
" &7&oView information for a specific expansion",
"&b/papi &flist",
" &7&oList active expansions",
"&b/papi &fparse &9<me/player name> <message>",
"&b/papi &fparse &9<me|--null|player name> <message>",
" &7&oParse a message with placeholders",
"&b/papi &fparserel &9<player one> <player two> <message>",
" &7&oParse a message with relational placeholders",

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -22,6 +22,7 @@ package me.clip.placeholderapi.commands.impl.local;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Stream;
import me.clip.placeholderapi.PlaceholderAPI;
@ -29,7 +30,6 @@ import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.commands.PlaceholderCommand;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.util.Msg;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
@ -49,7 +49,7 @@ public final class CommandParse extends PlaceholderCommand {
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params) {
switch (alias.toLowerCase()) {
switch (alias.toLowerCase(Locale.ROOT)) {
case "parserel":
evaluateParseRelation(sender, params);
break;
@ -69,7 +69,7 @@ public final class CommandParse extends PlaceholderCommand {
public void complete(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
switch (alias.toLowerCase()) {
switch (alias.toLowerCase(Locale.ROOT)) {
case "parserel":
completeParseRelation(params, suggestions);
break;
@ -92,7 +92,7 @@ public final class CommandParse extends PlaceholderCommand {
return;
}
@NotNull final OfflinePlayer player;
OfflinePlayer player;
if ("me".equalsIgnoreCase(params.get(0))) {
if (!(sender instanceof Player)) {
@ -101,6 +101,8 @@ public final class CommandParse extends PlaceholderCommand {
}
player = ((Player) sender);
} else if ("--null".equalsIgnoreCase(params.get(0))) {
player = null;
} else {
final OfflinePlayer target = resolvePlayer(params.get(0));
if (target == null) {
@ -120,13 +122,9 @@ public final class CommandParse extends PlaceholderCommand {
}
if (broadcast) {
Msg.broadcast(message);
Bukkit.broadcastMessage(message);
} else {
if (!(sender instanceof Player)) {
Msg.msg(sender, message);
} else {
((Player) sender).spigot().sendMessage(TextComponent.fromLegacyText(message));
}
sender.sendMessage(message);
}
}
@ -153,7 +151,8 @@ public final class CommandParse extends PlaceholderCommand {
final String message = PlaceholderAPI
.setRelationalPlaceholders(((Player) targetOne), ((Player) targetTwo),
String.join(" ", params.subList(2, params.size())));
Msg.msg(sender, message);
sender.sendMessage(message);
}
@ -161,10 +160,14 @@ public final class CommandParse extends PlaceholderCommand {
@NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions) {
if (params.size() <= 1) {
if (sender instanceof Player && (params.isEmpty() || "me"
.startsWith(params.get(0).toLowerCase()))) {
.startsWith(params.get(0).toLowerCase(Locale.ROOT)))) {
suggestions.add("me");
}
if ("--null".startsWith(params.get(0).toLowerCase(Locale.ROOT))) {
suggestions.add("--null");
}
final Stream<String> names = Bukkit.getOnlinePlayers().stream().map(Player::getName);
suggestByParameter(names, suggestions, params.isEmpty() ? null : params.get(0));

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -38,10 +38,6 @@ public final class PlaceholderAPIConfig {
return plugin.getConfig().getBoolean("check_updates");
}
public boolean cloudAllowUnverifiedExpansions() {
return plugin.getConfig().getBoolean("cloud_allow_unverified_expansions");
}
public boolean isCloudEnabled() {
return plugin.getConfig().getBoolean("cloud_enabled");

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -27,8 +27,11 @@ import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Indicates that a {@link PlaceholderExpansion} has been registered by
* PlaceholderAPI.
* This event indicates that a <b>single</b> {@link PlaceholderExpansion PlaceholderExpansion} has
* been registered in PlaceholderAPI.
*
* <p>To know when <b>all</b> Expansions have been registered, use the
* {@link me.clip.placeholderapi.events.ExpansionsLoadedEvent ExpansionsLoadedEvent} instead.
*/
public final class ExpansionRegisterEvent extends Event implements Cancellable {
@ -48,15 +51,25 @@ public final class ExpansionRegisterEvent extends Event implements Cancellable {
}
/**
* The {@link PlaceholderExpansion expansion} that was registered.
* The {@link PlaceholderExpansion PlaceholderExpansion} that was registered in PlaceholderAPI.
* <br>The PlaceholderExpansion will be available for use when the event
* {@link #isCancelled() was not cancelled}!
*
* @return The {@link PlaceholderExpansion} instance.
* @return Current instance of the registered {@link PlaceholderExpansion PlaceholderExpansion}
*/
@NotNull
public PlaceholderExpansion getExpansion() {
return expansion;
}
/**
* Indicates if this event was cancelled or not.
* <br>A cancelled Event will result in the {@link #getExpansion() PlaceholderExpansion} NOT
* being added to PlaceholderAPI's internal list and will therefore be considered not registered
* anymore.
*
* @return Whether the event has been cancelled or not.
*/
@Override
public boolean isCancelled() {
return cancelled;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -26,15 +26,19 @@ import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Indicates that a {@link PlaceholderExpansion} had been unregistered by
* PlaceholderAPI.
* This event indicates that a {@link PlaceholderExpansion PlaceholderExpansion} has been
* unregistered by PlaceholderAPI.
*
* <p>Note that this event is triggered <b>before</b> the PlaceholderExpansion is completely
* removed.
* <br>This includes removing any Listeners, stopping active tasks and clearing the cache of
* the PlaceholderExpansion.
*/
public final class ExpansionUnregisterEvent extends Event {
@NotNull
private static final HandlerList HANDLERS = new HandlerList();
@NotNull
private final PlaceholderExpansion expansion;
@ -48,9 +52,9 @@ public final class ExpansionUnregisterEvent extends Event {
}
/**
* The {@link PlaceholderExpansion expansion} that was unregistered.
* The {@link PlaceholderExpansion PlaceholderExpansion} that was unregistered.
*
* @return The {@link PlaceholderExpansion} instance.
* @return The {@link PlaceholderExpansion PlaceholderExpansion} instance.
*/
@NotNull
public PlaceholderExpansion getExpansion() {

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -21,18 +21,42 @@
package me.clip.placeholderapi.events;
import java.util.Collections;
import java.util.List;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Indicates that <b>all</b> {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlayceholderExpansions}
* have been loaded.
* <br/>This event is fired on Server load and when reloading the
* confiuration.
* This event indicated that <b>all</b> {@link PlaceholderExpansion PlaceholderExpansions} have
* been registered in PlaceholderAPI and can now be used.
* <br>This even will also be triggered whenever PlaceholderAPI gets reloaded.
*
* <p>All PlaceholderExpansions, except for those loaded by plugins, are loaded
* after Spigot triggered its ServerLoadEvent (1.13+), or after PlaceholderAPI has been enabled.
*/
public class ExpansionsLoadedEvent extends Event {
private final List<PlaceholderExpansion> expansions;
public ExpansionsLoadedEvent(List<PlaceholderExpansion> expansions) {
this.expansions = Collections.unmodifiableList(expansions);
}
/**
* Returns a unmodifiable list of {@link PlaceholderExpansion PlaceholderExpansions} that
* have been registered by PlaceholderAPI.
*
* <p><b>This list does not include manually registered PlaceholderExpansions.</b>
*
* @return List of {@link PlaceholderExpansion registered PlaceholderExpansions}.
*/
@NotNull
public final List<PlaceholderExpansion> getExpansions(){
return expansions;
}
@NotNull
private static final HandlerList HANDLERS = new HandlerList();

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -21,9 +21,11 @@
package me.clip.placeholderapi.expansion;
/**
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the clear
* method called when the implementing expansion is unregistered from PlaceholderAPI. This is useful
* if we want to do things when the implementing hook is unregistered
* Classes implementing this interface will have a {@link #clear() clear void} that is called
* by PlaceholderAPI whenever the {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
* is unregistered.
*
* <p>This allows you to execute things such as clearing internal caches, saving data to files, etc.
*
* @author Ryan McCarthy
*/

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -23,9 +23,11 @@ package me.clip.placeholderapi.expansion;
import org.bukkit.entity.Player;
/**
* This interface allows a class which extends a {@link PlaceholderExpansion} to have the cleanup
* method called every time a player leaves the server. This is useful if we want to clean up after
* the player
* Classes implementing this interface will have a {@link #cleanup(Player) cleanup void} that is
* called by PlaceholderAPI whenever a Player leaves the server.
*
* <p>This can be useful for cases where you keep data of the player in a cache or similar
* and want to free up space whenever they leave.
*
* @author Ryan McCarthy
*/

View File

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

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -42,7 +42,15 @@ public enum NMSVersion {
SPIGOT_1_16_R1("v1_16_R1"),
SPIGOT_1_16_R2("v1_16_R2"),
SPIGOT_1_16_R3("v1_16_R3"),
SPIGOT_1_17_R1("v1_17_R1");
SPIGOT_1_17_R1("v1_17_R1"),
SPIGOT_1_18_R1("v1_18_R1"),
SPIGOT_1_19_R1("v1_19_R1"),
SPIGOT_1_19_R2("v1_19_R2"),
SPIGOT_1_19_R3("v1_19_R3"),
SPIGOT_1_20_R1("v1_20_R1"),
SPIGOT_1_20_R2("v1_20_R2"),
SPIGOT_1_20_R3("v1_20_R3"),
SPIGOT_1_20_R4("v1_20_R4");
private final String version;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -22,6 +22,7 @@ package me.clip.placeholderapi.expansion;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.PlaceholderHook;
import org.bukkit.Bukkit;
@ -39,6 +40,14 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class PlaceholderExpansion extends PlaceholderHook {
/**
* The type is {@link Type#INTERNAL} by default.
* For external expansions, the type is updated on {@link me.clip.placeholderapi.expansion.manager.LocalExpansionManager#register(Class) register}.
* @since 2.11.4
*/
@ApiStatus.Internal
protected Type expansionType = Type.INTERNAL;
/**
* The placeholder identifier of this expansion. May not contain {@literal %},
* {@literal {}} or _
@ -158,6 +167,27 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
return PlaceholderAPIPlugin.getInstance();
}
/**
* Get the type of the expansion
*
* @return the type of the expansion
* @since 2.11.4
*/
@ApiStatus.Internal
public Type getExpansionType() {
return expansionType;
}
/**
* Set the type of the expansion
* @param expansionType the new type
* @since 2.11.4
*/
@ApiStatus.Internal
public void setExpansionType(Type expansionType) {
this.expansionType = expansionType;
}
// === Configuration ===
/**
@ -165,7 +195,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
* null when not specified.
* <br>You may use the {@link Configurable} interface to define default values set
*
* @return ConfigurationSection that this epxpansion has.
* @return ConfigurationSection that this expansion has.
*/
@Nullable
public final ConfigurationSection getConfigSection() {
@ -275,7 +305,6 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
* @param def The default boolean to return when the ConfigurationSection is null
* @return boolean from the provided path or the default one provided
*/
@NotNull
public final boolean getBoolean(@NotNull final String path, final boolean def) {
final ConfigurationSection section = getConfigSection();
return section == null ? def : section.getBoolean(path, def);
@ -293,6 +322,71 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
final ConfigurationSection section = getConfigSection();
return section != null && section.contains(path);
}
/**
* Logs the provided message with the provided Level in the console.
* <br>The message will be prefixed with {@link #getName() <code>[&lt;expansion name&gt;]</code>}
*
* @param level The Level at which the message should be logged with
* @param msg The message to log
*/
public void log(Level level, String msg) {
getPlaceholderAPI().getLogger().log(level, "[" + getName() + "] " + msg);
}
/**
* Logs the provided message and Throwable with the provided Level in the console.
* <br>The message will be prefixed with {@link #getName() <code>[&lt;expansion name&gt;]</code>}
*
* @param level The Level at which the message should be logged with
* @param msg The message to log
* @param throwable The Throwable to log
*/
public void log(Level level, String msg, Throwable throwable) {
getPlaceholderAPI().getLogger().log(level, "[" + getName() + "] " + msg, throwable);
}
/**
* Logs the provided message with Level "info".
* <br>The message will be prefixed with {@link #getName() <code>[&lt;expansion name&gt;]</code>}
*
* @param msg The message to log
*/
public void info(String msg) {
log(Level.INFO, msg);
}
/**
* Logs the provided message with Level "warning".
* <br>The message will be prefixed with {@link #getName() <code>[&lt;expansion name&gt;]</code>}
*
* @param msg The message to log
*/
public void warning(String msg) {
log(Level.WARNING, msg);
}
/**
* Logs the provided message with Level "severe" (error).
* <br>The message will be prefixed with {@link #getName() <code>[&lt;expansion name&gt;]</code>}
*
* @param msg The message to log
*/
public void severe(String msg) {
log(Level.SEVERE, msg);
}
/**
* Logs the provided message and Throwable with Level "severe" (error).
* <br>The message will be prefixed with {@link #getName() <code>[&lt;expansion name&gt;]</code>}
*
* @param msg The message to log
* @param throwable The Throwable to log
*/
public void severe(String msg, Throwable throwable) {
log(Level.SEVERE, msg, throwable);
}
/**
* Whether the provided Object is an instance of this PlaceholderExpansion.
@ -329,8 +423,8 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
*/
@Override
public final String toString() {
return String.format("PlaceholderExpansion[name: '%s', author: '%s', version: '%s']", getName(),
getAuthor(), getVersion());
return String.format("PlaceholderExpansion[name: '%s', author: '%s', version: '%s', type: '%s']", getName(),
getAuthor(), getVersion(), getExpansionType());
}
// === Deprecated API ===
@ -341,7 +435,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
* @return The plugin name.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public String getPlugin() {
return null;
}
@ -352,7 +446,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
* @return The description of the expansion.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public String getDescription() {
return null;
}
@ -363,8 +457,23 @@ public abstract class PlaceholderExpansion extends PlaceholderHook {
* @return The link for the expansion.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2.11.0")
@ApiStatus.ScheduledForRemoval(inVersion = "2.13.0")
public String getLink() {
return null;
}
public enum Type {
/**
* An expansion provided by a plugin is considered internal
*/
INTERNAL,
/**
* An expansion loaded from the expansions folder is considered external
*/
EXTERNAL
}
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -22,7 +22,22 @@ package me.clip.placeholderapi.expansion;
import org.bukkit.entity.Player;
/**
* Implementing this interface allows your {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}
* to be used as a relational placeholder expansion.
*
* <p>Relational placeholders take two Players as input and are always prefixed with {@code rel_},
* so {@code %foo_bar%} becomes {@code %rel_foo_bar%}
*/
public interface Relational {
/**
* This method is called whenever a placeholder starting with {@code rel_} is called.
*
* @param one The first player used for the placeholder.
* @param two The second player used for the placeholder.
* @param identifier The text right after the expansion's name (%expansion_<b>identifier</b>%)
* @return Parsed String from the expansion.
*/
String onPlaceholderRequest(Player one, Player two, String identifier);
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -20,18 +20,24 @@
package me.clip.placeholderapi.expansion;
/**
* Implementing this interface adds the {@link #start() start} and {@link #stop() stop} void
* methods to your {@link me.clip.placeholderapi.expansion.PlaceholderExpansion PlaceholderExpansion}.
*
* <p>This can be used to execute methods and tasks whenever the PlaceholderExpansion has been
* successfully (un)registered.
*/
public interface Taskable {
/**
* Called when the implementing class has successfully been registered to the placeholder map
* Tasks that need to be performed when this expansion is registered should go here
* Called when the implementing class has successfully been registered to the placeholder map.
* <br>Tasks that need to be performed when this expansion is registered should go here
*/
void start();
/**
* Called when the implementing class has been unregistered from PlaceholderAPI Tasks that need to
* be performed when this expansion has unregistered should go here
* Called when the implementing class has been unregistered from PlaceholderAPI.
* <br>Tasks that need to be performed when this expansion has unregistered should go here
*/
void stop();
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -20,6 +20,7 @@
package me.clip.placeholderapi.expansion;
@Deprecated
public final class Version {
private final boolean isSpigot;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -27,7 +27,10 @@ package me.clip.placeholderapi.expansion;
* with that version.
*
* @author Ryan McCarthy
*
* @deprecated Will be removed in a future release.
*/
@Deprecated
public interface VersionSpecific {
/**

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -171,7 +171,7 @@ public class CloudExpansion {
this.versions = versions;
}
public class Version {
public static class Version {
private String url, version, release_notes;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -37,6 +37,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@ -52,6 +53,7 @@ import java.util.stream.Collectors;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
import me.clip.placeholderapi.util.Msg;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
@ -88,7 +90,7 @@ public final class CloudExpansionManager {
@NotNull
private static String toIndexName(@NotNull final String name) {
return name.toLowerCase().replace(' ', '_');
return name.toLowerCase(Locale.ROOT).replace(' ', '_');
}
@NotNull
@ -98,7 +100,7 @@ public final class CloudExpansionManager {
public void load() {
clean();
fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
fetch();
}
public void kill() {
@ -168,7 +170,7 @@ public final class CloudExpansionManager {
await.clear();
}
public void fetch(final boolean allowUnverified) {
public void fetch() {
plugin.getLogger().info("Fetching available expansion information...");
ASYNC_EXECUTOR.submit(
@ -188,9 +190,6 @@ public final class CloudExpansionManager {
|| expansion.getVersion(expansion.getLatestVersion()) == null) {
toRemove.add(entry.getKey());
}
if (!allowUnverified && !expansion.isVerified()) {
toRemove.add(entry.getKey());
}
}
for (String name : toRemove) {
@ -201,7 +200,7 @@ public final class CloudExpansionManager {
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
}
// loop thru what's left on the main thread
// loop through what's left on the main thread
plugin
.getServer()
.getScheduler()
@ -267,8 +266,7 @@ public final class CloudExpansionManager {
await.remove(toIndexName(expansion));
if (exception != null) {
plugin.getLogger().log(Level.SEVERE,
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
Msg.severe("Failed to download %s:%s", exception, expansion.getName(), expansion.getVersion());
}
}, ASYNC_EXECUTOR);

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -22,11 +22,32 @@ package me.clip.placeholderapi.expansion.manager;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import java.io.File;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.events.ExpansionRegisterEvent;
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
import me.clip.placeholderapi.events.ExpansionsLoadedEvent;
import me.clip.placeholderapi.expansion.*;
import me.clip.placeholderapi.expansion.Cacheable;
import me.clip.placeholderapi.expansion.Cleanable;
import me.clip.placeholderapi.expansion.Configurable;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.Taskable;
import me.clip.placeholderapi.expansion.VersionSpecific;
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
import me.clip.placeholderapi.util.FileUtil;
import me.clip.placeholderapi.util.Futures;
@ -45,16 +66,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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 {
@NotNull
@ -81,7 +92,7 @@ public final class LocalExpansionManager implements Listener {
this.folder = new File(plugin.getDataFolder(), EXPANSIONS_FOLDER_NAME);
if (!this.folder.exists() && !folder.mkdirs()) {
plugin.getLogger().log(Level.WARNING, "failed to create expansions folder!");
Msg.warn("Failed to create expansions folder!");
}
}
@ -125,7 +136,7 @@ public final class LocalExpansionManager implements Listener {
public PlaceholderExpansion getExpansion(@NotNull final String identifier) {
expansionsLock.lock();
try {
return expansions.get(identifier.toLowerCase());
return expansions.get(identifier.toLowerCase(Locale.ROOT));
} finally {
expansionsLock.unlock();
}
@ -160,12 +171,27 @@ public final class LocalExpansionManager implements Listener {
@NotNull final Class<? extends PlaceholderExpansion> clazz) {
try {
final PlaceholderExpansion expansion = createExpansionInstance(clazz);
if(expansion == null){
return Optional.empty();
}
Objects.requireNonNull(expansion.getAuthor(), "The expansion author is null!");
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
if (expansion.getRequiredPlugin() != null && !expansion.getRequiredPlugin().isEmpty()) {
if (!Bukkit.getPluginManager().isPluginEnabled(expansion.getRequiredPlugin())) {
Msg.warn("Cannot load expansion %s due to a missing plugin: %s", expansion.getIdentifier(),
expansion.getRequiredPlugin());
return Optional.empty();
}
}
expansion.setExpansionType(PlaceholderExpansion.Type.EXTERNAL);
if (!expansion.register()) {
Msg.warn("Cannot load expansion %s due to an unknown issue.", expansion.getIdentifier());
return Optional.empty();
}
@ -178,23 +204,32 @@ public final class LocalExpansionManager implements Listener {
} 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);
Msg.severe("Failed to load expansion class %s%s", ex, clazz.getSimpleName(), reason);
}
return Optional.empty();
}
/**
* Attempt to register a {@link PlaceholderExpansion}
* @param expansion the expansion to register
* @return if the expansion was registered
*/
@ApiStatus.Internal
public boolean register(@NotNull final PlaceholderExpansion expansion) {
final String identifier = expansion.getIdentifier().toLowerCase();
final String identifier = expansion.getIdentifier().toLowerCase(Locale.ROOT);
if (!expansion.canRegister()) {
return false;
}
// Avoid loading two external expansions with the same identifier
if (expansion.getExpansionType() == PlaceholderExpansion.Type.EXTERNAL && expansions.containsKey(identifier)) {
Msg.warn("Failed to load external expansion %s. Identifier is already in use.", expansion.getIdentifier());
return false;
}
if (expansion instanceof Configurable) {
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
String pre = "expansions." + identifier + ".";
@ -230,8 +265,8 @@ public final class LocalExpansionManager implements Listener {
if (expansion instanceof VersionSpecific) {
VersionSpecific nms = (VersionSpecific) expansion;
if (!nms.isCompatibleWith(PlaceholderAPIPlugin.getServerVersion())) {
plugin.getLogger().warning("Your server version is not compatible with expansion " +
expansion.getIdentifier() + " " + expansion.getVersion());
Msg.warn("Your server version is incompatible with expansion %s %s",
expansion.getIdentifier(), expansion.getVersion());
return false;
}
}
@ -258,21 +293,25 @@ public final class LocalExpansionManager implements Listener {
if (expansion instanceof Listener) {
Bukkit.getPluginManager().registerEvents(((Listener) expansion), plugin);
}
plugin.getLogger().info("Successfully registered expansion: " + expansion.getIdentifier());
Msg.info(
"Successfully registered %s expansion: %s [%s]",
expansion.getExpansionType().name().toLowerCase(),
expansion.getIdentifier(),
expansion.getVersion()
);
if (expansion instanceof Taskable) {
((Taskable) expansion).start();
}
if (plugin.getPlaceholderAPIConfig().isCloudEnabled()) {
final Optional<CloudExpansion> cloudExpansionOptional =
plugin.getCloudExpansionManager().findCloudExpansionByName(identifier);
// Check eCloud for updates only if the expansion is external
if (plugin.getPlaceholderAPIConfig().isCloudEnabled() && expansion.getExpansionType() == PlaceholderExpansion.Type.EXTERNAL) {
final Optional<CloudExpansion> cloudExpansionOptional = plugin.getCloudExpansionManager().findCloudExpansionByName(identifier);
if (cloudExpansionOptional.isPresent()) {
CloudExpansion cloudExpansion = cloudExpansionOptional.get();
cloudExpansion.setHasExpansion(true);
cloudExpansion.setShouldUpdate(
!cloudExpansion.getLatestVersion().equals(expansion.getVersion()));
cloudExpansion.setShouldUpdate(!cloudExpansion.getLatestVersion().equals(expansion.getVersion()));
}
}
@ -281,7 +320,7 @@ public final class LocalExpansionManager implements Listener {
@ApiStatus.Internal
public boolean unregister(@NotNull final PlaceholderExpansion expansion) {
if (expansions.remove(expansion.getIdentifier()) == null) {
if (expansions.remove(expansion.getIdentifier().toLowerCase(Locale.ROOT)) == null) {
return false;
}
@ -310,27 +349,45 @@ public final class LocalExpansionManager implements Listener {
return true;
}
private void registerAll(@NotNull final CommandSender sender) {
plugin.getLogger().info("Placeholder expansion registration initializing...");
Msg.info("Placeholder expansion registration initializing...");
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
if (exception != null) {
plugin.getLogger().log(Level.SEVERE, "failed to load class files of expansions", exception);
Msg.severe("Failed to load class files of expansion.", exception);
return;
}
final long registered = classes.stream()
final List<PlaceholderExpansion> registered = classes.stream()
.filter(Objects::nonNull)
.map(this::register)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
final long needsUpdate = registered.stream()
.map(expansion -> plugin.getCloudExpansionManager().findCloudExpansionByName(expansion.getName()).orElse(null))
.filter(Objects::nonNull)
.filter(CloudExpansion::shouldUpdate)
.count();
Msg.msg(sender,
registered == 0 ? "&6No expansions were registered!"
: registered + "&a placeholder hooks successfully registered!");
StringBuilder message = new StringBuilder(registered.size() == 0 ? "&6" : "&a")
.append(registered.size())
.append(' ')
.append("placeholder hook(s) registered!");
if (needsUpdate > 0) {
message.append(' ')
.append("&6")
.append(needsUpdate)
.append(' ')
.append("placeholder hook(s) have an update available.");
}
Msg.msg(sender, message.toString());
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent());
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
});
}
@ -346,7 +403,12 @@ public final class LocalExpansionManager implements Listener {
@NotNull
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
return Arrays.stream(folder.listFiles((dir, name) -> name.endsWith(".jar")))
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
if (files == null) {
return CompletableFuture.completedFuture(Collections.emptyList());
}
return Arrays.stream(files)
.map(this::findExpansionInFile)
.collect(Futures.collector());
}
@ -359,8 +421,8 @@ public final class LocalExpansionManager implements Listener {
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.");
Msg.severe("Failed to load expansion %s, as it does not have a class which"
+ " extends PlaceholderExpansion", file.getName());
return null;
}
@ -368,19 +430,17 @@ public final class LocalExpansionManager implements Listener {
.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.");
Msg.severe("Failed to load expansion %s, as it does not have the required"
+ " methods declared for a PlaceholderExpansion.", file.getName());
return null;
}
return expansionClass;
} catch (final VerifyError ex) {
plugin.getLogger().severe("Failed to load Expansion class " + file.getName() +
" (Is a dependency missing?)");
plugin.getLogger().severe("Cause: " + ex.getClass().getSimpleName() + " " + ex.getMessage());
} catch (VerifyError | NoClassDefFoundError e) {
Msg.severe("Failed to load expansion %s (is a dependency missing?)", e, file.getName());
return null;
} catch (final Exception ex) {
throw new CompletionException(ex);
} catch (Exception e) {
throw new CompletionException(e.getMessage() + " (expansion file: " + file.getAbsolutePath() + ")", e);
}
});
}
@ -395,9 +455,8 @@ public final class LocalExpansionManager implements Listener {
if (ex.getCause() instanceof LinkageError) {
throw ((LinkageError) ex.getCause());
}
plugin.getLogger().warning("There was an issue with loading an expansion.");
Msg.warn("There was an issue with loading an expansion.");
return null;
}
}
@ -427,7 +486,8 @@ public final class LocalExpansionManager implements Listener {
}
expansion.unregister();
plugin.getLogger().info("Unregistered placeholder expansion: " + expansion.getName());
Msg.info("Unregistered placeholder expansion %s", expansion.getIdentifier());
Msg.info("Reason: required plugin %s was disabled.", name);
}
}

View File

@ -1,3 +1,23 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlaceholderAPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.clip.placeholderapi.expansion.manager;
import java.util.Arrays;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -39,16 +39,6 @@ public final class ServerLoadEventListener implements Listener {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
/**
* This method will be called when the server is first loaded
* <p>
* The goal of the method is to register all the expansions as soon as possible especially before
* players can join
* <p>
* This will ensure no issues with expansions and hooks.
*
* @param event the server load event
*/
@EventHandler
public void onServerLoad(@NotNull final ServerLoadEvent event) {
HandlerList.unregisterAll(this);

View File

@ -1,178 +1,137 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlaceholderAPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.clip.placeholderapi.replacer;
import java.util.function.Function;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class CharsReplacer implements Replacer {
@NotNull
private final Closure closure;
public CharsReplacer(@NotNull final Closure closure) {
this.closure = closure;
}
@NotNull
@Override
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
final char[] chars = text.toCharArray();
final StringBuilder builder = new StringBuilder(text.length());
final StringBuilder identifier = new StringBuilder();
final StringBuilder parameters = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
final char l = chars[i];
if (l == '&' && ++i < chars.length) {
final char c = Character.toLowerCase(chars[i]);
if (c != '0' && c != '1' && c != '2' && c != '3' && c != '4' && c != '5' && c != '6'
&& c != '7' && c != '8' && c != '9' && c != 'a' && c != 'b' && c != 'c' && c != 'd'
&& c != 'e' && c != 'f' && c != 'k' && c != 'l' && c != 'm' && c != 'n' && c != 'o' && c != 'r'
&& c != 'x') {
builder.append(l).append(chars[i]);
} else {
builder.append(ChatColor.COLOR_CHAR);
if (c != 'x') {
builder.append(chars[i]);
continue;
}
if ((i > 1 && chars[i - 2] == '\\') /*allow escaping &x*/) {
builder.setLength(builder.length() - 2);
builder.append('&').append(chars[i]);
continue;
}
builder.append(c);
int j = 0;
while (++j <= 6) {
if (i + j >= chars.length) {
break;
}
final char x = chars[i + j];
builder.append(ChatColor.COLOR_CHAR).append(x);
}
if (j == 7) {
i += 6;
} else {
builder.setLength(builder.length() - (j * 2)); // undo &x parsing
}
}
continue;
}
if (l != closure.head || i + 1 >= chars.length) {
builder.append(l);
continue;
}
boolean identified = false;
boolean oopsitsbad = true;
boolean hadSpace = false;
while (++i < chars.length) {
final char p = chars[i];
if (p == ' ' && !identified) {
hadSpace = true;
break;
}
if (p == closure.tail) {
oopsitsbad = false;
break;
}
if (p == '_' && !identified) {
identified = true;
continue;
}
if (identified) {
parameters.append(p);
} else {
identifier.append(p);
}
}
final String identifierString = identifier.toString().toLowerCase();
final String parametersString = parameters.toString();
identifier.setLength(0);
parameters.setLength(0);
if (oopsitsbad) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_').append(parametersString);
}
if (hadSpace) {
builder.append(' ');
}
continue;
}
final PlaceholderExpansion placeholder = lookup.apply(identifierString);
if (placeholder == null) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_');
}
builder.append(parametersString).append(closure.tail);
continue;
}
final String replacement = placeholder.onRequest(player, parametersString);
if (replacement == null) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_');
}
builder.append(parametersString).append(closure.tail);
continue;
}
builder.append(ChatColor.translateAlternateColorCodes('&', replacement));
}
return builder.toString();
}
}
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlaceholderAPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.clip.placeholderapi.replacer;
import java.util.Locale;
import java.util.function.Function;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class CharsReplacer implements Replacer {
@NotNull
private final Closure closure;
public CharsReplacer(@NotNull final Closure closure) {
this.closure = closure;
}
@NotNull
@Override
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
final char[] chars = text.toCharArray();
final StringBuilder builder = new StringBuilder(text.length());
final StringBuilder identifier = new StringBuilder();
final StringBuilder parameters = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
final char l = chars[i];
if (l != closure.head || i + 1 >= chars.length) {
builder.append(l);
continue;
}
boolean identified = false;
boolean invalid = true;
boolean hadSpace = false;
while (++i < chars.length) {
final char p = chars[i];
if (p == ' ' && !identified) {
hadSpace = true;
break;
}
if (p == closure.tail) {
invalid = false;
break;
}
if (p == '_' && !identified) {
identified = true;
continue;
}
if (identified) {
parameters.append(p);
} else {
identifier.append(p);
}
}
final String identifierString = identifier.toString();
final String lowercaseIdentifierString = identifierString.toLowerCase(Locale.ROOT);
final String parametersString = parameters.toString();
identifier.setLength(0);
parameters.setLength(0);
if (invalid) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_').append(parametersString);
}
if (hadSpace) {
builder.append(' ');
}
continue;
}
final PlaceholderExpansion placeholder = lookup.apply(lowercaseIdentifierString);
if (placeholder == null) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_');
}
builder.append(parametersString).append(closure.tail);
continue;
}
final String replacement = placeholder.onRequest(player, parametersString);
if (replacement == null) {
builder.append(closure.head).append(identifierString);
if (identified) {
builder.append('_');
}
builder.append(parametersString).append(closure.tail);
continue;
}
builder.append(replacement);
}
return builder.toString();
}
}

View File

@ -1,72 +0,0 @@
/*
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlaceholderAPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.clip.placeholderapi.replacer;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public final class RegexReplacer implements Replacer {
@NotNull
private final Pattern pattern;
public RegexReplacer(@NotNull final Closure closure) {
this.pattern = Pattern.compile(String
.format("\\%s((?<identifier>[a-zA-Z0-9]+)_)(?<parameters>[^%s%s]+)\\%s", closure.head,
closure.head, closure.tail, closure.tail));
}
@NotNull
@Override
public String apply(@NotNull final String text, @Nullable final OfflinePlayer player,
@NotNull final Function<String, @Nullable PlaceholderExpansion> lookup) {
final Matcher matcher = pattern.matcher(text);
if (!matcher.find()) {
return text;
}
final StringBuffer builder = new StringBuffer();
do {
final String identifier = matcher.group("identifier");
final String parameters = matcher.group("parameters");
final PlaceholderExpansion expansion = lookup.apply(identifier);
if (expansion == null) {
continue;
}
final String requested = expansion.onRequest(player, parameters);
matcher.appendReplacement(builder, requested != null ? requested : matcher.group(0));
}
while (matcher.find());
return ChatColor.translateAlternateColorCodes('&', matcher.appendTail(builder).toString());
}
}

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -50,7 +50,7 @@ public final class Format {
}
@NotNull
private static String buildFormat(@NotNull final Align align, @NotNull final int[] spacing) {
private static String buildFormat(@NotNull final Align align, final int[] spacing) {
return stream(spacing)
.mapToObj(space -> "%" + (align == Align.LEFT ? "-" : "") + (space + 2) + "s")
.collect(joining());

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@ -21,14 +21,40 @@
package me.clip.placeholderapi.util;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.stream.Collectors;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public final class Msg {
public static void log(Level level, String msg, Object... args) {
PlaceholderAPIPlugin.getInstance().getLogger().log(level, String.format(msg, args));
}
public static void info(String msg, Object... args) {
log(Level.INFO, msg, args);
}
public static void warn(String msg, Object... args) {
log(Level.WARNING, msg, args);
}
public static void warn(String msg, Throwable throwable, Object... args){
PlaceholderAPIPlugin.getInstance().getLogger().log(Level.WARNING, String.format(msg, args), throwable);
}
public static void severe(String msg, Object... args) {
log(Level.SEVERE, msg, args);
}
public static void severe(String msg, Throwable throwable, Object... args) {
PlaceholderAPIPlugin.getInstance().getLogger().log(Level.SEVERE, String.format(msg, args), throwable);
}
public static void msg(@NotNull final CommandSender sender, @NotNull final String... messages) {
if (messages.length == 0) {
return;

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

@ -2,9 +2,9 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI is free software: you can redistribute it and/or modify
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,7 +23,6 @@ package me.clip.placeholderapi;
import com.google.common.collect.ImmutableMap;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.replacer.CharsReplacer;
import me.clip.placeholderapi.replacer.RegexReplacer;
import me.clip.placeholderapi.replacer.Replacer;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
@ -40,7 +39,6 @@ public interface Values {
Replacer CHARS_REPLACER = new CharsReplacer(Replacer.Closure.PERCENT);
Replacer REGEX_REPLACER = new RegexReplacer(Replacer.Closure.PERCENT);
final class MockPlayerPlaceholderExpansion extends PlaceholderExpansion {

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,19 +30,9 @@ public class ReplacerBenchmarks {
Values.CHARS_REPLACER.apply(Values.SMALL_TEXT, null, Values.PLACEHOLDERS::get);
}
@Benchmark
public void measureRegexReplacerSmallText() {
Values.REGEX_REPLACER.apply(Values.SMALL_TEXT, null, Values.PLACEHOLDERS::get);
}
@Benchmark
public void measureCharsReplacerLargeText() {
Values.CHARS_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get);
}
@Benchmark
public void measureRegexReplacerLargeText() {
Values.REGEX_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get);
}
}

View File

@ -2,7 +2,7 @@
* This file is part of PlaceholderAPI
*
* PlaceholderAPI
* Copyright (c) 2015 - 2021 PlaceholderAPI Team
* Copyright (c) 2015 - 2024 PlaceholderAPI Team
*
* PlaceholderAPI free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,12 +37,6 @@ public final class ReplacerUnitTester {
Values.CHARS_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
}
@Test
void testRegexReplacerProducesExpectedSingleValue() {
assertEquals(PLAYER_NAME,
Values.REGEX_REPLACER.apply("%player_name%", null, Values.PLACEHOLDERS::get));
}
@Test
void testCharsReplacerProducesExpectedSentence() {
assertEquals(String.format(
@ -51,36 +45,14 @@ public final class ReplacerUnitTester {
Values.CHARS_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get));
}
@Test
void testRegexReplacerProducesExpectedSentence() {
assertEquals(String.format(
"My name is %s and my location is (%s, %s, %s), this placeholder is invalid %%server_name%%",
PLAYER_NAME, PLAYER_X, PLAYER_Y, PLAYER_Z),
Values.REGEX_REPLACER.apply(Values.LARGE_TEXT, null, Values.PLACEHOLDERS::get));
}
@Test
void testResultsAreTheSameAsReplacement() {
final String resultChars = Values.CHARS_REPLACER
.apply("%player_name%", null, Values.PLACEHOLDERS::get);
final String resultRegex = Values.REGEX_REPLACER
.apply("%player_name%", null, Values.PLACEHOLDERS::get);
assertEquals(resultChars, resultRegex);
assertEquals(PLAYER_NAME, resultChars);
}
@Test
void testResultsAreTheSameNoReplacement() {
final String resultChars = Values.CHARS_REPLACER
.apply("%player_location%", null, Values.PLACEHOLDERS::get);
final String resultRegex = Values.REGEX_REPLACER
.apply("%player_location%", null, Values.PLACEHOLDERS::get);
assertEquals(resultChars, resultRegex);
}
@Test
void testCharsReplacerIgnoresMalformed() {
final String text = "10% and %hello world 15%";
@ -88,12 +60,4 @@ public final class ReplacerUnitTester {
assertEquals(text, Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
}
@Test
void testCharsReplacerHandlesEscapedHex() {
final String text = "\\&xffffffThis should not change.";
assertEquals(text.substring(1),
Values.CHARS_REPLACER.apply(text, null, Values.PLACEHOLDERS::get));
}
}

View File

@ -1,239 +0,0 @@
This page shows all commands, including with a detailed description of what every command does.
## Overview
- **[Parse Commands](#parse-commands)**
- [`/papi bcparse <player|me> <string>`](#papi-bcparse)
- [`/papi cmdparse <player|me> <string>`](#papi-cmdparse)
- [`/papi parse <player|me> <string>`](#papi-parse)
- [`/papi parserel <player> <player> <string>`](#papi-parserel)
- **[eCloud Commands](#ecloud-commands)**
- [`/papi ecloud clear`](#papi-ecloud-clear)
- [`/papi ecloud disable`](#papi-ecloud-disable)
- [`/papi ecloud download <expansion> [version]`](#papi-ecloud-download)
- [`/papi ecloud enable`](#papi-ecloud-enable)
- [`/papi ecloud info <expansion> [version]`](#papi-ecloud-info)
- [`/papi ecloud list <all|<author>|installed>`](#papi-ecloud-list)
- [`/papi ecloud placeholders <expansion>`](#papi-ecloud-placeholders)
- [`/papi ecloud refresh`](#papi-ecloud-refresh)
- [`/papi ecloud status`](#papi-ecloud-status)
- **[Expansion Commands](#expansion-commands)**
- [`/papi info <expansion>`](#papi-info)
- [`/papi list`](#papi-list)
- [`/papi register <jar file>`](#papi-register)
- [`/papi unregister <jar file>`](#papi-unregister)
- **[Other Commands](#other-commands)**
- [`/papi dump`](#papi-dump)
- [`/papi reload`](#papi-reload)
----
### Parse Commands
These commands are used to parse placeholders into their respective values. Useful for debugging.
#### `/papi bcparse`
**Description**:
Parses placeholders of a String and broadcasts the result to all players.
**Arguments**:
* `<player|me>` - The Player to parse values of the placeholder (Use `me` for yourself).
* `<Text with placeholders>` - The text to parse.
**Example**:
```
/papi bcparse funnycube My name is %player_name%!
```
----
#### `/papi cmdparse`
**Description**:
Parses placeholders of a String and executes it as a command.
**Arguments**:
- `<player|me>` - The player to parse placeholders against. Use `me` for yourself.
- `<Command with placeholders>` - The Text to parse and execute as command. Please leave away the `/` of the command.
**Example**:
```
/papi cmdparse funnycube say My name is %player_name%!
```
----
#### `/papi parse`
**Description**:
Parses the placeholders in a given text and shows the result.
**Arguments**:
* `<player|me>` - The Player to parse values of the placeholder (Use `me` for yourself).
* `<Text with placeholders>` - The text to parse.
**Example**:
```
/papi parse funnycube My group is %vault_group%
```
----
#### `/papi parserel`
**Description**:
Parses a relational placeholder.
**Arguments**:
* `<player1>` - The first player.
* `<player2>` - the second player to compare with.
* `<Text with placeholders>` - The actual placeholder to parse.
**Example**:
```
/papi parserel funnycube extended_clip %placeholder%
```
----
### eCloud Commands
These commands all start with `/papi ecloud` and are used for things related about the [[Expansion Cloud]].
#### `/papi ecloud clear`
**Description**:
Clears the cache for the eCloud.
----
#### `/papi ecloud disable`
**Description**:
Disables the connection to the eCloud.
----
#### `/papi ecloud download`
**Description**:
Allows you to download an expansion from the eCloud
**Arguments**:
- `<expansion>` - The expansion to download.
- `[version]` - The specific version of the expansion to download (Optional)
**Example**:
```
/papi ecloud download Vault
/papi ecloud download Vault 1.5.2
```
----
#### `/papi ecloud enable`
**Description**:
Enables the connection to the eCloud
----
#### `/papi ecloud info`
**Description**:
Gives information about a specific Expansion.
**Arguments**:
- `<expansion>` - The Expansion to retrieve information from.
- `[version]` - The Expansion's version to get information from.
**Example**:
```
/papi ecloud info Vault
```
----
#### `/papi ecloud list`
**Description**:
Lists either all Expansions on the eCloud, only those by a specific author or only those that you have [installed](#papi-ecloud-download).
Installed Expansions show as green in the list and Expansions that are installed and have an update available show as gold.
**Arguments**:
- `<all|<author>|installed>` - List all Expansions, Expansions of a specific author or all Expnansions you have installed.
**Example**:
```
/papi ecloud list all
/papi ecloud list clip
/papi ecloud list installed
```
----
#### `/papi ecloud placeholders`
**Description**:
List all placeholders of an Expansion.
**Arguments**:
- `<expansion>` - The Expansion to list placeholders of.
**Example**:
```
/papi ecloud placeholders Vault
```
----
#### `/papi ecloud refresh`
**Description**:
Refresh the cached data from the eCloud.
----
#### `/papi ecloud status`
**Description**:
Displays the actual Status of the eCloud.
----
### Expansion Commands
These commands can be used to manage the expansions that you have currently installed.
#### `/papi info`
**Description**:
Gives you information about the specified Expansion.
**Argument(s)**:
- `<expansion>` - The Expansion to get info from (Needs to be registered and active).
**Example**:
```
/papi info Vault
```
----
#### `/papi list`
**Description**:
Lists all active/registered expansions.
This is different to [/papi ecloud list installed](#papi-ecloud-list) in the fact, that it also includes expansions that were installed through a plugin (That aren't a separate jar-file) and it also doesn't show which one have updates available.
----
#### `/papi register`
**Description**:
Registers an expansion from a specified filename.
This is useful in cases, where you downloaded the expansion manually and don't want to restart the server.
The file needs to be inside `/plugins/PlaceholderAPI/expansions`.
**Arguments**:
- `<filename>` - The file to register (including the file-extension).
**Example**:
```
/papi register MyExpansion.jar
```
----
#### `/papi unregister`
**Description**:
Unregisters the specified expansion.
**Arguments**:
- `<filename>` - The expansion to unregister.
**Example**:
```
/papi unregister MyExpansion.jar
```
----
### Other Commands
These are other commands of PlaceholderAPI that don't fit any of the above categories.
#### `/papi dump`
**Description**:
Pastes useful information from PlaceholderAPI such as plugin version, server version and installed expansions to https://paste.helpch.at for simple sharing and support.
#### `/papi reload`
**Description**:
Reloads the config settings.
You need to use this command after [downloading Expansions](#papi-ecloud-download) from the eCloud or they won't be properly registered.

View File

@ -1,67 +0,0 @@
## About
PlaceholderAPI uses an expansion-cloud (A website that has all kinds of expansions stored), to download jar-files, that contain the placeholders for it to use.
The expansion-cloud can be seen under https://api.extendedclip.com/home
## How it works
PlaceholderAPI connects to the ecloud on startup of your server, to check if the cloud is available and how many expansions are available on it.
If you run `/papi ecloud download <expansion>` PlaceholderAPI will connect to the site to first check if the specified expansion exists and then downloads it if it does.
Note that not all listed expansions are on the ecloud. Some are in the corresponding plugin itself and are registered on the startup of the server.
You can disable the connection to the cloud by setting `cloud_enabled` in the config.yml to false.
## Adding your own expansion
You can add your own expansion to the expansion-cloud for others to use.
In order to do that, you have to follow those steps:
1. Make sure you have created a seperate jar-file like explained on the page [[PlaceholderExpansion]].
2. Create an account on the site, or log in, if you already have one.
3. Click on `Expansions` and then on [`Upload New`](https://api.extendedclip.com/manage/add/).
4. Fill out the required information. `Source URL` and `Dependency URL` are optional.
5. Click on the button that says `Choose an file...` and select the jar of your expansion.
* **Important**! Make sure, that the name of the jar-file contains the same version like you set in the version-field!
6. Click on `Submit Expansion`
Your expansion is now uploaded and will be reviewed by a moderator.
If everything is ok will your expansion be approved and will be available on the ecloud for PlaceholderAPI*.
> *You can only download verified Expansions through PlaceholderAPIs command, unless you enable the option `cloud_allow_unverified_expansions` in the config.yml
> Unverified expansions can be downloaded manually by going to the site and download it yourself.
## Updating your expansion
Before you update, please note the following:
If you aren't a verified dev and you upload an update, your expansion will become **unverified** until a moderator reviews the update and approves it!
It is recommended to only update the expansion, if it contains huge changes or bug fixes.
To update your expansion, you first have to go to the list of [your expansions](https://api.extendedclip.com/manage/).
For that click on `Expansions` and select `Your Expansions`.
After that, follow those steps:
1. Click the name of the expansion, that you want to update.
2. Click on the button that says `Version`
3. Click on `Add Version`
4. Fill out the fields and upload the new jar.
* **Important**! Make sure, that the name of the jar-file contains the same version like you set in the version-field!
5. Click on `Save Changes`
If you're a verified dev, your version will be approved and is available directly.
If you aren't a verified dev, you have to wait until a moderator approves the update.
## Downloading a specific expansion version
In some cases, you may want to use a specific, older version of expansion. Such a case could be for example, when you run an old server version and the newest version of an expansion uses methods that aren't available on that particular server version.
For that case is there a way, to download a specific version of expansion. You can download the expansion either manually, or through PlaceholderAPI itself.
Here is how you can do it for each.
### Download with PlaceholderAPI
This is the easiest of both methods since it requires the least amount of effort.
Run the following command in-game or in your console to download a specific version:
`/papi ecloud download <expansion> [version]`
To find out, what versions are available for the expansion, run `/papi ecloud info <expansion>`
You can then run `/papi ecloud versioninfo <expansion> <version>` to receive more infor about a specific version.
After you downloaded the specific version, run `/papi reload` to refresh the installed expansions.
### Download manually
To download an expansion manually, you first have to connect to the website and go to the expansion of your choice.
There, you click on the button that says `Version` and click on the download-icon of the version you want to download.
Finally, stop your server, upload the jar to the folder in `/plugins/PlaceholderAPI/expansions` (Make sure to delete the old jar, if there's already one) and start the server again.

View File

@ -1,55 +0,0 @@
[readme]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md
Here are frequently asked questions about stuff related to PlaceholderAPI.
## It only shows `%placeholder%` and not the variable
When a plugin or `/papi parse me %placeholder%` only returns the placeholder itself and no value should you check for the following things:
### The expansion is actually installed.
In many cases is the cause that the expansion of the placeholder is missing.
Just execute `/papi ecloud download <name of expansion>` followed by `/papi reload` to activate it. You can find a list of Expansions and their Placeholders [[on this page|Placeholders]].
**NOTE!**
Not all placeholders come in their own expansion. Some plugins *hardcode* them in and load them on startup, when hooking into PlaceholderAPI.
### Plugin actualls supports PlaceholderAPI
It can happen that the plugin you use to display the placeholder in doesn't support PlaceholderAPI. In such a case check, if the parse command returns the actual value of a placeholder.
If that is the case while the plugin is still displaying the placeholder, can this be an indicator of the plugin not supporting PlaceholderAPI.
You can find a list of plugins supporting PlaceholderAPI [[here|Plugins-using-PlaceholderAPI]].
Just make sure that "Supports placeholders" has a check mark in front of it.
### No typo in the placeholder
Double-check that the placeholder you set doesn't contain a typo. You can use `/papi ecloud placeholders <expansion>` (replace `<expansion>` with the name of the expansion) to get a list of all the placeholders the expansion may have.
Keep in mind that this only works for separate expansions on the eCloud and not for those that are loaded by plugins.
### Plugin is enabled
If an expansion depends on a plugin, make sure you have the plugin installed and that it is enabled (Shows green in `/pl`).
## I can't download the expansion
Make sure, that the connection to the cloud (https://api.extendedclip.com) isn't blocked by a firewall or similar.
Next step would be to check if the expansion actually exists on the cloud. Not all plugins provide their placeholders through a separate jar on the cloud. Some have them build in and register them on startup.
If both checks failed, go to the cloud-page and download the jar manually. Put it then in the `expansions` folder of PlaceholderAPI (`/plugins/PlaceholderAPI/expansions`)
## How can other plugins use my placeholders with PlaceholderAPI?
A tutorial can be found [[here|Hook into PlaceholderAPI]]!
## Can I help on this wiki?
You sure can!
We welcome contributions to our wiki by everyone. If you found a typo or want to improve this wiki in another way, head over to the [Wiki's readme file][readme] to find out about how you can contribute towards this wiki.
## PlaceholderAPI is posting an error about an outdated expansion?
```
[00:00:01 ERROR]: [PlaceholderAPI] Failed to load Expansion class <expansion> (Is a dependency missing?)
[00:00:01 ERROR]: [PlaceholderAPI] Cause: NoClassDefFoundError <path>
```
If you receive the above error, try to do the following steps:
- Make sure any required dependency of the mentioned expansion (e.g. a plugin) is installed.
- Make sure you use the latest version supported for the server version you use.
- If you downloaded the jar from the ecloud, make sure it isn't malformed/corrupted.
If the issue persists after you've done those checks, report it to the author of the expansion.
In most cases is the issue that either a dependency is missing or that the expansion tries to use outdated methods from PlaceholderAPI.

View File

@ -1,78 +0,0 @@
<p align="center">
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/docs/wiki/wiki/img/logo.png" alt="PlaceholderAPI">
</p>
This wiki gives you information on how to create placeholders in your plugin that can be used in other plugins, how to use other placeholders inside your plugin, or how to make an expansion.
It also has a list with all available placeholders (Work in progress).
### Setup
**[[Hook into PlaceholderAPI]]**
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
- [[Adding placeholders to PlaceholderAPI|Hook-into-PlaceholderAPI#adding-placeholders-to-placeholderapi]]
- [[PlaceholderExpansion]]
- [[Without an external plugin|PlaceholderExpansion#without-an-external-plugin]]
- [[With external plugin|PlaceholderExpansion#with-external-plugin]]
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
### Other
**[[Commands]]**
**[[Expansion cloud]]**
**[[FAQ]]**
**[[Plugins using PlaceholderAPI]]**
**[[Placeholders]]**
- [[PAPI-placeholders|Placeholders#papi-placeholders-1]]
- [[Advancements|Placeholders#advancements]]
- [[Animations|Placeholders#animations]]
- [[Armor|Placeholders#armor]]
- [[ASCII|Placeholders#ASCII]]
- [[BungeeCord|Placeholders#bungeecord]]
- [[CheckItem|Placeholders#checkitem]]
- [[CooldownBar|Placeholders#cooldownbar]]
- [[Formatter|Placeholders#formatter]]
- [[Javascript|Placeholders#javascript]]
- [[ListPlayers|Placeholders#listplayer]]
- [[LocalTime|Placeholders#localtime]]
- [[Math|Placeholders#math]]
- [[MVdW placeholders|Placeholders#mvdw-placeholders]]
- [[OtherPlayer|Placeholders#otherplayer]]
- [[ParseNear|Placeholders#parsenear]]
- [[ParseOther|Placeholders#parseother]]
- [[Pinger|Placeholders#pinger]]
- [[Player|Placeholders#player]]
- [[PlayerList|Placeholders#playerlist]]
- [[Plugin|Placeholders#plugin]]
- [[Progress|Placeholders#progress]]
- [[RainbowColor|Placeholders#rainbowcolor]]
- [[RandomColor|Placeholders#randomcolor]]
- [[RedisBungee|Placeholders#redisbungee]]
- [[RelCon|Placeholders#relcon]]
- [[ScoreboardObjectives|Placeholders#scoreboardobjectives]]
- [[Server|Placeholders#server]]
- [[Sound|Placeholders#sound]]
- [[Spectators|Placeholders#spectators]]
- [[Statistic|Placeholders#statistic]]
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
- [[A|Placeholders#a]]
- [[B|Placeholders#b]]
- [[C|Placeholders#c]]
- [[D|Placeholders#d]]
- [[E|Placeholders#e]]
- [[F|Placeholders#f]]
- [[G|Placeholders#g]]
- [[H|Placeholders#h]]
- [[I|Placeholders#i]]
- [[J|Placeholders#j]]
- [[K|Placeholders#k]]
- [[L|Placeholders#l]]
- [[M|Placeholders#m]]
- [[N|Placeholders#n]]
- [[O|Placeholders#o]]
- [[P|Placeholders#p]]
- [[Q|Placeholders#q]]
- [[R|Placeholders#r]]
- [[S|Placeholders#s]]
- [[T|Placeholders#t]]
- [[U|Placeholders#u]]
- [[V|Placeholders#v]]
- [[W|Placeholders#w]]
- [[Z|Placeholders#z]]

View File

@ -1,142 +0,0 @@
[APIBadge]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
[SpigotBadge]: https://img.shields.io/spiget/version/6245?label=Spigot
[Spigot]: https://spigotmc.org/resources/6245
[GitHubBadge]: https://img.shields.io/github/v/release/PlaceholderAPI/PlaceholderAPI?label=GitHub%20Release
[GitHub]: /PlaceholderAPI/PlaceholderAPI/releases/latest
> [![SpigotBadge]][Spigot] [![GitHubBadge]][GitHub]
>
> ![APIBadge]
>
> *The GitHub release may be different from the spigot release*
This page is about using PlaceholderAPI in your own plugin, to either let other plugins use your plugin, or just use placeholders from other plugins in your own.
Please note, that the examples in this page are only available for **PlaceholderAPI 2.10.0 or higher**!
## First steps
Before you can actually make use of PlaceholderAPI, you first have to import it into your project.
### Import with Maven
To import PlaceholderAPI, simply add the following code to your **pom.xml**
Replace `{VERSION}` with the version listed at the top of this page.
```xml
<repositories>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>{VERSION}</version>
<scope>provided</scope>
</dependency>
</dependencies>
```
### Import with Gradle
Here is how you can import PlaceholderAPI through gradle.
Put this into your **Gradle.build**.
Replace `{VERSION}` with the version listed at the top of this page.
```gradle
repositories {
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
dependencies {
compileOnly 'me.clip:placeholderapi:{VERSION}'
}
```
### Set PlaceholderAPI as (soft)depend
Next step is to go to your plugin.yml and add PlaceholderAPI as a depend or softdepend, depending (no pun intended) on if it is optional or not.
**Example Softdepend**:
```yaml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.here
softdepend: [PlaceholderAPI] # This is used, if your plugin works without PlaceholderAPI.
```
**Example Depend**:
```yaml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.here
depend: [PlaceholderAPI] # If your plugin requires PlaceholderAPI, to work, use this.
```
## Adding placeholders to PlaceholderAPI
A full guide on how to create expansions can be found on the [[PlaceholderExpansion]] page of this wiki.
## Setting placeholders in your plugin
PlaceholderAPI offers the ability, to automatically parse placeholders from other plugins within your own plugin, giving the ability for your plugin to support thousands of other placeholders without depending on each plugin individually.
To use placeholders from other plugins in our own plugin, we simply have to [(soft)depend on PlaceholderAPI](#set-placeholderapi-as-softdepend) and use the `setPlaceholders` method.
It is also important to point out, that any required plugin/dependency for an expansion has to be on the server and enabled, or the `setPlaceholders` method will just return the placeholder itself (do nothing).
**Example**:
Let's assume we want to send an own join message that shows the group a player has.
To achieve that, we can do the following:
```java
package at.helpch.placeholderapi;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import me.clip.placeholderapi.PlaceholderAPI;
public class JoinExample extends JavaPlugin implements Listener {
@Override
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
/*
* We register the EventListener here, when PlaceholderAPI is installed.
* Since all events are in the main class (this class), we simply use "this"
*/
Bukkit.getPluginManager().registerEvents(this, this);
} else {
/*
* We inform about the fact that PlaceholderAPI isn't installed and then
* disable this plugin to prevent issues.
*/
getLogger().warn("Could not find PlaceholderAPI! This plugin is required.");
Bukkit.getPluginManager().disablePlugin(this);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent event) {
String joinText = "%player_name% &ajoined the server! They are rank &f%vault_rank%";
/*
* We parse the placeholders using "setPlaceholders"
* This would turn %vault_rank% into the name of the Group, that the
* joining player has.
*/
joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText);
event.setJoinMessage(joinText);
}
}
```

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,104 +0,0 @@
[Wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
[Placeholders]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
[Plugins using PlaceholderAPI]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Plugins-using-PlaceholderAPI
# Wiki
This is the wiki folder. It contains all pages that you can find in our [Wiki].
It allows you to suggest changes through Pull request while keeping a simple way for us to maintain the wiki, without granting everyone push rights to it.
If you want to contribute towards the wiki would we highly recommend to follow the below contributing Guidelines, to keep the overal style of the wiki intact.
## 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)
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]
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.
Each entry on this page follows a specific format that you need to follow:
```markdown
- **[:name](:url)**
- [?] Supports placeholders.
- [?] Provides own placeholders. [:link]
```
| Key | Description |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `: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` | 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/ |
| `?` | Should be replaced with either an `x` or a space, depending on if the option is supported. So the result is 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]` |
### [Placeholders]
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.
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 syntax used for each entry is the same:
````markdown
- ### **[:name](:url)**
> :command
```
:placeholders
```
----
````
| Key | Description |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `: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. |
| `: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/ |
| `: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` | List of placeholders your plugin/expansion offers. The list should stay in alphabetical order. You can use `<>` and `[]` to indicate required and optional variables. |
#### Extra notes
- 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
Please follow these general guidelines when editing any other pages.
### Links
The wiki uses 3 types of links:
- [Reference Links](#reference-links)
- [Wiki Links](#wiki-links)
- [Header Links](#header-links)
#### Reference Links
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.
To use a reference link, either use `[:text]` or `[:displayed_text][:text]` to link with a differently shown text.
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 should always be started with a hyphen (`-`) to better distinguish it from other formatting characters like the asterisk (`*`) used for bold or italic text.

View File

@ -1,23 +0,0 @@
[papi]: https://placeholderapi.com
[discordImg]: https://img.shields.io/discord/164280494874165248.svg?logo=discord&label=Discord&colorB=7289DA
[discord]: https://helpch.at/discord
[jenkinsImg]: https://img.shields.io/badge/Download%20from-Jenkins-brightgreen.svg
[jenkins]: http://ci.extendedclip.com/job/PlaceholderAPI/
[licenseImg]: https://img.shields.io/github/license/PlaceholderAPI/PlaceholderAPI.svg
[license]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/LICENSE
[issuesImg]: https://img.shields.io/github/issues-raw/PlaceholderAPI/PlaceholderAPI.svg?logo=github&logoColor=white
[issues]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues
[versionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
[plugin-page]: https://spigotmc.org/resources/6245
> © 2015 - 2021 [PlaceholderAPI Team][papi]
> Thanks for using PlaceholderAPI.
>
> **[Plugin-page]** | **[[Placeholders]]** | **[[Plugins using PlaceholderAPI]]** | **[[Hook into PlaceholderAPI]]**
>
> ![versionImg] [![jenkinsImg]][jenkins] [![licenseImg]][license] [![issuesImg]][issues] [![discordImg]][discord]

View File

@ -1,81 +0,0 @@
<p align="center">
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/docs/wiki/wiki/img/icon.png" alt="PlaceholderAPI">
</p>
**[[Main page|Home]]**
### Setup
**[[Hook into PlaceholderAPI]]**
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
- [[Adding placeholders to PlaceholderAPI|Hook-into-PlaceholderAPI#adding-placeholders-to-placeholderapi]]
- [[PlaceholderExpansion]]
- [[Without an external plugin|PlaceholderExpansion#without-an-external-plugin]]
- [[With external plugin|PlaceholderExpansion#with-external-plugin]]
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
### Other
**[[Commands]]**
**[[Expansion cloud]]**
**[[FAQ]]**
**[[Plugins using PlaceholderAPI]]**
**[[Placeholders]]**
- [[PAPI-placeholders|Placeholders#papi-placeholders-1]]
- [[Advancements|Placeholders#advancements]]
- [[Animations|Placeholders#animations]]
- [[Armor|Placeholders#armor]]
- [[ASCII|Placeholders#ASCII]]
- [[BungeeCord|Placeholders#bungeecord]]
- [[CheckItem|Placeholders#checkitem]]
- [[CooldownBar|Placeholders#cooldownbar]]
- [[Formatter|Placeholders#formatter]]
- [[Javascript|Placeholders#javascript]]
- [[ListPlayers|Placeholders#listplayer]]
- [[LocalTime|Placeholders#localtime]]
- [[Math|Placeholders#math]]
- [[MVdW placeholders|Placeholders#mvdw-placeholders]]
- [[OtherPlayer|Placeholders#otherplayer]]
- [[ParseNear|Placeholders#parsenear]]
- [[ParseOther|Placeholders#parseother]]
- [[Pinger|Placeholders#pinger]]
- [[Player|Placeholders#player]]
- [[PlayerList|Placeholders#playerlist]]
- [[Plugin|Placeholders#plugin]]
- [[Progress|Placeholders#progress]]
- [[RainbowColor|Placeholders#rainbowcolor]]
- [[RandomColor|Placeholders#randomcolor]]
- [[RedisBungee|Placeholders#redisbungee]]
- [[RelCon|Placeholders#relcon]]
- [[ScoreboardObjectives|Placeholders#scoreboardobjectives]]
- [[Server|Placeholders#server]]
- [[Sound|Placeholders#sound]]
- [[Spectators|Placeholders#spectators]]
- [[SpeedPerSec|Placeholders#speedpersec]]
- [[Statistic|Placeholders#statistic]]
- [[Team|Placeholders#team]]
- [[World|Placeholders#world]]
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
- [[A|Placeholders#a]]
- [[B|Placeholders#b]]
- [[C|Placeholders#c]]
- [[D|Placeholders#d]]
- [[E|Placeholders#e]]
- [[F|Placeholders#f]]
- [[G|Placeholders#g]]
- [[H|Placeholders#h]]
- [[I|Placeholders#i]]
- [[J|Placeholders#j]]
- [[K|Placeholders#k]]
- [[L|Placeholders#l]]
- [[M|Placeholders#m]]
- [[N|Placeholders#n]]
- [[O|Placeholders#o]]
- [[P|Placeholders#p]]
- [[Q|Placeholders#q]]
- [[R|Placeholders#r]]
- [[S|Placeholders#s]]
- [[T|Placeholders#t]]
- [[U|Placeholders#u]]
- [[V|Placeholders#v]]
- [[W|Placeholders#w]]
- [[Z|Placeholders#z]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB