Compare commits

..

2176 Commits

Author SHA1 Message Date
9de1ea8232 add world-specific variant 2024-02-10 18:52:50 +01:00
2f64af7ebb Introduce base plot count placeholder 2024-02-10 18:32:33 +01:00
7f1f1e025e feat: configurable accounting for bedrock layer when setting components (#4266)
- Add configuration option to force plot components to be set only above bedrock level
 - Account for build height < gen height where it is not wanted for components to be set at/below bedrock
2024-02-09 13:48:56 +01:00
59787fe7f3 Back to snapshot for development
Signed-off-by: Alexander Brandes <mc.cache@web.de>
2024-02-06 14:33:42 +01:00
6783d5ece6 Release 7.3.3
Signed-off-by: Alexander Brandes <mc.cache@web.de>
2024-02-05 23:04:06 +01:00
d9aa2a496c Update dependency gradle to v8.6 (#4321)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-05 23:00:08 +01:00
809ed6778c Update release-drafter/release-drafter action to v6 (#4322)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-05 22:53:29 +01:00
2fe44053a2 Update junit5 monorepo (#4320)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-05 22:53:19 +01:00
c36b87ca14 Update dependency xyz.jpenilla.run-paper to v2.2.3 (#4319)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-05 22:53:06 +01:00
5aec7653b6 Update dependency com.diffplug.spotless to v6.25.0 (#4308)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-02 18:05:41 +01:00
cc5d01e225 Update gradle/wrapper-validation-action action to v2 (#4309)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-02 18:05:30 +01:00
448577774a Entity#getEntitySpawnReason compatibility for spigot (#4305)
chore: Entity#getEntitySpawnReason compatibility for spigot
2024-02-02 16:46:39 +01:00
966c878a72 Back to snapshot for development
Signed-off-by: Alexander Brandes <mc.cache@web.de>
2024-01-22 20:37:31 +01:00
5021f5b379 Release 7.3.2
Signed-off-by: Alexander Brandes <mc.cache@web.de>
2024-01-22 20:32:39 +01:00
76ea9e0d3c PostPlotClearEvent added (#4268)
* PostPlotClearEvent added

* Made requested changes

* Clear.java changed

* Changed to PlotPlayer Event

* Removed methods

* Removed methods

* Removed useless import
2024-01-21 15:22:38 +01:00
951f08bc8b Add events for plot buying (#4291)
* cancelable event results are nullable

* chore: add javadocs to CancellablePlotEvent#

* feat: events for plot buy process
2024-01-21 15:21:36 +01:00
ae941e67a4 Fallback to areas QueueCoordinator when passing null (#4300)
* fix: fallback to area QueueCoordinator if null passed

* chore: add annotations to suppress IDE warnings
2024-01-21 12:40:38 +01:00
9566af5fda Use MUSIC soundcategory for plot music flag (#4302)
chore/fix: use MUSIC sound category for plot music
2024-01-21 12:38:46 +01:00
fccc146053 Do not remove entitys with CUSTOM spawn-reason on CreatureSpawnEvent. (#4297)
Do not remove entitys with CUSTOM spawn-reason.
2024-01-21 12:33:53 +01:00
a1d94af242 Fix home command reset (#4295)
* Add location not null check
The issue lies within the equals implementation

* Fix setposition method with default value.
Also add a comment too.

---------

Co-authored-by: OneLiteFeather <seelenretterin@onelitefeather.net>
2024-01-20 00:34:46 +01:00
6371cd4c5a Update fawe to v2.8.4 (#4278)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-13 17:04:44 +01:00
e4613cfc62 Fix minimessage tag resolver in list command (#4290)
fix: update resolver tag names for list command
2024-01-12 09:35:11 +01:00
8c44b2d2d2 feat: add specific admin permissions for placing vehicles (#4258)
- fixes #3850
2024-01-07 14:57:36 +00:00
449af2f3a4 Add admin permission override to edit signs (#4287)
* add admin permission override to edit signs

* include sign dying
2024-01-06 11:28:33 +01:00
ead7acdd76 fix: allow pistons on merged plot road if detect-invalid-edge-pistons true (#4257)
- fixes #4232
2023-12-31 18:50:29 +00:00
1991142d48 refactor: move leave event dispact to after logic (#4260)
- closes #4171
2023-12-26 15:26:31 +00:00
63ae11b3d3 Back to snapshot for development 2023-12-25 19:54:00 +01:00
86fe3c6846 Release 7.3.1 2023-12-25 19:49:36 +01:00
a90e179338 Relocate net.kyori.options (Support newer 1.20.4 builds) (#4280)
chore/fix: relocate net.kyori.option
2023-12-25 18:32:29 +01:00
a6ae287908 Back to snapshot for development 2023-12-22 17:59:33 +01:00
1a33997099 Release 7.3.0 2023-12-22 17:54:28 +01:00
6edd4b8220 Update dependency net.kyori:adventure-platform-bukkit to v4.3.2 (#4276)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 17:51:28 +01:00
9b0d1e484c Update dependency com.github.spotbugs:spotbugs-annotations to v4.8.3 (#4275)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 17:51:20 +01:00
6971fa4c10 Update github/codeql-action action to v3 (#4274)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 17:36:22 +01:00
3c818f3e33 Update dependency org.checkerframework:checker-qual to v3.42.0 (#4273)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 17:36:14 +01:00
31be2e5eb3 Update adventure to v4.15.0 (#4272)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 17:36:08 +01:00
945a8ad306 Update worldedit to v7.2.18 (#4271)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-22 17:35:54 +01:00
c6b0b99cd6 Fix MM update in plot condensation 2023-12-22 17:28:00 +01:00
dbfc43e3cd feat: allow for custom plot limit handling (#4261)
* feat: allow for custom plot limit handling

* feat: allow for custom plot limit handling

* chore: use fluent setter
2023-12-18 21:07:41 +01:00
c8b4a2fa39 feat: Allow admin done permission to override requiring plot complexity calculation (#4267)
Co-authored-by: MrJoshuaT <josh@jmt.me>
2023-12-16 21:04:11 +00:00
d851e27aed Fix checkerframework javadoc URL 2023-12-16 17:34:56 +01:00
4a45729c9e feat: add projectile-change-block flag (#4185)
- closes #4081
2023-12-12 13:53:10 +00:00
7931c0864e Update dependency org.checkerframework:checker-qual to v3.41.0 (#4265)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-09 10:26:00 +01:00
1456b29d93 Update fawe to v2.8.3 (#4264)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-09 10:25:53 +01:00
761477b76d Update dependency com.diffplug.spotless to v6.23.3 (#4263)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-09 10:25:46 +01:00
e61bcf905f Back to snapshot for development 2023-12-09 10:21:05 +01:00
85bec710df Release 7.2.1 2023-12-09 10:13:42 +01:00
d130794453 Prepare for 1.20.3/4 2023-12-08 07:29:19 +01:00
f5f875eb11 feat: add HasOwner PlotFilter filter (#4259)
* feat: add HasOwner PlotFilter filter
 - closes #3831

* change since to TODO

* Address feedback

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-12-07 18:29:10 +01:00
89511f07f9 Fix: disable sign-coloring when edit-sign flag is false (#4252)
* Initial commit

* Update Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java

Co-authored-by: powercas_gamer <cas@mizule.dev>

* Relocated Item check

* Added version check when building list of items

* Use mutable set and copy to immutable

---------

Co-authored-by: powercas_gamer <cas@mizule.dev>
2023-12-06 22:56:22 +01:00
1a18adcd95 Declare explicit runtime dependency on 'junit-platform-launcher' (#4255) 2023-12-02 00:17:28 +01:00
65858c5f3e Update dependency com.github.spotbugs:spotbugs-annotations to v4.8.2 (#4245)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-02 00:00:21 +01:00
5c7520b5f5 Update dependency org.junit.jupiter:junit-jupiter to v5.10.1 (#4246)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-02 00:00:13 +01:00
f3b9cd5ded Update dependency xyz.jpenilla.run-paper to v2.2.2 (#4248)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-01 23:47:33 +01:00
8a3eb25805 Update fawe to v2.8.2 (#4249)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-01 23:47:26 +01:00
48bbd3c018 Update dependency com.diffplug.spotless to v6.23.2 (#4250)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-01 23:47:17 +01:00
bf85013f70 Update dependency gradle to v8.5 (#4251)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-01 23:47:10 +01:00
d36a2d236b Update dependency org.checkerframework:checker-qual to v3.40.0 (#4253)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-01 23:46:59 +01:00
79f111ec0a Update actions/setup-java action to v4 (#4254)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-01 23:46:38 +01:00
31ae62b62c Introduce edit-sign flag (#4236) 2023-11-26 12:36:01 +00:00
cdb44d4884 fix: re-add default spawn option and disclude armour stands (#4240)
- Fixes #4238
2023-11-25 20:30:48 +00:00
eb63e4351d Feat(API): Mutable Location in PlayerTeleportToPlotEvent (#4196)
* feat: ability to overwrite spawn location for plot teleports

* chore/feat: migrate to LocationTransformer to resolve unnecessary chunk loads

* chore: simplify transform type
2023-11-21 17:26:30 +00:00
ba7880241b Fix: permission check for integer flags (#4217)
* Changing numeric check to support '0'

* Adding notes

* More detailed description of 'max-plots' setting
2023-11-21 17:26:15 +00:00
be6838f29e Make '/plot download world' clickable (#4239) 2023-11-19 14:43:07 +01:00
dc73116401 Fix: remove everyone command (#4106)
Fixing remove everyone command
2023-11-19 13:42:11 +00:00
b6a87df072 Fixup renovate warnings 2023-11-19 09:49:55 +01:00
8195afaa2f Fix: chest_boat not removing (#4231) 2023-11-06 14:38:32 +01:00
561eac2fbd Back to snapshot for development 2023-11-03 15:06:30 +01:00
fdc887850c Release 7.2.0 2023-11-03 15:01:50 +01:00
e3bfd9b8bf Add info about service providers to debugpaste (#4226) 2023-11-03 14:58:38 +01:00
e689337188 Update dependency me.clip:placeholderapi to v2.11.5 (#4220)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-02 21:25:40 +01:00
ee6ae6cba0 Update worldedit to v7.2.17 (#4222)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-02 21:25:30 +01:00
dc8d7809bd Update dependency com.github.spotbugs:spotbugs-annotations to v4.8.0 (#4223)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-02 07:55:10 +01:00
dcd63ed4d9 Update fawe to v2.8.1 (#4221)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-02 07:55:03 +01:00
3cc770970f feat: add configurable border size (#4213)
- allows players to travel past border, but not claim
 - closes #2962
2023-10-31 10:51:19 +00:00
1c3776b605 Delay economy initialization to server load (#4216) 2023-10-29 10:55:31 +01:00
95c7f621fb Fix: including "highestLimit" number (#4218)
Including "highestLimit" number
2023-10-29 10:55:01 +01:00
15b4cbdb0f Simplify Plot#getConnectedPlots and share cache between connected plots (#4212)
* Simplify Plot#getConnectedPlots and share cache between connected plots

* add missing isMerged check
2023-10-23 16:38:41 +02:00
812eac18d3 Label PRs with merge conflicts 2023-10-22 12:53:43 +02:00
16a4ee835c chore/fix(:runServer): cache fawe artifact and fix java 21 (#4209)
chore/fix: cache fawe artifact and fix java 21
2023-10-16 19:23:25 +02:00
c013b92e62 Address deprecated 'Times#of()' in 'PlotPlayer' (#4207) 2023-10-15 12:05:04 +00:00
b00a46b286 chore: remove poorly implemented /ps debug loadedchunks command (#4180)
- the same (but correctly implemented) functionality exists in other plugins
 - closes #4140
2023-10-10 11:06:22 +01:00
44b1127181 Back to snapshot for development 2023-10-09 17:14:17 +02:00
c7bfd48a21 Release 7.1.0 2023-10-09 17:03:09 +02:00
dc13783db8 chore: mitigate possible future sqlite driver problems (#4200)
* chore: mitigate possible future sqlite driver problems

* chore/feat: log driver version on error

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-10-09 16:55:09 +02:00
0a390ab342 Update dependency gradle to v8.4 (#4202)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-07 21:08:28 +02:00
d111740f64 Updater checkerqual 2023-10-07 20:48:53 +02:00
28e97e8441 Replace deprecated ageable with breedable (#4193)
* [#4164] Replace deprecated ageable with breedable

* [#4164] Correct methods and usage based on issue

* [#4164] Add since tag to deprecated and new methods

* [#4164] Add to deprecated annotation since argument with todo value

* [#4164] Change since to todo for changed code

* [#4164] Change access of storeBreedable to private
2023-10-07 20:15:26 +02:00
a30cdb37d6 fix: load flags after we is initialised (#4186)
* fix: load flags after we is initliased
 - fixes #4073
 - it could be possible to add a callback in the WE initilised event listener, but that overcomplicates it a bit and this is fine tbh

* Extract method
2023-10-07 20:14:54 +02:00
f848162066 Default to latest version of informative-annotations (#4199)
* Default to latest version of informative-annotations

* Update Core/build.gradle.kts
2023-10-07 20:14:10 +02:00
40c70aa98d Replace javadoc.io with javadocs.dev 2023-10-05 20:48:49 +02:00
0d2b36bac8 Fix: No response to errors in plot user group modifications (#4197) 2023-10-05 14:54:11 +01:00
d7e5bcdaa5 Update publishing profile 2023-10-04 13:45:11 +02:00
fc783574a3 Migrate 'EntityUtil#capNumeral' to an enhanced switch (#4195)
* Migrate 'EntityUtil#capNumeral' to an enhanced switch

* Apply feedback
2023-10-04 11:34:50 +02:00
5f7bb784f0 feat: add concrete-harden flag (#4184) 2023-10-04 09:41:47 +01:00
26c55a318f feat: add placeholder for plot size (#4181) 2023-10-02 20:37:00 +01:00
ee68bc3d9e Fix 'ChunkCoordinatorBuilder#unloadAfter()' javadocs (#4194) 2023-10-02 19:37:43 +02:00
a3bc3968a5 Update Paper javadoc URL to 1.20 (#4187) 2023-10-01 14:07:55 +02:00
79454da1a6 Address deprecated 'Project.buildDir' in build scripts (#4191) 2023-10-01 14:07:36 +02:00
12a4c92ad9 Update dependency com.diffplug.spotless to v6.22.0 (#4188)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 14:00:26 +02:00
167692d464 Update dependency org.checkerframework:checker-qual to v3.38.0 (#4189)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 14:00:03 +02:00
ae26e8155c Update fawe to v2.8.0 (#4190)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 13:59:52 +02:00
286ea62a21 Update actions/checkout action to v4 (#4192)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 13:59:43 +02:00
d95c74d8c9 Addresses issues related to maven publish scm block (#4179)
- Fixes https://github.com/IntellectualSites/PlotSquared/issues/4158
- Fixes https://github.com/IntellectualSites/PlotSquared/issues/4159
- Resolves https://github.com/IntellectualSites/PlotSquared/issues/4160
2023-10-01 11:54:47 +02:00
c1555ddbc7 Fix #isAccessible() deprecation in HybridPlotWorld (#4177)
Fixes https://github.com/IntellectualSites/PlotSquared/issues/4165
2023-10-01 11:50:19 +02:00
4fe0c586d9 Address deprecated URL instantiation (#4178)
Fixes https://github.com/IntellectualSites/PlotSquared/issues/4166
2023-10-01 11:50:12 +02:00
aae6ea4fee Update dependency net.kyori:adventure-platform-bukkit to v4.3.1 (#4182)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 11:50:03 +02:00
385d018504 Update worldedit to v7.2.16 (#4183)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 11:49:53 +02:00
f4def082c1 Update dependency cloud.commandframework:cloud-services to v1.8.4 (#4175)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 11:25:05 +02:00
69c9f1df83 Update dependency me.clip:placeholderapi to v2.11.4 (#4176)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-10-01 11:24:58 +02:00
e138dc0267 Update runServer gradle tasks (#4173)
* chore/feat: download fawe & only use latest patch versions in runServer

* chore: gitignore runServer-1.20 folder as well

* chore: exclude minor versions >= 10 by default (no need for < 10)

* chore: update gradle plugin
2023-09-30 01:32:50 +02:00
ca50b53f94 Update api.spigotmc.org from 0.1 to 0.2 (#4167) 2023-09-17 20:14:30 +02:00
f705487055 Ignore deprecations we can't address (yet) 2023-09-16 21:48:13 +02:00
b7c9453a1a Rewrite javadocs for PlotId class (#4157) 2023-09-15 13:17:42 -04:00
1aa370d562 Fixup bad commit d3dab0d736 2023-09-13 21:13:30 +02:00
d3dab0d736 Added documentation for PlotWeather 2023-09-12 21:13:04 -04:00
764156b267 Minor doc rewrite 2023-09-12 20:58:24 -04:00
665f5251bf Added docs to PlotItemStack 2023-09-12 20:42:58 -04:00
7c328095d7 *actually 10s 2023-09-06 17:46:56 +01:00
7884c91d52 fix: run world unload task every 10 seconds, not 1 second
- Every second meant worlds would be unloaded whilst a player attempted to teleport to it
2023-09-06 17:09:01 +01:00
e9a19e0821 Update dependency dev.notmyfault.serverlib:ServerLib to v2.3.4 (#4152)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-01 08:36:43 +02:00
022847fc4b Update fawe to v2.7.1 (#4153)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-01 08:36:29 +02:00
1ee673be58 Update dependency com.diffplug.spotless to v6.21.0 (#4154)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-01 08:33:17 +02:00
3c2aa99e86 Fix javadoc for 'PlotModificationManager#setComponent()' 2023-08-26 11:30:56 +02:00
11fac3f060 Remove repository-level CoC in favor with organization-level CoC (#4148)
Remove repository-level CoC in favor with organization-level Coc
2023-08-23 16:54:21 +02:00
3e57e524b9 Back to snapshot for development 2023-08-23 13:02:45 +02:00
f582ec03c5 Release 7.0.0 2023-08-23 12:50:00 +02:00
893be136f0 Update dependency gradle to v8.3 (#4147)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-23 12:22:47 +02:00
b74ba30281 Fixed NPE in DebugRoadRegen command 2023-08-21 19:09:35 -04:00
ba9dab1f73 Fixed a typo. 2023-08-18 00:28:51 -04:00
8e60fdb477 Merge remote-tracking branch 'origin/main' 2023-08-18 00:10:03 -04:00
443fe8dd47 Added deprecation 2023-08-18 00:09:48 -04:00
e56e52ba4f Fix 'grant' placeholder 2023-08-11 14:05:23 +02:00
cd008bed9b Update dependency net.essentialsx:EssentialsX to v2.20.1 (#4139)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-11 09:52:49 +02:00
d4c90283d6 Cleanup dependencies 2023-08-08 22:33:24 +02:00
dc04ec955a Back to snapshot for development 2023-08-02 13:57:50 +02:00
72f511ce99 Release 7.0.0-rc.4 2023-08-02 13:51:03 +02:00
0d63c2bdb6 feat: allow bypass of econ costs (#4126) 2023-08-02 13:48:07 +02:00
49e13384cf fix: remove "default" spawn reason (#4132) 2023-08-02 13:47:53 +02:00
1ddc19ff69 Update dependency com.intellectualsites.bom:bom-newest to v1.34 (#4130)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 10:45:47 +02:00
a6d436e841 Update dependency org.junit.jupiter:junit-jupiter to v5.10.0 (#4131)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 10:45:38 +02:00
9b0b39ac2e feat: add a permission requirement to /plot merge all (#4127) 2023-07-31 14:04:08 +02:00
638f0bd078 fix: do not use overall max schem height for checking road schem height (#4124) 2023-07-30 12:17:35 +02:00
c27b838dad fix: add missing method in UncheckedWorldLocation (#4112)
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-07-24 18:00:56 +00:00
e0cb2949df fix: switch to consistent heights for schematic generation (#4113) 2023-07-24 16:56:53 +01:00
59be582c28 fix: correct reflected fields for chunk needs saving (#4111) 2023-07-24 16:56:46 +01:00
f6cbb3792f [ci skip] Update documentation location 2023-07-22 11:40:01 +02:00
a68918f830 Update dependency gradle to v8.2.1 (#4117)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-22 11:16:24 +02:00
1a7ded864e Update dependency com.diffplug.spotless to v6.20.0 (#4118)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-22 09:11:22 +00:00
cbc8bc8879 [ci skip] Publish javadocs for releases only 2023-07-22 11:05:30 +02:00
21f79d1c13 Back to snapshot for development 2023-07-22 11:01:11 +02:00
293d7acf2d Release 7.0.0-rc.3 2023-07-22 10:56:35 +02:00
d876d3722a Fix default flags registration for third parties (#4114)
Co-authored-by: Leomixer17 <leonardo.dgs@yahoo.com>
2023-07-17 22:30:02 +02:00
dffb7672ff fix: add missing spawn event reasons (#4110) 2023-07-16 15:25:07 +01:00
f867867a42 Fix typo in comment 2023-07-15 19:56:44 +02:00
59eefd6865 fix: even better handling of schematic heights (#4102) 2023-07-10 23:13:36 +02:00
587a286d05 Back to snapsho for development 2023-07-05 13:35:51 +02:00
e10caf6aa0 Release 7.0.0-rc.2 2023-07-05 13:28:13 +02:00
08b325e37d feat: improvement of kick messages (#4099)
* Adding new player_not_in_plot message

* Adding new cannot_kick_player message

* Small typo

* Rejection: renaming of the player placeholder
2023-07-04 18:44:45 +02:00
c394108ba6 feat: add a sculk sensor flag (#4095) 2023-07-04 16:56:28 +01:00
31e89019f1 Update worldedit to v7.2.15 (#4096)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-01 10:43:53 +02:00
3a7075e28d Update dependency com.intellectualsites.bom:bom-newest to v1.31 (#4097)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-01 10:43:36 +02:00
8373b7874e Update dependency gradle to v8.2 (#4098)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-01 10:42:20 +02:00
fe13882b97 Update renovate.json 2023-07-01 10:28:10 +02:00
f45064c4c4 fix: P2 areas are in worlds.yml 2023-06-23 14:11:12 +01:00
af32399dd2 Correct calculating the plot price, if 'merge' differs from 'claim' 2023-06-23 10:40:40 +02:00
f3c03348d9 fix: return on null plot on big boom (#4085)
- Fixes #4084
2023-06-22 20:09:31 +02:00
a53330e39b Disable update checker for RC phase 2023-06-22 20:08:43 +02:00
e2ba93dab9 Update unsupported MiniMessage syntax 2023-06-22 19:55:36 +02:00
9d43434e40 Add 1.20.1 to the issue template 2023-06-17 18:45:42 +02:00
4f421167d1 Move renovate to .github folder 2023-06-17 18:43:53 +02:00
94f4619c2c Publish javadocs for v7 2023-06-15 17:30:27 +02:00
9885d3e506 Fill in 'since' annotations 2023-06-15 17:24:21 +02:00
a54276d3b2 Strip legacy color codes if message cannot be parsed by MiniMessage (#4077) 2023-06-15 10:23:09 +02:00
cbb284b0fd Properly drop unsupported biomes from biome list (#4074)
* Drop CUSTOM from biome list

* Drop cherry_grove if present on pre 1.20 versions
2023-06-14 15:12:34 +02:00
ed22b22e9c [ci skip] Update bug_report.yml 2023-06-11 12:06:33 +02:00
444ccda807 Add support for 1.20 (#4061)
1.20 fixes
2023-06-09 13:22:55 +02:00
db361cc420 Wrong biome list for 1.19.4 if datapacks are not enabled (#4016)
* Remove cherry grove for 1.20 below

* Handle PR feedback. Replace version check with registry check

* Simplify the biomes list

* Update Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java

Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>

* Handle pr feedback

---------

Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
2023-06-09 13:22:23 +02:00
079dc02cfe Update dependency net.essentialsx:EssentialsX to v2.20.0 (#4063)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-09 11:09:06 +00:00
e98791c865 Update top level group id and lowercaswe artifact names (#4060)
* Update top level group Id (#4055)

* Lowercase artifact names
2023-06-08 10:40:02 +02:00
7c3112f30f Update gradle (#4044)
* Update gradle

* Update codeQL

* *
2023-06-04 13:57:39 +02:00
c01f5f5c7d Update dependency com.diffplug.spotless to v6.19.0 (#4052)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-01 09:21:53 +02:00
95caa19505 Update guice to v7 (major) (#4053)
Update guice to v7

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-01 09:21:43 +02:00
b8055201df fix: do not reset the connectedCache every time Plot#getRegions is called (#4046)
* fix: do not reset the connectedCache every time Plot#getRegions is called
 - Fixes IntellectualSites/FastAsyncWorldEdit#2188

* Remove unused import
2023-05-25 19:05:20 +02:00
81daefae4a fix: do not overwrite bedrock with wall (#4048)
- Fixes #4047
2023-05-25 19:04:53 +02:00
02437a8c72 feat: add cost for the merge when using plot auto-merge (#3841)
* feat: add cost for the merge when using plot auto-merge
 - Closes #3814

* fix: Don't charge for auto merge if there is no auto merge

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-05-21 17:57:46 +02:00
958c66b28f Road-Schematic-Generation now shows correct skull skins and banner patterns (#4026)
* fix: Preserve NBT Data for Banners and Skulls on Chunk Generation

* Update Bukkit/src/main/java/com/plotsquared/bukkit/schematic/StateWrapper.java

* Make it compile

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-05-13 22:32:33 +02:00
c656190e14 Fix plot done success flag being false when complexity is higher than… (#4040)
Fix plot done success flag being false when complexity is higher than the threshold

Co-authored-by: MrJoshuaT <josh@jmt.me>
2023-05-13 22:23:11 +02:00
e914cb210e Update announce-release-on-discord.yml (#4036) 2023-05-01 10:16:29 +02:00
94c6af74d2 Update build.yml 2023-05-01 10:15:50 +02:00
ebb82bd66d Update build-pr.yml 2023-05-01 10:15:20 +02:00
66f907eb5d Update codeql 2023-05-01 10:15:04 +02:00
9ffede2c5c Update dependency org.junit.jupiter:junit-jupiter to v5.9.3 (#4032)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-01 10:14:20 +02:00
97172df0dc Update dependency com.intellectualsites.bom:bom-newest to v1.27 (#4033)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-01 10:03:01 +02:00
c9746b182c Update plugin xyz.jpenilla.run-paper to v2.1.0 (#4034)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-01 10:02:48 +02:00
10a2b80ffc Update dependency com.diffplug.spotless to v6.18.0 (#4030)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-29 15:30:00 +02:00
ca0f38255d Fix /plot area create <name> without passing a specific terrain type (#4025)
fix: Ensure PlotAreaBuilder#plotAreaType returns non-null value
2023-04-29 15:27:49 +02:00
0484ac73af Improve testability for different versions (#4018)
* Ignore run folders

* Add a bulk of supported test environments

* Fix gitignore

* Fix gitignore

* Fix gitignore
2023-04-22 11:33:00 +02:00
1a712ad3c1 fix: account for false permissions when checking range (#4014) 2023-04-21 23:24:14 +01:00
2d1f483469 fix: clear above and below plot gen heights if build heights are larger (#3991)
- Fixes #3985
2023-04-13 17:34:49 +01:00
91830e233b Fix Misaligned SVG In IJ project view (#4011) 2023-04-10 11:54:29 +02:00
561edb83bf Update renovate.json (#4005) 2023-04-01 17:52:58 +02:00
0e09cf223a Update dependency org.enginehub:squirrelid to v0.3.2 (#4002)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-27 10:43:58 +02:00
d78360d6eb fix: correct variable check in schematic dimensions
- Fixes #3999
2023-03-26 13:31:01 +01:00
1464804c11 Update dependency me.clip:placeholderapi to v2.11.3 (#3994)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 23:04:41 +00:00
8629eae5fc Update dependency com.diffplug.spotless to v6.17.0 (#3989)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 23:56:01 +01:00
7b8ba7c3ac Update github/codeql-action digest to 168b99b (#3992)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 23:54:31 +01:00
77c7466c17 Update dependency cloud.commandframework:cloud-services to v1.8.3 (#3993)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 23:54:22 +01:00
82fe76fd37 Update dependency com.intellectualsites.bom:bom-newest to v1.25 (#3995)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 23:53:15 +01:00
3f81ea4ef8 Update worldedit to v7.2.14 (#3996)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-21 23:52:56 +01:00
745b06a008 fix: fix generation by re-adding important method 2023-03-16 17:42:48 +00:00
77b2bd166a Update dependency io.github.gradle-nexus.publish-plugin to v1.3.0 (#3987)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-15 09:43:41 +00:00
8e02336c44 Reapply stash 2023-03-15 10:30:38 +01:00
3adfbde45a Don't format JSON files 2023-03-06 11:49:18 +01:00
e6db8e2750 Perform code formatting according to editorconfig (#3981)
* Perform code reformatting

* Fix javadoc errors
2023-03-06 11:38:30 +01:00
9cd0ee9b49 Cleanup deprecated methods (#3980) 2023-03-06 11:21:14 +01:00
d455d1fcd7 Merge branch 'v6' into v7 2023-03-06 10:48:51 +01:00
ea19ff783f Back to snapshot for development 2023-03-06 10:47:51 +01:00
447e4c7d58 Release 6.11.1 2023-03-06 10:40:17 +01:00
89031447f2 Migrate left over occurrences to enhanced switches (#3979)
* Migrate left-overs to enhanced switches

* More
2023-03-06 10:25:02 +01:00
4210a3a555 Deprecate unused methods for removal (#3977) 2023-03-06 10:13:03 +01:00
42e146b8c7 Delete unused HyperverseWorldManager file 2023-03-05 20:53:00 +01:00
a5fdcda673 Merge branch 'v6' into v7 2023-03-05 10:18:55 +01:00
52823f5024 Update Ilshidur/action-discord digest to 08d9328 (#3974)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-05 10:15:38 +01:00
1326c257a0 Update dependency com.intellectualsites.arkitektonika:Arkitektonika-Client to v2.1.2 (#3972)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-05 10:15:27 +01:00
fc3137cd96 Fix farmland moisturize (#3978)
* fix: Fix farmland gets moisturizes

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* chore: Revert code reformat

Signed-off-by: ByteExceptionM <git@byteexception.eu>

---------

Signed-off-by: ByteExceptionM <git@byteexception.eu>
2023-03-05 10:15:05 +01:00
a5c53a96d1 Record-inize methods (#3976) 2023-03-05 10:07:36 +01:00
c46cc73f52 Turn down renovate a bit 2023-03-05 00:03:39 +01:00
276e619caa Merge branch 'v6' into v7 2023-03-04 11:19:48 +01:00
f11acacedd Update dependency com.intellectualsites.prtree:PRTree to v2.0.1 (#3975)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-02 22:36:18 +01:00
f636a5ec63 Merge branch 'v6' into v7 2023-03-02 20:48:43 +01:00
d1bac90745 Update developers field 2023-03-02 20:48:33 +01:00
785362c576 Merge branch 'v6' into v7 2023-03-02 12:34:18 +01:00
e98f628d34 Pin GH actions to SHA to avoid mutable refs (#3973) 2023-03-02 12:30:14 +01:00
b2ab61559c Update dependency com.diffplug.spotless to v6.16.0 (#3970)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-02 00:46:34 +01:00
dd6eb8e74f Update dependency cloud.commandframework:cloud-services to v1.8.2 (#3971)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-03-02 00:46:19 +01:00
97cdd03ea4 Update dependency gradle to v7.6.1 (#3967)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-27 21:24:04 +01:00
f5118e6802 Don't fire 'PlotUnlinkEvent' twice on plot clear (#3947) 2023-02-23 09:26:30 +01:00
94ca5cf679 Update dependency cloud.commandframework:cloud-services to v1.8.1 (#3965)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-22 23:47:31 +01:00
5a55a1f602 Update dependency io.github.gradle-nexus.publish-plugin to v1.2.0 (#3966)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-22 23:47:13 +01:00
1e7ba7d173 Merge branch 'v6' into v7 2023-02-12 19:06:11 +01:00
ed33635a15 Update dependency com.diffplug.spotless to v6.15.0 (#3959)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-11 09:35:35 +01:00
888682e5d0 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.24 (#3960)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-11 09:35:21 +01:00
72bb5f00b0 Back to snapshot for development 2023-02-10 17:16:52 +01:00
773fd6f59f Release 6.11.0 2023-02-10 17:12:15 +01:00
aa784e98f8 Merge branch 'v6' into v7 2023-02-10 16:44:57 +01:00
5cce86d924 feat: Add event firing on remove road entity (#3955)
* feat: Add event firing on remove road entity

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* chore: Add some more entity vars

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* chore: Rename method

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* chore: Code cleanup

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* chore: Code reformat

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* chore: Change iterator removal

Signed-off-by: ByteExceptionM <git@byteexception.eu>

* Comply with checkstyle

---------

Signed-off-by: ByteExceptionM <git@byteexception.eu>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-02-09 20:51:59 +01:00
84567bcb00 Update dependency com.diffplug.spotless to v6.14.1 (#3957)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-06 12:48:30 +01:00
d7c2ab1d16 Make farmland keep its moisture (#3952)
Handle MoistureChangeEvent for farm land
2023-01-31 11:22:13 +01:00
0d359ade0c Update dependency com.diffplug.spotless to v6.14.0 (#3950)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-28 19:21:35 +01:00
ffbec24290 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.23 (#3948)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-24 22:35:15 +01:00
586474c8e6 Merge branch 'v6' into v7 2023-01-23 13:40:52 +01:00
70b6636f50 Revert "Cleanup deprecated methods"
This reverts commit 26692d6633.
2023-01-23 13:40:47 +01:00
ab357deb48 Put more legacy web interface deprecations in place 2023-01-23 13:40:35 +01:00
bd62d1a1c7 Merge branch 'v6' into v7 2023-01-23 13:28:12 +01:00
6130c3dfa5 Clarify 2D biome deprecation 2023-01-23 13:28:05 +01:00
26692d6633 Cleanup deprecated methods 2023-01-23 13:27:08 +01:00
bb0f200429 Merge branch 'v6' into v7 2023-01-23 13:18:28 +01:00
5787588500 Move BukkitPlotGenerator#generateChunkData() deprecation from v7 to v6 2023-01-23 13:18:20 +01:00
bed62edc02 Resolved conflicts 2023-01-23 13:03:26 +01:00
ee0f389c78 Merge branch 'v6' into v7 2023-01-23 13:01:48 +01:00
b40383b5a4 Back to snapshot for development 2023-01-23 12:33:51 +01:00
be8903128d Release 6.10.9 2023-01-23 12:28:33 +01:00
08800ec16d Cleanup deperecated WorldEdit met
Co-authored-by: Matthew Kaulfers <42121989+mkaulfers@users.noreply.github.com>
2023-01-22 11:26:07 +01:00
83e274ff9f Revert "PS-3908: Cleanup deprecated methods to improve code maturity. (#3944)"
This reverts commit 0dd8b1053c.
2023-01-22 11:21:01 +01:00
0dd8b1053c PS-3908: Cleanup deprecated methods to improve code maturity. (#3944)
https://github.com/IntellectualSites/PlotSquared/issues/3908
2023-01-22 00:02:15 +01:00
0558fcf5d5 Provide full verbosity for invalid components 2023-01-21 22:27:20 +01:00
5af8be4293 chore: Remove things marked as for removal (#3941)
* chore: Remove things marked as for removal

* Address feedback

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-01-21 16:44:28 +01:00
cbacdd67eb Merge branch 'v6' into v7 2023-01-21 16:39:14 +01:00
c45bbe3ec5 fix: ensure plots are fully unlinked before the clear itself is run (#3933)
* fix: ensure plots are fully unlinked before the clear itself is run

* Update Core/src/main/java/com/plotsquared/core/plot/PlotModificationManager.java

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2023-01-19 09:01:06 +01:00
746028afbc *Actually clean up 2023-01-17 13:25:46 +00:00
b79537ebbc Clean up merge 2023-01-17 12:59:16 +00:00
6efd581500 Merge branch 'v6' into v7
# Conflicts:
#	.github/workflows/codeql.yml
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PaperListener.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/ProjectileEventListener.java
#	Core/src/main/java/com/plotsquared/core/command/Add.java
#	Core/src/main/java/com/plotsquared/core/command/Caps.java
#	Core/src/main/java/com/plotsquared/core/command/Cluster.java
#	Core/src/main/java/com/plotsquared/core/command/Continue.java
#	Core/src/main/java/com/plotsquared/core/command/Copy.java
#	Core/src/main/java/com/plotsquared/core/command/Save.java
#	Core/src/main/java/com/plotsquared/core/command/Visit.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	build.gradle.kts
2023-01-17 11:51:39 +00:00
07e598e48f fix: account for exclusivity of max build height where requires (#3935) 2023-01-16 21:15:35 +00:00
f6f00dfcda fix: Remove chunk#isLoaded call in BukkitChunkCoordinator (#3934) 2023-01-16 17:14:20 +00:00
63a6bdc1d6 Terminate process if .git folder is not a repository (#3937)
Terminate process if folder is not a repository
2023-01-16 00:18:51 +01:00
abbac057ed Default to unix line endings (#3932)
* Default to unix line endings

* Respect preconfigured settings
2023-01-15 17:54:52 +01:00
c978322036 Separate workflows between PRs and pushes (#3928)
* Separate workflows between PRs and pushes

* Fixup
2023-01-15 14:10:41 +01:00
39d2f1a72c chore: remove uses of deprecated Permissions class and add javadoc notes (#3930)
- Closes #3907
2023-01-15 14:08:59 +01:00
86919b8841 Update dependency com.diffplug.spotless to v6.13.0 (#3929)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-15 10:28:43 +01:00
1448d8d4af Fixes #3906 by fine-graining the help menu generation localization support 2023-01-14 00:42:46 +01:00
8d9a387587 Merge branch 'v6' into v7 2023-01-14 00:31:05 +01:00
00722bc463 Reduce /plot home overhead (#3921)
* Add JFR events

* Replace global connected plots cache with local cache

* Simplify isOwner check

* Avoid extensive hashing of plots

* Clear caches in more cases

* Revert "Add JFR events"

This reverts commit 78c107f1
2023-01-14 00:27:09 +01:00
6a34a1996f Update dependency com.intellectualsites.bom:bom-1.18.x to v1.22 (#3918)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-13 22:28:58 +01:00
1d201b04ba chore: Update a few deprecations (#3913) 2023-01-13 17:48:13 +01:00
e887a59158 Officially deprecated BukkitPlayer#BukkitPlayer() (#3922)
* Officially deprecated BukkitPlayer#BukkitPlayer()

* Address review feedback
2023-01-12 10:03:11 +01:00
d1b8f652a7 Update dependency org.junit.jupiter:junit-jupiter to v5.9.2 (#3923)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-11 22:16:12 +01:00
0707aa47c9 Merge branch 'v6' into v7 2023-01-11 22:12:31 +01:00
4aa7bc51bc Include missing javadoc option 2023-01-11 22:11:11 +01:00
0f0030916f Add source documentation to javadocs and add dependency tab (#3917)
Get the most out of javadocs
2023-01-11 18:25:51 +01:00
8c57d616cf Drop HTTP4J (#3916) 2023-01-11 18:18:49 +01:00
66660507e0 Fix relocation of informative annotations 2023-01-11 08:48:12 +01:00
a12490c3eb Fixes #3919 2023-01-09 23:50:13 +01:00
bbf1e4fe61 Back to snapshot for development 2023-01-09 15:53:19 +01:00
febac6fa40 Release 6.10.8 2023-01-09 15:43:51 +01:00
99ee8a780d Back to snapshot for development 2023-01-09 15:40:32 +01:00
577a0d8ed9 Unstage 6.10.7 2023-01-09 15:28:31 +01:00
02ae14894a Stage 6.10.7 2023-01-09 15:23:50 +01:00
36e5f36660 Merge branch 'v6' into v7 2023-01-09 11:50:56 +01:00
78dbe7fbbc Back to snapshot for development 2023-01-09 11:41:59 +01:00
669293566b Release 6.10.6 2023-01-09 11:41:12 +01:00
350eae7813 Temporarily create javadocs for v7 snapshots 2023-01-09 11:35:11 +01:00
12dc198a86 Temporarily create javadocs for v7 snapshots 2023-01-09 11:33:49 +01:00
fb2533d66a Start deployment of v7 snapshots 2023-01-09 10:42:08 +01:00
707c7be5bd Remove unused editorconfig rules (#3915) 2023-01-09 10:26:05 +01:00
37d6dcc7ea Update javadoc links 2023-01-09 10:21:55 +01:00
becd8c4eaf Replace licenser with spotless (#3914) 2023-01-08 23:16:40 +01:00
530fcc0fea Revert GAV changes 2023-01-08 16:36:57 +01:00
7135bdd6aa Fix compile errors 2023-01-08 10:36:41 +01:00
3198c3b081 Merge branch 'v6' into v7 2023-01-08 10:20:15 +01:00
339ca8e30f Fix wrong plot id calculation for negative coordinates (#3898) 2023-01-04 12:35:12 +01:00
742d78a505 Add 1.19.3 to the issue template 2022-12-23 13:41:58 +01:00
120bf37196 Fix dispensers loading Legacy Material Support (#3894)
Fixes https://github.com/IntellectualSites/PlotSquared/issues/3883
2022-12-23 09:08:38 +00:00
2a40a6b35e Update dependency com.intellectualsites.bom:bom-1.18.x to v1.21 (#3890)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-13 22:45:51 +01:00
ea1f35b45a Update dependency cloud.commandframework:cloud-services to v1.8.0 (#3891)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-13 22:44:29 +01:00
15e63378a7 Update worldedit to v7.2.13 (#3889)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-11 08:39:32 +01:00
f3bc504a6f refactor: adjust specific Nullable annotations used (#3869) 2022-12-02 12:39:38 +00:00
3a8fae47a0 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.20 (#3882)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-28 15:23:44 +01:00
70cb1cd100 Back to snapshot for development 2022-11-28 11:18:56 +01:00
2067cc1670 Release 6.10.5 2022-11-28 11:18:06 +01:00
e6338976dd Update dependency gradle to v7.6 (#3880)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-25 19:20:37 +01:00
90ebd5d5ed feat: add a permission to override-allow a merge if the other plot's owner is offline (#3844) 2022-11-25 10:48:33 +00:00
c973ee8649 Revert "feat: check merge limits when completing auto-merge (#3868)" - Fixes a bug in 6.10.4 (#3876)
Revert "feat: check merge limits when completing auto-merge (#3868)"

This reverts commit 25ce7a83f1.
2022-11-20 10:58:04 +01:00
c1543f034c feat: improve handling of null issues in plot analysis (#3867) 2022-11-17 17:23:44 +00:00
6baf339ecb Update dependency com.intellectualsites.bom:bom-1.18.x to v1.19 (#3874)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-16 18:35:03 +01:00
11906ef1c9 Back to snapshot for development 2022-11-16 11:30:23 +01:00
ee8902154a Release 6.10.4 2022-11-16 11:26:03 +01:00
b5bc1988e5 feature: implement road flags as widely as seems reasonable (#3870)
* feature: implement road flags as widely as seems reasonable
 - Closes #3047
 - Any further road flag implementations would be very specific from what I can gather, and thus the gist of #3047 is now implemented

* Add javadoc since tag

Co-authored-by: Alexander Brandes <mc.cache@web.de>

* Create util class for method

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-11-15 19:07:38 +01:00
2147012beb chore: deprecate paper 1.13 listener as P2 effectively doesn't support 1.13 (#3872) 2022-11-14 22:58:05 +01:00
52bb561689 fix: attempt to recover from IllegalStateException when restoring block tags (#3838)
- Fixes #3801
2022-11-14 16:47:24 +01:00
25ce7a83f1 feat: check merge limits when completing auto-merge (#3868)
- Closes #3748
2022-11-13 11:57:41 +01:00
55c8a590e7 Fix item thrower/owner can be null (#3866)
fix: item thrower/owner can be nuill
 - Fixes #3862
2022-11-12 17:10:21 +01:00
28bd993680 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.18 (#3864)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-06 11:13:29 +01:00
8330f37d8a Back to snapshot for development 2022-11-02 09:35:57 +01:00
985fae65b6 ÂRelease 6.10.3 2022-11-02 09:34:33 +01:00
db2d590e8e fix: account for mismatched road-schematic heights (#3854) 2022-10-23 21:22:21 +02:00
c8d356783a Update dependency com.intellectualsites.bom:bom-1.18.x to v1.17 (#3853)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-20 10:23:56 +02:00
4947450ff0 Back to snapshot for development 2022-10-18 23:14:03 +02:00
de4e91ff62 Release 6.10.2 2022-10-18 23:12:27 +02:00
fe5e3d5f6d Annotate ExpireManager with @Inject (#3852)
fix: annotate ExpireManager with @Inject
2022-10-18 10:17:34 +02:00
b8b3098022 feat: Move ExpireManager to Guice by removing legacy IMP references (#3845)
* feat: Move ExpireManager to Guice by removing legacy IMP references

* Mark ExpireManager IMP as deprecated and add comments

* Add import for PlotPlatform for function reference

* Add ExpireManager instance call and optimize performance
2022-10-17 09:31:48 +02:00
0ae8fc46b8 Update dependency com.github.spotbugs:spotbugs-annotations to v4.7.3 (#3851)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-17 09:24:42 +02:00
e0762f63a8 chore: Replace paper reference in favor of bom 2022-10-15 16:04:30 +02:00
9f3850000c fix: adjust nullability checks for shulkers in the kill road mobs task (#3842)
- Fixes #3789
2022-10-15 15:26:14 +02:00
76c6be9ba7 Fix 'No resource for locale 'lang' found ' error (#3830)
* Fix #3820

* Reword message and add link to completed translations

* Fix #3820

* Reword message and add link to completed translations

* Add line breaks for better code readability

* Add line breaks for better code readability

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-10-13 19:19:20 +02:00
308a5aa781 Ensure all setBlock methods in BlockArrayCacheScopedQueueCoordinator apply the correct offset (#3843)
- Fixes #3783
2022-10-13 19:17:27 +02:00
e244527538 Make more complex patterns work correctly (#3847)
allow more complex patterns to work correctly
2022-10-13 19:16:19 +02:00
11dd013333 fix: Adjust schematic height logic when pasting and actually set air as well (#3840) 2022-10-13 16:46:29 +01:00
b740d5854c Support MiniMessage in plot-title flag (#3835) 2022-10-10 17:41:35 +01:00
d5445cfbef Don't kill owned road entities (leashed / named) (#3829) 2022-10-10 17:41:25 +01:00
3effaefda7 chore: Announce releases on Discord (#3839) 2022-10-09 16:40:51 +02:00
49b19e0eaf Check proper locations on PortalCreateEvent (#3834)
check proper locations on PortalCreateEvent
2022-10-08 15:13:11 +02:00
caef3a923b Deprecate PlotId#copy (#3821) 2022-10-08 14:11:16 +01:00
d4c3ceaf2b Move license into jar during compile process (#3826) 2022-10-08 14:10:57 +01:00
25e6aecf13 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.16 (#3825)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-04 22:54:56 +02:00
33c11fdee9 Back to snapshot for development 2022-10-04 19:31:27 +02:00
316dd92667 Release 6.10.1 2022-10-04 19:30:44 +02:00
e53d2ac449 Update the plot sign when a plot has been purchased (#3822) 2022-10-03 21:51:17 +02:00
5786e8cc7a refactor: replace guava's Iterables with Java's stream API (#3823) 2022-10-03 21:51:05 +02:00
1b717c9b10 Only show visible players in /plot near (#3819)
feat: check visibility of player in `/plot near`
2022-10-03 21:50:41 +02:00
35abae99ca Improve feedback for invalid patterns (#3818)
improve feedback for invalid patterns
2022-10-02 22:22:08 +02:00
d1a85982fb Fix "set block timer" error after "/plot download" with legacy-webinterface setting (#3812)
Add missing `Plot.removeRunning` call to Download
2022-10-01 11:37:24 +02:00
3446b913cd plots.auto.mega fix for #3815 (#3816)
Co-authored-by: Resi <unconfigured@null.spigotmc.org>
2022-09-28 10:53:44 +02:00
8b8fd6aab7 Update dependency com.intellectualsites.bom:bom-1.18.x to v1.15 (#3809)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-22 22:26:11 +02:00
520bb64eca Back to snapshot for development 2022-09-21 16:29:17 +02:00
60d266b2d7 Release 6.10.0 2022-09-21 16:28:17 +02:00
8deeef4f7d Add allay to animals (#3788)
add allay to animals
2022-09-21 16:18:34 +02:00
9b0b071c0c Add GLOW_BERRIES to VineGrowFlag (#3803) 2022-09-21 16:18:18 +02:00
81a3f1098d Update dependency org.junit.jupiter:junit-jupiter to v5.9.1 (#3807)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-21 16:18:08 +02:00
efc248dcdb Update dependency com.intellectualsites.bom:bom-1.18.x to v1.14 (#3794)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-12 11:19:07 +02:00
476f3d328d feature: add flag for beacon effects of other plots (#3627)
* feature: add flag for beacon effects of other plots

Took 7 minutes

* fix: don't add the beacon effect flag if the platform is not paper

Took 2 minutes

* fix: creating consistency in documentation

Took 7 minutes

* feature: add global paper setting for the beacon-effect

* fix: description of the plot flag and rewrite of the listener

* fix: renamed flag and added road support

* fix: renamed flag and changed flag functionality

* fix: added spigot fallback listener and fixed NPE

* refactor: Address checkstyle violations

* addition: remove beacon effects when player leaves a plot

* fix: updated javadoc and fixed usage of the PlotListener#addEffect method

* chore: Run license updater

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-09-05 20:06:37 +02:00
69f5f88183 Update dependency com.github.spotbugs:spotbugs-annotations to v4.7.2 (#3793)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-09-05 09:40:41 +02:00
6df63f7fc7 Invoke -parameters on compile time (#3787)
chore: Invoke -parameters on compile time
2022-09-03 12:55:55 +02:00
295b8a0135 Update dependency cloud.commandframework:cloud-services to v1.7.1 (#3784)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-27 09:32:40 +02:00
fcc5bc5473 Update dependency net.essentialsx:EssentialsX to v2.19.7 (#3780)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-24 09:56:33 +02:00
408b834376 [ci skip] chore: Add renovate schema URL 2022-08-20 15:31:51 +02:00
986812b9e4 chore: make snow set more future-proof (#3768) 2022-08-19 13:41:04 +02:00
8d4333ad9d fix(deps): update dependency net.essentialsx:essentialsx to v2.19.6 (#3770)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-13 10:12:05 +02:00
9ff9097ff9 fix(deps): update dependency net.essentialsx:essentialsx to v2.19.5 (#3767)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-12 14:13:42 +02:00
1ef424a2f1 fix(deps): update dependency com.intellectualsites.bom:bom-1.18.x to v1.13 (#3766)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-10 16:52:47 +02:00
9fd96dbaa2 build: Back to snapshot for development 2022-08-10 11:10:41 +02:00
b0a4e11c46 build: Release 6.9.4 2022-08-10 11:09:51 +02:00
77bce43ace fix: replace usages of snow tag (#3758)
* replace usages of snow tag

* powder snow is 1.17+
2022-08-10 11:03:20 +02:00
cba1927cc7 Items no longer despawn on road when natural_mob_spawning = true and kill-road-items = false (#3764)
* fix: handling of item despawning on road

* chore: de-duplicate check

* chore: check in PaperListener for consistency
2022-08-10 10:22:19 +02:00
3d19c5c2ad perf: avoid quadratic overhead for UUID collection (#3749)
avoid quadratic overhead for UUID collection
2022-08-08 12:50:22 +02:00
e0eff15694 fix: use correct uuid type in /grant (#3759)
use correct type
2022-08-07 21:19:01 +02:00
0bdeeea83b fix(deps): update worldedit to v7.2.12 (#3762)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-07 21:16:18 +02:00
7669e79da1 refactor: simplify timeout logic in uuid pipeline (#3760)
simplify timeout logic
2022-08-06 16:32:11 +02:00
6f96daae56 Update bug_report.yml 2022-08-06 13:49:25 +02:00
d1021d19da chore(deps): update dependency gradle to v7.5.1 (#3761)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-06 13:49:01 +02:00
ee589ac7f0 fix(deps): update worldedit to v7.2.11 (#3750)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-31 15:58:38 +02:00
3b747ffecf Don't allow wall corals to dry (#3746) 2022-07-29 23:00:55 +02:00
4e5a2b9f96 fix: Add user friendly message for creationdate placeholder (#3745) 2022-07-29 23:00:37 +02:00
aeb4350ccb Update bug_report.yml 2022-07-29 19:01:35 +02:00
9609990832 build: Update dependency com.intellectualsites.bom:bom-1.18.x to v1.12 (#3739)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-26 22:47:51 +02:00
0e4319b757 build: Update dependency org.junit.jupiter:junit-jupiter to v5.9.0 (#3741)
* build: Update dependency org.junit.jupiter:junit-jupiter to v5.9.0

* Update renovate.json

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-07-26 22:47:25 +02:00
c8f4907f77 build: Back to snapshot for development 2022-07-25 21:11:35 +02:00
dcf98c2298 build: Release 6.9.3 2022-07-25 21:10:39 +02:00
ae59c7442f fix: improve handling of missing message files (#3718)
* improve handling of missing message files

* fix javadoc

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-07-25 21:02:54 +02:00
98708118d8 Deprecate the static Permissions "util" class that is almost entirely superseded by methods in PermissionHolder instances themselves (#3695)
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-07-24 15:55:43 +02:00
276d8f8e1e change message of /p remove <player> if player does not need to be removed (#3734)
refactor: change message of `/p remove <player>` if unnecessary
2022-07-24 10:32:29 +02:00
87f89541b5 build: Update dependency com.intellectualsites.bom:bom-1.18.x to v1.11 (#3726)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-15 10:04:01 +02:00
93f6de7029 build: Update dependency gradle to v7.5 (#3727)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-15 10:03:27 +02:00
73d2686b17 build: Update dependency com.intellectualsites.bom:bom-1.18.x to v1.10 (#3723)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-06 00:14:20 +02:00
c446a95b07 build: Back to snapshot for development 2022-07-05 22:26:52 +02:00
3676e1df35 build: Release 6.9.2 2022-07-05 22:25:57 +02:00
12e2705260 Revert #3681 (#3722)
Revert "Adjust schematic height logic when pasting and actually set air as well (#3681)"

This reverts commit 08ce4c872c.
2022-07-05 15:02:25 +02:00
31e777a03a build: Update dependency me.clip:placeholderapi to v2.11.2 (#3720)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-04 14:07:14 +02:00
7f436c405b fix: Don't fail post processing compilation on non-ascii charmap (#3719) 2022-07-03 14:58:17 +02:00
4d4d2ab087 Ignore cancelled projectile launch events (#3709) 2022-06-28 21:15:09 +02:00
91017acce4 Realistically only need the "highest" y level of adding overlay block errors 2022-06-27 17:41:47 +01:00
c0bfa297bb Ensure use of new generation methods only on 1.19 and above 2022-06-27 17:40:46 +01:00
e90fd231d9 build: Update dependency com.github.spotbugs:spotbugs-annotations to v4.7.1 (#3714)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-06-27 17:00:13 +02:00
cd9f0789de build: Update bom to 1.9 2022-06-27 16:47:32 +02:00
5f4c8d92df build: Back to snapshot for development 2022-06-27 14:57:32 +02:00
263cb47a21 build: Release 6.9.1 2022-06-27 14:56:44 +02:00
005600c99e Show old flag value in remove command (#3711) 2022-06-27 13:31:45 +02:00
26bec7fe2f style: Address javadoc violations 2022-06-26 11:18:33 +02:00
f4b886d977 Minor cleanup of the plot analyze code (#3708)
- No need to wrap the final analysis into another async method. It's already contained in an async task
 - Don't overstretch a chunk bounday when setting blocks to newBlocks array
2022-06-23 19:18:29 +02:00
75fd9b2631 Update to new Spigot generation API (#3659)
* Address deprecations in queue/generation code

* Move to new generation API
 - Currently not working due to lack of biome-setting capability via BiomeProvider for flat worlds

* Any fixes to flat world biome setting will target 1.19

* Ensure compiled is actually set to true in BlockBucket

* Delegate to platformGenerator in deprecated generation method if applicable when using new generation methods (1.19)

* Re-add wrongly removed method

* Handle exceptions using logger

* We can simplify getting relative offset using floormod

* Replace many booleans with EnumSet

* Address comments, remove needless boolean return for populateChunk
2022-06-22 14:57:39 +02:00
c09d0d882e Use single PlotListener instance (#3704) 2022-06-22 12:50:56 +01:00
312cb2996c Better handling of offline projectile shooters (#3705) 2022-06-22 12:50:46 +01:00
f218902581 Implement build height limits into more events (#3691)
* Implement build height limits into more events

* Implement util method to check if y is within world build limits

* Extract duplicate player-build-height-checking to plot area
 - Extract to core module to allow any possible future platforms to access the method, as they will always duplicate

* Add code tag to javadoc

Co-authored-by: Alexander Brandes <mc.cache@web.de>

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-06-21 19:09:29 +02:00
f27009216c chore: Replace AnnotationHelper class (#3706) 2022-06-21 19:09:17 +02:00
6b680fb2c0 Merge v6/v7 2022-06-21 11:00:53 +02:00
dda52ebc2e build: Update dependency cloud.commandframework:cloud-services to v1.7.0 (#3701)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-06-20 10:47:49 +02:00
9ac8d38bab chore: Remove checkerframework from gradle libs
Closes #3700
2022-06-20 10:43:43 +02:00
6a54328f7d refactor: replace usages of switch over keyed enums (#3673) 2022-06-19 00:59:43 +01:00
7279862def docs: Publish javadocs to GH actions (#3686)
* docs: Publish javadocs to GH actions

* chore: Use updated URL

* chore: Use correct URL
2022-06-17 23:40:29 +02:00
08ce4c872c Adjust schematic height logic when pasting and actually set air as well (#3681) 2022-06-17 15:39:41 +01:00
27ffe4fcdc Address deprecations in queue/generation code (#3658) 2022-06-16 15:41:03 +01:00
8afcaccb8a Merge branch 'v6' into v7 2022-06-16 15:26:03 +01:00
c83b13e374 Merge branch 'v6' into v7
# Conflicts:
#	Core/src/main/java/com/plotsquared/core/command/Chat.java
#	Core/src/main/java/com/plotsquared/core/command/Save.java
#	Core/src/main/java/com/plotsquared/core/configuration/caption/Templates.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
#	Core/src/main/java/com/plotsquared/core/util/MainUtil.java
#	Core/src/main/java/com/plotsquared/core/util/RegExUtil.java
#	build.gradle.kts
#	gradle/libs.versions.toml
2022-06-16 15:25:33 +01:00
2b0c5b1e21 Reset wall filling on clear (#3680)
- Implements #3591
2022-06-16 16:22:27 +02:00
3d5c694daa chore: Comply with OSSRH licensing guidelines (#3684) 2022-06-15 20:17:17 +02:00
23360057b9 Chore: General deprecations (#3660)
Address deprecations for removal throughout the plugin
2022-06-13 23:45:27 +02:00
d153232969 Fix maximum plot number check in /plot continue counting the current plot twice (#3674)
Fix max plot restriction check in continue command

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-06-13 23:44:56 +02:00
bb0aa8d5cc fix: Don't publish root directory to maven repository (#3676)
* fix: Don't publish root directory (Fixes #3647)

* fix: More investigations

* fix: Exclude task 'jar' from root project

* chore: Keep group ID in the root scope
2022-06-13 15:23:12 +02:00
d69f3b0893 build: Update dependency com.intellectualsites.bom:bom-1.18.x to v1.5 (#3677)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-06-13 11:38:28 +02:00
565838ad43 [ci skip] chore: Update renovate excludes (Closes #3678) 2022-06-13 11:36:46 +02:00
8b52461271 build: Back to snapshot for development 2022-06-13 11:25:07 +02:00
d08381dfed build: Release 6.9.0 2022-06-13 11:23:48 +02:00
b6c45f2df3 Add an on-complete task to PlotArea#mergePlots (#3671)
* Add an on-complete task to PlotArea#mergePlots

* Fix typo
2022-06-13 09:06:01 +02:00
b9479405e1 Ensure forceSync is provided when constructing chunk coordinators (#3657)
* Ensure forceSync is provided when constructing chunk coordinators

* Re-add old factory create method and deprecate for removal

* Remove old create method that Guice doesn't like
2022-06-12 10:47:43 +02:00
a238ff19bf Implement tile entities to generation using Populators (#3665)
* Implement tile entities to generation using Populators
 - Fixes #3051

* Javadocs

* Don't do the big error if heads don't work

* Address comments regarding javadocs/comments

* Ensure Location is still sealed, and add api description annotation to public methods in UncheckedWorldLocation

* Clean up HybridGen
 - There's no need for while loops acting as a modulo after we've already performed a modulo
 - Make the code-sections calculating if positions are in the wall/road more readable
 - Collaps duplicate if-elseif bodies

* Better exception handling when setting data to LimitedRegion during chunk population

* Address comments

Co-authored-by: Alexander Brandes <mc.cache@web.de>

* Better naming for "legacy" block state populator

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-06-12 10:47:25 +02:00
c93b08d0c7 feat: Add 1.19 music disk to the /plot music GUI (#3668)
feat: Add 1.19 music disk to the GUI
2022-06-12 10:47:00 +02:00
1470b7117a chore: Add tadpole buckets to the list of dispensable items (#3669)
chore: Add tadpole buckets to the list of disposables

Signed-off-by: Alexander Brandes <mc.cache@web.de>
2022-06-12 10:46:21 +02:00
7cbc67f4fc chore: Fix typo 2022-06-11 17:14:51 +02:00
0a76bbb2b0 Update README.md 2022-06-11 17:14:05 +02:00
09cc59a1c1 docs: Unify WE, P2 and Fawe abbreviations (#3672) 2022-06-11 16:16:06 +02:00
60f7113105 build: Update bom 2022-06-11 14:53:39 +02:00
26c0c1b7cd Merge branch 'v6' into v7 2022-06-11 14:11:25 +02:00
bf646be482 Only load world cofigurations if WorldEdit has fully enabled (safe to do) (#3666)
* Only load world cofigurations if WorldEdit has fully enabled (safe to do)
 - Fixes #3664

(cherry picked from commit f2e1e99be3b4f1fd5ce00e32ea7773dd4d1855aa)

* Fix imports

* QueryCapability is effectively a "dumb" method

* Update Core/src/main/java/com/plotsquared/core/PlotSquared.java

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-06-10 16:52:17 +02:00
cc7e17960b docs: Add 1.19 to issue template 2022-06-10 13:42:09 +02:00
3c75b170f0 fix: mob cap counting for each connected plot individually (#3643)
cap meta is now handled in the base plot
2022-06-10 01:27:39 +02:00
764c94c9cc Merge branch 'v6' into v7 2022-06-10 01:14:09 +02:00
a79c474957 Deprecate methods for removal that will be removed/had their signatures changed in v7 2022-06-09 13:49:58 +01:00
4bb480a238 chore: Update Code of conduct email (#3661) 2022-06-09 12:58:31 +02:00
9ffa935c0c build: Switch to bill of materials (#3653)
* build: Switch to managed dependencies

* build: Move bom to root build script

* build: Update bom

* Update build.gradle.kts

* fix: Use the correct bom version
2022-06-09 12:57:37 +02:00
3d87ee41b3 v7 is 7.0.0-SNAPSHOT 2022-06-08 14:42:14 +01:00
0a32268784 Prevent blocks moving/generating below and above build height (#3641)
* fix: cancel BlockFormEvent outside of build limit

* refactor: rename variables for easier readability

* fix: cancel liquid flow outside build limit

* refactor: implement to/from context
2022-06-05 20:51:07 +02:00
ae3b8c06f6 chore: Address Paper javadoc warnings (#3648) 2022-06-05 20:50:49 +02:00
713c4ad0d2 Remove aggregation of cross module javadocs (#3646)
chore: Don't aggregate javadocs anymore
2022-06-03 23:13:41 +02:00
fd8832ac98 Merge branch 'v6' into v7 2022-06-01 20:13:07 +02:00
48386c0828 build: Back to snapshot for development 2022-06-01 20:12:50 +02:00
625b3921e1 build: Release 6.8.1 2022-06-01 20:09:36 +02:00
48aa37d173 Update Readme SVG (#3642)
docs: Update Readme SVG
2022-05-30 13:47:25 +02:00
228acc196c Merge branch 'v7' of https://github.com/IntellectualSites/PlotSquared into v7 2022-05-29 22:05:37 +02:00
62197f3deb Merge branch 'v6' into v7 2022-05-29 22:05:17 +02:00
2c2314e95c refactor: return info.server for %plotsquared_currentplot_owner% if plot is a server plot (#3640) 2022-05-25 10:18:10 +02:00
5eb2fc3ad0 Kick players on merged plots appropriately (#3639)
fix: kick denied player regardless on all connected plots
2022-05-24 20:30:06 +02:00
82cd9a092c build: Update fawe to v2.2.0 (#3637)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-05-24 13:33:54 +02:00
62754362c2 build: Don't expose jcip and findbugs annotations to the world on runtime (#3533)
* build: Don't expose jcip and findbugs

* build: Revert relocation change of unpublished, shaded deps

* chore: Exclude .DS_Store files
2022-05-21 10:01:06 +00:00
daa9348993 chore: Change maven group and artifact ID (#3632)
chore: Change maven group and artifact ID
2022-05-21 11:58:30 +02:00
2e9dfd6f6f chore: Update PaperMC repository endpoint (#3633)
Migration - New PaperMC endpoints
2022-05-21 07:57:22 +02:00
7e4499e092 Merge branch 'v7' of https://github.com/IntellectualSites/PlotSquared into v7 2022-05-18 22:14:35 +02:00
396a1575d2 Merge branch 'v6' into v7 2022-05-18 22:13:29 +02:00
fc9fe1462f build: Back to snapshot for development 2022-05-18 22:07:22 +02:00
41f546ca6b build: Release 6.8.0 2022-05-18 22:05:31 +02:00
d037da33cb chore: Ignore .DS_Store files 2022-05-18 21:59:09 +02:00
dc2d08c67e build: Update release-drafter/release-drafter action to v5.20.0 (#3624)
* build: Update release-drafter/release-drafter action to v5.20.0

* Update release-drafter.yml

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-05-18 17:19:23 +02:00
953d57d1b5 Replace legacy color codes in flag examples (#3520) 2022-05-16 13:28:03 +01:00
96dfc27411 Fix lag caused when generating augmented worlds with roads (#3614)
- Begin by implementing forceSync to the queue system as we know the chunk will be accessible to edits in some cases (i.e. population).
 - Also implement custom SideEffectSets to override any decided by the default chunk consumer, as we do NOT want to update neighbours in population (this caused infinite generation to be required causing the lag and server death). We also do not want to enqueue the QueueCoordinator in AugmentedUtils as this would write to the world and update neighbours before we might want to (plus it's just used to restrict and offset the blocks being set)
 - Then implement disabling any biomes from being saved/set to the queue to prevent augmented worlds having their biomes overridden in roads
 - Consequently fix ScopedQueueCoordinator, preventing the y value of blocks being set from needlessly being changed, fixing road heights in augmented worlds
 - Finally we do not need a method with chunkObject in the signature in AugmentedUtils as this is no longer used by the method
2022-05-16 13:27:41 +01:00
171d2e5e99 Fix generation of augmented/partial worlds when single worlds are enabled (#3615) 2022-05-16 13:21:43 +01:00
4433892431 fix: Block Endermites from spawning if mob spawning is disabled (#3623) 2022-05-16 13:20:03 +01:00
b53d2d03a4 Merge branch 'v6' into v7 2022-05-15 15:41:17 +02:00
c1431c0971 build: Update to Paper 1.18.2 (#3622)
build: Align MM and Adventure version
2022-05-15 12:31:40 +02:00
98a07dad1b Fix plot analysis (#3618)
* Fix plot analysis
 - Stop using deprecated ChunkQueueCoordinator and create a new purpose-built coordinator
 - Generation is chunk-by-chunk thus the old blocks cache needs to be filled accordingly
 - Remove the **four** System#gc calls
 - Fixes #3464
 - Fix really weird dumb... maths? in ExpiryTask
 - Fixes #3600

* Add since annotation

* Address comments and maxY should be inclusive

* Annotate new queue as internal use only
2022-05-15 11:58:04 +02:00
0ffa22b7a6 Deprecations to Queues (#3613)
* Deprecations and niceties
 - Deprecate ScopedQueueCoordinator as it is poorly named
 - Deprecate ChunkQueueCoordinator for complete removal as it is poorly designed (though still used)

* Add since tags
2022-05-15 11:57:26 +02:00
60a0129fe9 Correctly use yIndex when regenerating plots in certain world configurations (#3601)
- Fixes #3597
2022-05-15 11:42:19 +02:00
62ee60a76c Update MiniMessage to 4.10.1 (#3617)
* chore!: bump MiniMessage to 4.10.1

BREAKING CHANGE: bumping MiniMessage and Adventure removes the adventure Template class and breaks the whole messaging system api wise

* chore: fix minimessage messages, fix circular method reference
2022-05-14 17:05:28 +02:00
d5f8a0842b make y location of homes always absolute part 2 (#3620) 2022-05-13 15:46:52 +02:00
f7d55ce105 Implement restoring tags directly using a supplied block (#3616)
- Reduces overhead when setting blocks via fallback
 - Also means blocks will not be accessed via world when they should be access via chunk (https://github.com/IntellectualSites/PlotSquared/pull/3612)
2022-05-11 13:12:19 +01:00
85911646f3 Add ability to disable random Mojang uuid API calls (#3586)
* feature: ability to disable impromtu Mojang uuid API calls

* refactor: update comment for the new setting
2022-05-11 13:11:57 +01:00
8b75dece69 Implement chunkObject into queueing (#3612) 2022-05-11 13:11:38 +01:00
7d6e515ba8 Improvements to /plot list command (#3585)
* refactor: list command shows owner better
added check for:
- unknown owners (UUID not cached/invalid)
- server plots
- plots owner by everyone

* fix: show correct color in list command if plot is owned by everyone

* refactor: improved List command for server plots

(cherry picked from commit fed700f0d8)

* refactor: removed duplicate code

* refactor: renamed placeholders to reflect their use

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-05-10 09:50:27 +02:00
13d7357c85 Niceties
- Better ordering of augmented information printed to consol on startup
 - Override
2022-05-10 01:43:01 +01:00
16e26b910c build: Update dependency com.github.spotbugs:spotbugs-annotations to v4.7.0 (#3606)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-05-09 13:53:59 +02:00
faadebd30e chore: Update my name (#3599) 2022-05-07 15:56:24 +02:00
2aeacb3dcf build: Back to snapshot for development 2022-05-05 10:07:58 +02:00
9db7791835 build: Release 6.7.0 2022-05-05 09:58:14 +02:00
f49ddb819d Add Plot flag for projectiles (#3581)
* feature: add flag for projectiles

* build: add License to ProjectilesFlag.java

Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-05-04 23:21:24 +02:00
d71c62771e build: Update dependency org.checkerframework:checker-qual to v3.22.0 (#3595)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-05-03 09:58:14 +02:00
a6aaa9538f Set plot biome chunk by chunk (#3590)
* Actually set plot biome chunk by chunk

* Better variable name for chunk position
2022-04-30 14:16:58 +02:00
0974fb2834 [ci skip] build: Update com.fastasyncworldedit to v2.1.2 (#3588)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-25 16:56:30 +02:00
8982b33b6c build: Update github/codeql-action action to v2 (#3589)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-25 15:59:30 +02:00
a7b3b3b7df build: Back to snapshot for development 2022-04-19 08:50:50 +02:00
888bb20e78 build: Release 6.6.3 2022-04-19 08:45:44 +02:00
b11bb6fa22 make y location of homes always absolute (#3568) 2022-04-19 00:48:51 +02:00
e5764b958d build: Replace jsr305 with spotbugs (#3576) 2022-04-19 00:48:23 +02:00
bfe3141ff1 style: Emphasize project icon in idea selection (#3577) 2022-04-19 00:47:38 +02:00
73c82deeb0 build: Switch back to upstream SquirrelID (#3575) 2022-04-19 00:46:39 +02:00
38682ecff6 fix: share the QueueCoordinator in PlotModificationManager#unlinkPlot (#3571)
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-04-15 07:01:53 +00:00
6a54dc7eff fix: typo (MaxBuildHeight -> MinBuildHeight) (#3572) 2022-04-15 08:59:01 +02:00
8454c29c91 fix: Make PlayerManager#resolveName blocking for entry title (#3556) 2022-04-11 14:38:02 +00:00
b2c9311a47 build: Update com.fastasyncworldedit to v2.1.1 (#3562)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-04 15:32:02 +02:00
c4aa497a2b build: Update actions/setup-java action to v3.1.0 (#3563)
* build: Update actions/setup-java action to v3.1.0

* Update build.yml

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Alexander Brandes <mc.cache@web.de>
2022-04-04 15:31:53 +02:00
c13f544390 build: Back to snapshot for development 2022-04-04 13:03:49 +02:00
c28177d6af build: Release 6.6.2 2022-04-04 12:56:13 +02:00
8a80f252cf chore: Fill in since TODOs 2022-04-04 12:54:42 +02:00
93571c72d1 build: Update dependency org.checkerframework:checker-qual to v3.21.4 (#3561)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-04 12:47:38 +02:00
6fd7379221 build: Update dependency gradle to v7.4.2 (#3560)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-04 12:46:49 +02:00
dc5c80d812 clean up PlayerCommandPreprocess listener (#3557) 2022-04-01 19:30:37 +02:00
96e9a61e7c refactor: Deprecate Load#secToTime() (#3558) 2022-04-01 19:30:11 +02:00
b9bd9b81e6 Make confirm tasks synchronous. It was changed in 7ac3f7ca03 (#3551) 2022-03-23 15:04:39 +01:00
ec77812879 build: Update com.sk89q.worldedit to v7.2.10 (#3554)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-21 11:49:34 +01:00
efc2083798 Change the default sign orientation to better match the wall location 2022-03-15 16:25:40 +00:00
3a6f845c01 Use correct field for unsaved in 1.18 2022-03-15 16:25:23 +00:00
7efd42ae45 build: Ignore kyori updates until we update MM
Closes #3543
2022-03-14 20:09:52 +01:00
f43f4cbf5d build: Update com.fastasyncworldedit to v2.1.0 (#3541)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-14 15:36:43 +01:00
104cc4b7a4 build: Update dependency net.essentialsx:EssentialsX to v2.19.4 (#3540)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-14 12:40:03 +01:00
218be43143 build: Update dependency gradle to v7.4.1 (#3539)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-14 12:39:46 +01:00
308dba5601 Only add extent to WE operations once (#3537) 2022-03-10 22:40:09 +01:00
5f233bb5d1 Use new FAWE method including actor for schematic pasting 2022-03-09 16:31:33 +01:00
5e188d114f build: Misc dependency updates 2022-03-08 20:50:19 +01:00
660e05d27f build: Back to snapshot for development 2022-03-08 20:21:23 +01:00
4c0ad148bf build: Release 6.6.1 2022-03-08 20:15:16 +01:00
5c7bfb988c Fix #3532 2022-03-08 18:14:19 +00:00
b46f486680 build: Update actions/checkout action to v3 (#3530)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-07 23:14:24 +01:00
05797d0c78 build: Update dependency org.checkerframework:checker-qual to v3.21.3 (#3528)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-07 20:55:39 +01:00
36ef2cf9ba build: Update dependency net.essentialsx:EssentialsX to v2.19.3 (#3527)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-07 20:55:28 +01:00
26ec31a012 build: Back to snapshot for development 2022-03-07 15:55:25 +01:00
fd4a542062 build: Release 6.6.0 2022-03-07 15:35:00 +01:00
dc13f2565f ci: Pin GH workflow dependencies 2022-03-07 15:26:41 +01:00
9f632af0ae Implement extended world heights from Y-64 to Y319 #3473 (#3473)
* Begin to implement extended world heights:
 - Implemented in Bukkit module (and where required in Core module)

* Implement extended world heights into core module

* Add min gen height to setup,

* Default gen/build heights based on minecraft version

* Few fixes

* Fix up queues

* Address comments

* Make road schematic stuff slightly more efficient by sharing queues

* Minor fixes, don't overlay error many times for the same y

* Fix incorrect schematic paste height, undo changes to HybridUtils

* Overhall regenallroads method to make it work, make sure BukkitChunkCoordinator can/will finish

* Process chunks in order when regenerating all roads

* Address comments

* Address comments

* Ground level//bedrock is at min gen height
 - Add comment on == rather than <= being used
 - It's because it's only checking for the bedrock layer being broken if that's disabled

* Fix offset for min build height in SchematicHandler

* Better javadoc

Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>

* Address inclusivity issues for max world height

* Javadocs/comments/deprecation

* Use world min/max heights if present in QueueCoordinator

* Address some deprecations for regions and biome setting

* Add a count for chunks we're currently trying to load to not skip chunks at the end of a queue's edit

* Use minGenHeight + 1 rather than build height in AugmentedUtils

* Create utility method for layer index in GenChunk

* Correct height in HybridUtils, also use minGenHeight + 1

* Don't magically split to 128 height in regeneration

* Add utility methods for world height in QueueCoordinator

* Clean up ClassicPlotManager road creation/removal

* Start generation at min gen height if bedrock is disabled

* min gen height is set in PlotArea

* Add note on schem y normalisation

* Improve plot getVolume method readability

* Don't overly extend height when regenerating road region

* y index utility method in ChunknQueueCoordinator

* Layer index utility method in LocalChunk

* Use version min/max heights if world not present in QueueCoordinator

* Fix min -> max

* Don't allow players to modify outside build height when using plot set  / schematics.
 - Also fixes schematic height issues

* Remove debug

* Address comments

* Switch loadingChunks to AtomicInteger to be safe (in case of multi-threaded)

* Fix "security" issue that was already present

* Ensure sign isn't physicsed

Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
2022-03-05 19:03:39 +01:00
d698c6a1e5 [ci skip] Update issue templates for 1.18.2 2022-03-04 13:25:50 +01:00
40e1bd9897 build: Update dependency cloud.commandframework:cloud-services to v1.6.2 (#3522)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-03-01 16:31:40 +01:00
75f31c5bf6 Replace delombok-ed equals and hashCode methods (#3518)
* regenerate leftover delombok-ed equals and hashCode methods

* delegate to hashCode directly instead of single parameter calls
2022-02-27 18:51:37 +01:00
954c813cef build: Update gradle wrapper properly 2022-02-27 18:48:37 +01:00
05e055e9cf ci: Bump actions/setup-java to 3.0.0 (#3519) 2022-02-25 22:43:24 +01:00
2ea21c150f build: Back to snapshot for development 2022-02-23 11:05:40 +01:00
c2fd4edad5 build: Release 6.5.1 2022-02-23 11:00:45 +01:00
78b8696778 refactor: Delete rebase.yml 2022-02-23 10:54:07 +01:00
e653961385 Fix shulkers teleporting on the road (#3501)
* fix: Don't teleport shulkers on the road

* Address comments
2022-02-16 13:48:20 +01:00
b21d12fd52 build: Update dependency net.luckperms:api to v5.4 (#3505)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-14 11:58:35 +01:00
7557df96c7 Cancel block placement if the block consists of two block states (#3487)
* fix: cancel block placements out of area

* chore: use BlockMultiPlaceEvent

* chore: fix comment typo

* fix: max build height should be exclusive
2022-02-11 11:21:59 +01:00
61797c3aff build: Back to snapshot for development 2022-02-10 12:44:17 +01:00
78125ff1e2 build: Release 6.5.0 2022-02-10 12:32:02 +01:00
d7c8715b25 Don't open the component GUI if the actor has no permission for a specific preset (#3496)
* fix: Handle an empty component GUI gracefully

* Address comments
2022-02-10 12:19:35 +01:00
34f005c244 Restore ability to use PlaceholderAPI in greeting and farewell flag (#3489)
Fixes #3465
2022-02-10 12:11:39 +01:00
6fbd1376ca Don't enable presets with prices if economy is disabled (#3497) 2022-02-10 12:10:47 +01:00
951767dc64 fix: synchronize confirmExpiry (#3481)
Prevents that the MetaDataAccess is closed before setting the data
2022-02-08 15:57:09 +01:00
16928b05f1 Display "/plot help" categories only, if the player has permission to access these commands (#3490)
* feat: only show categories with access in help-menu

* chore: cleanup imports

* feat: tab complete should respect category permissions as well

* chore: cleanup imports again

* chore: rename ambiguous method name and update access modifier
2022-02-08 15:56:29 +01:00
fff14b05cb build: Update release-drafter/release-drafter action to v5.18.1 (#3494)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-07 10:37:26 +01:00
e619c867e9 build: Update dependency org.checkerframework:checker-qual to v3.21.2 (#3493)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-02-07 10:34:53 +01:00
543284e016 fix: NPE on unavailable music discs on lower versions (#3475)
* fix: NPE on unavailable music discs

* chore: documentation for InventoryUtil changes

* fix: no need for additional decrement

* chore: address requested changes

* fix: prevent binary mismatch

Co-authored-by: Alex <mc.cache@web.de>
2022-02-04 18:21:43 +01:00
0d78ba5f35 [ci skip] ci: Don't run actions twice 2022-01-31 21:12:00 +01:00
9ba2b62fc2 [ci skip] style: Restore GlobalFlagContainer's entry list being sorted alphabetically
Mostly helps me when updating the wiki
2022-01-31 15:50:44 +01:00
f10ee27fdd build: Update dependency org.bstats:bstats-bukkit to v3 (#3486)
* build: Update dependency org.bstats:bstats-bukkit to v3

* build: Update bStats

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
2022-01-31 10:35:31 +01:00
3278ce1fe9 build: Update dependency com.intellectualsites.paster:Paster to v1.1.4 (#3485)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-31 10:24:16 +01:00
fefb0334bd build: Update com.fastasyncworldedit to v2.0.1 (#3484)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-31 10:23:57 +01:00
d06a827e31 Always call plot events through the event dispatcher (#3479) 2022-01-29 13:12:00 +01:00
10bb520f3a docs: Switch to generated wiki (#3482) 2022-01-29 00:12:54 +01:00
126aa53b61 build: Back to snapshot for development 2022-01-27 14:00:51 +01:00
ac71046feb build: Release 6.4.0 2022-01-27 13:49:17 +01:00
7c290e6bd0 Align plugin's java version with API java version - Java 17 (#3468)
* refactor!: Align plugin's java version with API java version

* fix: Bump Guice to fix private injection on Java 17
2022-01-27 13:26:58 +01:00
4d297cc829 Separate linked javadocs per module (#3476)
* docs: Separate javadocs per module

* docs: Read javadoc version from Gradle version catalog
2022-01-27 13:26:27 +01:00
5ab410a5c5 fix: Don't ommit flag int input in no permission message (#3466) 2022-01-27 12:14:39 +01:00
1f28bac955 Fix: Plot#getOwner can be nullable, and redstone may be present on unowned plots (#3472) 2022-01-27 12:14:16 +01:00
92c54de5e9 fix: run whenDone on empty queue (#3474) 2022-01-27 12:13:55 +01:00
ff5d79699d docs: Add @since annotation for v6 changes (#3471) 2022-01-24 21:46:01 +01:00
a0594c19ee docs: Address dangling @see tags (#3469) 2022-01-24 21:43:35 +01:00
da41c136fe docs: Unify true/false style in @return (#3470) 2022-01-24 21:41:54 +01:00
6a5859ee0f build: Update release-drafter/release-drafter action to v5.17.6 (#3467)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-24 11:06:27 +01:00
59e0b4b67a feat: unknown owner(s) for plot expiry (#3452)
* feat: unknown owner(s) for plot expiry

* Sort plugins on `/plot debugpaste` alphabetically (#3447)

* feat: Sort plugins on debugpaste alphabetically

* Put (F[A])WE at the top

* feat: Add 1.18's music disc additions to `/plot music` (#3446)

* refactor: Prepare removal of our maven repository (#3451)

* Allow restoration of road schematic height calculation behaviour from pre 6.1.4 (#3444)

* refactor: Update SquirrelID GAV

* build: Release 6.3.0

* build: Back to snapshot for development

* fix: fallback method in BukkitQueueCoordinator uses world coordinates

* mark since tags as TODO

* fix: get the lowest diff for plot age

* fix: initialize with high value and better readability

* fix: no need for multiple age checks

* fix: address exceptions in plot analysis

* chore: address requested changes

* chore: Fix introduced violations

Co-authored-by: Alex <mc.cache@web.de>
Co-authored-by: Jordan <dordsor21@gmail.com>
2022-01-23 10:44:11 +01:00
5fc153d896 fix: PlayerInteractEvent does not necessarily interact with a block (#3463) 2022-01-22 17:25:41 +01:00
a003836dbc feat: plot-title flag value should allow single values (#3410) 2022-01-22 11:02:08 +01:00
42bf413528 chore: Address more violations 2022-01-20 21:01:38 +01:00
827f46566c draft: Address false positives in code style issues (#3461)
* chore: Address false positive code style issues

* chore: More work

* More work
2022-01-20 12:39:40 +01:00
6f4d2f6d5a Fix: Missing Component returns + plot info on unknown plot owner (#3449)
* Fix: getName should return something

* Fix caption typo

* Deprecate old getName methods + add new methods for username retrieval

* Remove wildcard import

* Use @since TODO instead of hard coded version

* chore: Update `@since` tags to TODO

Co-authored-by: NotMyFault <mc.cache@web.de>
2022-01-19 15:56:31 +01:00
6073b96317 feat: add worldname to the notify flags (#3457)
* feat: add worldname to the notify flags

* fix: change default message

* refactor: extract duplicated code

* fix: use area instead of world
2022-01-18 20:42:44 +01:00
74a490f9f0 build: Update release-drafter/release-drafter action to v5.17.5 (#3460)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-17 11:19:28 +01:00
3a752db698 build: Switch to Fawe release 2022-01-15 16:50:03 +01:00
7cdde5a822 build: Back to snapshot for development 2022-01-14 11:46:02 +01:00
8b6e7b2f2b build: Release 6.3.0 2022-01-14 11:14:00 +01:00
06f0b42a97 refactor: Update SquirrelID GAV 2022-01-14 10:58:44 +01:00
9a85080bf6 Allow restoration of road schematic height calculation behaviour from pre 6.1.4 (#3444) 2022-01-14 10:46:04 +01:00
d14d2caa2d refactor: Prepare removal of our maven repository (#3451) 2022-01-13 14:50:07 +01:00
bcfe7c58dd feat: Add 1.18's music disc additions to /plot music (#3446) 2022-01-12 22:22:01 +01:00
289f0f3bfd Sort plugins on /plot debugpaste alphabetically (#3447)
* feat: Sort plugins on debugpaste alphabetically

* Put (F[A])WE at the top
2022-01-12 22:21:51 +01:00
6fc4005c72 Fix for unwanted audio panning (#3430)
* Fixes https://github.com/IntellectualSites/PlotSquared/issues/3422

* Removed old code

Co-authored-by: Alex <mc.cache@web.de>
2022-01-11 11:02:23 +01:00
8f7c2e4c02 fix: /plot music being able to be used on unclaimed plots (#3432) 2022-01-11 11:01:36 +01:00
b43d08f4aa feat: Display explosion particles even after the event got canceled (with setting to control behavior) (#3436)
* feat: display explosion particles even after event cancel
And add settings option to change behavior

* refactor

* refactor: Change settings comment to clearer connect to it's purpose.
2022-01-10 13:18:19 +01:00
2c55c6a92e build: Update dependency org.checkerframework:checker-qual to v3.21.1 (#3441)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-10 11:26:53 +01:00
31f48cc7d1 Fix: 1.18 uses the same field as 1.17 for mustNotSave (#3428) 2022-01-05 21:22:09 +01:00
4b77f1ab28 Make road flags great again (#3420)
Fixes #3111
2022-01-05 21:21:58 +01:00
7cc38b5fa8 Fix: use ownersInclude instead of ownedBy where required (#3419)
* Fix: use ownersInclude instead of ownedBy where required
- Also account for multiple plot owners in Cluster player removal
- Add whereBasePlot to avoid merged plots listing multiple times if required
- Only use ownersInclude in visit if enabled in config
- Fixes #3143

* Remove static import
2022-01-05 21:21:48 +01:00
0c76d08b10 Only send border area exit message once (#3418)
Fixes #3335
2022-01-05 21:21:37 +01:00
9c474570c8 Fix: use portal corners to test for event cancellation as entity can be null (#3417)
* Fix: use portal corners to test for event cancellation as entity can be null

* Remove duplicate flag check?

* Simplify to Set#of
2022-01-05 21:21:25 +01:00
7e1d56c849 fix: Reimplement the "unknown owner" option to plot purge (#3412)
- Warn user that backgorund UUID caching may fix the issue
- Also correct the UUID set when purging based on "shared" (added) player
- Fixes #3353
2022-01-05 21:21:08 +01:00
07d0f124b4 ci: Let release drafter listen to forks too 2022-01-05 11:56:28 +01:00
8d6c621763 ci: Setup auto rebase (#3431) 2022-01-04 15:38:21 +01:00
cef7098014 build: Update plugin shadow to v7.1.2 (#3427)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 13:52:29 +01:00
e1efa7266e build: Update dependency cloud.commandframework:cloud-services to v1.6.1 (#3425)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 11:45:04 +01:00
f363941719 build: Update dependency org.apache.logging.log4j:log4j-api to v2.17.1 (#3426)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-01-03 11:14:52 +01:00
25095f4546 chore: Welcome 2022 2022-01-02 22:22:19 +01:00
fd0c2050d8 Refactor: Replace Rörledning with Cloud-Services (#3409)
* Refactor: Replace Rörledning with Cloud-Services

Cloud-Services is actually maintained, as opposed to Rörledning. Furthermore, Rörledning is available through Maven Central, whereas rörledning isn't.

This is a semi-breaking change, but because we relocate, it might be fine? Either way, this is a necessary change.

* build: Provide jsr at runtime

* Merge branch 'v6' into refactor/v6/cloud-services

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-12-31 15:49:11 +01:00
07fdc94dd8 Account for mutability of plot objects when sending move/swap success messages (#3414)
Fixes #3337
2021-12-31 15:46:08 +01:00
b501a81e21 build: Exchange mvdwapi version to our ones 2021-12-31 01:29:30 +01:00
eb334b3aac Fix: add missing placeholders for plot info
Fixes #3339
2021-12-30 14:41:31 +00:00
a77a51b6f2 build: Back to snapshot for development 2021-12-30 10:31:08 +01:00
7d981bc610 build: Release 6.2.2 2021-12-30 10:14:15 +01:00
3eb485e900 refactor: Drop guava annotations and create annotation helper (#3389) 2021-12-29 16:18:19 +01:00
9f4af889f7 fix: npe thrown in entity spawn listener (#3399) 2021-12-27 11:01:28 +01:00
2559c889e2 build: Update dependency me.clip:placeholderapi to v2.11.1 (#3403)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:42:37 +01:00
2cf268b99c build: Update actions/setup-java action to v2.5.0 (#3404)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:42:07 +01:00
e6fad8309c build: Update dependency gradle to v7.3.3 (#3402)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-27 10:40:00 +01:00
7551450cf9 fix: Send user-friendly message on join of denied plot (#3388)
Also refactor local variable `now` to a more fitting name
2021-12-26 23:28:50 +01:00
e042566bb7 fix: Strip redundant space at flag collection (#3400) 2021-12-26 23:28:03 +01:00
1f26808c7b Don't return the "side" for world plots when accessing default home locations 2021-12-22 17:47:48 +00:00
a7026047d0 Adding gold at the end might stop the prefix weirdness? 2021-12-22 17:46:39 +00:00
af2613202d refactor: Satisfy Semgrep 2021-12-22 02:06:07 +01:00
3da1e9255a build: Update dependency me.clip:placeholderapi to v2.11.0 (#3395)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-21 10:49:47 +01:00
9394906a79 build: Update dependency org.checkerframework:checker-qual to v3.21.0 (#3394)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-20 13:47:16 +01:00
d881cb6084 build: Update dependency com.intellectualsites.paster:Paster to v1.1.3 (#3391)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-20 11:55:54 +01:00
b9d43897af build: Update dependency net.essentialsx:EssentialsX to v2.19.2 (#3392)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-20 11:55:46 +01:00
76b58485a9 build: Update actions/checkout action to v2.4.0 (#3393)
* build: Update actions/checkout action to v2.4.0

* chore: Invert bolt's status

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
2021-12-20 11:55:14 +01:00
7002df0bc7 build: Bump dependencies for 1.18 2021-12-18 23:10:41 +01:00
958aac3cb1 chore: Configure bolt 2021-12-18 13:12:00 +01:00
a93402e27b fix: Standardize projectile permissions (#3374)
* fix: Standardize projectile permissions

- Let all projectiles (not just splash potions) have a permissions check on throwing
- Fixes snowballs, eggs, etc. being able to be thrown when not added to the plot, etc.
- Fixes #2986 (splash potions only able being to be thrown when also added to the plot)
- Remove the specialized code for egg hatching as now eggs are cancelled entirely
- Remove the non-standard plots.projectile.unowned and plots.projectile.other permissions in favor of the standard admin ones

* docs: Add back deprecated projectile permissions

* docs: Update Core/src/main/java/com/plotsquared/core/permissions/Permission.java

Co-authored-by: Alex <mc.cache@web.de>

Co-authored-by: Alex <mc.cache@web.de>
2021-12-17 22:06:56 +01:00
92f41f43c5 fix: Ignore the use flag for liquid placement/removal (#3375)
Fixes #3069
2021-12-17 21:52:15 +01:00
392ee9fa07 ci: Escape workflow tasks 2021-12-17 21:36:56 +01:00
8859871e89 build: Back to snapshot for development 2021-12-14 23:14:35 +01:00
93d99630a9 build: Release 6.2.1 2021-12-14 23:06:55 +01:00
47ae79e123 Revert "refactor: Address MiniMessage deprecations (#3354)" (#3371)
This reverts commit f086826942.
2021-12-14 23:04:36 +01:00
f9ad00c2c8 build: Update dependency org.apache.logging.log4j:log4j-api to v2.16.0 (#3368)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-14 13:57:16 +01:00
566af259db build: Update dependency org.checkerframework:checker-qual to v3.20.0 (#3369)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-13 15:11:48 +01:00
d9a6431078 build: Back to snapshot for development 2021-12-13 13:47:28 +01:00
e9c9375e78 build: Release 6.2.0 2021-12-13 13:35:37 +01:00
7c99c8aabf build: Update dependency com.intellectualsites.arkitektonika:Arkitektonika-Client to v2.1.1 (#3365)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-13 11:31:15 +01:00
88eb8f88a7 build: Update com.fastasyncworldedit to v1.17-419
Closes #3363
2021-12-13 11:11:00 +01:00
fd118c2c37 build: Update com.sk89q.worldedit to v7.2.8 (#3364)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-13 10:42:47 +01:00
858b6b5471 tests: Move to JUnit 5 (#3357) 2021-12-13 10:41:36 +01:00
f086826942 refactor: Address MiniMessage deprecations (#3354)
* refactor: Address MiniMessage deprecations

* refactor: More MiniMessage deprecations

* Move away from our `Templates#of`

* Address comments

* style: Address migration style issues

* docs: Add javadoc link for MiniMessage
2021-12-13 09:48:34 +01:00
9c84dc2bc0 build: Update pipeline version to release build 2021-12-10 11:25:21 +01:00
cba0f3ac1f build: Switch PRTree GAV to our deployment (#3360)
* build: Switch PRTree repository

* build: Use our GAV
2021-12-09 18:30:35 +01:00
b9a130ab00 feat: Add -Post events firing after operational plot events (#3334)
* Create Post* events

* Address license violations

* address review

* standardize post event calls in EventDispatcher

* Add package-info.java

* Add @since-tag to Post* events

* fix licenser issue

Co-authored-by: Alex <mc.cache@web.de>
2021-12-06 19:50:04 +01:00
688056352b build: Update dependency net.kyori:adventure-platform-bukkit to v4.0.1 (#3356)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-12-06 14:33:04 +01:00
2a40f52dea docs: Update issue template to 1.18 2021-12-05 23:29:28 +01:00
3ed369de19 style: Add missing bracket for deny example (#3351) 2021-11-29 20:56:48 +01:00
bec51401a3 build: Update dependency org.junit.jupiter:junit-jupiter to v5.8.2 (#3350)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-29 11:25:01 +01:00
109f884b5f build: Update dependency io.papermc:paperlib to v1.0.7 (#3349)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-29 11:13:23 +01:00
8f3fa419c4 Fixes #3344, Wrong iterator algorithm in PlotRangeIterator (#3345) 2021-11-23 19:52:23 +00:00
a9f08bc885 build: Update dependencies
Closes #3330
2021-11-15 12:41:52 +01:00
a8923ec729 build: Back to snapshot for development 2021-11-11 23:01:37 +01:00
4eafd043a3 Release 6.1.4 2021-11-11 22:49:46 +01:00
826cc8c835 build: Update Gradle 2021-11-11 22:43:48 +01:00
d1dbf777a4 Don't check/set if a chunk should be saved if it's a world-plot 2021-11-11 17:57:59 +00:00
823e78377b feat: Better deciding of heights to use for generation and schematics (#3300)
* Better deciding of heights to use for generation and schematics
 - If bedrock is disabled, we should still be filling the space with something
 - Use minBuildHeight instead of hardcoding "1" for schematics (it is still 1 by default) to ensure all-encompassing schematics
 - Schematic generation/handling for roads etc. should be accounting for all of wall, road, and plot heights for deciding point of origin
 - Fixes #3269
 - Starts to address #3175

* Also do for HybridPlotManager clear
2021-11-11 17:33:38 +00:00
87a2e81ec3 Don't write biome data to schematics if it's not present 2021-11-10 19:51:14 +00:00
88775334b7 Schematic paths are configurable (#3303) 2021-11-09 10:32:07 +00:00
e126547e97 chore: Update com.fastasyncworldedit to v1.17-390 (#3324)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-09 10:00:14 +01:00
c1163cdb2e feat: Split configuration for teleport on claim/auto (#3308)
- Fixes #2953
2021-11-07 22:29:49 +01:00
30d06b7801 build: Reduce consumer dependencies 2021-11-05 11:57:58 +01:00
a5cf7bf2c2 Fix BlockLoc to the requirements for use as a home location
- Add home locations to #fromString
 - Switch to y=Integer#minValue more
 - May help with #3321
2021-11-04 20:47:56 +00:00
3d4d413de8 Minor adjustment to plot home location logic
- Allow "centre" spelling
 - ClassicPlotWorld contains the PLOT_HEIGHT config setting, not HPW
2021-11-02 15:41:16 +00:00
b97e843849 perf: Get rid of Guice overhead when accessing the plot area manager (#3315)
Fixes #3311
Co-authored-by: Jordan <dordsor21@gmail.com>
2021-11-02 13:38:48 +00:00
48c7a3e94e refactor: Use player friendly done message on restricted building (#3309) 2021-11-02 13:32:04 +00:00
7263290bbe fix: Untrusted visit flag not working with untrusted visit permission
Fixes #3317 
Co-authored-by: Alex <mc.cache@web.de>
2021-11-02 13:28:39 +00:00
e99c4e3289 chore: Update dependency org.checkerframework:checker-qual to v3.19.0 (#3320)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 21:51:53 +01:00
87cb26189f Closes #3313 2021-11-01 14:07:44 +01:00
2dae336a5f chore: Update com.fastasyncworldedit to v1.17-380 (#3312)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 14:06:47 +01:00
258ed1469b chore: Update dependency net.kyori:adventure-api to v4.9.3 (#3314)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-11-01 14:06:40 +01:00
6f3eabba0e feat: Don't display the default plot title if on a server-plot, unless configured otherwise. (#3305)
- If plot-title flag is set, title will still be displayed.
2021-11-01 11:23:53 +00:00
804228fa6c Allow pitch and yaw to be used in default home location (#3304) 2021-10-29 10:48:35 +01:00
be85708e5a feat: Add border bypass permission (#3302)
* Add border bypass permission
 - Fixes #3297

* Add permission to plots.admin permpack

* Implement messages on leaving/entering border area

* Rename to border.denied and make border msg red

* change too le/ge as tthey are likely to be equal to border when hit.
 - Since we check for being across the border beforehand, it will hopefully not be spammed too much?
 - If it's spammed then either we use meta to set if a player's left the border, or we just remove the come-back-in altogether because it's a little looong
2021-10-28 10:13:36 +02:00
f2368f97df chore: Update com.sk89q.worldedit to v7.2.7 (#3299)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-25 11:22:31 +02:00
df87bcb743 build: Back to snapshot for development 2021-10-18 20:30:28 +02:00
5653d0f175 Release 6.1.3 2021-10-18 20:22:13 +02:00
b022a97196 fix: Flag list parsing for console players (#3277)
Instead of recreating the logic, we can simply reuse what we created above and string-ify that for parsing.
2021-10-18 20:20:52 +02:00
cb596ee6ea Fix StackOverFlow 2021-10-18 17:27:51 +01:00
4e391136c0 Add and Trust permission now count correctly (#3290) 2021-10-15 11:28:23 +01:00
a6a0e1d12f chore: Update dependency org.checkerframework:checker-qual to v3.18.1 (#3283)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-10 00:23:32 +02:00
d2776eed5a [ci skip] Move to work level templates 2021-10-08 18:09:58 +02:00
6528c60f4d fix: Fix greeting & farewell captions not being used (#3272)
* fix: Fix greeting & farewell captions not being used

Fixes #3250

* feat: Allow alias in greeting & farewell flag
2021-10-07 08:10:00 +00:00
7ee46be2ac feat: Allow plot alias in title (#3273)
Fixes #3171
2021-10-07 08:07:13 +00:00
13bc231091 chore: Update com.fastasyncworldedit to v1.17-343 (#3282)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-05 10:26:42 +02:00
55d1a40394 chore: Update plugin shadow to v7.1.0 (#3284)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-04 20:18:56 +02:00
d70f99b489 fix: Respect tab-complete aliases (Fixes #3266) (#3268)
* Fixes #3250

* ListFlag#merge should not allow duplicates (Fixes #3157) (#3265)

* feat: Respect non-visible players in tab completion (Closes #3263) (#3264)

* Respect non-visible players in tab completion (Closes #3263)

* Deprecate old Tab-Complete methods instead of hard-replacing them

* wtf git

* Mark for removal, useless new-lines

* Pass ConsolePlayer.getConsole() instead of Nullable param

* Respect tab-complete aliases (Fixes #3266)

* Useless import

Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: dordsor21 <dordsor21@gmail.com>
2021-10-04 17:10:36 +02:00
fde9735da2 chore: Update dependency net.kyori:adventure-api to v4.9.2 (#3278)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-04 17:05:52 +02:00
20f0aa3656 chore: Update com.fastasyncworldedit to v1.17-341 (#3275)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-04 17:05:38 +02:00
0b7bf2d26d chore: Update dependency dev.notmyfault.serverlib:ServerLib to v2.3.1 (#3276)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-04 17:05:24 +02:00
f10e38af63 [ci skip] chore: Improve pr template fields 2021-10-04 15:43:44 +02:00
21727ebfc7 build: Overhaul build & deployment workflow (#3267)
* Fixes #3250

* build: Overhaul build & deployment workflow

- Move to release drafter
- Replace publishing with gradle nexus
- Conventional commits are handy
- Determine build status in gh actions before deploying
2021-10-04 15:28:47 +02:00
e322ee85fd feat: Respect non-visible players in tab completion (Closes #3263) (#3264)
* Respect non-visible players in tab completion (Closes #3263)

* Deprecate old Tab-Complete methods instead of hard-replacing them

* wtf git

* Mark for removal, useless new-lines

* Pass ConsolePlayer.getConsole() instead of Nullable param
2021-10-03 14:32:02 +02:00
541255fe7e ListFlag#merge should not allow duplicates (Fixes #3157) (#3265) 2021-10-03 14:31:57 +02:00
20c2f36f6c Update com.fastasyncworldedit to v1.17-336 (#3258)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-29 18:09:46 +02:00
744f7a18ae Update dependency org.junit.jupiter:junit-jupiter to v5.8.1 (#3259)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-29 18:09:35 +02:00
18eece0b71 [ci skip] chore: Renovate
Closes #3260
2021-09-29 18:09:12 +02:00
4f12dcf966 Return base plot when using alias (#3253) 2021-09-25 15:58:31 +02:00
ee832528db [ci skip] Adjust renovate config
Closes #3252
2021-09-21 00:52:25 +02:00
bb5d6c91da Update Fawe version 2021-09-20 16:21:18 +02:00
6d4adecb32 6.1.3 2021-09-18 23:07:10 +01:00
c37b13dcb3 Fix bad move to adventure 2021-09-18 21:54:22 +01:00
086dac2ea4 Update dependency net.kyori:adventure-platform-bukkit to v4.0.0 (#3245)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-16 15:29:17 +02:00
b2b8598b5b Fix #3246 2021-09-15 13:19:25 +01:00
61e5d9f1b6 Move /p components title to translations file matching other parts of components
- Also component-ify title, this must not be limited to a String.
2021-09-15 11:13:03 +02:00
c8989b3332 Update dependency org.junit.jupiter:junit-jupiter to v5.8.0 (#3244)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-13 10:23:38 +02:00
9f54472dd6 Relocate annotations properly 2021-09-12 13:56:08 +02:00
115932c65a 6.1.2 2021-09-11 14:28:08 +02:00
04821f777e Mappings be obfuscated 2021-09-11 12:19:46 +01:00
cfae804780 6.1.1 2021-09-10 15:01:05 +01:00
4568b17c54 Fix issues with chunk saving in single world plots 2021-09-10 14:05:12 +01:00
7bc76a3824 Update serverlib 2021-09-09 21:50:11 +02:00
4b8180807c Update dependency com.intellectualsites.http:HTTP4J to v1.3 (#3239)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-09 21:44:23 +02:00
d77a8c8fa4 Some improvements to events (#3238)
#3222 #3072
2021-09-09 21:37:44 +02:00
27a8fcd739 Plot location may be final 2021-09-09 12:36:09 +02:00
c25a0c65a2 Don't check same plot over and over again 2021-09-08 18:37:45 +02:00
b224a8d1b8 Include world in plot chat & spy template 2021-09-07 16:36:08 +02:00
87d134215f Fix placeholder if world already exists. 2021-09-07 16:20:45 +02:00
93e280dba4 Remove unneeded commented out code 2021-09-07 15:08:00 +01:00
732f79bbfc Fix #3231 2021-09-07 14:47:37 +01:00
8e5e33eec2 Fix #3127 2021-09-07 14:02:48 +01:00
da3fb1abec Closes #3236 2021-09-07 13:52:47 +02:00
62d6b21081 [ci skip] Closes #3232 Closes #3233 2021-09-06 15:04:07 +02:00
4caaead7ee Renovate
Closes #3217
Closes #3226
Closes #3227
Closes #3229
Closes #3230
2021-09-06 13:47:40 +02:00
be38086f6c Update Fawe 2021-09-05 00:13:32 +02:00
c18b0f943c Switch deployment to the central repository 2021-09-04 13:58:16 +02:00
f036980dc5 Disband wilderness permission pack 2021-09-03 20:01:37 +02:00
0e4f54e9c0 Bump (FA)WE versions 2021-08-29 10:56:57 +01:00
7a3d5bd737 Don't trigger async catcher when adding chunk ticket
- Apparently PaperLib#getChunkAtAsync#whenComplete doesn't necessarily run the task on the main thread
2021-08-25 15:24:07 +01:00
2ab1973668 Handle administrative overrides sanely 2021-08-25 11:49:54 +02:00
387c6e79ba Return after invalid plot size 2021-08-25 11:10:02 +02:00
e3e00d34ef Improve error message claiming plots with ids 2021-08-25 01:36:19 +02:00
40e651188e Improve javadoc linking 2021-08-24 15:34:21 +02:00
b2915d9bd7 add license... 2021-08-23 10:11:43 +02:00
6ec136a03d Make sure lock is free'd even on error (fixes #3116) 2021-08-23 10:05:38 +02:00
a8fc6662e0 Allow visit to work when players are not the owner of the base plot 2021-08-22 16:26:49 +01:00
fb8e749411 Still allow serialisation of PlotTitle flag 2021-08-22 15:58:15 +01:00
4b26a7e300 Allow PlotTitle to have a "null" mode (default plot title flag should be the configured values) 2021-08-22 15:55:09 +01:00
8a53b41b52 Improve ChunkListener class
- Add quicker method for getting chunks (not requiring a slow stream done by CB) but comment it out for now because we shouldn't need to do our own GC for loaded chunks; they're "handled much better by minecraft as of 1.14" (not really) meaning the required methods for testing if a chunk is allowed to be unloaded is not present. We instead must now rely on the ChunkUnloadEvent for setting if a chunk should be saved.
- Optimise the shouldSave method by not requiring access to injected classes frequently. Location#getPlot methods are not optimised for frequent usage in the same task.
2021-08-22 15:54:05 +01:00
daa8ffc38f 6.0.10 2021-08-19 20:51:51 +02:00
34f0236e9f Add option to "update" blocks that are altered in P2 queues. (#3200) 2021-08-19 20:30:38 +02:00
8f0ae7e51d Clean up chunk coordinators and queue coordinators (#3208) 2021-08-19 12:31:47 +01:00
2988ad6b11 Address style violations 2021-08-18 11:58:18 +02:00
252d6a2866 Fix nms chunk reference 2021-08-17 22:43:58 +01:00
b8c9ae2b0b Bump FAWE version 2021-08-17 22:43:47 +01:00
bfe2dda5b1 Closes #3212 2021-08-17 16:38:24 +02:00
33a79595af Add TitleFlag (#3202) 2021-08-16 09:02:58 +00:00
eb2848e5d7 Fix bad method names etc for chunk/world listener 2021-08-15 13:58:56 +01:00
da4ae9f4f5 Slightly change how flag permissions are handled (#3201) 2021-08-14 13:13:01 +00:00
b841a7c03b Fix javadoc linking of deprecated methods 2021-08-11 17:58:24 +02:00
4ee5e3d134 Invert toggle messages where the toggle disables rather than enables 2021-08-08 16:51:21 +01:00
0e05935ad4 Fix #3166 2021-08-08 14:06:59 +01:00
78a775530a Merge branch 'v6' of github.com:IntellectualSites/PlotSquared into v6 2021-08-08 12:36:23 +01:00
dd36036334 Allow players to /plot home from non-plot-areas if per-world-teleport is enabled 2021-08-08 12:36:08 +01:00
3b2a04e4db Fix/v6/click event actions (#3178)
Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: dordsor21 <dordsor21@gmail.com>
2021-08-08 11:28:43 +00:00
5ab8d50b86 Don't keep PlotFlagUpdateHandlers forever
This allows Plots, FlagContainers and its PlotFlagUpdateHandlers being cleaned up by the GC correctly
2021-08-08 12:18:25 +01:00
391476ba26 6.0.9 2021-08-05 14:08:41 +02:00
25a69f4ca0 Escalate null entries in the db to the warn level 2021-08-04 23:09:38 +02:00
c8c946cc10 Fix /p kick msg (#3186)
* Negate mob-place flag debug message

* fixed a little typo :)

* Added check for dragon egg teleportation event
https://github.com/IntellectualSites/PlotSquared/issues/3074

* Basic dragon egg interact bugfix (Left-click interaction)

* Lifted admin if-condition out of roads (out-of-plot) only block (for animals)

* Fix https://github.com/IntellectualSites/PlotSquared/issues/3185
/p kick missing permission feedback format fix

* remove unnecessary import

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-08-04 20:59:19 +02:00
a405611b3a Fix emptying buckets in plot border (#3192)
* Fix emptying buckets in plot border

* Note on 1.13 compatibility for bucket-empty event

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-08-03 21:03:53 +00:00
fd4cec39c4 Fix sponge absorbing water across plot borders (#3191)
* Fix sponge absorbing water across plot borders

* Shorten for-loops by using removeIf

* Use 'Location' instead of 'var'

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-08-03 19:07:02 +00:00
e7fa057abe Detach shoulder entities from natural mob spawning 2021-08-03 10:20:59 +02:00
a86c06bb81 Update a few dependencies 2021-08-01 20:10:06 +02:00
9afaead81c Move to security advisory 2021-07-31 18:15:53 +02:00
6e7bd0a536 Left over from 89e17bb468 2021-07-31 10:43:11 +02:00
89e17bb468 Properly handle economy initialization (fixes #3189) 2021-07-30 20:29:12 +02:00
8fc9e0b13f Be a bit more helpful with deleted plotworlds and invalid db entries 2021-07-28 22:23:55 +02:00
6ad51bba65 Hot-fix for IntellectualSites#3179 (#3188)
Authored by @SirYwell ty!
2021-07-28 12:42:20 +02:00
9d396fa91f Fixes #3184 2021-07-27 15:04:22 +02:00
a8c3ac6cee Fixes #3181 2021-07-26 22:19:17 +02:00
9a9365a04d Fixes #3180 2021-07-26 21:23:59 +02:00
c9b012ea5b Leave a note when using deprecated commands 2021-07-24 18:01:26 +02:00
9dd35e87d6 We're using .editorconfig > code_style.xml 2021-07-23 22:23:49 +02:00
82f0b4194f Update Fawe version 2021-07-23 17:36:34 +02:00
3b27b6c850 FAWE-Bukkit shouldn't be in core 2021-07-23 16:24:30 +01:00
1e41734826 Send usage for '/p v' for too many arguments 2021-07-23 15:34:25 +01:00
a83a79c17e Error message for '/p v' when page out of range 2021-07-23 15:34:25 +01:00
8a77d5a450 Fix index out of bounds for '/p h' 2021-07-23 15:33:35 +01:00
2676b76107 6.0.8 2021-07-22 21:46:25 +01:00
51ff043af9 Prevent users defining their own click events in descriptions/farewells/greetings by default 2021-07-22 21:45:51 +01:00
fbde60fcf9 Handle edge cases of EntityChangeBlockEvent (#3163)
* Handle edge cases of EntityChangeBlockEvent

* Remove excessive plot area existence check

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-07-21 19:57:42 +00:00
a0557112a1 Handle db command args sanely 2021-07-21 15:55:26 +02:00
6d71e0f8be Fixes 3168 2021-07-20 22:21:32 +02:00
62e17f5fc5 [ci skip] Fix CONTRIBUTING.md link 2021-07-20 11:23:57 +02:00
613a92eeb9 6.0.7 2021-07-17 17:59:41 +01:00
31522b6502 Check plot ownership/event before handling Direction.ALL 2021-07-17 17:51:48 +01:00
2e64ac6d25 Revert projectile hit on splash (#3162)
* Revert projectile hit on splash

* Notes about potions splashing after hit cancelled
2021-07-15 18:43:05 +02:00
fe65a0c548 Fix off-by-one error in schematic pasting (#3160) 2021-07-14 17:58:04 +02:00
cc60d50dd2 Actually cancel projectile hit events (#3154)
Co-authored-by: NotMyFault <mc.cache@web.de>
2021-07-13 08:57:12 +00:00
a797d748ea Handle /p f add message properly
- Leave a note if the database connection has been established properly
2021-07-12 22:55:28 +02:00
2d1e3b8c03 Fixes #3148 2021-07-12 18:12:54 +02:00
635e18e7ed Add copper-oxide flag 2021-07-10 15:50:38 +02:00
b9cb6842e2 Add an online check for teleport listener
- Some plugins seem to like teleport players before they're online (e.g. NoCheatPlus)
 - Addresses #3142
2021-07-10 10:40:44 +01:00
991703914c Batching task count reset (#3144)
* Negate mob-place flag debug message

* fixed a little typo :)

* Added check for dragon egg teleportation event
https://github.com/IntellectualSites/PlotSquared/issues/3074

* Basic dragon egg interact bugfix (Left-click interaction)

* Lifted admin if-condition out of roads (out-of-plot) only block (for animals)

* See 4514d39bbd

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-07-07 10:10:51 +02:00
fdb6367351 Remove unneeded maven repos 2021-07-05 15:25:22 +02:00
bbee330f4f Don't append color codes to component lore
- Color codes are defined thru the file. Adding these here will clash with any other codes you already use
- Remove prefix from component GUI
2021-07-05 11:08:07 +02:00
8b8ac76852 Merge pull request #3136 from IntellectualSites/renovate/gradle-7.x
Update dependency gradle to v7.1.1
2021-07-02 17:58:00 +02:00
3b5b51b40c Update link if outdated Fawe version is spotted 2021-07-02 14:22:33 +02:00
5395ddc6a3 Update build.gradle.kts 2021-06-29 11:50:47 +02:00
60c701d20b Don't display plot rating placeholder in scientific notation
Fixes #3091
2021-06-28 18:49:03 +02:00
eb11d9e3aa Handle add & trust permission ranges properly 2021-06-28 16:40:01 +02:00
7898313b0b Check super types and interfaces on PlotPlayer#from
fixes https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/1140
2021-06-28 09:53:00 +02:00
8e23b10f7c Fix update notification ingame message 2021-06-27 18:11:57 +02:00
c46647d491 Handle plots.deny.<amount> properly 2021-06-27 16:40:45 +02:00
013e8fcda5 Leave a note where to get additional translations 2021-06-27 15:23:11 +02:00
f4ff9c0336 6.0.5 2021-06-27 13:21:44 +01:00
7c4d96e176 Fix #3117 2021-06-27 13:06:10 +01:00
2c920bd016 6.0.4 2021-06-26 20:11:15 +01:00
a5452012b5 separate 1.17-only events 2021-06-26 20:08:25 +01:00
43dd35f54b 6.0.3 2021-06-26 19:53:59 +01:00
67bbd64fa1 Update to FAWE 1.17 2021-06-26 16:19:07 +01:00
8f48b83c79 Replace the proper string in expressions 2021-06-24 19:14:59 +02:00
6a57a5c369 Fixes #3100 2021-06-24 16:40:10 +02:00
20df062d9f Back to snapshot for development 2021-06-23 11:50:24 +02:00
9fa0a8b27b Update ServerLib & remove Java version check
We now require Java 16 onwards
2021-06-22 23:49:31 +02:00
9acf9f4f19 Improve documentation of deprecated methods 2021-06-22 18:11:48 +02:00
0e84cf085b Fix compatibility issues with Citizens (fixes #3105) 2021-06-22 10:18:48 +02:00
ca9e371067 Teleport all players from plot on clear and delete (fixes #3102) 2021-06-21 18:20:47 +02:00
56920fe833 Load configs before accessing them (fixes #3099) 2021-06-21 16:38:40 +02:00
f2e6fd9692 Bump PlotAPI version 2021-06-21 12:05:56 +02:00
b2966cbc45 Back to snapshot for development 2021-06-21 11:51:20 +02:00
45c566859e Don't fail loading on versions prior to 1.17 2021-06-21 10:30:48 +02:00
654f7ed3ae Fix arkitektonika backend url 2021-06-20 20:13:37 +02:00
f1ef07bee0 Merge branch 'v6' of https://github.com/IntellectualSites/PlotSquared into v6 2021-06-20 18:28:29 +02:00
3e28d39285 We don't need "no-nashorn" config option in v6 2021-06-20 18:28:13 +02:00
8eb8c24209 Merge branch 'v5' into v6 2021-06-20 18:22:21 +02:00
4dbbf8f599 1.17 (#3088)
* Minor work for 1.17

* Address TODOs

Introduce `entity-change-block` flag covering blocks affected by `onPeskyMobsChangeTheWorldLikeWTFEvent`. Previously this was covered by the mob-place flag, however, changing the tilt state of big drip leafs and a series of other blocks call `EntityChangeBlockEvent` so this shouldn't be covered by mob flags only.

* Address other TODOs

* Compile against paper 1.17

This will only work if you built paper locally and deployed it to your local maven repo.

* Updated linked javadoc links

* Handle sculk sensor events in a more controllable way

* Update issue forms for 1.17
2021-06-20 18:17:18 +02:00
a3ebabacb8 Fix #3095 2021-06-18 15:45:45 +01:00
440afcca5d Fixes #3066 2021-06-18 16:37:25 +02:00
8220d4aa31 Update licenser & gradle 2021-06-18 01:22:24 +02:00
b196c9ce8e Fix place flag message 2021-06-16 01:15:09 +02:00
93568f9f7f Update pom 2021-06-12 12:09:40 +01:00
b01291c4ff Add note about PlayerPlotAutoEvent return null plot 2021-06-12 11:36:33 +01:00
a9d896eb45 Add note about PlayerPlotAutoEvent return null plot 2021-06-12 11:35:55 +01:00
3cd9b76805 Implement "off" to PlotWeather flag and make it default
- Players with "player weather" will no longer have their weather reset on plots that do not set the PlotWeather flag
2021-06-10 11:43:12 +01:00
e2700d3b28 Implement "off" to PlotWeather flag and make it default
- Players with "player weather" will no longer have their weather reset on plots that do not set the PlotWeather flag
2021-06-10 11:41:55 +01:00
942d799c9c Make "NaN" in placeholders translatable 2021-06-09 21:51:51 +02:00
f0cbc4f23e Add whenDone task to setCuboids and ensure whenDone tasks are added to the queue before FAWE might do something 2021-06-09 13:09:50 +01:00
9bd14b142b Move FAWE detection before guice injection/configuration 2021-06-09 13:09:50 +01:00
4ba1217b84 Fix licences 2021-06-09 13:09:50 +01:00
50d4353045 begin integration with fawe 2021-06-09 13:09:50 +01:00
19e97a7738 Correctly handle coordinates in swapping
Fixes #3030
2021-06-08 20:31:53 +01:00
2ac5fe45e3 Make CaptionLoader namespace-aware 2021-06-08 15:36:03 +02:00
7f3d3ecb00 Fixes #3018 2021-06-08 14:25:08 +02:00
331a6ea1b3 Remove "ORE" from setup steps
Touches #3068
Generating a world with just ore is used nowhere and needs to be reimplemented properly at some time.
2021-06-08 13:06:42 +02:00
8f2f673438 👀 2021-06-08 12:24:57 +02:00
66e12e2a0c Make world settings reloadable 2021-06-08 12:10:21 +02:00
2b3ecc178a Fix some inbox issues 2021-06-08 11:56:03 +02:00
df842c355e 5.13.13 2021-06-08 10:52:51 +02:00
9b043b7444 Make /plot rate categories translatable 2021-06-08 10:49:26 +02:00
ce287cf218 Add toggle allowing to opt out nashorn 2021-06-08 00:16:55 +02:00
24945efc7d Merge branch 'v5' into v6 2021-06-06 21:41:24 +02:00
a01ad5aa04 Update wiki location 2021-06-06 21:40:34 +02:00
fa14c40283 Update wiki links 2021-06-06 21:38:49 +02:00
d8f19cec66 Adjust improper origin -> target message of plot moving 2021-06-04 19:17:20 +02:00
955341ff9f Move enqueue to the actual end of the code 2021-06-04 18:41:57 +02:00
cb342de934 Check merge status from correct plot 2021-06-04 13:39:03 +02:00
ea0342f100 Enqueue on unlink 2021-06-04 13:39:03 +02:00
cd57741a51 Fix typo introduced in f4552e358d 2021-06-03 12:53:47 +02:00
f4552e358d Fixes #3027
- Ditch slf4j in favor of log4j. slf4j is (unfortunately) very much unmaintained at this time and future versions of MC (1.17+) will use log4j version 2.14.1 onwards over some ancient sfl4j version.
- Using log4j reduces our jar size as well, because we don't need to bridge it as the game provides it natively.
2021-06-03 12:40:27 +02:00
1dc225362d Bump gh action tasks prevent failing of gradle wrapper validation 2021-06-02 23:29:43 +02:00
a6b3e97cda feat: re-add aggregated javadocs task (#3077)
* feat: re-add aggregated javadocs task

This was removed by IntellectualSites/PlotSquared#2922.
Closes IntellectualSites/PlotSquared#3037.

Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>

* feat: aggregate javadocs on root build task

Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>

* Address changes requested

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-06-02 23:26:27 +02:00
8a244d12fc Fix if-condition limited to roads for animal attack cancelling on plots (#3079)
* Negate mob-place flag debug message

* fixed a little typo :)

* Added check for dragon egg teleportation event
https://github.com/IntellectualSites/PlotSquared/issues/3074

* Basic dragon egg interact bugfix (Left-click interaction)

* Lifted admin if-condition out of roads (out-of-plot) only block (for animals)

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-06-02 19:55:35 +02:00
5a5d1f5e62 Fixes #3063 2021-06-01 21:54:00 +02:00
21214814b7 Fixes #3032 2021-05-31 21:59:15 +02:00
3ac93dcfca Enhance /plot target & expiry confirm message 2021-05-28 20:21:41 +02:00
c509882a18 Enhance alias message with placeholders 2021-05-28 11:37:13 +02:00
c146d6207d Make /plot pardon an alias of Plot Remove (#3071)
* Make /plot pardon an alias of /plot undeny

* Make Remove state more clearly what it does

* Lazily target v6
2021-05-28 11:01:42 +02:00
2045a4988d Prevent dragon eggs from leaving or entering plot bounds (#3075)
* Negate mob-place flag debug message

* fixed a little typo :)

* Added check for dragon egg teleportation event
https://github.com/IntellectualSites/PlotSquared/issues/3074

* Basic dragon egg interact bugfix (Left-click interaction)

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-05-28 10:57:48 +02:00
dc7e6010cb Fixes #3073
- Also add new caption if attempting to clear an empty alias
2021-05-27 17:06:04 +02:00
b1fc17e045 Remove scripting from javadocs 2021-05-25 20:51:26 +02:00
daf0e6e1ba Use same creation message for templates like for setup 2021-05-25 11:02:37 +02:00
6f263735f0 Move notification-as-actionbar into the Chat config block
- Move titles alongside all its new options into its own config block
- Move `titles-as-actionbar` into the new titles block
- Enhance notification about removed config entries
2021-05-24 21:52:27 +02:00
1d2aa74e51 Add actionbar message for notification flags
- Move title_as_actionbar boolean into enabled_components
2021-05-24 13:49:00 +02:00
a69b1d895c Implemented the ability to change titles to actionbar on plot entry (#3060)
* Implemented the ability to change titles to actionbar on plot entry

* Fixed typo in action

* Updated explanation in Javadoc

* Implemented suggestions

* Remove excess import

* Implemented PR suggestions

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-05-23 17:28:03 +02:00
399d77c60f Component-ify plot setup wizard
Touches #3068
2021-05-22 19:49:22 +02:00
b768ee6d41 Don't send teleport message before the teleportation is initiated 2021-05-22 18:15:34 +02:00
58faffed6d Remove chat.interactive option
Whether the chat is interactive or not can be declared in the strings.json by using MMs <click:_action_:_value_> type.
2021-05-22 13:22:44 +02:00
87706d471b Add option for legacy sign material
Follow up to cde27899dd
2021-05-22 12:34:04 +02:00
eb7eb15ee7 Implemented tab completion for /plot help (#3053)
Co-authored-by: NotMyFault <mc.cache@web.de>
2021-05-22 02:23:54 +02:00
a17085bb18 Remove dead imports 2021-05-21 20:56:44 +02:00
cde27899dd Fixes #3064 2021-05-21 19:14:13 +02:00
93ff778de0 Add administrative override for /plot components 2021-05-21 17:54:26 +02:00
17f91c8eb9 Make /plot rate GUI items customizable
Bye bye legacy items :)
2021-05-21 16:48:34 +02:00
7775cd0073 Do not rely on a static file path
Doing so will cause issues with the `--plugins` flag.
E.g. `java -jar server.jar --plugins /path/to/plugins/`
2021-05-21 00:35:19 +02:00
cc48f273c0 Fixes #3057
Actually execute a kick from server if ordered
2021-05-20 21:59:05 +02:00
c8406681d7 Notify the kicked person over the actor 2021-05-20 21:22:00 +02:00
a05dd19986 Fixes #3058
- Anonymize meta data keys
2021-05-20 21:04:07 +02:00
aae350c1b3 Enhance flag tutorial message 2021-05-20 19:57:06 +02:00
c48559410f Provide instruction about the .editorconfig 2021-05-20 00:26:35 +02:00
9c59bfde52 Rephrase message if user has no access to sub-command help pages 2021-05-19 23:48:32 +02:00
eb9d7e97d9 Bug through last Economy PR - Withdrawn money for non-affordable plots (#3036)
* Replaced economy supported (Vault) check within cost condition with a pre-eliminating if-guard

* Negate mob-place flag debug message

* Actually prevent purchase of plots if they can't afford it (whoops)

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-05-19 17:44:45 +02:00
24eebe6711 Update gradle to 7.0.2 2021-05-19 11:51:55 +02:00
a2b8e4493f Fix infinite loop on multi auto (fixes #3022) 2021-05-18 22:30:40 +02:00
7c4a85325c Added event handler for cauldron water level modification to prevent untrusted players interacting with a plot (#3035)
* Added check for burning players using non-trusted plots cauldrons to extinguish themselves, causing the cauldron level to decrease

* Cancelling burning of players without downscaling water instead of ignoring their burn status

* Using Java 14 JEP 305 enhanced instanceOf

Co-authored-by: NotMyFault <mc.cache@web.de>

* Players without permissions may not wash banners or armor now either. Rain modification is now permitted.

* Extinguishing is now explicitly handled so that event handling for other plugins has the actual information of the new cauldron water level

* Un-nestified the if-condition :)

* Properly cancelled the event (since it is semantically cancelled)

* (Actually) properly cancelled the event (since it is semantically cancelled)

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-05-18 19:23:22 +00:00
94ba90d694 Always initialize PermissionHandler (fixes #3019) 2021-05-18 21:17:47 +02:00
e97bc25fb8 Log plot chat to console
- Fix plot music removal template
- Fix debug args
2021-05-17 10:35:09 +02:00
73936bb10d Fix licenser issues 2021-05-17 09:31:33 +02:00
23e65ac5d3 Merge branch 'feature/v6/update-licenser' into v6 2021-05-17 09:29:08 +02:00
9dc0396411 Fix plot list coloring 2021-05-16 22:47:02 +02:00
cc6db9ae9e Merge branch 'v5' into v6 2021-05-15 20:47:01 +02:00
3748d8e246 Minor cleanup in favor of Java 16
- Addressing a few command deprecations during the major release superseded by toggles
- Don't swallow SQL warnings in loggers behind debug, as it's often set to false
- Deleted JavaVersionCheck, it's part of ServerLib.
2021-05-15 20:39:16 +02:00
0341111f8f Add lectern-read-book flag
Fixes https://github.com/IntellectualSites/PlotSquared/issues/2980
2021-05-14 18:22:02 +02:00
a7c4b40fcc Add no-portals and deny-portal-travel flag 2021-05-14 15:51:20 +02:00
e7fb3571ac Update licenser 2021-05-14 13:36:18 +02:00
58ad9db5ed Jump to Java 16 2021-05-14 01:04:09 +02:00
6fd55b47c2 Fix typo 2021-05-13 21:41:10 +01:00
3d7c191d1c Make the plot jukebox gui translatable
Fixes https://github.com/IntellectualSites/PlotSquared-Translations/issues/2
2021-05-13 20:21:19 +02:00
9344e1ca79 Make /plot setup header translatable
- Document a couple of permission nodes
2021-05-13 13:32:34 +02:00
68eb5cd74f Replaced economy supported (Vault) check within cost condition with a pre-eliminating if-guard (#3014) 2021-05-12 19:00:14 +02:00
ca7ac71e76 Update gradle and shadow 2021-05-12 03:00:34 +02:00
3a280f3b6a Fix a few typos 2021-05-11 19:26:39 +02:00
19cea0e129 Un-stringify plot id calls
- PlotId#toString() already stringifies IDs, no need to call String.valueOf()
- Add tab completion to `/plot debugroadregen`
- Add `plots.flag.notify-leave.bypass` permission separating from notify-enter
- Add message notifying the player if the attempt to enter a plot they are denied from
2021-05-11 18:50:37 +02:00
2c40648a60 Fixed feedback recipient for notify flags (Owner instead of entering / leaving player) (#3011) 2021-05-11 18:26:24 +02:00
48815649a8 Clarify native dependency versions 2021-05-07 22:12:14 +02:00
f690e14a14 Exchange EssentialsX maven repo 2021-05-07 11:08:07 +02:00
b37ad79e50 Beautify empty /plot caps output
Also strip prefix from empty plot description
2021-05-07 09:59:17 +02:00
a990205d41 Fix empty templates when vault not found 2021-05-07 01:53:18 +02:00
891230c78e Fix /plot sethome returning usage message & working on unclaimed plots 2021-05-07 01:27:11 +02:00
8bfdf8ecf2 Fix /plot cluster sethome triggering usage message
Enhance cluster messages a bit
2021-05-07 01:18:33 +02:00
78655102b9 Fix flag exception coloring 2021-05-06 19:06:50 +02:00
491a171409 Fix invalid backup messages & component prefix & update minimessage 2021-05-06 10:30:04 +02:00
b3aec8f839 Fix empty default flag message 2021-05-02 20:31:23 +02:00
0106a4222d Address a few deprecations 2021-05-01 18:33:02 +02:00
11af33f2d5 Fixup inbox javadocs 2021-04-30 19:04:44 +02:00
812442fbbc Don't double color the inbox 2021-04-30 13:22:00 +02:00
1750dd3b97 Opt in future proof gradle features 🚀 (#2950)
* Opt in future proof gradle features

* Resolve merge conflicts
2021-04-30 09:50:22 +02:00
ffe298710d Lazy merge v5/v6 2021-04-28 20:17:10 +02:00
5cdb7e76fd Update wiki and issue links 2021-04-28 20:06:19 +02:00
361b936aa0 Update ServerLib 2021-04-27 11:58:49 +02:00
9503b0bfc4 Merge branch 'v5' into v6 2021-04-27 11:52:44 +02:00
823beaf268 Update a few dependencies 2021-04-27 11:46:14 +02:00
3ada55989f [ci skip] Setup new issue templates (#2951)
* Setup issue templates

* Exchange issue url
2021-04-26 16:25:15 +02:00
de597391dc Fix keep-inventory flag & adjust disallowed-blocks translation 2021-04-21 11:03:14 +02:00
59599261ff Fixes https://issues.intellectualsites.com/issue/PS-237 2021-04-12 16:08:31 +02:00
e1fb8c1ae5 Take building min height also into consideration 2021-04-11 10:12:37 +02:00
ba4146f82c Update to gradle 7 2021-04-10 16:52:46 +02:00
a5c43bb823 Suggest flag name instead of value 2021-04-10 09:34:53 +02:00
050cf3edb3 Update a few dependencies 2021-04-04 13:30:09 +02:00
84d5ebfa41 Make use of because args 2021-04-03 23:15:40 +02:00
6bc4e5b45c Re add per-world-teleport 2021-04-03 22:34:43 +02:00
496fe09f78 Merge branch 'v5' into v6 2021-04-03 22:31:54 +02:00
19daf1bd52 5.13.12 2021-04-03 22:18:03 +02:00
74a9c2f6b4 Reimplement per-world-visit 2021-04-03 21:48:21 +02:00
dd9edb68b2 Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/23 2021-04-02 23:48:16 +02:00
b02177e1d0 Add tab completion for gamemode flag 2021-04-02 23:20:39 +02:00
600d38d3e2 Add flag placeholders to flag commands 2021-04-02 17:50:37 +02:00
07fd7e497f Strip commands from translation files 2021-04-02 14:04:17 +02:00
932873ba02 Do not access nms for older versions on newer ones 2021-03-31 12:42:32 +02:00
567f1d4247 Fix backup captions and add placeholders to copy/move/swap 2021-03-30 13:44:04 +02:00
3f05dfe4bf Sort plots for /plot home the same as for /plot visit, fixes PS-188 2021-03-30 11:19:43 +02:00
fbebcf57c1 Fix exporting all plots 2021-03-29 17:07:58 +02:00
30d3a458e2 Addressing more issues 2021-03-28 17:39:02 +02:00
7591d88d00 Fixes PS-229
Closes #2948

Co-Authored-By: Benjamin Govaerts <17101059+BenjaminGoGurts@users.noreply.github.com>
2021-03-23 23:44:27 +01:00
22baabf751 Don't fail on Java 17 (and higher) 2021-03-23 10:39:17 +01:00
0cdda8b0ae Fix a few issues with debugexec 2021-03-12 15:05:25 +01:00
295a63087f Strip lesser used debug commands 2021-03-12 14:45:43 +01:00
797d3ed362 Don't invert the debug status message 2021-03-04 21:43:16 +01:00
31de7de385 Cover a couple of NPEs 2021-03-01 16:21:12 +01:00
5780ad370a Strip Java 15 note 2021-03-01 10:58:27 +01:00
3833d2cd83 Restrict a few more commands from plot world plots
And add missing tab completion for debug commands
2021-02-24 23:21:54 +01:00
38b60205e8 Use javax for Nullable + guice, hope I didn't miss anything 2021-02-24 20:35:38 +01:00
027456fd77 Add crop-grow flag 2021-02-24 18:41:36 +01:00
10e2d65221 Remove scripting-related stuff (#2947)
* Remove scripting-related stuff

* Cleanup

Co-authored-by: NotMyFault <mc.cache@web.de>
2021-02-24 09:53:55 +01:00
d9b5dc5dd7 Sort plots for /plot home the same as for /plot visit, fixes PS-188 2021-02-24 08:46:16 +01:00
c7e6564667 Add new metrics pies 2021-02-22 15:22:38 +01:00
da45813a06 Add new metrics pies 2021-02-22 15:18:20 +01:00
6cc9b5c62b Remove eol config entries 2021-02-22 13:24:46 +01:00
1172e02f1b Fix several issues with debug command 2021-02-21 12:34:14 +01:00
46fbc05040 Don't fail to load when moving components file 2021-02-20 19:41:58 +01:00
fee1ffa2e9 Switch to vanity url 2021-02-17 00:50:50 +01:00
22be81b5cb Switch to vanity url 2021-02-16 23:50:53 +01:00
12d260ca82 Fixes https://issues.intellectualsites.com/issue/PS-23 2021-02-09 18:20:50 +01:00
82e90553bc Enhance continue message 2021-02-03 15:44:18 +01:00
18c1a0e4f6 Remove duplicated translation strings 2021-02-02 16:48:01 +01:00
c42102d1c4 Don't shade without relocation 2021-02-01 15:31:25 +01:00
aca2d2e510 Fixes https://issues.intellectualsites.com/issue/PS-186 2021-01-31 11:44:22 +01:00
666938b738 Update ServerLib 2021-01-30 13:17:36 +01:00
a75db92007 Update ServerLib 2021-01-30 13:16:36 +01:00
aaf2fa8807 Update bStats to 2.1.0 2021-01-24 10:39:03 +01:00
e549235d83 Switch to ServerLib 2021-01-22 23:42:45 +01:00
86e8457574 Move to ServerLib 2021-01-22 23:34:47 +01:00
8292ed9e31 More annotation work 2021-01-10 00:01:48 +01:00
57fc51d013 Initial annotation usage cleanup + EditorConfig 2021-01-09 22:28:41 +01:00
8b332adbe7 Address comments 2021-01-09 21:34:42 +01:00
ae0ee1ebdd fix teleport to "*" 2021-01-09 21:34:42 +01:00
3cea734b9b Fix singleworlds 2021-01-09 21:34:42 +01:00
7ac3f7ca03 Fix sync tasks not being sync 2021-01-09 20:39:25 +01:00
0a5c73478d Fix improper missing permission message on /plot list world 2021-01-08 17:16:38 +01:00
495952acb0 Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/129 2021-01-08 16:46:57 +01:00
25a8f1522a Move creation date up in plot header 2021-01-08 16:08:42 +01:00
f13f7ce129 Disable destructive operations for plot world plots 2021-01-08 16:06:15 +01:00
cc90127af9 fix two <> errors in lang 2021-01-07 13:45:01 +00:00
98e8476a88 Bring v5 entity spawn changes to v6 2021-01-06 21:56:26 +00:00
ec8bdc9af6 Actually place the debugroadregen blocks 2021-01-04 19:23:31 +00:00
9598416932 handle cancellation properly in DefaultProgressSubscriber 2021-01-04 18:23:45 +00:00
4c0bc79e49 Allow over/undersizes schematics to be saved and pasted (#2944)
Co-authored-by: NotMyFault <mc.cache@web.de>
2021-01-03 23:46:53 +01:00
01dd2d8097 Should be code, not link
Co-authored-by: Alexander Söderberg <4096670+Citymonstret@users.noreply.github.com>
2021-01-03 23:42:32 +01:00
e09444d94f code style 2021-01-03 23:42:32 +01:00
0c76833997 Implement CaptionLoader API to be used by third party plugins/addons
This allows to load resources from other classloaders than the P2 one. Therefore, we can use this in addons too to manage messages the same way.
2021-01-03 23:42:32 +01:00
ad99ca1723 Use WE Expressions instead of js evaluation (#2941)
* Implement thread-safe expression evaluation

* Update `{args}` to `plot` automatically

* Stringify more money/balance/price occurrences with EconHandler#format
2021-01-02 16:32:07 +00:00
f47561b580 Invert leaf-decay message 2021-01-01 21:51:28 +01:00
4f60da292a Add leaf-decay flag
Stop leaves from decaying.
2021-01-01 21:47:09 +01:00
70fb86a1c3 Remove redundant legacy version check
"api-version" backs us up here.
2021-01-01 14:09:59 +01:00
bf79639d07 Update license to 2021
Happy new year 🎆
2021-01-01 00:46:30 +01:00
e8642df674 Update licenses to 2021
Happy new year 🎆
2021-01-01 00:19:45 +01:00
b648717079 5.13.11 2020-12-29 15:14:00 +01:00
3702caa25f Replace toggle permission with plots.toggle 2020-12-28 16:06:24 +01:00
4200bbfd0a Update permission range declaration 2020-12-28 15:38:42 +01:00
0fcca4c141 Use hasPermissionRange to check for trust and add limits 2020-12-28 15:36:00 +01:00
fafdae9ba9 Only check ice-form for ice (#2940)
Co-authored-by: NotMyFault <mc.cache@web.de>
2020-12-28 14:11:30 +00:00
ef215b1b0c fix debugpaste with multiverse 2020-12-28 12:31:51 +00:00
1d0721034d fix debugpaste with multiverse 2020-12-28 12:30:53 +00:00
3cfbe9585a Merge branch 'v6' of github.com:IntellectualSites/PlotSquared into v6 2020-12-28 12:27:12 +00:00
71305e636c cache bukkitworld 2020-12-28 12:10:27 +00:00
ce23c153ee Fix added_list and denied_list placeholders 2020-12-28 12:15:34 +01:00
019da4d2f4 Expose legacy serializer for placeholders 2020-12-28 11:21:35 +01:00
ffc31f565b Use builder for flags component 2020-12-28 00:05:33 +01:00
7f01f2d716 Rename placeholders matching more appropriately 2020-12-27 19:37:09 +01:00
bf20b0dd79 Beautify placeholder output for '*' permission 2020-12-27 19:16:26 +01:00
867826759b Make placeholders translatable 2020-12-26 13:50:00 +01:00
3be370071c fix purge <owner> 2020-12-23 14:13:50 +00:00
2b9a194244 5.13.10 2020-12-23 14:07:42 +00:00
67a928b1ae Merge branch 'v5' of github.com:IntellectualSites/PlotSquared into v5 2020-12-23 13:54:35 +00:00
67a7211b77 use correct UUID pipeline methods in purge command 2020-12-23 13:52:47 +00:00
1d4fe01db0 Rename database chart id 2020-12-22 20:54:22 +01:00
07491d8028 Rename database chart id 2020-12-22 20:53:13 +01:00
7f1baca872 Add database type to debugpaste 2020-12-22 17:55:37 +01:00
8c3a0a8275 Fix compiling 2020-12-21 20:33:49 +01:00
eba6043d26 Update paster 2020-12-21 15:59:12 +01:00
397692d113 Update Paster 2020-12-21 15:58:34 +01:00
035ecc1517 Delete dependabot.yml 2020-12-21 10:58:30 +01:00
bb52301200 Merge remote-tracking branch 'origin/renovate/configure' into v6 2020-12-20 22:38:35 +01:00
f4adf5d7e7 Add renovate.json 2020-12-20 21:24:38 +00:00
e4a8459798 Switch to IncendoPaster "library" 2020-12-19 16:20:44 +00:00
14fa738fbe switch to InvendoPaster "library" 2020-12-19 16:00:13 +00:00
4da7aa38ea @Sauilitired can't spell properly 2020-12-16 13:23:14 +01:00
5147d67318 Add charts for complex plot components 2020-12-16 13:20:23 +01:00
cbc599cb20 don't double-up schematic x/z offsets 2020-12-16 12:13:39 +00:00
09c84e25bf don't double-up schematic x/z offsets 2020-12-16 12:07:36 +00:00
224e3b6ad4 Fix publishing. I am an author. 2020-12-14 18:09:09 +00:00
992a683ba2 another annoying cache thing 2020-12-14 15:22:10 +00:00
e8e116312a Merge branch 'v5' into v6
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java
#	Core/src/main/java/com/plotsquared/core/command/Deny.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
2020-12-14 15:15:27 +00:00
de3ba9a25c re-send block change for blocks with gravity if they're physicsed
fixes PS-159
2020-12-14 14:53:53 +00:00
5e88cabb4b compare UUID to UUID, not UUIDMapping
fix PS-182
2020-12-14 14:32:34 +00:00
6d71177394 Don't save corrupt schematics so that when they load, they work. 2020-12-13 21:09:05 +00:00
edd9ae5118 Fix more flag message issues. 2020-12-12 22:46:37 +01:00
23ae3b5830 Use builder for flag list message 2020-12-12 21:19:28 +01:00
6746aab7ef Improve /plot info formatting 2020-12-12 18:56:19 +01:00
c85ff7ddda Update README.md 2020-12-12 17:52:24 +01:00
cf70efabb0 we want throwable to be null 2020-12-11 16:51:13 +00:00
6eb2958afc Fix merge issue 2020-12-11 11:42:19 +00:00
18f13b7d15 Merge branch 'v5' into v6 2020-12-10 21:28:28 +00:00
0bb959d26a Merge branch 'v6' of github.com:IntellectualSites/PlotSquared into v6 2020-12-10 21:15:51 +00:00
b4f3e85001 allow "owned" road mobs to be killed as well
(those that are leashed, being ridden, etc)
2020-12-10 21:14:32 +00:00
25100c46f7 Don't unclaim claimed plots with /p claim 2020-12-10 22:13:13 +01:00
540f4c0958 fix info for server-plots 2020-12-10 21:05:50 +00:00
8930ebe572 Relight command is pointless as we'd just use FAWE for it anyway. 2020-12-10 18:06:32 +00:00
8f93f2b6d2 Revert "Allow "Server" owner" as that has its own UUID
This reverts commit 9ba91889e0.
2020-12-10 18:02:38 +00:00
9ba91889e0 Allow "Server" owner 2020-12-10 17:58:00 +00:00
67683fbddb Ensure not to parse null parameters into templates for titles 2020-12-10 17:56:22 +00:00
824f9d7ad0 Add missing returns to /plot cluster 2020-12-09 23:14:52 +01:00
3e99f90eb1 Don't spit NPEs on NonNull values 2020-12-09 22:45:47 +01:00
3ca8a94419 Update java 8 notice 2020-12-08 00:18:40 +01:00
714837dd00 Add charts for complex components 2020-12-07 23:05:25 +01:00
bc1d3ddd5d Fix spelling 2020-12-07 21:25:32 +01:00
bf7b75b619 Make titles duration configurable 2020-12-07 21:23:38 +01:00
469d6ab907 Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/77 2020-12-07 14:46:16 +01:00
a4dd5bb62f Add tab completion to like/dislike and fix more messages 2020-12-07 12:51:14 +01:00
60859de0bd Add an option to teleport the player on plot clearing or deletion 2020-12-07 10:55:34 +01:00
ff70d5db14 Feature/v6/arkitektonika (#2916)
* Start working on Arkitektonika support

* Progress on Arkitektonika

* Add license headers

* Some QoL and javadocs

* Fix maximum calculation

* Fix minor formatting

* Reimplement legacy webinterface support

* Add documentation and fix deletion link

* Resolve conflicts/gradle stuff

* Fix links

* Make message readable

* Do not allow download of merged plots
2020-12-05 19:50:41 +01:00
c8ad936d26 Clean up PlotPlatform a bit and make the placeholder registry injectible 2020-12-05 18:41:41 +01:00
60b5f5fe48 Add note about Nashorn 2020-12-05 18:38:10 +01:00
14ec7fb816 Fix PlotRangeIterator 2020-12-05 18:03:24 +01:00
b4ea230ff1 Minor translation changes 2020-12-05 15:35:33 +01:00
410879d154 Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/141 2020-12-05 15:20:19 +01:00
f14121e99c Initiate placeholder registry 2020-12-05 15:08:27 +01:00
19d7444946 Fix flag description 2020-12-04 19:27:34 +01:00
d9aaed0035 Update dependencies 2020-12-04 18:07:59 +01:00
cfd3c159f9 Follow up to 4ff50525ed
Skipping deprecation here, this exists for so long and and has been superseded by permissions now.
2020-12-04 17:33:41 +01:00
4ff50525ed Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/110 2020-12-04 17:30:11 +01:00
34e02e9f3a Make JavaVersionCheck private 2020-12-04 16:00:18 +01:00
62690c2a53 Postpone java version during startup 2020-12-04 12:25:53 +01:00
5d30e0854f Add java version checker 2020-12-04 12:15:56 +01:00
ec683cdf88 Update ClassicPlotWorld.java 2020-11-29 17:48:59 +01:00
39feed6fac Improve wording of generation steps 2020-11-29 17:35:41 +01:00
ee7f683b76 Bump paperlib, fix single worlds. 2020-11-26 16:54:38 +00:00
209d52e920 Update adventure 2020-11-26 11:35:46 +01:00
585111ca38 Cancel boat placement on interactable blocks, fixes PS-175 (#2934)
* Cancel boat placement on interactable blocks, fixes PS-175

* Keep boat protection for old game versions

Co-authored-by: NotMyFault <mc.cache@web.de>
2020-11-24 16:32:35 +01:00
ef95334fe6 Update actions worflow 2020-11-23 18:35:44 +01:00
4595534a6f Update actions workflow 2020-11-23 18:32:28 +01:00
be9d9264ae Make use of Permission class in tab completion
Plus document a few more permission nodes
2020-11-19 22:29:44 +01:00
a8495c67d4 Update gradle to 6.7.1 2020-11-19 22:05:45 +01:00
eec369ea4f Improve tab completion, adjust permissions and more v6 changes 2020-11-19 21:53:27 +01:00
abed07b613 Add tab completion for /plot area 2020-11-19 21:24:23 +01:00
6cfdedb823 Don't collapse imports 2020-11-19 21:13:35 +01:00
db903ebb0a Revert "Update gradle.yml"
This reverts commit e12c83fd83.
2020-11-19 21:05:48 +01:00
e12c83fd83 Update gradle.yml 2020-11-19 17:44:57 +01:00
12861f6c07 Add tab completion for /plot setowner 2020-11-19 17:39:58 +01:00
52065b8313 Add tab completion for /plot schematic 2020-11-19 17:36:14 +01:00
f6ff843cfb Send message when attempting to leave an own plot
This is a temporary workaround for the todo addressed below.
2020-11-19 17:30:26 +01:00
aedf402c17 Fix /plot leave requiring an arg when none is needed 2020-11-19 17:10:01 +01:00
0745b03271 Add tab completion for /plot cluster 2020-11-19 17:00:21 +01:00
bb5c0de367 Fix /plot download world not being clickable 2020-11-19 16:39:44 +01:00
9478251d44 Fix /plot buy message and enhance it with player balance 2020-11-19 16:32:30 +01:00
47cb85d3db Merge pull request #2932 from IntellectualSites/feature/v6/generify-perms
Generify permissions thru Permission class
2020-11-16 10:34:29 +01:00
ce7ceccc1c Merge branch 'v6' into feature/v6/generify-perms 2020-11-16 10:25:48 +01:00
5d4cf3b705 setowner should allow null UUIDs 2020-11-10 17:24:37 +00:00
f33fc092e3 Add java 11 to actions test 2020-11-08 21:48:23 +01:00
0ff8abcd6f Update town template for schem 2 v2 2020-11-08 15:22:31 +01:00
b0d55d434d 5.13.9 2020-11-03 21:14:07 +01:00
092690e9f0 Update permission in regards of https://github.com/IntellectualSites/PlotSquared/pull/2932 2020-11-03 15:44:07 +00:00
5b11175cf3 Add plots.visit.denied permission 2020-11-03 15:44:07 +00:00
7a203a12a3 Merge branch 'v6' of https://github.com/IntellectualSites/PlotSquared into v6 2020-11-03 16:43:48 +01:00
f7dd8af35e Enhance plot claim message 2020-11-03 15:43:28 +00:00
7a9b3442d2 1.16.4 2020-11-03 16:43:18 +01:00
b66e2359d1 Update to 1.16.4
- Bump WorldEdit to 7.2.0 release
2020-11-03 15:58:17 +01:00
81c72ee5d9 Finish up permissions 2020-11-02 21:03:46 +01:00
fed7f89f96 Fix compiling 2020-11-02 11:58:07 +01:00
aefa629509 Generify permissions thru Permission class
- Fixed a few improper permissions
- Fixed a couple of typos
2020-11-02 00:55:58 +01:00
bc32581cbd Improve empty global flag list message 2020-11-02 00:00:38 +01:00
3f7f6af051 Merge pull request #2913 from IntellectualSites/features/v6/queue-features
Features/v6/queue features
2020-11-01 21:16:32 +01:00
ee9b2e8bf8 Just merge the whole thing. Merge branch 'v6' into features/v6/queue-features
# Conflicts:
#	Core/src/main/resources/lang/messages_en.json
2020-11-01 18:58:24 +00:00
0b968abfe4 fix merging conflicts 2020-11-01 17:45:38 +00:00
7e7ecd6a0f Update paperlib 2020-11-01 17:17:12 +01:00
7e9a9e14c7 Fix various instances where Adventure is being used incorrectly 2020-10-25 22:38:00 +00:00
333493f351 adventure v4.1.0; project now compiles 2020-10-17 21:10:02 +01:00
38333a6d11 Update to Gradle 6.7 2020-10-17 21:10:02 +01:00
4213957d76 Delete dependabot.yml 2020-10-12 12:21:32 +02:00
565f9e3e29 5.13.8 2020-10-11 19:27:01 +01:00
a1bfc1cb26 correctly handle road flags 2020-10-11 19:24:50 +01:00
cfd432886d Correctly handle road flags 2020-10-11 19:19:17 +01:00
191666a2f2 Fix logo 2020-10-11 13:03:22 +02:00
aeeae7c167 Fix links not being clickable 2020-10-11 12:47:49 +02:00
08c7d4d15e Remove dead imports 2020-10-09 21:03:23 +02:00
29b92659c7 Fix typos 2020-10-09 20:50:12 +02:00
209f25a5cf Update default branch 2020-10-09 20:21:57 +02:00
4622f4b51d Fix plot leave 2020-10-09 20:21:02 +02:00
4d51dc9b6c Switch to translateable captions 2020-10-09 17:47:51 +01:00
76b992509b use format not silly round stuff 2020-10-09 17:29:05 +01:00
925978db8f change default lighting to 1 2020-10-09 17:26:52 +01:00
c0e90ddb33 increase interval of progress notify 2020-10-09 17:25:48 +01:00
a7a29eaf97 Correctly cancel notify tasks and add notifications to commands 2020-10-09 17:24:59 +01:00
a451d2d6f2 Fix the injection 2020-10-09 16:34:59 +01:00
914429ab4f Merge branch 'v6' into features/v6/queue-features
# Conflicts:
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java
#	Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
2020-10-09 15:23:09 +01:00
f721a7c66c Update build.gradle.kts 2020-10-08 21:25:09 +02:00
bba499649b No need to point if PAPI is not in use 2020-10-08 20:56:33 +02:00
f9cd54c445 Shift logger.info -> error when running in an outdated environment 2020-10-08 20:54:06 +02:00
0d89125a8e Replace sys out with logger factory 2020-10-08 20:52:02 +02:00
6b37d678df Fix plot template tab completion 2020-10-08 20:47:43 +02:00
02698b3a0e Fix plot grant tab completion 2020-10-08 20:42:17 +02:00
6f0512c18c Fix plot set tab completions 2020-10-08 20:16:29 +02:00
e46b38b301 Fix plot set values 2020-10-08 19:51:42 +02:00
5841817fb5 Missing space 2020-10-08 19:29:09 +02:00
e28fb49015 Add override permission for /plot music 2020-10-08 19:27:05 +02:00
841eef6a52 Fix done message on backup and add done message to grant 2020-10-08 18:57:11 +02:00
2eee1ef203 Fix log4j 2020-10-08 14:33:48 +02:00
cd605f4996 Relocate log4j, move slf4j declaration 2020-10-08 14:02:08 +02:00
54a8482a88 Minecraft does not always provide slf4j 2020-10-08 14:02:08 +02:00
e15b5a07fb It runs! And it's small! 2020-10-08 14:02:08 +02:00
c198305b5e Add missing relocations 2020-10-08 14:02:08 +02:00
a637a8970b Add maven publishing 2020-10-08 14:02:08 +02:00
d97f68eec0 Address review issues 2020-10-08 14:02:08 +02:00
c3069a425d Format licence headers 2020-10-08 14:02:08 +02:00
9b1dc7d42e She compiles! 2020-10-08 14:02:08 +02:00
ec23fcdd75 Rewrite build scripts
Co-Authored By: Mariell Hoversholm <proximyst@proximyst.com>
2020-10-08 14:02:08 +02:00
544d57c720 Merge branch 'v5' into v6
# Conflicts:
#	Bukkit/build.gradle
#	Bukkit/pom.xml
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/uuid/BungeePermsUUIDService.java
#	Core/src/main/java/com/plotsquared/core/PlotPlatform.java
#	Core/src/main/java/com/plotsquared/core/command/DebugPaste.java
#	Core/src/main/java/com/plotsquared/core/command/Grant.java
#	build.gradle
2020-10-07 12:20:32 +01:00
b55d836871 5.13.7 2020-10-07 11:59:44 +01:00
a210f523a5 Add more information to debugpaste 2020-10-04 18:19:29 +02:00
e6237d68d0 Also remove BungeePerms from the config 2020-10-04 13:26:56 +02:00
56e6922279 Remove BungeePerms UUID fetcher 2020-10-04 13:26:56 +02:00
6e2f738d86 Stop relying on maxim's repo as it's very unreliable. 2020-10-04 12:24:37 +01:00
81d0bf6f04 Prevent blocks from getting waterlogged
In some cases, the PlayerInteractEvent doesn't cancel right clicks on blocks that can be waterlogged
2020-10-03 21:54:14 +02:00
95f509d337 Stop forcing loiwercase world names 2020-10-02 15:08:14 +01:00
2f5ce67154 add back setShouldAbortSpawn 2020-09-29 15:55:08 +01:00
89318be5f4 Apply e2f9b4245b to paper listener too 2020-09-29 15:53:23 +01:00
f80e8c8d11 For sake of allowing v5 -> v6 2020-09-25 20:08:28 +01:00
8c4bb4140a 5.13.6 2020-09-20 19:51:54 +01:00
ff83931a3f Fix plot grant 2020-09-20 19:42:13 +01:00
2468be4736 Merge branch 'v6' of https://github.com/IntellectualSites/PlotSquared into v6 2020-09-20 17:36:35 +02:00
4e835ed3ff Add missing command description 2020-09-20 00:51:54 +02:00
41f494fbff Remove jetbrains annotations 2020-09-18 12:45:26 +01:00
e974fe5dc7 Merge branch 'v6' into features/v6/queue-features 2020-09-18 12:22:32 +01:00
85a23442cc bump minimessage version to fix build 2020-09-18 12:22:01 +01:00
a822a70f00 bump minimessage so it compiles 2020-09-18 12:11:34 +01:00
819902c24e Fix licenses 2020-09-14 22:00:09 +01:00
554efbb057 Merge branch 'v5' into v6
# Conflicts:
#	.github/CODEOWNERS
#	Bukkit/pom.xml
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java
#	Core/src/main/java/com/plotsquared/core/command/Alias.java
#	Core/src/main/java/com/plotsquared/core/command/HomeCommand.java
#	Core/src/main/java/com/plotsquared/core/command/Music.java
#	Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
#	Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java
#	Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java
#	build.gradle
2020-09-11 15:44:04 +01:00
8547533210 update pom 2020-09-11 15:04:09 +01:00
d843d1715d Allow /plot home [area|world] 2020-09-11 15:03:48 +01:00
1552a8e74b Add option to change lighting behaviour in queues 2020-09-11 14:18:50 +01:00
f0e9a8c5fe Implement progress subscribers 2020-09-11 12:59:40 +01:00
648953ec1f 5.13.5 2020-09-11 12:27:23 +02:00
9e85748b2e Merge branch 'features/v6/queue-features' of github.com:IntellectualSites/PlotSquared into features/v6/queue-features 2020-09-11 11:21:23 +01:00
a98b23af02 progress subscriber 2020-09-11 11:20:38 +01:00
5463f15633 Add pigstep music disc 2020-09-11 01:16:57 +02:00
0c6113b0d1 5.13.4 2020-09-09 23:31:30 +02:00
c5906e780a Merge pull request #2912 from IntellectualSites/fix/v5/blocktypewrapper
Add default namespace when wrapping block categories by their ids
2020-09-08 18:50:08 +02:00
f2355a76d6 Add default namespace when wrapping block categories by their ids 2020-09-06 23:36:36 +02:00
0aeca40137 Take player visibility into account when sending notify-enter and notify-leave messages. Fixes PS-103. 2020-09-05 18:48:58 +02:00
5c48e4ad19 Add missing license header 2020-09-05 18:39:56 +02:00
f6d1e2b3b8 Check TileState manually on 1.13.2, fixes PS-122 2020-09-05 18:39:56 +02:00
37010d92ee Create CODEOWNERS 2020-09-05 13:42:11 +02:00
babad3ab6d Don't validate plot aliases with offline players (Fixes PS-126) 2020-09-04 14:49:02 +02:00
b12e9832c9 Update pom.xml 2020-09-02 17:20:54 +02:00
0f9554c717 Merge branch 'v5' into v6 2020-09-02 17:19:12 +02:00
d19dde2f85 Add more debugs 2020-09-02 17:18:41 +02:00
7a529e156d Add deb for onBlockIgnite event 2020-09-02 17:03:56 +02:00
cba2474df7 Merge v5/v6 2020-09-02 16:44:18 +02:00
03c889383b Merge pull request #2908 from IntellectualSites/dependabot/gradle/v5/org.yaml-snakeyaml-1.26
Bump snakeyaml from 1.25 to 1.26
2020-09-02 16:15:26 +02:00
da54478767 Merge pull request #2907 from IntellectualSites/dependabot/gradle/v5/org.jetbrains-annotations-20.1.0
Bump annotations from 20.0.0 to 20.1.0
2020-09-02 16:14:26 +02:00
acf9c2554f Merge pull request #2904 from IntellectualSites/dependabot/gradle/v5/org.ajoberstar.grgit-4.0.2
Bump org.ajoberstar.grgit from 4.0.1 to 4.0.2
2020-09-02 16:12:56 +02:00
7c53bfc870 Bump snakeyaml from 1.25 to 1.26
Bumps [snakeyaml](https://bitbucket.org/asomov/snakeyaml) from 1.25 to 1.26.
- [Commits](https://bitbucket.org/asomov/snakeyaml/branches/compare/snakeyaml-1.26..snakeyaml-1.25)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-02 14:10:44 +00:00
32a8dcd411 Bump annotations from 20.0.0 to 20.1.0
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 20.0.0 to 20.1.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JetBrains/java-annotations/compare/20.0.0...20.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-02 14:10:44 +00:00
20b4cec0ca Bump org.ajoberstar.grgit from 4.0.1 to 4.0.2
Bumps org.ajoberstar.grgit from 4.0.1 to 4.0.2.

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-02 14:10:39 +00:00
c51c938e8d Merge pull request #2903 from IntellectualSites/dependabot/add-v2-config-file
Create Dependabot config file
2020-09-02 16:10:14 +02:00
49984f2560 Create Dependabot config file 2020-09-02 13:55:15 +00:00
b3c77ef099 Merge branch 'dependabot/gradle/v5/org.jetbrains.kotlin-kotlin-stdlib-1.4.0' into v5 2020-09-02 12:57:05 +02:00
97e34844b4 Add option to opt-out MvDW Placeholder API 2020-09-02 12:13:23 +02:00
e924a1920e Add message to rgar 2020-09-01 00:02:56 +02:00
1441cc293c 5.13.3 2020-08-26 13:57:20 +02:00
311a2ddc75 Replace null checks with NullEconHandler 2020-08-25 12:41:03 +02:00
551d1d9f1a Add NullEconHandler to avoid verbose null checks 2020-08-25 12:41:03 +02:00
a5dea9e7f6 Permission cleanup 2020-08-24 20:51:23 +02:00
02bd83bd90 Merge v5 into v6 2020-08-24 14:33:53 +02:00
c42d5390a4 Allow teleporting to merged plots with multiple owners using /p home 2020-08-24 13:37:12 +02:00
31ea7297c2 Generate signs by default 2020-08-24 13:30:50 +02:00
c53cffb745 Generate signs by default 2020-08-24 13:17:15 +02:00
26a99a122a Minor permission fix 2020-08-23 19:34:22 +02:00
acb0bd95f2 Bump kotlin-stdlib from 1.3.72 to 1.4.0
Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.72 to 1.4.0.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.4.0/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.72...v1.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-22 23:05:56 +00:00
5d73b17415 Merge pull request #2899 from IntellectualSites/dependabot/gradle/v5/org.jetbrains-annotations-20.0.0
Bump annotations from 19.0.0 to 20.0.0
2020-08-23 01:04:40 +02:00
3a8fa9f5b6 Update WorldEdit version
That doesn't appear to break stuff 👀
2020-08-22 13:18:00 +02:00
e93d7feb2c Fixes PS-114 2020-08-22 11:48:03 +02:00
116b870152 Apply missing license header 2020-08-22 11:44:34 +02:00
667c7b07b6 Merge pull request #2897 from IntellectualSites/features/v6/services 2020-08-21 23:03:29 +02:00
45e75cc06e Merge branch 'v6' into features/v6/services 2020-08-21 23:02:52 +02:00
5c08db2f44 Merge branch 'feature/v5/1.16.2-support' into v5 2020-08-21 19:02:23 +02:00
28fc29c3ab Merge pull request #2890 from MeFisto94/fix-1-16-worldserver-regression
Fixes an OfflinePlayerUtil breakaged caused by NMS Changes
2020-08-21 18:29:03 +02:00
b2ac67692e Merge pull request #2892 from TimonMi/v5
[Bugfix] No chat message confirmation on /p add /p trust, etc.
2020-08-21 18:28:05 +02:00
1064d777c2 Clean up unused code 2020-08-21 00:02:07 +02:00
62f675adbe Allow visiting all owners of merged plots 2020-08-21 00:01:53 +02:00
cee0bbb805 Revert target usage 2020-08-20 23:29:51 +02:00
77eb75fcc6 Adapt adventure changes 2020-08-20 23:28:42 +02:00
55211907f2 Use command descriptions from translations 2020-08-20 23:16:15 +02:00
e1e7cd1479 Add missing license headers 2020-08-20 17:11:12 +02:00
2d3c729215 Extract plot modifications to external class 2020-08-20 17:10:50 +02:00
f391cfd432 Extract comment logic from the plot class 2020-08-20 16:03:06 +02:00
352136f0c6 Cleanup logging system 2020-08-18 15:50:28 +02:00
b6e7f90f6a Fix logger.info format 2020-08-18 15:34:43 +02:00
86cfeb76b6 More json stuff 2020-08-18 12:22:26 +02:00
d91357a807 Update messages_en.json 2020-08-18 10:59:44 +02:00
3c8d7a808b Prefix changes and others 2020-08-17 23:21:18 +02:00
d6a80c7ea5 More json stuff, fixes and enhancements 2020-08-17 22:26:01 +02:00
05a15ac689 Fix a few typos and spaces 2020-08-17 19:39:43 +02:00
580cc359e5 fabb9b6fd7 (r41530745) 2020-08-17 18:56:27 +02:00
630284e7ae More json fixes 2020-08-17 18:42:42 +02:00
cc562033e7 Fix console requirement 2020-08-17 18:29:51 +02:00
fabb9b6fd7 More json stuff 2020-08-17 18:15:29 +02:00
e8ffcaae46 progress subscriber 2020-08-17 16:21:11 +01:00
47d9895077 Fix ms to ticks conversion on Paper 2020-08-17 16:37:27 +02:00
aacf15757f Use less confusing variable name 2020-08-17 15:32:17 +02:00
914b44069b Convert item display name 2020-08-17 15:22:41 +02:00
4789327378 Encapsulate fields 2020-08-17 15:17:40 +02:00
c55f2945ac Fix sign text 2020-08-17 15:08:21 +02:00
c6a368d6f2 More json fixes 2020-08-17 13:24:15 +02:00
869a579655 Bump annotations from 19.0.0 to 20.0.0
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 19.0.0 to 20.0.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JetBrains/java-annotations/compare/19.0.0...20.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-17 09:08:30 +00:00
7cd1e8ea76 Fix command registration 2020-08-17 04:39:59 +02:00
351ae1b2c7 Synchronize auto queries 2020-08-17 01:27:45 +02:00
457f3e25cc resolve rebase issue 2020-08-17 01:10:46 +02:00
41c670450b Remove PlotFilter 2020-08-17 01:10:46 +02:00
f636db49f7 Remove SetupObject 2020-08-17 01:10:46 +02:00
505bba7612 Fix recursive call 2020-08-17 00:53:39 +02:00
72507aba4b Change player locale on event 2020-08-17 00:29:53 +02:00
9b086b3f2a Insert missing keys into message files 2020-08-17 00:29:53 +02:00
f9d7d2d1dd Fix clickable messages 2020-08-16 19:43:27 +02:00
e9efa3f2d3 Fix some translation issues 2020-08-16 18:24:54 +02:00
665a72a08f Fill out a lot more JavaDoc.
I've left DB stuff alone
2020-08-16 13:22:49 +01:00
61d1dcc231 Ignore Events if they are not caused by real players (i.e. citizens) 2020-08-16 14:09:32 +02:00
6c9b73b100 Apply patch by @SirYwell to construct the ResourceKey without consulting the DimensionManager 2020-08-16 14:02:03 +02:00
a4c9ed90b7 Fix startup issues and make messages send properly 2020-08-16 13:49:16 +02:00
28d6d4db92 Fix shading mess and make the plugin start 2020-08-16 12:44:10 +02:00
12def37194 clean up some javadoc stuff 2020-08-16 11:34:08 +01:00
ed2302e545 Remove illegal import 2020-08-16 12:10:19 +02:00
618adb913d Update license and remove dead module entries 2020-08-15 19:17:29 +02:00
4a220f9bfb Update license header 2020-08-15 14:59:29 +02:00
300abd868a Merge pull request #2888 from IntellectualSites/fix-conversion
Fix problem with config creation
2020-08-14 18:36:57 +02:00
87f0b1fc97 Add service system and rewrite Auto to use the service system 2020-08-14 17:24:34 +02:00
78a6e72fe1 5.13.2 2020-08-14 15:26:32 +02:00
8f1b2a9d2a fix pve against animals on other plots and roads 2020-08-14 14:21:45 +01:00
5b27b652e7 Fix color tag 2020-08-14 12:52:00 +02:00
556ff0baf4 Fix line break 2020-08-14 12:27:38 +02:00
8cc536b20f Fix spelling 2020-08-14 11:57:37 +02:00
5e20c871a5 Fix metrics setting 2020-08-14 11:36:17 +02:00
56fb892818 Fix brackets 2020-08-14 00:37:06 +02:00
7f104c249a Permission cleanup
- Removed plotme perms
- Fixed incorrect permission for "/plot flag remove"
- Fixed incorrect administrative unlink node
- Removed compat alias from "/plot set alias" command

I've documented all removed permission packages and fixed permissions in detail on the v6 page. So it's easy to go-by when updating.
2020-08-13 23:32:13 +02:00
0eeface374 Remove old translations 2020-08-13 21:37:28 +02:00
ffe1e1e40d Core is Core 2020-08-13 21:25:17 +02:00
5efdef19cf Remove dead asset setting 2020-08-13 21:16:30 +02:00
c9fae6a070 Remove old translation setup and move commands to templates 2020-08-13 21:11:07 +02:00
2b17f730d4 Merge v5 into v6 2020-08-12 18:20:37 +02:00
808bddbfbb Apply scaling to image 2020-08-12 10:30:05 +02:00
d6dfa9a0b9 https 2020-08-11 20:12:31 +02:00
924b73f070 Merge pull request #2896 from luca-gg/patch-1
Update de-DE.yml
2020-08-11 19:33:41 +02:00
64181c6ab8 Update de-DE.yml
adjusted grammar
2020-08-11 19:29:40 +02:00
a1b10a2900 Remove dead files 2020-08-11 17:49:04 +02:00
6315b9ea52 gradle 6.6 2020-08-11 17:43:24 +02:00
7c756304b5 1.16.2 support
- Bump EssentialsX version to the latest release
2020-08-11 16:20:33 +02:00
9fd11fbe13 Merge pull request #2893 from JunTVDE/de-translation-edit
added german translation for flag-descriptions to de-DE.yml
2020-08-09 13:21:31 +02:00
7cd9a03b0f Merge pull request #2894 from TimonMi/patch-1
Update link for contributing
2020-08-09 13:20:17 +02:00
f8bd844c6c Update link for contributing 2020-08-09 13:18:35 +02:00
987d9a267c added german translation for flag-descriptions to de-DE.yml 2020-08-09 13:05:40 +02:00
98d1bb9264 Merge remote-tracking branch 'upstream/v5' into v5 2020-08-08 18:39:47 +02:00
b46a19f5ca Keep player names, so they don't have to be looked up again.
That way the lookup function MainUtil#getName won't get called which would throw an exception if called in the Bukkit Thread.
As the player enters the Name, we don't have to look it up again.

Fixes PS-96
2020-08-08 18:07:49 +02:00
6e16ef1246 remove PllayerEvents 2020-08-08 13:21:46 +01:00
7bad242944 Merge branch 'v6' into feature/v6/json. It builds!
# Conflicts:
#	Bukkit/build.gradle
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/generator/DelegatePlotGenerator.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/queue/ChunkCoordinator.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/Area.java
#	Core/src/main/java/com/plotsquared/core/command/Clear.java
#	Core/src/main/java/com/plotsquared/core/command/Debug.java
#	Core/src/main/java/com/plotsquared/core/command/DebugRoadRegen.java
#	Core/src/main/java/com/plotsquared/core/command/Relight.java
#	Core/src/main/java/com/plotsquared/core/command/Set.java
#	Core/src/main/java/com/plotsquared/core/command/Template.java
#	Core/src/main/java/com/plotsquared/core/command/Trim.java
#	Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java
#	Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/GlobalFlagContainer.java
#	Core/src/main/java/com/plotsquared/core/queue/AreaBoundDelegateQueueCoordinator.java
#	Core/src/main/java/com/plotsquared/core/queue/ChunkQueueCoordinator.java
#	Core/src/main/java/com/plotsquared/core/queue/LocalBlockQueue.java
#	Core/src/main/java/com/plotsquared/core/util/ChunkUtil.java
#	Core/src/main/java/com/plotsquared/core/util/EntityUtil.java
#	Core/src/main/java/com/plotsquared/core/util/RegionManager.java
#	Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
#	Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java
#	build.gradle
2020-08-08 13:20:30 +01:00
74a5c48214 Finish up core and bukkit json 2020-08-08 12:16:48 +01:00
11af906c79 Fix a little oopsie 2020-08-07 18:55:22 +02:00
c31c4b4286 More work 2020-08-07 18:52:45 +02:00
7f29b5d1e8 ComponentPreset inventory to json 2020-08-07 13:22:10 +01:00
6012705e95 Implement Permission#format to replace the CaptionUtility#format method 2020-08-07 12:12:16 +01:00
21a97863ac Refactor Captions to Permission, reimplement message list in debug command 2020-08-07 11:53:32 +01:00
50cfecb3fd Several minor progress. Couple of bigger (inboxes and help) 2020-08-07 11:08:03 +01:00
1461804039 Remove last reference to PlotMessage in Core 2020-08-07 10:20:11 +01:00
dc3f45acd4 Added UseFlag check at Roads 2020-08-07 09:57:02 +01:00
6970dfa5f8 More json progress 2020-08-07 02:53:05 +02:00
48d3c2105d Fixes an OfflinePlayerUtil breakage caused by NMS Changes 2020-08-06 15:23:36 +02:00
18f630ba15 Bit more json 2020-08-06 14:06:19 +01:00
f68eb9c778 update plot list 2020-08-06 13:36:15 +01:00
4a960d9f2c update pagination to new json 2020-08-06 12:23:47 +01:00
c745b99922 Added UseFlag check at Roads 2020-08-06 12:01:43 +02:00
f1e3902fea Several more progress 2020-08-05 11:48:10 +01:00
41a623a643 More work towards json 2020-08-04 19:01:25 +02:00
d3fe1d3b2b Fix plot info, sign usage in Plot.class 2020-08-04 15:07:07 +01:00
3fd3baaa47 Making progress on messages 2020-08-03 23:59:16 +02:00
01d2b0024f Add more information to the debugpaste 2020-07-31 20:33:17 +02:00
01e66f8833 Readd skyblock template 2020-07-29 14:53:09 +02:00
afd9b56e71 Merge branch 'v5' of github.com:IntellectualSites/PlotSquared into v5 2020-07-28 13:58:37 +01:00
e2f9b4245b Fixes https://issues.intellectualsites.com/issue/PS-81
- Add break statements to switches to prevent bleed from normal spawning to breeding
 - Separate misc spawning from mob spawning
2020-07-28 13:56:37 +01:00
22a007b514 Revert "Update zh-CN.yml"
This reverts commit 240362a16d.
2020-07-28 12:33:04 +02:00
38988b4819 A little spring cleaning
- Add Javadoc comments for where QueueCoordinator can be given or nulled
 - Add some more Javadoc comments in general
 - Squash methods into one where QueueCoordinator can be given
 - Only use one queue in some places where it makes sense
2020-07-28 10:18:49 +01:00
704e92c3d0 Use placeholder 2020-07-28 09:38:27 +01:00
97b1a60ae8 Move comments to ChunkCoordinator, remove Range annotations 2020-07-28 08:44:16 +01:00
3288721259 Better constructor error handling in QueueProvider.
Add back default constructor requiring world to QueueCoordinator to indicate extents require this constructor
2020-07-28 08:34:14 +01:00
ab121c7eee Fixes https://github.com/IntellectualSites/PlotSquaredSuggestions/issues/133 2020-07-26 21:12:32 +02:00
240362a16d Update zh-CN.yml 2020-07-26 17:08:58 +02:00
f2dcbce490 Fix problem where servers created in v5 (not converted from v4) would fail to start properly.
This is a quite major issue and I hope this fix resolves it. Although, it should be tested with migration from v4 to v5 and then a fresh v5 server.
2020-07-25 03:16:36 +02:00
88df434404 Create CODE_OF_CONDUCT.md 2020-07-25 03:11:07 +02:00
b3ddabda29 Fix DelegateQueueCoordinator 2020-07-24 18:20:26 +01:00
b8b3e1e72a Merge branch 'v6' into feature/v6/pipeline-queue
# Conflicts:
#	Bukkit/build.gradle
#	Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java
2020-07-24 18:18:42 +01:00
615a5212bf update bukkit pom 2020-07-24 17:57:16 +01:00
221d299052 Fix a few remaining merge issues (+1 squashed commits)
Squashed commits:

[8c6b55dd4] Fix a few remaining merge issues
2020-07-24 17:57:16 +01:00
3180d2ddf2 Merge branch 'v5' into v6
# Conflicts:
#	Bukkit/build.gradle
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/placeholder/Placeholders.java
#	Core/src/main/java/com/plotsquared/core/PlotPlatform.java
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/generator/ClassicPlotManager.java
#	Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java
#	Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java
#	build.gradle
2020-07-24 17:15:58 +01:00
7aaa075ba8 Javadoc, some cleanup 2020-07-24 17:00:08 +01:00
4fb590889a Remove all permission related errors 2020-07-24 17:44:47 +02:00
115ca903b2 Remove unused stuff 2020-07-24 17:36:48 +02:00
e90170a384 Merge remote-tracking branch 'origin/v6' into feature/v6/json
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitOfflinePlayer.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitLocalQueue.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitEconHandler.java
#	Core/pom.xml
#	Core/src/main/java/com/plotsquared/core/PlotAPI.java
#	Core/src/main/java/com/plotsquared/core/PlotPlatform.java
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/Area.java
#	Core/src/main/java/com/plotsquared/core/command/Auto.java
#	Core/src/main/java/com/plotsquared/core/command/Claim.java
#	Core/src/main/java/com/plotsquared/core/command/CmdConfirm.java
#	Core/src/main/java/com/plotsquared/core/command/Command.java
#	Core/src/main/java/com/plotsquared/core/command/CommandCaller.java
#	Core/src/main/java/com/plotsquared/core/command/DebugExec.java
#	Core/src/main/java/com/plotsquared/core/command/Grant.java
#	Core/src/main/java/com/plotsquared/core/command/Inbox.java
#	Core/src/main/java/com/plotsquared/core/command/Load.java
#	Core/src/main/java/com/plotsquared/core/command/Save.java
#	Core/src/main/java/com/plotsquared/core/command/Setup.java
#	Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
#	Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java
#	Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java
#	Core/src/main/java/com/plotsquared/core/util/BlockUtil.java
#	Core/src/main/java/com/plotsquared/core/util/Permissions.java
2020-07-24 17:28:52 +02:00
1d0760c630 Formatting, mark nonnull, nullable etc 2020-07-24 16:24:53 +01:00
af44fe74ff Add namespaces for translations 2020-07-24 17:19:25 +02:00
72c0021306 A couple of reworks
- Redo how regeneration works a little to also take a cuboid region for regeneration off-chunk plots
 - Fix a couple of cases where we were writing to the queue instead of the world in the ChunkConsumer (dum)
 - this seems to be working.
2020-07-24 15:17:42 +01:00
18918eb3a3 Fix a couple more Guice issues. Refactor read chunks to be a list of chunks rather than CuboidRegion 2020-07-24 14:36:50 +01:00
416e181992 Merge branch 'v6' into feature/v6/pipeline-queue 2020-07-24 13:10:11 +01:00
d7a49e3316 This is not my fault 2020-07-24 14:08:40 +02:00
cf13f13fbf Merge branch 'v6' into feature/v6/pipeline-queue 2020-07-24 13:03:42 +01:00
f53a8d3b06 Fix permissionprofile initialisation order 2020-07-24 14:02:49 +02:00
8c5c1922c9 Merge branch 'v6' into feature/v6/pipeline-queue 2020-07-24 12:34:41 +01:00
707559e023 Merge remote-tracking branch 'origin/v6' into v6 2020-07-24 13:33:00 +02:00
97a2ccbfe0 make sure the PlayerMetaDataKeys keys are loaded 2020-07-24 13:32:46 +02:00
95f2a7a908 fix version 2020-07-24 12:22:13 +01:00
e53c53bb4a Merge branch 'v6' into feature/v6/pipeline-queue
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Core/src/main/java/com/plotsquared/core/queue/BasicLocalBlockQueue.java
2020-07-24 12:21:40 +01:00
d906a85095 Fix some issues I caused with Guice 2020-07-24 12:18:36 +01:00
dc1f669a1f Remove permission caching 2020-07-24 13:01:38 +02:00
0ea862b572 Merge pull request #2886 from IntellectualSites/features/v6/permissions
Permission system fixup
2020-07-24 12:49:37 +02:00
fe7a57b2b7 Remove mainutil cache workaround 2020-07-24 12:48:45 +02:00
c9c62a1083 Remove dumb permission mess. 2020-07-24 12:44:04 +02:00
5608c5a901 Merge branch 'v6' into features/v6/permissions
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java
#	Core/src/main/java/com/plotsquared/core/command/Auto.java
#	Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java
#	Core/src/main/java/com/plotsquared/core/util/Permissions.java
2020-07-24 12:20:45 +02:00
722361aedb Implement suggestions from PR comments 2020-07-24 12:15:25 +02:00
d2f40612f4 Switch from Class<T> to TypeLiteral, and implement managed meta access for temporary meta 2020-07-24 12:15:25 +02:00
6a63e5bb51 Expose the player's lock repository 2020-07-24 12:15:25 +02:00
ad40ab7e1e Grant plots to the correct player 2020-07-24 12:15:25 +02:00
05ce67fbfe Trick the compiler 2020-07-24 12:15:25 +02:00
555860cf83 Add managed persistent meta data access 2020-07-24 12:15:25 +02:00
2575787bd0 Add LockRepository 2020-07-24 12:15:25 +02:00
2cfb646065 Javadoc no fun 2020-07-23 18:11:52 +01:00
a1da452c41 Fix build properly 2020-07-23 18:09:37 +01:00
420e38bead idek? 2020-07-23 18:07:23 +01:00
41c4018a27 Merge branch 'v6' into feature/v6/pipeline-queue 2020-07-23 18:06:45 +01:00
4d4f755607 6.0.0-SUPER-SNAPSHOT 2020-07-23 18:06:14 +01:00
d8e5daf12b Fix missing Main->Chunk Util change 2020-07-23 18:04:01 +01:00
c3322021d0 mavenLocal, poms 2020-07-23 18:02:29 +01:00
45cc88091e Merge branch 'v6' into feature/v6/pipeline-queue
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
2020-07-23 17:33:05 +01:00
27498f68fb Many Much
- Add readregions to queues for when we're setting our own consumer (usually meaning the queue writes its own blocks, so it doesn't know which chunks to actually load)
 - Finish removing chunk/regionTasks
 - Allow the queue to not remove tickets from chunks (useful for swapping chunks so they don't unload needlessly)
 - Remove a lot of unused methods
 - Implement entities to queues
 - Remove chunk unloading (the server should really handle it)
2020-07-23 17:30:23 +01:00
d8e80daa93 Fix annoying guice injection issue 2020-07-23 15:40:43 +02:00
384a6730a4 Merge remote-tracking branch 'origin/features/v6/permissions' into features/v6/permissions
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
2020-07-23 15:06:00 +02:00
a7de76d150 Fix dependencies 2020-07-23 15:03:57 +02:00
2154e237ff Remove construction of fake player entities for offline players. 2020-07-23 15:03:57 +02:00
5fda3e9765 Get rid of PermHandler 2020-07-23 15:03:57 +02:00
b302bb9379 Make VaultPermissionHandler extent BukkitPermissionHandler 2020-07-23 15:03:57 +02:00
bfbb81030f Start working on the new permission system 2020-07-23 15:03:57 +02:00
63ce3292aa Fix PlayerManager injection 2020-07-23 15:03:27 +02:00
b9a8846ee9 Fix WorldManager injection 2020-07-23 14:56:53 +02:00
6ae1d28f80 Fix WorldManager injection 2020-07-23 14:56:06 +02:00
17d358f8fe Fix plot ID issues 2020-07-23 14:14:15 +02:00
cfd71457d2 Clean up BlockUtil 2020-07-23 14:14:15 +02:00
87285e08dc Fix plot ID issues 2020-07-23 14:11:34 +02:00
b3a63123fd Fix dependencies 2020-07-23 14:03:56 +02:00
7fc8238fb0 Remove construction of fake player entities for offline players. 2020-07-23 12:47:00 +02:00
32a0765484 Force more compilation errors 2020-07-22 21:09:38 +02:00
c5e1b87c61 Fix small issues 2020-07-22 21:06:23 +02:00
603d1ee9bb Even more
Ok seriously, I stop here
2020-07-22 20:38:46 +02:00
86a0816b26 Merge remote-tracking branch 'origin/feature/v6/json' into feature/v6/json 2020-07-22 19:55:03 +02:00
287cb0f5ad Fix minor issues 2020-07-22 19:54:35 +02:00
3009db3aa7 Update FlagCommand.java 2020-07-22 19:47:58 +02:00
32e095ce15 More progress
I need a break, if something is missing, feel free to exchange that. K thx 🙏
2020-07-22 19:42:22 +02:00
9d6744ec15 Get rid of PermHandler 2020-07-22 12:35:48 +02:00
532f2caa37 Make VaultPermissionHandler extent BukkitPermissionHandler 2020-07-22 12:06:56 +02:00
da2fa24e74 Merge remote-tracking branch 'origin/v6' into v6 2020-07-22 12:05:50 +02:00
8d04728ebc More work 2020-07-22 00:08:51 +02:00
2aa5c276c9 Some more work done towards json 2020-07-21 21:39:52 +02:00
6dba31b257 Start working on the new permission system 2020-07-21 14:28:54 +02:00
6040e1bb5e remove mainutil 2020-07-21 13:14:55 +02:00
20e9d13f60 Merge branch 'v6' into feature/v6/json
# Conflicts:
#	Core/src/main/java/com/plotsquared/core/util/MainUtil.java
#	Core/src/main/java/com/plotsquared/core/util/OperationUtil.java
2020-07-21 13:13:10 +02:00
73e3572c72 Fix the redstone flag on roads 2020-07-21 13:11:28 +02:00
5f76cc4f7b Give ConsolePlayer the same treatment 2020-07-21 13:07:33 +02:00
186a810bf6 Bring back PAPI placeholders and raw colour formatting 2020-07-21 13:05:40 +02:00
207e56969b Remove ChunkManager#chunkTask 2020-07-19 16:03:40 +01:00
94b6a27cf3 add missing license headers 2020-07-19 16:02:30 +01:00
21693e344c Switch from MainUtil 2020-07-19 14:37:42 +01:00
d2443f6de8 Merge branch 'v6' into feature/v6/pipeline-queue
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/queue/GenChunk.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
#	Core/src/main/java/com/plotsquared/core/plot/world/SinglePlotManager.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
2020-07-19 14:29:08 +01:00
ed27422e69 Move IJ/xyz cache out of MainUItil to its own class 2020-07-19 14:21:52 +01:00
d24c89405a Switch to using a Clipboard for regen in preparation for WE changes 2020-07-19 14:17:38 +01:00
2d518dfe2b Clean up BlockUtil 2020-07-19 14:49:26 +02:00
f357fa74f3 Remove unused files 2020-07-19 14:37:53 +02:00
335cf5d2e9 Fix issues 2020-07-19 14:34:42 +02:00
ed3eedd238 Merge branch 'v6' into feature/v6/json
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/Add.java
#	Core/src/main/java/com/plotsquared/core/command/Auto.java
#	Core/src/main/java/com/plotsquared/core/command/Buy.java
#	Core/src/main/java/com/plotsquared/core/command/Template.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridPlotManager.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java
#	Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
#	Core/src/main/java/com/plotsquared/core/location/Location.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotCluster.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotId.java
#	Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/implementations/KeepFlag.java
#	Core/src/main/java/com/plotsquared/core/util/MainUtil.java
#	Core/src/main/java/com/plotsquared/core/util/PlayerManager.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
#	Core/src/main/java/com/plotsquared/core/util/query/PlotQuery.java
#	Core/src/main/java/com/plotsquared/core/util/query/SearchPlotProvider.java
2020-07-19 14:32:31 +02:00
23783b8b0b add deprecations 2020-07-19 14:24:42 +02:00
193054f1fc Move shit out of MainUtil into more appropriate classes 2020-07-19 14:23:55 +02:00
87a8ff742f 5.13.1 2020-07-19 14:16:13 +02:00
656700b5be Start reimplementing chunk generation.
This would either need to be one WorldEdit operation or (preferable) WorldEdit allows Extents (including EditSessions) into the regenerate adapter method
2020-07-19 13:12:27 +01:00
3e84f3b3a4 Merge branch 'v6' into feature/v6/pipeline-queue
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
2020-07-18 15:27:52 +01:00
5360df6012 Add PlotRangeIterator for the many places where it'll be used. All one of them, in fact. This was not a waste of time. I am very happy I did this. This was worthwhile. Yup. 2020-07-18 16:19:12 +02:00
39fdaa367c Make PlotQuery iterable 2020-07-18 16:18:23 +02:00
7e0cdb12d7 Replace some common messages 2020-07-18 15:06:51 +02:00
03983e8886 Allow forcing of queues down pipelines to ensure whenDone runnables are called correctly
Also remove autoQueue since it's never used and would be a bad idea
2020-07-18 13:55:54 +01:00
57af50ed49 Continue implementation of new queue system
- Move ChunkCoordinatorBuild to Core
- Add core ChunkCoordinator
- Add Factories for ChunkCoordinator and its Builder
- Reimplement refreshChunk but in WorldUtil
- Allow custom Consumers to be used by the Queue when sent to the ChunkCoordinator
- Start switching ChunkTasks to use the new ChunkCoordinator system
- Replace GlobalBlockQueue's "empty task" system with normal sync TaskManager
- Remove lombok from the queue system
- Add back forceSync and chunkObject from LocalBlockQueue
2020-07-18 12:07:56 +01:00
e80ade65c7 Clean up PlotId 2020-07-18 11:05:16 +02:00
4d24112ec7 Fix merge issues 2020-07-17 23:06:40 +02:00
1a269a1227 Merge branch 'v6' into feature/v6/json
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
2020-07-17 23:05:45 +02:00
d077fafd29 Some random bukkitutil/worldutil improvements 2020-07-17 23:00:09 +02:00
5478e70576 Fix some more captions 2020-07-17 21:46:15 +02:00
66b94ab9f1 Start switching to WorldEdit Worlds 2020-07-17 17:21:32 +01:00
74c6fc954e Merge branch 'v6' into feature/v6/pipeline-queue
# Conflicts:
#	Core/src/main/java/com/plotsquared/core/command/Trim.java
#	Core/src/main/java/com/plotsquared/core/queue/BasicLocalBlockQueue.java
#	Core/src/main/java/com/plotsquared/core/queue/GlobalBlockQueue.java
2020-07-17 17:16:49 +01:00
22bd2eb238 Super minor issues from previous merges 2020-07-17 18:06:38 +02:00
2a72f274c9 Fix failed merge 2020-07-17 18:00:08 +02:00
3a1b56494a Merge branch 'v6' into feature/v6/json
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Core/src/main/java/com/plotsquared/core/command/Claim.java
#	Core/src/main/java/com/plotsquared/core/command/Condense.java
#	Core/src/main/java/com/plotsquared/core/plot/comment/CommentManager.java
#	Core/src/main/java/com/plotsquared/core/util/task/AutoClaimFinishTask.java
#	Core/src/main/java/com/plotsquared/core/util/task/ObjectTaskRunnable.java
#	Core/src/main/java/com/plotsquared/core/util/task/TaskManager.java
2020-07-17 17:58:14 +02:00
932052772c Fix edge cases for time conversion 2020-07-17 17:53:30 +02:00
43d058d3db Address comments 2020-07-17 17:53:30 +02:00
020b030667 More fixes 2020-07-17 17:53:30 +02:00
5a3eacde0b Replace method synchronization logic 2020-07-17 17:53:30 +02:00
7f412f5472 Begin work on the task system 2020-07-17 17:53:30 +02:00
33b6ef66d6 Delombok + import organisation 2020-07-17 17:24:45 +02:00
9fefe57c90 Switch to using QueueCoordinators everywhere 2020-07-17 15:41:06 +01:00
ed77522c08 Add wna block setting, use WorldEdit worlds rather than Strings. 2020-07-17 14:38:50 +01:00
09aca839a8 Add back changes to ChunkCoordinator 2020-07-17 14:00:01 +01:00
def9a1bcf8 begin new block setting/chunk pipeline
This will ultimately replace both the GlobalBlockQueue and the ChunkTask stuff
2020-07-17 13:22:33 +01:00
57435fdf34 verbosely ensure items cannot be duplicated when keeping inventory on death
Seemingly there's duplication issues on some servers (and apparently even when only PlotSquared is installed). Likely a Spigot issue, but there's nothing to be done for Spigot on 1.13/14/15
2020-07-16 23:24:11 +01:00
01ff9a34c2 Merge branch 'features/v5/placeholders' into v5 2020-07-16 18:48:45 +02:00
ff3a94933a Bump version 2020-07-16 18:43:52 +02:00
97a356c4a0 Very attentive reviewers, can recommend 2020-07-16 18:13:02 +02:00
10ab28c1ec Add missing license headers 2020-07-16 18:08:00 +02:00
2d9cf8b759 Get placeholders working 2020-07-16 18:04:17 +02:00
32b28a4ca5 Turn all UUID messages into debug messages 2020-07-15 22:42:58 +02:00
4996d8bcd1 Remove left over debugs 2020-07-15 14:05:15 +02:00
e5963a8590 Merge pull request #2877 from IntellectualSites/features/v5/split-bukkit-listeners
Clean up bukkit listeners by splitting them up
2020-07-15 13:35:38 +02:00
e8c155763b Register placeholders 2020-07-15 12:44:07 +02:00
a52249513e Update MVdW version 2020-07-15 12:05:42 +02:00
5d2d4ac12b fix language issue 2020-07-14 20:47:15 +02:00
64f5580edd Fix code styling issue 2020-07-14 20:46:52 +02:00
b989531a60 Merge branch 'v5' into features/v5/placeholders 2020-07-14 20:41:17 +02:00
34655b8d41 Add (untested) MVdWPlaceholderAPI support 2020-07-14 20:41:08 +02:00
30327d2fa3 update bukkit pom 2020-07-14 19:11:46 +01:00
2e4c43c251 Add config option to disable placing top wall blocks 2020-07-14 19:10:53 +01:00
c0a0d36e5d Remove remaining jetbrains imports 2020-07-14 19:40:47 +02:00
b68d7150f1 Manually fix some merge conflicts 2020-07-14 19:34:44 +02:00
198bcfdf4d Merge branch 'v6' into feature/v6/json
# Conflicts:
#	Bukkit/build.gradle
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Core/build.gradle
#	Core/src/main/java/com/plotsquared/core/PlotPlatform.java
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/Add.java
#	Core/src/main/java/com/plotsquared/core/command/Area.java
#	Core/src/main/java/com/plotsquared/core/command/Auto.java
#	Core/src/main/java/com/plotsquared/core/command/Command.java
#	Core/src/main/java/com/plotsquared/core/command/ListCmd.java
#	Core/src/main/java/com/plotsquared/core/configuration/Caption.java
#	Core/src/main/java/com/plotsquared/core/listener/PlotListener.java
#	Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java
#	Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
#	Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java
#	Core/src/main/java/com/plotsquared/core/setup/CommonSetupSteps.java
#	Core/src/main/java/com/plotsquared/core/util/MainUtil.java
#	Core/src/main/java/com/plotsquared/core/util/WorldUtil.java
2020-07-14 19:25:14 +02:00
8eb903ad72 Merge branch 'v5' into v6
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
2020-07-14 19:18:08 +02:00
c853147635 Merge pull request #2870 from IntellectualSites/feature/v6/platform 2020-07-14 19:13:00 +02:00
0294397021 Manually resolve a bunch of merge issues 2020-07-14 19:10:52 +02:00
97fed21811 Merge branch 'v6' into feature/v6/platform
# Conflicts:
#	Bukkit/build.gradle
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java
#	Core/build.gradle
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/Claim.java
#	Core/src/main/java/com/plotsquared/core/command/Debug.java
#	Core/src/main/java/com/plotsquared/core/command/DebugExec.java
#	Core/src/main/java/com/plotsquared/core/command/Purge.java
#	Core/src/main/java/com/plotsquared/core/command/Trim.java
#	Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java
#	Core/src/main/java/com/plotsquared/core/database/SQLManager.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java
#	Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java
#	Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java
#	Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java
#	Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
#	Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java
#	Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java
#	Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
#	Core/src/main/java/com/plotsquared/core/util/MainUtil.java
#	Core/src/main/java/com/plotsquared/core/util/RegionManager.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
#	Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java
2020-07-14 19:05:05 +02:00
510ea56431 Finalize DI stuff 2020-07-14 18:49:40 +02:00
7897d78f0d Merge pull request #2868 from IntellectualSites/feature/v6/slf4j 2020-07-14 18:49:34 +02:00
25a58a5c46 Merge branch 'v6' into feature/v6/platform 2020-07-14 17:45:33 +02:00
f9e5fd714d Merge remote-tracking branch 'origin/feature/v6/platform' into feature/v6/platform 2020-07-14 17:07:03 +02:00
55eefd09da Merge branch 'v6' into feature/v6/json 2020-07-14 16:52:40 +02:00
0ce1f3e0f6 Send special message when caption cannot be found 2020-07-14 16:36:13 +02:00
99be181aea Migrate some more captions 2020-07-14 16:31:58 +02:00
fbf6a3517d Add back title method that somehow went missing and add a template utility class to make templates less annoying to work with 2020-07-14 15:04:31 +02:00
1dc4da8beb Fix issues from previous merge 2020-07-14 13:21:59 +02:00
1908588fcb Change expansion author and version 2020-07-14 13:17:21 +02:00
af7db08036 Add new placeholder system 2020-07-14 13:14:02 +02:00
e72ce9c90e Update gradle.yml 2020-07-14 12:44:11 +02:00
32264ae5e3 Update gradle.yml 2020-07-14 12:43:45 +02:00
33f2ff7e6d Merge branch 'v6' into feature/v6/slf4j 2020-07-13 23:11:40 +02:00
6664d49928 Prefix all log messages 2020-07-13 23:04:27 +02:00
d648a6d3db Merge remote-tracking branch 'origin/feature/v6/slf4j' into feature/v6/slf4j
# Conflicts:
#	Bukkit/pom.xml
#	Core/pom.xml
2020-07-13 22:52:10 +02:00
a1f262b5b2 Fix gradle setup and replace all debug calls 2020-07-13 22:51:57 +02:00
b109b76120 Nevermind, it doesn't allow for relocations 2020-07-13 20:50:49 +02:00
1388f280e6 Update module poms 2020-07-13 20:46:34 +02:00
d141b040d6 Fix relocations 2020-07-13 20:45:04 +02:00
e84d82315c Add log4j config (this might work :p) 2020-07-13 20:39:52 +02:00
c6962ef4d2 Shift a few more messages to debug 2020-07-13 19:56:34 +02:00
f93714a44e Properly add prefixes to messages 2020-07-13 13:01:13 +02:00
564efd77f7 Fix some messages 2020-07-12 22:11:23 +02:00
5442c7cc2e Start moving commands to new message system 2020-07-12 22:06:07 +02:00
0fa5a16cd0 replace remaining debug calls 2020-07-12 21:49:05 +02:00
1881cdc9ab Revert "Add prefix"
This reverts commit fb2aa44f78.
2020-07-12 21:28:38 +02:00
fb2aa44f78 Add prefix 2020-07-12 21:25:22 +02:00
e88da3cea9 Add chunk coordinator 2020-07-12 20:58:48 +02:00
14b6f84816 fix typos that were c/p over 2020-07-12 18:50:04 +01:00
ac8841447c 6cf2c0ad97 (r40542418) 2020-07-12 17:11:25 +02:00
6cf2c0ad97 Disable the paper uuid service for offline mode servers and add toggles for all third party uuid services 2020-07-12 17:04:30 +02:00
c045ef698c Add license headers and fix method change in PlotSquared.java 2020-07-12 11:42:45 +01:00
5cdb3f4fd5 Add missing injection points 2020-07-12 12:25:44 +02:00
5a5c5721cc fix compiler crashing 2020-07-12 07:38:57 +02:00
3a11ffc77a Clean up bukkit listeners by splitting them up 2020-07-11 19:03:55 +01:00
916675fb08 Guice progress 2020-07-11 17:19:19 +02:00
a2ec404014 Fix /plot target nearest 2020-07-11 13:40:22 +01:00
6f6cb4b630 More DI progress 2020-07-11 05:29:41 +02:00
c0f69f321d Guice progress 2020-07-10 22:12:37 +02:00
55bf41d2da Remove dumdum static access 2020-07-10 19:25:05 +02:00
7687d7705b Fix merge issue 2020-07-10 18:38:14 +02:00
21ad9a36c8 Merge branch 'v6' into feature/v6/platform
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java
#	Core/src/main/java/com/plotsquared/core/location/Location.java
2020-07-10 18:37:18 +02:00
afb72aa102 Don't include eggs with spawn*_eggs* 2020-07-10 17:31:46 +01:00
d00dc658df Inject EventDispatcher and PlotListener 2020-07-10 18:17:44 +02:00
2dab7c8dda Inject PlotAreaManager 2020-07-10 17:32:07 +02:00
c37cc40ad9 Move annotation in BukkitWorld 2020-07-10 12:27:26 +02:00
5341015cb1 Finalize immutable locations and add a platform world implementation 2020-07-10 12:21:29 +02:00
2fb76e6636 Split road and plot paste-on-top settings 2020-07-09 22:39:06 +01:00
5b260ea8da update bukkit pom 2020-07-09 22:33:01 +01:00
55139eb134 Do not respect paste on top for road schematics. 2020-07-09 22:19:23 +01:00
5e44bb60c6 Merge branch 'v5' of github.com:IntellectualSites/PlotSquared into v5 2020-07-09 22:14:38 +01:00
96740fd282 Couple of fixes to road flag logic 2020-07-09 21:52:51 +01:00
cf1b027db9 Start making locations immutable 2020-07-09 22:28:46 +02:00
fb050ac3da 5.12.5 2020-07-09 21:15:28 +02:00
b36c6427d1 Split failed UUID batches into individual requests in order to identify the invalid UUIDs 2020-07-09 20:37:14 +02:00
63c308971b Update location block vector on add and subtract 2020-07-09 20:14:06 +02:00
cfd389883b Improve piston interaction with area border 2020-07-09 20:14:06 +02:00
4576cfd961 Improve piston interaction with plot border
Fixes retracting pistons being able to modify plot borders. Prevents
piston heads from sticking outside plots.
2020-07-09 20:14:06 +02:00
89cb6450fb Fix issue where PlotPlayer#getLocation returns a mutable location 2020-07-09 20:04:00 +02:00
699eb71e2a Fix kill-road-mobs. Fixes PS-73 2020-07-09 19:46:17 +02:00
6b07f38cff Send teleportation cancellation message immediately on movement, rather than after the timer has finished. This fixes PS-33. 2020-07-09 16:45:25 +02:00
904f5485ab Merge remote-tracking branch 'origin/v5' into v5 2020-07-09 16:38:53 +02:00
e05d817482 Fix plot owner placeholder. Fixes PS-62. 2020-07-09 16:38:46 +02:00
db37077af7 Make signs able to use captions 2020-07-09 12:58:28 +02:00
61de18190f More dispense blocking on roads 2020-07-09 12:33:23 +02:00
1310f9470e 5.12.4 2020-07-08 19:34:08 +01:00
d652225f36 Let players teleport to their merged plots 2020-07-08 19:33:58 +02:00
2936b806f3 Allow players to interact on their own plot 2020-07-08 17:10:09 +01:00
3fa532a3c0 Move message sending into PlotPlayer to make it platform independent 2020-07-08 15:35:58 +02:00
d267d1bb98 Start expiry tasks 2020-07-08 14:35:46 +01:00
9792d4cc4b Remove style.yml 2020-07-08 15:23:33 +02:00
090bd69be5 Merge branch 'v6' into feature/v6/json
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java
2020-07-08 15:22:02 +02:00
c36e311520 Continue cleaning up PlotSquared.java 2020-07-08 15:09:25 +02:00
f2191cb731 Save style.yml again 2020-07-08 13:59:31 +02:00
265c10ec1c Remove commands.yml 2020-07-08 13:59:31 +02:00
51bd21a464 Merge branch 'v6' into feature/v6/platform
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
2020-07-08 13:57:33 +02:00
5004005c5a Fixes PS-65
EssentialsX uses paperlib 1.0.4 where we compile explicitly against 1.0.2
2020-07-08 12:21:31 +02:00
67a49a2ca7 5.12.3 2020-07-07 21:03:30 +02:00
57127537f7 Add permission check for /plot home 2020-07-07 20:45:52 +02:00
3476522c00 Allow /p v <alias> 2020-07-07 20:45:52 +02:00
3d087b1bbe Fix tab completion and usage 2020-07-07 20:45:52 +02:00
c058614fcc Split visit command into home and visit 2020-07-07 20:45:52 +02:00
9e9db0f1df Merge branch 'features/v5/road-respect-flags' into v5 2020-07-07 17:49:32 +01:00
e826836c36 Merge branch 'v5' into features/v5/road-respect-flags 2020-07-07 17:48:46 +01:00
196df855ac Clean up PlotAreaManager and move a bunch of plot area related logic out of PlotSquared 2020-07-07 13:37:03 +02:00
d76c9dad52 Remove access to PlotSquared#IMP and rename IPlotMain to PlotPlatform, then rename PlotSquared#imp() to PlotSquared#platform() 2020-07-07 12:56:43 +02:00
298e65a394 Replace remaining references to PlotSquared#log 2020-07-06 17:17:46 +02:00
078b776f60 Implement console messages 2020-07-05 18:14:29 +02:00
4d61a345c6 Small documentation fixes 2020-07-05 18:06:10 +02:00
dc0358957e Add prefix replacement to messages and skip sending empty messages 2020-07-05 18:02:43 +02:00
42d648e338 Use adventure for titles 2020-07-05 17:57:58 +02:00
1c254984c1 Replace logging references in Bukkitmain 2020-07-05 13:56:54 +02:00
f287cc34e7 Remove json message stuff 2020-07-05 13:46:25 +02:00
c8a8806e7d Component progress. The plugin is **very** broken right now. 2020-07-05 13:41:40 +02:00
d061f728bd Merge remote-tracking branch 'origin/feature/v5/json' into feature/v5/json 2020-07-05 12:44:25 +02:00
b5818bfefc Lazy fix for FancyMessage 1.16 2020-07-04 20:25:49 +02:00
6bf5bc60d1 Update messages_en.json with new placeholders 2020-07-04 18:57:56 +02:00
c784c69eb3 progress 2020-07-04 18:53:03 +02:00
e3759d059a Fixing missing license headers. 2020-07-04 18:03:47 +02:00
429f5e55c3 Add option to disable background caching 2020-07-03 13:50:12 +02:00
0e7a6d7a62 Fix typo 2020-07-03 13:47:50 +02:00
ad1ec42b12 Add new clear pipeline to hpw and make some stuff read access as required. 2020-07-02 14:33:22 +01:00
580212d66d fix build 2020-07-01 21:49:53 +01:00
b71de856a8 allow plugins extending and replacing RegionManager to be notified of, and "accept" plot clear "requests".
.
.
.
.
.
FAWE
2020-07-01 21:49:53 +01:00
35cff29917 Add license header 2020-07-01 17:24:47 +02:00
2910176b97 Add road flag container 2020-07-01 14:53:57 +01:00
c5ec8e1931 actually fix all conflicts 2020-07-01 14:21:18 +01:00
82a887fd3b Merge branch 'v5' into features/v5/road-respect-flags
# Conflicts:
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEvents.java
2020-07-01 14:12:16 +01:00
eff410d1da Merge pull request #2862 from IntellectualSites/bukkit/1.16.1
Update to 1.16.1
2020-07-01 12:02:57 +02:00
cbe8875b94 Bump gradle version 2020-07-01 11:59:28 +02:00
49c35ec084 Resolve NMF's concerns 2020-06-29 22:05:32 -04:00
f80cadcd7f Draft of Caption resolving 2020-06-29 21:33:57 +02:00
fa2ad8ab22 Improve plot alias command (tab complete, admin permission) fixes PS-63 2020-06-29 13:48:37 +02:00
600f757046 Finish messages 2020-06-29 12:34:09 +02:00
3a2e932d17 Add missing mobs from 1.13.2+ 2020-06-28 18:45:40 -04:00
a2aaa3633a More work 2020-06-28 16:56:42 +02:00
bd9bdc9e03 Separate the Vault Permission Handling from the Economy Handling 2020-06-28 14:28:11 +02:00
3b793929d8 Initialize messages_en.json 2020-06-28 13:51:57 +02:00
e139550949 Make cache expiration configurable 2020-06-27 23:07:20 +02:00
181c5b134f Update old links 2020-06-27 21:48:15 +02:00
74876f9e64 Get biome data from correct schematic for intersections (Fixes PS-50) 2020-06-27 20:44:46 +01:00
02f3c3ef50 Fix my stupid mistake of using lamdas not creating nested classes when creating schematics. "this" doesn't work like that. Cheers Java. 2020-06-27 20:38:55 +01:00
9c3d2cfb02 Move the caching and static accessors from EconHandler to PlotMain 2020-06-27 06:26:00 +02:00
9d609c2dfe Merge remote-tracking branch 'remotes/origin/v5' into bukkit/1.16.1 2020-06-26 20:40:50 -04:00
cb04c183a8 Update to 1.16.1 2020-06-26 20:38:30 -04:00
38425a1eae Update world border on Plot#claim (Fixes PS-13) 2020-06-26 13:49:17 +02:00
4b997d42df Some slf4j progress 2020-06-26 11:03:42 +02:00
d1ecf9232e Merge pull request #2859 from FreebuildFR/feature/flag_placeholder
Add placeholders to get the value of a plot flag
2020-06-26 02:22:59 +02:00
e833403e3c Replace split with substring for placeholders 2020-06-25 14:08:44 +02:00
f64026af1a Only initialise EconHandler when economy is enabled and stop accessing the static instance directly. 2020-06-24 15:26:06 +02:00
efab6e92f7 Lower tab completion cache time and fix "Invalid player" message for /plot kick 2020-06-24 13:44:06 +02:00
f69cc5cc98 Merge remote-tracking branch 'origin/v5' into v5 2020-06-24 08:32:14 +02:00
f6f26c6102 Fix issue where numbers were sometimes parsed as usernames when they shouldn't be. This commit also fixes an issue where "Not a valid plot ID" was sent twice. 2020-06-24 08:31:23 +02:00
159b35c717 Fix OfflinePlayerUUIDService breaking when no worlds have been loaded. 2020-06-24 08:05:06 +02:00
7fbac4f286 Add a second placeholder to support only local flag of current plot 2020-06-24 00:51:27 +02:00
29080de860 5.12.2 2020-06-23 23:57:27 +02:00
e17222dd19 Merge remote-tracking branch 'origin/v5' into v5 2020-06-23 18:37:00 +02:00
55cf34508a Fix issue where old player objects were not cleaned up properly.
This is caused by an issue with the event order in Spigot (and Spigot derivatives), so the fix is rather hacky.
2020-06-23 18:36:53 +02:00
c52603921d Bump version 2020-06-23 13:13:01 +02:00
f4724a3c87 Fix expiration flag commands 2020-06-23 11:45:04 +02:00
2b4e2fc793 Add plot debugging and make tab completable aliases configurable 2020-06-23 11:39:45 +02:00
14baead342 Add placeholder to get the value of a plot flag 2020-06-23 01:20:17 +02:00
2d6e6ceaeb Improve documentation of BukkitMain#wrapPlayer and improve generic types 2020-06-22 15:45:57 +02:00
1dcf8d3995 Progress on the debug logging API 2020-06-21 15:50:49 +02:00
d07d32e28b Generate plot blocks on correct height when removing intersection
Fixes PS-46
2020-06-20 00:14:04 +02:00
cb969e37a6 Don't teleport players; Fixes PS-14 2020-06-19 11:36:35 +02:00
6259287dff Add tab completion for /plot <deny|kick|remove> 2020-06-13 15:54:38 +02:00
3e2e61d2be Re-introduce online mode 2020-06-13 15:53:03 +02:00
a3586791b5 Remove unused code and use less aggressive colors 2020-06-11 01:01:00 +02:00
bb298ab660 Remove leftover TODO 2020-06-11 01:01:00 +02:00
8c0f581ff0 Add missing license headers to new files 2020-06-11 01:01:00 +02:00
033b87deb5 Resolve TODOs 2020-06-11 01:01:00 +02:00
b6f1610a7e Provide no suggestions instead of player names for commands 2020-06-11 01:01:00 +02:00
e3fbb32399 Formatting and documentation 2020-06-11 01:01:00 +02:00
67b80bb8e8 Fix /plot setup back 2020-06-11 01:01:00 +02:00
ae1427b189 Remove usage of SetupObject 2020-06-11 01:01:00 +02:00
5165c439fc Add tab completion and fix minor bugs 2020-06-11 01:01:00 +02:00
b15c48e074 Implement setup steps 2020-06-11 01:01:00 +02:00
c5bfde330f First draft of redesigned setup processing 2020-06-11 01:01:00 +02:00
d12ecc8616 Softdepend on new complementary UUID services 2020-06-04 11:41:20 +02:00
950640a557 Revert "Don't send chat spy to message sender"
This reverts commit a37ab10414.
Let's not break plotchat when plotspy is enabled
2020-06-04 11:29:02 +02:00
86746e7843 Fixed https://issues.intellectualsites.com/issue/PS-26 2020-06-03 21:18:46 +02:00
2c74d2479f Exchange website url 2020-06-02 17:06:33 +02:00
f1b79a3b0d Add more documentation to the settings.yml
Apparently gradle wants to update the poms so here we go
2020-05-27 22:20:13 +02:00
6442922d86 Implement some more generic types to make the player objects easier to work with and also create wrapper objects for fake players (NPCs). Potentially fixes PS-27 2020-05-27 14:08:48 +02:00
edbacb8e47 Bump dependency version 2020-05-25 20:11:57 +02:00
71e22f41b1 Bump json from 20190722 to 20200518
Bumps [json](https://github.com/douglascrockford/JSON-java) from 20190722 to 20200518.
- [Release notes](https://github.com/douglascrockford/JSON-java/releases)
- [Commits](https://github.com/douglascrockford/JSON-java/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-25 17:29:36 +02:00
b9b0d89b5f Replace the R-tree library with PRTree. Fix SquirrelID shading issues. Bump the version to 5.12.0 2020-05-25 15:13:31 +02:00
fdf82d0d1e Merge pull request #2852 from aurorasmiles/features/v5/uuid
Add BungeePerms UUID service
2020-05-25 13:15:41 +02:00
09327b0128 Merge branch 'v5' into features/v5/uuid 2020-05-25 13:13:29 +02:00
8a3ee4cdc2 Merge pull request #2853 from darbyjack/v5
Updated PAPI & EssX dependency to ensure compatibility
2020-05-25 13:02:10 +02:00
8d1033f725 Merge branch 'v5' into v5 2020-05-25 12:58:32 +02:00
1d8bad3a80 Merge pull request #2855 from IntellectualSites/dependabot/gradle/v5/net.luckperms-api-5.1
Bump luckperms from 5.0 to 5.1
2020-05-25 12:51:01 +02:00
67fbfb0f2d Bump api from 5.0 to 5.1
Bumps [api](https://github.com/lucko/LuckPerms) from 5.0 to 5.1.
- [Release notes](https://github.com/lucko/LuckPerms/releases)
- [Commits](https://github.com/lucko/LuckPerms/compare/v5.0...v5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-25 09:13:10 +00:00
4b0df80878 Updated PAPI & EssX dependency to ensure compatibility 2020-05-25 00:09:28 -05:00
52b90b6757 Merge pull request #2841 from IntellectualSites/features/v5/uuid 2020-05-25 01:40:35 +02:00
31b71ade69 * :D 2020-05-24 23:43:15 +01:00
0021b114de Revert "Slow down queue a bit because 1.13+ performance is bad"
This reverts commit bbde2f5e06.
2020-05-24 23:24:27 +01:00
28a7d027f6 Merge branch 'v5' into features/v5/uuid 2020-05-24 21:14:56 +02:00
e32a2e2723 Merge pull request #2847 from IntellectualSites/features/v5/single-area 2020-05-24 21:13:51 +02:00
46b68e489d Tab complete /p list 2020-05-24 21:08:11 +02:00
2436a6a402 remove debug, whoops 2020-05-24 20:54:10 +02:00
862467c0fa Tab complete /plot visit 2020-05-24 20:53:16 +02:00
69cfb431b1 Unstupidify Visit 2020-05-24 20:18:02 +02:00
172bd6f0f2 This should hopefully fix that broken merge. Maybe. Possibly. Idk. 2020-05-24 19:05:09 +02:00
a882555d1b Merge branch 'v5' into features/v5/uuid
# Conflicts:
#	Bukkit/build.gradle
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/ListCmd.java
#	Core/src/main/java/com/plotsquared/core/command/Visit.java
2020-05-24 19:00:21 +02:00
0b12c4e5b2 Update issue link 2020-05-24 18:48:15 +02:00
0ac6383c2c Use PlotQuery in Visit 2020-05-24 18:35:32 +02:00
76913d4a78 immutable -> mutable 2020-05-24 18:35:32 +02:00
a0d1da3274 fix dum typo 2020-05-24 18:35:32 +02:00
1aa144e47d Deprecate old PlotFilter class 2020-05-24 18:35:32 +02:00
6b31743fb3 add missing javadoc 2020-05-24 18:35:32 +02:00
508fdce704 Add missing methods to PlotQuery and use PlotQuery in ListCmd 2020-05-24 18:35:32 +02:00
e912909aad Add plot query system 2020-05-24 18:35:32 +02:00
98322d5d11 Add BungeePerms UUID service. This should probably work. 2020-05-24 14:32:34 +02:00
7b97130af7 Add option to disable legacy cache, also add an option to return "Unknown" when a request cannot be fulfilled (old behaviour)
This should fix issues where lowercase offline mode UUIDs don't have access to their old cache.
2020-05-24 05:00:36 +02:00
cc168d5ae9 Fix SQLite table creation statement and add legacy SQLite uuids as a provider 2020-05-24 04:48:19 +02:00
d19df3b6eb Fix offline mode UUIDs 2020-05-24 04:28:29 +02:00
75dbc2db98 Fix offline mode UUIDs 2020-05-24 04:27:20 +02:00
2875b050c5 Add plugin UUID services. They probably work. 2020-05-23 19:43:32 +02:00
6c6c2b57a1 Add options to disable tab completion and extend username completion, also limit the total number of username suggestions to 200 per request 2020-05-23 17:20:09 +02:00
113da81f29 Actually save the schematic 2020-05-23 16:15:48 +02:00
4dd2613f2f Add missing caption 2020-05-23 15:02:53 +02:00
8c37cc5340 Fix minor issues 2020-05-23 15:02:31 +02:00
47c74cfa6d Set correct region height 2020-05-23 14:39:28 +02:00
32a55127f1 Fix partial area regeneration when using PlotSquared generation.
Also fix issues with region height and road width.
2020-05-23 14:32:02 +02:00
6d0458281b Merge remote-tracking branch 'origin/v5' into features/v5/single-area 2020-05-23 02:30:45 +02:00
6090c7ccac Link issues to new issue tracker for legacy reasons 2020-05-23 01:25:18 +02:00
5e6b27e21f Update README.md 2020-05-23 00:33:30 +02:00
eee04ab87d Shade guava-mini into the bukkot module 2020-05-22 22:04:46 +02:00
a833803bdf Shade rx into the bukkot module 2020-05-22 22:04:46 +02:00
d2af342a5d Shade r-tree into the bukkit module 2020-05-22 22:04:46 +02:00
93619b3988 Don't access tree until it has been created 2020-05-22 22:04:46 +02:00
dd4c5014fc Get rid of unused field 2020-05-22 22:04:46 +02:00
1e3379b00a Fix up the plot area nightmare 2020-05-22 22:04:46 +02:00
bbde2f5e06 Slow down queue a bit because 1.13+ performance is bad 2020-05-22 10:44:51 +01:00
b61dfd6f97 Single plot area progress 2020-05-22 03:20:11 +02:00
f16fa0a3ed Merge branch 'features/v5/worlds' into features/v5/single-area 2020-05-22 02:56:36 +02:00
d4bd08415a Shade guava-mini into the bukkot module 2020-05-22 02:56:23 +02:00
9ad276eeae Merge branch 'features/v5/worlds' into features/v5/single-area 2020-05-22 02:54:24 +02:00
a3179bf114 Shade rx into the bukkot module 2020-05-22 02:54:10 +02:00
0d20dad2a3 Merge branch 'features/v5/worlds' into features/v5/single-area 2020-05-22 02:52:05 +02:00
7c080770f0 Shade r-tree into the bukkit module 2020-05-22 02:51:40 +02:00
9752e5f62b Start working on single plot areas 2020-05-22 02:48:32 +02:00
3b7057ad4f do a second attempt at fetching uuid batches even if it errors 2020-05-21 21:24:55 +02:00
38a7c771be Don't access tree until it has been created 2020-05-21 20:23:36 +02:00
1c6075df2b Get rid of unused field 2020-05-21 20:06:37 +02:00
3ede0447b0 Fix up the plot area nightmare 2020-05-21 20:06:04 +02:00
f01b242e4a For sign updating to be scheduled asynchronously.
It then forces it back on the main thread, so it's fine, but this way we can safely wait for the UUID mapping to be fetched.
2020-05-20 15:26:20 +02:00
2417dace2d Add UUID caching 2020-05-20 15:12:09 +02:00
f82a111518 Merge branch 'v5' into features/v5/uuid
# Conflicts:
#	Bukkit/pom.xml
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
2020-05-20 11:27:11 +02:00
525ba648ae ignore build/ and update bukkit pom.xml apparently 2020-05-20 09:44:45 +01:00
0160c2bb55 Add setCuboids method to RegionManager
- Allow FAWE to take charge of big operations like /plot set all
2020-05-20 08:43:58 +01:00
ea41c842bc Fix a bunch of minor issues 2020-05-20 00:31:59 +02:00
8efc78e1c9 IT COMPILES! 2020-05-19 23:05:36 +02:00
973c18623f Port more commands and add more tab completion utilities 2020-05-19 19:34:33 +02:00
7aba70ea65 Make plot clears/sets less crashy.
There's still the issue of Spigot's (or paper's) terrible GC that does nothing and stores everything in PS old gen memory so the server just numpties itself though.
2020-05-19 16:54:12 +01:00
123ca8efe9 Update more commands and add proper request timeouts 2020-05-19 17:33:59 +02:00
22c26fe962 Add PlotArea#getFlag 2020-05-19 13:07:50 +01:00
761803f777 Add option for roads to respect a plot area's flags and implement to PlayerEvents 2020-05-19 12:41:51 +01:00
d5d18a60fb Fix #2836
getCompoundTag can also be in Core since we're using WorldEdit.
2020-05-19 11:53:18 +01:00
37b065a097 Progress. 2020-05-19 00:28:52 +02:00
fdfc61cf97 Update username on async pre login event 2020-05-18 20:45:51 +02:00
31c84ab18f Basic pipeline setup 2020-05-18 00:22:34 +02:00
a47527857c Fix wonky annotation placement in SQLiteUUIDService 2020-05-17 23:58:39 +02:00
12f2cb0d58 Add a cache uuid service 2020-05-17 23:57:40 +02:00
67bf90e92f Create the SQLite UUID service and cache 2020-05-17 23:41:59 +02:00
b5f92f5003 Add sync catcher to the blocking pipeline methods 2020-05-17 23:26:19 +02:00
58989c9311 Add some missing methods to the pipeline 2020-05-17 23:20:36 +02:00
736004d88b Don't fill in stacktrace for ServiceError 2020-05-17 18:03:04 +02:00
49f51f24f7 Don't loop services when all mappings have been found 2020-05-17 18:02:26 +02:00
95df62e59b Add missing consumer API methods 2020-05-17 17:48:42 +02:00
64cfe240f9 Port OfflinePlayerUUIDService to the new system 2020-05-17 17:36:12 +02:00
29f2863cf4 Progress 2020-05-17 17:26:48 +02:00
792fa1f11d Improve design 2020-05-17 12:55:07 +02:00
7591c440c2 Begin working on the new UUID service API 2020-05-17 12:40:25 +02:00
c58309b385 Add { transitive = false } to HV 2020-05-16 21:37:14 +02:00
5ae70743b1 Always set the generator 2020-05-16 21:37:14 +02:00
29e0479081 Fix preset initialization 2020-05-16 21:37:14 +02:00
441a73839e Add /plot components 2020-05-16 21:37:14 +02:00
ff8f7a0867 Actually create the world managers 2020-05-16 21:37:14 +02:00
31edffcb63 Begin working on a platform specific world management system
This should make world management a fair bit cleaner
2020-05-16 21:37:14 +02:00
5442d43918 Update bug-issue-report-for-plotsquared.md 2020-05-15 16:46:47 +02:00
25d4d23958 5.11.2 2020-05-14 23:15:08 +02:00
86edb20c15 Add a FAWE/WE chart 2020-05-14 16:33:26 +02:00
3d30885daf No PlotSquared-Core-Core 2020-05-14 15:47:25 +02:00
194c5aa27b Merge branch 'v5' of https://github.com/IntellectualSites/PlotSquared into v5 2020-05-14 14:45:33 +01:00
20c487238a PlotSquared-Core please 2020-05-14 14:45:27 +01:00
6814b4bef2 Fix Core archive name 2020-05-14 15:24:43 +02:00
e1a25907f2 Merge branch 'v5' of https://github.com/IntellectualSites/PlotSquared into v5 2020-05-14 14:19:37 +01:00
5f896dd39a Properly copy NBT data in containers 2020-05-14 14:19:33 +01:00
f4729310fa Include the core dependency in the Bukkit module 2020-05-14 14:52:43 +02:00
2f02f4392a Fix names of shaded jars 2020-05-14 14:51:23 +02:00
b7f708dcd6 Fix gradle config 2020-05-14 14:32:20 +02:00
501fd9c8e6 Merge remote-tracking branch 'origin/v5' into v5 2020-05-14 14:16:17 +02:00
7ba7df5cb2 Make the upload task work 2020-05-14 14:16:10 +02:00
9dd9201b67 Allow plot auto from non-plot areas if the server has only one plot area 2020-05-14 13:10:53 +01:00
8fb9f29ab7 Fixes #2827
If existing blocks are an instance of container, clear the inventory.
2020-05-14 12:57:26 +01:00
dd852801cc Merge pull request #2825 from IntellectualSites/tile-entity-cap
Fix chunk processing
2020-05-14 13:18:19 +02:00
1fa41e6209 Merge branch 'v5' into tile-entity-cap 2020-05-14 13:17:41 +02:00
a2db2e8268 Add return 2020-05-14 11:27:35 +01:00
617abf89e6 Split ChunkManager to Chunk and Region Managers
- Having not chunk-specific code in ChunkManager felt wrong.
- Also allow FAWE to replace setbiome code
- Also improve performance (proper usage of chunk loading) for setbiome
2020-05-14 11:27:35 +01:00
98b4ceab7d Fix style.yml 2020-05-13 16:29:10 +01:00
86a996b2ff Make the tile entity check true by default, as it only applies when the chunk processor is enabled (and it's disabled by default) 2020-05-13 15:09:00 +02:00
e6a9daf31a Make the tile entity limit in ProcessedWEExtent apply per chunk rather than per edit 2020-05-13 14:54:54 +02:00
8c0f7b207e Make the chunk listener NOT delete all tile entities in the chunk 2020-05-13 14:39:58 +02:00
ec347f8738 Add missing blocks and block tile entities from /plot set if the chunk processor is enabled 2020-05-13 14:24:04 +02:00
19fe2efb6e Fix the WE extent and add our own tile entity list 2020-05-13 14:11:17 +02:00
e6878d7804 clean up ProcessedWEExtent 2020-05-13 12:47:52 +02:00
435d877262 Make the tile entity check respect the chunk processor status 2020-05-13 12:25:48 +02:00
3deff629b0 Add paper specific listener for limiting the amount of tile entities in a chunk during build, instead of just doing it during chunk unloading 2020-05-12 23:01:14 +02:00
a038cb6d1b Merge branch 'v5' of https://github.com/IntellectualSites/PlotSquared into v5 2020-05-12 18:53:57 +01:00
637dd7d0c2 correct update messaging 2020-05-12 18:53:26 +01:00
d20fa39cf5 Add flag that prevents people from copying NBT data in the plot unless they're added as members 2020-05-12 19:25:06 +02:00
be6910d5d9 Reformated and update French translation
Some of my translations used '' to represent ' but it's not needed. Also splited some long lines and translated new backup system and keep-inventory flag.
2020-05-12 17:29:32 +02:00
2d6a5a3804 Update download link 2020-05-12 15:16:51 +02:00
630e81fbfb 5.11.1 2020-05-12 13:42:24 +02:00
6488aafd9d Version bump 2020-05-12 12:56:18 +02:00
4ad90d423d Fix timeout comment 2020-05-12 12:52:45 +02:00
d2dae45082 Add leaves to the blacklist 2020-05-12 12:49:39 +02:00
85c9bd7ceb Add all sign type to blacklist 2020-05-12 12:24:36 +02:00
d0ee579069 Move backup config section to a more appropriate place 2020-05-12 10:44:34 +01:00
10dbcbcdbd Prevent NPE in entityDamage
This is done by creating a fake (WE) entity type in the case that the entity type name is null. In these cases, WE has no equivalent.

By doing this, all entity category contains check will fail, and it will default to the PVE check at the bottom of the if-else if chain.
2020-05-12 10:05:47 +02:00
e8dd5fe903 Merge pull request #2816 from IntellectualSites/backups
Plot backup system
2020-05-12 09:40:25 +02:00
32c23e6ced Merge branch 'v5' into backups 2020-05-11 22:27:16 +02:00
81aaba328a ENGLISH > ROOT 2020-05-11 22:21:37 +02:00
3c5dd3d0d2 Merge remote-tracking branch 'origin/v5' into v5 2020-05-11 22:11:29 +02:00
2dc07d9321 Add a looooot of default disallowed blocks 2020-05-11 22:11:21 +02:00
841dd5e189 Update wiki links 2020-05-11 20:27:06 +02:00
b2bc2887d2 Fix dumdum merge 2020-05-11 20:17:41 +02:00
e20319f4e1 Merge branch 'v5' into backups
# Conflicts:
#	Core/src/main/java/com/plotsquared/core/configuration/Captions.java
2020-05-11 20:15:48 +02:00
d40160d205 Fix javadoc 2020-05-11 20:04:22 +02:00
f7167d5e83 Fix typo 2020-05-11 20:03:26 +02:00
282773a43f Replace Guava methods with stdlib equivalents 2020-05-11 20:02:33 +02:00
8944be5319 (Complex) command suggestions for /plot set 2020-05-11 19:37:25 +02:00
df01f9bea7 Add a list of blocks that cannot be used in /plot set <component> 2020-05-11 18:35:06 +02:00
3c17b76b1c Remove dum-dum line break 2020-05-11 11:21:32 +02:00
7a6909dab1 Merge branch 'v5' into backups 2020-05-11 11:19:59 +02:00
3064ae80d1 Add a keep-inventory flag 2020-05-11 11:19:36 +02:00
06bb6856a8 Fix bad getApplicablePlotArea(Location) code
- Fixes #2815 alongside 667098268f
2020-05-11 09:48:18 +01:00
702caa6feb Remove rogue line break 2020-05-10 22:09:56 +02:00
fc74c582bf Add option to disable deletion of plot backups when the plot is unclaimed 2020-05-10 21:52:57 +02:00
658361f825 Destroy backups when the plot is uncalimed 2020-05-10 21:31:16 +02:00
e0c9a802d8 Add automatic backups and implement them /plot clear and /plot set <component>. 2020-05-10 20:31:07 +02:00
c4a70c0945 Fix tab completion for the backup command 2020-05-10 19:42:42 +02:00
f7d6ac00e4 Make the backup commands work 2020-05-10 19:20:11 +02:00
8ed5a21b36 Merge branch 'v5' into backups 2020-05-10 17:03:36 +02:00
773a993ee1 Merge branch 'remove-eol-translation-strings' into v5 2020-05-10 17:02:13 +02:00
6fb63c9609 Implement backup restoration command. This might work, idk, we'll see. 2020-05-10 16:53:19 +02:00
079289eb74 Use #getTranslated on GENERIC_UNOWNED 2020-05-10 16:40:12 +02:00
59f96d4455 Translate all backup failure reasons 2020-05-10 16:39:14 +02:00
cdab52fcbe dumdum space go bye bye 2020-05-10 16:04:33 +02:00
63c9037b10 Fix typo 2020-05-10 16:00:20 +02:00
bbc86eba39 /plot debug progress 2020-05-10 15:51:27 +02:00
e0fb6f5440 /plot debug structure 2020-05-10 15:36:20 +02:00
2bd30af361 Cache both backup profiles and backup objects 2020-05-10 15:12:17 +02:00
b136f44f12 Merge branch 'v5' into remove-eol-translation-strings 2020-05-10 15:05:58 +02:00
d0dbb495b0 Add BackupProfile#restoreBackup 2020-05-10 14:58:45 +02:00
8715a27a93 No backups for merged plots 🐮 2020-05-10 14:41:02 +02:00
503fc44208 Updated according to new translations and old removed 2020-05-10 14:12:56 +02:00
d3bfaeb5a4 Ready for merging !
Removed useless space at the end of the file + precision of the date (latest edition)
2020-05-10 14:12:56 +02:00
7adecd0808 Last fix (removed unused translation + added the missing) 2020-05-10 14:12:56 +02:00
c99e081ae0 Fiexed issues reported by CodeFactor 2020-05-10 14:12:56 +02:00
285b6bf62d Updated and corrected French translation
Old translation has been reviewed and new v5 flags' translations has been added.
Some mistakes could now remain, I will fix them if needed ;)
Enjoy !
2020-05-10 14:12:56 +02:00
723e29cdd0 Continue working on the backup system 2020-05-10 14:02:25 +02:00
667098268f Almost fix slime pathing?
This almost works, there's no real way to do it gracefully because you can't set where the slime should be travelling to nicely, nor can you set rotation etc. Seems to be a fairly large part of the event capability missing from paper.
2020-05-10 12:18:55 +01:00
e6408b35a2 fix merge auto 2020-05-10 10:44:14 +01:00
3eb0de68c4 Begin working on the structure for the backup system 2020-05-09 20:05:39 +02:00
dd1b944205 Update gradle and remove license header from gradle 2020-05-09 16:47:49 +02:00
ae11f0610e Add a few more translation strings for setup wizard 2020-05-09 16:45:32 +02:00
55fc963673 5.10.6 2020-05-09 13:19:29 +01:00
198c7ca58d Remove dead translations 2020-05-09 14:04:08 +02:00
5a2f70238a Typo 2020-05-06 12:53:27 +01:00
8257b0b563 No lazy init when calling toString,equals or hashCode
That prevents premature initialization as NullBlockCategory
2020-05-06 12:53:27 +01:00
9b997d2195 Make constructor private 2020-05-06 12:53:27 +01:00
a19fa1b92c Send a debug message if category not found 2020-05-06 12:53:27 +01:00
2c060db9c0 Lazily initialize block tags 2020-05-06 12:53:27 +01:00
a8621a15ad Override setblock setting Pattern in ChunkBlockQueue
> Should stop NPE during plot analysis
> Without overriding this method, DelegateLocalBlockQueue setblock Pattern is called
> DelegateLocalBlockQueue's setblocks use parent.setBlock, but we set that to null in ChunkBlockQueue
> ChunkBlockQueue is simply just to cache the values from generation to use in analysis
> Therefore there is no need to setblocks in any other Queue implementation
2020-05-06 12:53:16 +01:00
179e9e1e74 Clean up plot grants and plot auto
- Correct maths for calculating granted plots, etc etc
- Don't check if the player has the correct number of plots AGAIN on AutoClaimFinishTask. That's dumb.
2020-05-06 11:39:34 +01:00
df5feff9ec Display the correct number of grants used in auto 2020-05-05 13:50:29 +01:00
9226aaff1f In the interest of debug should show everything, add debug when registering an unknown flag. 2020-05-05 12:57:14 +01:00
afe874a59b try-catch for NPE in purge and fail gracefully if the world is null
Plausible scenario since purge is often run to remove plots in the DB from removed worlds
Shouls fix #2806
2020-05-05 11:12:39 +01:00
4ad9f12d5d Move plot version to debugpaste top 2020-05-04 23:58:01 +02:00
228c37815a Fix merge all
Fixes #2804
2020-05-04 17:15:53 +01:00
a37ab10414 Don't send chat spy to message sender 2020-05-03 18:13:54 +02:00
d73dbf0c81 5.10.5 2020-05-02 13:34:04 +01:00
daee26681a use strings for spawn reasons to be safe 2020-05-02 12:13:00 +01:00
729469e030 Add config options for all paper events. 2020-05-02 11:58:32 +01:00
c6dc9ee189 Add some more listeners
- Also use setShouldAbortSpawn so it doesn't just try forever
 - Add config to enable or disable all paper listeners
2020-05-02 11:58:32 +01:00
85a75ad868 Yeet that PaperSPiGoT out of here 2020-05-02 11:58:32 +01:00
8ec8b8d803 Add some paper-specific listeners 2020-05-02 11:58:32 +01:00
d864792d09 Fixes #2800 Allow to wrap OfflinePlayers in 1.15.2 2020-05-02 11:28:06 +01:00
ed2e9a80ed Fix rare bug where if the plot size was less than 15 and the chunk contained an entire plot, it would generate incorrectly 2020-05-01 20:30:59 +01:00
36948ed351 Move world settings dump to a better location (where all of the fields will actually have been set) 2020-05-01 20:29:35 +01:00
e06429f3b0 Correct world types given to player 2020-05-01 19:18:11 +01:00
fd4a9a16de Execute commands when clicked for expire messages 2020-05-01 13:34:43 -04:00
acba10ac09 Fix broken url 2020-05-01 17:00:55 +02:00
d6d49e0912 Show suffix in versionString() too 2020-05-01 15:56:35 +01:00
b5de5f30ac Allow suffixes to the version
- Useful for "PlotSquared-5.10.4-SNAPSHOT" etc
2020-05-01 15:53:40 +01:00
17698065a0 Add extra SpawnReasons to spawn listener 2020-04-30 17:00:35 +01:00
135c6f2c15 Send a less obnoxious message if the flag name length exceeds the maximum allowed length 2020-04-30 13:36:03 +02:00
a263fe2f2d Apparently we need to recover from bad flags 2020-04-30 12:15:42 +01:00
cbe46539ca Pick up the rest of the reformating 2020-04-30 11:53:07 +01:00
5e842f1572 Force flag names to be 64 characters or less
- A few people seem to be on interesting SQL installs. This should fix the issues they have with 767 bytes,
2020-04-30 11:52:39 +01:00
b56d4d0fea Merge branch 'reformat' into v5 2020-04-30 11:39:02 +01:00
42106bb97a I didn't get everything first time 2020-04-30 11:33:59 +01:00
e7216d4aef Merge branch 'v5' into reformat 2020-04-30 11:33:31 +01:00
0751e9cea3 Make LiquidFlowFlag an enum 2020-04-30 11:18:28 +01:00
0091580ae0 Reformat it all. 2020-04-30 11:01:52 +01:00
4a16f9c1a7 LiquidFlow true will override BlockPhysics false 2020-04-30 10:59:43 +01:00
894d673c90 Fix tests 2020-04-30 11:32:50 +02:00
577fe3037f Update checker improvements and 5.10.4
- Add config option to disable poll once it's found an update (true by default)
 - Better PlotVersion stuff can now detect if you're using a later version than the spigot API, and not tell you about it
2020-04-30 10:17:19 +01:00
53ca62e8fc Bump version 2020-04-29 22:06:23 +02:00
670f6d9f8b Fix coral-dry flag not respecting horn coral blocks 2020-04-29 21:55:55 +02:00
8a21334e66 Merge branch 'v5' of https://github.com/IntellectualSites/PlotSquared into v5 2020-04-28 11:21:51 +01:00
a130d801d5 schem.intellectualsites.com (just forwards to athion.net but cnamed) 2020-04-28 11:21:30 +01:00
51b6f41eff Update papi hook message 2020-04-25 23:54:30 +02:00
a829799b36 Update scripting message 2020-04-25 23:53:46 +02:00
ccb43d0661 Do placeholders better.
- Still allow parsing of placeholder if no plot is required and plot is null.
- Properly check if the player is null before getting the plot, and if the plot is null
- These were still issues before my initial "fix" city
2020-04-23 14:16:06 +01:00
5bd53436df Prevent NPE for report comments 2020-04-23 13:44:34 +01:00
caa4a08b26 getOfflinePlayer once 2020-04-23 09:21:52 +01:00
0fa99d7940 Never return null in Placeholder. Also slight cleanup. 2020-04-23 09:06:37 +01:00
73dae7842d Only poll for updates every 30 mins.
- Don't do GET requests on player join (bad idea, it was sync...)
 - If there's an update it will notify the player still, it just caches the update status
2020-04-22 12:09:00 +01:00
92a18d810c Correct usage of Json.
I'm dumb and forgot toString doesn't work. Repalce with getAsString
2020-04-22 09:57:46 +01:00
591eb60a71 5.10.2
*bump version after resource update
2020-04-22 08:24:55 +01:00
9081a5aff6 Fix incorrectly formatted biomes in worlds.yml automagically 2020-04-22 08:22:14 +01:00
8ff4566905 Change misleading information 2020-04-21 23:42:31 +02:00
c8d8fb6aff Reformat premium information 2020-04-21 23:38:56 +02:00
6da4994955 Enhance premium verification 2020-04-21 23:06:11 +02:00
4780fcd534 Fixes #2782
Thanks for the contribution :)
2020-04-21 15:53:38 +02:00
5b30711470 Cant use bar chart 2020-04-21 12:39:48 +01:00
336f27f078 Only check update if premium. Add bstats bars for premium vs not. 2020-04-21 12:39:48 +01:00
92ef0d723b 5.10.1 2020-04-21 11:59:10 +01:00
ffee7a518e update default biome to match format WorldEdit accepts. 2020-04-21 09:16:02 +01:00
8d61e6f111 Fix update checker
- No more NPEs
 - Use the better spigot API
 - No obnoxious tooltip displaying the link without being clickable
2020-04-21 08:56:23 +01:00
67736bfbca git object is actually needed in Core build 2020-04-21 08:28:22 +01:00
84108b60c2 force version 2020-04-21 08:16:06 +01:00
59f8f2fdff Fix biome setting in 1.13 and 1.14 2020-04-20 23:40:04 +02:00
5c6175badb Merge remote-tracking branch 'origin/v5' into v5 2020-04-20 23:37:02 +02:00
8db8a30455 Fix biome setting 2020-04-20 23:36:56 +02:00
cbe8fda1df Fix update notification 2020-04-20 23:24:28 +02:00
558df450b5 Update spigot updater 2020-04-20 21:04:30 +02:00
f1d10c96bc Added PERMISSIONS_ADMIN_CHAT_BYPASS enum for the permission plots.admin.chat.bypass allowing users to bypass the plot chat security feature. 2020-04-20 18:55:28 +02:00
4d1b08a628 Updated to properly use the permissions system from com.plotsquared.core.util.Permissions and com.plotsquared.core.configuration.Captions 2020-04-20 18:55:28 +02:00
2eda56bc1f If all players are denied from a plot, this will allow administrators with permission to see chatspy, talk in plots they have been denied from. 2020-04-20 18:55:28 +02:00
c391fee100 Merge pull request #2779 from lenis0012/v5
Use primite int type for setBiome 1.13 workaround
2020-04-20 18:53:55 +02:00
06d255ccc2 Create FUNDING.yml 2020-04-20 18:48:22 +02:00
bb291b947f Use primite int type for setBiome 1.13 workaround 2020-04-20 17:27:46 +02:00
3c8b22688a I'm dumb. 2020-04-19 21:24:45 +02:00
cdd1fad85c Fix github link in debugpaste 2020-04-19 21:22:45 +02:00
ab6fd06657 Link to bStats 2020-04-18 23:22:05 +02:00
3bb32a5630 Add bStats stats to README 2020-04-18 23:21:01 +02:00
bf5862942a Disable prefixes for flag info headers and footers and suppress NPE in the update utility 2020-04-18 22:26:13 +02:00
cbea595fa0 Don't relocate json-simple. 2020-04-18 21:14:44 +02:00
952ea0b090 Fix setowner none (unclaim) 2020-04-18 17:59:45 +01:00
af951ac11c Update upload to debug the content if incorrect properly. 2020-04-18 17:53:45 +01:00
165614efe9 make sure never to have unclaim be an alias of delete. Even if it doesn't work. 2020-04-18 17:44:01 +01:00
95335df84d Merge branch 'v5' of https://github.com/IntellectualSites/PlotSquared into v5 2020-04-18 17:22:58 +01:00
100861484a Fix plot claim. 2020-04-18 17:22:51 +01:00
70eb588f1f Update issue template for v5/v3 support 2020-04-18 17:04:16 +02:00
c206de263b Merge remote-tracking branch 'origin/v5' into v5 2020-04-18 02:28:29 +02:00
0c12972c03 Register misc-flags. 2020-04-18 02:28:11 +02:00
546c4defb7 Add SirYwell to authors list
Thanks for all your hard work regarding v5 ❤️
2020-04-16 23:49:08 +02:00
814fca3832 Update flag description 2020-04-16 19:15:40 +02:00
3ee29297e0 Add option to force plot chat in plot areas. 2020-04-16 16:55:14 +01:00
6d9d0fff10 Add description caption for chat flag 2020-04-16 12:49:00 +01:00
714b8dad87 Implement IntellectualSites/PlotSquaredSuggestions/96
Also make Plot Chat work properly. Not sure what was going on there before...
2020-04-16 11:54:32 +01:00
a44807d47b Don't dump biome array on /ps reload. Gradle also seems to want to change the Core pom. 2020-04-16 11:43:13 +01:00
4aac3bf7e4 Merge pull request #2757 from IntellectualSites/api/v5/packages
Package Restructure
2020-04-16 10:58:13 +02:00
ee2ed8222d Merge config packages 2020-04-16 06:14:33 +02:00
edaf396894 Merge features/v5/internal-updates into api/v5/packages 2020-04-16 06:11:03 +02:00
6f052f0001 Remove extra line from HEADER 2020-04-16 05:05:58 +02:00
ba40a56c32 Add GPLv3 License headers to all source files. 2020-04-16 04:52:39 +02:00
780be3776a Addressed some comments 2020-04-15 15:26:54 -04:00
98235b3fdc Merge remote-tracking branch 'origin/dependabot/gradle/features/v5/internal-updates/org.jetbrains.kotlin-kotlin-stdlib-1.3.72' into features/v5/internal-updates 2020-04-14 20:25:22 +02:00
f5a9abfc8d Bump kotlin-stdlib from 1.3.61 to 1.3.72
Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.61 to 1.3.72.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-14 18:25:00 +00:00
a8619fe2ad Bump asm from 7.3.1 to 8.0.1
Bumps asm from 7.3.1 to 8.0.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-14 18:23:48 +00:00
c812bb1295 Bump annotations from 18.0.0 to 19.0.0
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 18.0.0 to 19.0.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Changelog](https://github.com/JetBrains/java-annotations/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JetBrains/java-annotations/compare/18.0.0...19.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-14 17:50:27 +00:00
4e7bcc788b Merge pull request #2764 from IntellectualSites/features/v5/event-entity-categories
Features/v5/event entity categories
2020-04-12 23:21:47 +02:00
79bd69e599 Make the entity counting code use the new entity categories, remove usage of magic numbers and add /plot caps 2020-04-12 19:30:50 +02:00
5772af37fe Reclassify shulker as a hostile mob 2020-04-12 04:46:51 +02:00
6324bb1134 Use entity categories in events 2020-04-12 01:47:56 +02:00
658f2a3fc3 Finalize entity type categorisation 2020-04-12 01:23:13 +02:00
6e536f81ac Add more entity categories 2020-04-12 00:57:50 +02:00
dd9450d36a Add entity category loading code to WorldUtil (implemented in BukkitUtil) 2020-04-11 22:26:31 +02:00
8ef3a90ce0 Merge remote-tracking branch 'origin/features/v5/internal-updates' into features/v5/internal-updates 2020-04-11 21:49:15 +02:00
e6c76ad3f3 Entity categories implementation 2020-04-11 21:49:08 +02:00
4a249843eb Workaround to accept Slimes and EnderDragons as Monsters 2020-04-11 21:42:52 +02:00
5c1f0f51df Add a custom bStats chart tracking terrain types 2020-04-11 20:56:34 +02:00
2377ce1123 Relocate metrics properly 2020-04-11 19:52:45 +02:00
6f2b31f4a3 Add missing default flag values to GlobalFlagContainer (fixes #2748) 2020-04-11 18:49:04 +02:00
c5590440d6 Merge remote-tracking branch 'origin/features/v5/internal-updates' into features/v5/internal-updates 2020-04-11 17:58:27 +02:00
7931390ae4 Fix json relocation issue. Make plot areas dump their default flags and add progress output for flag conversion. 2020-04-11 17:58:08 +02:00
546b857b9d Fail default flag parsing gracefully 2020-04-11 17:19:43 +02:00
ce10d54a9c Don't use legacy IDs to get block types in the hybrid plot manager 2020-04-11 13:28:58 +02:00
965bbb9f3b Extract block queues from AugmentedUtils 2020-04-11 13:23:57 +02:00
e88b331155 Clean up AugmentedUtils and make the code readable by humans 2020-04-11 12:08:46 +02:00
ce177c3c46 Clean up HybridGen and make the code readable by humans
Previously it was only readable by androids, and Jesse.
2020-04-11 12:00:42 +02:00
5a6dbfda36 Fix javadoc generation issues 2020-04-11 03:23:48 +02:00
6c1caac731 Rename jar from BukkitAPI to Bukkit 2020-04-11 02:57:00 +02:00
9c3c42c3e6 Rename published maven artifacts
# Conflicts:
#	Bukkit/build.gradle
#	Core/build.gradle
2020-04-11 02:54:34 +02:00
5fc33dcc06 Rename published maven artifacts 2020-04-11 02:39:02 +02:00
c196ced0e2 Move org.json into core 2020-04-11 02:28:15 +02:00
dfa977a020 Moved more packaged based on feedback 2020-04-10 20:19:18 -04:00
5be2dfa747 Package Changes 2020-04-10 19:26:07 -04:00
f9ea99fa1d Merge pull request #2754 from IntellectualSites/features/v5/owners
Remove all direct access to Plot.owner
2020-04-10 19:52:41 +02:00
79583c011f Replace getOwnerAbs() == null with !hasOwner() 2020-04-10 19:28:10 +02:00
172bcc7677 Revert "Replace getOwnerAbs() == null with hasOwner()"
This reverts commit 79620042
2020-04-10 19:22:12 +02:00
fa51cb94a3 Merge pull request #2755 from IntellectualSites/features/v5/licenses
Add GPLv3 License headers to all source files.
2020-04-10 19:14:14 +02:00
c2060ea1a7 Remove deprecation of getOwner() 2020-04-10 19:11:53 +02:00
7962004215 Replace getOwnerAbs() == null with hasOwner() 2020-04-10 19:10:43 +02:00
45476f2867 I missed AbstractDB somehow... 2020-04-10 18:15:35 +02:00
280ced7904 Add GPLv3 License headers to all source files.
Reason: "            How to Apply These Terms to Your New Programs

           If you develop a new program, and you want it to be of the greatest
         possible use to the public, the best way to achieve this is to make it
         free software which everyone can redistribute and change under these terms.

           To do so, attach the following notices to the program.  It is safest
         to attach them to the start of each source file to most effectively
         state the exclusion of warranty; and each file should have at least
         the "copyright" line and a pointer to where the full notice is found."
2020-04-10 18:09:01 +02:00
474795367e Reformat Plot after the owner changes. It was a bit too messy. 2020-04-10 14:07:52 +02:00
ce756411cf Remove all direct access to Plot.owner
New methods were added for access to the absolute owner of a plot, and the documentation of the owner getters to clarify the purpose of the methods.
2020-04-10 14:05:01 +02:00
bdba2b33fb Remove Nukkit and Sponge files from v5
We don't need these because they already exist in our git history and in the legacy branch.
2020-04-09 19:38:10 -04:00
0d26111fa7 Include golems (snowmen, iron golems and shulkers) in the animal-interact flag. 2020-04-09 21:38:24 +02:00
dada7dbb86 Use relocated org.json instead of including the source files 2020-04-09 17:41:55 +02:00
cb05d34d20 Fixes #2751 2020-04-09 17:07:14 +02:00
7c25c60252 Merge pull request #2743 from IntellectualSites/features/v5/async-load
Prevent synchronous chunk loading whenever possible
2020-04-09 15:09:18 +02:00
86149224d1 Don't set walls, wall filling or outline in plots using full vanilla terrain generation 2020-04-09 13:06:45 +02:00
f717589074 Fix typo in MainUtil and switch out Consumer<Integer> to IntConsumer 2020-04-09 11:23:39 +02:00
254a0541cc Fix OfflinePlayerUtil runtime exception 2020-04-08 22:52:13 +02:00
271109a726 Fix dumdum async getLoadedChunks call, but only because Aikar broke everything. 2020-04-08 21:49:41 +02:00
38de74c4ff Make sure PlayerEvents#logout is called 2020-04-08 17:53:11 +02:00
865d11e844 Register vehicle-place and make it disabled by default 2020-04-08 17:28:16 +02:00
ebba9a2290 Fix interval flags 2020-04-08 17:22:53 +02:00
bc45b8b695 Merge branch 'features/v5/internal-updates' into features/v5/async-load 2020-04-08 17:17:17 +02:00
7ac389b698 Fix block ignition location check 2020-04-08 17:15:17 +02:00
616d22ceac Fix liquid-flow 2020-04-08 17:01:41 +02:00
f6332d2cd9 Add tab completions to flyflag 2020-04-08 16:53:39 +02:00
4ca7a81e96 Fix untrusted-visit. 2020-04-08 16:52:10 +02:00
ae2867136a Make the fly flag an enum flag instead. It now accepts: true, false and default, where default is the default value, and does not change the flight status at all. 2020-04-08 16:39:19 +02:00
ef04ed9151 Fix augmented generation 2020-04-08 04:10:22 +02:00
1522632f5a Don't replace blocks if they have identical states already 2020-04-08 02:02:20 +02:00
be6bcafccc Make sure augmented generation doesn't crash the server 2020-04-08 01:23:22 +02:00
5d332e7d58 Fix plot clearing in normal plot worlds 2020-04-08 00:01:58 +02:00
283ff945f3 Fix /plot auto performance and remove sign-guessing 2020-04-07 23:39:56 +02:00
0d4af3023d Extract TaskManager lambdas for better debugging 2020-04-07 23:18:36 +02:00
7fdb7961ce Merge branch 'features/v5/internal-updates' into features/v5/async-load 2020-04-07 22:13:42 +02:00
e161209a46 Fix plot claiming 2020-04-07 22:12:52 +02:00
5e2e4a8631 Revert testCreate change 2020-04-07 21:43:32 +02:00
e4a6bd0ca5 Don't try to remove players. Fixes #2742. 2020-04-07 20:56:43 +02:00
5547185b3f Prevent synchronous chunk loading whenever possible 2020-04-07 20:19:39 +02:00
7841ee3dcc Fix a few encapsulate merge issues 2020-04-02 13:40:11 +01:00
099a680c85 Encapsulation and Magic Values (#2711)
* Encapsulate attributes of PlotArea using lombok Getters/Setters

* Limit access to collections, don't expose implementation details

* Better naming for some boolean attributes

* Replace magic type value with PlotAreaType enum

* Replace magic terrain value with PlotAreaTerrainType enum

* Fix remaining rebase conflicts

* Reduce code duplication

Co-authored-by: Alexander Söderberg <Sauilitired@users.noreply.github.com>
2020-04-02 13:34:38 +01:00
9764d4d226 Actually add biomes to road schematics 2020-03-28 10:43:24 +00:00
37336fffe2 Merge branch 'features/v5/internal-updates' of https://github.com/IntellectualSites/PlotSquared into features/v5/internal-updates 2020-03-28 02:26:25 +01:00
a285404847 Update gradle, actions and fix typo in branch 2020-03-27 23:44:17 +01:00
2994b2c158 Use try with resource to close ClipboardReader and stop adding "atic" to schematic files or not reason 2020-03-26 20:55:27 +00:00
3a3a06631d Add coral-dry flag 2020-03-25 21:14:58 +01:00
f9bf576d2e Actually initialise the biome array in HybridPlotWorlds.
Fixes generation using schematics (and allows generation using biomes in schematics for roads and plots....)
2020-03-25 17:46:08 +00:00
f2f7fbce09 Allow trusted users to use /plot set 2020-03-25 11:01:19 +00:00
412a3ee344 Support v2 schematics properly. No 3D biomes are supported by it as yet. (#2716) 2020-03-24 09:08:56 +01:00
2f4eea118a add clear option to /ps purge (#2714) 2020-03-24 09:08:32 +01:00
7310506ed4 Add option to have road regeneration be persistent across restarts. (#2715)
* Add option to have road regeneration be persistent across restarts.

* Use int[] not Integer[]. There's the possibility of large arrays given the size of some worlds.

* Correctly close Input/Output streams with try-with-resource.
Also don't try to ObjectOutputStream if an existing file hasn't actually been deleted.
2020-03-22 19:23:35 +00:00
26b5ee7482 Merge branch 'features/v5/internal-updates' of https://github.com/IntellectualSites/PlotSquared into features/v5/internal-updates 2020-03-20 12:12:30 +00:00
58280a20a8 Log don't debug on regenallroad completion 2020-03-20 12:11:39 +00:00
3d47d7e73f Use worldedit to regenerate chunks. (#2708)
* Use worldedit to regeneration chunks. It's very slow, but it works.

* Use the AutoClose-ness of EditSession
2020-03-20 13:05:13 +01:00
d9f9d7dc34 Features/v5/event results (#2706)
* Begin events rewrite using Guava EventBus:
- moved events to within core
- removed BukkitEventUtil
- EventUtil in core is now the implementation
- Refactor any event calls

TODO:
- Test :)
- Implement changes to PlotSquared's own listeners
- Other

* Correct code style for annotations and refactor EventUtil to EventDispatcher

* Make getEventResultRaw default method and remove empty PlotEventListener file

* not raw map

* Remove PlotPlusListener

* Add listener registration to PlotAPI. Add documentation and refactor Result enum

* Add reason for the Event Result. Change how the claim event is called
TODO: better auto event somehow. Possible re-write of auto required..?

* Implement changes to events properly
Add PlayerAutoPlotEvent
Add PlotDoneEvent
Add schematic variable to Claim event and allow it to be changed
Add reason for plot unlink to unlink event
Add pattern to component set event and allow it to be changed
Allow component of component set event to be changed
Add player to plot merge event

* Fix compile

* Correct formating

* Various cleanup
 - Correct formatting in places
 - Add feedback to Desc command cancellation
 - Correct use of flag API
 - Add FlagRemove event to flagcommand where required

* Replace reason with caption

* Switch colours in Event Deny caption

Co-authored-by: dordsor21 <dordsor21@gmail.com>
2020-03-15 12:22:49 +01:00
4bcd926543 Update discord links 2020-03-09 23:50:22 +01:00
05626c2c8f Features/v5/move swap fixes + some other important commits (comments, etc) (#2699)
* Use generics instead of the raw class

* Add Gradle wrapper verification

* Fix biome setting in versions prior to 1.15

* Fixes #2654

* Document area getters in PlotAreaManager, and replace y-value with z in the area contains check.

* Remove update notifications

* Remove unused dependencies

* Do not kick plot owners on "/p deny *"

* Do not kick any added players on /p deny *

* Allow redstone to be used in server plot with `redstone.disable-offline` enabled.

Potentially fixes #2613

* Disallow swapping ,erged plots

* Fix legacy converter.

* Fix blockbucket pattern generation

* Prevent pasting schematics onto merged plots.

* Cancel claim event correctly

* Revert "Cancel claim event correctly"

This reverts commit 0f786155
Further investigation required

* Fix plot swapping messing up owners. Fixes #2282

* Fix plot move

* Prevent plot swapping form changing the database unless the swap was successful.

* Update signs after swap.

* Only send move success message if the move was successful.

Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: Daniel <admin@hywse.eu>
Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
2020-02-28 22:15:04 +01:00
30b83faab6 Fix plot downloading 2020-02-28 00:31:53 +01:00
9868648fcb Pull/2693 (#2694)
* Commit WIP flag work.

* More ported flag types, and additions to the flag API.

* Make PlotFlag more generic to allow generic flag creation

* Pull Captions methods into a Caption interface.

* Port MusicFlag

* Port flight flag

* Port UntrustedVisitFlag

* Port DenyExitFlag

* Remove paper suggestion

* Make ListFlag lists immutable

* Update Flag containers. Add javadocs. Add missing methods.

* Port description flag

* Port greeting and farewell flags

* Port weather flag

* Move getExample implementation to BooleanFlag

* Port reserved flags

* Port all boolean flags.

* Remove unused flag types

* Invert liquid-flow flag

* Find the real (legacy) flag name

* Change NOITFY -> NOTIFY in Captions

* Make IntegerFlag extendable

* Port integer flags

* Update Flag command to current API state

* Begin remaking flag command

* Create DoubleFlag + extract common parsing stuff

* Supply arguments in flag parse exceptions

* Implement missing flag subcommands

* Update Flag command to current API state

* Implement PriceFlag

* Port deny-teleport

* Port gamemode flags

* Port BreakFlag

* Port PlaceFlag

* Port UseFlag

* Remove old unused flag constants

* Port blocked-cmds flag

* Fix entity util

* Port TimeFlag

* Use CaptionUtility for formatting

* Port keep flag

* Fix imports

* Reformat code

* Remove unused classes

* Fix MainUtil.java

* Remove FlagCmd

* Add flag info header and footer

* Comment out flag related stuff in SchematicHandler

* Remove FlagManager

* Finalize Plot.java

* Finalize PlotArea.java

* Finalize PlotListener

* Fix API issues

* Fix a bunch of compile errors

* Fix `/plot flag remove`

* Fix initialization of GlobalFlagContainer

* Apply API changes to events

* Update SQLManager to new API

* Invert default value for DenyExitFlag

* Replace flag.getValue().toString() with flag.toString()

* Make FlagContainer instance in Plot final

* Fix various command issues

* Clean up PlotSettings

* Don't show internal flags in flag list

* Fix `/plot flag add`

* Remove the info inventory as it's 100% broken

* Add plot info entries and fix up the default format

* Fix default flag state in Captions

* 781c200 part 2

* Fix odd grammar in captions

* Fix odd grammar in captions v2

* Add create table statements for plot_flags

* Remove old flag references in SQLManager

* Use the new plot_flags table

* Add tab completion to `/plot flag`

* Improve parse error handling

* Make flag permission check recognize parse exceptions

* Initial progress towards flag conversion

* Fix minor issues

* Don't validate flags during flag conversion

* Allow unrecognized flags to be parsed

* Filter out internal flags from command sugguestions

* Use the wrong caption when there's no plot description set

* Limit command suggestions for boolean flags

* Make blocktypelistflags accept blockcategories

* Require categories to be prefixed with '#' and fix some minor display issues

* Fix plot database conversion

* Update PlotFlagEvent.java

Updated return description

* Fix command annotation wrapping

* Add FLAG_UPDATE event for FlagContainer listeners

* Make getParentContainer nullable

* Document castUnsafe in FlagContainer

* Document FlagContainer constructors

* Add missing documentation to FlagContainer

* Document FlagParseException

* Fix wording in FlagContainer javadoc

* Document InternalFlag

* Document PlotFlag

* Minor changes

* Remove revisit comments

Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
2020-02-24 18:42:02 +01:00
b99631f1bd Fix regen. Fixes #2692 2020-02-24 14:00:45 +01:00
6be26e8047 Also consider negative locations when cancelling liquid flow 2020-02-24 12:11:22 +01:00
c7de9379ad Prevent liquids from flowing out of block walls. Fixes #2598. 2020-02-24 11:47:52 +01:00
86ea69b65e Update README.md 2020-02-21 00:53:52 +01:00
f2aa9dccd1 Revert "Remove unused code"
This reverts commit 6d779dad05.
2020-02-20 20:08:25 +01:00
464f5e09ae Allow all messages to be formatted by external formatters and add PAPI support 2020-02-20 16:03:17 +01:00
17e4bde720 Update gradle version 2020-02-20 00:41:19 +01:00
6d779dad05 Remove unused code
Or at least I made it unused lul
2020-02-20 00:39:32 +01:00
38d0cc1b29 Fix isPremium method 2020-02-20 00:05:55 +01:00
fc9a221127 Update BukkitMain.java
wiz is quick
2020-02-20 00:02:06 +01:00
95394ec54f Add Premium verification 2020-02-19 23:55:43 +01:00
a3759f93a2 Add placeholders 2020-02-16 20:33:24 +01:00
2632283431 Move recent changes into 1 branch 2020-02-16 15:17:06 +01:00
8a014e3ad5 Remove wiki generator and unnencessary comments from the settings 2020-02-16 15:08:02 +01:00
1b3427837e Rename maven artifacts
Renaming the Core module artifact matchin its module name on GitHub, like the bukkit or nukkit module does.
Given that, it's more clear which maven artifact belongs to which module.
2020-02-16 14:42:27 +01:00
b3c91d866b Lazy cherry-pick 5db1e73eae4b0d4628df8bbbc172670c42d96435 without merge conflics 2020-02-16 14:41:51 +01:00
10dd531cdb Remove paper suggestion 2020-02-16 14:38:33 +01:00
6953187cac Add current + new version to update notification
And fix a little typo alongside bumping versioning to v5
2020-02-16 14:37:07 +01:00
7b83f0146e Readd update notification permission implementation 2020-02-16 02:34:51 +01:00
4ed108b5c0 Remove legacy auto updater (v3) 2020-02-16 01:36:24 +01:00
24b6b23d25 Bind update notifications to spigot resource updates
The notification permission could be moved back into the other class, but well
2020-02-16 01:33:43 +01:00
5ea03f12fb Update issue template 2020-02-14 17:54:45 +01:00
99a53cb005 DoogiePC doesn't like trees 2020-02-12 18:57:42 -05:00
d7af409d01 Test another workaround 2020-02-12 18:21:23 -05:00
0304e98b00 Workaround for SPIGOT-5574 2020-02-12 15:42:31 -05:00
b16db904cc Removed unused class which should be unbreaking. 2020-02-11 17:09:36 -05:00
4b306d454b Fixed an error with the debug command and added @NotNull to generator methods 2020-02-11 17:06:58 -05:00
e53ea2377c Fixed #2671
Sort of fixed. I added an if statement to log and return if a certain condition is met. It is unclear if there will be more generation issues as a result.
2020-02-11 16:52:16 -05:00
f79f2ac29e Tweaks to the world generator 2020-02-11 16:16:56 -05:00
1516edbeca Update dependencies
Changed gradle to new group id and repository. Updated paper-api to 1.15.2
2020-02-11 15:25:42 -05:00
54348d824c Update authors 2020-02-10 17:36:54 +01:00
f32cb0c16e Merge remote-tracking branch 'origin/dependabot/gradle/v4/org.projectlombok-lombok-1.18.12' into v4 2020-02-10 17:18:02 +01:00
4a03cb0701 Merge remote-tracking branch 'origin/dependabot/gradle/v4/org.ow2.asm-asm-7.3.1' into v4 2020-02-10 17:17:39 +01:00
76e25953b1 Bump lombok from 1.18.10 to 1.18.12
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.10 to 1.18.12.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.10...v1.18.12)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-10 08:03:18 +00:00
2f0bf97162 Fix displaying 1 player remove as players 2020-02-09 01:12:32 +01:00
d0b6badf09 Fix DebugClaimTest (#2667)
* Fix DebugClaimTest

* Remove code causing 3 database updates per plot + errors when using MySQL
2020-01-31 17:12:06 +00:00
30f37e1e8b Update /plot info placeholders 2020-01-27 23:39:29 +01:00
4e1c90bbcc Fixes space between names in plot info (Fixes #2675) 2020-01-27 23:06:42 +01:00
c31c855952 Update gradle version to 6.1 2020-01-24 18:47:32 +01:00
312b2ad1a8 Send the bStats ID 2020-01-24 18:10:19 +01:00
0953b5627e Add bStats plugin version
bStats 1.7 requires plugins to have an ID to submit data.
2020-01-24 16:08:48 +01:00
57af89f1d0 Merge pull request #2652 from SynergyMC/breaking
Revert teleportation behavior to pre-4.400
2020-01-22 21:23:25 -05:00
f71f481ff3 Compile against 1.15.2 2020-01-22 23:54:37 +01:00
0ba31ed56b Update dependencies fitting https pattern 2020-01-21 18:25:46 +01:00
edc81bc668 Updated branch names for gh actions testing 2020-01-21 15:52:57 +01:00
7797e33ec5 Update sponsors 2020-01-20 01:24:08 +01:00
118adb42b9 add hungarian translation 2020-01-14 12:27:23 +01:00
2efe604b9b Bump asm from 7.2 to 7.3.1
Bumps asm from 7.2 to 7.3.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-13 08:01:49 +00:00
cadd0cd9b4 Merge pull request #2660 from IntellectualSites/feature/v4/wildcards-player-args
Improve "everyone" args and update a few command messages
2020-01-10 19:40:01 +01:00
f3187a465c Oops 2020-01-10 19:38:38 +01:00
6fe856c002 Merge remote-tracking branch 'origin/dependabot/gradle/v4/junit-junit-4.13' into v4 2020-01-10 19:06:22 +01:00
9a626ea1de Deprecate metrics methods
Metrics are controlled via bstats config for some time now. The config option in settings.yml has already been deprecated in the past.
2020-01-10 14:18:38 +01:00
026233b7e7 Update gradlew 2020-01-10 14:07:33 +01:00
6ee9d91aef Update requriedTypes 2020-01-10 14:01:28 +01:00
808a1ed703 Add wildcards to command args 2020-01-10 13:35:59 +01:00
7142e9e0e3 deprecate metrics settings 2020-01-07 22:45:53 +01:00
66a2e5427e Bump junit from 4.12 to 4.13
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/master/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 07:40:34 +00:00
3aa554c52b Implemented optional specification of teleport causes
This should have backwards-compatibility for any users of the API but would require an update from anything reimplementing (for whatever reason) the interfaces amended by this commit.
2020-01-02 18:29:12 -10:00
4322f4c31d Merge pull request #2649 from IntellectualSites/dependabot/gradle/v4/org.ajoberstar.grgit-4.0.1
Bump org.ajoberstar.grgit from 4.0.0 to 4.0.1
2020-01-03 01:24:18 +01:00
33f8df3afe Add teleport cooldown bypass permission to plugin.yml 2020-01-03 01:12:48 +01:00
42a83b56c3 Add clarification of tp bypass permission node to settings.yml 2020-01-03 01:10:32 +01:00
0f39df0e0b Revert teleportation behavior to pre-4.400 2019-12-31 16:05:53 -10:00
a17588199f Merge pull request #1 from IntellectualSites/v4
Merge from upstream
2019-12-31 15:24:42 -10:00
fad835c029 Bump org.ajoberstar.grgit from 4.0.0 to 4.0.1
Bumps org.ajoberstar.grgit from 4.0.0 to 4.0.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-30 14:32:48 +00:00
568e9537ec Bump WorldEdit version to 7.0.1 2019-12-27 17:33:52 +01:00
58bb0509f7 Bump gradle version to 6.0.1 2019-12-27 17:01:17 +01:00
0ad2682210 Add update and jvm flags to debugpaste 2019-12-27 16:53:38 +01:00
f97e52ea0b Fixes building against 1.15 2019-12-25 10:40:54 +01:00
4c90523121 use 1.15 spigot 2019-12-25 02:39:41 +00:00
519d3ee2d6 Fix 'Unable to find method createTag' on 1.15 servers (#2642)
* Fix 'Unable to find method createTag' on 1.15 servers (#2629)

Mojang apparently refactored their NBT code in 1.15, so the NBT
parsing code in NbtFactory that used Mojang's NBT code via Reflection
broke. Since PlotSquared now depends on WorldEdit, it is much easier
to use their NBT parsing library than to update the Reflection-based
code.

* Clean up NBT streams properly
2019-12-23 20:35:37 +00:00
3abb35e506 Prevent NPE when trying to set statement = null in SQLManager
If the statement is null, the `isClosed` check will lead to a NPE. As it's going to be null either way, just ignoring the NPE has no side effects.
2019-12-20 18:01:36 +01:00
c6e36fd70e Fix plot biomes.
When migrating to the WorldEdit Biome types, code was not altered to account for these changes. This lead to configuration parsing breaking, and the `/plot setbiome` command no longer functioning. This fixes #2599.
2019-12-20 17:37:48 +01:00
ccc7b0ec65 Fix #2634 no such method error 2019-12-20 06:03:23 +00:00
4d1d3a165c Merge pull request #2635 from traksag/interact-fix
Fix interact handling for sneaking players
2019-12-18 22:23:42 -05:00
e54cf24248 Fix interact handling for sneaking players 2019-12-18 19:42:57 +01:00
7103969bba Merge pull request #2634 from traksag/hanging-fix
Fix that players cannot place hanging entities
2019-12-18 12:37:47 -05:00
3bb40a8fff Fix that players cannot place hanging entities 2019-12-17 21:04:44 +01:00
f4dcc9e786 Merge remote-tracking branch 'origin/breaking' into breaking 2019-12-15 13:08:27 -05:00
9fd29b264e Some logging operations to check for tps loss. 2019-12-15 13:08:02 -05:00
478c761750 More PlayerEvent fixes. 2019-12-15 12:53:16 -05:00
dbd6feed4e Update issue template and add link to suggestion repo on issue tab 2019-12-14 18:05:15 +01:00
480c9f11b8 Add 1.15 to templates 2019-12-14 17:46:07 +01:00
ed8fa0a2a5 Revert changes to BlockPlaceEvent 2019-12-10 17:53:55 -05:00
3af05e7960 Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking 2019-12-09 14:44:16 -05:00
07b6942690 Minor code tweaks 2019-12-09 14:43:53 -05:00
7d8a5213dd Bump okio from 2.2.2 to 2.4.1
Bumps [okio](https://github.com/square/okio) from 2.2.2 to 2.4.1.
- [Release notes](https://github.com/square/okio/releases)
- [Changelog](https://github.com/square/okio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okio/compare/2.2.2...2.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 19:34:28 +01:00
241589fdb0 Revert "Bump retrofit from 2.4.0 to 2.6.2"
This reverts commit 1097f44feb.
2019-12-07 18:56:43 +01:00
eb09e0a633 Bump okhttp from 3.12.0 to 4.2.2
Bumps [okhttp](https://github.com/square/okhttp) from 3.12.0 to 4.2.2.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-3.12.0...parent-4.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:49:39 +01:00
4e2c90e399 Bump gson from 2.8.0 to 2.8.6
Bumps [gson](https://github.com/google/gson) from 2.8.0 to 2.8.6.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/gson/compare/gson-parent-2.8.0...gson-parent-2.8.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:48:37 +01:00
1097f44feb Bump retrofit from 2.4.0 to 2.6.2
Bumps [retrofit](https://github.com/square/retrofit) from 2.4.0 to 2.6.2.
- [Release notes](https://github.com/square/retrofit/releases)
- [Changelog](https://github.com/square/retrofit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/retrofit/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:47:38 +01:00
e5423b5e08 Bump kotlin-stdlib from 1.3.50 to 1.3.61
Bumps [kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.3.50 to 1.3.61.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.3.61/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.3.50...v1.3.61)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:41:32 +01:00
4ba5b6da1d Bump annotations from 17.0.0 to 18.0.0
Bumps [annotations](https://github.com/JetBrains/java-annotations) from 17.0.0 to 18.0.0.
- [Release notes](https://github.com/JetBrains/java-annotations/releases)
- [Commits](https://github.com/JetBrains/java-annotations/compare/17.0.0...18.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:37:56 +01:00
c1a7844f4a Bump lombok from 1.18.8 to 1.18.10
Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.8 to 1.18.10.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](https://github.com/rzwitserloot/lombok/compare/v1.18.8...v1.18.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:36:45 +01:00
781a4d8d78 Bump org.ajoberstar.grgit from 3.1.1 to 4.0.0
Bumps org.ajoberstar.grgit from 3.1.1 to 4.0.0.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-07 18:35:23 +01:00
3ba29583fc Add all colors to style.yml
For further releases , we should aim to get a rid of the styles.yml and $ codes. I've seen a lot of people struggling with them, and if you want to use other formatting codes, you need to yamlize the non yamlized messages, otherwise it won't work properly.
2019-12-07 17:40:15 +01:00
7760631751 Remove deprecated method from Captions.java 2019-12-06 21:18:56 -05:00
05d6d557b8 Merge remote-tracking branch 'origin/breaking' into breaking 2019-12-06 21:16:19 -05:00
9925a320f5 Fix event listeners 2019-12-06 21:16:09 -05:00
dca5d84d29 Fixes #2620 2019-12-06 00:28:07 +01:00
0b470f8e01 Update links 2019-12-04 20:11:05 +01:00
7e58f4341e Minor fixes and performance improvement 2019-12-02 17:07:57 -05:00
d8933afb50 Merge remote-tracking branch 'origin/breaking' into breaking 2019-11-28 21:50:31 -05:00
4bb45fc220 Replace ByteArrayUtilities code with Guava and Replace PlotGameMode with WorldEdit equivalent. 2019-11-28 21:50:21 -05:00
09f913cba4 Enhanced Fixes #2595
Updating messages and adding new strings that fit better.
2019-11-28 19:02:58 +01:00
006d730185 Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking 2019-11-26 18:00:44 -05:00
cf558d8f62 Update DebugPaste.java 2019-11-25 22:40:50 +00:00
a65d546f3b Fix debugpaste split 2019-11-25 22:38:03 +00:00
bf02c9fe5f Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking 2019-11-25 22:37:39 +00:00
6908b9f29b Update bug-issue-report-for-plotsquared.md 2019-11-24 19:30:37 +01:00
cd06dbc915 Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking 2019-11-22 16:12:01 +00:00
977dfa807f potentially fix partial world auto 2019-11-22 16:11:48 +00:00
8b7e8ec635 Update bug-issue-report-for-plotsquared.md 2019-11-22 15:52:25 +01:00
c14e1d7add Update Settings.java 2019-11-22 12:40:27 +01:00
7377366372 Updating some debug colors 2019-11-22 12:28:34 +01:00
9c9841663a Fixes #2595 (leave error) 2019-11-19 01:39:51 +00:00
612e96201c Fixed ItemTypeListFlag issue 2019-11-18 13:43:16 -05:00
d7aa4a0e1f Revert "Fix some flag issues"
This reverts commit 8b741477
2019-11-18 13:41:46 -05:00
8b7414770f Fix some flag issues 2019-11-18 11:09:32 -05:00
a26ede4dae Typo 2019-11-14 12:54:02 -08:00
7591770c40 Update README.md 2019-11-14 12:48:41 -08:00
7623698a00 don't use legacy ids here 2019-11-12 22:31:02 +00:00
f518c47e09 Fixes #1922 Banned people can still "talk" in plot 2019-11-12 20:52:14 +00:00
c23086259d Potentially fixes rename issues
#2450
2019-11-12 20:48:33 +00:00
765a021ecd Some flag fixes
Use ItemType for the flags, since they accept items, not blocks.
Fixes #2571
2019-11-12 20:38:18 +00:00
7e21107120 Update README.md
Include information about what the project is. The previous README assumed that the reader would already be familiar with the concept, which isn't really ideal for a project description. The added text is taken from the Spigot resource page.
2019-11-12 10:20:46 +01:00
322e186c4b Ignore invalid blocks 2019-11-12 07:32:05 +00:00
59b8776814 Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking 2019-11-11 20:39:44 +00:00
5bb7069c7f Fixes #2571 2019-11-11 20:39:28 +00:00
1a2c15684e Fixed typo 2019-11-11 21:39:27 +01:00
b02565532f Update template checkbox 2019-11-11 21:38:44 +01:00
7d7414ebb9 Fix for single chance parsing 2019-11-11 19:47:26 +00:00
55d6217c32 Check if WORLDEDIT_RESTRICTIONS is enabled
Unregister if disabled.
2019-11-11 19:44:51 +00:00
1042 changed files with 83838 additions and 69570 deletions

387
.editorconfig Normal file
View File

@ -0,0 +1,387 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 130
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_wrap_on_typing = true
[*.java]
ij_java_align_consecutive_assignments = false
ij_java_align_consecutive_variable_declarations = false
ij_java_align_group_field_declarations = false
ij_java_align_multiline_annotation_parameters = false
ij_java_align_multiline_array_initializer_expression = false
ij_java_align_multiline_assignment = false
ij_java_align_multiline_binary_operation = false
ij_java_align_multiline_chained_methods = false
ij_java_align_multiline_extends_list = false
ij_java_align_multiline_for = true
ij_java_align_multiline_method_parentheses = false
ij_java_align_multiline_parameters = true
ij_java_align_multiline_parameters_in_calls = false
ij_java_align_multiline_parenthesized_expression = false
ij_java_align_multiline_records = true
ij_java_align_multiline_resources = true
ij_java_align_multiline_ternary_operation = false
ij_java_align_multiline_text_blocks = false
ij_java_align_multiline_throws_list = false
ij_java_align_subsequent_simple_methods = false
ij_java_align_throws_keyword = false
ij_java_annotation_parameter_wrap = off
ij_java_array_initializer_new_line_after_left_brace = false
ij_java_array_initializer_right_brace_on_new_line = false
ij_java_array_initializer_wrap = off
ij_java_assert_statement_colon_on_next_line = false
ij_java_assert_statement_wrap = off
ij_java_assignment_wrap = off
ij_java_binary_operation_sign_on_next_line = false
ij_java_binary_operation_wrap = off
ij_java_blank_lines_after_anonymous_class_header = 0
ij_java_blank_lines_after_class_header = 1
ij_java_blank_lines_after_imports = 1
ij_java_blank_lines_after_package = 1
ij_java_blank_lines_around_class = 1
ij_java_blank_lines_around_field = 0
ij_java_blank_lines_around_field_in_interface = 0
ij_java_blank_lines_around_initializer = 1
ij_java_blank_lines_around_method = 1
ij_java_blank_lines_around_method_in_interface = 1
ij_java_blank_lines_before_class_end = 1
ij_java_blank_lines_before_imports = 1
ij_java_blank_lines_before_method_body = 0
ij_java_blank_lines_before_package = 0
ij_java_block_brace_style = end_of_line
ij_java_block_comment_at_first_column = true
ij_java_call_parameters_new_line_after_left_paren = true
ij_java_call_parameters_right_paren_on_new_line = true
ij_java_call_parameters_wrap = on_every_item
ij_java_case_statement_on_separate_line = true
ij_java_catch_on_new_line = false
ij_java_class_annotation_wrap = split_into_lines
ij_java_class_brace_style = end_of_line
ij_java_class_count_to_use_import_on_demand = 100000
ij_java_class_names_in_javadoc = 1
ij_java_do_not_indent_top_level_class_members = false
ij_java_do_not_wrap_after_single_annotation = false
ij_java_do_while_brace_force = always
ij_java_doc_add_blank_line_after_description = true
ij_java_doc_add_blank_line_after_param_comments = false
ij_java_doc_add_blank_line_after_return = false
ij_java_doc_add_p_tag_on_empty_lines = true
ij_java_doc_align_exception_comments = true
ij_java_doc_align_param_comments = true
ij_java_doc_do_not_wrap_if_one_line = false
ij_java_doc_enable_formatting = true
ij_java_doc_enable_leading_asterisks = true
ij_java_doc_indent_on_continuation = true
ij_java_doc_keep_empty_lines = true
ij_java_doc_keep_empty_parameter_tag = true
ij_java_doc_keep_empty_return_tag = true
ij_java_doc_keep_empty_throws_tag = true
ij_java_doc_keep_invalid_tags = false
ij_java_doc_param_description_on_new_line = false
ij_java_doc_preserve_line_breaks = false
ij_java_doc_use_throws_not_exception_tag = true
ij_java_else_on_new_line = false
ij_java_enum_constants_wrap = split_into_lines
ij_java_extends_keyword_wrap = off
ij_java_extends_list_wrap = normal
ij_java_field_annotation_wrap = split_into_lines
ij_java_finally_on_new_line = false
ij_java_for_brace_force = always
ij_java_for_statement_new_line_after_left_paren = false
ij_java_for_statement_right_paren_on_new_line = false
ij_java_for_statement_wrap = off
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true
ij_java_if_brace_force = always
ij_java_imports_layout = *, |, javax.**, java.**, |, $*
ij_java_indent_case_from_switch = true
ij_java_insert_inner_class_imports = false
ij_java_insert_override_annotation = true
ij_java_keep_blank_lines_before_right_brace = 2
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
ij_java_keep_blank_lines_in_code = 2
ij_java_keep_blank_lines_in_declarations = 2
ij_java_keep_control_statement_in_one_line = true
ij_java_keep_first_column_comment = true
ij_java_keep_indents_on_empty_lines = false
ij_java_keep_line_breaks = true
ij_java_keep_multiple_expressions_in_one_line = false
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_classes_in_one_line = false
ij_java_keep_simple_lambdas_in_one_line = false
ij_java_keep_simple_methods_in_one_line = false
ij_java_label_indent_absolute = false
ij_java_label_indent_size = 0
ij_java_lambda_brace_style = end_of_line
ij_java_layout_static_imports_separately = true
ij_java_line_comment_add_space = false
ij_java_line_comment_at_first_column = true
ij_java_method_annotation_wrap = split_into_lines
ij_java_method_brace_style = end_of_line
ij_java_method_call_chain_wrap = on_every_item
ij_java_method_parameters_new_line_after_left_paren = true
ij_java_method_parameters_right_paren_on_new_line = true
ij_java_method_parameters_wrap = on_every_item
ij_java_modifier_list_wrap = false
ij_java_names_count_to_use_import_on_demand = 100000
ij_java_new_line_after_lparen_in_record_header = false
ij_java_parameter_annotation_wrap = off
ij_java_parentheses_expression_new_line_after_left_paren = false
ij_java_parentheses_expression_right_paren_on_new_line = false
ij_java_place_assignment_sign_on_next_line = false
ij_java_prefer_longer_names = false
ij_java_prefer_parameters_wrap = true
ij_java_record_components_wrap = normal
ij_java_repeat_synchronized = true
ij_java_replace_instanceof_and_cast = false
ij_java_replace_null_check = true
ij_java_replace_sum_lambda_with_method_ref = true
ij_java_resource_list_new_line_after_left_paren = false
ij_java_resource_list_right_paren_on_new_line = false
ij_java_resource_list_wrap = off
ij_java_rparen_on_new_line_in_record_header = false
ij_java_space_after_closing_angle_bracket_in_type_argument = false
ij_java_space_after_colon = true
ij_java_space_after_comma = true
ij_java_space_after_comma_in_type_arguments = true
ij_java_space_after_for_semicolon = true
ij_java_space_after_quest = true
ij_java_space_after_type_cast = true
ij_java_space_before_annotation_array_initializer_left_brace = false
ij_java_space_before_annotation_parameter_list = false
ij_java_space_before_array_initializer_left_brace = false
ij_java_space_before_catch_keyword = true
ij_java_space_before_catch_left_brace = true
ij_java_space_before_catch_parentheses = true
ij_java_space_before_class_left_brace = true
ij_java_space_before_colon = true
ij_java_space_before_colon_in_foreach = true
ij_java_space_before_comma = false
ij_java_space_before_do_left_brace = true
ij_java_space_before_else_keyword = true
ij_java_space_before_else_left_brace = true
ij_java_space_before_finally_keyword = true
ij_java_space_before_finally_left_brace = true
ij_java_space_before_for_left_brace = true
ij_java_space_before_for_parentheses = true
ij_java_space_before_for_semicolon = false
ij_java_space_before_if_left_brace = true
ij_java_space_before_if_parentheses = true
ij_java_space_before_method_call_parentheses = false
ij_java_space_before_method_left_brace = true
ij_java_space_before_method_parentheses = false
ij_java_space_before_opening_angle_bracket_in_type_parameter = false
ij_java_space_before_quest = true
ij_java_space_before_switch_left_brace = true
ij_java_space_before_switch_parentheses = true
ij_java_space_before_synchronized_left_brace = true
ij_java_space_before_synchronized_parentheses = true
ij_java_space_before_try_left_brace = true
ij_java_space_before_try_parentheses = true
ij_java_space_before_type_parameter_list = false
ij_java_space_before_while_keyword = true
ij_java_space_before_while_left_brace = true
ij_java_space_before_while_parentheses = true
ij_java_space_inside_one_line_enum_braces = false
ij_java_space_within_empty_array_initializer_braces = false
ij_java_space_within_empty_method_call_parentheses = false
ij_java_space_within_empty_method_parentheses = false
ij_java_spaces_around_additive_operators = true
ij_java_spaces_around_assignment_operators = true
ij_java_spaces_around_bitwise_operators = true
ij_java_spaces_around_equality_operators = true
ij_java_spaces_around_lambda_arrow = true
ij_java_spaces_around_logical_operators = true
ij_java_spaces_around_method_ref_dbl_colon = false
ij_java_spaces_around_multiplicative_operators = true
ij_java_spaces_around_relational_operators = true
ij_java_spaces_around_shift_operators = true
ij_java_spaces_around_type_bounds_in_type_parameters = true
ij_java_spaces_around_unary_operator = false
ij_java_spaces_within_angle_brackets = false
ij_java_spaces_within_annotation_parentheses = false
ij_java_spaces_within_array_initializer_braces = false
ij_java_spaces_within_braces = false
ij_java_spaces_within_brackets = false
ij_java_spaces_within_cast_parentheses = false
ij_java_spaces_within_catch_parentheses = false
ij_java_spaces_within_for_parentheses = false
ij_java_spaces_within_if_parentheses = false
ij_java_spaces_within_method_call_parentheses = false
ij_java_spaces_within_method_parentheses = false
ij_java_spaces_within_parentheses = false
ij_java_spaces_within_switch_parentheses = false
ij_java_spaces_within_synchronized_parentheses = false
ij_java_spaces_within_try_parentheses = false
ij_java_spaces_within_while_parentheses = false
ij_java_special_else_if_treatment = true
ij_java_subclass_name_suffix = Impl
ij_java_ternary_operation_signs_on_next_line = true
ij_java_ternary_operation_wrap = on_every_item
ij_java_test_name_suffix = Test
ij_java_throws_keyword_wrap = off
ij_java_throws_list_wrap = normal
ij_java_use_external_annotations = false
ij_java_use_fq_class_names = false
ij_java_use_relative_indents = false
ij_java_use_single_class_imports = true
ij_java_variable_annotation_wrap = off
ij_java_visibility = public
ij_java_while_brace_force = always
ij_java_while_on_new_line = false
ij_java_wrap_comments = false
ij_java_wrap_first_method_in_call_chain = true
ij_java_wrap_long_lines = false
[*.properties]
ij_properties_align_group_field_declarations = false
ij_properties_keep_blank_lines = false
ij_properties_key_value_delimiter = equals
ij_properties_spaces_around_key_value_delimiter = false
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.gradle.kts, *.kt, *.kts, *.main.kts}]
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_assignment_wrap = off
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 0
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
ij_kotlin_block_comment_at_first_column = true
ij_kotlin_call_parameters_new_line_after_left_paren = false
ij_kotlin_call_parameters_right_paren_on_new_line = false
ij_kotlin_call_parameters_wrap = off
ij_kotlin_catch_on_new_line = false
ij_kotlin_class_annotation_wrap = split_into_lines
ij_kotlin_continuation_indent_for_chained_calls = true
ij_kotlin_continuation_indent_for_expression_bodies = true
ij_kotlin_continuation_indent_in_argument_lists = true
ij_kotlin_continuation_indent_in_elvis = true
ij_kotlin_continuation_indent_in_if_conditions = true
ij_kotlin_continuation_indent_in_parameter_lists = true
ij_kotlin_continuation_indent_in_supertype_lists = true
ij_kotlin_else_on_new_line = false
ij_kotlin_enum_constants_wrap = off
ij_kotlin_extends_list_wrap = off
ij_kotlin_field_annotation_wrap = split_into_lines
ij_kotlin_finally_on_new_line = false
ij_kotlin_if_rparen_on_new_line = false
ij_kotlin_import_nested_classes = false
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_keep_blank_lines_before_right_brace = 2
ij_kotlin_keep_blank_lines_in_code = 2
ij_kotlin_keep_blank_lines_in_declarations = 2
ij_kotlin_keep_first_column_comment = true
ij_kotlin_keep_indents_on_empty_lines = false
ij_kotlin_keep_line_breaks = true
ij_kotlin_lbrace_on_next_line = false
ij_kotlin_line_comment_add_space = false
ij_kotlin_line_comment_at_first_column = true
ij_kotlin_method_annotation_wrap = split_into_lines
ij_kotlin_method_call_chain_wrap = off
ij_kotlin_method_parameters_new_line_after_left_paren = false
ij_kotlin_method_parameters_right_paren_on_new_line = false
ij_kotlin_method_parameters_wrap = off
ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_space_after_comma = true
ij_kotlin_space_after_extend_colon = true
ij_kotlin_space_after_type_colon = true
ij_kotlin_space_before_catch_parentheses = true
ij_kotlin_space_before_comma = false
ij_kotlin_space_before_extend_colon = true
ij_kotlin_space_before_for_parentheses = true
ij_kotlin_space_before_if_parentheses = true
ij_kotlin_space_before_lambda_arrow = true
ij_kotlin_space_before_type_colon = false
ij_kotlin_space_before_when_parentheses = true
ij_kotlin_space_before_while_parentheses = true
ij_kotlin_spaces_around_additive_operators = true
ij_kotlin_spaces_around_assignment_operators = true
ij_kotlin_spaces_around_equality_operators = true
ij_kotlin_spaces_around_function_type_arrow = true
ij_kotlin_spaces_around_logical_operators = true
ij_kotlin_spaces_around_multiplicative_operators = true
ij_kotlin_spaces_around_range = false
ij_kotlin_spaces_around_relational_operators = true
ij_kotlin_spaces_around_unary_operator = false
ij_kotlin_spaces_around_when_arrow = true
ij_kotlin_variable_annotation_wrap = off
ij_kotlin_while_on_new_line = false
ij_kotlin_wrap_elvis_expressions = 1
ij_kotlin_wrap_expression_body_functions = 0
ij_kotlin_wrap_first_method_in_call_chain = false
[*.json]
indent_size = 2
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = true
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false
[{*.htm, *.html, *.sht, *.shtm, *.shtml}]
ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p
ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span, pre, textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal
ij_html_uniform_ident = false
[{*.yaml, *.yml}]
indent_size = 2
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
* text=auto
*.java text
*.jar binary

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @IntellectualSites/plotsquared-team

View File

@ -1,28 +0,0 @@
__*NOTICE: Bukkit/Spigot versions 1.7.10 to 1.12.2 are considered legacy and will receive limited support. Please consider upgrading to 1.13 for future support. Plugins exist for 1.13+ that bring back old behaviors found in 1.8*__
# Bug report template
<!--- In order to create a valid issue report you have to follow this template. -->
<!--- Incomplete reports might be marked as invalid. -->
<!-- Feature requests and enhancements may be suggested at https://github.com/IntellectualSites/PlotSquaredSuggestions. -->
**Debug paste link:**
<!--- Enter /plot debugpaste in game or in your console and copy the output here -->
**[REQUIRED] Spigot/Paper Version Number:**
**[REQUIRED] Minecraft Version Number:**
**[REQUIRED] Description of the problem:**
**Any relevant console output or screenshots:**
**Plugins being used on the server:**
<!--- Optional but recommended --->
**How to replicate:**
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
**Checklist**:
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
- [] I included all information required in the sections above
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [] I made sure I am using an up-to-date version of PlotSquared
- [] I made sure the bug/error is not caused by any other plugin

View File

@ -1,90 +0,0 @@
---
name: Bug/Issue report for PlotSquared
about: Bug / Issue report about this plugin
title: ''
labels: "[?] Testing Required"
assignees: ''
---
<!--- READ THIS BEFORE SUBMITTING AN ISSUE REPORT!!! -->
<!--- ##### DO NOT REMOVE THIS TEMPLATE! YOUR ISSUE *WILL* FIT IN IT! ##### -->
# NOTICE:
```diff
! PlotSquared for Minecraft Java Edition versions between 1.7 through to 1.12.2 are considered
! legacy, and will receive limited to no support. Please consider upgrading to 1.13+ for
! future support. Plugins exist for 1.13+ which bring back behaviors found in 1.8.8
! All versions of PlotSquared for Sponge and Nukkit(X) will recieve limited to no support
! due to lack of developer interest and time. Additionally, NukkitX has not had feature
! updates since the Better Together, which prevents some PlotSquared features from ever
! functioning. Contributions are always welcome however!
```
**Feature requests & Suggestions are to be submitted at the [PlotSquared Suggestions tracker](https://github.com/IntellectualSites/PlotSquaredSuggestions)**
**Code contributions are to be done through [PRs](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request), tagging the specific issue ticket(s) if applicable.**
**[DISCORD INVITE LINK](https://discord.gg/cSMxtGn)** and please, for the love of the little sanity we have left, use the correct channels!
# BUG REPORT TEMPLATE:
<!--- Incomplete reports will most likely be marked as invalid, and closed, with few exceptions.-->
## Required Information section:
> ALL FIELDS IN THIS SECTION ARE REQUIRED, and must contain appropriate information
### Server config info (Debug/file paste links):
<!--- Issue /plot debugpaste in game or in your console and copy the supplied URL here -->
<!--- If you cannot perform the above, we require logs/latest.log; settings.yml; worlds.yml and possibly PlotSquared.use_THIS.yml -->
<!--- If you are unwilling to supply the information we need, we reserve the right to not assist you. Redact IP addresses if you need to. -->
### Server type:
**select one**
<!-- Select the type you are reporting the issue for (put an "X" between of brackets): -->
- [ ] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)*
- [ ] Sponge *- NOTE: NOT ACTIVELY MAINTAINED*
- [ ] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED*
### Minecraft Version:
**select one**
<!-- Select the type you are reporting the issue for (put an "X" between of brackets): -->
- [ ] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared***
- [ ] Minecraft 1.13.2
- [ ] Minecraft Java Edition *other versions, please specify*:
- [ ] Minecraft Bedrock Edition *speicify version*:
### Server build info:
<!--- Run /version in-game or in console & paste the full output here: -->
``` paste here, between the tick marks, replacing this text ```
### WorldEdit/FAWE versions:
<!--- Specify which plugin you are using, and add its version -->
- [ ] FAWE *version*:
- [ ] WorldEdit *version*:
### Description of the problem:
<!--- Be as specific as possible. Don't lie, redact information, or use false names/situations. -->
<!--- Who, What, When, Where, Why, How, Expected behavior, Resultant behavior, etc -->
### How to replicate:
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
## Additional Information:
> The information here is optional for you to provide, however it may help us to more readily diagnose any compatibility and bug issues.
### Other plugins being used on the server:
<!--- Optional but recommended - issue "/plugins" in-game or in console and copy/paste the list -->
### Relevant console output, log lines, and/or screenshots:
<!--- Please use in-line code insertion ( ```like this``` ) for short (20 lines or less) text blobs, or a paste service for large blobs -->
### Additional relevant comments/remarks:
<!--- Use this space to give us any additional information which may be relevant to this issue, such as: if you are using a Minecraft hosting provider; unusual installation environment; etc -->
# AFFIRMATION OF COMPLETION:
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
- [ ] I included all information required in the sections above
- [ ] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [ ] I made sure I am using an up-to-date version of PlotSquared
- [ ] I made sure the bug/error is not caused by any other plugin
- [x] I didn't read but checked everything above.

108
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,108 @@
name: Bug report
description: Create a report to help us improve
labels: 'Requires Testing'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report for PlotSquared! Fill out the following form to your best ability to help us fix the problem.
Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.gitbook.io/plotsquared/).
Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://github.com/IntellectualSites/PlotSquared/security/policy) GitHub form!
- type: dropdown
attributes:
label: Server Implementation
description: Which server Implementation are you using? If your server implementation is not listed, it is not supported. Switch to a supported version first.
multiple: false
options:
- Paper
- Spigot
validations:
required: true
- type: dropdown
attributes:
label: Server Version
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false
options:
- '1.20.4'
- '1.20'
- '1.19.4'
- '1.19.3'
- '1.19.2'
- '1.19.1'
- '1.19'
- '1.18.2'
- '1.18.1'
- '1.17.1'
- '1.16.5'
validations:
required: true
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce this behaviour
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: true
- type: textarea
attributes:
label: Expected behaviour
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Screenshots / Videos
description: If applicable, add screenshots to help explain your problem.
- type: input
attributes:
label: Error log (if applicable)
description: If you are reporting a console error, upload any relevant log excerpts to either https://paste.gg/ or https://gist.github.com, save and the paste the link in this box.
- type: input
attributes:
label: Plot Debugpaste
description: Run `/plot debugpaste` in your console or ingame and provide the output link here.
validations:
required: true
- type: input
attributes:
label: PlotSquared Version
description: What version of PlotSquared are you running? (`/version PlotSquared`)
placeholder: "For example: PlotSquared version 5.13.11-Premium"
validations:
required: true
- type: checkboxes
attributes:
label: Checklist
description: Make sure you have followed each of the steps outlined here.
options:
- label: I have included a Plot debugpaste.
required: true
- label: I am using the newest build from https://www.spigotmc.org/resources/77506/ and the issue still persists.
required: true
- type: textarea
attributes:
label: Anything else?
description: You can provide additional context below.

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: IntellectualSites Discord
url: https://discord.gg/intellectualsites
about: Our support Discord, please ask questions and seek support here.
- name: PlotSquared Wiki
url: https://intellectualsites.gitbook.io/plotsquared/
about: Take a look at the wiki page for instructions how to setup PlotSquared and use its commands.

View File

@ -0,0 +1,29 @@
name: Feature request
description: Suggest an idea for this project
labels: 'Enhancement'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request for PlotSquared! Fill out the following form to your best ability to help us understand your feature request and greately improve the change of it getting added.
For anything else than a feature request, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.gitbook.io/plotsquared/).
- type: textarea
attributes:
label: What feature do you want to see added?
description: A clear and concise description of your feature request.
validations:
required: true
- type: textarea
attributes:
label: Are there any alternatives?
description: List any alternatives you might have tried
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: You can provide additional context below.

View File

@ -1,17 +0,0 @@
## Overview
<!-- Please describe which issue this Pull Request targets
If there is no issue, please create one so we can look into it before approving your PR.
You can do so here: https://github.com/IntellectualSites/PlotSquared/issues/new/choose
-->
**Fixes #{issue number}**
## Description
## Checklist
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
- [] I included all information required in the sections above
- [] I tested my changes and approved their functionality
- [] I ensured my changes do not break other parts of the code
- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/PlotSquared/blob/breaking/CONTRIBUTING.md)

View File

@ -1,8 +0,0 @@
# Comment to a new issue.
issueOpened: >
Thank your for raising a issue. We will try and get back to you as soon as possible.
Please make sure that you followed the issue template, and provided all neccessary information.
Failure to do so will prevent us from resolving the issue in a timely manner.
Please note that suggestions are now to be submitted to https://git.io/fN5B4 rather than this issue tracker!

1
.github/release-drafter.yml vendored Normal file
View File

@ -0,0 +1 @@
_extends: .github

19
.github/renovate.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommitsDisabled"
],
"automerge": true,
"labels": [
"dependencies"
],
"rebaseWhen": "conflicted",
"schedule": ["on the first day of the month"],
"ignoreDeps": [
"com.google.code.gson:gson",
"com.google.guava:guava",
"org.yaml:snakeyaml",
"org.apache.logging.log4j:log4j-api"
]
}

26
.github/stale.yml vendored
View File

@ -1,16 +1,18 @@
# Number of days of inactivity before an issue becomes stale daysUntilStale: 30
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7 daysUntilClose: 7
# Issues with these labels will never be considered stale only: issues
exemptLabels: exemptLabels:
- [‼] high priority - "Bug"
# Label to use when marking an issue as stale - "Enhancement"
staleLabel: Old - "Approved"
# Comment to post when marking an issue as stale. Set to `false` to disable - "Priority"
- "Under investigation"
staleLabel: "resolution: stale"
markComment: > markComment: >
This issue has been automatically marked as stale because it has not had This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you recent activity. It will be closed if no further activity occurs. If the issue is still present and can be reproduced, please let the team know.
for your contributions. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable closeComment: >
closeComment: false This issue has been automatically closed because it has not had activity in
a long time. If the issue still applies to the most recent supported
version, please reply to this issue and the team will reopen it.

View File

@ -0,0 +1,24 @@
name: Announce release on discord
on:
release:
types: [ published ]
jobs:
send_announcement:
runs-on: ubuntu-latest
steps:
- name: send custom message with args
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: PlotSquared Release
DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png
uses: Ilshidur/action-discord@0.3.2
with:
args: |
"<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>"
""
"<:plotsquared:730750385886593039> **PlotSquared ${{ github.event.release.tag_name }} has been released!**"
""
"Click here to view changelog: https://github.com/IntellectualSites/PlotSquared/releases/tag/${{ github.event.release.tag_name }}"
""
"The download is available at:"
"- Spigot: <https://www.spigotmc.org/resources/77506/>"

21
.github/workflows/build-pr.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Build PR
on: [ pull_request ]
jobs:
build_pr:
if: github.repository_owner == 'IntellectualSites'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Clean Build
run: ./gradlew clean build

67
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,67 @@
name: build
on:
push:
branches:
- main
jobs:
build:
if: github.repository_owner == 'IntellectualSites'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Clean Build
run: ./gradlew clean build
- name: Determine release status
if: ${{ runner.os == 'Linux' }}
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Publish Release
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Publish Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: ./gradlew publishToSonatype
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish core javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: 'Core/build/docs/javadoc'
destination-github-username: 'IntellectualSites'
destination-repository-name: 'plotsquared-javadocs'
user-email: ${{ secrets.USER_EMAIL }}
target-branch: main
target-directory: v7/core
- name: Publish bukkit javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: 'Bukkit/build/docs/javadoc'
destination-github-username: 'IntellectualSites'
destination-repository-name: 'plotsquared-javadocs'
user-email: ${{ secrets.USER_EMAIL }}
target-branch: main
target-directory: v7/bukkit

36
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

View File

@ -1,24 +0,0 @@
name: Java CI
on:
push:
branches:
- breaking
- master
pull_request:
branches:
- breaking
- master
jobs:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Test with Gradle
run: ./gradlew clean build

View File

@ -0,0 +1,23 @@
name: "Label conflicting PRs"
on:
push:
pull_request_target:
types: [ synchronize ]
pull_request:
types: [ synchronize ]
permissions:
pull-requests: write
jobs:
main:
if: github.event.pull_request.user.login != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Label conflicting PRs
uses: eps1lon/actions-label-merge-conflict@v2.1.0
with:
dirtyLabel: "unresolved-merge-conflict"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
commentOnDirty: "Please take a moment and address the merge conflicts of your pull request. Thanks!"
continueOnMissingPermissions: true

17
.github/workflows/release-drafter.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: draft release
on:
push:
branches:
- main
pull_request:
types: [ opened, reopened, synchronize ]
pull_request_target:
types: [ opened, reopened, synchronize ]
jobs:
update_release_draft:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

285
.gitignore vendored
View File

@ -1,143 +1,142 @@
### Others ### ### Others ###
*.cmd *.cmd
*.sh *.sh
*.prefs *.prefs
Sponge/build Core/build
Core/build
Bukkit/build ### Maven ###
Nukkit/build /mvn
/target/lib
### Maven ### /target/maven-archiver
/mvn /target/classes
/target/lib /target/maven-status
/target/maven-archiver pom.xml.tag
/target/classes pom.xml.releaseBackup
/target/maven-status pom.xml.versionsBackup
pom.xml.tag pom.xml.next
pom.xml.releaseBackup release.properties
pom.xml.versionsBackup dependency-reduced-pom.xml
pom.xml.next buildNumber.properties
release.properties .mvn/timing.properties
dependency-reduced-pom.xml out/
buildNumber.properties
.mvn/timing.properties
out/ ### Java ###
*.class
### Java ### # Mobile Tools for Java (J2ME)
*.class .mtj.tmp/
# Mobile Tools for Java (J2ME) # Package Files #
.mtj.tmp/ *.war
*.ear
# Package Files #
*.war # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
*.ear hs_err_pid*
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid* ### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
### Intellij ### *.iml
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
## Directory-based project format:
*.iml /.idea/*
!/.idea/icon.svg
## Directory-based project format: # if you remove the above rule, at least ignore the following:
.idea/
# if you remove the above rule, at least ignore the following: # User-specific stuff:
# .idea/workspace.xml
# User-specific stuff: # .idea/tasks.xml
# .idea/workspace.xml # .idea/dictionaries
# .idea/tasks.xml # .idea/shelf
# .idea/dictionaries
# .idea/shelf # Sensitive or high-churn files:
# .idea/dataSources.ids
# Sensitive or high-churn files: # .idea/dataSources.xml
# .idea/dataSources.ids # .idea/sqlDataSources.xml
# .idea/dataSources.xml # .idea/dynamic.xml
# .idea/sqlDataSources.xml # .idea/uiDesigner.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml # Gradle:
# .idea/gradle.xml
# Gradle: # .idea/libraries
# .idea/gradle.xml .gradle
# .idea/libraries
.gradle # Mongo Explorer plugin:
# .idea/mongoSettings.xml
# Mongo Explorer plugin:
# .idea/mongoSettings.xml ## File-based project format:
*.ipr
## File-based project format: *.iws
*.ipr
*.iws ## Plugin-specific files:
## Plugin-specific files: # IntelliJ
/out/
# IntelliJ
/out/ # JIRA plugin
atlassian-ide-plugin.xml
# mpeltonen/sbt-idea plugin
.idea_modules/ # Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
# JIRA plugin crashlytics.properties
atlassian-ide-plugin.xml crashlytics-build.properties
fabric.properties
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties ### Eclipse ###
crashlytics-build.properties *.pydevproject
fabric.properties .metadata
bin/
tmp/
### Eclipse ### *.tmp
*.pydevproject *.bak
.metadata *.swp
bin/ *~.nib
tmp/ local.properties
*.tmp .settings/
*.bak .loadpath
*.swp
*~.nib # Eclipse Core
local.properties .project
.settings/
.loadpath # External tool builders
.externalToolBuilders/
# Eclipse Core
.project # Locally stored "Eclipse launch configurations"
*.launch
# External tool builders
.externalToolBuilders/ # CDT-specific
.cproject
# Locally stored "Eclipse launch configurations"
*.launch # JDT-specific (Eclipse Java Development Tools)
.classpath
# CDT-specific
.cproject # Java annotation processor (APT)
.factorypath
# JDT-specific (Eclipse Java Development Tools)
.classpath # PDT-specific
.buildpath
# Java annotation processor (APT)
.factorypath # sbteclipse plugin
.target
# PDT-specific
.buildpath # TeXlipse plugin
.texlipse
# sbteclipse plugin
.target # STS (Spring Tool Suite)
.springBeans
# TeXlipse plugin /target/
.texlipse checkstyle.xml
classes/
# STS (Spring Tool Suite) *.bat
.springBeans
/target/ # Other
Nukkit/build/classes/ docs/
Nukkit/build/dependency-cache/ build/
checkstyle.xml
classes/ .DS_Store
p2error.txt # Ignore run folders
*.bat run-[0-9].[0-9][0-9]/
Nukkit/build/resources/main/plugin.yml run-[0-9].[0-9][0-9].[0-9]/
docs/

146
.idea/icon.svg generated Normal file
View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
id="svg2"
xml:space="preserve"
width="512"
height="512"
viewBox="0 0 512 512.00001"
sodipodi:docname="icon.svg"
inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath18">
<path
d="M 0,2500 H 3000 V 0 H 0 Z"
id="path16" />
</clipPath>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1440"
inkscape:window-height="900"
id="namedview4"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="0.1632"
inkscape:cx="1087.6225"
inkscape:cy="1666.6666"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="g10" />
<g
id="g10"
inkscape:groupmode="layer"
inkscape:label="PlotSquared"
transform="matrix(1.3333333,0,0,-1.3333333,0,3333.3333)">
<g
id="g12"
transform="matrix(0.16955078,0,0,0.16955078,-68.456969,2101.8529)">
<g
id="g14"
clip-path="url(#clipPath18)">
<g
id="g20"
transform="translate(1486.1511,2242.6453)">
<path
d="m 0,0 c 16.533,10.846 33.211,21.453 50.104,31.699 78.972,-48.281 153.985,-102.704 227.269,-159.144 148.61,-115.422 287.884,-243.01 414.393,-382.333 111.39,-122.861 212.751,-255.152 298.898,-396.971 52.744,-87.322 100.544,-177.884 139.514,-272.214 -11.638,-3.551 -23.108,-7.655 -34.362,-12.286 l -0.24,0.288 c -11.135,12.982 -24.141,24.212 -34.915,37.506 -22.557,23.013 -45.425,45.737 -68.03,68.678 -19.725,20.253 -40.601,39.45 -58.958,60.974 -36.355,36.451 -72.517,73.093 -108.944,109.471 -22.628,26.013 -48.064,49.385 -71.965,74.197 -19.029,19.485 -38.706,38.346 -57.519,57.999 -12.166,14.998 -26.684,27.716 -39.93,41.658 -27.668,27.524 -54.903,55.479 -82.571,82.979 -23.924,27.956 -51.664,52.264 -76.692,79.164 -4.68,4.487 -8.855,10.774 -15.886,11.326 -22.34,34.027 -58.311,57.327 -97.377,67.502 -104.312,99.153 -215.487,191.202 -332.661,274.782 -117.942,-83.94 -229.476,-176.781 -334.484,-276.39 -26.684,-0.024 -53.368,0.024 -80.076,-0.024 0.024,-26.564 0.048,-53.104 0,-79.668 -72.229,-73.021 -139.491,-150.937 -202.385,-232.092 -63.758,-82.619 -121.973,-169.51 -173.541,-260.264 131.932,-69.061 257.864,-149.521 375.926,-240.275 0.096,-26.444 -0.12,-52.888 0.096,-79.332 l 0.744,-0.984 c 20.109,-24.14 43.409,-45.233 65.126,-67.861 15.118,-15.382 30.571,-30.404 45.569,-45.881 17.565,-20.733 37.698,-39.042 56.607,-58.503 19.917,-20.781 41.25,-40.218 59.967,-62.151 29.156,-29.299 58.167,-58.815 87.515,-87.922 29.155,-33.043 61.502,-63.111 92.169,-94.738 13.726,-12.67 25.124,-27.571 38.634,-40.457 25.029,-25.365 50.129,-50.657 75.325,-75.853 -37.914,-51.208 -73.741,-103.952 -107.192,-158.183 -167.83,273.317 -397.235,507.305 -662.37,687.158 -81.875,55.335 -167.23,105.584 -255.681,149.641 -52.815,26.276 -106.831,50.248 -162.239,70.381 99.393,233.628 242.795,446.715 410.289,636.79 93.562,106.088 194.634,205.433 301.466,298.13 C -217.335,-155.808 -111.439,-73.789 0,0"
style="fill:#062f4c;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path22" />
</g>
<g
id="g24"
transform="translate(1201.7948,1741.5303)">
<path
d="M 0,0 C 105.008,99.609 216.543,192.45 334.485,276.39 451.659,192.81 562.833,100.76 667.146,1.608 c -34.987,8.83 -71.51,9.718 -107.264,6.431 -41.202,-4.296 -82.907,-19.077 -112.543,-48.953 -33.019,-32.155 -49.456,-77.604 -55.311,-122.501 -28.124,27.908 -56.104,55.983 -84.035,84.083 -2.976,2.976 -6.839,4.823 -10.391,6.911 -19.029,26.348 -45.953,46.673 -76.62,57.495 C 187.555,-2.472 151.513,-0.12 116.166,0 Z"
style="fill:#4c8fcc;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path26" />
</g>
<g
id="g28"
transform="translate(919.3342,1429.7462)">
<path
d="m 0,0 c 62.894,81.156 130.156,159.072 202.385,232.092 0.048,-244.21 0.024,-488.421 0,-732.631 C 84.323,-409.785 -41.61,-329.325 -173.541,-260.264 -121.973,-169.51 -63.758,-82.619 0,0"
style="fill:#4c8fcc;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path30" />
</g>
<g
id="g32"
transform="translate(1649.134,1700.6166)">
<path
d="m 0,0 c 29.635,29.875 71.341,44.657 112.543,48.952 35.754,3.288 72.277,2.4 107.263,-6.431 39.066,-10.174 75.037,-33.474 97.377,-67.501 11.879,-17.661 20.181,-37.411 26.42,-57.687 10.871,-38.802 11.95,-79.356 11.446,-119.358 -44.345,-0.072 -88.69,0.048 -133.035,-0.072 -1.032,30.907 3.263,63.686 -10.175,92.626 -9.526,20.325 -32.107,31.243 -53.751,32.131 -21.453,1.44 -45.065,-4.32 -59.175,-21.597 -12.79,-15.861 -15.382,-37.002 -16.558,-56.655 -1.295,-29.132 3.696,-59.031 17.518,-84.923 16.821,-30.619 39.378,-57.783 64.526,-81.9 31.387,-32.634 67.501,-60.374 97.857,-94.041 27.332,-28.988 51.256,-61.479 68.005,-97.785 20.541,-41.13 26.972,-87.827 25.82,-133.372 -0.912,-32.107 -5.231,-64.406 -16.149,-94.737 -11.59,-31.699 -31.123,-61.047 -58.335,-81.371 -25.124,-19.125 -55.696,-29.852 -86.651,-34.771 -49.552,-6.743 -101.888,-4.847 -148.465,14.854 -35.227,14.829 -64.238,42.689 -81.708,76.548 -20.996,40.242 -27.115,86.339 -27.259,131.212 0.048,17.829 0,35.658 0.048,53.463 44.345,0.048 88.69,-0.023 133.059,0.048 1.728,-35.538 -4.055,-72.06 5.663,-106.807 5.783,-22.173 26.204,-37.794 48.185,-41.754 20.733,-3.431 43.577,-2.015 61.622,9.791 15.502,9.43 23.949,26.78 26.78,44.225 5.903,35.922 1.872,74.293 -15.381,106.688 -16.918,30.595 -39.474,57.711 -64.55,81.899 -33.187,34.099 -71.173,63.254 -102.585,99.081 -26.756,28.867 -49.408,61.646 -65.486,97.641 -24.572,52.48 -26.731,112.422 -20.18,169.102 C -49.456,-77.604 -33.019,-32.155 0,0"
style="fill:#feeeee;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path34" />
</g>
<g
id="g36"
transform="translate(1262.7214,1613.126)">
<path
d="m 0,0 v -301.13 c 23.204,0.024 46.409,-0.048 69.613,0.024 18.525,0.288 38.202,6.575 50.153,21.429 12.43,17.277 13.917,39.522 14.613,60.111 0.024,43.985 -0.048,87.994 0.024,131.979 -0.48,23.637 -0.983,50.369 -17.277,69.23 C 104.864,-5.711 86.867,-0.24 69.589,0 46.385,0.048 23.204,0.024 0,0 m -141.002,128.38 c 26.708,0.048 53.392,0 80.075,0.024 H 55.24 c 35.346,-0.12 71.389,-2.471 104.815,-14.925 30.668,-10.823 57.592,-31.148 76.621,-57.496 26.852,-39.09 36.69,-87.202 38.058,-133.947 0.024,-48.833 0.096,-97.689 -0.024,-146.521 -1.728,-47.993 -11.974,-97.953 -41.514,-136.971 -22.748,-30.644 -57.495,-50.801 -94.281,-59.583 -45.377,-11.878 -92.578,-6.791 -138.891,-7.847 -0.072,-111.799 0,-223.574 -0.024,-335.373 -13.942,0 -27.86,0.024 -41.778,-0.024 -32.802,0.072 -65.605,0 -98.384,0.048 l -0.744,0.984 c -0.216,26.444 0,52.888 -0.096,79.332 0.024,244.211 0.048,488.421 0,732.632 0.048,26.563 0.024,53.103 0,79.667"
style="fill:#feeeee;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path38" />
</g>
<g
id="g40"
transform="translate(1966.3174,1675.6364)">
<path
d="m 0,0 c 7.031,-0.552 11.206,-6.839 15.885,-11.326 25.029,-26.9 52.768,-51.208 76.693,-79.164 27.667,-27.5 54.903,-55.456 82.571,-82.979 13.246,-13.942 27.764,-26.66 39.93,-41.658 18.813,-19.653 38.49,-38.514 57.519,-57.999 23.9,-24.812 49.337,-48.185 71.965,-74.197 36.427,-36.378 72.589,-73.02 108.943,-109.471 18.358,-21.524 39.234,-40.722 58.959,-60.974 22.605,-22.941 45.473,-45.665 68.03,-68.678 10.774,-13.294 23.78,-24.524 34.914,-37.506 -103.904,-41.97 -203.488,-94.114 -298.922,-152.761 -246.994,-152.28 -466.224,-350.298 -639.333,-583.398 -25.197,25.196 -50.297,50.488 -75.325,75.852 -13.51,12.886 -24.908,27.788 -38.634,40.458 -30.667,31.627 -63.014,61.695 -92.17,94.738 -29.347,29.107 -58.359,58.623 -87.514,87.922 -18.717,21.933 -40.05,41.37 -59.967,62.151 -18.909,19.461 -39.042,37.77 -56.607,58.503 -14.998,15.477 -30.452,30.499 -45.569,45.88 -21.717,22.629 -45.017,43.722 -65.126,67.862 32.779,-0.048 65.582,0.024 98.384,-0.048 114.391,-98.097 220.407,-205.984 315.384,-322.99 92.914,114.318 196.242,220.022 307.753,316.271 30.955,4.919 61.526,15.646 86.65,34.771 27.212,20.325 46.745,49.672 58.335,81.371 107.312,77.988 219.327,149.929 337.509,210.376 -35.299,64.67 -75.829,126.437 -118.254,186.643 C 176.253,-228.037 104.24,-140.115 26.42,-57.687 20.181,-37.41 11.878,-17.661 0,0"
style="fill:#042338;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path42" />
</g>
<g
id="g44"
transform="translate(1499.3971,1669.1094)">
<path
d="m 0,0 c 3.551,-2.088 7.415,-3.935 10.39,-6.911 27.932,-28.1 55.912,-56.175 84.036,-84.083 -6.551,-56.679 -4.392,-116.622 20.18,-169.102 16.078,-35.994 38.73,-68.774 65.486,-97.641 31.412,-35.826 69.398,-64.982 102.585,-99.081 25.076,-24.188 47.632,-51.304 64.55,-81.899 17.253,-32.395 21.284,-70.765 15.381,-106.688 -2.831,-17.445 -11.278,-34.794 -26.78,-44.225 -18.045,-11.806 -40.889,-13.222 -61.622,-9.79 -21.981,3.959 -42.402,19.58 -48.185,41.753 -9.718,34.747 -3.935,71.269 -5.663,106.808 -44.369,-0.072 -88.714,0 -133.059,-0.048 -0.048,-17.806 0,-35.635 -0.048,-53.464 0.144,-44.873 6.263,-90.97 27.259,-131.212 17.47,-33.859 46.481,-61.718 81.708,-76.548 46.577,-19.701 98.913,-21.597 148.465,-14.854 -111.511,-96.249 -214.839,-201.953 -307.753,-316.271 -94.977,117.006 -200.993,224.893 -315.383,322.99 13.918,0.048 27.836,0.024 41.777,0.024 0.024,111.799 -0.048,223.574 0.024,335.372 46.313,1.056 93.514,-4.031 138.891,7.847 36.786,8.783 71.533,28.94 94.282,59.583 29.539,39.018 39.785,88.978 41.513,136.971 0.12,48.833 0.048,97.689 0.024,146.522 C 36.69,-87.203 26.852,-39.09 0,0"
style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path46" />
</g>
<g
id="g48"
transform="translate(1748.0469,1601.6797)">
<path
d="M 0,0 C 14.11,17.277 37.722,23.036 59.175,21.597 80.82,20.709 103.4,9.791 112.927,-10.534 c 13.438,-28.94 9.142,-61.719 10.174,-92.626 44.345,0.12 88.691,0 133.036,0.072 0.504,40.002 -0.576,80.556 -11.447,119.358 77.82,-82.428 149.833,-170.35 215.583,-262.664 42.426,-60.207 82.956,-121.973 118.254,-186.643 -118.182,-60.447 -230.196,-132.388 -337.508,-210.376 10.918,30.331 15.238,62.63 16.149,94.737 1.152,45.545 -5.279,92.242 -25.82,133.372 -16.749,36.306 -40.673,68.797 -68.005,97.785 -30.355,33.667 -66.47,61.406 -97.857,94.041 -25.148,24.117 -47.705,51.28 -64.526,81.9 -13.822,25.892 -18.813,55.791 -17.517,84.923 C -15.382,-37.002 -12.79,-15.862 0,0"
style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path50" />
</g>
<g
id="g52"
transform="translate(1262.7214,1613.126)">
<path
d="m 0,0 c 23.204,0.024 46.385,0.048 69.589,0 17.278,-0.24 35.275,-5.711 47.537,-18.357 16.294,-18.861 16.797,-45.593 17.277,-69.23 -0.072,-43.985 0,-87.994 -0.024,-131.979 -0.696,-20.589 -2.183,-42.834 -14.613,-60.111 -11.951,-14.854 -31.628,-21.141 -50.153,-21.429 -23.204,-0.072 -46.409,0 -69.613,-0.024 z"
style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none"
id="path54" />
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,105 +0,0 @@
plugins {
id "com.github.johnrengelman.shadow"
}
repositories {
maven { url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = "http://nexus.hc.to/content/repositories/pub_releases" }
maven { url = "https://repo.codemc.org/repository/maven-public" }
maven {
name = "papermc"
url = "https://papermc.io/repo/repository/maven-public/"
}
mavenLocal()
}
dependencies {
implementation(project(":Core"))
compile(project(":Core"))
compile("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT")
//implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT'
implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT")
compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0")
compile("io.papermc:paperlib:1.0.2")
compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0")
implementation("net.kyori:text-adapter-bukkit:3.0.3")
compile("net.milkbowl.vault:VaultAPI:1.7") {
exclude(module: "bukkit")
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {
from("src/main/resources") {
include("plugin.yml")
expand(
name: project.parent.name,
version: project.parent.version
)
}
}
//noinspection GroovyAssignabilityCheck
jar.archiveFileName = "PlotSquared-BukkitAPI-${project.parent.version}.jar"
jar.destinationDirectory = file("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/" + project.parent.version)
task createPom {
doLast {
pom {
project {
groupId = "com.github.intellectualsites.plotsquared"
artifactId = "PlotSquared-BukkitAPI"
version = project.parent.version
}
}.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/${project.parent.version}/PlotSquared-BukkitAPI-${project.parent.version}.pom")
pom {
project {
groupId = "com.github.intellectualsites.plotsquared"
artifactId = "PlotSquared-BukkitAPI"
version = "latest"
}
}.writeTo("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/latest/PlotSquared-BukkitAPI-latest.pom")
}
}
task copyFiles {
doLast {
copy {
from("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/${project.parent.version}/")
into("../mvn/com/github/intellectualsites/plotsquared/PlotSquared-BukkitAPI/latest/")
include("PlotSquared-BukkitAPI*.jar")
rename("PlotSquared-BukkitAPI-${project.parent.version}.jar", "PlotSquared-BukkitAPI-latest.jar")
}
}
}
shadowJar {
dependencies {
include(dependency(":Core"))
// update notification stuff
include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT"))
include(dependency("com.squareup.retrofit2:retrofit:2.4.0"))
include(dependency("com.squareup.okhttp3:okhttp:3.12.0"))
include(dependency("com.squareup.okio:okio:2.2.2"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50"))
include(dependency("io.papermc:paperlib:1.0.2"))
include(dependency("net.kyori:text-adapter-bukkit:3.0.3"))
}
relocate('net.kyori.text', 'com.github.intellectualsites.plotsquared.formatting.text')
relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib")
// relocate('org.mcstats', 'com.plotsquared.stats')
archiveFileName = "${parent.name}-${project.name}-${parent.version}.jar"
destinationDirectory = file "../target"
}
shadowJar.doLast {
task ->
ant.checksum file: task.archivePath
}
build.dependsOn(shadowJar)
build.finalizedBy(copyFiles)
copyFiles.dependsOn(createPom)

117
Bukkit/build.gradle.kts Normal file
View File

@ -0,0 +1,117 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
repositories {
maven {
name = "PlaceholderAPI"
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
maven {
name = "PaperMC"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = "EssentialsX"
url = uri("https://repo.essentialsx.net/releases/")
}
}
dependencies {
api(projects.plotsquaredCore)
// Metrics
implementation(libs.bstatsBukkit)
// Paper
compileOnly(libs.paper)
implementation(libs.paperlib)
// Plugins
compileOnly(libs.worldeditBukkit) {
exclude(group = "org.bukkit")
exclude(group = "org.spigotmc")
}
compileOnly(libs.faweBukkit) { isTransitive = false }
testImplementation(libs.faweBukkit) { isTransitive = false }
compileOnly(libs.vault) {
exclude(group = "org.bukkit")
}
compileOnly(libs.placeholderapi)
compileOnly(libs.luckperms)
compileOnly(libs.essentialsx)
compileOnly(libs.mvdwapi) { isTransitive = false }
// Other libraries
implementation(libs.squirrelid) { isTransitive = false }
implementation(libs.serverlib)
// Our libraries
implementation(libs.arkitektonika)
implementation(libs.paster)
implementation(libs.informativeAnnotations)
// Adventure
implementation(libs.adventureBukkit)
}
tasks.processResources {
filesMatching("plugin.yml") {
expand("version" to project.version)
}
}
tasks.named<ShadowJar>("shadowJar") {
dependsOn(":plotsquared-core:shadowJar")
dependencies {
exclude(dependency("org.checkerframework:"))
}
relocate("net.kyori.option", "com.plotsquared.core.configuration.option")
relocate("net.kyori.adventure", "com.plotsquared.core.configuration.adventure")
relocate("net.kyori.examination", "com.plotsquared.core.configuration.examination")
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
relocate("org.bstats", "com.plotsquared.metrics")
relocate("org.enginehub", "com.plotsquared.squirrelid")
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
relocate("com.google.inject", "com.plotsquared.google")
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
relocate("cloud.commandframework.services", "com.plotsquared.core.services")
relocate("io.leangen.geantyref", "com.plotsquared.core.geantyref")
relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika")
relocate("com.intellectualsites.http", "com.plotsquared.core.http")
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster")
relocate("org.incendo.serverlib", "com.plotsquared.bukkit.serverlib")
relocate("org.jetbrains", "com.plotsquared.core.annotations")
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
relocate("javax.annotation", "com.plotsquared.core.annotation")
relocate("com.github.spotbugs", "com.plotsquared.core.spotbugs")
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
relocate("net.jcip", "com.plotsquared.core.annotations.jcip")
relocate("edu.umd.cs.findbugs", "com.plotsquared.core.annotations.findbugs")
relocate("com.intellectualsites.annotations", "com.plotsquared.core.annotations.informative")
// Get rid of all the libs which are 100% unused.
minimize()
mergeServiceFiles()
}
tasks {
withType<Javadoc> {
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
val opt = options as StandardJavadocDocletOptions
opt.links("https://jd.papermc.io/paper/1.20/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/")
opt.links("https://jd.advntr.dev/api/4.14.0/")
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
// opt.links("https://checkerframework.org/api/")
opt.isLinkSource = true
opt.bottom(File("$rootDir/javadocfooter.html").readText())
opt.isUse = true
opt.encoding("UTF-8")
opt.keyWords()
opt.addStringOption("-since", isRelease)
}
}

View File

@ -1,835 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit;
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.PlayerEvents;
import com.github.intellectualsites.plotsquared.bukkit.listeners.PlotPlusListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.SingleWorldListener;
import com.github.intellectualsites.plotsquared.bukkit.listeners.WorldEvents;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChatManager;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChunkManager;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitCommand;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEconHandler;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEventUtil;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitHybridUtils;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitInventoryUtil;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSchematicHandler;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSetupUtils;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitTaskManager;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.bukkit.util.Metrics;
import com.github.intellectualsites.plotsquared.bukkit.util.SetGenCB;
import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue;
import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.github.intellectualsites.plotsquared.bukkit.uuid.FileUUIDHandler;
import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.github.intellectualsites.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
import com.github.intellectualsites.plotsquared.plot.generator.HybridGen;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.ConsoleColors;
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation;
import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extension.platform.Actor;
import io.papermc.lib.PaperLib;
import lombok.Getter;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Getter private static WorldEdit worldEdit;
static {
try {
Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
} catch (Throwable ignored) {
}
}
private int[] version;
@Getter private String pluginName;
@Getter private SingleWorldListener singleWorldListener;
private Method methodUnloadChunk0;
private boolean methodUnloadSetup = false;
private boolean metricsStarted;
@Override public int[] getServerVersion() {
if (this.version == null) {
try {
this.version = new int[3];
String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
this.version[0] = Integer.parseInt(split[0]);
this.version[1] = Integer.parseInt(split[1]);
if (split.length == 3) {
this.version[2] = Integer.parseInt(split[2]);
}
} catch (NumberFormatException e) {
e.printStackTrace();
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion()));
PlotSquared.debug(
StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
return new int[] {1, 13, 0};
}
}
return this.version;
}
@Override public String getServerImplementation() {
return Bukkit.getVersion();
}
@Override public void onEnable() {
this.pluginName = getDescription().getName();
PlotPlayer.registerConverter(Player.class, BukkitUtil::getPlayer);
PaperLib.suggestPaper(this);
new PlotSquared(this, "Bukkit");
if (PlotSquared.get().IMP.getServerVersion()[1] < 13) {
System.out.println(
"You can't use this version of PlotSquared on a server less than Minecraft 1.13.2.");
System.out
.println("Please check the download page for the link to the legacy versions.");
System.out.println("The server will now be shutdown to prevent any corruption.");
Bukkit.shutdown();
return;
}
// Check for updates
if (PlotSquared.get().getUpdateUtility() != null) {
final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(),
((updateDescription, throwable) -> {
Bukkit.getScheduler().runTask(BukkitMain.this, () -> {
getLogger().info("-------- PlotSquared Update Check --------");
if (throwable != null) {
getLogger().severe(String
.format("Could not check for update. Reason: %s",
throwable.getMessage()));
} else {
if (updateDescription == null) {
getLogger().info(
"You appear to be running the latest version of PlotSquared. Congratulations!");
} else {
getLogger()
.info("There appears to be a PlotSquared update available!");
getLogger().info(String.format("You are running version %s,"
+ " the newest available version is %s",
getPluginVersionString(), updateDescription.getVersion()));
getLogger().info(
String.format("Update URL: %s", updateDescription.getUrl()));
}
}
getLogger().info("-------- PlotSquared Update Check --------");
});
}));
} else {
getLogger().warning("Update checking disabled. Skipping.");
}
this.startMetrics();
if (Settings.Enabled_Components.WORLDS) {
TaskManager.IMP.taskRepeat(this::unload, 20);
try {
singleWorldListener = new SingleWorldListener(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void unload() {
if (!this.methodUnloadSetup) {
this.methodUnloadSetup = true;
try {
ReflectionUtils.RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
this.methodUnloadChunk0 = classCraftWorld.getRealClass()
.getDeclaredMethod("unloadChunk0", int.class, int.class, boolean.class);
this.methodUnloadChunk0.setAccessible(true);
} catch (Throwable event) {
event.printStackTrace();
}
}
final PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
long start = System.currentTimeMillis();
final SinglePlotArea area = ((SinglePlotAreaManager) manager).getArea();
outer:
for (final World world : Bukkit.getWorlds()) {
final String name = world.getName();
final char char0 = name.charAt(0);
if (!Character.isDigit(char0) && char0 != '-') {
continue;
}
if (!world.getPlayers().isEmpty()) {
continue;
}
PlotId id;
try {
id = PlotId.fromString(name);
} catch (IllegalArgumentException ignored) {
continue;
}
final Plot plot = area.getOwnedPlot(id);
if (plot != null) {
if (!MainUtil.isServerOwned(plot) || PlotPlayer.wrap(plot.getOwner()) == null) {
if (world.getKeepSpawnInMemory()) {
world.setKeepSpawnInMemory(false);
return;
}
final Chunk[] chunks = world.getLoadedChunks();
if (chunks.length == 0) {
if (!Bukkit.unloadWorld(world, true)) {
PlotSquared.debug("Failed to unload " + world.getName());
}
return;
} else {
int index = 0;
do {
final Chunk chunkI = chunks[index++];
boolean result;
if (methodUnloadChunk0 != null) {
try {
result = (boolean) methodUnloadChunk0
.invoke(world, chunkI.getX(), chunkI.getZ(), true);
} catch (Throwable e) {
methodUnloadChunk0 = null;
e.printStackTrace();
continue outer;
}
} else {
result = world.unloadChunk(chunkI.getX(), chunkI.getZ(), true);
}
if (!result) {
continue outer;
}
if (System.currentTimeMillis() - start > 5) {
return;
}
} while (index < chunks.length);
}
}
}
}
}
}
@Override public void onDisable() {
PlotSquared.get().disable();
Bukkit.getScheduler().cancelTasks(this);
}
@Override public void log(@NonNull String message) {
try {
message = Captions.color(message);
if (!Settings.Chat.CONSOLE_COLOR) {
message = ChatColor.stripColor(message);
}
this.getServer().getConsoleSender().sendMessage(message);
} catch (final Throwable ignored) {
System.out.println(ConsoleColors.fromString(message));
}
}
@Override public void shutdown() {
this.getServer().getPluginManager().disablePlugin(this);
}
@Override public int[] getPluginVersion() {
String ver = getDescription().getVersion();
if (ver.contains("-")) {
ver = ver.split("-")[0];
}
String[] split = ver.split("\\.");
return new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1]),
Integer.parseInt(split[2])};
}
@Override public String getPluginVersionString() {
return getDescription().getVersion();
}
@Override public void registerCommands() {
final BukkitCommand bukkitCommand = new BukkitCommand();
final PluginCommand plotCommand = getCommand("plots");
if (plotCommand != null) {
plotCommand.setExecutor(bukkitCommand);
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
plotCommand.setTabCompleter(bukkitCommand);
}
}
@Override public File getDirectory() {
return getDataFolder();
}
@Override public File getWorldContainer() {
return Bukkit.getWorldContainer();
}
@Override public TaskManager getTaskManager() {
return new BukkitTaskManager(this);
}
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
PlotSquared.log(Captions.PREFIX + "KillAllEntities started.");
TaskManager.runTaskRepeat(() -> PlotSquared.get().forEachPlotArea(plotArea -> {
final World world = Bukkit.getWorld(plotArea.worldname);
try {
if (world == null) {
return;
}
List<Entity> entities = world.getEntities();
Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) {
Entity entity = iterator.next();
switch (entity.getType()) {
case EGG:
case FISHING_HOOK:
case ENDER_SIGNAL:
case AREA_EFFECT_CLOUD:
case EXPERIENCE_ORB:
case LEASH_HITCH:
case FIREWORK:
case LIGHTNING:
case WITHER_SKULL:
case UNKNOWN:
case PLAYER:
// non moving / unmovable
continue;
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case SNOWBALL:
case SHULKER_BULLET:
case SPECTRAL_ARROW:
case ENDER_PEARL:
case ARROW:
case LLAMA_SPIT:
case TRIDENT:
// managed elsewhere | projectile
continue;
case ITEM_FRAME:
case PAINTING:
// Not vehicles
continue;
case ARMOR_STAND:
// Temporarily classify as vehicle
case MINECART:
case MINECART_CHEST:
case MINECART_COMMAND:
case MINECART_FURNACE:
case MINECART_HOPPER:
case MINECART_MOB_SPAWNER:
case ENDER_CRYSTAL:
case MINECART_TNT:
case BOAT:
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.github.intellectualsites.plotsquared.plot.object.Location
location = BukkitUtil.getLocation(entity.getLocation());
Plot plot = location.getPlot();
if (plot == null) {
if (location.isPlotArea()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
}
continue;
}
List<MetadataValue> meta = entity.getMetadata("plot");
if (meta.isEmpty()) {
continue;
}
Plot origin = (Plot) meta.get(0).value();
if (!plot.equals(origin.getBasePlot(false))) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
}
}
continue;
case SMALL_FIREBALL:
case FIREBALL:
case DRAGON_FIREBALL:
case DROPPED_ITEM:
if (Settings.Enabled_Components.KILL_ROAD_ITEMS && plotArea
.getOwnedPlotAbs(BukkitUtil.getLocation(entity.getLocation()))
== null) {
entity.remove();
}
// dropped item
continue;
case PRIMED_TNT:
case FALLING_BLOCK:
// managed elsewhere
continue;
case SHULKER:
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
LivingEntity livingEntity = (LivingEntity) entity;
List<MetadataValue> meta = entity.getMetadata("shulkerPlot");
if (!meta.isEmpty()) {
if (livingEntity.isLeashed()) {
continue;
}
List<MetadataValue> keep = entity.getMetadata("keep");
if (!keep.isEmpty()) {
continue;
}
PlotId originalPlotId = (PlotId) meta.get(0).value();
if (originalPlotId != null) {
com.github.intellectualsites.plotsquared.plot.object.Location
pLoc = BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
if (!originalPlotId.equals(currentPlotId) && (
currentPlotId == null || !area
.getPlot(originalPlotId)
.equals(area.getPlot(currentPlotId)))) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
}
}
}
} else {
//This is to apply the metadata to already spawned shulkers (see EntitySpawnListener.java)
com.github.intellectualsites.plotsquared.plot.object.Location
pLoc = BukkitUtil.getLocation(entity.getLocation());
PlotArea area = pLoc.getPlotArea();
if (area != null) {
PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc));
if (currentPlotId != null) {
entity.setMetadata("shulkerPlot", new FixedMetadataValue(
(Plugin) PlotSquared.get().IMP, currentPlotId));
}
}
}
}
continue;
case LLAMA:
case DONKEY:
case MULE:
case ZOMBIE_HORSE:
case SKELETON_HORSE:
case HUSK:
case ELDER_GUARDIAN:
case WITHER_SKELETON:
case STRAY:
case ZOMBIE_VILLAGER:
case EVOKER:
case EVOKER_FANGS:
case VEX:
case VINDICATOR:
case POLAR_BEAR:
case BAT:
case BLAZE:
case CAVE_SPIDER:
case CHICKEN:
case COW:
case CREEPER:
case ENDERMAN:
case ENDERMITE:
case ENDER_DRAGON:
case GHAST:
case GIANT:
case GUARDIAN:
case HORSE:
case IRON_GOLEM:
case MAGMA_CUBE:
case MUSHROOM_COW:
case OCELOT:
case PIG:
case PIG_ZOMBIE:
case RABBIT:
case SHEEP:
case SILVERFISH:
case SKELETON:
case SLIME:
case SNOWMAN:
case SPIDER:
case SQUID:
case VILLAGER:
case WITCH:
case WITHER:
case WOLF:
case ZOMBIE:
case PARROT:
case SALMON:
case DOLPHIN:
case TROPICAL_FISH:
case DROWNED:
case COD:
case TURTLE:
case PUFFERFISH:
case PHANTOM:
case ILLUSIONER:
default: {
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
Location location = entity.getLocation();
if (BukkitUtil.getLocation(location).isPlotRoad()) {
if (entity instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entity;
if (!livingEntity.isLeashed() || !entity
.hasMetadata("keep")) {
Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity
.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
continue;
}
}
} else {
Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player) && entity
.getMetadata("keep").isEmpty()) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
iterator.remove();
entity.remove();
continue;
}
}
}
}
continue;
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}), 20);
}
@Override @Nullable
public final ChunkGenerator getDefaultWorldGenerator(@NotNull final String worldName,
final String id) {
final IndependentPlotGenerator result;
if (id != null && id.equalsIgnoreCase("single")) {
result = new SingleWorldGenerator();
} else {
result = PlotSquared.get().IMP.getDefaultGenerator();
if (!PlotSquared.get().setupPlotWorld(worldName, id, result)) {
return null;
}
}
return (ChunkGenerator) result.specify(worldName);
}
@Override public void registerPlayerEvents() {
final PlayerEvents main = new PlayerEvents();
getServer().getPluginManager().registerEvents(main, this);
getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this);
}
@Override public void registerPlotPlusEvents() {
PlotPlusListener.startRunnable(this);
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
}
@Override public void registerForceFieldEvents() {
}
@Override public boolean initWorldEdit() {
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
worldEdit = WorldEdit.getInstance();
return true;
}
return false;
}
@Override public EconHandler getEconomyHandler() {
try {
BukkitEconHandler econ = new BukkitEconHandler();
if (econ.init()) {
return econ;
}
} catch (Throwable ignored) {
PlotSquared.debug("No economy detected!");
}
return null;
}
@Override public QueueProvider initBlockQueue() {
//TODO Figure out why this code is still here yet isn't being called anywhere.
// try {
// new SendChunk();
// MainUtil.canSendChunk = true;
// } catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
// PlotSquared.debug(
// SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
// MainUtil.canSendChunk = false;
// }
return QueueProvider.of(BukkitLocalQueue.class, BukkitLocalQueue.class);
}
@Override public WorldUtil initWorldUtil() {
return new BukkitUtil();
}
@Override @Nullable public GeneratorWrapper<?> getGenerator(@NonNull final String world,
@Nullable final String name) {
if (name == null) {
return null;
}
final Plugin genPlugin = Bukkit.getPluginManager().getPlugin(name);
if (genPlugin != null && genPlugin.isEnabled()) {
ChunkGenerator gen = genPlugin.getDefaultWorldGenerator(world, "");
if (gen instanceof GeneratorWrapper<?>) {
return (GeneratorWrapper<?>) gen;
}
return new BukkitPlotGenerator(world, gen);
} else {
return new BukkitPlotGenerator(PlotSquared.get().IMP.getDefaultGenerator());
}
}
@Override public HybridUtils initHybridUtils() {
return new BukkitHybridUtils();
}
@Override public SetupUtils initSetupUtils() {
return new BukkitSetupUtils();
}
@Override public void startMetrics() {
if (this.metricsStarted) {
return;
}
this.metricsStarted = true;
Metrics metrics = new Metrics(this);// bstats
PlotSquared.log(Captions.PREFIX + "&6Metrics enabled.");
}
@Override public ChunkManager initChunkManager() {
return new BukkitChunkManager();
}
@Override public EventUtil initEventUtil() {
return new BukkitEventUtil();
}
@Override public void unregister(@NonNull final PlotPlayer player) {
BukkitUtil.removePlayer(player.getName());
}
@Override public void registerChunkProcessor() {
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
}
@Override public void registerWorldEvents() {
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
}
@NotNull @Override public IndependentPlotGenerator getDefaultGenerator() {
return new HybridGen();
}
@Override public InventoryUtil initInventoryUtil() {
return new BukkitInventoryUtil();
}
@Override public UUIDHandlerImplementation initUUIDHandler() {
final UUIDWrapper wrapper;
if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE) {
wrapper = new LowerOfflineUUIDWrapper();
} else {
wrapper = new OfflineUUIDWrapper();
}
Settings.UUID.OFFLINE = true;
} else {
wrapper = new DefaultUUIDWrapper();
Settings.UUID.OFFLINE = false;
}
if (!Bukkit.getVersion().contains("git-Spigot")) {
if (wrapper instanceof DefaultUUIDWrapper
|| wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) {
Settings.UUID.NATIVE_UUID_PROVIDER = true;
}
}
if (Settings.UUID.OFFLINE) {
PlotSquared.log(Captions.PREFIX + "&6" + getPluginName()
+ " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
+ "Bukkit");
} else {
PlotSquared.log(Captions.PREFIX + "&6" + getPluginName() + " is using online UUIDs");
}
if (Settings.UUID.USE_SQLUUIDHANDLER) {
return new SQLUUIDHandler(wrapper);
} else {
return new FileUUIDHandler(wrapper);
}
}
@Override public void setGenerator(@NonNull final String worldName) {
World world = BukkitUtil.getWorld(worldName);
if (world == null) {
// create world
ConfigurationSection worldConfig =
PlotSquared.get().worlds.getConfigurationSection("worlds." + worldName);
String manager = worldConfig.getString("generator.plugin", getPluginName());
SetupObject setup = new SetupObject();
setup.plotManager = manager;
setup.setupGenerator = worldConfig.getString("generator.init", manager);
setup.type = worldConfig.getInt("generator.type");
setup.terrain = worldConfig.getInt("generator.terrain");
setup.step = new ConfigurationNode[0];
setup.world = worldName;
SetupUtils.manager.setupWorld(setup);
world = Bukkit.getWorld(worldName);
} else {
try {
if (!PlotSquared.get().hasPlotArea(worldName)) {
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
}
} catch (Exception e) {
PlotSquared.log("Failed to reload world: " + world + " | " + e.getMessage());
Bukkit.getServer().unloadWorld(world, false);
return;
}
}
assert world != null;
ChunkGenerator gen = world.getGenerator();
if (gen instanceof BukkitPlotGenerator) {
PlotSquared.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
} else if (gen != null) {
PlotSquared.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
} else if (PlotSquared.get().worlds.contains("worlds." + worldName)) {
PlotSquared.get().loadWorld(worldName, null);
}
}
@Override public SchematicHandler initSchematicHandler() {
return new BukkitSchematicHandler();
}
@Override @Nullable public PlotPlayer wrapPlayer(final Object player) {
if (player instanceof Player) {
return BukkitUtil.getPlayer((Player) player);
}
if (player instanceof OfflinePlayer) {
return BukkitUtil.getPlayer((OfflinePlayer) player);
}
if (player instanceof String) {
return UUIDHandler.getPlayer((String) player);
}
if (player instanceof UUID) {
return UUIDHandler.getPlayer((UUID) player);
}
return null;
}
@Override public String getNMSPackage() {
final String name = Bukkit.getServer().getClass().getPackage().getName();
return name.substring(name.lastIndexOf('.') + 1);
}
@Override public ChatManager<?> initChatManager() {
if (Settings.Chat.INTERACTIVE) {
return new BukkitChatManager();
} else {
return new PlainChatManager();
}
}
@Override public GeneratorWrapper<?> wrapPlotGenerator(@Nullable final String world,
@NonNull final IndependentPlotGenerator generator) {
return new BukkitPlotGenerator(generator);
}
@Override public List<String> getPluginIds() {
final List<String> names = new ArrayList<>();
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin
.isEnabled());
}
return names;
}
@Override public Actor getConsole() {
@NotNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
return wePlugin.wrapCommandSender(console);
}
}

View File

@ -1,107 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import org.apache.commons.lang.Validate;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
/**
* Represents a wrapper around an array class of an arbitrary reference type,
* which properly implements "value" hash code and equality functions.
* <p>
* This class is intended for use as a key to a map.
* </p>
*
* @param <E> The type of elements in the array.
* @author Glen Husman
* @see Arrays
*/
public final class ArrayWrapper<E> {
private E[] _array;
/**
* Creates an array wrapper with some elements.
*
* @param elements The elements of the array.
*/
public ArrayWrapper(E... elements) {
setArray(elements);
}
/**
* Converts an iterable element collection to an array of elements.
* The iteration order of the specified object will be used as the array element order.
*
* @param list The iterable of objects which will be converted to an array.
* @param c The type of the elements of the array.
* @return An array of elements in the specified iterable.
*/
@SuppressWarnings("unchecked") public static <T> T[] toArray(Iterable<? extends T> list,
Class<T> c) {
int size = -1;
if (list instanceof Collection<?>) {
@SuppressWarnings("rawtypes") Collection coll = (Collection) list;
size = coll.size();
}
if (size < 0) {
size = 0;
// Ugly hack: Count it ourselves
for (@SuppressWarnings("unused") T element : list) {
size++;
}
}
T[] result = (T[]) Array.newInstance(c, size);
int i = 0;
for (T element : list) { // Assumes iteration order is consistent
result[i++] = element; // Assign array element at index THEN increment counter
}
return result;
}
/**
* Retrieves a reference to the wrapped array instance.
*
* @return The array wrapped by this instance.
*/
public E[] getArray() {
return _array;
}
/**
* Set this wrapper to wrap a new array instance.
*
* @param array The new wrapped array.
*/
public void setArray(E[] array) {
Validate.notNull(array, "The array must not be null.");
_array = array;
}
/**
* Determines if this object has a value equivalent to another object.
*
* @see Arrays#equals(Object[], Object[])
*/
@SuppressWarnings("rawtypes") @Override public boolean equals(Object other) {
if (!(other instanceof ArrayWrapper)) {
return false;
}
return Arrays.equals(_array, ((ArrayWrapper) other)._array);
}
/**
* Gets the hash code represented by this objects value.
*
* @return This object's hash code.
* @see Arrays#hashCode(Object[])
*/
@Override public int hashCode() {
return Arrays.hashCode(_array);
}
}

View File

@ -1,905 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.Statistic.Type;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.io.IOException;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
/**
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>.
* This class allows plugins to emulate the functionality of the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>.
* <p>
* This class follows the builder pattern, allowing for method chaining.
* It is set up such that invocations of property-setting methods will affect the current editing component,
* and a call to {@link #then()} or {@link #then(String)} will append a new editing component to the end of the message,
* optionally initializing it with text. Further property-setting method calls will affect that editing component.
* </p>
*/
public class FancyMessage
implements JsonRepresentedObject, Cloneable, Iterable<MessagePart>, ConfigurationSerializable {
private static Constructor<?> nmsPacketPlayOutChatConstructor;
// The ChatSerializer's instance of Gson
private static Object nmsChatSerializerGsonInstance;
private static Method fromJsonMethod;
private static JsonParser _stringParser = new JsonParser();
static {
ConfigurationSerialization.registerClass(FancyMessage.class);
}
private List<MessagePart> messageParts;
private String jsonString;
private boolean dirty;
/**
* Creates a JSON message with text.
*
* @param firstPartText The existing text in the message.
*/
public FancyMessage(final String firstPartText) {
this(TextualComponent.rawText(firstPartText));
}
private FancyMessage(final TextualComponent firstPartText) {
messageParts = new ArrayList<>();
messageParts.add(new MessagePart(firstPartText));
jsonString = null;
dirty = false;
if (nmsPacketPlayOutChatConstructor == null) {
try {
nmsPacketPlayOutChatConstructor = Reflection.getNMSClass("PacketPlayOutChat")
.getDeclaredConstructor(Reflection.getNMSClass("IChatBaseComponent"));
nmsPacketPlayOutChatConstructor.setAccessible(true);
} catch (NoSuchMethodException e) {
Bukkit.getLogger()
.log(Level.SEVERE, "Could not find Minecraft method or constructor.", e);
} catch (SecurityException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access constructor.", e);
}
}
}
/**
* Creates a JSON message without text.
*/
public FancyMessage() {
this((TextualComponent) null);
}
/**
* Deserializes a JSON-represented message from a mapping of key-value pairs.
* This is called by the Bukkit serialization API.
* It is not intended for direct public API consumption.
*
* @param serialized The key-value mapping which represents a fancy message.
*/
@SuppressWarnings("unchecked") public static FancyMessage deserialize(
Map<String, Object> serialized) {
FancyMessage msg = new FancyMessage();
msg.messageParts = (List<MessagePart>) serialized.get("messageParts");
msg.jsonString = serialized.containsKey("JSON") ? serialized.get("JSON").toString() : null;
msg.dirty = !serialized.containsKey("JSON");
return msg;
}
/**
* Deserializes a fancy message from its JSON representation. This JSON representation is of the format of
* that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
*
* @param json The JSON string which represents a fancy message.
* @return A {@code FancyMessage} representing the parameterized JSON message.
*/
public static FancyMessage deserialize(String json) {
JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
JsonArray extra = serialized.getAsJsonArray("extra"); // Get the extra component
FancyMessage returnVal = new FancyMessage();
returnVal.messageParts.clear();
for (JsonElement mPrt : extra) {
MessagePart component = new MessagePart();
JsonObject messagePart = mPrt.getAsJsonObject();
for (Map.Entry<String, JsonElement> entry : messagePart.entrySet()) {
// Deserialize text
if (TextualComponent.isTextKey(entry.getKey())) {
// The map mimics the YAML serialization, which has a "key" field and one or more "value" fields
Map<String, Object> serializedMapForm =
new HashMap<>(); // Must be object due to Bukkit serializer API compliance
serializedMapForm.put("key", entry.getKey());
if (entry.getValue().isJsonPrimitive()) {
// Assume string
serializedMapForm.put("value", entry.getValue().getAsString());
} else {
// Composite object, but we assume each element is a string
for (Map.Entry<String, JsonElement> compositeNestedElement : entry
.getValue().getAsJsonObject().entrySet()) {
serializedMapForm.put("value." + compositeNestedElement.getKey(),
compositeNestedElement.getValue().getAsString());
}
}
component.text = TextualComponent.deserialize(serializedMapForm);
} else if (MessagePart.stylesToNames.inverse().containsKey(entry.getKey())) {
if (entry.getValue().getAsBoolean()) {
component.styles
.add(MessagePart.stylesToNames.inverse().get(entry.getKey()));
}
} else if (entry.getKey().equals("color")) {
component.color =
ChatColor.valueOf(entry.getValue().getAsString().toUpperCase());
} else if (entry.getKey().equals("clickEvent")) {
JsonObject object = entry.getValue().getAsJsonObject();
component.clickActionName = object.get("action").getAsString();
component.clickActionData = object.get("value").getAsString();
} else if (entry.getKey().equals("hoverEvent")) {
JsonObject object = entry.getValue().getAsJsonObject();
component.hoverActionName = object.get("action").getAsString();
if (object.get("value").isJsonPrimitive()) {
// Assume string
component.hoverActionData =
new JsonString(object.get("value").getAsString());
} else {
// Assume composite type
// The only composite type we currently store is another FancyMessage
// Therefore, recursion time!
component.hoverActionData = deserialize(object.get("value")
.toString() /* This should properly serialize the JSON object as a JSON string */);
}
} else if (entry.getKey().equals("insertion")) {
component.insertionData = entry.getValue().getAsString();
} else if (entry.getKey().equals("with")) {
for (JsonElement object : entry.getValue().getAsJsonArray()) {
if (object.isJsonPrimitive()) {
component.translationReplacements
.add(new JsonString(object.getAsString()));
} else {
// Only composite type stored in this array is - again - FancyMessages
// Recurse within this function to parse this as a translation replacement
component.translationReplacements.add(deserialize(object.toString()));
}
}
}
}
returnVal.messageParts.add(component);
}
return returnVal;
}
@Override public FancyMessage clone() throws CloneNotSupportedException {
FancyMessage instance = (FancyMessage) super.clone();
instance.messageParts = new ArrayList<>(messageParts.size());
for (int i = 0; i < messageParts.size(); i++) {
instance.messageParts.add(i, messageParts.get(i).clone());
}
instance.dirty = false;
instance.jsonString = null;
return instance;
}
/**
* Sets the text of the current editing component to a value.
*
* @param text The new text of the current editing component.
* @return This builder instance.
*/
public FancyMessage text(String text) {
MessagePart latest = latest();
latest.text = TextualComponent.rawText(text);
dirty = true;
return this;
}
/**
* Sets the text of the current editing component to a value.
*
* @param text The new text of the current editing component.
* @return This builder instance.
*/
public FancyMessage text(TextualComponent text) {
MessagePart latest = latest();
latest.text = text;
dirty = true;
return this;
}
/**
* Sets the color of the current editing component to a value.
*
* @param color The new color of the current editing component.
* @return This builder instance.
* @throws IllegalArgumentException If the specified {@code ChatColor} enumeration value is not a color (but a format value).
*/
public FancyMessage color(final ChatColor color) {
if (!color.isColor()) {
throw new IllegalArgumentException(color.name() + " is not a color");
}
latest().color = color;
dirty = true;
return this;
}
/**
* Sets the stylization of the current editing component.
*
* @param styles The array of styles to apply to the editing component.
* @return This builder instance.
* @throws IllegalArgumentException If any of the enumeration values in the array do not represent formatters.
*/
public FancyMessage style(ChatColor... styles) {
for (final ChatColor style : styles) {
if (!style.isFormat()) {
throw new IllegalArgumentException(style.name() + " is not a style");
}
}
latest().styles.addAll(Arrays.asList(styles));
dirty = true;
return this;
}
/**
* Set the behavior of the current editing component to instruct the client to open a file on the client side filesystem when the currently edited part of the {@code FancyMessage} is clicked.
*
* @param path The path of the file on the client filesystem.
* @return This builder instance.
*/
public FancyMessage file(final String path) {
onClick("open_file", path);
return this;
}
/**
* Set the behavior of the current editing component to instruct the client to open a webpage in the client's web browser when the currently edited part of the {@code FancyMessage} is clicked.
*
* @param url The URL of the page to open when the link is clicked.
* @return This builder instance.
*/
public FancyMessage link(final String url) {
onClick("open_url", url);
return this;
}
/**
* Set the behavior of the current editing component to instruct the client to replace the chat input box content with the specified string when the currently edited part of the {@code FancyMessage} is clicked.
* The client will not immediately send the command to the server to be executed unless the client player submits the command/chat message, usually with the enter key.
*
* @param command The text to display in the chat bar of the client.
* @return This builder instance.
*/
public FancyMessage suggest(final String command) {
onClick("suggest_command", command);
return this;
}
/**
* Set the behavior of the current editing component to instruct the client to append the chat input box content with the specified string when the currently edited part of the {@code FancyMessage} is SHIFT-CLICKED.
* The client will not immediately send the command to the server to be executed unless the client player submits the command/chat message, usually with the enter key.
*
* @param command The text to append to the chat bar of the client.
* @return This builder instance.
*/
public FancyMessage insert(final String command) {
latest().insertionData = command;
dirty = true;
return this;
}
/**
* Set the behavior of the current editing component to instruct the client to send the specified string to the server as a chat message when the currently edited part of the {@code FancyMessage} is clicked.
* The client <b>will</b> immediately send the command to the server to be executed when the editing component is clicked.
*
* @param command The text to display in the chat bar of the client.
* @return This builder instance.
*/
public FancyMessage command(final String command) {
onClick("run_command", command);
return this;
}
/**
* Set the behavior of the current editing component to display information about an achievement when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param name The name of the achievement to display, excluding the "achievement." prefix.
* @return This builder instance.
*/
public FancyMessage achievementTooltip(final String name) {
onHover("show_achievement", new JsonString("achievement." + name));
return this;
}
/**
* Set the behavior of the current editing component to display information about a parameterless statistic when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param which The statistic to display.
* @return This builder instance.
* @throws IllegalArgumentException If the statistic requires a parameter which was not supplied.
*/
public FancyMessage statisticTooltip(final Statistic which) {
Type type = which.getType();
if (type != Type.UNTYPED) {
throw new IllegalArgumentException(
"That statistic requires an additional " + type + " parameter!");
}
try {
Object statistic = Reflection
.getMethod(Reflection.getOBCClass("CraftStatistic"), "getNMSStatistic",
Statistic.class).invoke(null, which);
return achievementTooltip(
(String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name")
.get(statistic));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
return this;
} catch (InvocationTargetException e) {
Bukkit.getLogger()
.log(Level.WARNING, "A error has occurred during invoking of method.", e);
return this;
}
}
/**
* Set the behavior of the current editing component to display information about a statistic parameter with a material when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param which The statistic to display.
* @param item The sole material parameter to the statistic.
* @return This builder instance.
* @throws IllegalArgumentException If the statistic requires a parameter which was not supplied, or was supplied a parameter that was not required.
*/
public FancyMessage statisticTooltip(final Statistic which, Material item) {
Type type = which.getType();
if (type == Type.UNTYPED) {
throw new IllegalArgumentException("That statistic needs no additional parameter!");
}
if ((type == Type.BLOCK && item.isBlock()) || type == Type.ENTITY) {
throw new IllegalArgumentException(
"Wrong parameter type for that statistic - needs " + type + "!");
}
try {
Object statistic = Reflection
.getMethod(Reflection.getOBCClass("CraftStatistic"), "getMaterialStatistic",
Statistic.class, Material.class).invoke(null, which, item);
return achievementTooltip(
(String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name")
.get(statistic));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
return this;
} catch (InvocationTargetException e) {
Bukkit.getLogger()
.log(Level.WARNING, "A error has occurred during invoking of method.", e);
return this;
}
}
/**
* Set the behavior of the current editing component to display information about a statistic parameter with an entity type when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param which The statistic to display.
* @param entity The sole entity type parameter to the statistic.
* @return This builder instance.
* @throws IllegalArgumentException If the statistic requires a parameter which was not supplied, or was supplied a parameter that was not required.
*/
public FancyMessage statisticTooltip(final Statistic which, EntityType entity) {
Type type = which.getType();
if (type == Type.UNTYPED) {
throw new IllegalArgumentException("That statistic needs no additional parameter!");
}
if (type != Type.ENTITY) {
throw new IllegalArgumentException(
"Wrong parameter type for that statistic - needs " + type + "!");
}
try {
Object statistic = Reflection
.getMethod(Reflection.getOBCClass("CraftStatistic"), "getEntityStatistic",
Statistic.class, EntityType.class).invoke(null, which, entity);
return achievementTooltip(
(String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name")
.get(statistic));
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
return this;
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
return this;
} catch (InvocationTargetException e) {
Bukkit.getLogger()
.log(Level.WARNING, "A error has occurred during invoking of method.", e);
return this;
}
}
/**
* Set the behavior of the current editing component to display information about an item when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param itemJSON A string representing the JSON-serialized NBT data tag of an {@link ItemStack}.
* @return This builder instance.
*/
public FancyMessage itemTooltip(final String itemJSON) {
onHover("show_item", new JsonString(
itemJSON)); // Seems a bit hacky, considering we have a JSON object as a parameter
return this;
}
/**
* Set the behavior of the current editing component to display information about an item when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param itemStack The stack for which to display information.
* @return This builder instance.
*/
public FancyMessage itemTooltip(final ItemStack itemStack) {
try {
Object nmsItem = Reflection
.getMethod(Reflection.getOBCClass("inventory.CraftItemStack"), "asNMSCopy",
ItemStack.class).invoke(null, itemStack);
return itemTooltip(Reflection.getMethod(Reflection.getNMSClass("ItemStack"), "save",
Reflection.getNMSClass("NBTTagCompound"))
.invoke(nmsItem, Reflection.getNMSClass("NBTTagCompound").newInstance())
.toString());
} catch (Exception e) {
e.printStackTrace();
return this;
}
}
/**
* Set the behavior of the current editing component to display raw text when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param text The text, which supports newlines, which will be displayed to the client upon hovering.
* @return This builder instance.
*/
public FancyMessage tooltip(final String text) {
onHover("show_text", new JsonString(text));
return this;
}
/**
* Set the behavior of the current editing component to display raw text when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param lines The lines of text which will be displayed to the client upon hovering. The iteration order of this object will be the order in which the lines of the tooltip are created.
* @return This builder instance.
*/
public FancyMessage tooltip(final Iterable<String> lines) {
tooltip(ArrayWrapper.toArray(lines, String.class));
return this;
}
/*
/**
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
* @param replacements The replacements, in order, that will be used in the language-specific message.
* @return This builder instance.
*/ /* ------------
public FancyMessage translationReplacements(final Iterable<? extends CharSequence> replacements){
for(CharSequence str : replacements){
latest().translationReplacements.add(new JsonString(str));
}
return this;
}
*/
/**
* Set the behavior of the current editing component to display raw text when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param lines The lines of text which will be displayed to the client upon hovering.
* @return This builder instance.
*/
public FancyMessage tooltip(final String... lines) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < lines.length; i++) {
builder.append(lines[i]);
if (i != lines.length - 1) {
builder.append('\n');
}
}
tooltip(builder.toString());
return this;
}
/**
* Set the behavior of the current editing component to display formatted text when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param text The formatted text which will be displayed to the client upon hovering.
* @return This builder instance.
*/
public FancyMessage formattedTooltip(FancyMessage text) {
for (MessagePart component : text.messageParts) {
if (component.clickActionData != null && component.clickActionName != null) {
throw new IllegalArgumentException("The tooltip text cannot have click data.");
} else if (component.hoverActionData != null && component.hoverActionName != null) {
throw new IllegalArgumentException("The tooltip text cannot have a tooltip.");
}
}
onHover("show_text", text);
return this;
}
/**
* Set the behavior of the current editing component to display the specified lines of formatted text when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param lines The lines of formatted text which will be displayed to the client upon hovering.
* @return This builder instance.
*/
public FancyMessage formattedTooltip(FancyMessage... lines) {
if (lines.length < 1) {
onHover(null, null); // Clear tooltip
return this;
}
FancyMessage result = new FancyMessage();
result.messageParts
.clear(); // Remove the one existing text component that exists by default, which destabilizes the object
for (int i = 0; i < lines.length; i++) {
try {
for (MessagePart component : lines[i]) {
if (component.clickActionData != null && component.clickActionName != null) {
throw new IllegalArgumentException(
"The tooltip text cannot have click data.");
} else if (component.hoverActionData != null
&& component.hoverActionName != null) {
throw new IllegalArgumentException(
"The tooltip text cannot have a tooltip.");
}
if (component.hasText()) {
result.messageParts.add(component.clone());
}
}
if (i != lines.length - 1) {
result.messageParts.add(new MessagePart(TextualComponent.rawText("\n")));
}
} catch (CloneNotSupportedException e) {
Bukkit.getLogger().log(Level.WARNING, "Failed to clone object", e);
return this;
}
}
return formattedTooltip(
result.messageParts.isEmpty() ? null : result); // Throws NPE if size is 0, intended
}
/**
* Set the behavior of the current editing component to display the specified lines of formatted text when the client hovers over the text.
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
*
* @param lines The lines of text which will be displayed to the client upon hovering. The iteration order of this object will be the order in which the lines of the tooltip are created.
* @return This builder instance.
*/
public FancyMessage formattedTooltip(final Iterable<FancyMessage> lines) {
return formattedTooltip(ArrayWrapper.toArray(lines, FancyMessage.class));
}
/**
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
*
* @param replacements The replacements, in order, that will be used in the language-specific message.
* @return This builder instance.
*/
public FancyMessage translationReplacements(final String... replacements) {
for (String str : replacements) {
latest().translationReplacements.add(new JsonString(str));
}
dirty = true;
return this;
}
/**
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
*
* @param replacements The replacements, in order, that will be used in the language-specific message.
* @return This builder instance.
*/
public FancyMessage translationReplacements(final FancyMessage... replacements) {
Collections.addAll(latest().translationReplacements, replacements);
dirty = true;
return this;
}
/**
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
*
* @param replacements The replacements, in order, that will be used in the language-specific message.
* @return This builder instance.
*/
public FancyMessage translationReplacements(final Iterable<FancyMessage> replacements) {
return translationReplacements(ArrayWrapper.toArray(replacements, FancyMessage.class));
}
/**
* Terminate construction of the current editing component, and begin construction of a new message component.
* After a successful call to this method, all setter methods will refer to a new message component, created as a result of the call to this method.
*
* @param text The text which will populate the new message component.
* @return This builder instance.
*/
public FancyMessage then(final String text) {
return then(TextualComponent.rawText(text));
}
/**
* Terminate construction of the current editing component, and begin construction of a new message component.
* After a successful call to this method, all setter methods will refer to a new message component, created as a result of the call to this method.
*
* @param text The text which will populate the new message component.
* @return This builder instance.
*/
public FancyMessage then(final TextualComponent text) {
if (!latest().hasText()) {
throw new IllegalStateException("previous message part has no text");
}
messageParts.add(new MessagePart(text));
dirty = true;
return this;
}
/**
* Terminate construction of the current editing component, and begin construction of a new message component.
* After a successful call to this method, all setter methods will refer to a new message component, created as a result of the call to this method.
*
* @return This builder instance.
*/
public FancyMessage then() {
if (!latest().hasText()) {
throw new IllegalStateException("previous message part has no text");
}
messageParts.add(new MessagePart());
dirty = true;
return this;
}
@Override public void writeJson(JsonWriter writer) throws IOException {
if (messageParts.size() == 1) {
latest().writeJson(writer);
} else {
writer.beginObject().name("text").value("").name("extra").beginArray();
for (final MessagePart part : this) {
part.writeJson(writer);
}
writer.endArray().endObject();
}
}
/**
* Serialize this fancy message, converting it into syntactically-valid JSON using a {@link JsonWriter}.
* This JSON should be compatible with vanilla formatter commands such as {@code /tellraw}.
*
* @return The JSON string representing this object.
*/
public String toJSONString() {
if (!dirty && jsonString != null) {
return jsonString;
}
StringWriter string = new StringWriter();
JsonWriter json = new JsonWriter(string);
try {
writeJson(json);
json.close();
} catch (IOException e) {
throw new RuntimeException("invalid message");
}
jsonString = string.toString();
dirty = false;
return jsonString;
}
/**
* Sends this message to a player. The player will receive the fully-fledged formatted display of this message.
*
* @param player The player who will receive the message.
*/
public void send(Player player) {
send(player, toJSONString());
}
private void send(CommandSender sender, String jsonString) {
if (!(sender instanceof Player)) {
sender.sendMessage(toOldMessageFormat());
return;
}
Player player = (Player) sender;
try {
Object handle = Reflection.getHandle(player);
Object connection =
Reflection.getField(handle.getClass(), "playerConnection").get(handle);
Reflection
.getMethod(connection.getClass(), "sendPacket", Reflection.getNMSClass("Packet"))
.invoke(connection, createChatPacket(jsonString));
} catch (IllegalArgumentException e) {
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
} catch (IllegalAccessException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
} catch (InstantiationException e) {
Bukkit.getLogger().log(Level.WARNING, "Underlying class is abstract.", e);
} catch (InvocationTargetException e) {
Bukkit.getLogger()
.log(Level.WARNING, "A error has occurred during invoking of method.", e);
} catch (NoSuchMethodException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not find method.", e);
} catch (ClassNotFoundException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not find class.", e);
}
}
private Object createChatPacket(String json)
throws IllegalArgumentException, IllegalAccessException, InstantiationException,
InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
if (nmsChatSerializerGsonInstance == null) {
// Find the field and its value, completely bypassing obfuscation
Class<?> chatSerializerClazz;
// Get the three parts of the version string (major version is currently unused)
// vX_Y_RZ
// X = major
// Y = minor
// Z = revision
final String version = Reflection.getVersion();
String[] split =
version.substring(1, version.length() - 1).split("_"); // Remove trailing dot
//int majorVersion = Integer.parseInt(split[0]);
int minorVersion = Integer.parseInt(split[1]);
int revisionVersion = Integer.parseInt(split[2].substring(1)); // Substring to ignore R
if (minorVersion < 8 || (minorVersion == 8 && revisionVersion == 1)) {
chatSerializerClazz = Reflection.getNMSClass("ChatSerializer");
} else {
chatSerializerClazz = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
}
if (chatSerializerClazz == null) {
throw new ClassNotFoundException("Can't find the ChatSerializer class");
}
for (Field declaredField : chatSerializerClazz.getDeclaredFields()) {
if (Modifier.isFinal(declaredField.getModifiers()) && Modifier
.isStatic(declaredField.getModifiers()) && declaredField.getType().getName()
.endsWith("Gson")) {
// We've found our field
declaredField.setAccessible(true);
nmsChatSerializerGsonInstance = declaredField.get(null);
fromJsonMethod = nmsChatSerializerGsonInstance.getClass()
.getMethod("fromJson", String.class, Class.class);
break;
}
}
}
// Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)' than to reflectively call it
// Of course, the implementation may change, but fuzzy matches might break with signature changes
Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json,
Reflection.getNMSClass("IChatBaseComponent"));
return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent);
}
/**
* Sends this message to a command sender.
* If the sender is a player, they will receive the fully-fledged formatted display of this message.
* Otherwise, they will receive a version of this message with less formatting.
*
* @param sender The command sender who will receive the message.
* @see #toOldMessageFormat()
*/
public void send(CommandSender sender) {
send(sender, toJSONString());
}
/**
* Sends this message to multiple command senders.
*
* @param senders The command senders who will receive the message.
* @see #send(CommandSender)
*/
public void send(final Iterable<? extends CommandSender> senders) {
String string = toJSONString();
for (final CommandSender sender : senders) {
send(sender, string);
}
}
/**
* Convert this message to a human-readable string with limited formatting.
* This method is used to send this message to clients without JSON formatting support.
* <p>
* Serialization of this message by using this message will include (in this order for each message part):
* <ol>
* <li>The color of each message part.</li>
* <li>The applicable stylizations for each message part.</li>
* <li>The core text of the message part.</li>
* </ol>
* The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort.
* <p>
* Color and formatting can be removed from the returned string by using {@link ChatColor#stripColor(String)}.</p>
*
* @return A human-readable string representing limited formatting in addition to the core text of this message.
*/
public String toOldMessageFormat() {
StringBuilder result = new StringBuilder();
for (MessagePart part : this) {
result.append(part.color == null ? "" : part.color);
for (ChatColor formatSpecifier : part.styles) {
result.append(formatSpecifier);
}
result.append(part.text);
}
return result.toString();
}
private MessagePart latest() {
return messageParts.get(messageParts.size() - 1);
}
private void onClick(final String name, final String data) {
final MessagePart latest = latest();
latest.clickActionName = name;
latest.clickActionData = data;
dirty = true;
}
private void onHover(final String name, final JsonRepresentedObject data) {
final MessagePart latest = latest();
latest.hoverActionName = name;
latest.hoverActionData = data;
dirty = true;
}
// Doc copied from interface
public Map<String, Object> serialize() {
HashMap<String, Object> map = new HashMap<>();
map.put("messageParts", messageParts);
// map.put("JSON", toJSONString());
return map;
}
/**
* <b>Internally called method. Not for API consumption.</b>
*/
public Iterator<MessagePart> iterator() {
return messageParts.iterator();
}
}

View File

@ -1,20 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
/**
* Represents an object that can be serialized to a JSON writer instance.
*/
interface JsonRepresentedObject {
/**
* Writes the JSON representation of this object to the specified writer.
*
* @param writer The JSON writer which will receive the object.
* @throws IOException If an error occurs writing to the stream.
*/
public void writeJson(JsonWriter writer) throws IOException;
}

View File

@ -1,45 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import com.google.gson.stream.JsonWriter;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Represents a JSON string value.
* Writes by this object will not write name values nor begin/end objects in the JSON stream.
* All writes merely write the represented string value.
*/
final class JsonString implements JsonRepresentedObject, ConfigurationSerializable {
private String _value;
public JsonString(CharSequence value) {
_value = value == null ? null : value.toString();
}
public static JsonString deserialize(Map<String, Object> map) {
return new JsonString(map.get("stringValue").toString());
}
@Override public void writeJson(JsonWriter writer) throws IOException {
writer.value(getValue());
}
public String getValue() {
return _value;
}
public Map<String, Object> serialize() {
HashMap<String, Object> theSingleValue = new HashMap<String, Object>();
theSingleValue.put("stringValue", _value);
return theSingleValue;
}
@Override public String toString() {
return _value;
}
}

View File

@ -1,154 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.google.gson.stream.JsonWriter;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
/**
* Internal class: Represents a component of a JSON-serializable {@link FancyMessage}.
*/
final class MessagePart implements JsonRepresentedObject, ConfigurationSerializable, Cloneable {
static final BiMap<ChatColor, String> stylesToNames;
static {
ImmutableBiMap.Builder<ChatColor, String> builder = ImmutableBiMap.builder();
for (final ChatColor style : ChatColor.values()) {
if (!style.isFormat()) {
continue;
}
String styleName;
switch (style) {
case MAGIC:
styleName = "obfuscated";
break;
case UNDERLINE:
styleName = "underlined";
break;
default:
styleName = style.name().toLowerCase();
break;
}
builder.put(style, styleName);
}
stylesToNames = builder.build();
}
static {
ConfigurationSerialization.registerClass(MessagePart.class);
}
ChatColor color = ChatColor.WHITE;
ArrayList<ChatColor> styles = new ArrayList<>();
String clickActionName = null;
String clickActionData = null;
String hoverActionName = null;
JsonRepresentedObject hoverActionData = null;
TextualComponent text = null;
String insertionData = null;
ArrayList<JsonRepresentedObject> translationReplacements = new ArrayList<>();
MessagePart(final TextualComponent text) {
this.text = text;
}
MessagePart() {
this.text = null;
}
@SuppressWarnings("unchecked")
public static MessagePart deserialize(Map<String, Object> serialized) {
MessagePart part = new MessagePart((TextualComponent) serialized.get("text"));
part.styles = (ArrayList<ChatColor>) serialized.get("styles");
part.color = ChatColor.getByChar(serialized.get("color").toString());
part.hoverActionName = (String) serialized.get("hoverActionName");
part.hoverActionData = (JsonRepresentedObject) serialized.get("hoverActionData");
part.clickActionName = (String) serialized.get("clickActionName");
part.clickActionData = (String) serialized.get("clickActionData");
part.insertionData = (String) serialized.get("insertion");
part.translationReplacements =
(ArrayList<JsonRepresentedObject>) serialized.get("translationReplacements");
return part;
}
boolean hasText() {
return text != null;
}
@Override @SuppressWarnings("unchecked") public MessagePart clone()
throws CloneNotSupportedException {
MessagePart obj = (MessagePart) super.clone();
obj.styles = (ArrayList<ChatColor>) styles.clone();
if (hoverActionData instanceof JsonString) {
obj.hoverActionData = new JsonString(((JsonString) hoverActionData).getValue());
} else if (hoverActionData instanceof FancyMessage) {
obj.hoverActionData = ((FancyMessage) hoverActionData).clone();
}
obj.translationReplacements =
(ArrayList<JsonRepresentedObject>) translationReplacements.clone();
return obj;
}
public void writeJson(JsonWriter json) {
try {
json.beginObject();
text.writeJson(json);
json.name("color").value(color.name().toLowerCase());
for (final ChatColor style : styles) {
json.name(stylesToNames.get(style)).value(true);
}
if (clickActionName != null && clickActionData != null) {
json.name("clickEvent").beginObject().name("action").value(clickActionName)
.name("value").value(clickActionData).endObject();
}
if (hoverActionName != null && hoverActionData != null) {
json.name("hoverEvent").beginObject().name("action").value(hoverActionName)
.name("value");
hoverActionData.writeJson(json);
json.endObject();
}
if (insertionData != null) {
json.name("insertion").value(insertionData);
}
if (translationReplacements.size() > 0 && TextualComponent.isTranslatableText(text)) {
json.name("with").beginArray();
for (JsonRepresentedObject obj : translationReplacements) {
obj.writeJson(json);
}
json.endArray();
}
json.endObject();
} catch (IOException e) {
Bukkit.getLogger()
.log(Level.WARNING, "A problem occurred during writing of JSON string", e);
}
}
public Map<String, Object> serialize() {
HashMap<String, Object> map = new HashMap<>();
map.put("text", text);
map.put("styles", styles);
map.put("color", color.getChar());
map.put("hoverActionName", hoverActionName);
map.put("hoverActionData", hoverActionData);
map.put("clickActionName", clickActionName);
map.put("clickActionData", clickActionData);
map.put("insertion", insertionData);
map.put("translationReplacements", translationReplacements);
return map;
}
}

View File

@ -1,202 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import org.bukkit.Bukkit;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* A class containing static utility methods and caches which are intended as reflective conveniences.
* Unless otherwise noted, upon failure methods will return {@code null}.
*/
public final class Reflection {
/**
* Stores loaded classes from the {@code net.minecraft.server} package.
*/
private static final Map<String, Class<?>> _loadedNMSClasses = new HashMap<>();
/**
* Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages).
*/
private static final Map<String, Class<?>> _loadedOBCClasses = new HashMap<>();
private static final Map<Class<?>, Map<String, Field>> _loadedFields = new HashMap<>();
/**
* Contains loaded methods in a cache.
* The map maps [types to maps of [method names to maps of [parameter types to method instances]]].
*/
private static final Map<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>>
_loadedMethods = new HashMap<>();
private static String _versionString;
private Reflection() {
}
/**
* Gets the version string from the package name of the CraftBukkit server implementation.
* This is needed to bypass the JAR package name changing on each update.
*
* @return The version string of the OBC and NMS packages, <em>including the trailing dot</em>.
*/
public synchronized static String getVersion() {
if (_versionString == null) {
String name = Bukkit.getServer().getClass().getPackage().getName();
_versionString = name.substring(name.lastIndexOf('.') + 1) + ".";
}
return _versionString;
}
/**
* Gets a {@link Class} object representing a type contained within the {@code net.minecraft.server} versioned package.
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
*
* @param className The name of the class, excluding the package, within NMS.
* @return The class instance representing the specified NMS class, or {@code null} if it could not be loaded.
*/
public synchronized static Class<?> getNMSClass(String className) {
if (_loadedNMSClasses.containsKey(className)) {
return _loadedNMSClasses.get(className);
}
String fullName = "net.minecraft.server." + getVersion() + className;
Class<?> clazz;
try {
clazz = Class.forName(fullName);
} catch (ClassNotFoundException e) {
_loadedNMSClasses.put(className, null);
throw new RuntimeException(e);
}
_loadedNMSClasses.put(className, clazz);
return clazz;
}
/**
* Gets a {@link Class} object representing a type contained within the {@code org.bukkit.craftbukkit} versioned package.
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
*
* @param className The name of the class, excluding the package, within OBC. This name may contain a subpackage name, such as {@code inventory.CraftItemStack}.
* @return The class instance representing the specified OBC class, or {@code null} if it could not be loaded.
*/
public synchronized static Class<?> getOBCClass(String className) {
if (_loadedOBCClasses.containsKey(className)) {
return _loadedOBCClasses.get(className);
}
String fullName = "org.bukkit.craftbukkit." + getVersion() + className;
Class<?> clazz;
try {
clazz = Class.forName(fullName);
} catch (ClassNotFoundException e) {
_loadedOBCClasses.put(className, null);
throw new RuntimeException(e);
}
_loadedOBCClasses.put(className, clazz);
return clazz;
}
/**
* Attempts to get the NMS handle of a CraftBukkit object.
* <p>
* The only match currently attempted by this method is a retrieval by using a parameterless {@code getHandle()} method implemented by the runtime type of the specified object.
* </p>
*
* @param obj The object for which to retrieve an NMS handle.
* @return The NMS handle of the specified object, or {@code null} if it could not be retrieved using {@code getHandle()}.
*/
public synchronized static Object getHandle(Object obj)
throws InvocationTargetException, IllegalAccessException, IllegalArgumentException {
return getMethod(obj.getClass(), "getHandle").invoke(obj);
}
/**
* Retrieves a {@link Field} instance declared by the specified class with the specified name.
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
* returned will be an instance or static field.
* <p>
* A global caching mechanism within this class is used to store fields. Combined with synchronization, this guarantees that
* no field will be reflectively looked up twice.
* </p>
* <p>
* If a field is deemed suitable for return, {@link Field#setAccessible(boolean) setAccessible} will be invoked with an argument of {@code true} before it is returned.
* This ensures that callers do not have to check or worry about Java access modifiers when dealing with the returned instance.
* </p>
*
* @param clazz The class which contains the field to retrieve.
* @param name The declared name of the field in the class.
* @return A field object with the specified name declared by the specified class.
* @see Class#getDeclaredField(String)
*/
public synchronized static Field getField(Class<?> clazz, String name) {
Map<String, Field> loaded;
if (!_loadedFields.containsKey(clazz)) {
loaded = new HashMap<>();
_loadedFields.put(clazz, loaded);
} else {
loaded = _loadedFields.get(clazz);
}
if (loaded.containsKey(name)) {
// If the field is loaded (or cached as not existing), return the relevant value, which might be null
return loaded.get(name);
}
try {
Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
loaded.put(name, field);
return field;
} catch (NoSuchFieldException | SecurityException e) {
// Error loading
e.printStackTrace();
// Cache field as not existing
loaded.put(name, null);
return null;
}
}
/**
* Retrieves a {@link Method} instance declared by the specified class with the specified name and argument types.
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
* returned will be an instance or static field.
* <p>
* A global caching mechanism within this class is used to store method. Combined with synchronization, this guarantees that
* no method will be reflectively looked up twice.
* <p>
* If a method is deemed suitable for return, {@link Method#setAccessible(boolean) setAccessible} will be invoked with an argument of {@code true} before it is returned.
* This ensures that callers do not have to check or worry about Java access modifiers when dealing with the returned instance.
* <p>
* This method does <em>not</em> search superclasses of the specified type for methods with the specified signature.
* Callers wishing this behavior should use {@link Class#getDeclaredMethod(String, Class...)}.
*
* @param clazz The class which contains the method to retrieve.
* @param name The declared name of the method in the class.
* @param args The formal argument types of the method.
* @return A method object with the specified name declared by the specified class.
*/
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
_loadedMethods.computeIfAbsent(clazz, k -> new HashMap<>());
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames =
_loadedMethods.get(clazz);
loadedMethodNames.computeIfAbsent(name, k -> new HashMap<>());
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);
ArrayWrapper<Class<?>> wrappedArg = new ArrayWrapper<>(args);
if (loadedSignatures.containsKey(wrappedArg)) {
return loadedSignatures.get(wrappedArg);
}
for (Method m : clazz.getMethods()) {
if (m.getName().equals(name) && Arrays.equals(args, m.getParameterTypes())) {
m.setAccessible(true);
loadedSignatures.put(wrappedArg, m);
return m;
}
}
loadedSignatures.put(wrappedArg, null);
return null;
}
}

View File

@ -1,313 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.chat;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.gson.stream.JsonWriter;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Represents a textual component of a message part.
* This can be used to not only represent string literals in a JSON message,
* but also to represent localized strings and other text values.
* <p>Different instances of this class can be created with static constructor methods.</p>
*/
public abstract class TextualComponent implements Cloneable {
static {
ConfigurationSerialization.registerClass(TextualComponent.ArbitraryTextTypeComponent.class);
ConfigurationSerialization.registerClass(TextualComponent.ComplexTextTypeComponent.class);
}
static TextualComponent deserialize(Map<String, Object> map) {
if (map.containsKey("key") && map.size() == 2 && map.containsKey("value")) {
// Arbitrary text component
return ArbitraryTextTypeComponent.deserialize(map);
} else if (map.size() >= 2 && map.containsKey("key") && !map
.containsKey("value") /* It contains keys that START WITH value */) {
// Complex JSON object
return ComplexTextTypeComponent.deserialize(map);
}
return null;
}
static boolean isTextKey(String key) {
return key.equals("translate") || key.equals("text") || key.equals("score") || key
.equals("selector");
}
static boolean isTranslatableText(TextualComponent component) {
return component instanceof ComplexTextTypeComponent && component.getKey()
.equals("translate");
}
/**
* Create a textual component representing a string literal.
*
* <p>This is the default type of textual component when a single string
* literal is given to a method.
*
* @param textValue The text which will be represented.
* @return The text component representing the specified literal text.
*/
public static TextualComponent rawText(String textValue) {
return new ArbitraryTextTypeComponent("text", textValue);
}
/**
* Create a textual component representing a localized string.
* The client will see this text component as their localized version of the specified string <em>key</em>, which can be overridden by a
* resource pack.
* <p>
* If the specified translation key is not present on the client resource pack, the translation key will be displayed as a string literal to
* the client.
* </p>
*
* @param translateKey The string key which maps to localized text.
* @return The text component representing the specified localized text.
*/
public static TextualComponent localizedText(String translateKey) {
return new ArbitraryTextTypeComponent("translate", translateKey);
}
private static void throwUnsupportedSnapshot() {
throw new UnsupportedOperationException(
"This feature is only supported in snapshot releases.");
}
/**
* Create a textual component representing a scoreboard value.
* The client will see their own score for the specified objective as the text represented by this component.
* <p>
* <b>This method is currently guaranteed to throw an {@code UnsupportedOperationException} as it is only supported on snapshot clients.</b>
* </p>
*
* @param scoreboardObjective The name of the objective for which to display the score.
* @return The text component representing the specified scoreboard score (for the viewing player), or {@code null} if an error occurs during
* JSON serialization.
*/
public static TextualComponent objectiveScore(String scoreboardObjective) {
return objectiveScore("*", scoreboardObjective);
}
/**
* Create a textual component representing a scoreboard value.
* The client will see the score of the specified player for the specified objective as the text represented by this component.
*
* <p><b>This method is currently guaranteed to throw an {@code UnsupportedOperationException}
* as it is only supported on snapshot clients.</b>
*
* @param playerName The name of the player whos score will be shown. If
* this string represents the single-character sequence
* "*", the viewing player's score will be displayed.
* Standard minecraft selectors (@a, @p, etc)
* are <em>not</em> supported.
* @param scoreboardObjective The name of the objective for
* which to display the score.
* @return The text component representing the specified scoreboard score
* for the specified player, or {@code null} if an error occurs during JSON serialization.
*/
public static TextualComponent objectiveScore(String playerName, String scoreboardObjective) {
throwUnsupportedSnapshot(); // Remove this line when the feature is released to non-snapshot versions, in addition to updating ALL THE
// OVERLOADS documentation accordingly
return new ComplexTextTypeComponent("score",
ImmutableMap.<String, String>builder().put("name", playerName)
.put("objective", scoreboardObjective).build());
}
/**
* Create a textual component representing a player name, retrievable by using a standard minecraft selector.
* The client will see the players or entities captured by the specified selector as the text represented by this component.
* <p>
* <b>This method is currently guaranteed to throw an {@code UnsupportedOperationException} as it is only supported on snapshot clients.</b>
* </p>
*
* @param selector The minecraft player or entity selector which will capture the entities whose string representations will be displayed in
* the place of this text component.
* @return The text component representing the name of the entities captured by the selector.
*/
public static TextualComponent selector(String selector) {
throwUnsupportedSnapshot(); // Remove this line when the feature is released to non-snapshot versions, in addition to updating ALL THE
// OVERLOADS documentation accordingly
return new ArbitraryTextTypeComponent("selector", selector);
}
@Override public String toString() {
return getReadableString();
}
/**
* @return The JSON key used to represent text components of this type.
*/
public abstract String getKey();
/**
* @return A readable String
*/
public abstract String getReadableString();
/**
* Clones a textual component instance.
* The returned object should not reference this textual component instance, but should maintain the same key and value.
*/
@Override public abstract TextualComponent clone() throws CloneNotSupportedException;
/**
* Writes the text data represented by this textual component to the specified JSON writer object.
* A new object within the writer is not started.
*
* @param writer The object to which to write the JSON data.
* @throws IOException If an error occurs while writing to the stream.
*/
public abstract void writeJson(JsonWriter writer) throws IOException;
/**
* Internal class used to represent all types of text components.
* Exception validating done is on keys and values.
*/
private static final class ArbitraryTextTypeComponent extends TextualComponent
implements ConfigurationSerializable {
private String key;
private String value;
public ArbitraryTextTypeComponent(String key, String value) {
setKey(key);
setValue(value);
}
public static ArbitraryTextTypeComponent deserialize(Map<String, Object> map) {
return new ArbitraryTextTypeComponent(map.get("key").toString(),
map.get("value").toString());
}
@Override public String getKey() {
return key;
}
public void setKey(String key) {
Preconditions
.checkArgument(key != null && !key.isEmpty(), "The key must be specified.");
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
Preconditions.checkArgument(value != null, "The value must be specified.");
this.value = value;
}
@Override public TextualComponent clone() throws CloneNotSupportedException {
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
return new ArbitraryTextTypeComponent(getKey(), getValue());
}
@Override public void writeJson(JsonWriter writer) throws IOException {
writer.name(getKey()).value(getValue());
}
@Override @SuppressWarnings("serial") public Map<String, Object> serialize() {
return new HashMap<String, Object>() {
{
put("key", getKey());
put("value", getValue());
}
};
}
@Override public String getReadableString() {
return getValue();
}
}
/**
* Internal class used to represent a text component with a nested JSON
* value.
*
* <p>Exception validating done is on keys and values.
*/
private static final class ComplexTextTypeComponent extends TextualComponent
implements ConfigurationSerializable {
private String key;
private Map<String, String> value;
public ComplexTextTypeComponent(String key, Map<String, String> values) {
setKey(key);
setValue(values);
}
public static ComplexTextTypeComponent deserialize(Map<String, Object> map) {
String key = null;
Map<String, String> value = new HashMap<>();
for (Map.Entry<String, Object> valEntry : map.entrySet()) {
if (valEntry.getKey().equals("key")) {
key = (String) valEntry.getValue();
} else if (valEntry.getKey().startsWith("value.")) {
value.put(valEntry.getKey().substring(6) /* Strips out the value prefix */,
valEntry.getValue().toString());
}
}
return new ComplexTextTypeComponent(key, value);
}
@Override public String getKey() {
return key;
}
public void setKey(String key) {
Preconditions
.checkArgument(key != null && !key.isEmpty(), "The key must be specified.");
this.key = key;
}
public Map<String, String> getValue() {
return value;
}
public void setValue(Map<String, String> value) {
Preconditions.checkArgument(value != null, "The value must be specified.");
this.value = value;
}
@Override public TextualComponent clone() {
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
return new ComplexTextTypeComponent(getKey(), getValue());
}
@Override public void writeJson(JsonWriter writer) throws IOException {
writer.name(getKey());
writer.beginObject();
for (Map.Entry<String, String> jsonPair : value.entrySet()) {
writer.name(jsonPair.getKey()).value(jsonPair.getValue());
}
writer.endObject();
}
@Override @SuppressWarnings("serial") public Map<String, Object> serialize() {
return new java.util.HashMap<String, Object>() {
{
put("key", getKey());
for (Map.Entry<String, String> valEntry : getValue().entrySet()) {
put("value." + valEntry.getKey(), valEntry.getValue());
}
}
};
}
@Override public String getReadableString() {
return getKey();
}
}
}

View File

@ -1,295 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.commands;
import com.github.intellectualsites.plotsquared.bukkit.uuid.DatFileFilter;
import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.github.intellectualsites.plotsquared.commands.Argument;
import com.github.intellectualsites.plotsquared.commands.CommandDeclaration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.commands.CommandCategory;
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
import com.github.intellectualsites.plotsquared.plot.commands.SubCommand;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import com.google.common.collect.Sets;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
@CommandDeclaration(command = "uuidconvert", permission = "plots.admin",
description = "Debug UUID conversion", usage = "/plot uuidconvert <lower|offline|online>",
requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) public class DebugUUID
extends SubCommand {
public DebugUUID() {
super(Argument.String);
}
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
final UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
final UUIDWrapper newWrapper;
switch (args[0].toLowerCase()) {
case "lower":
newWrapper = new LowerOfflineUUIDWrapper();
break;
case "offline":
newWrapper = new OfflineUUIDWrapper();
break;
case "online":
newWrapper = new DefaultUUIDWrapper();
break;
default:
try {
Class<?> clazz = Class.forName(args[0]);
newWrapper = (UUIDWrapper) clazz.newInstance();
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot uuidconvert <lower|offline|online>");
return false;
}
}
if (args.length != 2 || !"-o".equals(args[1])) {
MainUtil.sendMessage(player, Captions.COMMAND_SYNTAX,
"/plot uuidconvert " + args[0] + " -o");
MainUtil.sendMessage(player, "&cBe aware of the following!");
MainUtil.sendMessage(player,
"&8 - &cUse the database command or another method to backup your plots beforehand");
MainUtil.sendMessage(player,
"&8 - &cIf the process is interrupted, all plots could be deleted");
MainUtil.sendMessage(player, "&8 - &cIf an error occurs, all plots could be deleted");
MainUtil.sendMessage(player, "&8 - &cPlot settings WILL be lost upon conversion");
MainUtil
.sendMessage(player, "&cTO REITERATE: BACK UP YOUR DATABASE BEFORE USING THIS!!!");
MainUtil.sendMessage(player,
"&7Retype the command with the override parameter when ready :)");
return false;
}
if (currentUUIDWrapper.getClass().getCanonicalName()
.equals(newWrapper.getClass().getCanonicalName())) {
MainUtil.sendMessage(player, "&cUUID mode already in use!");
return false;
}
MainUtil.sendMessage(player, "&6Beginning UUID mode conversion");
MainUtil.sendMessage(player, "&7 - Disconnecting players");
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
entry.getValue()
.kick("UUID conversion has been initiated. You may reconnect when finished.");
}
MainUtil.sendMessage(player, "&7 - Initializing map");
final HashMap<UUID, UUID> uCMap = new HashMap<>();
final HashMap<UUID, UUID> uCReverse = new HashMap<>();
MainUtil.sendMessage(player, "&7 - Collecting playerdata");
HashSet<String> worlds = Sets.newHashSet(WorldUtil.IMP.getMainWorld(), "world");
HashSet<UUID> uuids = new HashSet<>();
HashSet<String> names = new HashSet<>();
for (String worldName : worlds) {
File playerDataFolder = new File(worldName + File.separator + "playerdata");
String[] dat = playerDataFolder.list(new DatFileFilter());
if (dat != null) {
for (String current : dat) {
String s = current.replaceAll(".dat$", "");
try {
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (Exception ignored) {
MainUtil.sendMessage(player,
Captions.PREFIX + "Invalid playerdata: " + current);
}
}
}
File playersFolder = new File(worldName + File.separator + "players");
dat = playersFolder.list(new DatFileFilter());
if (dat != null) {
for (String current : dat) {
names.add(current.replaceAll(".dat$", ""));
}
}
}
MainUtil.sendMessage(player, "&7 - Populating map");
UUID uuid2;
UUIDWrapper wrapper = new DefaultUUIDWrapper();
for (UUID uuid : uuids) {
try {
OfflinePlotPlayer op = wrapper.getOfflinePlayer(uuid);
uuid = currentUUIDWrapper.getUUID(op);
uuid2 = newWrapper.getUUID(op);
if (!uuid.equals(uuid2) && !uCMap.containsKey(uuid) && !uCReverse
.containsKey(uuid2)) {
uCMap.put(uuid, uuid2);
uCReverse.put(uuid2, uuid);
}
} catch (Throwable ignored) {
MainUtil.sendMessage(player,
Captions.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
}
}
for (String name : names) {
UUID uuid = currentUUIDWrapper.getUUID(name);
uuid2 = newWrapper.getUUID(name);
if (!uuid.equals(uuid2)) {
uCMap.put(uuid, uuid2);
uCReverse.put(uuid2, uuid);
}
}
if (uCMap.isEmpty()) {
MainUtil.sendMessage(player, "&c - Error! Attempting to repopulate");
for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) {
if (op.getLastPlayed() != 0) {
// String name = op.getPluginName();
// StringWrapper wrap = new StringWrapper(name);
UUID uuid = currentUUIDWrapper.getUUID(op);
uuid2 = newWrapper.getUUID(op);
if (!uuid.equals(uuid2)) {
uCMap.put(uuid, uuid2);
uCReverse.put(uuid2, uuid);
}
}
}
if (uCMap.isEmpty()) {
MainUtil.sendMessage(player, "&cError. Failed to collect UUIDs!");
return false;
} else {
MainUtil.sendMessage(player, "&a - Successfully repopulated");
}
}
MainUtil.sendMessage(player, "&7 - Replacing cache");
TaskManager.runTaskAsync(() -> {
for (Entry<UUID, UUID> entry : uCMap.entrySet()) {
String name = UUIDHandler.getName(entry.getKey());
if (name != null) {
UUIDHandler.add(new StringWrapper(name), entry.getValue());
}
}
MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)");
File file = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
if (file.exists()) {
try {
List<String> lines = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
for (String line : lines) {
try {
line = line.trim();
if (line.isEmpty()) {
continue;
}
line = line.replaceAll("[\\|][0-9]+[\\|][0-9]+[\\|]", "");
String[] split = line.split("\\|");
String name = split[0];
if (name.isEmpty() || name.length() > 16 || !StringMan
.isAlphanumericUnd(name)) {
continue;
}
UUID old = currentUUIDWrapper.getUUID(name);
if (old == null) {
continue;
}
UUID now = newWrapper.getUUID(name);
UUIDHandler.add(new StringWrapper(name), now);
uCMap.put(old, now);
uCReverse.put(now, old);
} catch (Exception e2) {
e2.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
MainUtil.sendMessage(player, "&7 - Replacing wrapper");
UUIDHandler.setUUIDWrapper(newWrapper);
MainUtil.sendMessage(player, "&7 - Updating plot objects");
for (Plot plot : PlotSquared.get().getPlots()) {
UUID value = uCMap.get(plot.owner);
if (value != null) {
plot.owner = value;
}
plot.getTrusted().clear();
plot.getMembers().clear();
plot.getDenied().clear();
}
MainUtil.sendMessage(player, "&7 - Deleting database");
boolean result = DBFunc.deleteTables();
MainUtil.sendMessage(player, "&7 - Creating tables");
try {
DBFunc.createTables();
if (!result) {
MainUtil.sendMessage(player, "&cConversion failed! Attempting recovery");
for (Plot plot : PlotSquared.get().getPlots()) {
UUID value = uCReverse.get(plot.owner);
if (value != null) {
plot.owner = value;
}
}
DBFunc.createPlotsAndData(new ArrayList<>(PlotSquared.get().getPlots()),
() -> MainUtil.sendMessage(player, "&6Recovery was successful!"));
return;
}
} catch (Exception e) {
e.printStackTrace();
return;
}
if (newWrapper instanceof OfflineUUIDWrapper) {
PlotSquared.get().worlds.set("UUID.force-lowercase", false);
PlotSquared.get().worlds.set("UUID.offline", true);
} else if (newWrapper instanceof DefaultUUIDWrapper) {
PlotSquared.get().worlds.set("UUID.force-lowercase", false);
PlotSquared.get().worlds.set("UUID.offline", false);
}
try {
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
} catch (IOException ignored) {
MainUtil.sendMessage(player,
"Could not save configuration. It will need to be manual set!");
}
MainUtil.sendMessage(player, "&7 - Populating tables");
TaskManager.runTaskAsync(() -> {
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
DBFunc.createPlotsAndData(plots,
() -> MainUtil.sendMessage(player, "&aConversion complete!"));
});
MainUtil.sendMessage(player, "&aIt is now safe for players to join");
MainUtil.sendMessage(player,
"&cConversion is still in progress, you will be notified when it is complete");
});
return true;
}
}

View File

@ -1,59 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Plot plot;
private final boolean auto;
private boolean cancelled;
/**
* PlayerClaimPlotEvent: Called when a plot is claimed.
*
* @param player Player that claimed the plot
* @param plot Plot that was claimed
*/
public PlayerClaimPlotEvent(Player player, Plot plot, boolean auto) {
super(player);
this.plot = plot;
this.auto = auto;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the plot involved
*
* @return Plot
*/
public Plot getPlot() {
return this.plot;
}
/**
* @return true if it was an automated claim, else false
*/
public boolean wasAuto() {
return this.auto;
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public boolean isCancelled() {
return this.cancelled;
}
@Override public void setCancelled(boolean b) {
this.cancelled = b;
}
}

View File

@ -1,40 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class PlayerEnterPlotEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final Plot plot;
/**
* Called when a player leaves a plot.
*
* @param player Player that entered the plot
* @param plot Plot that was entered
*/
public PlayerEnterPlotEvent(Player player, Plot plot) {
super(player);
this.plot = plot;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the plot involved.
*
* @return Plot
*/
public Plot getPlot() {
return this.plot;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,43 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
*
*/
public class PlayerLeavePlotEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final Plot plot;
/**
* PlayerLeavePlotEvent: Called when a player leaves a plot
*
* @param player Player that left the plot
* @param plot Plot that was left
*/
public PlayerLeavePlotEvent(Player player, Plot plot) {
super(player);
this.plot = plot;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the plot involved
*
* @return Plot
*/
public Plot getPlot() {
return this.plot;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,65 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import java.util.UUID;
public class PlayerPlotDeniedEvent extends PlotEvent {
private static final HandlerList handlers = new HandlerList();
private final Player initiator;
private final boolean added;
private final UUID player;
/**
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a plot.
*
* @param initiator Player that initiated the event
* @param plot Plot in which the event occurred
* @param player Player that was denied/un-denied
* @param added true of add to deny list, false if removed
*/
public PlayerPlotDeniedEvent(Player initiator, Plot plot, UUID player, boolean added) {
super(plot);
this.initiator = initiator;
this.added = added;
this.player = player;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* If a user was added.
*
* @return boolean
*/
public boolean wasAdded() {
return this.added;
}
/**
* The player added/removed.
*
* @return UUID
*/
public UUID getPlayer() {
return this.player;
}
/**
* The player initiating the action.
*
* @return Player
*/
public Player getInitiator() {
return this.initiator;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,68 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import java.util.UUID;
/**
*
*/
public class PlayerPlotHelperEvent extends PlotEvent {
private static final HandlerList handlers = new HandlerList();
private final Player initiator;
private final boolean added;
private final UUID player;
/**
* PlayerPlotHelperEvent: Called when a plot helper is added/removed
*
* @param initiator Player that initiated the event
* @param plot Plot in which the event occurred
* @param player Player that was added/removed from the helper list
* @param added true of the player was added, false if the player was removed
*/
public PlayerPlotHelperEvent(Player initiator, Plot plot, UUID player, boolean added) {
super(plot);
this.initiator = initiator;
this.added = added;
this.player = player;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* If a player was added
*
* @return boolean
*/
public boolean wasAdded() {
return this.added;
}
/**
* The UUID added/removed
*
* @return UUID
*/
public UUID getPlayer() {
return this.player;
}
/**
* The player initiating the action
*
* @return Player
*/
public Player getInitiator() {
return this.initiator;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,65 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import java.util.UUID;
public class PlayerPlotTrustedEvent extends PlotEvent {
private static final HandlerList handlers = new HandlerList();
private final Player initiator;
private final boolean added;
private final UUID player;
/**
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
*
* @param initiator Player that initiated the event
* @param plot Plot in which the event occurred
* @param player Player that was added/removed from the trusted list
* @param added true of the player was added, false if the player was removed
*/
public PlayerPlotTrustedEvent(Player initiator, Plot plot, UUID player, boolean added) {
super(plot);
this.initiator = initiator;
this.added = added;
this.player = player;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* If a player was added
*
* @return boolean
*/
public boolean wasAdded() {
return this.added;
}
/**
* The UUID added/removed
*
* @return UUID
*/
public UUID getPlayer() {
return this.player;
}
/**
* The player initiating the action
*
* @return Player
*/
public Player getInitiator() {
return this.initiator;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,66 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* Called when a player teleports to a plot
*/
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Location from;
private final Plot plot;
private boolean cancelled;
/**
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
*
* @param player That was teleported
* @param from Start location
* @param plot Plot to which the player was teleported
*/
public PlayerTeleportToPlotEvent(Player player, Location from, Plot plot) {
super(player);
this.from = from;
this.plot = plot;
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override public HandlerList getHandlers() {
return handlers;
}
/**
* Get the from location
*
* @return Location
*/
public Location getFrom() {
return this.from;
}
/**
* Get the plot involved
*
* @return Plot
*/
public Plot getPlot() {
return this.plot;
}
@Override public boolean isCancelled() {
return this.cancelled;
}
@Override public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -1,56 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
/**
* Event called when plots are automatically merged with /plot auto
* {@inheritDoc}
*/
public final class PlotAutoMergeEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final List<PlotId> plots;
@Getter private final World world;
@Getter @Setter private boolean cancelled;
/**
* PlotAutoMergeEvent: Called when plots are automatically merged with /plot auto
*
* @param world World in which the event occurred
* @param plot Plot that was merged
* @param plots A list of plots involved in the event
*/
public PlotAutoMergeEvent(@NotNull final World world, @NotNull final Plot plot,
@NotNull final List<PlotId> plots) {
super(plot);
this.world = world;
this.plots = plots;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the plots being added.
*
* @return Unmodifiable list containing the merging plots
*/
public List<PlotId> getPlots() {
return Collections.unmodifiableList(this.plots);
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,105 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import java.util.UUID;
public class PlotChangeOwnerEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Player initiator;
private final UUID newOwner;
private final UUID oldOwner;
private boolean hasOldOwner;
private boolean cancelled;
/**
* PlotChangeOwnerEvent: Called when a plot's owner is change.
*
* @param newOwner The new owner of the plot
* @param oldOwner The old owner of the plot
* @param plot The plot having its owner changed
*/
public PlotChangeOwnerEvent(Player initiator, Plot plot, UUID oldOwner, UUID newOwner,
boolean hasOldOwner) {
super(plot);
this.initiator = initiator;
this.newOwner = newOwner;
this.oldOwner = oldOwner;
this.hasOldOwner = hasOldOwner;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the PlotId.
*
* @return PlotId
*/
public PlotId getPlotId() {
return getPlot().getId();
}
/**
* Get the world name.
*
* @return String
*/
public String getWorld() {
return getPlot().getWorldName();
}
/**
* Get the change-owner initator
*
* @return Player
*/
public Player getInitiator() {
return this.initiator;
}
/**
* Get the old owner of the plot. Null if not exists.
*
* @return UUID
*/
public UUID getOldOwner() {
return this.oldOwner;
}
/**
* Get the new owner of the plot
*
* @return UUID
*/
public UUID getNewOwner() {
return this.newOwner;
}
/**
* Get if the plot had an old owner
*
* @return boolean
*/
public boolean hasOldOwner() {
return this.hasOldOwner;
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public boolean isCancelled() {
return this.cancelled;
}
@Override public void setCancelled(boolean b) {
this.cancelled = b;
}
}

View File

@ -1,53 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
* Called when a plot is cleared
*/
public class PlotClearEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
public PlotClearEvent(Plot plot) {
super(plot);
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the PlotId.
*
* @return PlotId
*/
public PlotId getPlotId() {
return getPlot().getId();
}
/**
* Get the world name.
*
* @return String
*/
public String getWorld() {
return getPlot().getWorldName();
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public boolean isCancelled() {
return this.cancelled;
}
@Override public void setCancelled(boolean b) {
this.cancelled = b;
}
}

View File

@ -1,54 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import org.bukkit.event.HandlerList;
/**
* Called when a plot component is set
*/
public class PlotComponentSetEvent extends PlotEvent {
private static final HandlerList handlers = new HandlerList();
private final String component;
public PlotComponentSetEvent(Plot plot, String component) {
super(plot);
this.component = component;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the PlotId
*
* @return PlotId
*/
public PlotId getPlotId() {
return getPlot().getId();
}
/**
* Get the world name
*
* @return String
*/
public String getWorld() {
return getPlot().getWorldName();
}
/**
* Get the component which was set
*
* @return Component name
*/
public String getComponent() {
return this.component;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,53 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
* Called when a plot is deleted
*/
public class PlotDeleteEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
public PlotDeleteEvent(Plot plot) {
super(plot);
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the PlotId.
*
* @return PlotId
*/
public PlotId getPlotId() {
return getPlot().getId();
}
/**
* Get the world name.
*
* @return String
*/
public String getWorld() {
return getPlot().getWorldName();
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public boolean isCancelled() {
return this.cancelled;
}
@Override public void setCancelled(boolean b) {
this.cancelled = b;
}
}

View File

@ -1,18 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.event.Event;
public abstract class PlotEvent extends Event {
private final Plot plot;
public PlotEvent(Plot plot) {
this.plot = plot;
}
public final Plot getPlot() {
return this.plot;
}
}

View File

@ -1,52 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
* Called when a Flag is added to a plot.
*/
public class PlotFlagAddEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Flag flag;
private boolean cancelled;
/**
* PlotFlagAddEvent: Called when a Flag is added to a plot.
*
* @param flag Flag that was added
* @param plot Plot to which the flag was added
*/
public PlotFlagAddEvent(Flag flag, Plot plot) {
super(plot);
this.flag = flag;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the flag involved.
*
* @return Flag
*/
public Flag getFlag() {
return this.flag;
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public final boolean isCancelled() {
return this.cancelled;
}
@Override public final void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -1,52 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
* Called when a flag is removed from a plot
*/
public class PlotFlagRemoveEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Flag flag;
private boolean cancelled;
/**
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
*
* @param flag Flag that was removed
* @param plot Plot from which the flag was removed
*/
public PlotFlagRemoveEvent(Flag flag, Plot plot) {
super(plot);
this.flag = flag;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the flag involved
*
* @return Flag
*/
public Flag getFlag() {
return this.flag;
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public final boolean isCancelled() {
return this.cancelled;
}
@Override public final void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -1,46 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Event called when several plots are merged
* {@inheritDoc}
*/
public final class PlotMergeEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@Getter private final int dir;
@Getter private final int max;
@Getter private final World world;
@Getter @Setter private boolean cancelled;
/**
* PlotMergeEvent: Called when plots are merged
*
* @param world World in which the event occurred
* @param plot Plot that was merged
* @param dir The direction of the merge
* @param max Max merge size
*/
public PlotMergeEvent(@NotNull final World world, @NotNull final Plot plot,
@NotNull final int dir, @NotNull final int max) {
super(plot);
this.world = world;
this.dir = dir;
this.max = max;
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,49 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.Rating;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
public class PlotRateEvent extends PlotEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final PlotPlayer rater;
private Rating rating;
private boolean cancelled = false;
public PlotRateEvent(PlotPlayer rater, Rating rating, Plot plot) {
super(plot);
this.rater = rater;
this.rating = rating;
}
public static HandlerList getHandlerList() {
return handlers;
}
public PlotPlayer getRater() {
return this.rater;
}
public Rating getRating() {
return this.rating;
}
public void setRating(Rating rating) {
this.rating = rating;
}
@Override public HandlerList getHandlers() {
return handlers;
}
@Override public boolean isCancelled() {
return this.cancelled;
}
@Override public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}

View File

@ -1,57 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.events;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
/**
* Event called when several merged plots are unlinked
* {@inheritDoc}
*/
public final class PlotUnlinkEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final List<PlotId> plots;
@Getter private final World world;
@Getter private final PlotArea area;
@Getter @Setter private boolean cancelled;
/**
* Called when a mega-plot is unlinked.
*
* @param world World in which the event occurred
* @param plots Plots that are involved in the event
*/
public PlotUnlinkEvent(@NotNull final World world, @NotNull final PlotArea area,
@NotNull final List<PlotId> plots) {
this.plots = plots;
this.world = world;
this.area = area;
}
public static HandlerList getHandlerList() {
return handlers;
}
/**
* Get the plots involved.
*
* @return Unmodifiable list containing {@link PlotId PlotIds} of the plots involved
*/
public List<PlotId> getPlots() {
return Collections.unmodifiableList(this.plots);
}
@Override public HandlerList getHandlers() {
return handlers;
}
}

View File

@ -1,32 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.generator;
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import org.jetbrains.annotations.NotNull;
import java.util.Random;
public class BukkitAugmentedGenerator extends BlockPopulator {
private static BukkitAugmentedGenerator generator;
public static BukkitAugmentedGenerator get(World world) {
for (BlockPopulator populator : world.getPopulators()) {
if (populator instanceof BukkitAugmentedGenerator) {
return (BukkitAugmentedGenerator) populator;
}
}
if (generator == null) {
generator = new BukkitAugmentedGenerator();
}
world.getPopulators().add(generator);
return generator;
}
@Override
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk source) {
AugmentedUtils.generate(world.getName(), source.getX(), source.getZ(), null);
}
}

View File

@ -1,208 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.generator;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.bukkit.util.block.GenChunk;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import com.sk89q.worldedit.math.BlockVector2;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Set;
public class BukkitPlotGenerator extends ChunkGenerator
implements GeneratorWrapper<ChunkGenerator> {
@SuppressWarnings("unused") public final boolean PAPER_ASYNC_SAFE = true;
private final IndependentPlotGenerator plotGenerator;
private final ChunkGenerator platformGenerator;
private final boolean full;
private List<BlockPopulator> populators;
private boolean loaded = false;
public BukkitPlotGenerator(IndependentPlotGenerator generator) {
if (generator == null) {
throw new IllegalArgumentException("Generator may not be null!");
}
this.plotGenerator = generator;
this.platformGenerator = this;
this.populators = new ArrayList<>();
this.populators.add(new BlockStatePopulator(this.plotGenerator));
this.full = true;
MainUtil.initCache();
}
public BukkitPlotGenerator(final String world, final ChunkGenerator cg) {
if (cg instanceof BukkitPlotGenerator) {
throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName()
+ " is already a BukkitPlotGenerator!");
}
this.full = false;
this.platformGenerator = cg;
this.plotGenerator = new DelegatePlotGenerator(cg, world);
MainUtil.initCache();
}
@Override public void augment(PlotArea area) {
BukkitAugmentedGenerator.get(BukkitUtil.getWorld(area.worldname));
}
@Override public boolean isFull() {
return this.full;
}
@Override public IndependentPlotGenerator getPlotGenerator() {
return this.plotGenerator;
}
@Override public ChunkGenerator getPlatformGenerator() {
return this.platformGenerator;
}
@Override @NotNull public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
try {
if (!this.loaded) {
String name = world.getName();
PlotSquared.get().loadWorld(name, this);
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(name);
if (!areas.isEmpty()) {
PlotArea area = areas.iterator().next();
if (!area.MOB_SPAWNING) {
if (!area.SPAWN_EGGS) {
world.setSpawnFlags(false, false);
}
world.setAmbientSpawnLimit(0);
world.setAnimalSpawnLimit(0);
world.setMonsterSpawnLimit(0);
world.setWaterAnimalSpawnLimit(0);
} else {
world.setSpawnFlags(true, true);
world.setAmbientSpawnLimit(-1);
world.setAnimalSpawnLimit(-1);
world.setMonsterSpawnLimit(-1);
world.setWaterAnimalSpawnLimit(-1);
}
}
this.loaded = true;
}
} catch (Exception e) {
e.printStackTrace();
}
ArrayList<BlockPopulator> toAdd = new ArrayList<>();
List<BlockPopulator> existing = world.getPopulators();
if (populators == null && platformGenerator != null) {
populators = new ArrayList<>(platformGenerator.getDefaultPopulators(world));
}
if (populators != null) {
for (BlockPopulator populator : this.populators) {
if (!existing.contains(populator)) {
toAdd.add(populator);
}
}
}
return toAdd;
}
@Override @NotNull
public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z,
@NotNull BiomeGrid biome) {
GenChunk result = new GenChunk();
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
if (result.getChunkData() != null) {
for (int chunkX = 0; chunkX < 16; chunkX++) {
for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
biome.setBiome(chunkX, chunkZ, Biome.PLAINS);
}
}
return result.getChunkData();
}
}
// Set the chunk location
result.setChunk(new ChunkWrapper(world.getName(), x, z));
// Set the result data
result.setChunkData(createChunkData(world));
result.biomeGrid = biome;
result.result = null;
// Catch any exceptions (as exceptions usually thrown)
try {
// Fill the result data if necessary
if (this.platformGenerator != this) {
return this.platformGenerator.generateChunkData(world, random, x, z, biome);
} else {
generate(BlockVector2.at(x, z), world, result);
}
} catch (Throwable e) {
e.printStackTrace();
}
// Return the result data
return result.getChunkData();
}
private void generate(BlockVector2 loc, World world, ScopedLocalBlockQueue result) {
// Load if improperly loaded
if (!this.loaded) {
String name = world.getName();
PlotSquared.get().loadWorld(name, this);
this.loaded = true;
}
// Process the chunk
if (ChunkManager.preProcessChunk(loc, result)) {
return;
}
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
try {
this.plotGenerator.generateChunk(result, area);
} catch (Throwable e) {
// Recover from generator error
e.printStackTrace();
}
ChunkManager.postProcessChunk(loc, result);
}
/**
* Allow spawning everywhere.
*
* @param world Ignored
* @param x Ignored
* @param z Ignored
* @return always true
*/
@Override public boolean canSpawn(@NotNull final World world, final int x, final int z) {
return true;
}
@Override public String toString() {
if (this.platformGenerator == this) {
return this.plotGenerator.getName();
}
if (this.platformGenerator == null) {
return "null";
} else {
return this.platformGenerator.getClass().getName();
}
}
@Override public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
return toString().equals(obj.toString()) || toString().equals(obj.getClass().getName());
}
}

View File

@ -1,64 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.generator;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import lombok.RequiredArgsConstructor;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range;
import java.util.Random;
@RequiredArgsConstructor final class DelegatePlotGenerator extends IndependentPlotGenerator {
private final ChunkGenerator chunkGenerator;
private final String world;
@Override public void initialize(PlotArea area) {
}
@Override public String getName() {
return this.chunkGenerator.getClass().getName();
}
@Override public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
return PlotSquared.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
}
@Override public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings) {
World world = BukkitUtil.getWorld(this.world);
Location min = result.getMin();
int chunkX = min.getX() >> 4;
int chunkZ = min.getZ() >> 4;
Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ));
try {
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
@Override public void setBiome(@Range(from = 0, to = 15) int x,
@Range(from = 0, to = 15) int z, Biome biome) {
result.setBiome(x, z, BukkitAdapter.adapt(biome));
}
@Override @NotNull public Biome getBiome(int x, int z) {
return Biome.FOREST;
}
};
chunkGenerator.generateChunkData(world, random, chunkX, chunkZ, grid);
return;
} catch (Throwable ignored) {
}
for (BlockPopulator populator : chunkGenerator.getDefaultPopulators(world)) {
populator.populate(world, random, world.getChunkAt(chunkX, chunkZ));
}
}
}

View File

@ -1,36 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.generator;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import lombok.RequiredArgsConstructor;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import org.jetbrains.annotations.NotNull;
import java.util.Random;
@RequiredArgsConstructor final class BlockStatePopulator extends BlockPopulator {
private final IndependentPlotGenerator plotGenerator;
private LocalBlockQueue queue;
@Override public void populate(@NotNull final World world, @NotNull final Random random,
@NotNull final Chunk source) {
if (this.queue == null) {
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
}
final PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
final ChunkWrapper wrap = new ChunkWrapper(area.worldname, source.getX(), source.getZ());
final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z);
if (this.plotGenerator.populateChunk(chunk, area)) {
this.queue.flush();
}
}
}

View File

@ -1,283 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefClass;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefField;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefMethod;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import java.lang.reflect.Method;
import java.util.HashSet;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused") public class ChunkListener implements Listener {
private RefMethod methodGetHandleChunk;
private RefField mustSave;
private Chunk lastChunk;
private boolean ignoreUnload = false;
public ChunkListener() {
if (Settings.Chunk_Processor.AUTO_TRIM) {
try {
RefClass classChunk = getRefClass("{nms}.Chunk");
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
this.mustSave = classChunk.getField("mustSave");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
} catch (Throwable ignored) {
PlotSquared.debug(PlotSquared.get().IMP.getPluginName()
+ "/Server not compatible for chunk processor trim/gc");
Settings.Chunk_Processor.AUTO_TRIM = false;
}
}
if (!Settings.Chunk_Processor.AUTO_TRIM) {
return;
}
for (World world : Bukkit.getWorlds()) {
world.setAutoSave(false);
}
TaskManager.runTaskRepeat(() -> {
try {
HashSet<Chunk> toUnload = new HashSet<>();
for (World world : Bukkit.getWorlds()) {
String worldName = world.getName();
if (!PlotSquared.get().hasPlotArea(worldName)) {
continue;
}
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
Object chunkMap = w.getClass().getDeclaredMethod("getPlayerChunkMap").invoke(w);
Method methodIsChunkInUse =
chunkMap.getClass().getDeclaredMethod("isChunkInUse", int.class, int.class);
Chunk[] chunks = world.getLoadedChunks();
for (Chunk chunk : chunks) {
if ((boolean) methodIsChunkInUse
.invoke(chunkMap, chunk.getX(), chunk.getZ())) {
continue;
}
int x = chunk.getX();
int z = chunk.getZ();
if (!shouldSave(worldName, x, z)) {
unloadChunk(worldName, chunk, false);
continue;
}
toUnload.add(chunk);
}
}
if (toUnload.isEmpty()) {
return;
}
long start = System.currentTimeMillis();
for (Chunk chunk : toUnload) {
if (System.currentTimeMillis() - start > 5) {
return;
}
chunk.unload(true);
}
} catch (Throwable e) {
e.printStackTrace();
}
}, 1);
}
public boolean unloadChunk(String world, Chunk chunk, boolean safe) {
if (safe && shouldSave(world, chunk.getX(), chunk.getZ())) {
return false;
}
Object c = this.methodGetHandleChunk.of(chunk).call();
RefField.RefExecutor field = this.mustSave.of(c);
if ((Boolean) field.get()) {
field.set(false);
if (chunk.isLoaded()) {
ignoreUnload = true;
chunk.unload(false);
ignoreUnload = false;
}
}
return true;
}
public boolean shouldSave(String world, int chunkX, int chunkZ) {
int x = chunkX << 4;
int z = chunkZ << 4;
int x2 = x + 15;
int z2 = z + 15;
Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs();
if (plot != null && plot.hasOwner()) {
return true;
}
plot = new Location(world, x2, 1, z2).getOwnedPlotAbs();
if (plot != null && plot.hasOwner()) {
return true;
}
plot = new Location(world, x2, 1, z).getOwnedPlotAbs();
if (plot != null && plot.hasOwner()) {
return true;
}
plot = new Location(world, x, 1, z2).getOwnedPlotAbs();
if (plot != null && plot.hasOwner()) {
return true;
}
plot = new Location(world, x + 7, 1, z + 7).getOwnedPlotAbs();
return plot != null && plot.hasOwner();
}
@EventHandler public void onChunkUnload(ChunkUnloadEvent event) {
if (ignoreUnload) {
return;
}
Chunk chunk = event.getChunk();
if (Settings.Chunk_Processor.AUTO_TRIM) {
String world = chunk.getWorld().getName();
if (PlotSquared.get().hasPlotArea(world)) {
if (unloadChunk(world, chunk, true)) {
return;
}
}
}
if (processChunk(event.getChunk(), true)) {
chunk.setForceLoaded(true);
}
}
@EventHandler public void onChunkLoad(ChunkLoadEvent event) {
processChunk(event.getChunk(), false);
}
@EventHandler(priority = EventPriority.LOWEST) public void onItemSpawn(ItemSpawnEvent event) {
Item entity = event.getEntity();
PaperLib.getChunkAtAsync(event.getLocation()).thenAccept(chunk -> {
if (chunk == this.lastChunk) {
event.getEntity().remove();
event.setCancelled(true);
return;
}
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
return;
}
Entity[] entities = chunk.getEntities();
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
event.getEntity().remove();
event.setCancelled(true);
this.lastChunk = chunk;
} else {
this.lastChunk = null;
}
});
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent event) {
if (Settings.Chunk_Processor.DISABLE_PHYSICS) {
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onEntitySpawn(CreatureSpawnEvent event) {
LivingEntity entity = event.getEntity();
PaperLib.getChunkAtAsync(event.getLocation()).thenAccept(chunk -> {
if (chunk == this.lastChunk) {
event.getEntity().remove();
event.setCancelled(true);
return;
}
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
return;
}
Entity[] entities = chunk.getEntities();
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
event.getEntity().remove();
event.setCancelled(true);
this.lastChunk = chunk;
} else {
this.lastChunk = null;
}
});
}
private void cleanChunk(final Chunk chunk) {
TaskManager.index.incrementAndGet();
final Integer currentIndex = TaskManager.index.get();
Integer task = TaskManager.runTaskRepeat(() -> {
if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
BlockState[] tiles = chunk.getTileEntities();
if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
long start = System.currentTimeMillis();
int i = 0;
while (System.currentTimeMillis() - start < 250) {
if (i >= tiles.length) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
tiles[i].getBlock().setType(Material.AIR, false);
i++;
}
}, 5);
TaskManager.tasks.put(currentIndex, task);
}
public boolean processChunk(Chunk chunk, boolean unload) {
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
return false;
}
Entity[] entities = chunk.getEntities();
BlockState[] tiles = chunk.getTileEntities();
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
for (Entity ent : entities) {
if (!(ent instanceof Player)) {
ent.remove();
}
}
PlotSquared.debug("PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
}
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) {
PlotSquared.debug("PlotSquared detected unsafe chunk: " + (chunk.getX()<< 4) + "," + (chunk.getX() << 4));
cleanChunk(chunk);
return true;
}
for (BlockState tile : tiles) {
tile.getBlock().setType(Material.AIR, false);
}
}
return false;
}
}

View File

@ -1,173 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import io.papermc.lib.PaperLib;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent;
import org.bukkit.event.vehicle.VehicleUpdateEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class EntitySpawnListener implements Listener {
private final static String KEY = "P2";
private static boolean ignoreTP = false;
private static boolean hasPlotArea = false;
private static String areaName = null;
public static void testNether(Entity entity) {
@NotNull World world = entity.getWorld();
if (world.getEnvironment() != World.Environment.NETHER
&& world.getEnvironment() != World.Environment.THE_END) {
return;
}
test(entity);
}
public static void testCreate(Entity entity) {
@NotNull World world = entity.getWorld();
if (areaName == world.getName()) {
} else {
areaName = world.getName();
hasPlotArea = PlotSquared.get().hasPlotArea(areaName);
}
if (!hasPlotArea)
return;
test(entity);
}
public static void test(Entity entity) {
@NotNull World world = entity.getWorld();
List<MetadataValue> meta = entity.getMetadata(KEY);
if (meta.isEmpty()) {
if (PlotSquared.get().hasPlotArea(world.getName())) {
entity.setMetadata(KEY,
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation()));
}
} else {
org.bukkit.Location origin = (org.bukkit.Location) meta.get(0).value();
World originWorld = origin.getWorld();
if (!originWorld.equals(world)) {
if (!ignoreTP) {
if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) {
try {
ignoreTP = true;
PaperLib.teleportAsync(entity,origin);
} finally {
ignoreTP = false;
}
if (entity.getLocation().getWorld().equals(world)) {
entity.remove();
}
}
} else {
entity.remove();
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void creatureSpawnEvent(EntitySpawnEvent event) {
Entity entity = event.getEntity();
Location location = BukkitUtil.getLocation(entity.getLocation());
PlotArea area = location.getPlotArea();
if (!location.isPlotArea()) {
return;
}
Plot plot = location.getOwnedPlotAbs();
if (plot == null) {
if (!area.MOB_SPAWNING) {
EntityType type = entity.getType();
switch (type) {
case DROPPED_ITEM:
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
break;
}
case PLAYER:
return;
}
if (type.isAlive() || !area.MISC_SPAWN_UNOWNED) {
event.setCancelled(true);
}
}
return;
}
if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) {
event.setCancelled(true);
}
switch (entity.getType()) {
case ENDER_CRYSTAL:
if (PlayerEvents.checkEntity(entity, plot)) {
event.setCancelled(true);
}
case SHULKER:
if (!entity.hasMetadata("shulkerPlot")) {
entity.setMetadata("shulkerPlot",
new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId()));
}
}
}
@EventHandler public void onChunkLoad(ChunkLoadEvent event) {
@NotNull Chunk chunk = event.getChunk();
for (Entity entity : chunk.getEntities()) {
testCreate(entity);
}
}
@EventHandler public void onVehicle(VehicleUpdateEvent event) {
testNether(event.getVehicle());
}
@EventHandler public void onVehicle(VehicleCreateEvent event) {
testCreate(event.getVehicle());
}
@EventHandler public void onVehicle(VehicleBlockCollisionEvent event) {
testNether(event.getVehicle());
}
@EventHandler public void onTeleport(EntityTeleportEvent event) {
Entity ent = event.getEntity();
if (ent instanceof Vehicle || ent instanceof ArmorStand) {
testNether(event.getEntity());
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void vehicleMove(VehicleMoveEvent event) {
testNether(event.getVehicle());
}
@EventHandler public void spawn(CreatureSpawnEvent event) {
if (event.getEntityType() == EntityType.ARMOR_STAND) {
testCreate(event.getEntity());
}
}
}

View File

@ -1,106 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
import com.google.common.collect.Iterables;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@SuppressWarnings("unused") public class ForceFieldListener {
private static Set<PlotPlayer> getNearbyPlayers(Player player, Plot plot) {
Set<PlotPlayer> players = new HashSet<>();
for (Player nearPlayer : Iterables
.filter(player.getNearbyEntities(5d, 5d, 5d), Player.class)) {
PlotPlayer plotPlayer;
if ((plotPlayer = BukkitUtil.getPlayer(nearPlayer)) == null || !plot
.equals(plotPlayer.getCurrentPlot())) {
continue;
}
if (!plot.isAdded(plotPlayer.getUUID())) {
players.add(plotPlayer);
}
}
return players;
}
private static PlotPlayer hasNearbyPermitted(Player player, Plot plot) {
for (Player nearPlayer : Iterables
.filter(player.getNearbyEntities(5d, 5d, 5d), Player.class)) {
PlotPlayer plotPlayer;
if ((plotPlayer = BukkitUtil.getPlayer(nearPlayer)) == null || !plot
.equals(plotPlayer.getCurrentPlot())) {
continue;
}
if (plot.isAdded(plotPlayer.getUUID())) {
return plotPlayer;
}
}
return null;
}
private static Vector calculateVelocity(PlotPlayer player, PlotPlayer e) {
Location playerLocation = player.getLocationFull();
Location oPlayerLocation = e.getLocation();
double playerX = playerLocation.getX();
double playerY = playerLocation.getY();
double playerZ = playerLocation.getZ();
double oPlayerX = oPlayerLocation.getX();
double oPlayerY = oPlayerLocation.getY();
double oPlayerZ = oPlayerLocation.getZ();
double x = 0d;
if (playerX < oPlayerX) {
x = 1.0d;
} else if (playerX > oPlayerX) {
x = -1.0d;
}
double y = 0d;
if (playerY < oPlayerY) {
y = 0.5d;
} else if (playerY > oPlayerY) {
y = -0.5d;
}
double z = 0d;
if (playerZ < oPlayerZ) {
z = 1.0d;
} else if (playerZ > oPlayerZ) {
z = -1.0d;
}
return new Vector(x, y, z);
}
public static void handleForcefield(Player player, PlotPlayer plotPlayer, Plot plot) {
if (Flags.FORCEFIELD.isTrue(plot)) {
UUID uuid = plotPlayer.getUUID();
if (plot.isAdded(uuid)) {
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
for (PlotPlayer oPlayer : players) {
if (!Permissions
.hasPermission(oPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
((BukkitPlayer) oPlayer).player
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
}
}
} else {
PlotPlayer oPlayer = hasNearbyPermitted(player, plot);
if (oPlayer == null) {
return;
}
if (!Permissions
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
}
}
}
}
}

View File

@ -1,189 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
import com.github.intellectualsites.plotsquared.plot.flag.IntervalFlag;
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.UUID;
@SuppressWarnings("unused") public class PlotPlusListener extends PlotListener implements Listener {
private static final HashMap<UUID, Interval> feedRunnable = new HashMap<>();
private static final HashMap<UUID, Interval> healRunnable = new HashMap<>();
public static void startRunnable(JavaPlugin plugin) {
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
if (!healRunnable.isEmpty()) {
for (Iterator<Entry<UUID, Interval>> iterator =
healRunnable.entrySet().iterator(); iterator.hasNext(); ) {
Entry<UUID, Interval> entry = iterator.next();
Interval value = entry.getValue();
++value.count;
if (value.count == value.interval) {
value.count = 0;
Player player = Bukkit.getPlayer(entry.getKey());
if (player == null) {
iterator.remove();
continue;
}
double level = player.getHealth();
if (level != value.max) {
player.setHealth(Math.min(level + value.amount, value.max));
}
}
}
}
if (!feedRunnable.isEmpty()) {
for (Iterator<Entry<UUID, Interval>> iterator =
feedRunnable.entrySet().iterator(); iterator.hasNext(); ) {
Entry<UUID, Interval> entry = iterator.next();
Interval value = entry.getValue();
++value.count;
if (value.count == value.interval) {
value.count = 0;
Player player = Bukkit.getPlayer(entry.getKey());
if (player == null) {
iterator.remove();
continue;
}
int level = player.getFoodLevel();
if (level != value.max) {
player.setFoodLevel(Math.min(level + value.amount, value.max));
}
}
}
}
}, 0L, 20L);
}
@EventHandler(priority = EventPriority.HIGH) public void onInteract(BlockDamageEvent event) {
Player player = event.getPlayer();
if (player.getGameMode() != GameMode.SURVIVAL) {
return;
}
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
if (plot == null) {
return;
}
if (Flags.INSTABREAK.isTrue(plot)) {
Block block = event.getBlock();
BlockBreakEvent call = new BlockBreakEvent(block, player);
Bukkit.getServer().getPluginManager().callEvent(call);
if (!call.isCancelled()) {
event.getBlock().breakNaturally();
}
}
}
@EventHandler(priority = EventPriority.HIGH) public void onDamage(EntityDamageEvent event) {
if (event.getEntityType() != EntityType.PLAYER) {
return;
}
Plot plot = BukkitUtil.getLocation(event.getEntity()).getOwnedPlot();
if (plot == null) {
return;
}
if (Flags.INVINCIBLE.isTrue(plot)) {
event.setCancelled(true);
}
}
@EventHandler public void onItemDrop(PlayerDropItemEvent event) {
Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
if (plot == null) {
return;
}
UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) {
if (Flags.ITEM_DROP.isFalse(plot)) {
event.setCancelled(true);
}
}
}
@EventHandler public void onPlotEnter(PlayerEnterPlotEvent event) {
Player player = event.getPlayer();
Plot plot = event.getPlot();
Optional<IntervalFlag.Interval> feed = plot.getFlag(Flags.FEED);
feed.ifPresent(value -> feedRunnable
.put(player.getUniqueId(), new Interval(value.getVal1(), value.getVal2(), 20)));
Optional<IntervalFlag.Interval> heal = plot.getFlag(Flags.HEAL);
heal.ifPresent(value -> healRunnable
.put(player.getUniqueId(), new Interval(value.getVal1(), value.getVal2(), 20)));
}
@EventHandler public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
feedRunnable.remove(player.getUniqueId());
healRunnable.remove(player.getUniqueId());
}
@EventHandler public void onPlotLeave(PlayerLeavePlotEvent event) {
Player leaver = event.getPlayer();
Plot plot = event.getPlot();
if (!plot.hasOwner()) {
return;
}
BukkitUtil.getPlayer(leaver);
feedRunnable.remove(leaver.getUniqueId());
healRunnable.remove(leaver.getUniqueId());
}
@EventHandler public void onItemPickup(EntityPickupItemEvent event) {
LivingEntity ent = event.getEntity();
if (ent instanceof Player) {
Player player = (Player) ent;
PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
if (plot == null) {
return;
}
UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) {
event.setCancelled(true);
}
}
}
private static class Interval {
final int interval;
final int amount;
final int max;
int count = 0;
Interval(int interval, int amount, int max) {
this.interval = interval;
this.amount = amount;
this.max = max;
}
}
}

View File

@ -1,100 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.plugin.Plugin;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused") public class SingleWorldListener implements Listener {
private Method methodGetHandleChunk;
private Field mustSave;
public SingleWorldListener(Plugin plugin) throws Exception {
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
try {
this.mustSave = classChunk.getField("mustSave").getRealField();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
Bukkit.getPluginManager().registerEvents(this, plugin);
}
public void markChunkAsClean(Chunk chunk) {
try {
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
if (mustSave != null) {
this.mustSave.set(nmsChunk, false);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
private void handle(ChunkEvent event) {
World world = event.getWorld();
String name = world.getName();
PlotAreaManager man = PlotSquared.get().getPlotAreaManager();
if (!(man instanceof SinglePlotAreaManager)) {
return;
}
if (!isPlotId(name)) {
return;
}
markChunkAsClean(event.getChunk());
}
// @EventHandler
// public void onPopulate(ChunkPopulateEvent event) {
// handle(event);
// }
@EventHandler(priority = EventPriority.LOWEST) public void onChunkLoad(ChunkLoadEvent event) {
handle(event);
}
private boolean isPlotId(String worldName) {
int len = worldName.length();
int separator = 0;
for (int i = 0; i < len; i++) {
switch (worldName.charAt(i)) {
case ',':
case ';':
separator++;
break;
case '-':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
default:
return false;
}
}
return separator == 1;
}
}

View File

@ -1,37 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.listeners;
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.generator.ChunkGenerator;
@SuppressWarnings("unused")
public class WorldEvents implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldInit(WorldInitEvent event) {
World world = event.getWorld();
String name = world.getName();
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager single = (SinglePlotAreaManager) manager;
if (single.isWorld(name)) {
world.setKeepSpawnInMemory(false);
return;
}
}
ChunkGenerator gen = world.getGenerator();
if (gen instanceof GeneratorWrapper) {
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
} else {
PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
}
}
}

View File

@ -1,26 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockState;
import org.bukkit.Material;
import org.bukkit.block.Block;
import java.util.function.Supplier;
public class BukkitBlockUtil {
public static Supplier<BlockState> supply(Block block) {
return () -> BukkitAdapter.asBlockType(block.getType()).getDefaultState();
}
public static Supplier<BlockState> supply(Material type) {
return () -> BukkitAdapter.asBlockType(type).getDefaultState();
}
public static BlockState get(Block block) {
return get(block.getType());
}
public static BlockState get(Material material) {
return BukkitAdapter.asBlockType(material).getDefaultState();
}
}

View File

@ -1,38 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class BukkitOfflinePlayer implements OfflinePlotPlayer {
public final OfflinePlayer player;
/**
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player),
* as it caches player objects.
*
* @param player
*/
public BukkitOfflinePlayer(OfflinePlayer player) {
this.player = player;
}
@NotNull @Override public UUID getUUID() {
return this.player.getUniqueId();
}
@Override public long getLastPlayed() {
return this.player.getLastPlayed();
}
@Override public boolean isOnline() {
return this.player.isOnline();
}
@Override public String getName() {
return this.player.getName();
}
}

View File

@ -1,313 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.world.item.ItemType;
import io.papermc.lib.PaperLib;
import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.WeatherType;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventException;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.RegisteredListener;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
public class BukkitPlayer extends PlotPlayer {
private static boolean CHECK_EFFECTIVE = true;
public final Player player;
private boolean offline;
private UUID uuid;
private String name;
/**
* <p>Please do not use this method. Instead use
* BukkitUtil.getPlayer(Player), as it caches player objects.</p>
*
* @param player Bukkit player instance
*/
public BukkitPlayer(@NotNull final Player player) {
this.player = player;
super.populatePersistentMetaMap();
}
public BukkitPlayer(@NotNull final Player player, final boolean offline) {
this.player = player;
this.offline = offline;
super.populatePersistentMetaMap();
}
@Override public Actor toActor() {
return BukkitAdapter.adapt(player);
}
@NotNull @Override public Location getLocation() {
final Location location = super.getLocation();
return location == null ? BukkitUtil.getLocation(this.player) : location;
}
@NotNull @Override public UUID getUUID() {
if (this.uuid == null) {
this.uuid = UUIDHandler.getUUID(this);
}
return this.uuid;
}
@Override public long getLastPlayed() {
return this.player.getLastPlayed();
}
@Override public boolean canTeleport(@NotNull final Location location) {
final org.bukkit.Location to = BukkitUtil.getLocation(location);
final org.bukkit.Location from = player.getLocation();
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
callEvent(event);
if (event.isCancelled() || !event.getTo().equals(to)) {
return false;
}
event = new PlayerTeleportEvent(player, to, from);
callEvent(event);
return true;
}
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
}
private void callEvent(@NotNull final Event event) {
final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
for (final RegisteredListener listener : listeners) {
if (listener.getPlugin().getName().equals(PlotSquared.imp().getPluginName())) {
continue;
}
try {
listener.callEvent(event);
} catch (final EventException e) {
e.printStackTrace();
}
}
}
@Override public boolean hasPermission(final String permission) {
if (this.offline && EconHandler.manager != null) {
return EconHandler.manager.hasPermission(getName(), permission);
}
return this.player.hasPermission(permission);
}
@Override public int hasPermissionRange(final String stub, final int range) {
if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) {
return Integer.MAX_VALUE;
}
final String[] nodes = stub.split("\\.");
final StringBuilder n = new StringBuilder();
for (int i = 0; i < (nodes.length - 1); i++) {
n.append(nodes[i]).append(".");
if (!stub.equals(n + Captions.PERMISSION_STAR.getTranslated())) {
if (hasPermission(n + Captions.PERMISSION_STAR.getTranslated())) {
return Integer.MAX_VALUE;
}
}
}
if (hasPermission(stub + ".*")) {
return Integer.MAX_VALUE;
}
int max = 0;
if (CHECK_EFFECTIVE) {
boolean hasAny = false;
String stubPlus = stub + ".";
final Set<PermissionAttachmentInfo> effective = player.getEffectivePermissions();
if (!effective.isEmpty()) {
for (PermissionAttachmentInfo attach : effective) {
String permStr = attach.getPermission();
if (permStr.startsWith(stubPlus)) {
hasAny = true;
String end = permStr.substring(stubPlus.length());
if (MathMan.isInteger(end)) {
int val = Integer.parseInt(end);
if (val > range) {
return val;
}
if (val > max) {
max = val;
}
}
}
}
if (hasAny) {
return max;
}
// Workaround
for (PermissionAttachmentInfo attach : effective) {
String permStr = attach.getPermission();
if (permStr.startsWith("plots.") && !permStr.equals("plots.use")) {
return max;
}
}
CHECK_EFFECTIVE = false;
}
}
for (int i = range; i > 0; i--) {
if (hasPermission(stub + "." + i)) {
return i;
}
}
return max;
}
@Override public boolean isPermissionSet(final String permission) {
return this.player.isPermissionSet(permission);
}
@Override public void sendMessage(final String message) {
if (!StringMan.isEqual(this.getMeta("lastMessage"), message) || (
System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000)) {
setMeta("lastMessage", message);
setMeta("lastMessageTime", System.currentTimeMillis());
this.player.sendMessage(message);
}
}
@Override public void teleport(@NotNull final Location location) {
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
return;
}
final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5,
location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch());
PaperLib.teleportAsync(player, bukkitLocation, PlayerTeleportEvent.TeleportCause.PLUGIN);
}
@Override public String getName() {
if (this.name == null) {
this.name = this.player.getName();
}
return this.name;
}
@Override public boolean isOnline() {
return !this.offline && this.player.isOnline();
}
@Override public void setCompassTarget(Location location) {
this.player.setCompassTarget(
new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX(),
location.getY(), location.getZ()));
}
@Override public Location getLocationFull() {
return BukkitUtil.getLocationFull(this.player);
}
@Override public void setWeather(@NotNull final PlotWeather weather) {
switch (weather) {
case CLEAR:
this.player.setPlayerWeather(WeatherType.CLEAR);
break;
case RAIN:
this.player.setPlayerWeather(WeatherType.DOWNFALL);
break;
case RESET:
default:
this.player.resetPlayerWeather();
break;
}
}
@NotNull @Override public PlotGameMode getGameMode() {
switch (this.player.getGameMode()) {
case ADVENTURE:
return PlotGameMode.ADVENTURE;
case CREATIVE:
return PlotGameMode.CREATIVE;
case SPECTATOR:
return PlotGameMode.SPECTATOR;
case SURVIVAL:
return PlotGameMode.SURVIVAL;
default:
return PlotGameMode.NOT_SET;
}
}
@Override public void setGameMode(@NotNull final PlotGameMode gameMode) {
switch (gameMode) {
case ADVENTURE:
this.player.setGameMode(GameMode.ADVENTURE);
break;
case CREATIVE:
this.player.setGameMode(GameMode.CREATIVE);
break;
case SPECTATOR:
this.player.setGameMode(GameMode.SPECTATOR);
break;
case SURVIVAL:
default:
this.player.setGameMode(GameMode.SURVIVAL);
break;
}
}
@Override public void setTime(final long time) {
if (time != Long.MAX_VALUE) {
this.player.setPlayerTime(time, false);
} else {
this.player.resetPlayerTime();
}
}
@Override public boolean getFlight() {
return player.getAllowFlight();
}
@Override public void setFlight(boolean fly) {
this.player.setAllowFlight(fly);
}
@Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) {
if (id.getBlockType().getMaterial().isAir()) {
// Let's just stop all the discs because why not?
for (final Sound sound : Arrays.stream(Sound.values())
.filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) {
player.stopSound(sound);
}
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
} else {
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, id.to(Material.class));
this.player.playSound(BukkitUtil.getLocation(location),
Sound.valueOf(BukkitAdapter.adapt(id).name()), Float.MAX_VALUE, 1f);
}
}
@Override public void kick(final String message) {
this.player.kickPlayer(message);
}
@Override public void stopSpectating() {
if (getGameMode() == PlotGameMode.SPECTATOR) {
this.player.setSpectatorTarget(null);
}
}
@Override public boolean isBanned() {
return this.player.isBanned();
}
}

View File

@ -1,8 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
class AgeableStats {
int age;
boolean locked;
boolean adult;
}

View File

@ -1,15 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
class ArmorStandStats {
final float[] head = new float[3];
final float[] body = new float[3];
final float[] leftLeg = new float[3];
final float[] rightLeg = new float[3];
final float[] leftArm = new float[3];
final float[] rightArm = new float[3];
boolean arms;
boolean noPlate;
boolean invisible;
boolean small;
}

View File

@ -1,12 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
class EntityBaseStats {
EntityWrapper passenger;
float fall;
short fire;
int age;
double vZ;
double vY;
double vX;
}

View File

@ -1,40 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
import lombok.Getter;
import lombok.NonNull;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@Getter public abstract class EntityWrapper {
protected final float yaw;
protected final float pitch;
private final Entity entity;
private final EntityType type;
public double x;
public double y;
public double z;
EntityWrapper(@NonNull final Entity entity) {
this.entity = entity;
this.type = entity.getType();
final Location location = entity.getLocation();
this.x = location.getX();
this.y = location.getY();
this.z = location.getZ();
this.yaw = location.getYaw();
this.pitch = location.getPitch();
}
@SuppressWarnings("deprecation") @Override public String toString() {
return String.format("[%s, x=%s, y=%s, z=%s]", type.getName(), x, y, z);
}
public abstract Entity spawn(World world, int xOffset, int zOffset);
public abstract void saveEntity();
}

View File

@ -1,12 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
import org.bukkit.entity.Horse;
class HorseStats {
double jump;
boolean chest;
Horse.Variant variant;
Horse.Color color;
Horse.Style style;
}

View File

@ -1,28 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import java.util.Collection;
class LivingEntityStats {
boolean loot;
String name;
boolean visible;
float health;
short air;
boolean persistent;
boolean leashed;
short leashX;
short leashY;
short leashZ;
boolean equipped;
ItemStack mainHand;
ItemStack helmet;
ItemStack boots;
ItemStack leggings;
ItemStack chestplate;
Collection<PotionEffect> potions;
ItemStack offHand;
}

View File

@ -1,9 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.entity;
import org.bukkit.entity.AnimalTamer;
class TameableStats {
AnimalTamer owner;
boolean tamed;
}

View File

@ -1,265 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.object.schematic;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Container;
import org.bukkit.block.Sign;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class StateWrapper {
public org.bukkit.block.BlockState state = null;
public CompoundTag tag = null;
public StateWrapper(org.bukkit.block.BlockState state) {
this.state = state;
}
public StateWrapper(CompoundTag tag) {
this.tag = tag;
}
public static String jsonToColourCode(String str) {
str = str.replace("{\"extra\":", "").replace("],\"text\":\"\"}", "]")
.replace("[{\"color\":\"black\",\"text\":\"", "&0")
.replace("[{\"color\":\"dark_blue\",\"text\":\"", "&1")
.replace("[{\"color\":\"dark_green\",\"text\":\"", "&2")
.replace("[{\"color\":\"dark_aqua\",\"text\":\"", "&3")
.replace("[{\"color\":\"dark_red\",\"text\":\"", "&4")
.replace("[{\"color\":\"dark_purple\",\"text\":\"", "&5")
.replace("[{\"color\":\"gold\",\"text\":\"", "&6")
.replace("[{\"color\":\"gray\",\"text\":\"", "&7")
.replace("[{\"color\":\"dark_gray\",\"text\":\"", "&8")
.replace("[{\"color\":\"blue\",\"text\":\"", "&9")
.replace("[{\"color\":\"green\",\"text\":\"", "&a")
.replace("[{\"color\":\"aqua\",\"text\":\"", "&b")
.replace("[{\"color\":\"red\",\"text\":\"", "&c")
.replace("[{\"color\":\"light_purple\",\"text\":\"", "&d")
.replace("[{\"color\":\"yellow\",\"text\":\"", "&e")
.replace("[{\"color\":\"white\",\"text\":\"", "&f")
.replace("[{\"obfuscated\":true,\"text\":\"", "&k")
.replace("[{\"bold\":true,\"text\":\"", "&l")
.replace("[{\"strikethrough\":true,\"text\":\"", "&m")
.replace("[{\"underlined\":true,\"text\":\"", "&n")
.replace("[{\"italic\":true,\"text\":\"", "&o").replace("[{\"color\":\"black\",", "&0")
.replace("[{\"color\":\"dark_blue\",", "&1")
.replace("[{\"color\":\"dark_green\",", "&2")
.replace("[{\"color\":\"dark_aqua\",", "&3").replace("[{\"color\":\"dark_red\",", "&4")
.replace("[{\"color\":\"dark_purple\",", "&5").replace("[{\"color\":\"gold\",", "&6")
.replace("[{\"color\":\"gray\",", "&7").replace("[{\"color\":\"dark_gray\",", "&8")
.replace("[{\"color\":\"blue\",", "&9").replace("[{\"color\":\"green\",", "&a")
.replace("[{\"color\":\"aqua\",", "&b").replace("[{\"color\":\"red\",", "&c")
.replace("[{\"color\":\"light_purple\",", "&d").replace("[{\"color\":\"yellow\",", "&e")
.replace("[{\"color\":\"white\",", "&f").replace("[{\"obfuscated\":true,", "&k")
.replace("[{\"bold\":true,", "&l").replace("[{\"strikethrough\":true,", "&m")
.replace("[{\"underlined\":true,", "&n").replace("[{\"italic\":true,", "&o")
.replace("{\"color\":\"black\",\"text\":\"", "&0")
.replace("{\"color\":\"dark_blue\",\"text\":\"", "&1")
.replace("{\"color\":\"dark_green\",\"text\":\"", "&2")
.replace("{\"color\":\"dark_aqua\",\"text\":\"", "&3")
.replace("{\"color\":\"dark_red\",\"text\":\"", "&4")
.replace("{\"color\":\"dark_purple\",\"text\":\"", "&5")
.replace("{\"color\":\"gold\",\"text\":\"", "&6")
.replace("{\"color\":\"gray\",\"text\":\"", "&7")
.replace("{\"color\":\"dark_gray\",\"text\":\"", "&8")
.replace("{\"color\":\"blue\",\"text\":\"", "&9")
.replace("{\"color\":\"green\",\"text\":\"", "&a")
.replace("{\"color\":\"aqua\",\"text\":\"", "&b")
.replace("{\"color\":\"red\",\"text\":\"", "&c")
.replace("{\"color\":\"light_purple\",\"text\":\"", "&d")
.replace("{\"color\":\"yellow\",\"text\":\"", "&e")
.replace("{\"color\":\"white\",\"text\":\"", "&f")
.replace("{\"obfuscated\":true,\"text\":\"", "&k")
.replace("{\"bold\":true,\"text\":\"", "&l")
.replace("{\"strikethrough\":true,\"text\":\"", "&m")
.replace("{\"underlined\":true,\"text\":\"", "&n")
.replace("{\"italic\":true,\"text\":\"", "&o").replace("{\"color\":\"black\",", "&0")
.replace("{\"color\":\"dark_blue\",", "&1").replace("{\"color\":\"dark_green\",", "&2")
.replace("{\"color\":\"dark_aqua\",", "&3").replace("{\"color\":\"dark_red\",", "&4")
.replace("{\"color\":\"dark_purple\",", "&5").replace("{\"color\":\"gold\",", "&6")
.replace("{\"color\":\"gray\",", "&7").replace("{\"color\":\"dark_gray\",", "&8")
.replace("{\"color\":\"blue\",", "&9").replace("{\"color\":\"green\",", "&a")
.replace("{\"color\":\"aqua\",", "&b").replace("{\"color\":\"red\",", "&c")
.replace("{\"color\":\"light_purple\",", "&d").replace("{\"color\":\"yellow\",", "&e")
.replace("{\"color\":\"white\",", "&f").replace("{\"obfuscated\":true,", "&k")
.replace("{\"bold\":true,", "&l").replace("{\"strikethrough\":true,", "&m")
.replace("{\"underlined\":true,", "&n").replace("{\"italic\":true,", "&o")
.replace("\"color\":\"black\",\"text\":\"", "&0")
.replace("\"color\":\"dark_blue\",\"text\":\"", "&1")
.replace("\"color\":\"dark_green\",\"text\":\"", "&2")
.replace("\"color\":\"dark_aqua\",\"text\":\"", "&3")
.replace("\"color\":\"dark_red\",\"text\":\"", "&4")
.replace("\"color\":\"dark_purple\",\"text\":\"", "&5")
.replace("\"color\":\"gold\",\"text\":\"", "&6")
.replace("\"color\":\"gray\",\"text\":\"", "&7")
.replace("\"color\":\"dark_gray\",\"text\":\"", "&8")
.replace("\"color\":\"blue\",\"text\":\"", "&9")
.replace("\"color\":\"green\",\"text\":\"", "&a")
.replace("\"color\":\"aqua\",\"text\":\"", "&b")
.replace("\"color\":\"red\",\"text\":\"", "&c")
.replace("\"color\":\"light_purple\",\"text\":\"", "&d")
.replace("\"color\":\"yellow\",\"text\":\"", "&e")
.replace("\"color\":\"white\",\"text\":\"", "&f")
.replace("\"obfuscated\":true,\"text\":\"", "&k")
.replace("\"bold\":true,\"text\":\"", "&l")
.replace("\"strikethrough\":true,\"text\":\"", "&m")
.replace("\"underlined\":true,\"text\":\"", "&n")
.replace("\"italic\":true,\"text\":\"", "&o").replace("\"color\":\"black\",", "&0")
.replace("\"color\":\"dark_blue\",", "&1").replace("\"color\":\"dark_green\",", "&2")
.replace("\"color\":\"dark_aqua\",", "&3").replace("\"color\":\"dark_red\",", "&4")
.replace("\"color\":\"dark_purple\",", "&5").replace("\"color\":\"gold\",", "&6")
.replace("\"color\":\"gray\",", "&7").replace("\"color\":\"dark_gray\",", "&8")
.replace("\"color\":\"blue\",", "&9").replace("\"color\":\"green\",", "&a")
.replace("\"color\":\"aqua\",", "&b").replace("\"color\":\"red\",", "&c")
.replace("\"color\":\"light_purple\",", "&d").replace("\"color\":\"yellow\",", "&e")
.replace("\"color\":\"white\",", "&f").replace("\"obfuscated\":true,", "&k")
.replace("\"bold\":true,", "&l").replace("\"strikethrough\":true,", "&m")
.replace("\"underlined\":true,", "&n").replace("\"italic\":true,", "&o")
.replace("[{\"text\":\"", "&0").replace("{\"text\":\"", "&0").replace("\"},", "")
.replace("\"}]", "").replace("\"}", "");
for (Entry<String, String> entry : Captions.replacements.entrySet()) {
str = str.replace(entry.getKey(), entry.getValue());
}
return str;
}
public boolean restoreTag(String worldName, int x, int y, int z) {
if (this.tag == null) {
return false;
}
String tileid = this.tag.getString("id").toLowerCase();
if (tileid.startsWith("minecraft:")) {
tileid = tileid.replace("minecraft:", "");
}
World world = BukkitUtil.getWorld(worldName);
Block block = world.getBlockAt(x, y, z);
if (block == null) {
return false;
}
org.bukkit.block.BlockState state = block.getState();
switch (tileid) {
case "chest":
case "beacon":
case "brewingstand":
case "dispenser":
case "dropper":
case "furnace":
case "hopper":
case "shulkerbox":
List<Tag> itemsTag = this.tag.getListTag("Items").getValue();
int length = itemsTag.size();
String[] ids = new String[length];
byte[] amounts = new byte[length];
byte[] slots = new byte[length];
for (int i = 0; i < length; i++) {
Tag itemTag = itemsTag.get(i);
CompoundTag itemComp = (CompoundTag) itemTag;
String id = itemComp.getString("id");
if (id.startsWith("minecraft:")) {
id = id.replace("minecraft:", "");
}
ids[i] = id;
amounts[i] = itemComp.getByte("Count");
slots[i] = itemComp.getByte("Slot");
}
if (state instanceof Container) {
Container container = (Container) state;
Inventory inv = container.getSnapshotInventory();
for (int i = 0; i < ids.length; i++) {
Material mat = Material.getMaterial(ids[i].toUpperCase());
if (mat != null) {
ItemStack item = new ItemStack(mat, (int) amounts[i]);
inv.setItem(slots[i], item);
PlotSquared.log(mat.name() + " " + slots[i]);
}
}
PlotSquared.log(inv.getStorageContents());
container.update(true, true);
return true;
}
return false;
case "sign":
if (state instanceof Sign) {
Sign sign = (Sign) state;
sign.setLine(0, jsonToColourCode(tag.getString("Text1")));
sign.setLine(1, jsonToColourCode(tag.getString("Text2")));
sign.setLine(2, jsonToColourCode(tag.getString("Text3")));
sign.setLine(3, jsonToColourCode(tag.getString("Text4")));
state.update(true);
return true;
}
return false;
}
return false;
}
public CompoundTag getTag() {
if (this.tag != null) {
return this.tag;
}
if (this.state instanceof InventoryHolder) {
InventoryHolder inv = (InventoryHolder) this.state;
ItemStack[] contents = inv.getInventory().getContents();
Map<String, Tag> values = new HashMap<>();
values.put("Items", new ListTag(CompoundTag.class, serializeInventory(contents)));
return new CompoundTag(values);
}
return null;
}
public String getId() {
return "Chest";
}
public List<CompoundTag> serializeInventory(ItemStack[] items) {
List<CompoundTag> tags = new ArrayList<>();
for (int i = 0; i < items.length; ++i) {
if (items[i] != null) {
Map<String, Tag> tagData = serializeItem(items[i]);
tagData.put("Slot", new ByteTag((byte) i));
tags.add(new CompoundTag(tagData));
}
}
return tags;
}
public Map<String, Tag> serializeItem(ItemStack item) {
Map<String, Tag> data = new HashMap<>();
data.put("id", new StringTag(item.getType().name()));
data.put("Damage", new ShortTag(item.getDurability()));
data.put("Count", new ByteTag((byte) item.getAmount()));
if (!item.getEnchantments().isEmpty()) {
List<CompoundTag> enchantmentList = new ArrayList<>();
for (Entry<Enchantment, Integer> entry : item.getEnchantments().entrySet()) {
Map<String, Tag> enchantment = new HashMap<>();
enchantment.put("id", new StringTag(entry.getKey().toString()));
enchantment.put("lvl", new ShortTag(entry.getValue().shortValue()));
enchantmentList.add(new CompoundTag(enchantment));
}
Map<String, Tag> auxData = new HashMap<>();
auxData.put("ench", new ListTag(CompoundTag.class, enchantmentList));
data.put("tag", new CompoundTag(auxData));
}
return data;
}
}

View File

@ -1,53 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.chat.FancyMessage;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
import org.bukkit.ChatColor;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class BukkitChatManager extends ChatManager<FancyMessage> {
@Override public FancyMessage builder() {
return new FancyMessage("");
}
@Override public void color(PlotMessage message, String color) {
message.$(this).color(ChatColor.getByChar(Captions.color(color).substring(1)));
}
@Override public void tooltip(PlotMessage message, PlotMessage... tooltips) {
List<FancyMessage> lines =
Arrays.stream(tooltips).map(tooltip -> tooltip.$(this)).collect(Collectors.toList());
message.$(this).formattedTooltip(lines);
}
@Override public void command(PlotMessage message, String command) {
message.$(this).command(command);
}
@Override public void text(PlotMessage message, String text) {
message.$(this).then(ChatColor.stripColor(text));
}
@Override public void send(PlotMessage plotMessage, PlotPlayer player) {
if (player instanceof ConsolePlayer || !Settings.Chat.INTERACTIVE) {
player.sendMessage(plotMessage.$(this).toOldMessageFormat());
} else {
plotMessage.$(this).send(((BukkitPlayer) player).player);
}
}
@Override public void suggest(PlotMessage plotMessage, String command) {
plotMessage.$(this).suggest(command);
}
}

View File

@ -1,696 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.entity.EntityWrapper;
import com.github.intellectualsites.plotsquared.bukkit.object.entity.ReplicatingEntityWrapper;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.generator.AugmentedUtils;
import com.github.intellectualsites.plotsquared.plot.listener.WEExtent;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotLoc;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.world.RegionUtil;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
public class BukkitChunkManager extends ChunkManager {
public static boolean isIn(CuboidRegion region, int x, int z) {
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX() && z >= region.getMinimumPoint().getZ() && z <= region.getMaximumPoint().getZ();
}
public static ContentMap swapChunk(World world1, World world2, Chunk pos1, Chunk pos2,
CuboidRegion r1, CuboidRegion r2) {
ContentMap map = new ContentMap();
int relX = r2.getMinimumPoint().getX() - r1.getMinimumPoint().getX();
int relZ = r2.getMinimumPoint().getZ() - r1.getMinimumPoint().getZ();
map.saveEntitiesIn(pos1, r1, relX, relZ, true);
map.saveEntitiesIn(pos2, r2, -relX, -relZ, true);
int sx = pos1.getX() << 4;
int sz = pos1.getZ() << 4;
String worldName1 = world1.getName();
String worldName2 = world2.getName();
BukkitWorld bukkitWorld1 = new BukkitWorld(world1);
BukkitWorld bukkitWorld2 = new BukkitWorld(world2);
LocalBlockQueue queue1 = GlobalBlockQueue.IMP.getNewQueue(worldName1, false);
LocalBlockQueue queue2 = GlobalBlockQueue.IMP.getNewQueue(worldName2, false);
for (int x = Math.max(r1.getMinimumPoint().getX(), sx); x <= Math.min(r1.getMaximumPoint().getX(), sx + 15); x++) {
for (int z = Math.max(r1.getMinimumPoint().getZ(), sz); z <= Math.min(r1.getMaximumPoint().getZ(), sz + 15); z++) {
for (int y = 0; y < 256; y++) {
Block block1 = world1.getBlockAt(x, y, z);
BaseBlock baseBlock1 = bukkitWorld1.getFullBlock(BlockVector3.at(x, y, z));
BlockData data1 = block1.getBlockData();
int xx = x + relX;
int zz = z + relZ;
Block block2 = world2.getBlockAt(xx, y, zz);
BaseBlock baseBlock2 = bukkitWorld2.getFullBlock(BlockVector3.at(xx, y, zz));
BlockData data2 = block2.getBlockData();
if (block1.isEmpty()) {
if (!block2.isEmpty()) {
queue1.setBlock(x, y, z, baseBlock2);
queue2.setBlock(xx, y, zz, WEExtent.AIRBASE);
}
} else if (block2.isEmpty()) {
queue1.setBlock(x, y, z, WEExtent.AIRBASE);
queue2.setBlock(xx, y, zz, baseBlock1);
} else if (block1.equals(block2)) {
if (!data1.matches(data2)) {
block1.setBlockData(data2);
block2.setBlockData(data1);
}
} else {
queue1.setBlock(x, y, z, baseBlock2);
queue2.setBlock(xx, y, zz, baseBlock1);
}
}
}
}
queue1.enqueue();
queue2.enqueue();
return map;
}
@Override public Set<BlockVector2> getChunkChunks(String world) {
Set<BlockVector2> chunks = super.getChunkChunks(world);
for (Chunk chunk : Bukkit.getWorld(world).getLoadedChunks()) {
BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5);
chunks.add(loc);
}
return chunks;
}
@Override public int[] countEntities(Plot plot) {
int[] existing = (int[]) plot.getMeta("EntityCount");
if (existing != null && (System.currentTimeMillis() - (long) plot.getMeta("EntityCountTime")
< 1000)) {
return existing;
}
PlotArea area = plot.getArea();
World world = BukkitUtil.getWorld(area.worldname);
Location bot = plot.getBottomAbs();
Location top = plot.getTopAbs();
int bx = bot.getX() >> 4;
int bz = bot.getZ() >> 4;
int tx = top.getX() >> 4;
int tz = top.getZ() >> 4;
int size = tx - bx << 4;
Set<Chunk> chunks = new HashSet<>();
for (int X = bx; X <= tx; X++) {
for (int Z = bz; Z <= tz; Z++) {
if (world.isChunkLoaded(X, Z)) {
chunks.add(world.getChunkAt(X, Z));
}
}
}
boolean doWhole = false;
List<Entity> entities = null;
if (size > 200 && chunks.size() > 200) {
entities = world.getEntities();
if (entities.size() < 16 + size / 8) {
doWhole = true;
}
}
int[] count = new int[6];
if (doWhole) {
for (Entity entity : entities) {
org.bukkit.Location location = entity.getLocation();
PaperLib.getChunkAtAsync(location).thenAccept( chunk -> {
if (chunks.contains(chunk)) {
int X = chunk.getX();
int Z = chunk.getZ();
if (X > bx && X < tx && Z > bz && Z < tz) {
count(count, entity);
} else {
Plot other = area.getPlot(BukkitUtil.getLocation(location));
if (plot.equals(other)) {
count(count, entity);
}
}
}
});
}
} else {
for (Chunk chunk : chunks) {
int X = chunk.getX();
int Z = chunk.getZ();
Entity[] entities1 = chunk.getEntities();
for (Entity entity : entities1) {
if (X == bx || X == tx || Z == bz || Z == tz) {
Plot other = area.getPlot(BukkitUtil.getLocation(entity));
if (plot.equals(other)) {
count(count, entity);
}
} else {
count(count, entity);
}
}
}
}
return count;
}
@Override public boolean copyRegion(Location pos1, Location pos2, Location newPos,
final Runnable whenDone) {
final int relX = newPos.getX() - pos1.getX();
final int relZ = newPos.getZ() - pos1.getZ();
final CuboidRegion region =
RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
final World oldWorld = Bukkit.getWorld(pos1.getWorld());
final BukkitWorld oldBukkitWorld = new BukkitWorld(oldWorld);
final World newWorld = Bukkit.getWorld(newPos.getWorld());
assert newWorld != null;
assert oldWorld != null;
final String newWorldName = newWorld.getName();
final ContentMap map = new ContentMap();
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(newWorldName, false);
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
@Override public void run(int[] value) {
int bx = value[2];
int bz = value[3];
int tx = value[4];
int tz = value[5];
BlockVector2 loc = BlockVector2.at(value[0], value[1]);
int cxx = loc.getX() << 4;
int czz = loc.getZ() << 4;
PaperLib.getChunkAtAsync(oldWorld, loc.getX(), loc.getZ())
.thenAccept(chunk1 -> map.saveEntitiesIn(chunk1, region)).thenRun(() -> {
for (int x = bx & 15; x <= (tx & 15); x++) {
for (int z = bz & 15; z <= (tz & 15); z++) {
map.saveBlocks(oldBukkitWorld, 256, cxx + x, czz + z, relX, relZ);
}
}
});
}
}, () -> {
for (Entry<PlotLoc, BaseBlock[]> entry : map.allBlocks.entrySet()) {
PlotLoc loc = entry.getKey();
BaseBlock[] blocks = entry.getValue();
for (int y = 0; y < blocks.length; y++) {
if (blocks[y] != null) {
BaseBlock block = blocks[y];
queue.setBlock(loc.getX(), y, loc.getZ(), block);
}
}
}
queue.enqueue();
GlobalBlockQueue.IMP.addEmptyTask(() -> {
//map.restoreBlocks(newWorld, 0, 0);
map.restoreEntities(newWorld, relX, relZ);
TaskManager.runTask(whenDone);
});
}, 5);
return true;
}
@Override public boolean regenerateRegion(final Location pos1, final Location pos2,
final boolean ignoreAugment, final Runnable whenDone) {
final String world = pos1.getWorld();
final int p1x = pos1.getX();
final int p1z = pos1.getZ();
final int p2x = pos2.getX();
final int p2z = pos2.getZ();
final int bcx = p1x >> 4;
final int bcz = p1z >> 4;
final int tcx = p2x >> 4;
final int tcz = p2z >> 4;
final List<BlockVector2> chunks = new ArrayList<>();
for (int x = bcx; x <= tcx; x++) {
for (int z = bcz; z <= tcz; z++) {
chunks.add(BlockVector2.at(x, z));
}
}
final World worldObj = Bukkit.getWorld(world);
final BukkitWorld bukkitWorldObj = new BukkitWorld(worldObj);
TaskManager.runTask(new Runnable() {
@Override public void run() {
long start = System.currentTimeMillis();
while (!chunks.isEmpty() && System.currentTimeMillis() - start < 5) {
final BlockVector2 chunk = chunks.remove(0);
int x = chunk.getX();
int z = chunk.getZ();
int xxb = x << 4;
int zzb = z << 4;
int xxt = xxb + 15;
int zzt = zzb + 15;
Chunk chunkObj = worldObj.getChunkAt(x, z);
if (!chunkObj.load(false)) {
continue;
}
final LocalBlockQueue queue = GlobalBlockQueue.IMP.getNewQueue(world, false);
if (xxb >= p1x && xxt <= p2x && zzb >= p1z && zzt <= p2z
&& PlotSquared.imp().getServerVersion()[1] == 13) {
AugmentedUtils
.bypass(ignoreAugment, () -> queue.regenChunkSafe(chunk.getX(), chunk.getZ()));
continue;
}
boolean checkX1 = false;
int xxb2;
if (x == bcx) {
xxb2 = p1x - 1;
checkX1 = true;
} else {
xxb2 = xxb;
}
boolean checkX2 = false;
int xxt2;
if (x == tcx) {
xxt2 = p2x + 1;
checkX2 = true;
} else {
xxt2 = xxt;
}
boolean checkZ1 = false;
int zzb2;
if (z == bcz) {
zzb2 = p1z - 1;
checkZ1 = true;
} else {
zzb2 = zzb;
}
boolean checkZ2 = false;
int zzt2;
if (z == tcz) {
zzt2 = p2z + 1;
checkZ2 = true;
} else {
zzt2 = zzt;
}
final ContentMap map = new ContentMap();
if (checkX1) {
map.saveRegion(bukkitWorldObj, xxb, xxb2, zzb2, zzt2); //
}
if (checkX2) {
map.saveRegion(bukkitWorldObj, xxt2, xxt, zzb2, zzt2); //
}
if (checkZ1) {
map.saveRegion(bukkitWorldObj, xxb2, xxt2, zzb, zzb2); //
}
if (checkZ2) {
map.saveRegion(bukkitWorldObj, xxb2, xxt2, zzt2, zzt); //
}
if (checkX1 && checkZ1) {
map.saveRegion(bukkitWorldObj, xxb, xxb2, zzb, zzb2); //
}
if (checkX2 && checkZ1) {
map.saveRegion(bukkitWorldObj, xxt2, xxt, zzb, zzb2); // ?
}
if (checkX1 && checkZ2) {
map.saveRegion(bukkitWorldObj, xxb, xxb2, zzt2, zzt); // ?
}
if (checkX2 && checkZ2) {
map.saveRegion(bukkitWorldObj, xxt2, xxt, zzt2, zzt); //
}
CuboidRegion currentPlotClear =
RegionUtil.createRegion(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
map.saveEntitiesOut(chunkObj, currentPlotClear);
AugmentedUtils.bypass(ignoreAugment,
() -> setChunkInPlotArea(null, new RunnableVal<ScopedLocalBlockQueue>() {
@Override public void run(ScopedLocalBlockQueue value) {
Location min = value.getMin();
int bx = min.getX();
int bz = min.getZ();
for (int x1 = 0; x1 < 16; x1++) {
for (int z1 = 0; z1 < 16; z1++) {
PlotLoc plotLoc = new PlotLoc(bx + x1, bz + z1);
BaseBlock[] ids = map.allBlocks.get(plotLoc);
if (ids != null) {
for (int y = 0; y < Math.min(128, ids.length); y++) {
BaseBlock id = ids[y];
if (id != null) {
value.setBlock(x1, y, z1, id);
} else {
value.setBlock(x1, y, z1, BlockTypes.AIR.getDefaultState());
}
}
for (int y = Math.min(128, ids.length);
y < ids.length; y++) {
BaseBlock id = ids[y];
if (id != null) {
value.setBlock(x1, y, z1, id);
}
}
}
}
}
}
}, world, chunk));
//map.restoreBlocks(worldObj, 0, 0);
map.restoreEntities(worldObj, 0, 0);
}
if (!chunks.isEmpty()) {
TaskManager.runTaskLater(this, 1);
} else {
TaskManager.runTaskLater(whenDone, 1);
}
}
});
return true;
}
@Override public CompletableFuture loadChunk(String world, BlockVector2 chunkLoc, boolean force) {
return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.getX(), chunkLoc.getZ(), force);
}
@Override
public void unloadChunk(final String world, final BlockVector2 chunkLoc, final boolean save) {
if (!PlotSquared.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(
() -> BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save));
} else {
BukkitUtil.getWorld(world).unloadChunk(chunkLoc.getX(), chunkLoc.getZ(), save);
}
}
@Override public void clearAllEntities(Location pos1, Location pos2) {
String world = pos1.getWorld();
List<Entity> entities = BukkitUtil.getEntities(world);
int bx = pos1.getX();
int bz = pos1.getZ();
int tx = pos2.getX();
int tz = pos2.getZ();
for (Entity entity : entities) {
if (!(entity instanceof Player)) {
org.bukkit.Location location = entity.getLocation();
if (location.getX() >= bx && location.getX() <= tx && location.getZ() >= bz
&& location.getZ() <= tz) {
if (entity.hasMetadata("ps-tmp-teleport")) {
continue;
}
entity.remove();
}
}
}
}
@Override public void swap(Location bot1, Location top1, Location bot2, Location top2,
final Runnable whenDone) {
CuboidRegion region1 =
RegionUtil.createRegion(bot1.getX(), top1.getX(), bot1.getZ(), top1.getZ());
CuboidRegion region2 =
RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ());
final World world1 = Bukkit.getWorld(bot1.getWorld());
World world2 = Bukkit.getWorld(bot2.getWorld());
int relX = bot2.getX() - bot1.getX();
int relZ = bot2.getZ() - bot1.getZ();
final ArrayDeque<ContentMap> maps = new ArrayDeque<>();
for (int x = bot1.getX() >> 4; x <= top1.getX() >> 4; x++) {
for (int z = bot1.getZ() >> 4; z <= top1.getZ() >> 4; z++) {
Chunk chunk1 = world1.getChunkAt(x, z);
Chunk chunk2 = world2.getChunkAt(x + (relX >> 4), z + (relZ >> 4));
maps.add(swapChunk(world1, world2, chunk1, chunk2, region1, region2));
}
}
GlobalBlockQueue.IMP.addEmptyTask(() -> {
for (ContentMap map : maps) {
map.restoreEntities(world1, 0, 0);
TaskManager.runTaskLater(whenDone, 1);
}
});
}
private void count(int[] count, Entity entity) {
switch (entity.getType()) {
case PLAYER:
// not valid
return;
case SMALL_FIREBALL:
case FIREBALL:
case DROPPED_ITEM:
case EGG:
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case SNOWBALL:
case ENDER_PEARL:
case ARROW:
case TRIDENT:
case SHULKER_BULLET:
case SPECTRAL_ARROW:
case DRAGON_FIREBALL:
case LLAMA_SPIT:
// projectile
case PRIMED_TNT:
case FALLING_BLOCK:
// Block entities
case ENDER_CRYSTAL:
case FISHING_HOOK:
case ENDER_SIGNAL:
case EXPERIENCE_ORB:
case LEASH_HITCH:
case FIREWORK:
case LIGHTNING:
case WITHER_SKULL:
case UNKNOWN:
case AREA_EFFECT_CLOUD:
case EVOKER_FANGS:
// non moving / unremovable
break;
case ITEM_FRAME:
case PAINTING:
case ARMOR_STAND:
count[5]++;
break;
// misc
case MINECART:
case MINECART_CHEST:
case MINECART_COMMAND:
case MINECART_FURNACE:
case MINECART_HOPPER:
case MINECART_MOB_SPAWNER:
case MINECART_TNT:
case BOAT:
count[4]++;
break;
case POLAR_BEAR:
case RABBIT:
case SHEEP:
case MUSHROOM_COW:
case OCELOT:
case PIG:
case HORSE:
case SQUID:
case VILLAGER:
case IRON_GOLEM:
case WOLF:
case CHICKEN:
case COW:
case SNOWMAN:
case BAT:
case DONKEY:
case LLAMA:
case SKELETON_HORSE:
case ZOMBIE_HORSE:
case MULE:
case DOLPHIN:
case TURTLE:
case COD:
case PARROT:
case SALMON:
case PUFFERFISH:
case TROPICAL_FISH:
case CAT:
case FOX:
case PANDA:
// animal
count[3]++;
count[1]++;
break;
case BLAZE:
case CAVE_SPIDER:
case CREEPER:
case ENDERMAN:
case ENDERMITE:
case ENDER_DRAGON:
case GHAST:
case GIANT:
case GUARDIAN:
case MAGMA_CUBE:
case PIG_ZOMBIE:
case SILVERFISH:
case SKELETON:
case SLIME:
case SPIDER:
case WITCH:
case WITHER:
case ZOMBIE:
case SHULKER:
case ELDER_GUARDIAN:
case STRAY:
case HUSK:
case EVOKER:
case VEX:
case WITHER_SKELETON:
case ZOMBIE_VILLAGER:
case VINDICATOR:
// monster
count[3]++;
count[2]++;
break;
default:
if (entity instanceof Creature) {
count[3]++;
if (entity instanceof Animals) {
count[1]++;
} else {
count[2]++;
}
} else {
count[4]++;
}
}
count[0]++;
}
public static class ContentMap {
final Set<EntityWrapper> entities;
final Map<PlotLoc, BaseBlock[]> allBlocks;
ContentMap() {
this.entities = new HashSet<>();
this.allBlocks = new HashMap<>();
}
public void saveRegion(BukkitWorld world, int x1, int x2, int z1, int z2) {
if (z1 > z2) {
int tmp = z1;
z1 = z2;
z2 = tmp;
}
if (x1 > x2) {
int tmp = x1;
x1 = x2;
x2 = tmp;
}
for (int x = x1; x <= x2; x++) {
for (int z = z1; z <= z2; z++) {
saveBlocks(world, 256, x, z, 0, 0);
}
}
}
void saveEntitiesOut(Chunk chunk, CuboidRegion region) {
for (Entity entity : chunk.getEntities()) {
Location location = BukkitUtil.getLocation(entity);
int x = location.getX();
int z = location.getZ();
if (isIn(region, x, z)) {
continue;
}
if (entity.getVehicle() != null) {
continue;
}
EntityWrapper wrap = new ReplicatingEntityWrapper(entity, (short) 2);
wrap.saveEntity();
this.entities.add(wrap);
}
}
void saveEntitiesIn(Chunk chunk, CuboidRegion region) {
saveEntitiesIn(chunk, region, 0, 0, false);
}
void saveEntitiesIn(Chunk chunk, CuboidRegion region, int offsetX, int offsetZ,
boolean delete) {
for (Entity entity : chunk.getEntities()) {
Location location = BukkitUtil.getLocation(entity);
int x = location.getX();
int z = location.getZ();
if (!isIn(region, x, z)) {
continue;
}
if (entity.getVehicle() != null) {
continue;
}
EntityWrapper wrap = new ReplicatingEntityWrapper(entity, (short) 2);
wrap.x += offsetX;
wrap.z += offsetZ;
wrap.saveEntity();
this.entities.add(wrap);
if (delete) {
if (!(entity instanceof Player)) {
entity.remove();
}
}
}
}
void restoreEntities(World world, int xOffset, int zOffset) {
for (EntityWrapper entity : this.entities) {
try {
entity.spawn(world, xOffset, zOffset);
} catch (Exception e) {
PlotSquared.debug("Failed to restore entity (e): " + e.toString());
e.printStackTrace();
}
}
this.entities.clear();
}
//todo optimize maxY
void saveBlocks(BukkitWorld world, int maxY, int x, int z, int offsetX, int offsetZ) {
maxY = Math.min(255, maxY);
BaseBlock[] ids = new BaseBlock[maxY + 1];
for (short y = 0; y <= maxY; y++) {
BaseBlock block = world.getFullBlock(BlockVector3.at(x, y, z));
ids[y] = block;
}
PlotLoc loc = new PlotLoc(x + offsetX, z + offsetZ);
this.allBlocks.put(loc, ids);
}
}
}

View File

@ -1,61 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.commands.DebugUUID;
import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
import com.github.intellectualsites.plotsquared.plot.object.ConsolePlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.ProxiedCommandSender;
import org.bukkit.command.RemoteConsoleCommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class BukkitCommand implements CommandExecutor, TabCompleter {
public BukkitCommand() {
new DebugUUID();
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String commandLabel,
String[] args) {
if (commandSender instanceof Player) {
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), args);
}
if (commandSender instanceof ConsoleCommandSender
|| commandSender instanceof ProxiedCommandSender
|| commandSender instanceof RemoteConsoleCommandSender) {
return MainCommand.onCommand(ConsolePlayer.getConsole(), args);
}
return false;
}
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String s,
String[] args) {
if (!(commandSender instanceof Player)) {
return null;
}
PlotPlayer player = BukkitUtil.getPlayer((Player) commandSender);
if (args.length == 0) {
return Collections.singletonList("plots");
}
Collection objects = MainCommand.getInstance().tab(player, args, s.endsWith(" "));
if (objects == null) {
return null;
}
List<String> result = new ArrayList<>();
for (Object o : objects) {
result.add(o.toString());
}
return result.isEmpty() ? null : result;
}
}

View File

@ -1,83 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
public class BukkitEconHandler extends EconHandler {
private Economy econ;
private Permission perms;
public boolean init() {
if (this.econ == null || this.perms == null) {
setupPermissions();
setupEconomy();
}
return this.econ != null && this.perms != null;
}
private boolean setupPermissions() {
RegisteredServiceProvider<Permission> permissionProvider =
Bukkit.getServer().getServicesManager().getRegistration(Permission.class);
if (permissionProvider != null) {
this.perms = permissionProvider.getProvider();
}
return this.perms != null;
}
private boolean setupEconomy() {
if (Bukkit.getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> economyProvider =
Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
if (economyProvider != null) {
this.econ = economyProvider.getProvider();
}
return this.econ != null;
}
@Override public double getMoney(PlotPlayer player) {
double bal = super.getMoney(player);
if (Double.isNaN(bal)) {
return this.econ.getBalance(((BukkitPlayer) player).player);
}
return bal;
}
@Override public void withdrawMoney(PlotPlayer player, double amount) {
this.econ.withdrawPlayer(((BukkitPlayer) player).player, amount);
}
@Override public void depositMoney(PlotPlayer player, double amount) {
this.econ.depositPlayer(((BukkitPlayer) player).player, amount);
}
@Override public void depositMoney(OfflinePlotPlayer player, double amount) {
this.econ.depositPlayer(((BukkitOfflinePlayer) player).player, amount);
}
@Override public boolean hasPermission(String world, String player, String perm) {
return this.perms.playerHas(world, Bukkit.getOfflinePlayer(player), perm);
}
@Override public double getBalance(PlotPlayer player) {
return this.econ.getBalance(player.getName());
}
public void setPermission(String world, String player, String perm, boolean value) {
if (value) {
this.perms.playerAdd(world, player, perm);
} else {
this.perms.playerRemove(world, player, perm);
}
}
}

View File

@ -1,133 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotDeniedEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotHelperEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotTrustedEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerTeleportToPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotAutoMergeEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotChangeOwnerEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotClearEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotComponentSetEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotDeleteEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagAddEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagRemoveEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotMergeEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotRateEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotUnlinkEvent;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.Rating;
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.UUID;
/**
* Utility class for handling Bukkit Events.
*/
public final class BukkitEventUtil extends EventUtil {
@Nullable public Player getPlayer(final PlotPlayer player) {
if (player instanceof BukkitPlayer) {
return ((BukkitPlayer) player).player;
}
return null;
}
private boolean callEvent(@NotNull final Event event) {
Bukkit.getServer().getPluginManager().callEvent(event);
return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled();
}
@Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) {
return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto));
}
@Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) {
return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot));
}
@Override public boolean callComponentSet(Plot plot, String component) {
return callEvent(new PlotComponentSetEvent(plot, component));
}
@Override public boolean callClear(Plot plot) {
return callEvent(new PlotClearEvent(plot));
}
@Override public boolean callDelete(Plot plot) {
return callEvent(new PlotDeleteEvent(plot));
}
@Override public boolean callFlagAdd(Flag flag, Plot plot) {
return callEvent(new PlotFlagAddEvent(flag, plot));
}
@Override public boolean callFlagRemove(Flag<?> flag, Plot plot, Object value) {
return callEvent(new PlotFlagRemoveEvent(flag, plot));
}
@Override public boolean callMerge(Plot plot, int dir, int max) {
return callEvent(
new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max));
}
@Override public boolean callAutoMerge(Plot plot, List<PlotId> plots) {
return callEvent(
new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots));
}
@Override public boolean callUnlink(PlotArea area, List<PlotId> plots) {
return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots));
}
@Override public void callEntry(PlotPlayer player, Plot plot) {
callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot));
}
@Override public void callLeave(PlotPlayer player, Plot plot) {
callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot));
}
@Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added));
}
@Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added));
}
@Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added));
}
@Override
public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner,
boolean hasOldOwner) {
return callEvent(
new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner));
}
@Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) {
PlotRateEvent event = new PlotRateEvent(player, rating, plot);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return null;
}
return event.getRating();
}
}

View File

@ -1,8 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
public class BukkitHybridUtils extends HybridUtils {
}

View File

@ -1,124 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
public class BukkitInventoryUtil extends InventoryUtil {
@Override public void open(PlotInventory inv) {
BukkitPlayer bp = (BukkitPlayer) inv.player;
Inventory inventory = Bukkit.createInventory(null, inv.size * 9, inv.getTitle());
PlotItemStack[] items = inv.getItems();
for (int i = 0; i < inv.size * 9; i++) {
PlotItemStack item = items[i];
if (item != null) {
inventory.setItem(i, getItem(item));
}
}
bp.player.openInventory(inventory);
}
@Override public void close(PlotInventory inv) {
if (!inv.isOpen()) {
return;
}
BukkitPlayer bp = (BukkitPlayer) inv.player;
bp.player.closeInventory();
}
@Override public void setItem(PlotInventory inv, int index, PlotItemStack item) {
BukkitPlayer bp = (BukkitPlayer) inv.player;
InventoryView opened = bp.player.getOpenInventory();
if (!inv.isOpen()) {
return;
}
opened.setItem(index, getItem(item));
bp.player.updateInventory();
}
private static ItemStack getItem(PlotItemStack item) {
if (item == null) {
return null;
}
ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getBlockState()), item.amount);
ItemMeta meta = null;
if (item.name != null) {
meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', item.name));
}
if (item.lore != null) {
if (meta == null) {
meta = stack.getItemMeta();
}
List<String> lore = new ArrayList<>();
for (String entry : item.lore) {
lore.add(ChatColor.translateAlternateColorCodes('&', entry));
}
meta.setLore(lore);
}
if (meta != null) {
stack.setItemMeta(meta);
}
return stack;
}
public PlotItemStack getItem(ItemStack item) {
if (item == null) {
return null;
}
// int id = item.getTypeId();
Material id = item.getType();
ItemMeta meta = item.getItemMeta();
int amount = item.getAmount();
String name = null;
String[] lore = null;
if (item.hasItemMeta()) {
assert meta != null;
if (meta.hasDisplayName()) {
name = meta.getDisplayName();
}
if (meta.hasLore()) {
List<String> itemLore = meta.getLore();
lore = itemLore.toArray(new String[0]);
}
}
return new PlotItemStack(id.name(), amount, name, lore);
}
@Override public PlotItemStack[] getItems(PlotPlayer player) {
BukkitPlayer bp = (BukkitPlayer) player;
PlayerInventory inv = bp.player.getInventory();
return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i)))
.toArray(PlotItemStack[]::new);
}
@Override public boolean isOpen(PlotInventory plotInventory) {
if (!plotInventory.isOpen()) {
return false;
}
BukkitPlayer bp = (BukkitPlayer) plotInventory.player;
InventoryView opened = bp.player.getOpenInventory();
if (plotInventory.isOpen()) {
if (opened.getType() == InventoryType.CRAFTING) {
opened.getTitle();
}
}
return false;
}
}

View File

@ -1,213 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntArrayTag;
import com.sk89q.jnbt.IntTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.block.BaseBlock;
import java.io.ByteArrayOutputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.IntStream;
/**
* Schematic Handler.
*/
public class BukkitSchematicHandler extends SchematicHandler {
@Override public void getCompoundTag(final String world, final Set<CuboidRegion> regions,
final RunnableVal<CompoundTag> whenDone) {
// async
TaskManager.runTaskAsync(new Runnable() {
@Override public void run() {
// Main positions
Location[] corners = MainUtil.getCorners(world, regions);
final Location bot = corners[0];
final Location top = corners[1];
CuboidRegion cuboidRegion =
new CuboidRegion(BukkitUtil.IMP.getWeWorld(world), bot.getBlockVector3(),
top.getBlockVector3());
final int width = cuboidRegion.getWidth();
int height = cuboidRegion.getHeight();
final int length = cuboidRegion.getLength();
Map<String, Tag> schematic = new HashMap<>();
schematic.put("Version", new IntTag(1));
Map<String, Tag> metadata = new HashMap<>();
metadata.put("WEOffsetX", new IntTag(0));
metadata.put("WEOffsetY", new IntTag(0));
metadata.put("WEOffsetZ", new IntTag(0));
schematic.put("Metadata", new CompoundTag(metadata));
schematic.put("Width", new ShortTag((short) width));
schematic.put("Height", new ShortTag((short) height));
schematic.put("Length", new ShortTag((short) length));
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
schematic.put("Offset", new IntArrayTag(new int[] {0, 0, 0,}));
Map<String, Integer> palette = new HashMap<>();
List<CompoundTag> tileEntities = new ArrayList<>();
ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
// Queue
final ArrayDeque<CuboidRegion> queue = new ArrayDeque<>(regions);
TaskManager.runTask(new Runnable() {
@Override public void run() {
if (queue.isEmpty()) {
TaskManager.runTaskAsync(() -> {
schematic.put("PaletteMax", new IntTag(palette.size()));
Map<String, Tag> paletteTag = new HashMap<>();
palette.forEach(
(key, value) -> paletteTag.put(key, new IntTag(value)));
schematic.put("Palette", new CompoundTag(paletteTag));
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
schematic.put("TileEntities",
new ListTag(CompoundTag.class, tileEntities));
whenDone.value = new CompoundTag(schematic);
TaskManager.runTask(whenDone);
});
return;
}
final Runnable regionTask = this;
CuboidRegion region = queue.poll();
Location pos1 = new Location(world, region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ());
Location pos2 = new Location(world, region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ());
final int p1x = pos1.getX();
final int sy = pos1.getY();
final int p1z = pos1.getZ();
final int p2x = pos2.getX();
final int p2z = pos2.getZ();
final int ey = pos2.getY();
Iterator<Integer> yiter = IntStream.range(sy, ey + 1).iterator();
final Runnable yTask = new Runnable() {
@Override public void run() {
long ystart = System.currentTimeMillis();
while (yiter.hasNext()
&& System.currentTimeMillis() - ystart < 20) {
final int y = yiter.next();
Iterator<Integer> ziter =
IntStream.range(p1z, p2z + 1).iterator();
final Runnable zTask = new Runnable() {
@Override public void run() {
long zstart = System.currentTimeMillis();
while (ziter.hasNext()
&& System.currentTimeMillis() - zstart < 20) {
final int z = ziter.next();
Iterator<Integer> xiter =
IntStream.range(p1x, p2x + 1).iterator();
final Runnable xTask = new Runnable() {
@Override public void run() {
long xstart = System.currentTimeMillis();
final int ry = y - sy;
final int rz = z - p1z;
while (xiter.hasNext()
&& System.currentTimeMillis() - xstart
< 20) {
final int x = xiter.next();
final int rx = x - p1x;
BlockVector3 point =
BlockVector3.at(x, y, z);
BaseBlock block =
cuboidRegion.getWorld()
.getFullBlock(point);
if (block.getNbtData() != null) {
Map<String, Tag> values =
new HashMap<>();
for (Map.Entry<String, Tag> entry : block
.getNbtData().getValue()
.entrySet()) {
values.put(entry.getKey(),
entry.getValue());
}
// Remove 'id' if it exists. We want 'Id'
values.remove("id");
// Positions are kept in NBT, we don't want that.
values.remove("x");
values.remove("y");
values.remove("z");
values.put("Id", new StringTag(
block.getNbtId()));
values.put("Pos", new IntArrayTag(
new int[] {rx, ry, rz}));
tileEntities
.add(new CompoundTag(values));
}
String blockKey =
block.toImmutableState()
.getAsString();
int blockId;
if (palette.containsKey(blockKey)) {
blockId = palette.get(blockKey);
} else {
blockId = palette.size();
palette
.put(blockKey, palette.size());
}
while ((blockId & -128) != 0) {
buffer.write(blockId & 127 | 128);
blockId >>>= 7;
}
buffer.write(blockId);
}
if (xiter.hasNext()) {
this.run();
}
}
};
xTask.run();
}
if (ziter.hasNext()) {
this.run();
}
}
};
zTask.run();
}
if (yiter.hasNext()) {
TaskManager.runTaskLater(this, 1);
} else {
regionTask.run();
}
}
};
yTask.run();
}
});
}
});
}
@Override
public boolean restoreTile(LocalBlockQueue queue, CompoundTag ct, int x, int y, int z) {
return new StateWrapper(ct).restoreTag(queue.getWorld(), x, y, z);
}
}

View File

@ -1,243 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.ConfigurationNode;
import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.entity.Player;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Objects;
public class BukkitSetupUtils extends SetupUtils {
@Override public void updateGenerators() {
if (!SetupUtils.generators.isEmpty()) {
return;
}
String testWorld = "CheckingPlotSquaredGenerator";
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
try {
if (plugin.isEnabled()) {
ChunkGenerator generator = plugin.getDefaultWorldGenerator(testWorld, "");
if (generator != null) {
PlotSquared.get().removePlotAreas(testWorld);
String name = plugin.getDescription().getName();
GeneratorWrapper<?> wrapped;
if (generator instanceof GeneratorWrapper<?>) {
wrapped = (GeneratorWrapper<?>) generator;
} else {
wrapped = new BukkitPlotGenerator(testWorld, generator);
}
SetupUtils.generators.put(name, wrapped);
}
}
} catch (Throwable e) { // Recover from third party generator error
e.printStackTrace();
}
}
}
@Override public void unload(String worldName, boolean save) {
World world = Bukkit.getWorld(worldName);
if (world == null) {
return;
}
World dw = Bukkit.getWorlds().get(0);
for (Player player : world.getPlayers()) {
PaperLib.teleportAsync(player,dw.getSpawnLocation());
}
if (save) {
for (Chunk chunk : world.getLoadedChunks()) {
chunk.unload(true);
}
} else {
for (Chunk chunk : world.getLoadedChunks()) {
chunk.unload(false);
}
}
Bukkit.unloadWorld(world, false);
}
@Override public String setupWorld(SetupObject object) {
SetupUtils.manager.updateGenerators();
ConfigurationNode[] steps = object.step == null ? new ConfigurationNode[0] : object.step;
String world = object.world;
int type = object.type;
String worldPath = "worlds." + object.world;
switch (type) {
case 2: {
if (object.id != null) {
if (!PlotSquared.get().worlds.contains(worldPath)) {
PlotSquared.get().worlds.createSection(worldPath);
}
ConfigurationSection worldSection =
PlotSquared.get().worlds.getConfigurationSection(worldPath);
String areaName = object.id + "-" + object.min + "-" + object.max;
String areaPath = "areas." + areaName;
if (!worldSection.contains(areaPath)) {
worldSection.createSection(areaPath);
}
ConfigurationSection areaSection =
worldSection.getConfigurationSection(areaPath);
HashMap<String, Object> options = new HashMap<>();
for (ConfigurationNode step : steps) {
options.put(step.getConstant(), step.getValue());
}
options.put("generator.type", object.type);
options.put("generator.terrain", object.terrain);
options.put("generator.plugin", object.plotManager);
if (object.setupGenerator != null && !object.setupGenerator
.equals(object.plotManager)) {
options.put("generator.init", object.setupGenerator);
}
for (Entry<String, Object> entry : options.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (worldSection.contains(key)) {
Object current = worldSection.get(key);
if (!Objects.equals(value, current)) {
areaSection.set(key, value);
}
} else {
worldSection.set(key, value);
}
}
}
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
if (gen != null && gen.isFull()) {
object.setupGenerator = null;
}
break;
}
case 1: {
if (!object.plotManager.endsWith(":single")) {
if (!PlotSquared.get().worlds.contains(worldPath)) {
PlotSquared.get().worlds.createSection(worldPath);
}
if (steps.length != 0) {
ConfigurationSection worldSection =
PlotSquared.get().worlds.getConfigurationSection(worldPath);
for (ConfigurationNode step : steps) {
worldSection.set(step.getConstant(), step.getValue());
}
}
PlotSquared.get().worlds
.set("worlds." + world + ".generator.type", object.type);
PlotSquared.get().worlds
.set("worlds." + world + ".generator.terrain", object.terrain);
PlotSquared.get().worlds
.set("worlds." + world + ".generator.plugin", object.plotManager);
if (object.setupGenerator != null && !object.setupGenerator
.equals(object.plotManager)) {
PlotSquared.get().worlds
.set("worlds." + world + ".generator.init", object.setupGenerator);
}
}
GeneratorWrapper<?> gen = SetupUtils.generators.get(object.setupGenerator);
if (gen != null && gen.isFull()) {
object.setupGenerator = null;
}
break;
}
case 0: {
if (steps.length != 0) {
if (!PlotSquared.get().worlds.contains(worldPath)) {
PlotSquared.get().worlds.createSection(worldPath);
}
ConfigurationSection worldSection =
PlotSquared.get().worlds.getConfigurationSection(worldPath);
for (ConfigurationNode step : steps) {
worldSection.set(step.getConstant(), step.getValue());
}
}
break;
}
}
try {
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
} catch (IOException e) {
e.printStackTrace();
}
Plugin plugin = Bukkit.getPluginManager().getPlugin("Multiverse-Core");
if (object.setupGenerator != null) {
if (plugin != null && plugin.isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mv create " + world + " normal -g " + object.setupGenerator);
setGenerator(world, object.setupGenerator);
if (Bukkit.getWorld(world) != null) {
return world;
}
}
WorldCreator wc = new WorldCreator(object.world);
wc.generator(object.setupGenerator);
wc.environment(Environment.NORMAL);
wc.type(WorldType.FLAT);
Bukkit.createWorld(wc);
setGenerator(world, object.setupGenerator);
} else {
if (plugin != null && plugin.isEnabled()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
"mv create " + world + " normal");
if (Bukkit.getWorld(world) != null) {
return world;
}
}
World bw =
Bukkit.createWorld(new WorldCreator(object.world).environment(Environment.NORMAL));
}
return object.world;
}
public void setGenerator(String world, String generator) {
if (Bukkit.getWorlds().isEmpty() || !Bukkit.getWorlds().get(0).getName().equals(world)) {
return;
}
File file = new File("bukkit.yml").getAbsoluteFile();
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
yml.set("worlds." + world + ".generator", generator);
try {
yml.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override public String getGenerator(PlotArea plotArea) {
if (SetupUtils.generators.isEmpty()) {
updateGenerators();
}
World world = Bukkit.getWorld(plotArea.worldname);
if (world == null) {
return null;
}
ChunkGenerator generator = world.getGenerator();
if (!(generator instanceof BukkitPlotGenerator)) {
return null;
}
for (Entry<String, GeneratorWrapper<?>> entry : SetupUtils.generators.entrySet()) {
GeneratorWrapper<?> current = entry.getValue();
if (current.equals(generator)) {
return entry.getKey();
}
}
return null;
}
}

View File

@ -1,54 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.BukkitMain;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import org.bukkit.Bukkit;
public class BukkitTaskManager extends TaskManager {
private final BukkitMain bukkitMain;
public BukkitTaskManager(BukkitMain bukkitMain) {
this.bukkitMain = bukkitMain;
}
@Override public int taskRepeat(Runnable runnable, int interval) {
return this.bukkitMain.getServer().getScheduler()
.scheduleSyncRepeatingTask(this.bukkitMain, runnable, interval, interval);
}
@SuppressWarnings("deprecation") @Override
public int taskRepeatAsync(Runnable runnable, int interval) {
return this.bukkitMain.getServer().getScheduler()
.scheduleAsyncRepeatingTask(this.bukkitMain, runnable, interval, interval);
}
@Override public void taskAsync(Runnable runnable) {
if (this.bukkitMain.isEnabled()) {
this.bukkitMain.getServer().getScheduler()
.runTaskAsynchronously(this.bukkitMain, runnable);
} else {
runnable.run();
}
}
@Override public void task(Runnable runnable) {
this.bukkitMain.getServer().getScheduler().runTask(this.bukkitMain, runnable).getTaskId();
}
@Override public void taskLater(Runnable runnable, int delay) {
this.bukkitMain.getServer().getScheduler().runTaskLater(this.bukkitMain, runnable, delay)
.getTaskId();
}
@Override public void taskLaterAsync(Runnable runnable, int delay) {
this.bukkitMain.getServer().getScheduler()
.runTaskLaterAsynchronously(this.bukkitMain, runnable, delay);
}
@Override public void cancelTask(int task) {
if (task != -1) {
Bukkit.getScheduler().cancelTask(task);
}
}
}

View File

@ -1,445 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@SuppressWarnings({"unused", "WeakerAccess"}) public class BukkitUtil extends WorldUtil {
private static String lastString = null;
private static World lastWorld = null;
private static Player lastPlayer = null;
private static PlotPlayer lastPlotPlayer = null;
public static void removePlayer(String player) {
lastPlayer = null;
lastPlotPlayer = null;
}
public static PlotPlayer getPlayer(@NonNull final OfflinePlayer op) {
if (op.isOnline()) {
return getPlayer(op.getPlayer());
}
final Player player = OfflinePlayerUtil.loadPlayer(op);
player.loadData();
return new BukkitPlayer(player, true);
}
/**
* Get a plot based on the location.
*
* @param location the location to check
* @return plot if found, otherwise it creates a temporary plot
* @see Plot
*/
public static Plot getPlot(org.bukkit.Location location) {
if (location == null) {
return null;
}
return getLocation(location).getPlot();
}
/**
* Get a plot based on the player location.
*
* @param player the player to check
* @return plot if found, otherwise it creates a temporary plot
* @see #getPlot(org.bukkit.Location)
* @see Plot
*/
public static Plot getPlot(Player player) {
return getPlot(player.getLocation());
}
/**
* Get home location.
*
* @param plot Plot that you want to get the location for
* @return plot bottom location
* @see Plot
*/
public static org.bukkit.Location getHomeLocation(Plot plot) {
return BukkitUtil.getLocation(plot.getHome());
}
/**
* Get the PlotPlayer for an offline player.
*
* <p>Note that this will work if the player is offline, however not all
* functionality will work.
*
* @param player the player to wrap
* @return a {@code PlotPlayer}
* @see PlotPlayer#wrap(Object)
*/
public static PlotPlayer wrapPlayer(OfflinePlayer player) {
return PlotPlayer.wrap(player);
}
/**
* Gets the PlotPlayer for a player. The PlotPlayer is usually cached and
* will provide useful functions relating to players.
*
* @param player the player to wrap
* @return a {@code PlotPlayer}
* @see PlotPlayer#wrap(Object)
*/
public static PlotPlayer wrapPlayer(Player player) {
return PlotPlayer.wrap(player);
}
/**
* Gets the number of plots, which the player is able to build in.
*
* @param player player, for whom we're getting the plots
* @return the number of allowed plots
*/
public static int getAllowedPlots(Player player) {
PlotPlayer plotPlayer = PlotPlayer.wrap(player);
return plotPlayer.getAllowedPlots();
}
/**
* Check whether or not a player is in a plot.
*
* @param player who we're checking for
* @return true if the player is in a plot, false if not-
*/
public static boolean isInPlot(Player player) {
return getPlot(player) != null;
}
/**
* Gets a collection containing the players plots.
*
* @param world Specify the world we want to select the plots from
* @param player Player, for whom we're getting the plots
* @return a set containing the players plots
* @see Plot
*/
public static Set<Plot> getPlayerPlots(String world, Player player) {
if (world == null) {
return new HashSet<>();
}
return PlotPlayer.wrap(player).getPlots(world);
}
/**
* Send a message to a player. The message supports color codes.
*
* @param player the recipient of the message
* @param string the message
* @see MainUtil#sendMessage(PlotPlayer, String)
*/
public static void sendMessage(Player player, String string) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), string);
}
/**
* Gets the player plot count.
*
* @param world Specify the world we want to select the plots from
* @param player Player, for whom we're getting the plot count
* @return the number of plots the player has
*/
public static int getPlayerPlotCount(String world, Player player) {
if (world == null) {
return 0;
}
return BukkitUtil.getPlayer(player).getPlotCount(world);
}
/**
* Send a message to a player.
*
* @param player the recipient of the message
* @param caption the message
* @see MainUtil#sendMessage(com.github.intellectualsites.plotsquared.commands.CommandCaller, Captions, String...)
*/
public static void sendMessage(Player player, Captions caption) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption);
}
public static PlotPlayer getPlayer(@NonNull final Player player) {
if (player == lastPlayer) {
return lastPlotPlayer;
}
final String name = player.getName();
final PlotPlayer plotPlayer = UUIDHandler.getPlayer(name);
if (plotPlayer != null) {
return plotPlayer;
}
lastPlotPlayer = new BukkitPlayer(player);
UUIDHandler.getPlayers().put(name, lastPlotPlayer);
lastPlayer = player;
return lastPlotPlayer;
}
public static Location getLocation(@NonNull final org.bukkit.Location location) {
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()),
MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()));
}
public static Location getLocationFull(@NonNull final org.bukkit.Location location) {
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()),
MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()),
location.getYaw(), location.getPitch());
}
public static org.bukkit.Location getLocation(@NonNull final Location location) {
return new org.bukkit.Location(getWorld(location.getWorld()), location.getX(),
location.getY(), location.getZ());
}
public static World getWorld(@NonNull final String string) {
return Bukkit.getWorld(string);
}
public static String getWorld(@NonNull final Entity entity) {
return entity.getWorld().getName();
}
public static List<Entity> getEntities(@NonNull final String worldName) {
World world = getWorld(worldName);
if (world != null) {
return world.getEntities();
} else {
return new ArrayList<>();
}
}
public static Location getLocation(@NonNull final Entity entity) {
final org.bukkit.Location location = entity.getLocation();
String world = location.getWorld().getName();
return new Location(world, location.getBlockX(), location.getBlockY(),
location.getBlockZ());
}
@NotNull public static Location getLocationFull(@NonNull final Entity entity) {
final org.bukkit.Location location = entity.getLocation();
return new Location(location.getWorld().getName(), MathMan.roundInt(location.getX()),
MathMan.roundInt(location.getY()), MathMan.roundInt(location.getZ()), location.getYaw(),
location.getPitch());
}
public static Material getMaterial(@NonNull final BlockState plotBlock) {
return BukkitAdapter.adapt(plotBlock.getBlockType());
}
@Override public boolean isBlockSame(BlockState block1, BlockState block2) {
if (block1.equals(block2)) {
return true;
}
Material mat1 = getMaterial(block1), mat2 = getMaterial(block2);
return mat1 == mat2;
}
@Override public boolean isWorld(@NonNull final String worldName) {
return getWorld(worldName) != null;
}
@Override public BiomeType getBiome(String world, int x, int z) {
return BukkitAdapter.adapt(getWorld(world).getBiome(x, z));
}
@Override public int getHighestBlock(@NonNull final String world, final int x, final int z) {
final World bukkitWorld = getWorld(world);
// Skip top and bottom block
int air = 1;
for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) {
Block block = bukkitWorld.getBlockAt(x, y, z);
Material type = block.getType();
if (type.isSolid()) {
if (air > 1) {
return y;
}
air = 0;
} else {
if (block.isLiquid()) {
return y;
}
air++;
}
}
return bukkitWorld.getMaxHeight() - 1;
}
@Override @Nullable public String[] getSign(@NonNull final Location location) {
Block block = getWorld(location.getWorld()).getBlockAt(location.getX(), location.getY(), location.getZ());
return TaskManager.IMP.sync(new RunnableVal<String[]>() {
@Override public void run(String[] value) {
if (block.getState() instanceof Sign) {
Sign sign = (Sign) block.getState();
this.value = sign.getLines();
}
}
});
}
@Override public Location getSpawn(@NonNull final PlotPlayer player) {
return getLocation(((BukkitPlayer) player).player.getBedSpawnLocation());
}
@Override public Location getSpawn(@NonNull final String world) {
final org.bukkit.Location temp = getWorld(world).getSpawnLocation();
return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ(),
temp.getYaw(), temp.getPitch());
}
@Override public void setSpawn(@NonNull final Location location) {
final World world = getWorld(location.getWorld());
if (world != null) {
world.setSpawnLocation(location.getX(), location.getY(), location.getZ());
}
}
@Override public void saveWorld(@NonNull final String worldName) {
final World world = getWorld(worldName);
if (world != null) {
world.save();
}
}
@Override @SuppressWarnings("deprecation")
public void setSign(@NonNull final String worldName, final int x, final int y, final int z,
@NonNull final String[] lines) {
final World world = getWorld(worldName);
final Block block = world.getBlockAt(x, y, z);
// block.setType(Material.AIR);
final Material type = block.getType();
if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) {
BlockFace facing = BlockFace.EAST;
if (world.getBlockAt(x, y, z + 1).getType().isSolid()) {
facing = BlockFace.NORTH;
} else if (world.getBlockAt(x + 1, y, z).getType().isSolid()) {
facing = BlockFace.WEST;
} else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) {
facing = BlockFace.SOUTH;
}
if (PlotSquared.get().IMP.getServerVersion()[1] == 13) {
block.setType(Material.valueOf("WALL_SIGN"), false);
} else {
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
}
if (!(block.getBlockData() instanceof WallSign)) {
PlotSquared.debug(block.getBlockData().getAsString());
throw new RuntimeException("Something went wrong generating a sign");
}
final Directional sign = (Directional) block.getBlockData();
sign.setFacing(facing);
block.setBlockData(sign, false);
}
final org.bukkit.block.BlockState blockstate = block.getState();
if (blockstate instanceof Sign) {
final Sign sign = (Sign) blockstate;
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i]);
}
sign.update(true);
}
}
@Override
public boolean addItems(@NonNull final String worldName, @NonNull final PlotItem items) {
final World world = getWorld(worldName);
final Block block = world.getBlockAt(items.x, items.y, items.z);
final org.bukkit.block.BlockState state = block.getState();
if (state instanceof InventoryHolder) {
InventoryHolder holder = (InventoryHolder) state;
Inventory inv = holder.getInventory();
for (int i = 0; i < items.types.length; i++) {
// ItemStack item = new ItemStack(LegacyMappings.fromLegacyId(items.id[i]).getMaterial(), items.amount[i], items.data[i]);
ItemStack item = new ItemStack(BukkitAdapter.adapt(items.types[i]), items.amount[i]);
inv.addItem(item);
}
state.update(true);
return true;
}
return false;
}
@Override public boolean isBlockSolid(@NonNull final BlockState block) {
return block.getBlockType().getMaterial().isSolid();
}
@Override public String getClosestMatchingName(@NonNull final BlockState block) {
try {
return getMaterial(block).name();
} catch (Exception ignored) {
return null;
}
}
@Override @Nullable
public StringComparison<BlockState>.ComparisonResult getClosestBlock(String name) {
BlockState state = BlockUtil.get(name);
return new StringComparison<BlockState>().new ComparisonResult(1, state);
}
@Override
public void setBiomes(@NonNull final String worldName, @NonNull final CuboidRegion region,
@NonNull final BiomeType biomeType) {
final World world = getWorld(worldName);
final Biome biome = BukkitAdapter.adapt(biomeType);
for (int x = region.getMinimumPoint().getX(); x <= region.getMaximumPoint().getX(); x++) {
for (int z = region.getMinimumPoint().getZ(); z <= region.getMaximumPoint().getZ(); z++) {
world.setBiome(x, z, biome);
}
}
}
public com.sk89q.worldedit.world.World getWeWorld(String world) {
return new BukkitWorld(Bukkit.getWorld(world));
}
@Override public BlockState getBlock(@NonNull final Location location) {
final World world = getWorld(location.getWorld());
final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
return BukkitAdapter.asBlockType(block.getType()).getDefaultState();
}
@Override public String getMainWorld() {
return Bukkit.getWorlds().get(0).getName();
}
}

View File

@ -1,7 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
public class BukkitVersion {
public static int[] v1_13_2 = {1, 13, 2};
public static int[] v1_13_1 = {1, 13, 1};
public static int[] v1_13_0 = {1, 13, 0};
}

View File

@ -1,708 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.ServicePriority;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
/**
* bStats collects some data for plugin authors.
* <p>
* Check out https://bStats.org/ to learn more about bStats!
*/
@SuppressWarnings({"WeakerAccess", "unused"})
public class Metrics {
static {
// You can use the property to disable the check in your test environment
if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) {
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
final String defaultPackage = new String(
new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'});
final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
// We want to make sure nobody just copy & pastes the example and use the wrong package names
if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) {
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
}
}
}
// The version of this bStats class
public static final int B_STATS_VERSION = 1;
// The url to which the data is sent
private static final String URL = "https://bStats.org/submitData/bukkit";
// Is bStats enabled on this server?
private boolean enabled;
// Should failed requests be logged?
private static boolean logFailedRequests;
// Should the sent data be logged?
private static boolean logSentData;
// Should the response text be logged?
private static boolean logResponseStatusText;
// The uuid of the server
private static String serverUUID;
// The plugin
private final Plugin plugin;
// A list with all custom charts
private final List<CustomChart> charts = new ArrayList<>();
/**
* Class constructor.
*
* @param plugin The plugin which stats should be submitted.
*/
public Metrics(Plugin plugin) {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
this.plugin = plugin;
// Get the config file
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
File configFile = new File(bStatsFolder, "config.yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
// Check if the config file exists
if (!config.isSet("serverUuid")) {
// Add default values
config.addDefault("enabled", true);
// Every server gets it's unique random id.
config.addDefault("serverUuid", UUID.randomUUID().toString());
// Should failed request be logged?
config.addDefault("logFailedRequests", false);
// Should the sent data be logged?
config.addDefault("logSentData", false);
// Should the response text be logged?
config.addDefault("logResponseStatusText", false);
// Inform the server owners about bStats
config.options().header(
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
"To honor their work, you should not disable it.\n" +
"This has nearly no effect on the server performance!\n" +
"Check out https://bStats.org/ to learn more :)"
).copyDefaults(true);
try {
config.save(configFile);
} catch (IOException ignored) { }
}
// Load the data
enabled = config.getBoolean("enabled", true);
serverUUID = config.getString("serverUuid");
logFailedRequests = config.getBoolean("logFailedRequests", false);
logSentData = config.getBoolean("logSentData", false);
logResponseStatusText = config.getBoolean("logResponseStatusText", false);
if (enabled) {
boolean found = false;
// Search for all other bStats Metrics classes to see if we are the first one
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION"); // Our identifier :)
found = true; // We aren't the first
break;
} catch (NoSuchFieldException ignored) { }
}
// Register our service
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
if (!found) {
// We are the first!
startSubmitting();
}
}
}
/**
* Checks if bStats is enabled.
*
* @return Whether bStats is enabled or not.
*/
public boolean isEnabled() {
return enabled;
}
/**
* Adds a custom chart.
*
* @param chart The chart to add.
*/
public void addCustomChart(CustomChart chart) {
if (chart == null) {
throw new IllegalArgumentException("Chart cannot be null!");
}
charts.add(chart);
}
/**
* Starts the Scheduler which submits our data every 30 minutes.
*/
private void startSubmitting() {
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (!plugin.isEnabled()) { // Plugin was disabled
timer.cancel();
return;
}
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
Bukkit.getScheduler().runTask(plugin, () -> submitData());
}
}, 1000 * 60 * 5, 1000 * 60 * 30);
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
// WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
// WARNING: Just don't do it!
}
/**
* Gets the plugin specific data.
* This method is called using Reflection.
*
* @return The plugin specific data.
*/
public JSONObject getPluginData() {
JSONObject data = new JSONObject();
String pluginName = plugin.getDescription().getName();
String pluginVersion = plugin.getDescription().getVersion();
data.put("pluginName", pluginName); // Append the name of the plugin
data.put("pluginVersion", pluginVersion); // Append the version of the plugin
JSONArray customCharts = new JSONArray();
for (CustomChart customChart : charts) {
// Add the data of the custom charts
JSONObject chart = customChart.getRequestJsonObject();
if (chart == null) { // If the chart is null, we skip it
continue;
}
customCharts.add(chart);
}
data.put("customCharts", customCharts);
return data;
}
/**
* Gets the server specific data.
*
* @return The server specific data.
*/
private JSONObject getServerData() {
// Minecraft specific data
int playerAmount;
try {
// Around MC 1.8 the return type was changed to a collection from an array,
// This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
} catch (Exception e) {
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
}
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
String bukkitVersion = Bukkit.getVersion();
// OS/Java specific data
String javaVersion = System.getProperty("java.version");
String osName = System.getProperty("os.name");
String osArch = System.getProperty("os.arch");
String osVersion = System.getProperty("os.version");
int coreCount = Runtime.getRuntime().availableProcessors();
JSONObject data = new JSONObject();
data.put("serverUUID", serverUUID);
data.put("playerAmount", playerAmount);
data.put("onlineMode", onlineMode);
data.put("bukkitVersion", bukkitVersion);
data.put("javaVersion", javaVersion);
data.put("osName", osName);
data.put("osArch", osArch);
data.put("osVersion", osVersion);
data.put("coreCount", coreCount);
return data;
}
/**
* Collects the data and sends it afterwards.
*/
private void submitData() {
final JSONObject data = getServerData();
JSONArray pluginData = new JSONArray();
// Search for all other bStats Metrics classes to get their plugin data
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION"); // Our identifier :)
for (RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
try {
pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider()));
} catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { }
}
} catch (NoSuchFieldException ignored) { }
}
data.put("plugins", pluginData);
// Create a new thread for the connection to the bStats server
new Thread(new Runnable() {
@Override
public void run() {
try {
// Send the data
sendData(plugin, data);
} catch (Exception e) {
// Something went wrong! :(
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
}
}
}
}).start();
}
/**
* Sends the data to the bStats server.
*
* @param plugin Any plugin. It's just used to get a logger instance.
* @param data The data to send.
* @throws Exception If the request failed.
*/
private static void sendData(Plugin plugin, JSONObject data) throws Exception {
if (data == null) {
throw new IllegalArgumentException("Data cannot be null!");
}
if (Bukkit.isPrimaryThread()) {
throw new IllegalAccessException("This method must not be called from the main thread!");
}
if (logSentData) {
plugin.getLogger().info("Sending data to bStats: " + data.toString());
}
HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
// Compress the data to save bandwidth
byte[] compressedData = compress(data.toString());
// Add headers
connection.setRequestMethod("POST");
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
// Send data
connection.setDoOutput(true);
DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.write(compressedData);
outputStream.flush();
outputStream.close();
InputStream inputStream = connection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder builder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
builder.append(line);
}
bufferedReader.close();
if (logResponseStatusText) {
plugin.getLogger().info("Sent data to bStats and received response: " + builder.toString());
}
}
/**
* Gzips the given String.
*
* @param str The string to gzip.
* @return The gzipped String.
* @throws IOException If the compression failed.
*/
private static byte[] compress(final String str) throws IOException {
if (str == null) {
return null;
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
gzip.write(str.getBytes(StandardCharsets.UTF_8));
gzip.close();
return outputStream.toByteArray();
}
/**
* Represents a custom chart.
*/
public static abstract class CustomChart {
// The id of the chart
final String chartId;
/**
* Class constructor.
*
* @param chartId The id of the chart.
*/
CustomChart(String chartId) {
if (chartId == null || chartId.isEmpty()) {
throw new IllegalArgumentException("ChartId cannot be null or empty!");
}
this.chartId = chartId;
}
private JSONObject getRequestJsonObject() {
JSONObject chart = new JSONObject();
chart.put("chartId", chartId);
try {
JSONObject data = getChartData();
if (data == null) {
// If the data is null we don't send the chart.
return null;
}
chart.put("data", data);
} catch (Throwable t) {
if (logFailedRequests) {
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
}
return null;
}
return chart;
}
protected abstract JSONObject getChartData() throws Exception;
}
/**
* Represents a custom simple pie.
*/
public static class SimplePie extends CustomChart {
private final Callable<String> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public SimplePie(String chartId, Callable<String> callable) {
super(chartId);
this.callable = callable;
}
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
String value = callable.call();
if (value == null || value.isEmpty()) {
// Null = skip the chart
return null;
}
data.put("value", value);
return data;
}
}
/**
* Represents a custom advanced pie.
*/
public static class AdvancedPie extends CustomChart {
private final Callable<Map<String, Integer>> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
super(chartId);
this.callable = callable;
}
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Map<String, Integer> map = callable.call();
if (map == null || map.isEmpty()) {
// Null = skip the chart
return null;
}
boolean allSkipped = true;
for (Map.Entry<String, Integer> entry : map.entrySet()) {
if (entry.getValue() == 0) {
continue; // Skip this invalid
}
allSkipped = false;
values.put(entry.getKey(), entry.getValue());
}
if (allSkipped) {
// Null = skip the chart
return null;
}
data.put("values", values);
return data;
}
}
/**
* Represents a custom drilldown pie.
*/
public static class DrilldownPie extends CustomChart {
private final Callable<Map<String, Map<String, Integer>>> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) {
super(chartId);
this.callable = callable;
}
@Override
public JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Map<String, Map<String, Integer>> map = callable.call();
if (map == null || map.isEmpty()) {
// Null = skip the chart
return null;
}
boolean reallyAllSkipped = true;
for (Map.Entry<String, Map<String, Integer>> entryValues : map.entrySet()) {
JSONObject value = new JSONObject();
boolean allSkipped = true;
for (Map.Entry<String, Integer> valueEntry : map.get(entryValues.getKey()).entrySet()) {
value.put(valueEntry.getKey(), valueEntry.getValue());
allSkipped = false;
}
if (!allSkipped) {
reallyAllSkipped = false;
values.put(entryValues.getKey(), value);
}
}
if (reallyAllSkipped) {
// Null = skip the chart
return null;
}
data.put("values", values);
return data;
}
}
/**
* Represents a custom single line chart.
*/
public static class SingleLineChart extends CustomChart {
private final Callable<Integer> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public SingleLineChart(String chartId, Callable<Integer> callable) {
super(chartId);
this.callable = callable;
}
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
int value = callable.call();
if (value == 0) {
// Null = skip the chart
return null;
}
data.put("value", value);
return data;
}
}
/**
* Represents a custom multi line chart.
*/
public static class MultiLineChart extends CustomChart {
private final Callable<Map<String, Integer>> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
super(chartId);
this.callable = callable;
}
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Map<String, Integer> map = callable.call();
if (map == null || map.isEmpty()) {
// Null = skip the chart
return null;
}
boolean allSkipped = true;
for (Map.Entry<String, Integer> entry : map.entrySet()) {
if (entry.getValue() == 0) {
continue; // Skip this invalid
}
allSkipped = false;
values.put(entry.getKey(), entry.getValue());
}
if (allSkipped) {
// Null = skip the chart
return null;
}
data.put("values", values);
return data;
}
}
/**
* Represents a custom simple bar chart.
*/
public static class SimpleBarChart extends CustomChart {
private final Callable<Map<String, Integer>> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
super(chartId);
this.callable = callable;
}
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Map<String, Integer> map = callable.call();
if (map == null || map.isEmpty()) {
// Null = skip the chart
return null;
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
JSONArray categoryValues = new JSONArray();
categoryValues.add(entry.getValue());
values.put(entry.getKey(), categoryValues);
}
data.put("values", values);
return data;
}
}
/**
* Represents a custom advanced bar chart.
*/
public static class AdvancedBarChart extends CustomChart {
private final Callable<Map<String, int[]>> callable;
/**
* Class constructor.
*
* @param chartId The id of the chart.
* @param callable The callable which is used to request the chart data.
*/
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
super(chartId);
this.callable = callable;
}
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Map<String, int[]> map = callable.call();
if (map == null || map.isEmpty()) {
// Null = skip the chart
return null;
}
boolean allSkipped = true;
for (Map.Entry<String, int[]> entry : map.entrySet()) {
if (entry.getValue().length == 0) {
continue; // Skip this invalid
}
allSkipped = false;
JSONArray categoryValues = new JSONArray();
for (int categoryValue : entry.getValue()) {
categoryValues.add(categoryValue);
}
values.put(entry.getKey(), categoryValues);
}
if (allSkipped) {
// Null = skip the chart
return null;
}
data.put("values", values);
return data;
}
}
}

View File

@ -1,87 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.UUID;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.callConstructor;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.callMethod;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getCbClass;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getNmsClass;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getUtilClass;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.makeConstructor;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.makeMethod;
public class OfflinePlayerUtil {
public static Player loadPlayer(OfflinePlayer player) {
if (player == null) {
return null;
}
if (player instanceof Player) {
return (Player) player;
}
return loadPlayer(player.getUniqueId(), player.getName());
}
private static Player loadPlayer(UUID id, String name) {
Object server = getMinecraftServer();
Object interactManager = newPlayerInteractManager();
Object worldServer = getWorldServer();
Object profile = newGameProfile(id, name);
Class<?> entityPlayerClass = getNmsClass("EntityPlayer");
Constructor entityPlayerConstructor =
makeConstructor(entityPlayerClass, getNmsClass("MinecraftServer"),
getNmsClass("WorldServer"), getUtilClass("com.mojang.authlib.GameProfile"),
getNmsClass("PlayerInteractManager"));
Object entityPlayer =
callConstructor(entityPlayerConstructor, server, worldServer, profile, interactManager);
return (Player) getBukkitEntity(entityPlayer);
}
private static Object newGameProfile(UUID id, String name) {
Class<?> gameProfileClass = getUtilClass("com.mojang.authlib.GameProfile");
if (gameProfileClass == null) { //Before uuids
return name;
}
Constructor gameProfileConstructor =
makeConstructor(gameProfileClass, UUID.class, String.class);
if (gameProfileConstructor == null) { //Version has string constructor
gameProfileConstructor = makeConstructor(gameProfileClass, String.class, String.class);
return callConstructor(gameProfileConstructor, id.toString(), name);
} else { //Version has uuid constructor
return callConstructor(gameProfileConstructor, id, name);
}
}
private static Object newPlayerInteractManager() {
Object worldServer = getWorldServer();
Class<?> playerInteractClass = getNmsClass("PlayerInteractManager");
Class<?> worldClass = getNmsClass("World");
Constructor c = makeConstructor(playerInteractClass, worldClass);
return callConstructor(c, worldServer);
}
private static Object getWorldServer() {
Object server = getMinecraftServer();
Class<?> minecraftServerClass = getNmsClass("MinecraftServer");
Method getWorldServer = makeMethod(minecraftServerClass, "getWorldServer", int.class);
return callMethod(getWorldServer, server, 0);
}
//NMS Utils
private static Object getMinecraftServer() {
return callMethod(makeMethod(getCbClass("CraftServer"), "getServer"), Bukkit.getServer());
}
private static Entity getBukkitEntity(Object o) {
Method getBukkitEntity = makeMethod(o.getClass(), "getBukkitEntity");
return callMethod(getBukkitEntity, o);
}
}

View File

@ -1,142 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefClass;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefConstructor;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefField;
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.RefMethod;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.sk89q.worldedit.math.BlockVector2;
import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
/**
* An utility that can be used to send chunks, rather than using bukkit code
* to do so (uses heavy NMS).
*/
public class SendChunk {
private final RefMethod methodGetHandlePlayer;
private final RefMethod methodGetHandleChunk;
private final RefConstructor mapChunk;
private final RefField connection;
private final RefMethod send;
private final RefMethod methodInitLighting;
/**
* Constructor.
*/
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
this.methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
RefClass classChunk = getRefClass("{nms}.Chunk");
this.methodInitLighting = classChunk.getMethod("initLighting");
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), int.class);
RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
this.connection = classEntityPlayer.getField("playerConnection");
RefClass classPacket = getRefClass("{nms}.Packet");
RefClass classConnection = getRefClass("{nms}.PlayerConnection");
this.send = classConnection.getMethod("sendPacket", classPacket.getRealClass());
}
public void sendChunk(Collection<Chunk> input) {
HashSet<Chunk> chunks = new HashSet<>(input);
HashMap<String, ArrayList<Chunk>> map = new HashMap<>();
int view = Bukkit.getServer().getViewDistance();
for (Chunk chunk : chunks) {
String world = chunk.getWorld().getName();
ArrayList<Chunk> list = map.computeIfAbsent(world, k -> new ArrayList<>());
list.add(chunk);
Object c = this.methodGetHandleChunk.of(chunk).call();
this.methodInitLighting.of(c).call();
}
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
PlotPlayer pp = entry.getValue();
Plot plot = pp.getCurrentPlot();
Location location = null;
String world;
if (plot != null) {
world = plot.getWorldName();
} else {
location = pp.getLocation();
world = location.getWorld();
}
ArrayList<Chunk> list = map.get(world);
if (list == null) {
continue;
}
if (location == null) {
location = pp.getLocation();
}
int chunkX = location.getX() >> 4;
int chunkZ = location.getZ() >> 4;
Player player = ((BukkitPlayer) pp).player;
Object entity = this.methodGetHandlePlayer.of(player).call();
for (Chunk chunk : list) {
int dx = Math.abs(chunkX - chunk.getX());
int dz = Math.abs(chunkZ - chunk.getZ());
if ((dx > view) || (dz > view)) {
continue;
}
Object c = this.methodGetHandleChunk.of(chunk).call();
chunks.remove(chunk);
Object con = this.connection.of(entity).get();
Object packet = null;
try {
packet = this.mapChunk.create(c, 65535);
} catch (Exception ignored) {
}
if (packet == null) {
PlotSquared.debug("Error with PacketPlayOutMapChunk reflection.");
}
this.send.of(con).call(packet);
}
}
for (final Chunk chunk : chunks) {
TaskManager.runTask(() -> {
try {
chunk.unload(true);
} catch (Throwable ignored) {
String worldName = chunk.getWorld().getName();
PlotSquared.debug(
"$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";" + chunk
.getZ());
PlotSquared.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
PlotSquared.debug("$3 - $4" + worldName + "/level.dat or " + worldName
+ "/level_old.dat may be corrupt (try repairing or removing these)");
}
});
}
}
public void sendChunk(String worldName, Collection<BlockVector2> chunkLocations) {
World myWorld = Bukkit.getWorld(worldName);
ArrayList<Chunk> chunks = new ArrayList<>();
for (BlockVector2 loc : chunkLocations) {
if (myWorld.isChunkLoaded(loc.getX(), loc.getZ())) {
PaperLib.getChunkAtAsync(myWorld, loc.getX(), loc.getZ()).thenAccept(chunks::add);
}
}
sendChunk(chunks);
}
}

View File

@ -1,147 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util.block;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil;
import com.github.intellectualsites.plotsquared.bukkit.object.schematic.StateWrapper;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.block.BasicLocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import io.papermc.lib.PaperLib;
import lombok.NonNull;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import java.util.concurrent.ExecutionException;
public class BukkitLocalQueue extends BasicLocalBlockQueue {
public BukkitLocalQueue(String world) {
super(world);
}
@Override public LocalChunk getLocalChunk(int x, int z) {
return new BasicLocalChunk(this, x, z) {
// Custom stuff?
};
}
@Override public void optimize() {
}
@Override public BlockState getBlock(int x, int y, int z) {
World worldObj = Bukkit.getWorld(getWorld());
if (worldObj != null) {
Block block = worldObj.getBlockAt(x, y, z);
return BukkitBlockUtil.get(block);
} else {
return BlockUtil.get(0, 0);
}
}
@Override public void refreshChunk(int x, int z) {
World worldObj = Bukkit.getWorld(getWorld());
if (worldObj != null) {
worldObj.refreshChunk(x, z);
} else {
PlotSquared.debug("Error Refreshing Chunk");
}
}
@Override public void fixChunkLighting(int x, int z) {
// Do nothing
}
@Override public final void regenChunk(int x, int z) {
World worldObj = Bukkit.getWorld(getWorld());
if (worldObj != null) {
worldObj.regenerateChunk(x, z);
} else {
PlotSquared.debug("Error Regenerating Chunk");
}
}
@Override public final void setComponents(LocalChunk lc)
throws ExecutionException, InterruptedException {
setBaseBlocks(lc);
}
public void setBaseBlocks(LocalChunk localChunk) {
World worldObj = Bukkit.getWorld(getWorld());
if (worldObj == null) {
throw new NullPointerException("World cannot be null.");
}
PaperLib.getChunkAtAsync(worldObj, localChunk.getX(), localChunk.getZ(), true)
.thenAccept(chunk -> {
for (int layer = 0; layer < localChunk.baseblocks.length; layer++) {
BaseBlock[] blocksLayer = localChunk.baseblocks[layer];
if (blocksLayer != null) {
for (int j = 0; j < blocksLayer.length; j++) {
if (blocksLayer[j] != null) {
BaseBlock block = blocksLayer[j];
int x = MainUtil.x_loc[layer][j];
int y = MainUtil.y_loc[layer][j];
int z = MainUtil.z_loc[layer][j];
BlockData blockData = BukkitAdapter.adapt(block);
Block existing = chunk.getBlock(x, y, z);
if (BukkitBlockUtil.get(existing).equals(block) && existing
.getBlockData().matches(blockData)) {
continue;
}
existing.setType(BukkitAdapter.adapt(block.getBlockType()), false);
existing.setBlockData(blockData, false);
if (block.hasNbtData()) {
CompoundTag tag = block.getNbtData();
StateWrapper sw = new StateWrapper(tag);
sw.restoreTag(worldObj.getName(), existing.getX(),
existing.getY(), existing.getZ());
}
}
}
}
}
});
}
private void setMaterial(@NonNull final BlockState plotBlock, @NonNull final Block block) {
Material material = BukkitAdapter.adapt(plotBlock.getBlockType());
block.setType(material, false);
}
private boolean equals(@NonNull final BlockState plotBlock, @NonNull final Block block) {
return plotBlock.equals(BukkitBlockUtil.get(block));
}
public void setBiomes(LocalChunk lc) {
if (lc.biomes != null) {
World worldObj = Bukkit.getWorld(getWorld());
int bx = lc.getX() << 4;
int bz = lc.getX() << 4;
for (int x = 0; x < lc.biomes.length; x++) {
BiomeType[] biomes2 = lc.biomes[x];
if (biomes2 != null) {
for (BiomeType biomeStr : biomes2) {
if (biomeStr != null) {
Biome biome = BukkitAdapter.adapt(biomeStr);
worldObj.setBiome(bx, bz, biome);
}
}
}
}
}
}
}

View File

@ -1,191 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.util.block;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil;
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper;
import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import java.util.Arrays;
public class GenChunk extends ScopedLocalBlockQueue {
public final Biome[] biomes;
public BlockState[][] result;
public BiomeGrid biomeGrid;
public Chunk chunk;
public String world;
public int chunkX;
public int chunkZ;
@Getter @Setter private ChunkData chunkData = null;
public GenChunk() {
super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15));
this.biomes = Biome.values();
}
public Chunk getChunk() {
if (chunk == null) {
World worldObj = BukkitUtil.getWorld(world);
if (worldObj != null) {
this.chunk = worldObj.getChunkAt(chunkX, chunkZ);
}
}
return chunk;
}
public void setChunk(Chunk chunk) {
this.chunk = chunk;
}
public void setChunk(ChunkWrapper wrap) {
chunk = null;
world = wrap.world;
chunkX = wrap.x;
chunkZ = wrap.z;
}
@Override public void fillBiome(BiomeType biomeType) {
if (biomeGrid == null) {
return;
}
Biome biome = BukkitAdapter.adapt(biomeType);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
this.biomeGrid.setBiome(x, z, biome);
}
}
}
@Override public void setCuboid(Location pos1, Location pos2, BlockState block) {
if (result != null && pos1.getX() == 0 && pos1.getZ() == 0 && pos2.getX() == 15
&& pos2.getZ() == 15) {
for (int y = pos1.getY(); y <= pos2.getY(); y++) {
int layer = y >> 4;
BlockState[] data = result[layer];
if (data == null) {
result[layer] = data = new BlockState[4096];
}
int start = y << 8;
int end = start + 256;
Arrays.fill(data, start, end, block);
}
}
int minX = Math.min(pos1.getX(), pos2.getX());
int minY = Math.min(pos1.getY(), pos2.getY());
int minZ = Math.min(pos1.getZ(), pos2.getZ());
int maxX = Math.max(pos1.getX(), pos2.getX());
int maxY = Math.max(pos1.getY(), pos2.getY());
int maxZ = Math.max(pos1.getZ(), pos2.getZ());
chunkData.setRegion(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1, BukkitAdapter.adapt(block));
}
@Override public boolean setBiome(int x, int z, BiomeType biomeType) {
return setBiome(x, z, BukkitAdapter.adapt(biomeType));
}
public boolean setBiome(int x, int z, Biome biome) {
if (this.biomeGrid != null) {
this.biomeGrid.setBiome(x, z, biome);
return true;
}
return false;
}
@Override public boolean setBlock(int x, int y, int z, Pattern pattern) {
return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z));
}
@Override public boolean setBlock(int x, int y, int z, BlockState id) {
if (this.result == null) {
this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id));
return true;
}
this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id));
this.storeCache(x, y, z, id);
return true;
}
private void storeCache(final int x, final int y, final int z, final BlockState id) {
int i = MainUtil.CACHE_I[y][x][z];
BlockState[] v = this.result[i];
if (v == null) {
this.result[i] = v = new BlockState[4096];
}
int j = MainUtil.CACHE_J[y][x][z];
v[j] = id;
}
@Override public boolean setBlock(int x, int y, int z, BaseBlock id) {
if (this.result == null) {
this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id));
return true;
}
this.chunkData.setBlock(x, y, z, BukkitAdapter.adapt(id));
this.storeCache(x, y, z, id.toImmutableState());
return true;
}
@Override public BlockState getBlock(int x, int y, int z) {
int i = MainUtil.CACHE_I[y][x][z];
if (result == null) {
return BukkitBlockUtil.get(chunkData.getType(x, y, z));
}
BlockState[] array = result[i];
if (array == null) {
return BlockTypes.AIR.getDefaultState();
}
int j = MainUtil.CACHE_J[y][x][z];
return array[j];
}
public int getX() {
return chunk == null ? chunkX : chunk.getX();
}
public int getZ() {
return chunk == null ? chunkZ : chunk.getZ();
}
@Override public String getWorld() {
return chunk == null ? world : chunk.getWorld().getName();
}
@Override public Location getMax() {
return new Location(getWorld(), 15 + (getX() << 4), 255, 15 + (getZ() << 4));
}
@Override public Location getMin() {
return new Location(getWorld(), getX() << 4, 0, getZ() << 4);
}
public GenChunk clone() {
GenChunk toReturn = new GenChunk();
if (this.result != null) {
for (int i = 0; i < this.result.length; i++) {
BlockState[] matrix = this.result[i];
if (matrix != null) {
toReturn.result[i] = new BlockState[matrix.length];
System.arraycopy(matrix, 0, toReturn.result[i], 0, matrix.length);
}
}
}
toReturn.chunkData = this.chunkData;
return toReturn;
}
}

View File

@ -1,11 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import java.io.File;
import java.io.FilenameFilter;
public class DatFileFilter implements FilenameFilter {
@Override public boolean accept(File dir, String name) {
return name.endsWith(".dat");
}
}

View File

@ -1,41 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.UUID;
public class DefaultUUIDWrapper extends UUIDWrapper {
@NotNull @Override public UUID getUUID(PlotPlayer player) {
return ((BukkitPlayer) player).player.getUniqueId();
}
@Override public UUID getUUID(OfflinePlotPlayer player) {
return player.getUUID();
}
@Override public OfflinePlotPlayer getOfflinePlayer(UUID uuid) {
return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(uuid));
}
@Override public UUID getUUID(String name) {
return Bukkit.getOfflinePlayer(name).getUniqueId();
}
@Override public OfflinePlotPlayer[] getOfflinePlayers() {
OfflinePlayer[] ops = Bukkit.getOfflinePlayers();
return Arrays.stream(ops).map(BukkitOfflinePlayer::new).toArray(BukkitOfflinePlayer[]::new);
}
@Override public OfflinePlotPlayer getOfflinePlayer(String name) {
return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(name));
}
}

View File

@ -1,250 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation;
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Sets;
import org.bukkit.Bukkit;
import org.bukkit.World;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
public class FileUUIDHandler extends UUIDHandlerImplementation {
public FileUUIDHandler(UUIDWrapper wrapper) {
super(wrapper);
}
@Override public boolean startCaching(Runnable whenDone) {
return super.startCaching(whenDone) && cache(whenDone);
}
public boolean cache(final Runnable whenDone) {
final File container = Bukkit.getWorldContainer();
List<World> worlds = Bukkit.getWorlds();
final String world;
if (worlds.isEmpty()) {
world = "world";
} else {
world = worlds.get(0).getName();
}
TaskManager.runTaskAsync(() -> {
PlotSquared.debug(Captions.PREFIX + "Starting player data caching for: " + world);
File uuidFile = new File(PlotSquared.get().IMP.getDirectory(), "uuids.txt");
if (uuidFile.exists()) {
try {
List<String> lines =
Files.readAllLines(uuidFile.toPath(), StandardCharsets.UTF_8);
for (String line : lines) {
try {
line = line.trim();
if (line.isEmpty()) {
continue;
}
line = line.replaceAll("[\\|][0-9]+[\\|][0-9]+[\\|]", "");
String[] split = line.split("\\|");
String name = split[0];
if (name.isEmpty() || (name.length() > 16) || !StringMan
.isAlphanumericUnd(name)) {
continue;
}
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
if (uuid == null) {
continue;
}
UUIDHandler.add(new StringWrapper(name), uuid);
} catch (Exception e2) {
e2.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<>());
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
PlotSquared.debug("Fast mode UUID caching enabled!");
File playerDataFolder = new File(container, world + File.separator + "playerdata");
String[] dat = playerDataFolder.list(new DatFileFilter());
boolean check = all.isEmpty();
if (dat != null) {
for (String current : dat) {
String s = current.replaceAll(".dat$", "");
try {
UUID uuid = UUID.fromString(s);
if (check || all.remove(uuid)) {
File file = new File(playerDataFolder, current);
NbtFactory.NbtCompound compound = NbtFactory
.fromStream(new FileInputStream(file),
NbtFactory.StreamOptions.GZIP_COMPRESSION);
if (!compound.containsKey("bukkit")) {
PlotSquared.debug("ERROR: Player data (" + uuid.toString()
+ ".dat) does not contain the the key \"bukkit\"");
} else {
NbtFactory.NbtCompound bukkit =
(NbtFactory.NbtCompound) compound.get("bukkit");
String name = (String) bukkit.get("lastKnownName");
long last = (long) bukkit.get("lastPlayed");
long first = (long) bukkit.get("firstPlayed");
if (ExpireManager.IMP != null) {
ExpireManager.IMP.storeDate(uuid, last);
ExpireManager.IMP.storeAccountAge(uuid, last - first);
}
toAdd.put(new StringWrapper(name), uuid);
}
}
} catch (Exception e) {
e.printStackTrace();
PlotSquared.debug(Captions.PREFIX + "Invalid playerdata: " + current);
}
}
}
add(toAdd);
if (all.isEmpty()) {
if (whenDone != null) {
whenDone.run();
}
return;
} else {
PlotSquared.debug(
"Failed to cache: " + all.size() + " uuids - slowly processing all files");
}
}
HashSet<String> worlds1 = Sets.newHashSet(world, "world");
HashSet<UUID> uuids = new HashSet<>();
HashSet<String> names = new HashSet<>();
File playerDataFolder = null;
for (String worldName : worlds1) {
// Getting UUIDs
playerDataFolder = new File(container, worldName + File.separator + "playerdata");
String[] dat = playerDataFolder.list(new DatFileFilter());
if ((dat != null) && (dat.length != 0)) {
for (String current : dat) {
String s = current.replaceAll(".dat$", "");
try {
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (Exception ignored) {
PlotSquared.debug(Captions.PREFIX + "Invalid PlayerData: " + current);
}
}
break;
}
// Getting names
File playersFolder = new File(worldName + File.separator + "players");
dat = playersFolder.list(new DatFileFilter());
if ((dat != null) && (dat.length != 0)) {
for (String current : dat) {
names.add(current.replaceAll(".dat$", ""));
}
break;
}
}
for (UUID uuid : uuids) {
try {
File file =
new File(playerDataFolder + File.separator + uuid.toString() + ".dat");
if (!file.exists()) {
continue;
}
NbtFactory.NbtCompound compound = NbtFactory
.fromStream(new FileInputStream(file),
NbtFactory.StreamOptions.GZIP_COMPRESSION);
if (!compound.containsKey("bukkit")) {
PlotSquared.debug("ERROR: Player data (" + uuid.toString()
+ ".dat) does not contain the the key \"bukkit\"");
} else {
NbtFactory.NbtCompound bukkit =
(NbtFactory.NbtCompound) compound.get("bukkit");
String name = (String) bukkit.get("lastKnownName");
StringWrapper wrap = new StringWrapper(name);
if (!toAdd.containsKey(wrap)) {
long last = (long) bukkit.get("lastPlayed");
long first = (long) bukkit.get("firstPlayed");
if (Settings.UUID.OFFLINE) {
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase()
.equals(name)) {
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
} else {
long most = (long) compound.get("UUIDMost");
long least = (long) compound.get("UUIDLeast");
uuid = new UUID(most, least);
}
}
if (ExpireManager.IMP != null) {
ExpireManager.IMP.storeDate(uuid, last);
ExpireManager.IMP.storeAccountAge(uuid, last - first);
}
toAdd.put(wrap, uuid);
}
}
} catch (Exception ignored) {
PlotSquared.debug(
Captions.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
}
}
for (String name : names) {
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
StringWrapper nameWrap = new StringWrapper(name);
toAdd.put(nameWrap, uuid);
}
if (getUUIDMap().isEmpty()) {
for (OfflinePlotPlayer offlinePlotPlayer : FileUUIDHandler.this.uuidWrapper
.getOfflinePlayers()) {
long last = offlinePlotPlayer.getLastPlayed();
if (last != 0) {
String name = offlinePlotPlayer.getName();
StringWrapper wrap = new StringWrapper(name);
if (!toAdd.containsKey(wrap)) {
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(offlinePlotPlayer);
if (toAdd.containsValue(uuid)) {
StringWrapper duplicate = toAdd.inverse().get(uuid);
PlotSquared.debug(
"The UUID: " + uuid.toString() + " is already mapped to "
+ duplicate
+ "\n It cannot be added to the Map with a key of " + wrap);
}
toAdd.putIfAbsent(wrap, uuid);
if (ExpireManager.IMP != null) {
ExpireManager.IMP.storeDate(uuid, last);
}
}
}
}
}
add(toAdd);
if (whenDone != null) {
whenDone.run();
}
});
return true;
}
@Override public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
TaskManager.runTaskAsync(() -> {
ifFetch.value = FileUUIDHandler.this.uuidWrapper.getUUID(name);
TaskManager.runTask(ifFetch);
});
}
}

View File

@ -1,32 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.google.common.base.Charsets;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
@NotNull @Override public UUID getUUID(PlotPlayer player) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
}
@Override public UUID getUUID(OfflinePlotPlayer player) {
return UUID.nameUUIDFromBytes(
("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
}
@Override public UUID getUUID(OfflinePlayer player) {
return UUID.nameUUIDFromBytes(
("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
}
@Override public UUID getUUID(String name) {
return UUID
.nameUUIDFromBytes(("OfflinePlayer:" + name.toLowerCase()).getBytes(Charsets.UTF_8));
}
}

View File

@ -1,105 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitOfflinePlayer;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collection;
import java.util.UUID;
public class OfflineUUIDWrapper extends UUIDWrapper {
private final Object[] arg = new Object[0];
private Method getOnline = null;
public OfflineUUIDWrapper() {
try {
this.getOnline = Server.class.getMethod("getOnlinePlayers");
} catch (NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}
@NotNull @Override public UUID getUUID(PlotPlayer player) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8));
}
@Override public UUID getUUID(OfflinePlotPlayer player) {
return UUID
.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8));
}
public UUID getUUID(OfflinePlayer player) {
return UUID
.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(Charsets.UTF_8));
}
@Override public OfflinePlotPlayer getOfflinePlayer(UUID uuid) {
BiMap<UUID, StringWrapper> map = UUIDHandler.getUuidMap().inverse();
String name = null;
if (map.containsKey(uuid)) {
name = map.get(uuid).value;
}
if (name != null) {
OfflinePlayer op = Bukkit.getOfflinePlayer(name);
if (op.hasPlayedBefore()) {
return new BukkitOfflinePlayer(op);
}
}
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
if (getUUID(player).equals(uuid)) {
return new BukkitOfflinePlayer(player);
}
}
return null;
}
public Player[] getOnlinePlayers() {
if (this.getOnline == null) {
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
return onlinePlayers.toArray(new Player[0]);
}
try {
Object players = this.getOnline.invoke(Bukkit.getServer(), this.arg);
if (players instanceof Player[]) {
return (Player[]) players;
} else {
@SuppressWarnings("unchecked") Collection<? extends Player> p =
(Collection<? extends Player>) players;
return p.toArray(new Player[0]);
}
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ignored) {
PlotSquared.debug("Failed to resolve online players");
this.getOnline = null;
Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
return onlinePlayers.toArray(new Player[0]);
}
}
@Override public UUID getUUID(String name) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));
}
@Override public OfflinePlotPlayer[] getOfflinePlayers() {
OfflinePlayer[] ops = Bukkit.getOfflinePlayers();
return Arrays.stream(ops).map(BukkitOfflinePlayer::new).toArray(BukkitOfflinePlayer[]::new);
}
@Override public OfflinePlotPlayer getOfflinePlayer(String name) {
return new BukkitOfflinePlayer(Bukkit.getOfflinePlayer(name));
}
}

View File

@ -1,246 +0,0 @@
package com.github.intellectualsites.plotsquared.bukkit.uuid;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
import com.github.intellectualsites.plotsquared.plot.object.StringWrapper;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation;
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
import com.google.common.collect.HashBiMap;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
public class SQLUUIDHandler extends UUIDHandlerImplementation {
final int MAX_REQUESTS = 500;
private final String PROFILE_URL =
"https://sessionserver.mojang.com/session/minecraft/profile/";
private final JSONParser jsonParser = new JSONParser();
private final SQLite sqlite;
public SQLUUIDHandler(UUIDWrapper wrapper) {
super(wrapper);
this.sqlite =
new SQLite(MainUtil.getFile(PlotSquared.get().IMP.getDirectory(), "usercache.db"));
try {
this.sqlite.openConnection();
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
try (PreparedStatement stmt = getConnection().prepareStatement(
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username)"
+ ')')) {
stmt.execute();
} catch (SQLException e) {
e.printStackTrace();
}
startCaching(null);
}
private Connection getConnection() {
synchronized (this.sqlite) {
return this.sqlite.getConnection();
}
}
@Override public boolean startCaching(final Runnable whenDone) {
if (!super.startCaching(whenDone)) {
return false;
}
TaskManager.runTaskAsync(() -> {
try {
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<>());
try (PreparedStatement statement = getConnection()
.prepareStatement("SELECT `uuid`, `username` FROM `usercache`");
ResultSet resultSet = statement.executeQuery()) {
while (resultSet.next()) {
StringWrapper username = new StringWrapper(resultSet.getString("username"));
UUID uuid = UUID.fromString(resultSet.getString("uuid"));
toAdd.put(new StringWrapper(username.value), uuid);
}
}
add(toAdd);
// This should be called as long as there are some unknown plots
final ArrayDeque<UUID> toFetch = new ArrayDeque<>();
for (UUID u : UUIDHandler.getAllUUIDS()) {
if (!uuidExists(u)) {
toFetch.add(u);
}
}
if (toFetch.isEmpty()) {
if (whenDone != null) {
whenDone.run();
}
return;
}
FileUUIDHandler fileHandler = new FileUUIDHandler(SQLUUIDHandler.this.uuidWrapper);
fileHandler.startCaching(() -> {
// If the file based UUID handler didn't cache it, then we can't cache offline mode
// Also, trying to cache based on files again, is useless as that's what the file based uuid cacher does
if (Settings.UUID.OFFLINE) {
if (whenDone != null) {
whenDone.run();
}
return;
}
TaskManager.runTaskAsync(() -> {
while (!toFetch.isEmpty()) {
try {
for (int i = 0; i < Math.min(MAX_REQUESTS, toFetch.size()); i++) {
UUID uuid = toFetch.pop();
HttpURLConnection connection = (HttpURLConnection) new URL(
SQLUUIDHandler.this.PROFILE_URL + uuid.toString()
.replace("-", "")).openConnection();
try (InputStream con = connection.getInputStream()) {
InputStreamReader reader = new InputStreamReader(con);
JSONObject response =
(JSONObject) SQLUUIDHandler.this.jsonParser
.parse(reader);
String name = (String) response.get("name");
if (name != null) {
add(new StringWrapper(name), uuid);
}
}
connection.disconnect();
}
} catch (IOException | ParseException e) {
PlotSquared.debug(
"Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)");
}
try {
//Mojang allows requests every 10 minutes according to https://wiki.vg/Mojang_API
//15 Minutes is chosen here since system timers are not always precise
//and it should provide enough time where Mojang won't block requests.
TimeUnit.MINUTES.sleep(15);
} catch (InterruptedException e) {
e.printStackTrace();
break;
}
}
if (whenDone != null) {
whenDone.run();
}
});
});
} catch (SQLException e) {
throw new SQLUUIDHandlerException("Couldn't select :s", e);
}
});
return true;
}
@Override public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
PlotSquared.debug(Captions.PREFIX + "UUID for '" + name
+ "' was null. We'll cache this from the Mojang servers!");
if (ifFetch == null) {
return;
}
TaskManager.runTaskAsync(() -> {
try {
URL url = new URL(SQLUUIDHandler.this.PROFILE_URL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
String body = JSONArray.toJSONString(Collections.singletonList(name));
OutputStream stream = connection.getOutputStream();
stream.write(body.getBytes());
stream.flush();
stream.close();
JSONArray array = (JSONArray) SQLUUIDHandler.this.jsonParser
.parse(new InputStreamReader(connection.getInputStream()));
JSONObject jsonProfile = (JSONObject) array.get(0);
String id = (String) jsonProfile.get("id");
String name1 = (String) jsonProfile.get("name");
ifFetch.value = UUID.fromString(
id.substring(0, 8) + '-' + id.substring(8, 12) + '-' + id.substring(12, 16)
+ '-' + id.substring(16, 20) + '-' + id.substring(20, 32));
} catch (IOException | ParseException e) {
e.printStackTrace();
}
TaskManager.runTask(ifFetch);
});
}
@Override public void handleShutdown() {
super.handleShutdown();
try {
getConnection().close();
} catch (SQLException e) {
throw new SQLUUIDHandlerException("Couldn't close database connection", e);
}
}
/**
* This is useful for name changes
*/
@Override public void rename(final UUID uuid, final StringWrapper name) {
super.rename(uuid, name);
TaskManager.runTaskAsync(() -> {
try (PreparedStatement statement = getConnection()
.prepareStatement("UPDATE usercache SET `username`=? WHERE `uuid`=?")) {
statement.setString(1, name.value);
statement.setString(2, uuid.toString());
statement.execute();
PlotSquared.debug(
Captions.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
} catch (SQLException e) {
e.printStackTrace();
}
});
}
@Override public boolean add(final StringWrapper name, final UUID uuid) {
// Ignoring duplicates
if (super.add(name, uuid)) {
TaskManager.runTaskAsync(() -> {
try (PreparedStatement statement = getConnection()
.prepareStatement("REPLACE INTO usercache (`uuid`, `username`) VALUES(?, ?)")) {
statement.setString(1, uuid.toString());
statement.setString(2, name.toString());
statement.execute();
PlotSquared
.debug(Captions.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
} catch (SQLException e) {
e.printStackTrace();
}
});
return true;
}
return false;
}
private class SQLUUIDHandlerException extends RuntimeException {
SQLUUIDHandlerException(String s, Throwable c) {
super("SQLUUIDHandler caused an exception: " + s, c);
}
}
}

View File

@ -0,0 +1,86 @@
/*
* PlotSquared, a land and world management plugin for Minecraft.
* Copyright (C) IntellectualSites <https://intellectualsites.com>
* Copyright (C) IntellectualSites team and contributors
*
* This program 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.
*
* This program 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 <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.bukkit;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.command.MainCommand;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.player.PlotPlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.ProxiedCommandSender;
import org.bukkit.command.RemoteConsoleCommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
public class BukkitCommand implements CommandExecutor, TabCompleter {
@Override
public boolean onCommand(
CommandSender commandSender, Command command, String commandLabel,
String[] args
) {
if (commandSender instanceof Player) {
return MainCommand.onCommand(BukkitUtil.adapt((Player) commandSender), args);
}
if (commandSender instanceof ConsoleCommandSender
|| commandSender instanceof ProxiedCommandSender
|| commandSender instanceof RemoteConsoleCommandSender) {
return MainCommand.onCommand(ConsolePlayer.getConsole(), args);
}
return false;
}
@Override
public List<String> onTabComplete(
CommandSender commandSender, Command command, String label,
String[] args
) {
if (!(commandSender instanceof Player)) {
return null;
}
PlotPlayer<?> player = BukkitUtil.adapt((Player) commandSender);
if (args.length == 0) {
return Collections.singletonList("plots");
}
if (!Settings.Enabled_Components.TAB_COMPLETED_ALIASES.contains(label.toLowerCase(Locale.ENGLISH))) {
return List.of();
}
Collection<com.plotsquared.core.command.Command> objects =
MainCommand.getInstance().tab(player, args, label.endsWith(" "));
if (objects == null) {
return null;
}
List<String> result = new ArrayList<>();
for (com.plotsquared.core.command.Command o : objects) {
result.add(o.toString());
}
return result;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
/*
* PlotSquared, a land and world management plugin for Minecraft.
* Copyright (C) IntellectualSites <https://intellectualsites.com>
* Copyright (C) IntellectualSites team and contributors
*
* This program 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.
*
* This program 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 <https://www.gnu.org/licenses/>.
*/
package com.plotsquared.bukkit.entity;
class AgeableStats {
int age;
boolean locked;
boolean adult;
}

Some files were not shown because too many files have changed in this diff Show More