Compare commits

...
1269 Commits
Author SHA1 Message Date
NotAlexNoyle 8a8f65ec82 Exclude CODEOWNERS from language statistics 2026-10-27 08:25:13 -04:00
NotAlexNoyle feb854817f Add CODEOWNERS (one staff approval) 2026-10-27 08:25:13 -04:00
NotAlexNoyle 97a73bf591 Fix jar name 2025-12-13 13:20:22 -05:00
NotAlexNoyle 4e66693b21 Backport 5.3.4 to java 17 2025-12-12 00:04:56 -05:00
NotAlexNoyle f9fc0f1a28 Merge branch 'Multiverse:main' into main 2025-12-12 00:03:29 -05:00
NotAlexNoyle f246094915 Rebase on version 5 2025-12-12 00:01:29 -05:00
Ben Woo 72ee0d5bed Merge pull request #3402 from Multiverse/fix/on-change-node
Always fire onChange for node even if old and new values may be equal
2025-12-12 12:01:31 +08:00
Ben Woo 1afecd40ea Merge pull request #3401 from Multiverse/chore/1.21.11
Update platforms supported version for 1.21.11
2025-12-12 11:57:24 +08:00
Ben Woo 00944ed3b2 Always fire onChange for node even if old and new values may be equal 2025-12-12 11:56:50 +08:00
Ben Woo 5f659a80d8 Update platforms supported version for 1.21.11 2025-12-11 14:24:39 +08:00
Ben Woo 5f9b0af8d1 Merge pull request #3400 from Multiverse/feat/notify-restart
Add restart message for config options that only applies after a server restart
2025-12-10 10:44:34 +08:00
Ben Woo 5c44c05f6f Add restart message for config options that only applies after a server restart 2025-12-09 20:48:04 +08:00
Ben Woo 1699a47011 Merge pull request #3396 from Multiverse/feat/unset-entity-rate
Default spawn rate and limit to "unset" instead of server wide's default
2025-12-09 17:16:27 +08:00
Ben Woo 96deee719b Merge pull request #3397 from Multiverse/fix/config-reset
Remove config saving on plugin disable
2025-12-09 17:15:33 +08:00
Ben Woo 8a60761098 Merge pull request #3398 from Multiverse/fix/arg-handling
Add maxArgForAware flag to gamerule commands for improved argument handling
2025-12-09 17:14:35 +08:00
Ben Woo a38b4e03b4 Merge pull request #3399 from Multiverse/fix/localise-replacements
Properly localise message replacement even if message itself is not localised
2025-12-09 17:14:18 +08:00
Ben Woo db9b725e10 Properly localise message replacement even if message itself is not localised 2025-12-09 16:17:43 +08:00
Ben Woo d43b23e7ea Add maxArgForAware flag to gamerule commands for improved argument handling 2025-12-09 15:59:57 +08:00
Ben Woo 86d77ae796 Remove config saving on plugin disable 2025-12-09 15:50:38 +08:00
Ben Woo 86bf785c84 Improve config saving error checking 2025-12-09 15:50:19 +08:00
Ben Woo 626537290d Default spawn rate and limit to "unset" instead of server wide's default 2025-12-09 14:41:01 +08:00
Ben Woo 9fa47727f4 Merge pull request #3395 from Multiverse/feat/node-load-change
Refactor configuration node on set callbacks to split up load and change events
2025-12-09 12:34:12 +08:00
Ben Woo ae3bc6d201 Rename NodeLoadCallback to NodeValueCallback to extend it potential use case 2025-12-09 11:28:02 +08:00
Ben Woo b1d126397e Refactor configuration node on set callbacks to split up load and change events 2025-12-08 21:18:10 +08:00
Ben Woo 8ab9993e97 Merge pull request #3394 from Multiverse/feat/case-insensitive
Make world name matching case-insensitive to follow papermc behvaiour
2025-12-08 21:03:28 +08:00
Ben Woo 13b949c692 Make world name matching case-insensitive to follow papermc behvaiour 2025-12-08 17:39:10 +08:00
Ben Woo 2b41c1367e Merge pull request #3393 from Multiverse/feat/more-patterns
Add more useful common regex patterns
2025-12-08 17:21:25 +08:00
Ben Woo fde3f388bd Add more useful common regex patterns 2025-12-07 20:56:00 +08:00
Ben Woo eb3968b7d6 Merge pull request #3391 from Multiverse/feat/sort-plugin-list
Sort plugin list alphabetically for dumps
2025-12-04 10:20:19 +08:00
Ben Woo fed1fdcbea Sort plugin list alphabetically for dumps 2025-12-03 10:34:05 +08:00
Ben Woo bfb6fea5f5 Merge pull request #3390 from Multiverse/feat/placeholder-playercount
Add player count placeholder
2025-12-02 23:13:13 +08:00
Ben Woo 5b02452a3d Add player count placeholder 2025-12-02 23:03:30 +08:00
Ben Woo 4a2bfc74fa Merge pull request #3361 from Multiverse/v5.4
V5.4
2025-12-01 17:06:01 +08:00
Ben Woo f0539441cf Merge pull request #3388 from Multiverse/chore/purpur-loader
Add purpur as a supported loader tag on modrinth
2025-12-01 17:04:51 +08:00
Ben Woo efe490d8c4 Add purpur as a supported loader tag on modrinth 2025-12-01 16:55:41 +08:00
Ben Woo 3074cfab17 Fix typo in maxArgForAware for who command 2025-12-01 16:51:16 +08:00
Ben Woo 7a5dd44feb Merge pull request #3383 from Multiverse/refactor/using-option
Refactor world manager methods with better use of streams and option
2025-12-01 16:41:21 +08:00
Ben Woo 88a9ee5b6d Merge pull request #3387 from Multiverse/fix/selectors-error-spam
Fix selectors spamming stacktrace and improve invalid format message
2025-12-01 16:41:02 +08:00
Ben Woo 46f67240e8 Merge pull request #3384 from Multiverse/fix/issuer-aware
Fix ambiguous error message with issue aware args is not found by using maxArgForAware
2025-12-01 16:40:45 +08:00
Ben Woo 89e765b2e8 Fix selectors spamming stacktrace and improve invalid format message 2025-11-29 11:15:04 +08:00
Ben Woo b8bdec22d3 Fix ambiguous error message with issue aware args is not found by using maxArgForAware 2025-11-19 15:32:26 +08:00
Ben Woo 792913cff7 Refactor world manager methods with better use of streams and option 2025-11-19 15:00:39 +08:00
Ben Woo 6dcb40fdcb Merge pull request #3380 from Multiverse/fix/issuer-aware-argument
Better error message for teleport command when no players match selectors
2025-11-19 11:25:46 +08:00
Ben Woo 2bb601098a Merge pull request #3382 from Multiverse/refactor/attempt
Refactor Attempt interface to remove default method implementations and enforce contract
2025-11-18 16:40:22 +08:00
Ben Woo 4bcebd51f5 Merge pull request #3381 from Multiverse/chore/whitespace
Remove unnecessary blank line in CloneWorldOptions.java
2025-11-18 16:40:01 +08:00
Ben Woo e207eb5d0d Merge branch 'main' into v5.4 2025-11-18 16:37:44 +08:00
Ben Woo f181bb7ade Better error message for teleport command when no players match selectors. 2025-11-18 16:34:38 +08:00
Ben Woo 7207d9303f Refactor IssuerAwareContextBuilder and add maxArgForAware option 2025-11-18 16:34:00 +08:00
Ben Woo 82799cdbe8 Open up PlayerFinder::isSelector method 2025-11-18 16:31:12 +08:00
Ben Woo 3629babdbc Remove unnecessary blank line in CloneWorldOptions.java 2025-11-18 15:34:49 +08:00
Ben Woo eed3353e2b Refactor Attempt interface to remove default method implementations and enforce contract 2025-11-18 15:34:28 +08:00
Ben Woo 147564caab Merge pull request #3372 from Multiverse/fix/perm-register
Register permission with its wildcards explicitly
2025-11-13 10:52:04 +08:00
Ben Woo 30e50866bd Merge pull request #3376 from Multiverse/fix/java-17-issue
Fix compatibility with Java 17
2025-11-05 17:29:46 +08:00
Ben Woo 5dde7608f2 Merge pull request #3377 from Multiverse/fix/checkstyle-action
Bump checkstyle action version
2025-11-05 17:29:11 +08:00
Ben Woo 2f9915c62e Bump checkstyle action version 2025-11-05 17:28:36 +08:00
Ben Woo e62e37831b Fix compatibility with Java 17 2025-11-05 10:09:28 +08:00
Ben Woo ef9934f3c6 Merge pull request #3373 from riku6460/fix-set-spawn
Fix spawn location inconsistency
2025-11-04 11:20:19 +08:00
Ben Woo 691bcd0ffa Merge pull request #3375 from BenTechDev/patch-1
✏️ fix typo in UnloadWorldOptions
2025-11-04 11:10:00 +08:00
BenTech 148644970d ✏️ fix typo in UnloadWorldOptions 2025-11-03 18:34:42 +00:00
riku6460 ad20ec94c5 Fix spawn location inconsistency
CraftWorld.setSpawnLocation(Location) requires the world in location.
https://github.com/PaperMC/Paper/blob/e8c6ba5068287049c890688534963041208c4213/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java#L338

See #3321
2025-11-03 03:33:06 +09:00
Ben Woo f7d86884b4 Merge pull request #3369 from Multiverse/feat/simplified-destination
Add simplified destination tab completion configuration option
2025-10-30 11:30:12 +08:00
Ben Woo 0e0e4e0434 Register permission with its wildcards explicitly 2025-10-30 11:29:12 +08:00
Ben Woo 8e878b1ed0 Merge pull request #3370 from Multiverse/fix/passenger-mode
Update default passenger mode description for papermc 1.21.10 changes
2025-10-26 23:21:33 +08:00
Ben Woo e1c6af2f38 Update default passenger mode description for papermc 1.21.10 changes 2025-10-26 13:37:58 +08:00
Ben Woo b52d65757a Fix config test 2025-10-26 13:27:55 +08:00
Ben Woo ff2135c775 Add simplified destination tab completion configuration option 2025-10-26 12:09:06 +08:00
Ben Woo c4e4e311e2 Merge pull request #3368 from Multiverse/perf/suggest-destination
Minor perf improvement to suggestDestinationsWithPerms
2025-10-26 11:59:39 +08:00
Ben Woo 3e4ded52e3 Merge branch 'main' into v5.4 2025-10-26 11:45:23 +08:00
Ben Woo 4ef8390ea3 Minor perf improvement to suggestDestinationsWithPerms 2025-10-26 11:44:57 +08:00
Ben Woo bca71e1acc Merge pull request #3367 from Multiverse/fix/tab-complete-quotes
Quote multi-word strings for all tab-completion
2025-10-24 14:43:14 +08:00
Ben Woo 343da8c301 Quote multi-word strings for all tab-completion 2025-10-24 14:29:07 +08:00
Ben Woo d34f3adccc Merge pull request #3366 from Multiverse/fix/coordinate-scale
Fix spigot compatibility with getCoordinateScale
2025-10-20 11:33:59 +08:00
Ben Woo b3862faf88 Fix spigot compatibility with getCoordinateScale 2025-10-20 10:56:31 +08:00
Ben Woo 8bffffdc65 Merge pull request #3364 from Multiverse/feat/silent-teleport
Add a silent flag to turn off teleport output message
2025-10-16 11:21:03 +08:00
Ben Woo 79a71fa58f Add a silent flag to turn off teleport output message 2025-10-15 22:43:22 +08:00
Ben Woo a41476de89 Merge pull request #3363 from Multiverse/fix/warning-spam
Revert throw an error when trying to set spawn-rate or spawn-limit if…
2025-10-15 22:30:32 +08:00
Ben Woo fe75e497e4 Revert throw an error when trying to set spawn-rate or spawn-limit if disabled by config 2025-10-15 22:26:31 +08:00
Ben Woo fdd9257e2c Merge pull request #3359 from Multiverse/fix/async-online-players
Implement ConcurrentPlayerWorldTracker to allow for async online player names and worlds lookup
2025-10-13 17:41:37 +08:00
Ben Woo 55d1347d4f Merge pull request #3360 from Multiverse/feat/destination-message
Implement display message for destination instances to improve teleport command output
2025-10-13 17:38:45 +08:00
Ben Woo 29cc97486b Add @since 5.4 annotations to ConcurrentPlayerWorldTracker methods 2025-10-13 17:37:41 +08:00
Ben Woo 8d06b92edd Implement display message for destination instances to improve teleport command output 2025-10-12 23:27:12 +08:00
Ben Woo ce3b6ab700 Make getOnlinePlayers unmodifiable and getPlayerWorld return option 2025-10-12 23:00:01 +08:00
Ben Woo 58ac0f505c Make tab completion for players a non-async call 2025-10-12 22:58:50 +08:00
Ben Woo 4004554733 Merge pull request #3358 from Multiverse/chore/mockbukkit-dep
Bump mockbukkit and fix test dep
2025-10-12 22:42:15 +08:00
Ben Woo 99037b2af5 Bump mockbukkit and fix test dep 2025-10-12 22:37:30 +08:00
Ben Woo ac46a5f64a Merge pull request #3355 from Multiverse/chore/config-links
Update wiki and add donation link in `config.yml`
2025-10-09 22:08:47 +08:00
Ben Woo 4d805b921b Merge pull request #3356 from Multiverse/chore/copper-update
Add supported mc versions for 1.21.9 and 1.21.10
2025-10-09 21:55:48 +08:00
Ben Woo a612854490 Add supported mc versions for 1.21.9 and 1.21.10 2025-10-09 21:42:20 +08:00
Ben Woo e85c14e319 Update wiki and add donation link in config.yml 2025-10-09 21:39:25 +08:00
Ben Woo 3983af7b4c Merge pull request #3351 from Multiverse/fix/spawn-location
Fix join location on 1.21.9 due to deprecated PlayerSpawnLocationEvent
2025-10-03 23:07:40 +08:00
Ben Woo 8853f88f3a Fix join location on 1.21.9 due to deprecated PlayerSpawnLocationEvent 2025-10-03 23:01:07 +08:00
Ben Woo 08d361e0ec Merge pull request #3350 from Multiverse/chore/mockbukkit-bump
Bump multiverse-plugin and mockbukkit version
2025-10-01 21:51:18 +08:00
Ben Woo f985f2db06 Bump multiverse-plugin and mockbukkit version 2025-10-01 21:46:38 +08:00
Ben Woo c068225950 Implement ConcurrentPlayerWorldTracker to allow for async online player names and worlds lookup 2025-10-01 21:45:27 +08:00
Ben Woo 82acca3ff9 Merge pull request #3348 from Multiverse/feat/properties-bukkit-world
Use bukkit world properties for difficulty, scale, and keep-spawn when create/import
2025-10-01 21:34:05 +08:00
Ben Woo d712c1eb09 Merge pull request #3347 from Multiverse/fix/deprecated-biome
Refactor biome parsing to use NamespacedKey and Registry
2025-10-01 21:33:28 +08:00
Ben Woo 25e9213ee9 Merge pull request #3349 from Multiverse/fix/apply-spawn-disabled
Throw an error when trying to set spawn-rate or spawn-limit if disabled by config
2025-10-01 21:33:02 +08:00
Ben Woo 9e79708fec Refactor biome parsing to use NamespacedKey and Registry 2025-09-29 22:18:42 +08:00
Ben Woo 65d1141289 Throw an error when trying to set spawn-rate or spawn-limit if disabled by config 2025-09-29 22:01:51 +08:00
Ben Woo 63b2ffdf72 Use bukkit world properties for difficulty, scale, and keep-spawn when create/import 2025-09-29 21:34:00 +08:00
Ben Woo 14d8ad7a5c Merge pull request #3346 from Multiverse/fix/locale-lowercase
Fix issues with lower/uppercasing string when server is of non-english locale
2025-09-29 21:18:29 +08:00
Ben Woo 33e0df925f Merge pull request #3345 from Multiverse/chore/non-public-listener
Cleanup listener methods to be non-public
2025-09-29 21:17:45 +08:00
Ben Woo 1883edbb28 Fix issues with lower/uppercasing string when server is of non-english locale 2025-09-29 20:47:08 +08:00
Ben Woo b7a2bd61ca Cleanup listener methods to be non-public 2025-09-29 20:22:40 +08:00
Ben Woo a0673ac109 Merge pull request #3344 from Multiverse/fix/test-generator
Pass empty string instead of null for generator id and improve error message
2025-09-28 17:50:10 +08:00
Ben Woo 7735a33ccf Change test error message to not show full stacktrace 2025-09-28 17:47:05 +08:00
Ben Woo 5f24520685 Pass empty string instead of null for generator type 2025-09-28 17:46:31 +08:00
Ben Woo 608cb8611c Merge pull request #3343 from Multiverse/fix/custom-env
Remove tab completing "custom" environment type
2025-09-28 10:19:03 +08:00
Ben Woo a965b9ce56 Remove tab completing "custom" environment type 2025-09-28 10:15:08 +08:00
Ben Woo 981d368058 Merge pull request #3338 from Multiverse/feat/relative-positioning
Add back support for relative position with ~ in destination coordinates
2025-09-22 20:10:26 +08:00
Ben Woo 7507099a4e Merge pull request #3341 from Multiverse/api/unloadedworldlocation-final
Make UnloadedWorldLocation non-final to allow extending
2025-09-22 20:08:52 +08:00
Ben Woo 29b58b1655 Make UnloadedWorldLocation non-final to allow extending 2025-09-22 19:57:10 +08:00
Ben Woo a1081c1b6b Merge pull request #3340 from Multiverse/feat/generator-test
Improve generator plugin detection and add an option to disable it
2025-09-22 19:55:36 +08:00
Ben Woo 3152b62668 Merge pull request #3339 from Multiverse/fix/worlds-old-exist
Fix issue when trying to backup `worlds.yml.old` and file already exists
2025-09-22 19:51:57 +08:00
Ben Woo 0082cc9852 Improve generator plugin detection and add an option to disable it 2025-09-22 19:51:18 +08:00
Ben Woo f60b656bed Fix issue when trying to backup worlds.yml.old and file already exists 2025-09-22 19:27:58 +08:00
Ben Woo da5f5de5cd Add localization for position parse error messages 2025-09-20 21:33:16 +08:00
Ben Woo e9aacecc2f Add back support for relative position with ~ in destination coordinates 2025-09-20 20:31:13 +08:00
Ben Woo fa3adbe605 Merge pull request #3332 from Multiverse/fix/delete-fail-message
Fix message when delete failed due to invalid world folder
2025-09-06 13:11:39 +08:00
Ben Woo e33b2f7025 Fix message when delete failed due to invalid world folder 2025-09-06 13:07:03 +08:00
Ben Woo a9cc577754 Merge pull request #3330 from ElFrod0/config-server-properties-path
Configurable server.properties path
2025-08-31 10:34:48 +08:00
Ben Woo 02344a31cf Add api status annotation for new server-properties-path config 2025-08-31 10:30:33 +08:00
ElFrod0 2f4871ef71 Add newline for consistency 2025-08-29 19:40:41 +02:00
ElFrod0 9750fad4b7 Update fresh config for tests 2025-08-29 19:35:21 +02:00
ElFrod0 df77372d96 Configurable server.properties file location 2025-08-29 19:33:49 +02:00
Ben Woo 039af3c219 Merge pull request #3327 from Multiverse/5.3
5.3
2025-08-29 10:34:05 +08:00
Ben Woo 09ec4f87ef Merge pull request #3328 from Multiverse/fix/mvapi-not-started
Pass in config object directly into spawn config class instead of using mvapi
2025-08-27 14:06:11 +08:00
Ben Woo f996f22f4b Pass in config object directly into spawn config class instead of using mvapi 2025-08-27 14:02:37 +08:00
Ben Woo b230c5ae9c Merge pull request #3326 from Multiverse/fix/spawning-config-order
Maintain spawn category config order between config saves
2025-08-27 13:50:30 +08:00
Ben Woo 2561107697 Merge pull request #3325 from Multiverse/feat/disable-apply-spawn
Add option to disable mv handling of spawn rate and limit
2025-08-27 13:48:42 +08:00
Ben Woo 70babc8656 Maintain spawn category config order between config saves 2025-08-27 13:46:59 +08:00
Ben Woo bd09d6c950 Merge pull request #3324 from Multiverse/chore/deps
Fix some dependency issues
2025-08-27 13:35:17 +08:00
Ben Woo b94de763ca Depend on latest paper api version 2025-08-27 12:40:52 +08:00
Ben Woo 22ca57543f Change mockbukkit version to fix test issues 2025-08-27 12:40:25 +08:00
Ben Woo 25c70170d9 Add option to disable mv handling of spawn rate and limit 2025-08-27 12:35:09 +08:00
Ben Woo 9926041c2f Merge pull request #3321 from KioProject123/fix/spawn-location-angle
fix spawn location angle
2025-08-18 15:06:10 +08:00
KioProject 1c99898d0d fix 2025-08-18 13:49:01 +08:00
KioProject 41e0261eee fix spawn location angle 2025-08-18 13:13:25 +08:00
Ben Woo 642f3ab1b8 Merge pull request #3320 from MrXiaoM/patch-1
Fix adventure dep in spigot-based server
2025-08-17 22:57:20 +08:00
人間工作 57d1844756 fix NoClassDefFoundError in spigot-based server 2025-08-17 22:09:17 +08:00
Ben Woo 73e1650fc3 Merge pull request #3318 from Multiverse/fix/match-invalid-regex
Properly handle error from invalid regex string in matcher
2025-08-11 13:08:49 +08:00
Ben Woo 800709ca95 Properly annotate parameters for matcher classes 2025-08-11 12:43:38 +08:00
Ben Woo 935cbad21c Properly handle error from invalid wildcard string in matcher 2025-08-11 12:40:05 +08:00
Ben Woo 0e2a27b298 Merge pull request #3317 from Multiverse/fix/remove-logging
Fix unwanted warning logging for matcher
2025-08-11 12:28:59 +08:00
Ben Woo baaa175423 Properly handle error from invalid regex string in matcher 2025-08-11 12:24:36 +08:00
Ben Woo e2b7a31191 Fix unwanted warning logging for matcher 2025-08-11 12:15:16 +08:00
Ben Woo afa2825bc7 Merge pull request #3315 from Multiverse/feat/load-folder-check
Add folder checking before loading world
2025-07-31 16:32:37 +08:00
Ben Woo 21b4f6b087 Add folder checking before loading world 2025-07-31 15:25:14 +08:00
Ben Woo a771652c8f Merge pull request #3291 from Multiverse/5.2
5.2
2025-07-28 10:11:52 +08:00
Ben Woo e89b4f19ee Merge pull request #3314 from Multiverse/fix/debug-permissions
Fix debug-permission comment spacing
2025-07-27 14:23:34 +08:00
Ben Woo eb8ef32a94 Fix debug-permission comment spacing 2025-07-27 12:38:50 +08:00
Ben Woo f9d783bc5c Merge pull request #3311 from Multiverse/refactor/remove-deprecate
Deprecate other removeWorld methods in favour of using RemoveWorldOpt…
2025-07-27 11:36:20 +08:00
Ben Woo 87dd4168cd Merge pull request #3313 from Multiverse/fix/save-flush
Use newer save method with chunk flushing when possible
2025-07-27 11:35:35 +08:00
Ben Woo 2da6ece606 Merge pull request #3312 from Multiverse/chore/bump-deps
Bump dependencies
2025-07-27 11:35:08 +08:00
Ben Woo cbb3a7a518 Merge pull request #3310 from Multiverse/fix/spawn-command
Fix spawn command using deprecated teleport method
2025-07-27 11:34:32 +08:00
Ben Woo 57796d295b Bump dependencies 2025-07-26 12:26:38 +08:00
Ben Woo 09314e8bce Use newer save method with chunk flushing when possible 2025-07-26 12:08:23 +08:00
Ben Woo 907a6dd5c0 Fix spawn command using deprecated teleport method 2025-07-26 11:50:53 +08:00
Ben Woo a50bd807b6 Deprecate other removeWorld methods in favour of using RemoveWorldOptions 2025-07-26 11:50:02 +08:00
Ben Woo 02081b4654 Merge pull request #3305 from Multiverse/fix/text-format-null
Fix ChatTextFormatter handling null strings
2025-07-26 10:44:56 +08:00
Ben Woo 156ec7911d Merge pull request #3308 from Multiverse/fix/world-name-dot
Fix v4 config migration when world name contains dot
2025-07-26 10:44:10 +08:00
Ben Woo 2b95c62a84 Fix v4 config migration when world name contains dot 2025-07-24 22:56:08 +08:00
Ben Woo 539d5c43d1 Merge pull request #3306 from Multiverse/chore/update-game-version
Update supported game version for 1.21.7 and 1.21.8
2025-07-23 14:19:35 +08:00
Ben Woo 1664690472 Update supported game version for 1.21.7 and 1.21.8 2025-07-23 14:08:42 +08:00
Ben Woo 455396713e Fix ChatTextFormatter handling null strings 2025-07-21 22:44:45 +08:00
Ben Woo 8bc3a593d0 Merge pull request #3303 from Multiverse/feat/remove-options
Add options to remove a world without unloading or saving the bukkit …
2025-07-20 15:05:33 +08:00
Ben Woo 5177f290ae Merge pull request #3304 from Multiverse/refactor/wm-cleanup
Refactor/wm cleanup
2025-07-20 15:05:11 +08:00
Ben Woo 5118864bb8 Use our ChatTextFormatter to remove colour from string 2025-07-20 14:56:18 +08:00
Ben Woo 654da03add Remove unnecessary casting 2025-07-20 14:54:41 +08:00
Ben Woo 61229356ad Mark initAllWorlds as internal api 2025-07-20 14:53:16 +08:00
Ben Woo fa5aa41547 Add options to remove a world without unloading or saving the bukkit world 2025-07-20 14:49:57 +08:00
Ben Woo 04f07657eb Merge pull request #3301 from Multiverse/feat/import-bukkit
Improve support for importing worlds already loaded on the server
2025-07-20 11:44:45 +08:00
Ben Woo eea2af169f Improve support for importing worlds already loaded on the server 2025-07-19 23:33:51 +08:00
Ben Woo 6d393723ff Merge pull request #3299 from Multiverse/feat/skip-folder-check
Add option to skip folder check on import
2025-07-19 23:08:28 +08:00
Ben Woo 9137ef04d2 Merge pull request #3300 from Multiverse/feat/load-env-check
Add an environment check when loading a world that already exist in b…
2025-07-19 23:06:56 +08:00
Ben Woo 878c4bea3d Add option to skip folder check on import 2025-07-19 23:05:17 +08:00
Ben Woo 021d86e21c Add an environment check when loading a world that already exist in bukkit 2025-07-19 22:59:15 +08:00
Ben Woo 3e9425c8f1 Merge pull request #3297 from Multiverse/feat/matcher
Implement StringMatcher api
2025-07-18 15:02:20 +08:00
Ben Woo cc60b9c938 Implement StringMatcher api 2025-07-18 14:46:59 +08:00
Ben Woo d3cc950a97 Merge pull request #3296 from Multiverse/feat/attempt-causeby
Add causeBy chaining for Attempt
2025-07-18 11:09:41 +08:00
Ben Woo 5e97b1169b Merge pull request #3294 from Multiverse/fix/removed-property
Add warning on removed animals and monsters world properties
2025-07-18 11:07:39 +08:00
Ben Woo c3f4f117e5 Merge pull request #3293 from Multiverse/fix/delete-tab-complete
Tab complete to include unloaded worlds for delete command
2025-07-18 11:06:54 +08:00
Ben Woo 814901b1c1 Merge pull request #3292 from Multiverse/fix/spawn-egg
Always allow spawner egg to align with v4 behaviour
2025-07-18 11:06:31 +08:00
Ben Woo 7c6b1d07b0 Add causeBy chaining for Attempt 2025-07-18 11:04:41 +08:00
Ben Woo c389a41cdc Add warning on removed animals and monsters world properties 2025-07-17 12:38:33 +08:00
Ben Woo 2db9ae7c66 Tab complete to include unloaded worlds for delete command 2025-07-17 11:59:24 +08:00
Ben Woo b80aea4c38 Always allow spawner egg to align with v4 behaviour 2025-07-17 11:54:56 +08:00
Ben Woo 35b129701f Merge pull request #3285 from Multiverse/feat/joinlocation-bypass
Add bypass permission for join location
2025-07-15 13:46:45 +08:00
Ben Woo d92fe17c4f Merge branch 'main' into feat/joinlocation-bypass
# Conflicts:
#	src/main/java/org/mvplugins/multiverse/core/listeners/MVPlayerListener.java
2025-07-15 13:40:51 +08:00
Ben Woo 488e258e3f Merge pull request #3290 from Multiverse/fix/gamerule-tab-complete
Fix gamerule tab complete when legacy alias is enabled
2025-07-14 11:26:11 +08:00
Ben Woo d096d1a941 Fix gamerule command flag group name 2025-07-14 11:22:17 +08:00
Ben Woo 3ef4271e63 Fix gamerule tab complete when legacy alias is enabled 2025-07-14 11:18:25 +08:00
Ben Woo 0a33d35b2b Merge pull request #3288 from Multiverse/fix/bukkit-compatility
Fix PlayerSpawnLocationEvent may not be available on bukkit
2025-07-11 11:13:09 +08:00
Ben Woo b4fedea1db Fix PlayerSpawnLocationEvent may not be available on bukkit 2025-07-11 11:06:54 +08:00
Ben Woo 4d92964dda Merge pull request #3287 from Multiverse/fix/worldkey
Fix missing world placeholder in BUKKIT_CREATION_FAILED message
2025-07-09 18:07:57 +08:00
Ben Woo 3443b175ff Fix missing world placeholder in BUKKIT_CREATION_FAILED message 2025-07-09 17:40:11 +08:00
Ben Woo ad3fe9e114 Merge pull request #3284 from Multiverse/fix/teleport-fail-message
Make teleport failure message more descriptive
2025-07-07 11:05:14 +08:00
Ben Woo d1660d7e81 Add bypass permission for join location 2025-07-07 10:41:38 +08:00
Ben Woo 7750b61103 Make teleport failure message more descriptive 2025-07-07 10:19:26 +08:00
Ben Woo eeb1019bbb Merge pull request #3276 from Multiverse/fix/locale-lowercase
Fix message key lowercase issues if java environment is non-english
2025-06-28 17:05:09 +08:00
Ben Woo 6bbaad8bdb Merge pull request #3277 from Multiverse/fix/config-comment
Fix config.yml comment spacing
2025-06-28 17:04:48 +08:00
Missing_Love 1ef4470979 Update multiverse-core_zh.properties (#3274)
* Update multiverse-core_zh.properties

* Update multiverse-core_zh.properties
2025-06-28 17:03:41 +08:00
Ben Woo 3110f462ac Fix config.yml comment spacing 2025-06-28 17:02:10 +08:00
Ben Woo 170e1ac347 Fix message key lowercase issues if java environment is non-english 2025-06-27 18:09:27 +08:00
Ben Woo 86b95034cc Merge pull request #3275 from Multiverse/chore/dbo-1.21.6
Update dbo supported version list with 1.21.6
2025-06-27 12:39:20 +08:00
Ben Woo 8f6d4d5960 Update dbo supported version list with 1.21.6 2025-06-27 12:28:21 +08:00
Ben Woo a34d2f810b Merge pull request #3273 from Multiverse/docs/donate-links
Update donation links to our github sponsor and open collective
2025-06-26 21:09:50 +08:00
Ben Woo db002ab2b1 Update donation links to our github sponsor and open collective 2025-06-26 21:07:33 +08:00
Ben Woo c9c8a1a9c6 Merge pull request #3272 from Tisment/main
Translation of the plugin to Spanish
2025-06-26 20:00:17 +08:00
Tisment cdc22bc533 Created the file multiverse-core_es.properties 2025-06-24 11:40:02 +02:00
Ben Woo 1efe98ab46 Merge pull request #3271 from Multiverse/fix/setspawn-save
Fix setspawn command not saving the updated location to file immediately
2025-06-23 20:29:20 +08:00
Ben Woo 989242810d Fix setspawn command not saving the updated location to file immediately 2025-06-23 19:08:36 +08:00
Ben Woo 29d3c0c8c1 Merge pull request #3244 from Multiverse/5.1
5.1
2025-06-23 12:02:22 +08:00
Ben Woo 97cc7e53f0 Merge pull request #3266 from Multiverse/chore/1.21.6
Add 1.21.6 as supported version for Modrinth and Hangar
2025-06-23 11:08:10 +08:00
Ben Woo 4c4544340a Merge pull request #3270 from Multiverse/fix/dot-world-name
Fix world not loading when the world name has `.` in it
2025-06-22 17:06:54 +08:00
Ben Woo 755fab05ba Add tests for world name with dot 2025-06-22 17:02:50 +08:00
Ben Woo 5f295fd57b Fix world not loading when the world name has . in it 2025-06-22 16:49:14 +08:00
Ben Woo 86b888a68e Add 1.21.6 as supported version for modrinth and hanger 2025-06-20 22:10:42 +08:00
Ben Woo 4fd8350a96 Merge pull request #3265 from Multiverse/feat/destination-sender
Add support for destination parse with sender context
2025-06-20 15:06:30 +08:00
Ben Woo 5702426ddd Fix config test due to destination parsing 2025-06-20 15:01:01 +08:00
Ben Woo 9c562d09ea Add support for destination parse with sender context 2025-06-20 14:20:50 +08:00
Ben Woo 59d1c44c23 Merge pull request #3264 from Multiverse/feat/sender-string-parse
Add support config string parsing with sender context
2025-06-20 14:03:06 +08:00
Ben Woo 1082f73be7 Add support config string parsing with sender context 2025-06-20 12:13:14 +08:00
Ben Woo 1372626b50 Merge pull request #3263 from Multiverse/feat/config-alias-name
Add support for alias name in config node
2025-06-20 12:01:24 +08:00
Ben Woo c09dacb8ec Add support for alias name in config node 2025-06-20 11:11:07 +08:00
Ben Woo 518d64882c Merge pull request #3262 from Multiverse/feat/api-qol
Add qol methods whenLoaded and isLoaded to MultiverseCoreApi
2025-06-16 19:44:30 +08:00
Ben Woo 4f08b9a446 Add qol methods whenLoaded and isLoaded to MultiverseCoreApi 2025-06-16 11:02:19 +08:00
Ben Woo a3b7dd542d Mark CoreConfig#getConfig() as internal use only 2025-06-16 11:01:33 +08:00
Ben Woo c68936f06d Merge pull request #3261 from Multiverse/refactor/destination-suggestion
Streamline destination suggestions with helper methods to directly parse to string
2025-06-15 22:02:19 +08:00
Ben Woo b91214f958 Streamline destination suggestions with helper methods to directly parse to string 2025-06-15 21:55:01 +08:00
Ben Woo ff26ffd9c5 Merge pull request #3258 from Multiverse/feat/sender-context
Implement sender context for config node suggestions
2025-06-15 21:21:31 +08:00
Ben Woo 058a7c97cb Implement SenderNodeSuggester to builders 2025-06-15 21:19:30 +08:00
Ben Woo a50965509d Implement sender context for config node suggestions 2025-06-10 22:48:20 +08:00
Ben Woo 3356724481 Merge pull request #3256 from Multiverse/fix/generator-tab-complete
Improve generator provider tab-complete logic
2025-06-10 11:30:59 +08:00
Ben Woo 8dcdf68b9f Merge pull request #3257 from Whitebrim/patch-1
lang: fix deposit/withdraw (en)
2025-06-10 11:30:45 +08:00
Ben Woo ae0f25a0f8 Merge pull request #3255 from Whitebrim/main
Translation to Russian
2025-06-10 11:30:30 +08:00
Whitebrim 148f513bc2 lang: fix deposit/withdraw (en) 2025-06-10 03:38:57 +03:00
Whitebrim 29f60bcde5 lang: fix deposit/withdraw 2025-06-10 03:36:45 +03:00
Ben Woo e9ddb24706 Improve generator provider tab-complete logic 2025-06-09 23:16:43 +08:00
Whitebrim 71e815a9bd Create multiverse-core_ru.properties
Translated to Russian
2025-06-07 21:17:47 +03:00
Ben Woo a55ce680df Merge pull request #3254 from Multiverse/fix/world-chart
Fix bstats world chart
2025-06-07 13:42:40 +08:00
Ben Woo 3e47460c3b Fix bstats world chart 2025-06-07 13:36:57 +08:00
Ben Woo abd6983eee Merge pull request #3253 from Multiverse/fix/donate-colour
Add green colour to donate and enable message
2025-06-07 00:16:12 +08:00
Ben Woo ce263b5b1f Merge pull request #3252 from Multiverse/feat/improve-context
Feat/improve context
2025-06-07 00:15:53 +08:00
Ben Woo 7f15a28a69 Add green colour to donate and enable message 2025-06-07 00:00:03 +08:00
Ben Woo 4ddcb3f0bf Fix teleport command tab complete for in-game with player arg 2025-06-06 23:48:24 +08:00
Ben Woo d76a6a6ca6 Refactor issuer aware context handling to extract our similar logic 2025-06-06 23:08:20 +08:00
Ben Woo e9a20254b0 Merge pull request #3249 from Multiverse/feat/passengers
Add support for passenger and vehicle teleports
2025-06-06 20:32:24 +08:00
Ben Woo 42a8d33824 Fix some javadocs of the new attempt methods 2025-06-06 20:19:19 +08:00
Ben Woo d89f00a607 Merge pull request #3250 from Multiverse/chore/annotations
Add ApiStatus annotations to new and deprecated api
2025-06-06 20:12:43 +08:00
Ben Woo 41c8c17bc9 Fix config test 2025-06-06 20:07:57 +08:00
Ben Woo a3a621945a Add ApiStatus annotations to new and deprecated api 2025-06-06 20:06:20 +08:00
Ben Woo 71eedd392d Add support for passenger and vehicle teleports 2025-06-06 20:01:30 +08:00
Ben Woo ccfcae9dd0 Merge pull request #3247 from Multiverse/fix/vanila-selector
Hotfix for vanilla selector params getting cut off by comma separation
2025-06-03 22:09:53 +08:00
Ben Woo f50849422b Merge pull request #3248 from Multiverse/chore/issue-template-update
Update issue template new dumps command, and fix typos
2025-06-02 22:43:47 +08:00
Ben Woo 8786a09b8f Update issue template new dumps command, and fix typos 2025-06-02 22:25:55 +08:00
Ben Woo 07b750f11c Hotfix for vanilla selector params getting cut off by comma separation 2025-06-02 21:45:29 +08:00
Ben Woo ba78b7da3a Merge pull request #3245 from Multiverse/feat/chat-color
Use kyori adventure whenever possible to support rgb formatting
2025-06-02 13:07:38 +08:00
Ben Woo 38231ef0d4 Use kyori adventure whenever possible to support rgb formatting 2025-06-02 13:01:03 +08:00
Ben Woo 232d18f8da Merge pull request #3237 from Multiverse/feat/setspawn-safety
Add location safety check for setspawn command
2025-06-02 11:07:17 +08:00
Ben Woo 530a8a9c2c Merge pull request #3243 from Multiverse/feat/time-placeholder
Implement time formatting for world time placeholder
2025-06-02 11:07:06 +08:00
Ben Woo 38bbe8103c Merge pull request #3241 from Multiverse/fix/entry-fee-message
Fix vault economy not showing payment message
2025-06-02 10:55:13 +08:00
Ben Woo d2af009d9f Fix entry check messages 2025-06-02 10:51:43 +08:00
Ben Woo 8a96c7b610 Don't show seconds for default 12h and 24h format 2025-06-02 10:47:22 +08:00
Ben Woo bb2da157da Fix minecraft time calculation 2025-06-02 10:47:03 +08:00
Ben Woo 1c521e0f79 Implement time formatting for world time placeholder 2025-06-01 23:39:04 +08:00
Ben Woo aab13c1ec6 Add support for multiple params in placeholder 2025-06-01 23:38:12 +08:00
Ben Woo fd72d6a9b8 Add locale keys for economy recipt messages 2025-06-01 20:40:15 +08:00
Ben Woo d73e90e46e Fix negative deposit issue 2025-06-01 20:39:48 +08:00
Ben Woo 913f131b3b Cleanup double to int conversion for item economy 2025-06-01 20:32:11 +08:00
Ben Woo 795aeab7a3 Fix vault economy not showing payment message 2025-06-01 16:22:36 +08:00
Ben Woo 2ee01adb6b Fix negative entry fee display in /mv info command 2025-06-01 15:37:15 +08:00
Ben Woo b4e246ffb3 Merge pull request #3240 from Multiverse/fix/chat-prefix-colour
Fix chat prefix colour codes not applying
2025-06-01 10:09:21 +08:00
Ben Woo 64995a0bfd Fix chat prefix colour codes not applying 2025-06-01 09:58:37 +08:00
Ben Woo 3173b5fc18 Merge pull request #3236 from Multiverse/fix/locale-key
Fix content display wrong locale key
2025-05-31 16:22:48 +08:00
Ben Woo ae4d33d7b1 Fix PlayerLocation context logic 2025-05-31 16:20:51 +08:00
Ben Woo d5b2cc884b Support localization for setspawn command output 2025-05-31 16:20:34 +08:00
Ben Woo 50f6152a71 Fix sendError message type 2025-05-31 15:48:57 +08:00
Ben Woo c84ae0493c Add location safety check for setspawn command 2025-05-31 15:48:47 +08:00
Ben Woo e1dadc045f Fix content display wrong locale key 2025-05-31 13:53:46 +08:00
Ben Woo 15812081e0 Merge pull request #3230 from xiaohuang2004/patch-1
Update multiverse-core_zh.properties
2025-05-31 09:58:02 +08:00
Ben Woo 5365ebd939 Fix Localization test 2025-05-31 09:56:14 +08:00
Ben Woo e06770a55f Fix zh property file location 2025-05-31 09:56:04 +08:00
Ben Woo a931c63ba9 Merge pull request #3233 from Multiverse/fix/worldborder-permissions
Add permission for world border
2025-05-16 16:55:01 +08:00
Ben Woo 47fae91a29 Add permission for world border 2025-05-16 16:50:06 +08:00
Ben Woo df010c4978 Merge pull request #3231 from Multiverse/feat/generator
Implement generator info command
2025-05-14 14:50:55 +08:00
Ben Woo 8060e12d57 Merge pull request #3232 from Multiverse/fix/config-comments
Fix some config comment typos
2025-05-14 14:50:14 +08:00
Ben Woo dd8a74c19e Fix some config comment typos 2025-05-14 14:47:46 +08:00
Huang Jinjie f0992dae25 Update multiverse-core_zh.properties
I read Multiverse Core Changelog and found it support message outputs with localisation support. However, my client still display English which has been set to Chinese. I searched the code and don't found a Chinese simplified translation file. So I translate it base on the multiverse-core_en.property. I don't know exactly how to operate it, so I commit the file directly and hope the plugin can support Chinese in next version. If it can be accepted, I will continue to translate other add-one Multiverse plugins. Thanks!
2025-05-14 14:02:17 +08:00
Ben Woo 2935d13cd0 Implement generator info command 2025-05-09 22:56:53 +08:00
Ben Woo d484c539a9 Merge pull request #3228 from Multiverse/feat/config-command
Improve comments for first-spawn and join-destination
2025-05-09 19:07:32 +08:00
Ben Woo 3c511417a5 Improve comments for first-spawn and join-destination 2025-05-09 19:04:32 +08:00
Ben Woo ad6c44bec3 Merge pull request #3227 from Multiverse/fix/event-executor
Fix event executor on spigot
2025-05-09 18:28:25 +08:00
Ben Woo dd155507e6 More isolated error handling for each event method registration 2025-05-09 18:20:38 +08:00
Ben Woo 866a7415b6 Fix event executor on spigot 2025-05-08 22:48:43 +08:00
Ben Woo 230ffd59d4 Merge pull request #3226 from Multiverse/fix/import-issue-on-spigot
Fix adventure text import issues on spigot
2025-05-07 08:25:56 +08:00
Ben Woo ca4e3e11d2 Fix adventure text import issues on spigot 2025-05-07 08:22:35 +08:00
Ben Woo 395c3098c4 Merge pull request #3225 from Multiverse/fix/skip-wrong-class
Fix wrong skip class for AsyncPlayerChatEvent
2025-05-06 15:12:02 +08:00
Ben Woo b0219fbb5b Fix wrong skip class for AsyncPlayerChatEvent 2025-05-06 15:04:33 +08:00
Ben Woo dbeba59561 Merge pull request #3224 from Multiverse/feat/world-border-command
Implement `/mv worldborder` commands
2025-05-06 14:58:32 +08:00
Ben Woo 4104a2db59 Merge pull request #3223 from Multiverse/feat/allow-advancement
Implement world property to disable advancement grant
2025-05-06 14:56:47 +08:00
Ben Woo 1f97a8960a Implement /mv worldborder commands 2025-05-06 14:56:05 +08:00
Ben Woo 8597dd63ca Fix world config in tests due to new allow-advancement-grant property 2025-05-06 11:01:38 +08:00
Ben Woo 3fcfb4d11e Merge pull request #3222 from Multiverse/feat/async-chat-event
Implement paper's AsyncChatEvent for world prefix chat
2025-05-06 10:48:50 +08:00
Ben Woo 72e3ba99c6 Implement world property to disable advancement grant 2025-05-06 10:48:22 +08:00
Ben Woo 27417c53d7 Implement paper's AsyncChatEvent for world prefix chat 2025-05-05 23:08:44 +08:00
Ben Woo db97b6e678 Merge pull request #3221 from Multiverse/feat/dynamic-listener
Implement dynamic listener api
2025-05-05 22:09:48 +08:00
Ben Woo ac050bfb37 Add comments for event-priority config options 2025-05-05 22:07:32 +08:00
Ben Woo 5e75b1cd17 Implement dynamic listener api 2025-05-05 21:57:04 +08:00
Ben Woo 565ed9f1fc Merge pull request #3220 from Multiverse/feat/auto-import
Add option to disable auto import of worlds on init/reload
2025-05-05 00:14:57 +08:00
Ben Woo 41ab66b704 Add option to disable auto import of worlds on init/reload 2025-05-04 22:52:31 +08:00
Ben Woo a9d81bd5a2 Merge pull request #3219 from Multiverse/feat/config-cmd-locale
Implement localisation for config command output
2025-05-04 17:27:08 +08:00
Ben Woo 98095927a9 Implement localisation for config command output 2025-05-04 15:40:36 +08:00
Ben Woo 2e1e8685e9 Tweaks to string message for DimensionFormat 2025-05-04 15:40:12 +08:00
Ben Woo 087fdbbb2c Fix MessageReplacement instanceof parsing at the wrong place 2025-05-04 15:39:32 +08:00
Ben Woo 42cd9ec18d Merge pull request #3217 from Multiverse/fix/unregister
Fix incorrect way of unregistering MultiverseCoreApi from service manager
2025-05-03 20:21:09 +08:00
Ben Woo f63861b1d4 Fix incorrect way of unregistering MultiverseCoreApi from service manager 2025-05-03 20:13:31 +08:00
Ben Woo 3233ae556c Merge pull request #3215 from Multiverse/feat/world-name-format
Implement automatic link of respawn world from nether/end to overworld
2025-05-03 20:03:12 +08:00
Ben Woo d1e1ea56d1 Merge pull request #3216 from Multiverse/fix/displaypermerrors-mgrate
Fix displaypermerrors config migration
2025-05-03 20:02:38 +08:00
Ben Woo 7eede2daeb Fix displaypermerrors config migration 2025-05-03 19:21:18 +08:00
Ben Woo 468399ad84 Add javadoc for DimensionFinder 2025-05-03 19:14:12 +08:00
Ben Woo 200e8cbc30 Improve respawn related config comments 2025-05-03 19:13:54 +08:00
Ben Woo 69ab331a6f Merge pull request #3213 from Multiverse/feat/keep-files
Add option to keep files during world regen
2025-05-03 18:55:00 +08:00
Ben Woo dcb8a354cf Merge pull request #3214 from Multiverse/chore/clone-command-test
Fix clone command test due to World#save being unimplemented
2025-05-03 17:05:07 +08:00
Ben Woo e625e4750f Fix comments in DeleteWorldOptions#keepFiles 2025-05-03 17:04:32 +08:00
Ben Woo dbcbcad6d1 Fix clone command test due to World#save being unimplemented 2025-05-03 17:02:47 +08:00
Ben Woo 84916fe25b Fix saveBukkitWorld parameter name 2025-05-03 17:02:27 +08:00
Ben Woo 535da5e39b Implement automatic link of respawn world from nether/end to overworld 2025-05-03 16:59:57 +08:00
Ben Woo cd2869863f Fix delete world test due to api changes 2025-05-03 14:29:57 +08:00
Ben Woo b9766f87c9 Merge pull request #3212 from Multiverse/fix/clone-default-save
Default save bukkit world before clone to true
2025-05-03 14:23:11 +08:00
Ben Woo 32829531d3 Add option to keep files during world regen 2025-05-03 14:22:50 +08:00
Ben Woo aa82743c25 Default save bukkit world before clone to true 2025-05-03 11:44:04 +08:00
Ben Woo 47e9076c9e Merge pull request #3211 from Multiverse/feat/unload-bukkit
Add `--no-unload-bukkit-world` flag to unload command
2025-05-02 22:15:56 +08:00
Ben Woo 841ad8f55d Merge pull request #3210 from Multiverse/feat/clone-save
Add an option to force save world to disk before cloning world
2025-05-02 22:15:33 +08:00
Ben Woo 407e778841 Add --no-unload-bukkit-world flag to unload command 2025-05-02 22:13:48 +08:00
Ben Woo 5b85e2f119 Add an option to force save world to disk before cloning world 2025-05-02 21:58:28 +08:00
Ben Woo 49bdb568cc Merge pull request #3209 from Multiverse/feat/bukkit-yml
Implement bukkit-yml-path config option
2025-05-02 21:28:00 +08:00
Ben Woo a4e7282a0b Implement bukkit-yml-path config option 2025-05-02 21:24:46 +08:00
Ben Woo 1cfd9e6905 Load all config nodes before calling onSetValue 2025-05-02 21:24:27 +08:00
Ben Woo 064e4a0ed8 Merge pull request #3207 from Multiverse/fix/purge-entities
Actually implement the auto-purge-entities config option
2025-05-02 19:59:30 +08:00
Ben Woo 65d199c65a Merge pull request #3208 from Multiverse/fix/gha-no-release
GHA do not build of upload if there is no release
2025-05-02 19:56:21 +08:00
Ben Woo cb61c81836 GHA do not build of upload if there is no release 2025-05-02 19:53:56 +08:00
Ben Woo 25e1751283 Merge pull request #3206 from Multiverse/fix/api-service
Refactor and properly unregister MultiverseCoreApi from service manager
2025-05-02 19:47:21 +08:00
Ben Woo e417e0479c Actually implement the auto-purge-entities config option 2025-05-02 19:43:54 +08:00
Ben Woo fe4cada82d Refactor and properly unregister MultiverseCoreApi from service manager 2025-05-02 17:29:25 +08:00
Ben Woo c92d04376c Merge pull request #3205 from Multiverse/feat/gha
Github release action improvements
2025-05-02 16:54:43 +08:00
Ben Woo a24a3a54f4 Add a dispatch create release action 2025-05-02 16:53:41 +08:00
Ben Woo 8b4e339665 Fix dispatch javadoc java version 2025-05-02 16:31:01 +08:00
Ben Woo 6c96f506c8 Upload javadoc for pre-release as well 2025-05-02 16:28:00 +08:00
Ben Woo 28475e442d Use tag name instead of publish name for release builds 2025-05-02 16:27:10 +08:00
Ben Woo 59e6fdbfa5 Merge pull request #3204 from Multiverse/chore/trigger
Trigger MV5 release build
2025-05-01 17:20:58 +08:00
Ben Woo 2848889395 Trigger MV5 release build 2025-05-01 17:12:40 +08:00
Ben Woo 3df1e5a547 Merge pull request #3203 from Multiverse/feat/gamemode-flight-enforcement
Feat/gamemode flight enforcement
2025-04-30 23:24:48 +08:00
Ben Woo 0739ac3a70 Merge pull request #3201 from Multiverse/fix/double-load-unload
Fix logic error where bukkit load and unload is called twice
2025-04-30 23:24:31 +08:00
Ben Woo c4a692ad70 Add config option for flight enforcement 2025-04-30 21:09:36 +08:00
Ben Woo 1535238770 Fix gamemode enforcement config not applying 2025-04-30 21:07:05 +08:00
Ben Woo efd8b4b34e Merge pull request #3200 from Multiverse/fix/who-invalid-world
Fix who command null exception when invalid world is specified
2025-04-30 19:54:08 +08:00
Ben Woo 88125ecf9c Merge pull request #3202 from Multiverse/fix/severe-logging
Remove unnecessary severe logging in create command
2025-04-30 19:52:25 +08:00
Ben Woo 675e590ccf Remove unnecessary severe logging in create command 2025-04-30 19:24:34 +08:00
Ben Woo afd89dbb51 Fix logic error where bukkit load and unload is called twice 2025-04-30 19:20:51 +08:00
Ben Woo c961c9ff57 Fix who command null exception when invalid world is specified 2025-04-30 17:53:16 +08:00
Ben Woo 2d02658730 Merge pull request #3196 from Multiverse/benwoo1110-patch-1
Release MV5
2025-04-29 10:43:07 +08:00
Ben Woo dfd4b88031 Update README.md 2025-04-29 09:51:59 +08:00
Ben Woo 52e0b1288a Merge pull request #3195 from Multiverse/fix/publish
Remove onarandombox publish repo as its already in our gradle plugin
2025-04-29 09:40:08 +08:00
Ben Woo d1dd8d7493 Remove onarandombox publish repo as its already in our gradle plugin 2025-04-29 09:37:28 +08:00
Ben Woo ca73265f88 Merge pull request #2824 from Multiverse/MV5
MV5
2025-04-29 09:29:59 +08:00
Ben Woo 5bdec28099 Prep for release 2025-04-29 08:56:31 +08:00
Ben Woo bd0a3dd3fb Update to an even cooler banner 2025-04-28 23:11:56 +08:00
Ben Woo 7a9994004c Add wiki website link 2025-04-28 22:46:38 +08:00
Ben Woo 45b9dd3622 Introduce a cool new banner 2025-04-28 22:45:17 +08:00
Ben Woo 269bbf8783 Improve mv modify messages 2025-04-28 20:32:55 +08:00
Ben Woo fa5bbec9e3 Improve passing of location object and error handling 2025-04-25 17:08:12 +08:00
Ben Woo ee3a1f3a79 Rename NullLocation to NullSpawnLocation 2025-04-25 16:10:16 +08:00
Ben Woo b9e29fddea Fix entity spawn config modify value optional 2025-04-20 16:59:34 +08:00
Ben Woo c9a0dd368d Implement materials tab complete 2025-04-19 15:19:26 +08:00
Ben Woo 2db3589f05 Add shutdownDependencyInjection to MultiverseModule 2025-04-13 13:52:49 +08:00
Ben Woo 702ef3c569 Abstract out MultiverseModuleBinder 2025-04-13 12:49:51 +08:00
Ben Woo 0f21b61529 Better organise test resource files into folders 2025-04-13 12:44:22 +08:00
Ben Woo a568ab66dd Better organise test resource files into folders 2025-04-13 12:06:40 +08:00
Ben Woo 15dfc164e6 Remove ACF overrides as it has been fixed upstream 2025-04-13 12:00:31 +08:00
Ben Woo bbb5ecba1d Add spawn limit setting 2025-04-13 11:54:40 +08:00
Ben Woo 63b5393dea Refactor worldRef for spawn config 2025-04-13 11:44:26 +08:00
Ben Woo 1b8abc2ddd Rename mobsSpawnConfig to entitySpawnConfig 2025-04-13 11:39:29 +08:00
Ben Woo 8ee4e00181 Add support for controlling non-living entity spawn 2025-04-13 11:33:03 +08:00
Ben Woo 757057de39 Fix permissions of newly added commands 2025-04-11 23:51:49 +08:00
Ben Woo 5ce2eedbfd Fix import command syntax 2025-04-11 23:51:22 +08:00
Ben Woo fca6951d36 Fix clone command syntax 2025-04-10 22:51:53 +08:00
Ben Woo dc83349537 Add default failure logging for config load methods 2025-04-10 22:51:46 +08:00
Ben Woo c159b16860 Don't set ticks per spawn for SpawnCategory MISC 2025-04-10 22:50:57 +08:00
Ben Woo 4fba35b68f Automatically set default value of ListConfigNode to an ArrayList 2025-04-10 22:50:08 +08:00
Ben Woo 4ca8cfcaa1 Parse quotes for tab complete as well 2025-04-09 13:38:36 +08:00
Ben Woo 58de984524 Fix edge cases with parseQuotesInArgs and add tests 2025-04-09 13:08:02 +08:00
Ben Woo b615213907 Fix entity spawn config syntax 2025-04-09 10:53:59 +08:00
Ben Woo 807f7c1b66 Merge branch 'main' into MV5
# Conflicts:
#	build.gradle
2025-04-09 10:53:12 +08:00
Ben Woo 77994b991f Fix info command flag tab complete when in console 2025-04-09 10:16:24 +08:00
Ben Woo 677dd475f7 Improve entity spawn config info command output 2025-04-09 10:15:40 +08:00
Ben Woo 0e6a63d60e Fix InjectionTest commands number 2025-04-09 09:39:07 +08:00
Ben Woo 4fc4d7613a PlayerFinder use REPatterns for uuid and comma 2025-04-09 09:38:14 +08:00
Ben Woo 3cf1a9f33b Check null input for addonToCommaSeperated 2025-04-09 09:35:16 +08:00
Ben Woo c1b60c148e Use reflection to get spawn category of entity types 2025-04-09 09:03:23 +08:00
Ben Woo 9a3b28f5f5 Refactor list suggester to use addonToCommaSeperated util method 2025-04-09 09:02:46 +08:00
Ben Woo 6aebd2904f Do not need to set generator if generator string is empty 2025-04-08 23:46:36 +08:00
Ben Woo d0671a25d6 Merge pull request #3192 from Multiverse/ben/mv5/revamp-mobs-spawn
Ben/mv5/revamp mobs spawn
2025-04-08 23:41:47 +08:00
Ben Woo 8e17d2a6bd Add todo on spawn reasoning filter 2025-04-08 23:41:08 +08:00
Ben Woo af7a71753f Fix minor purge entity syntax issues 2025-04-08 23:38:07 +08:00
Ben Woo c0dd1518e1 Add purge entities commands 2025-04-08 23:30:43 +08:00
Ben Woo 3b5a1c1988 Implement MobsSpawnConfigCommand fully 2025-04-08 22:44:09 +08:00
Ben Woo 774c2b2327 Merge pull request #3191 from Multiverse/chore/gha-game-version
Update gha supported game version to 1.21.5
2025-04-08 21:44:25 +08:00
Ben Woo 71b1662b55 Update gha supported game version to 1.21.5 2025-04-08 21:40:29 +08:00
Ben Woo 9317f4cd6b Merge pull request #3190 from Multiverse/fix/javadoc-action
Fix gha javadoc cp path
2025-04-08 21:10:40 +08:00
Ben Woo 00b4a9bab4 Fix gha javadoc cp path 2025-04-08 21:05:38 +08:00
Ben Woo 48a091842a Merge pull request #3188 from Multiverse/ben/fix-gha-publish 2025-04-08 20:48:13 +08:00
Ben Woo 7e9ca7cc79 Refactor spawning to use MobsSpawnConfig with SpawnCategory support 2025-04-08 17:19:32 +08:00
Ben Woo d333cf55d1 Use isBooleanProp on MultiverseWorld getters 2025-04-08 14:23:12 +08:00
Ben Woo cb45ae1590 Reduce wait time for async teleport test 2025-04-08 14:19:27 +08:00
Ben Woo 3c85f1324d Add support for command args with spaces by using quotes 2025-04-08 14:16:27 +08:00
Ben Woo ee3f26b2f3 Refactor destination parsing to have error reasoning 2025-04-08 13:45:18 +08:00
Ben Woo 67f5e47dc9 Add a script to automatically convert locale properties to enum value 2025-04-08 13:30:39 +08:00
Ben Woo 8b530854f6 Use UnloadedWorldLocation for all destinations and fix some edge cases 2025-04-08 10:59:03 +08:00
Ben Woo 91e503e904 Refactor all commands to use FlagBuilder and fix legacy alias bugs 2025-04-07 23:26:37 +08:00
Ben Woo cf287ab9bf Implement new way of having flags with FlagBuilder class 2025-04-06 19:53:47 +08:00
Ben Woo ad51e92d90 Fix config tests 2025-04-06 19:48:41 +08:00
Ben Woo 40f80e8040 Make showLegacyAliases false by default 2025-04-06 19:48:32 +08:00
Ben Woo 5efbeaba92 Implement option to disable legacy aliases 2025-04-06 18:08:03 +08:00
Ben Woo e5eb9a7eba Refactor migrator action to its own package 2025-04-06 14:44:20 +08:00
Ben Woo 0ea7375fe9 Merge pull request #3189 from Multiverse/ben/mv5/mvanchor
Refactor anchors with MultiverseAnchor class and better location handling
2025-04-06 10:18:09 +08:00
Ben Woo 7db9e99fd7 Refactor anchors with MultiverseAnchor class and better location handling 2025-04-06 00:09:20 +08:00
Ben Woo da3248894e Use UnloadedWorldLocation for LocationManipulation 2025-04-06 00:06:23 +08:00
Ben Woo 8934133874 Implement equals, hashcode and string for UnloadedWorldLocation 2025-04-06 00:06:02 +08:00
Ben Woo 0ec184ce4d Improve error handling for location with unloaded worlds 2025-04-05 16:27:16 +08:00
Ben Woo 57ff66ab27 Improve localization for exceptions 2025-04-05 13:19:26 +08:00
Ben Woo 8bfa604584 Improve biome provider and generator error handling 2025-04-05 12:05:10 +08:00
Ben Woo c541c27485 Fix gha gradle publish command 2025-04-02 20:35:49 +08:00
Ben Woo fd02e00da6 Merge pull request #3187 from Multiverse/ben/publish-repo 2025-04-02 16:44:55 +08:00
Ben Woo 729ee19585 Remove need for QueuedCommandAction functional interface 2025-03-29 22:35:08 +08:00
Ben Woo e14853dc11 Use onarandombox repo for publishing 2025-03-29 17:46:15 +08:00
Ben Woo c439412a3c Common class to compile reusable regex pattern 2025-03-29 17:11:24 +08:00
Ben Woo 035728e37f Merge pull request #3185 from Multiverse/ben/mv5/protocol-version
Refactor protocol version to derive from plugin's version string
2025-03-29 16:45:57 +08:00
Ben Woo 4728449137 Remove need for MinBackwardsCompatibleVersion 2025-03-28 15:23:50 +08:00
Ben Woo e94cc41ca8 Refactor protocol version to derive from plugin's version string 2025-03-26 22:56:14 +08:00
Ben Woo ab4856c81e Merge pull request #3184 from Multiverse/ben/mv5/attempt-aggregate
Better handling for a list of attempts with AttemptsAggregate
2025-03-26 21:54:07 +08:00
Ben Woo 7861ac7d63 Remove unused of Async class 2025-03-26 21:42:48 +08:00
Ben Woo cf37956784 Add docs for AsyncAttempt 2025-03-26 21:40:58 +08:00
Ben Woo 0b39e94047 Implement runnable method and add javadocs to AttemptsAggregate 2025-03-26 21:30:50 +08:00
Ben Woo 0dce6293d5 Better handling for a list of attempts with AttemptsAggregate 2025-03-25 22:56:34 +08:00
Ben Woo 8b181cbe43 Add missing world properties in /mv info 2025-03-25 17:48:54 +08:00
Ben Woo 290a12ce02 Refactor method of getting only the world alias without fallback 2025-03-25 17:40:01 +08:00
Ben Woo 8eab3c13ef Add support for localize Message within ContentDisplay api 2025-03-25 17:19:46 +08:00
Ben Woo bf3fba58e2 Implement mv world events - Load, Unload, Clone, Regen, Remove 2025-03-25 15:19:18 +08:00
Ben Woo 34991a722a Minor codestyle and null checking cleanup 2025-03-25 13:45:04 +08:00
Ben Woo cca6c16928 Merge branch 'ben/mv5/dest-packet' into MV5 2025-03-25 12:22:07 +08:00
Ben Woo 1b379bb426 Cleanup hasAnySpawnPermission to remove duplicated code 2025-03-25 12:21:20 +08:00
Ben Woo 294c69524f Include its Destination object in DestinationSuggestionPacket to simplify code 2025-03-25 12:14:26 +08:00
Jeremy Wood 441e6da0ca Merge pull request #3183 from Multiverse/dtm/mv5/cleanup-2
Various cleanup & reorganizing
2025-03-24 23:58:50 -04:00
Jeremy Wood 09da352175 Reorganize config.functions package into config.nodes. 2025-03-24 23:35:59 -04:00
Jeremy Wood 552533f82e Move confighandle.node package to config package. 2025-03-24 23:26:42 -04:00
Jeremy Wood 8ddbadf6fc Move confighandle.migration package to config package. 2025-03-24 23:25:08 -04:00
Jeremy Wood 92297ceba9 Move confighandle.functions package to config package. 2025-03-24 23:24:44 -04:00
Jeremy Wood 766496459d Move confighandle package contents to config.handle. 2025-03-24 23:19:59 -04:00
Jeremy Wood 510c4b287c Revert "Mark everything under commandtools package as Internal."
This reverts commit 8cb35006
2025-03-24 22:29:46 -04:00
Jeremy Wood bc9122cf7e Rename commandtools package to command. 2025-03-24 22:26:35 -04:00
Jeremy Wood 8cb3500690 Mark everything under commandtools package as Internal. 2025-03-24 22:20:13 -04:00
Jeremy Wood 1a8c2c3045 Use lambda expression in AnchorManager. 2025-03-24 22:19:42 -04:00
Jeremy Wood 9295318794 Fix unmodifiable set in AnchorManager. 2025-03-24 22:19:41 -04:00
Ben Woo 81ea96019a CommandQueuePayload's OTP should be a String instead of int 2025-03-24 21:10:16 +08:00
Ben Woo 818c416d81 Fix listeners test 2025-03-24 20:23:22 +08:00
Ben Woo c020a298ef Implement QueuedCommandAction functional interface 2025-03-24 20:22:05 +08:00
Ben Woo d960ec048c Remove MVLocalesListener as it is handled by ACF 2025-03-24 20:11:05 +08:00
Ben Woo f4bca52712 Remove need for OpenBukkitCommandIssuer 2025-03-24 19:48:34 +08:00
Ben Woo 2f73856d17 Refactor configuration to confighandle package 2025-03-24 19:41:15 +08:00
Ben Woo 2608a12cf3 Merge pull request #3181 from Multiverse/ben/mv5/cleanup
Ben/mv5/cleanup
2025-03-22 12:23:52 +08:00
Ben Woo dc3acc8e08 Rename MVCoreConfig to CoreConfig 2025-03-16 11:29:25 +08:00
Ben Woo f5aa3f3de5 Add javadocs to various classes 2025-03-16 11:09:03 +08:00
Ben Woo e43f7de881 Refactor ConfirmMode to config package 2025-03-16 10:11:38 +08:00
Ben Woo 96f17784ec Cleanup DumpService 2025-03-16 10:08:32 +08:00
Ben Woo 02b3fa60c6 Merge pull request #3179 from Multiverse/ben/mv5/run-queue
Refactor runQueuedCommand to relay failure reason to caller
2025-03-16 10:07:51 +08:00
Ben Woo caa35ed6e3 Refactor runQueuedCommand to relay failure reason to caller 2025-03-15 09:42:34 +08:00
Ben Woo dc9a386af1 Implement a default command exception handler to show stacktrace 2025-03-08 12:58:31 +08:00
Ben Woo 120b51e9e6 Minor refactor to PlayerPortalEvent 2025-03-08 10:59:31 +08:00
Ben Woo 626e6d01ee Implement alias tab completion for destinations 2025-03-06 21:07:56 +08:00
Ben Woo ac2ca92d33 Remove colour code when resolving alias name in commands 2025-03-06 20:43:45 +08:00
Ben Woo 781dc35e52 Use runTaskLater instead of scheduleSyncDelayTask 2025-03-06 19:55:35 +08:00
Ben Woo ac8896ed6d Use Try class instead of catching throwable for ConfirmCommand 2025-03-06 19:55:10 +08:00
Ben Woo ca7ac564da Make destination classes final 2025-03-05 21:33:46 +08:00
Ben Woo 4551eae74f Fix MVDebugModeEvent not being called 2025-03-05 20:22:01 +08:00
Ben Woo dd279910bd Fix config test 2025-03-03 22:38:29 +08:00
Ben Woo ef47a70089 Default firstSpawnOverride to false 2025-03-02 16:56:09 +08:00
Ben Woo a2d7bbc58c Merge branch 'main' into MV5 2025-03-01 22:05:14 +08:00
Ben Woo 0ed41e3776 Merge branch 'main' into MV5 2025-03-01 22:04:42 +08:00
Ben Woo babcec1f5d Rename WorldPurger to LegacyWorldPurger 2025-02-28 22:35:27 +08:00
Ben Woo 9e25e1d00b Merge pull request #3176 from Multiverse/ben/update-gradle-action
Update gradle gha deps to v4
2025-02-28 22:30:19 +08:00
Ben Woo e9e0407dbc Refactor null name with hidden method 2025-02-28 22:29:48 +08:00
Ben Woo cfd7be25af Ensure VersionMigrator is applied in the correct order 2025-02-28 17:28:54 +08:00
Ben Woo 74e595b236 Add destination and debug mode tab completion for /mv config 2025-02-28 17:15:24 +08:00
Ben Woo f46449fb99 Fix possible null issue with gamerule completion 2025-02-28 17:10:15 +08:00
Ben Woo 54ebdcb38b Refactor config handling to only serialise and deserialise on load and save 2025-02-26 23:02:16 +08:00
Ben Woo 1a3baf2a98 Remove old dep relocations 2025-02-26 20:06:59 +08:00
Ben Woo 02127fa123 Update to 1.0.2 of gradle plugins. 2025-02-26 20:04:26 +08:00
Ben Woo 16f8f3cd00 Fix spectator mode not flying 2025-02-25 20:36:11 +08:00
Ben Woo a9fd4db245 Add debug block for checking safe location 2025-02-25 14:24:49 +08:00
Ben Woo f966266bdc Merge pull request #3177 from Multiverse/zax71/main/updated-readme 2025-02-24 11:58:24 +08:00
Zax71 c5b4b88647 Change available for to available on in badges and fix release/pre-release badges 2025-02-23 09:21:46 +00:00
Ben Woo fe0be3e6ec Fix destination's velocity not applying 2025-02-23 16:02:21 +08:00
Ben Woo 733a561cf8 Add teleport test for when finer permission is disabled 2025-02-23 15:41:39 +08:00
Ben Woo 61e2d008fe Refactor permission checking with scope enum 2025-02-23 15:38:16 +08:00
Ben Woo 95bd8492d2 Add time to placeholderApi 2025-02-23 13:45:57 +08:00
Ben Woo 5db01b860d Fix mv anchor tab completion 2025-02-23 13:39:29 +08:00
Ben Woo e3409be81b Update gradle gha deps to v4 2025-02-22 13:16:43 +08:00
Ben Woo bb9591ce10 Merge pull request #3172 from Multiverse/zax71/mv5/legacy-gamerule-names
Add back legacy gamerule commands
2025-02-17 19:22:13 +08:00
Ben Woo ab65c01408 Fix remove command tab complete 2025-02-17 19:18:23 +08:00
Zax71 a47125d29b Add back legacy gamerule commands 2025-02-16 12:28:24 +00:00
Ben Woo 3160ac32b4 Urlencode mclogs payload 2025-02-15 16:29:28 +08:00
Ben Woo 2de0c32d32 Add command context for MultiverseWorld array 2025-02-15 15:23:54 +08:00
Ben Woo fb7e496e4e Move addonToCommaSeperated to StringFormatter class 2025-02-15 15:23:54 +08:00
Ben Woo 9956142bba Merge pull request #3169 from Multiverse/zax71/MV5/confirm-command-custom-timeout
Add config option for `/mv confirm` timeout
2025-02-13 13:35:42 +08:00
Ben Woo 188a60ade7 Remove validDuration from ConfirmQueuePayload and directly reference config value 2025-02-13 13:27:49 +08:00
Zax71 b701da15ff Got the config done but DI is hard 2025-02-12 19:19:34 +00:00
Ben Woo eb20386bac Add reflection method to get field value from field name 2025-02-06 22:10:16 +08:00
Ben Woo 757ea6038f Merge pull request #3168 from Multiverse/dtm/mv5/gradle-plugins
Use build logic from custom gradle plugins.
2025-02-03 22:26:30 +08:00
Ben Woo 288a87d551 Fix tests issues with Biome.values() 2025-02-03 22:05:30 +08:00
Ben Woo e6313ceeb9 Add biome tab completion and docs 2025-02-03 21:59:39 +08:00
Jeremy Wood 74c311be96 Update to 1.0.1 of gradle plugins. 2025-02-03 08:43:20 -05:00
Jeremy Wood 0ffb55c4b9 Use build logic from custom gradle plugins. 2025-02-02 20:22:53 -05:00
Ben Woo f76c3e106a Remove unused AsyncSafetyTeleporter in MVPlayerListener 2025-01-31 20:12:41 +08:00
Ben Woo e83f9093f5 Fix tests due to biome string change 2025-01-28 13:22:45 +08:00
Ben Woo 40cafbd743 Add support for custom biome provider plugins 2025-01-28 13:11:07 +08:00
Ben Woo 13d75b1645 Use try with loading api service 2025-01-28 12:02:33 +08:00
Ben Woo 95ca397072 Implement Try<Void> for config save methods 2025-01-28 12:02:33 +08:00
Ben Woo cdfea86283 Add tests for spawn command 2025-01-28 12:02:33 +08:00
Ben Woo 06e7b30963 Use player.performCommand and check returns true 2025-01-28 12:02:33 +08:00
Ben Woo 761455aeb9 Fix teleporter not parsed correctly 2025-01-28 12:02:33 +08:00
Ben Woo c6797363f5 Implement using generator settings when creating world 2025-01-28 12:01:12 +08:00
Jeremy Wood a7ca4499c3 Merge pull request #3164 from Multiverse/dtm/mv5/more-fixes-2
More DumpsCommand cleanup.
2025-01-27 15:30:50 -05:00
Ben Woo e910e88b35 Fallback to WorldManager#getDefaultWorld when removing players from world 2025-01-28 00:20:46 +08:00
Ben Woo 92548a3617 Ensure mapAsyncAttempt is not forcing mapper AsyncAttempt to run synced 2025-01-28 00:10:31 +08:00
Ben Woo 92b13a5057 Make finer teleport config option apply to spawn permissions as well 2025-01-27 23:36:26 +08:00
Ben Woo 4cad57f749 Refactor all config node variables to be camelcase 2025-01-27 23:21:55 +08:00
Jeremy Wood 5cb7fc87c9 Use sealed classes for HttpAPIClient and implementations. 2025-01-27 10:15:53 -05:00
Ben Woo 1eaa76cb3a mapAsyncAttempt should call thenApply instead of thenApplyAsync 2025-01-27 23:04:20 +08:00
Jeremy Wood 72a7b2b511 Reduce complexity of DumpsLogPoster. 2025-01-27 10:00:30 -05:00
Jeremy Wood 35c4392033 Increase ThrowsCount checkstyle to permit max of 2. 2025-01-27 09:59:01 -05:00
Ben Woo df11141d17 Fix protocol version inequality (again lol) 2025-01-25 17:05:42 +08:00
Ben Woo f8b41cea91 Fix isIteratingOverLevelsMethod being null 2025-01-25 17:05:14 +08:00
Ben Woo c4f5ae366c Fix protocol version logic 2025-01-25 15:32:54 +08:00
Ben Woo d6ea37777f Rename getServiceProvider to getServiceLocator 2025-01-25 12:29:49 +08:00
Ben Woo 547c123075 Fix MultiversePlugin abstract methods should be public 2025-01-25 12:13:13 +08:00
Ben Woo 5d09bce8f4 Revamp how submodules should depend on mvcore 2025-01-25 11:55:43 +08:00
Ben Woo 18fd97410e Cleanup MultiverseCoreApi tests 2025-01-25 10:10:37 +08:00
Ben Woo 1ffdc4ad75 Add more common api getters and expose PluginServiceLocator 2025-01-25 10:10:24 +08:00
Ben Woo 0fceff073c Fix comment style in PluginServiceLocator 2025-01-25 09:52:57 +08:00
Ben Woo dee05cb21f Suggesting destination use CommandSender instead of CommandIssuer 2025-01-25 09:51:24 +08:00
Ben Woo 2b70c8bfa5 Merge pull request #3157 from Multiverse/zax71/mv5/whoCommandAutoWorld
`/mv who` command auto world
2025-01-25 09:40:47 +08:00
Ben Woo 3861737918 Merge pull request #3162 from Multiverse/ben/mv5/server-props
Read server.properties files to get default world
2025-01-25 09:32:12 +08:00
Ben Woo ee15740d75 Read server.properties files to get default world 2025-01-25 09:25:00 +08:00
Ben Woo 164e0ffd09 Fix javadoc error with p tag 2025-01-25 09:24:25 +08:00
Ben Woo 878d1d86f3 Merge remote-tracking branch 'origin/MV5' into MV5 2025-01-25 09:19:46 +08:00
Ben Woo 548dc7dae7 Removed unused sendPlayerToDefaultWorld method 2025-01-25 09:17:47 +08:00
Ben Woo 367b9096c5 Fix more sonarcloud nitpicks 2025-01-25 09:17:47 +08:00
Ben Woo 12c9911434 Convert GameRuleValue class to a record 2025-01-25 09:17:46 +08:00
Ben Woo d6f63ee2e9 Private constructor for TestingMode to prevent instantiation 2025-01-25 09:17:46 +08:00
Ben Woo 580e876009 Merge pull request #3161 from Multiverse/dtm/mv5/more-fixes
More checkstyle and sonarqube fixes.
2025-01-25 09:16:22 +08:00
Ben Woo 7aacd73460 Op should have teleport permissions 2025-01-25 09:15:45 +08:00
Jeremy Wood c692632b7f Reduce complexity of DumpsCommand.
Moves most logic to DumpsService.
2025-01-24 13:27:55 -05:00
Jeremy Wood 68595d4acf Extract LogPoster out of DumpsCommand. 2025-01-24 11:21:16 -05:00
Jeremy Wood 78d0e14ffd Add reusable page and filter flags. 2025-01-24 10:29:23 -05:00
Jeremy Wood 28f609858f Rename flags package to flag. 2025-01-24 10:03:44 -05:00
Jeremy Wood 9d72c7b22d Reduce complexity of CreateCommand. 2025-01-24 09:22:34 -05:00
Jeremy Wood d6f4bca6d1 Slightly lower complexity of AnchorManager. 2025-01-24 09:22:34 -05:00
Jeremy Wood 1397d14c4e Slightly lower complexity of RegenWorldOptions. 2025-01-24 09:22:34 -05:00
Ben Woo 0002582991 Convert GameRuleValue class to a record 2025-01-24 09:22:34 -05:00
Ben Woo 21b8008297 Private constructor for TestingMode to prevent instantiation 2025-01-24 09:22:33 -05:00
Ben Woo 906fac1e62 Make bypass gamemode and playerlimit permission false even when oped 2025-01-24 22:18:23 +08:00
Ben Woo 8096a4e185 Use ACFUtil for random instance 2025-01-24 21:27:02 +08:00
Jeremy Wood d3274cced7 Merge pull request #3159 from Multiverse/dtm/mv5/sonarqube-fixes
Checkstyle/Sonarqube fixes.
2025-01-24 00:04:43 -05:00
Jeremy Wood 949c4704f4 Reuse random in RegenWorldOptions. 2025-01-23 23:59:44 -05:00
Jeremy Wood 6d32393145 Remove instance initializer on HashMap. 2025-01-23 23:57:21 -05:00
Jeremy Wood 54f03256f7 Fix potential source of infinite recursion. 2025-01-23 23:55:36 -05:00
Jeremy Wood 715d1cb59b Fix checkstyle and sonarqube issues found in AnchorManager. 2025-01-23 23:45:19 -05:00
Jeremy Wood abe9ddd638 Update a few places using common replacements. 2025-01-23 23:44:53 -05:00
Jeremy Wood fb75953468 Fix many checkstyle and sonarqube issues on commands. 2025-01-23 23:41:59 -05:00
Jeremy Wood 417090489c Add common replacement keys. 2025-01-23 22:23:46 -05:00
Jeremy Wood f6e91fbc03 Disable checkstyle indentation module forceStrictCondition. 2025-01-23 19:53:49 -05:00
Jeremy Wood d7c1954a39 Merge pull request #3158 from Multiverse/ben/mv5/revamp-api
Ben/mv5/revamp api
2025-01-23 18:22:09 -05:00
Ben Woo ddc4785fed Dont call registerConditions in constructor 2025-01-23 23:14:32 +08:00
Ben Woo 402fa87e32 Refactor classes to reduce public exposure 2025-01-23 23:01:36 +08:00
Ben Woo 525171a69a De-interface all classes and remove api package 2025-01-23 22:29:08 +08:00
Zax71 c5a8134bce Switch to using @Flags("resolve=issuerAware") 2025-01-20 15:22:39 +00:00
Ben Woo d9cf3f50ee Merge pull request #3156 from Multiverse/zax71/mv5/improvedLocation 2025-01-20 12:38:53 +08:00
Zax71 9a55e35055 Add /mvw alias for /mv who 2025-01-19 17:33:18 +00:00
Zax71 9660b0c689 Allow not specifying a world to /mv who 2025-01-19 17:31:15 +00:00
Zax71 96b174c78a Improve syntax for /mv setspawn 2025-01-19 16:55:44 +00:00
Zax71 a269c0292f Add /mvss alias and state pitch and yaw when setting 2025-01-19 16:51:40 +00:00
Ben Woo 365b871cf1 Send correct price formatting when player has not enough money 2025-01-19 22:46:13 +08:00
Ben Woo 31524f9d0e Remove FilesManipulator and merge with FileUtils 2025-01-19 22:34:10 +08:00
Ben Woo b646937d23 Make config set methods return Try<Void> 2025-01-19 22:25:39 +08:00
Ben Woo d6a70bbb9b Fix MultiverseWorld#isLoadedWorld returning wrong value 2025-01-19 15:58:12 +08:00
Ben Woo 55cd6b7c59 Make WorldConfigNodes reference MultiverseWorld instead of LoadedMultiverseWorld 2025-01-19 15:51:42 +08:00
Ben Woo 4362453f90 Implement MVWorldPropertyChangeEvent 2025-01-19 15:29:04 +08:00
Ben Woo 36aa144121 Implement MVRespawnEvent as Cancellable and remove respawn method 2025-01-19 14:43:34 +08:00
Ben Woo bb91a74308 Make ItemEconomy a service 2025-01-19 14:36:38 +08:00
Ben Woo b8db6e2645 Implement MultiverseCoreApi 2025-01-18 15:51:26 +08:00
Ben Woo 449f85ee5c Ensure all imports in api does not import other multiverse.core packages 2025-01-18 15:16:41 +08:00
Ben Woo c1e6614423 Implement generator as an api 2025-01-18 15:13:41 +08:00
Ben Woo b17afbd8e0 Merge pull request #3155 from Multiverse/ben/mv5/api
Ben/mv5/api
2025-01-18 14:59:22 +08:00
Ben Woo b3e633b119 Fix and remove some useless todos 2025-01-18 14:57:13 +08:00
Ben Woo 4eb9ff6dae Remove old tests 2025-01-18 14:36:10 +08:00
Ben Woo e3fded9373 Major refactor to support developer api 2025-01-18 14:34:35 +08:00
Ben Woo 53c9cbe81c More configuration option for respawning 2025-01-18 11:37:00 +08:00
Ben Woo b68e8a2cef Localise teleport "you" message 2025-01-17 20:14:59 +08:00
Ben Woo 5742670a90 Implement better spawn command permission checking and tab complete 2025-01-17 20:14:21 +08:00
Ben Woo b66498545a Log unknown world flag 2025-01-17 20:13:18 +08:00
Ben Woo 7a6d328d5a Fix minor issues with teleport CommandCompletion 2025-01-17 18:57:14 +08:00
Ben Woo 2cfcdad4de Improve teleport tab complete handling 2025-01-17 16:50:41 +08:00
Ben Woo 4dc61634bd Don't log permission checks for console 2025-01-17 16:47:24 +08:00
Ben Woo 51731cd178 Only suggest destination that sender have permission for 2025-01-17 15:21:51 +08:00
Ben Woo 14a541cc49 Fix debug permission config not applying 2025-01-17 15:20:17 +08:00
Ben Woo 9d54cc48dd Properly register world and teleport permissions 2025-01-17 11:36:17 +08:00
Ben Woo ed5a13b269 Implement default-respawn-to-world-spawn config option and refactor respawn event 2025-01-16 20:55:27 +08:00
Ben Woo 971a159eae Fix config tests 2025-01-16 19:43:06 +08:00
Ben Woo 83e197aacd Implement config option for debug permission 2025-01-16 19:40:26 +08:00
Ben Woo 9884ec2e82 Fix tests by adding new anchor-respawn property to worlds.yml files 2025-01-16 13:16:58 +08:00
Ben Woo 52a4059f98 Fix typo in anchor respawn method name 2025-01-16 13:16:01 +08:00
Ben Woo c49653ebc8 Add world property toggle allow anchor spawn 2025-01-16 11:00:44 +08:00
Ben Woo 9be7c75dcc Defaults mv dumps to use paste.dev as paste.gg is down 2025-01-16 10:46:01 +08:00
Ben Woo 5b97c3fd1c Fix mv dumps unable to get latest.log if world-container is changed 2025-01-16 10:10:33 +08:00
Ben Woo 3a9eb88197 Merge pull request #3151 from Multiverse/ben/mv5/block-safety
ben/mv5/block-safety
2025-01-16 09:50:31 +08:00
Ben Woo d83d6c6483 Improve safe location search config comments 2025-01-16 09:42:40 +08:00
Ben Woo 6fb620cac6 Fix failing tests caused by new class and config changes 2025-01-16 09:39:38 +08:00
Ben Woo cb2ab3e437 Shift all to use AdvancedBlockSafety and deprecate old BlockSafety 2025-01-16 09:31:53 +08:00
Ben Woo 03dc8e4245 Rename the broken config file and regen a new one 2025-01-15 19:07:00 +08:00
Ben Woo 2df1f39ef9 Implement rest of block safety methods 2025-01-15 14:11:01 +08:00
Ben Woo 3b9a91c010 Implement better search algo that search from the nearest block outwards 2025-01-15 12:43:44 +08:00
Ben Woo 64e7baec3c Implement initial new algorithm for safe location 2025-01-14 23:10:35 +08:00
Ben Woo 06feb84ba9 Add test for worlds.yml with weird formatting 2025-01-13 23:55:01 +08:00
Ben Woo b5f1b32a3d Fix serialisation issues with string and list items 2025-01-13 23:53:57 +08:00
Ben Woo 647e116bc5 Refactor config handles and make world properties alphabetical order 2025-01-13 23:16:32 +08:00
Ben Woo 874b604294 Check if current location is safe before searching around 2025-01-13 19:27:52 +08:00
Ben Woo 1f8a7975ce Add more tests for world config manager 2025-01-13 14:31:17 +08:00
Ben Woo 293417125a Refactor and add config file assertion for config.yml testing 2025-01-13 14:18:30 +08:00
Ben Woo 5b09097fd2 Fix not removing old serialisation tags if file is crlf 2025-01-13 14:17:50 +08:00
Ben Woo c03679d20e Fix new config file not having version number 2025-01-13 14:16:49 +08:00
Ben Woo ef21d83c35 Fix config handle reset not using serialiser 2025-01-13 07:04:31 +08:00
Ben Woo 89871cd418 Ensure onSetValue is ran when setting up nodes 2025-01-12 22:49:15 +08:00
Ben Woo 7d90a11d9c Remove invalid command condition in delete command 2025-01-12 22:34:23 +08:00
Ben Woo ec19f3e786 Defer world operations if world is ticking 2025-01-12 22:33:46 +08:00
Ben Woo de879c7af2 Implement tab-complete for world property respawn-world 2025-01-12 21:57:02 +08:00
Ben Woo f707f29249 Improve worlds config tests with node to node yaml comparison 2025-01-12 18:07:01 +08:00
Ben Woo 4798ddda63 Fix world migration issues with alias and spawnrate 2025-01-12 18:06:01 +08:00
Ben Woo 4f28d38dc1 Fix test failing with lowercase enum 2025-01-12 15:26:23 +08:00
Ben Woo 2356bfa7fc Save all enums in config as lowercased 2025-01-12 15:22:23 +08:00
Ben Woo 643fa604d1 Fix certain config options resetting on reload 2025-01-12 15:21:59 +08:00
Ben Woo a982875558 Fix some english 2025-01-12 14:53:24 +08:00
Ben Woo 803345d09d Fix regen command test by disabling confirm 2025-01-12 12:24:29 +08:00
Ben Woo f1d98a68c5 Implement otp for queue command and confirm mode 2025-01-12 12:16:07 +08:00
Ben Woo 2c82c279e2 Implement option to disable finer teleport permission checking 2025-01-12 10:54:45 +08:00
Ben Woo 1e33689d7b Implement concurrent teleport limit 2025-01-12 10:50:32 +08:00
Ben Woo 8793aa506b Implement new config options for future features 2025-01-12 09:31:39 +08:00
Ben Woo 6d08d1551b Improve first spawn and join location with PlayerSpawnLocationEvent 2025-01-11 09:48:14 +08:00
Ben Woo 2949b96a46 Improve message output for tp command with proper fail reason 2025-01-10 23:58:28 +08:00
Ben Woo cdb5fc0560 Implement option to resolve world by alias for commands and destinations 2025-01-10 23:01:55 +08:00
Ben Woo f37ee00030 Implement --unsafe flag for spawn command 2025-01-10 21:32:44 +08:00
Ben Woo df7b9a3e5b Implement correct default scale for nether and end environment 2025-01-10 21:11:41 +08:00
Ben Woo bb6d236495 Merge pull request #3150 from Multiverse/ben/mv5/revamp-teleport
Ben/mv5/revamp teleport
2025-01-10 20:29:21 +08:00
Ben Woo 7c2b7e5a47 Fix a test for ConfigTeleportInterceptTest 2025-01-10 20:24:02 +08:00
Ben Woo 5f15cce3f3 Add tests for multiple player teleport 2025-01-10 20:21:19 +08:00
Ben Woo 199da71be0 Add docs for new AsyncSafetyTeleporter 2025-01-10 20:13:49 +08:00
Ben Woo 303ac039e0 Add default serialisers for all number types 2025-01-10 20:01:49 +08:00
Ben Woo 067a88eec1 Fix scale double migration 2025-01-10 19:57:21 +08:00
Ben Woo 34ea244e82 Add tests for setPropertyString 2025-01-10 19:48:42 +08:00
Ben Woo 68717d592c Implement double serialization to fix scale config node 2025-01-10 13:23:59 +08:00
Ben Woo c0c9814c10 Improve config node deserialization handling 2025-01-10 13:23:15 +08:00
Ben Woo 0f1a9eb8f7 Fix double migrator action class name 2025-01-10 13:19:03 +08:00
Ben Woo d9aae1ade7 Remove unused TeleportResult.Success enum 2025-01-09 22:36:09 +08:00
Ben Woo 3e69dd4877 Fix teleport test build error 2025-01-09 22:29:35 +08:00
Ben Woo 918d54f466 Only allow proper true/false strings to be parsed 2025-01-09 21:28:46 +08:00
Ben Woo 25e704d6ce Implement test for teleport command 2025-01-09 20:54:49 +08:00
Ben Woo d8d8607592 Convert all usage of AsyncSafetyTeleporter to new api 2025-01-09 20:52:16 +08:00
Ben Woo 2e309cab0d Refactor safety teleporter with AsyncSafetyTeleporterAction 2025-01-08 22:49:11 +08:00
Ben Woo 97b6d240fc Implement attempt thenRun and thenAccept 2025-01-08 22:48:27 +08:00
Ben Woo 9e38142c4f Make file utils a service and optimise server folder file search 2025-01-08 09:34:11 +08:00
Ben Woo 5dddfbebc9 Merge pull request #3149 from Multiverse/ben/mv5/single-biome
Add support for creating worlds with single biome
2025-01-05 23:10:13 +08:00
Ben Woo ddedf2cbdd Fix failed tests caused by new biome property 2025-01-05 23:02:21 +08:00
Ben Woo 71e47d22ef Add support for creating worlds with single biome 2025-01-05 22:55:34 +08:00
Ben Woo 08ac65e372 Add missing SPAWN_FAILED message key 2025-01-05 11:15:18 +08:00
Ben Woo 50ed9e29d8 Merge pull request #3147 from Multiverse/ben/mv5/regen-test
Implement tests for regen command
2025-01-05 10:48:52 +08:00
Ben Woo e492c2801e Implement more tests for regen command 2025-01-05 10:43:55 +08:00
Ben Woo 5259f6a503 Fix spawn location in world config should use SpawnLocation class not bukkit Location 2025-01-04 10:21:47 +08:00
Ben Woo 17bb856242 Add --unsafe flag to teleport command 2025-01-04 10:09:17 +08:00
Ben Woo df1cb2ccc2 Fix config typo in auto-purge-entities comments 2025-01-04 09:50:05 +08:00
Ben Woo 5a90d51e36 Implement tests for regen command 2025-01-03 21:35:21 +08:00
Ben Woo b8f2ebdab7 Enable tests for counting number of commands as a service 2025-01-03 20:37:15 +08:00
Ben Woo 78b9ad532b Fix anchor command inheriting from CoreCommand 2025-01-03 20:36:48 +08:00
Ben Woo 88bb593b84 Refactor and implement tests for create and delete command 2025-01-03 20:27:09 +08:00
Ben Woo f67777b9a7 Allow delete world command to delete unloaded worlds 2025-01-03 20:26:43 +08:00
Ben Woo a5ba42285f Fix crash when CommandManager calling Plugin#getConfig before config is migrated 2025-01-03 20:15:13 +08:00
Ben Woo 33e440ffec Fix regen command random seed flag 2025-01-03 18:13:38 +08:00
Ben Woo 8fdb13765e Fix regen command syntax description and minor notes 2025-01-02 22:59:19 +08:00
Ben Woo 88171da0ab Fix invalid gamerule error 2025-01-02 22:58:24 +08:00
Ben Woo 7db5f8c30c Merge pull request #3146 from Multiverse/ben/mv5/improve-locales
Implement configurable default and per-player locale
2025-01-02 20:50:16 +08:00
Ben Woo 69ab1d3953 Ensure parent locales field is using the same instance in CommandManager 2025-01-02 20:48:37 +08:00
Ben Woo 92f3225144 Merge pull request #3145 from Multiverse/ben/mv5/check-command
Actually implement check command
2025-01-02 20:44:23 +08:00
Ben Woo 1885298222 Implement more detailed localization config tests 2025-01-01 22:23:13 +08:00
Ben Woo 7ae9d2671e Add config methods for the 2 new locale config nodes 2025-01-01 22:22:46 +08:00
Ben Woo c6ceba8ea5 Implement configurable default and per-player locale 2025-01-01 11:34:11 +08:00
Ben Woo 22e18545ed Actually implement check command 2024-12-31 12:04:16 +08:00
Ben Woo f20b4f285f Bump mockbukkit with canGenerateStructures method support 2024-12-31 11:27:06 +08:00
Ben Woo d06407fcde Merge pull request #3142 from Multiverse/ben/mv5/teleport-intercept
Properly implement teleport intercept config option
2024-12-20 23:12:03 +08:00
Ben Woo 8410175f60 Merge pull request #3137 from Multiverse/ben/mv5/command-permissions
Implement more customisable way of doing permission checking
2024-12-20 23:11:43 +08:00
Ben Woo 3bdc7f428b Merge pull request #3140 from Multiverse/ben/mv5/command-tests
Ben/mv5/command tests
2024-12-20 23:09:32 +08:00
Ben Woo a5009bf8a5 Merge pull request #3141 from Multiverse/ben/mv5/flag-group
Allow customisation of flag group prefix used
2024-12-20 23:08:57 +08:00
Ben Woo 018e15483d Improve teleport intercept config comment 2024-12-12 18:37:21 +08:00
Ben Woo d8b56b9feb Properly implement teleport intercept config option 2024-12-12 10:39:35 +08:00
Ben Woo 63b6ab225f Allow customisation of flag group prefix used 2024-12-11 19:47:56 +08:00
Ben Woo 0700d481d1 Add test for config command 2024-12-11 17:23:34 +08:00
Ben Woo 80ad788028 Abstract common action for command testing to a base class 2024-12-11 17:23:19 +08:00
Ben Woo f55bacc83d Improve error handling for string parser 2024-12-11 17:22:40 +08:00
Ben Woo 12ed1885d8 Implement better permission checking for spawn command 2024-12-11 15:59:38 +08:00
Ben Woo 8e64b18102 Merge pull request #3136 from Multiverse/ben/mv5/gamerule-value
Improve gamerule value suggestion
2024-12-07 14:26:30 +08:00
Ben Woo 32f609e9ad Teleport command no longer need to override hasPermission 2024-11-29 22:57:49 +08:00
Ben Woo ea87f2a30b Implement more customisable way of doing permission checking 2024-11-29 22:51:20 +08:00
Ben Woo 75a98f9c67 Improve gamerule value suggestion 2024-11-27 16:48:31 +08:00
Ben Woo 974887d13f Throw error if number parsing fails 2024-11-27 15:23:24 +08:00
Ben Woo c6983a5f44 Ensure value is not null for the relevant PropertyModifyAction 2024-11-27 15:07:35 +08:00
Ben Woo 0d6daa1cd6 Improve MultiverseWorld command context error handling 2024-11-27 15:06:39 +08:00
Ben Woo 6a351fd38a Backup old mv4's worlds config to worlds.yml.old 2024-11-27 11:58:59 +08:00
Ben Woo 6c6553bf85 Delete old entryfee path from world config during migration 2024-11-27 11:58:18 +08:00
Ben Woo 7e8ba18ba1 Fix worlds config file name from worlds2 to worlds 2024-11-27 11:57:38 +08:00
Jeremy Wood aac076f19a Ignore ordering for potential worlds list test. 2024-11-25 09:23:51 -08:00
Ben Woo ecf0260a9f Revert "Remove unused MVPlayerTouchedPortalEvent"
This reverts commit 9781e8350c.
2024-11-24 13:39:28 +08:00
Ben Woo 470e657e3e Merge pull request #3133 from Multiverse/ben/mv5/events
Ben/mv5/events
2024-11-24 13:28:09 +08:00
Ben Woo d0774614c8 Rename MVDumpsDebugInfoEvent methods to reflect the class name change 2024-11-24 13:26:22 +08:00
Ben Woo 8d852c5269 Add todo for MVWorldPropertyChangeEvent 2024-11-24 11:21:13 +08:00
Ben Woo e93e2aa5f4 Implement MVWorldDeleteEvent event 2024-11-24 11:21:01 +08:00
Ben Woo 07ed9fbc48 Cleanup MVConfigReloadEvent and deprecate MVRespawnEvent 2024-11-23 21:28:05 +08:00
Ben Woo c0ceb4f993 Rename MVVersionEvent to MVDumpsDebugInfoEvent for clarity 2024-11-23 21:25:23 +08:00
Ben Woo 9781e8350c Remove unused MVPlayerTouchedPortalEvent 2024-11-23 21:24:30 +08:00
Ben Woo b1afd8f786 Implement MVTeleportDestinationEvent event 2024-11-23 21:24:14 +08:00
Ben Woo 668856dccc Add temporary publishing repo 2024-11-23 18:06:53 +08:00
Ben Woo e59089f706 Fix mvimport description locale 2024-11-22 20:52:17 +08:00
Ben Woo 295259a456 Merge pull request #3132 from Multiverse/ben/mv5/merge-main
Ben/mv5/merge main
2024-11-22 20:51:45 +08:00
Ben Woo 8ebb5cff5a Merge branch 'main' into ben/mv5/merge-main
# Conflicts:
#	src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java
2024-11-22 17:14:17 +08:00
Ben Woo 8a28bcafec Expose MV's completion and context instances in CommandManager 2024-11-21 22:28:48 +08:00
Ben Woo 0cc1676e6c Fix finer permission checking filter 2024-11-21 22:28:10 +08:00
Ben Woo b434903739 Merge pull request #3131 from Multiverse/ben/mv5/NewAndRemovedWorlds
Use a record NewAndRemovedWorlds instead of generic tuple for clarity
2024-11-21 22:10:41 +08:00
Ben Woo 5b3477af3e Merge pull request #3117 from Multiverse/ben/pr-comment-artifact
Comment build artifact in PR
2024-11-21 21:36:51 +08:00
Ben Woo e2050c825e Merge pull request #3130 from Multiverse/ben/mv5/improve-destination
Refactor to remove need for ParsedDestination and add destination tests
2024-11-21 11:52:08 +08:00
Ben Woo faf8d1a7d0 Merge pull request #3129 from Multiverse/ben/mv5/material-converter
Re-add MaterialConverter class and add tests
2024-11-21 11:49:24 +08:00
Ben Woo e15dd7e69b Implement DestinationInstance#getIdentifier shortcut 2024-11-21 10:56:41 +08:00
Ben Woo cee6a4879a Implement ExactDestination#fromLocation 2024-11-21 09:57:07 +08:00
Ben Woo f5b5148f82 Use a record NewAndRemovedWorlds instead of generic tuple for clarity 2024-11-21 09:46:57 +08:00
Ben Woo d3f6b11fe5 Refactor to remove need for ParsedDestination and add destination tests 2024-11-20 22:25:33 +08:00
Ben Woo 1eeb265f4e Merge pull request #3127 from Multiverse/ben/mv5/testssss
More testsss
2024-11-20 21:48:37 +08:00
Ben Woo 2f8d23390a Merge pull request #3128 from Multiverse/fix-publish-repo 2024-11-19 07:08:32 +08:00
Jeremy Wood c4d01b65b7 Publish to correct repo url based on version. 2024-11-18 15:36:47 -05:00
Ben Woo d415a7fc5c Re-add MaterialConverter class and add tests 2024-11-17 15:05:12 +08:00
Ben Woo 0b89738ec0 Update to mockbukkit 4.0 2024-11-16 17:03:11 +08:00
Jeremy Wood e33fc93a1d Merge pull request #3126 from Multiverse/ben/fix-publish
Fix gha publish command
2024-11-16 02:29:27 -05:00
Ben Woo 656b318be3 Fix gha publish command 2024-11-16 15:27:32 +08:00
Jeremy Wood 562dece6f9 Merge pull request #3125 from Multiverse/jwood/reposilite
Publish to new repo using temp url.
2024-11-16 02:02:19 -05:00
Jeremy Wood fa30b432a9 Publish to new repo using temp url. 2024-11-15 23:19:53 -05:00
Ben Woo 20af0350aa Implement tests for WorldNameChecker class 2024-11-14 20:39:56 +08:00
Ben Woo 30e8b93786 Fix null and empty world name checking 2024-11-14 20:39:35 +08:00
Ben Woo b7d067123c Implement more detailed world manager tests 2024-11-14 19:50:08 +08:00
Ben Woo 38dd0018e7 Fix and refactor cloneWorld hasWorldFolder check 2024-11-14 19:48:51 +08:00
Ben Woo e889e406ae Fix bstats shadowing and archive name build issues 2024-11-14 15:28:17 +08:00
Jeremy Wood 83b6236ed7 Merge pull request #3124 from Multiverse/ben/javadoc-latest
Add latest dir for javadoc
2024-11-14 00:51:18 -05:00
Ben Woo 41cab5b290 Improve replace_latest description 2024-11-14 13:40:53 +08:00
Ben Woo 99a716ccaa latest boolean 2024-11-14 13:38:42 +08:00
Ben Woo ecca904aef Add latest dir for javadoc 2024-11-14 13:26:32 +08:00
Ben Woo a2a740f371 Merge pull request #3123 from Multiverse/ben/javadoc
Javadoc with github action
2024-11-14 12:32:51 +08:00
Ben Woo c66b1a2b96 Add manual dispatch action for javadoc 2024-11-14 12:25:13 +08:00
Ben Woo 52b2170f8f Deploy javadoc to github pages on release 2024-11-14 12:22:30 +08:00
Ben Woo 4264c0c9d2 Merge pull request #3119 from Multiverse/ben/mv5/java-21
Make test run on java 21 for latest mockbukkit to work
2024-11-10 16:29:55 +08:00
Ben Woo 061b90ce90 Config gha to use java 21 for build 2024-10-14 14:23:45 +08:00
Ben Woo 38aa534cf5 Bump mockbukkit to latest 1.21 version 2024-10-14 14:19:29 +08:00
Ben Woo 234d42f1f1 Make tests run on java 21 instead of 17 2024-10-14 14:18:39 +08:00
Ben Woo a226ae5d4a Merge pull request #3098 from Multiverse/ben/mv5/anchorcommands
Implement anchor commands
2024-10-14 10:58:11 +08:00
Ben Woo 1ba0505c4b Merge pull request #3109 from Multiverse/ben/mv5/entryfee-currency
Properly implement entryfee for world config
2024-10-14 10:57:35 +08:00
Ben Woo bc27f0548a Merge pull request #3106 from Multiverse/ben/mv5/remove-old-serial
Remove old SerializationConfig dependency
2024-10-14 10:56:12 +08:00
Ben Woo 17d376d4d4 Bump upload artifact action to v4 2024-10-13 10:54:38 +08:00
Ben Woo 1547ea84c6 Comment build artifact in PR 2024-10-13 10:54:19 +08:00
Ben Woo c8e50ff7fc Merge pull request #3115 from Multiverse/ben/mv5/config-improvements
Ben/mv5/config improvements
2024-10-12 13:56:59 +08:00
Ben Woo 5a9b9771bc Merge pull request #3116 from Multiverse/ben/mv5/fix-version-test
Fix version command test
2024-10-12 13:56:45 +08:00
Ben Woo 7def05e112 Fix version command test 2024-10-12 13:50:45 +08:00
Ben Woo 42cfd9dcc4 Fix enforcementHandler being null in WorldConfigNodes 2024-10-12 13:43:49 +08:00
Ben Woo 7868a1971e Dont need to deserialize enum if it is already an enum 2024-10-12 13:43:17 +08:00
Ben Woo 9c929fccca Fix modify command string parsing 2024-10-12 13:42:15 +08:00
Ben Woo 18f4600ca4 Merge pull request #3107 from Multiverse/ben/mv5/version-cmd-test
Add tests for version command
2024-10-12 13:37:47 +08:00
Ben Woo 1ea3531d26 Merge pull request #3104 from Multiverse/ben/mv5/multi-plugin-hk2-support
multi plugin hk2 support
2024-10-12 13:36:47 +08:00
Ben Woo 11e2deaa23 Properly implement entryfee for world config 2024-09-18 21:12:17 +08:00
Ben Woo a68b78e5a4 Make contract for core specific listeners and commands 2024-09-15 13:36:29 +08:00
Ben Woo c3674e0a2f Revamp hk2 injection to support injection in dependent plugins 2024-09-15 13:36:29 +08:00
Ben Woo 64584cc6cf Fix gradle group id 2024-09-15 13:36:29 +08:00
Ben Woo 7368ff257c Add tests for version command 2024-09-15 13:34:35 +08:00
Ben Woo 54736baf33 Remove old SerializationConfig dependency 2024-09-15 13:30:36 +08:00
Ben Woo 1528fdfed1 Merge pull request #3105 from Multiverse/ben/mv5/papi-dep
Update placeholderAPI repo and version
2024-09-15 10:44:04 +08:00
Ben Woo c05d1401ea Update placeholderAPI repo and version 2024-09-15 09:43:41 +08:00
Ben Woo 4be2034588 Merge pull request #3093 from Multiverse/Zax71/MV5/implement-1420 2024-09-10 14:19:20 +08:00
Ben Woo 7bde4c1033 Merge pull request #3057 from Multiverse/zax71/MV5/spawnCommand
Add `/mv spawn` and `/mv setspawn`
2024-08-30 14:27:15 +08:00
Ben Woo f00e2964f3 Proper spawn permission checking 2024-08-30 14:23:45 +08:00
Ben Woo 1ec4e4b8f0 Improve setspawn command location param 2024-08-30 13:55:39 +08:00
Ben Woo 330d4fbe39 Improve spawn command messaging 2024-08-30 13:06:27 +08:00
Ben Woo 8cbf2bc050 Merge branch 'MV5' into zax71/MV5/spawnCommand 2024-08-30 12:29:50 +08:00
Ben Woo 77350539a7 Merge pull request #3095 from Multiverse/zax71/mv5/legacy-aliases
Add legacy aliases to all commands
2024-08-30 12:27:49 +08:00
Ben Woo d530c2aa4d Fix some formatting issues. 2024-08-30 12:25:50 +08:00
Ben Woo d83ecd3b94 Merge pull request #3097 from Multiverse/ben/mv5/getWorld-bukkit
Fix WorldManager#getWorld from bukkit World not mapping to worldname
2024-08-29 11:14:01 +08:00
Ben Woo fe79580e86 Merge pull request #3099 from Multiverse/ben/mv5/AsyncAttempt
Add onFailure methods to AsyncAttempt class
2024-08-29 11:00:28 +08:00
Ben Woo e0d0ee0ad0 Add onFailure methods to AsyncAttempt class. 2024-08-28 20:01:03 +08:00
Ben Woo 1d1f5940d7 Implement anchor commands 2024-08-28 19:15:03 +08:00
Ben Woo ad3a6fc8fc Fix WorldManager#getWorld from bukkit World not mapping to worldname 2024-08-28 17:56:36 +08:00
Ben Woo 533e843cdb Merge pull request #3055 from Multiverse/zax71/MV5/whoCommand
Add `/mv who` and `/mv whoall`
2024-08-28 17:53:08 +08:00
Ben Woo 833c33e26e Merge pull request #3094 from Multiverse/zax71/mv5/mvm-coloring 2024-08-28 10:21:58 +08:00
Zax71 949ba46a16 Add legacy aliases 2024-08-27 19:59:21 +01:00
Zax71 62c9497365 Fix colouring on /mv modify 2024-08-27 19:30:41 +01:00
Zax71 fef9ba44cd Allow /mv list to show world names instead of aliases 2024-08-27 18:51:30 +01:00
Ben Woo 38f97a81c8 Merge pull request #3091 from Multiverse/1.21.1-update
Update to 1.21.1
2024-08-25 10:09:26 +08:00
Zax71 e13349949a Update to 1.21.1 2024-08-23 12:08:41 +01:00
Ben Woo 2d059eabc3 Merge pull request #3084 from Multiverse/ben/fix-getTo-null 2024-08-13 10:19:25 +08:00
Ben Woo 006fe56d18 Fix edge case where PlayerTeleportEvent getTo is null 2024-08-12 21:41:39 +08:00
Ben Woo 2cf8b6961c Merge pull request #3082 from Multiverse/1.21-update 2024-08-08 08:10:15 +08:00
Zax71 9c519e1ea4 Maybe don't be so dumb this time 2024-08-07 15:42:55 +01:00
Ben Woo f1db561262 Merge pull request #3081 from Multiverse/1.21-update
Change versions to support 1.21
2024-08-07 22:07:19 +08:00
Zax71 f0cf1b7d4c Change versions to support 1.21 2024-08-07 13:10:26 +01:00
Ben Woo 7b20cd6443 Merge branch 'MV5' into zax71/MV5/whoCommand 2024-03-12 10:39:36 +08:00
Ben Woo 278c51d056 Merge pull request #3056 from Multiverse/zax71MV5/versionCommand
Add `/mv version`
2024-03-12 10:38:12 +08:00
Zax71 caed081f82 Update Ben's name 2024-03-08 18:03:42 +00:00
Zax71 6982d8e7ba Add null check for world 2024-03-08 18:02:15 +00:00
Zax71 1a508a5d14 Add logic for spawn and setspawn 2024-03-08 17:58:45 +00:00
Zax71 631ed2973a Rename to /mv spawn tp in preparation for /mv spawn set 2024-02-24 18:10:30 +00:00
Zax71 39c533e808 Use safetyTeleporter and add i18n 2024-02-24 17:56:54 +00:00
Zax71 b1a5907d0c /mv spawn basic features 2024-02-24 17:38:40 +00:00
Zax71 7276da7665 Implement i18n 2024-02-24 13:48:57 +00:00
Zax71 90b8729129 Add Ben and Zax71 to authors 2024-02-24 13:37:23 +00:00
Zax71 c24f198ed0 Add /mv version 2024-02-24 13:36:13 +00:00
Zax71 c640a251b6 Add i18n and tell user when a world is empty when using /mv who 2024-02-24 13:03:12 +00:00
Zax71 a6f4f2d2d5 Add /mv who and /mv whoall 2024-02-24 12:26:05 +00:00
Ben Woo 0c37c9e934 Merge pull request #3033 from Multiverse/ben/mv5/list-value-node
Implement ListValueNode and modify actions
2023-09-25 22:24:42 +08:00
Ben Woo 454bcd36e5 Refactor and fix checkstyles for some listeners 2023-09-25 14:09:09 +08:00
Ben Woo af7d5a8cb0 Remove useless MultiverseCoreListener 2023-09-25 14:08:51 +08:00
Ben Woo a44361f5e4 Merge pull request #3034 from Multiverse/zax71/MV5/gameruleCommandMerge
Zax71/mv5/gamerule command merge
2023-09-25 13:31:20 +08:00
Ben Woo 8d508358f7 Implement gamerule reset 2023-09-25 12:29:29 +08:00
Zax71 7c6d7d5883 Merge /mv gamerule and /mv gamerules 2023-09-24 10:34:11 +01:00
Ben Woo c78dbcd395 Implement ListValueNode and modify actions 2023-09-24 11:11:48 +08:00
Ben Woo b2c1aafb62 Make sure nodes is not null and fix some checkstyles 2023-09-23 10:14:10 +08:00
Ben Woo d08e6fae38 Merge pull request #3032 from Multiverse/zax71/MV5/GeneratorsCommand
Add `/mv generators` command
2023-09-23 09:52:17 +08:00
Ben Woo d6ccbd9eee Fix some checkstyles for generator command 2023-09-23 09:50:22 +08:00
Ben Woo d880ea95ed Merge pull request #3031 from Multiverse/ben/mv5/issuer-methods
Support more variety of message payload for MVCommandIssuer
2023-09-23 09:41:07 +08:00
Ben Woo 38aa2acf8e Merge pull request #3030 from Multiverse/zax71/MV5/InfoCommand
Add `/mv info`
2023-09-23 09:40:41 +08:00
Ben Woo 5845fdd541 Merge pull request #3027 from Multiverse/ben/mv5/config-suggest-parser
Implement autocomplete and string parsing for config handling
2023-09-23 09:39:15 +08:00
Ben Woo 01cfcc5684 Merge pull request #3019 from Multiverse/ben/mv5/teleporter
Ben/mv5/teleporter
2023-09-23 09:38:55 +08:00
Ben Woo 62a4e7e27d Merge pull request #3028 from Multiverse/ben/mv5/remove-unsafecallwrapper
Remove UnsafeCallWrapper as now we use varv Try
2023-09-23 09:38:39 +08:00
Zax71 ac174dcf66 Add /mv generators 2023-09-22 19:03:19 +01:00
Ben Woo 4095829eca Replace properties method in MVConfig to StringPropertyHandle 2023-09-22 23:09:31 +08:00
Ben Woo 13dc1bd0d0 Support more variety of message payload for MVCommandIssuer 2023-09-22 17:44:44 +08:00
Ben Woo 3a6c52337f Add more properties to info command and refactor 2023-09-22 17:20:41 +08:00
Ben Woo 61e3ffb7e5 Add null value formatting for MapContentProvider 2023-09-22 17:20:13 +08:00
Ben Woo 41f9989eef Fix more checkstyles and use LinkedHashMap for info command 2023-09-22 16:09:04 +08:00
Ben Woo 896524b57a Check some checkstyles for info command 2023-09-22 15:46:54 +08:00
Zax71 42ca91d05b Add /mv info 2023-09-21 18:54:49 +01:00
Ben Woo 5db5b948cc Fix some related checkstyles 2023-09-21 11:47:20 +08:00
Ben Woo 2e5679491c Remove UnsafeCallWrapper as now we use varv Try 2023-09-21 11:36:55 +08:00
Ben Woo 980d6784df Merge branch 'MV5' into ben/mv5/teleporter
# Conflicts:
#	src/main/java/org/mvplugins/multiverse/core/commands/RemoveCommand.java
2023-09-21 11:23:05 +08:00
Ben Woo a2f6e201d0 Add injection test for AsyncSafetyTeleporter 2023-09-21 11:20:23 +08:00
Ben Woo f2e193eda3 Improve node suggest javadocs 2023-09-20 23:39:04 +08:00
Ben Woo 4084cd4af1 Move property handling to a separate class 2023-09-20 23:35:10 +08:00
Ben Woo 6fe87fbc7b Implement autocomplete and string parsing for config handling 2023-09-20 16:32:25 +08:00
Ben Woo 6611ec4457 Make defaultValue a supplier and fix some checkstyle in ConfigNode 2023-09-20 13:45:14 +08:00
Ben Woo e4bff69372 Pass multiverse core instance directly into WorldConfigNodes 2023-09-20 12:39:59 +08:00
Ben Woo 5dba08dd1b Merge pull request #3025 from Multiverse/ben/mv5/fix-remove-locale
Fix remove success message key
2023-09-20 12:34:02 +08:00
Ben Woo 2e0ce517a8 Merge pull request #3026 from Multiverse/ben/mv5/enum-completion
Implement lowercased enum completion and fix some checkstyles
2023-09-20 12:33:47 +08:00
Ben Woo 7fcfa64538 Merge pull request #3024 from Multiverse/ben/mv5/mv-world-oncontext
Ben/mv5/mv world oncontext
2023-09-20 12:33:33 +08:00
Ben Woo cce041877f Cleanup NodeGroup with docs and annotation 2023-09-20 12:31:34 +08:00
Ben Woo 6ba51fa573 Implement lowercased enum completion and fix some checkstyles 2023-09-20 12:25:03 +08:00
Ben Woo bbfc1a05e8 Cleanup MultiverseCommand and add docs 2023-09-20 12:18:04 +08:00
Ben Woo 80fcf8fe19 Fix remove success message key 2023-09-20 12:10:02 +08:00
Ben Woo b99de26deb Use MultiverseWorld instead of worldname string for RemoveCommand 2023-09-20 12:06:08 +08:00
Ben Woo fb240a19fa Add context resolving for MultiverseWorld class 2023-09-20 12:02:29 +08:00
Ben Woo 180680f297 Add method to get MultiverseWorld from a bukkit world. 2023-09-20 12:01:26 +08:00
Ben Woo 91f9842b24 Merge pull request #3022 from Multiverse/dtm/mv5/teleporter_attempt
Add AsyncAttempt.
2023-09-14 22:34:34 +08:00
Ben Woo bf8244e587 Refactor some async attempt handling 2023-09-14 11:30:35 +08:00
Ben Woo 94bcca914f Add warning of player still in world while unloading 2023-09-14 11:26:07 +08:00
Ben Woo 23b429940c Fully implement AsyncResult 2023-09-14 11:03:45 +08:00
Jeremy Wood 3df46bc55c Add AsyncAttempt for example purposes. 2023-09-13 16:16:47 -04:00
Ben Woo 2f3306aa97 Add class level docs for AsyncResult 2023-09-14 00:37:33 +08:00
Ben Woo 82c84c2c7c Implement AsyncResult, a wrapper for CompletableFuture 2023-09-14 00:36:22 +08:00
Ben Woo 2642d940ba Clearer docs for tolerance and radius for getSafeLocation 2023-09-13 23:32:10 +08:00
Ben Woo 404ab738c0 Fix imports 2023-09-13 23:21:23 +08:00
Ben Woo bc1a2ff8a1 Merge branch 'MV5' into ben/mv5/teleporter
# Conflicts:
#	src/main/java/org/mvplugins/multiverse/core/commands/DeleteCommand.java
#	src/main/java/org/mvplugins/multiverse/core/commands/RegenCommand.java
#	src/main/java/org/mvplugins/multiverse/core/commands/RemoveCommand.java
#	src/main/java/org/mvplugins/multiverse/core/commands/UnloadCommand.java
#	src/main/java/org/mvplugins/multiverse/core/destination/core/CannonDestination.java
#	src/main/java/org/mvplugins/multiverse/core/destination/core/ExactDestination.java
#	src/main/java/org/mvplugins/multiverse/core/destination/core/WorldDestination.java
#	src/main/java/org/mvplugins/multiverse/core/listeners/MVPlayerListener.java
#	src/main/java/org/mvplugins/multiverse/core/permissions/CorePermissionsChecker.java
#	src/main/java/org/mvplugins/multiverse/core/world/LoadedMultiverseWorld.java
#	src/main/java/org/mvplugins/multiverse/core/world/helpers/PlayerWorldTeleporter.java
2023-09-13 23:04:36 +08:00
Jeremy Wood db0d5da5ce Merge pull request #3020 from Multiverse/ben/mv5/nuke-worldmanager
Nuke the old world manager
2023-09-13 09:55:32 -04:00
Ben Woo fbab3bc269 Nuke the old world manager 2023-09-12 23:05:51 +08:00
Ben Woo ba93195671 Move logic of teleporting players out of world from world manager 2023-09-12 18:07:12 +08:00
Ben Woo 9ddfa59712 Merge branch 'MV5' into ben/mv5/teleporter
# Conflicts:
#	src/main/java/org/mvplugins/multiverse/core/commands/TeleportCommand.java
2023-09-12 17:25:50 +08:00
Ben Woo 6f014838e9 Cleanup commands checkstyle and flags 2023-09-12 17:22:20 +08:00
Ben Woo ef2b42d9a0 Check for destination's checkTeleportSafety 2023-09-12 16:36:43 +08:00
Ben Woo 245fac98e5 Implement new AsyncSafetyTeleporter 2023-09-12 16:33:43 +08:00
Ben Woo 0e43444523 Merge pull request #3018 from Multiverse/ben/mv5/player-world-action
Implement player world actions and some refactor
2023-09-12 14:20:42 +08:00
Ben Woo f9bd7f136d Split PlayerWorldAction to PlayerWorldTeleporter and EnforcementHandler 2023-09-12 13:13:54 +08:00
Ben Woo a45849799d Implement player world actions and some refactor 2023-09-12 12:45:09 +08:00
Ben Woo 80dba5068c Merge pull request #2991 from zax71/MV5-always-spawn-location
Implement JoinDestination and EnableJoinDestination config options
2023-09-12 11:38:10 +08:00
Ben Woo b78941c0a0 Refactor join-destination config and use async teleport 2023-09-12 11:33:50 +08:00
Ben Woo dc3ec52d74 Merge branch 'MV5' into MV5-always-spawn-location 2023-09-12 11:27:38 +08:00
Ben Woo 57b27ce6e6 Fix hk2 ServiceLocatorGenerator 2023-09-12 11:16:30 +08:00
Ben Woo d6c8d5381f Merge branch 'MV5' into MV5-always-spawn-location
# Conflicts:
#	src/main/java/org/mvplugins/multiverse/core/config/MVCoreConfigNodes.java
#	src/main/java/org/mvplugins/multiverse/core/listeners/MVPlayerListener.java
2023-09-12 10:38:04 +08:00
Ben Woo 5178d68828 Merge pull request #3017 from Multiverse/dtm/checkstyle/imports
Fix import order check.
2023-09-12 10:26:49 +08:00
Ben Woo f6ba48c5f2 Apply new import order changes 2023-09-12 10:24:58 +08:00
Jeremy Wood ede47e834b Fix import order check. 2023-09-11 22:17:47 -04:00
Ben Woo df7e333610 Merge pull request #3016 from Multiverse/ben/mv5/repackage
Move package to org.mvplugins.multiverse.core
2023-09-12 01:03:17 +08:00
Ben Woo 48f9e65321 Change third party relocate to org.mvplugins.multiverse.external. 2023-09-12 01:02:00 +08:00
Ben Woo 474630d1ff Move package to org.mvplugins.multiverse.core 2023-09-12 00:56:20 +08:00
Ben Woo 1812315033 Merge pull request #3015 from Multiverse/ben/mv5/import-refactor
Optimise all imports
2023-09-12 00:45:18 +08:00
Ben Woo e31ef1428c Fix import order checkstyle and remove comment 2023-09-12 00:43:46 +08:00
Ben Woo 256ac67cf1 Optimise all imports 2023-09-12 00:41:17 +08:00
Ben Woo 9dbe7e20ad Merge pull request #3014 from Multiverse/ben/mv5/a-lot-of-checkstyle
Fix a lot of checkstyles throughout
2023-09-12 00:29:14 +08:00
Ben Woo e005b266ea Add a todo about the todo checkstyle to enable todo warning after mv 2023-09-12 00:19:27 +08:00
Ben Woo 1dfdb611c6 Set back throw count to 0 2023-09-12 00:15:13 +08:00
Ben Woo dd4b01f922 Fix a lot of checkstyles throughout 2023-09-12 00:07:25 +08:00
Ben Woo 39f3805ef3 Fix all imports once and for all 2023-09-11 23:09:34 +08:00
Jeremy Wood d3fa42a035 Merge pull request #3013 from Multiverse/world-revamp-continue
Continue revamping World/WorldManager.
2023-09-11 10:42:47 -04:00
Ben Woo 46d115b2f3 Fix LocalizationTest 2023-09-11 22:13:48 +08:00
Ben Woo 690d956ce2 Merge branch 'MV5' into world-revamp-continue 2023-09-11 22:11:32 +08:00
Ben Woo ffec23c9ed Add docs and fix more checkstyles 2023-09-11 21:52:16 +08:00
Jeremy Wood d77fb43536 Add continue-on-error to step as well. 2023-09-11 08:48:23 -04:00
Jeremy Wood 86e2ab45fb Change checkstyle workflow back to PR annotations without failure. 2023-09-11 08:44:05 -04:00
Jeremy Wood 5a474d7efa Merge pull request #3010 from Multiverse/ben/mv5/nested-locale-message
Add support for nested Message within MessageReplacement and fix some checkstyles
2023-09-11 08:30:09 -04:00
Jeremy Wood ca9b244a89 Merge pull request #3011 from Multiverse/ben/mv5/upstream-checkstyle
Upstream checkstyle changes from world revamp
2023-09-11 08:13:42 -04:00
Ben Woo 329901afa6 Remove public from config nodes and remove names that are the same as path 2023-09-11 17:06:06 +08:00
Ben Woo 61570b1a7f Merge pull request #3012 from Multiverse/ben/mv5/improve-world-purge
Cleanup world purger and add docs
2023-09-11 16:48:31 +08:00
Ben Woo aa063007e8 Fix some checktyle issue in WorldPurger 2023-09-11 16:47:39 +08:00
Ben Woo 58c13c1f73 Copy spawn location when cloning world 2023-09-11 16:42:27 +08:00
Ben Woo c0f2168ba4 Copy spawn location only if seed didnt change on regen 2023-09-11 16:40:03 +08:00
Ben Woo ef0cb4b893 Do not apply spawn location if it's a null location 2023-09-11 16:39:34 +08:00
Ben Woo c2ff8a467f Make unsettable properties have null name 2023-09-11 16:38:49 +08:00
Ben Woo 404a2f4183 Cleanup adjust spawn logic 2023-09-11 16:03:36 +08:00
Ben Woo a4a5be20f9 Use .get() for world folder, since it should fail if null 2023-09-11 15:49:27 +08:00
Ben Woo 481933b948 Add support for removing players before unloading world 2023-09-11 15:39:06 +08:00
Ben Woo 379e0172c4 Fix regen world keeping seed not working 2023-09-11 15:38:28 +08:00
Ben Woo d8334ad71a Refactor world results and add docs 2023-09-11 14:35:56 +08:00
Ben Woo ba7b6ae951 Upstream checkstyle changes from world revamp 2023-09-11 13:40:50 +08:00
Ben Woo 1745c16bec Add support for nested Message within MessageReplacement and fix some checkstyles 2023-09-11 13:37:38 +08:00
Ben Woo 7490996ecb Make getWorldConfig return an Option 2023-09-11 11:49:52 +08:00
Ben Woo bf7a708fb3 Reorder and add more world blacklisted names 2023-09-11 11:41:40 +08:00
Ben Woo d02cd63244 Merge pull request #3008 from Multiverse/ben/mv5/results
Revamp results to support value returns
2023-09-11 10:55:08 +08:00
Jeremy Wood 089655fada Fix some more checkstyle issues. 2023-09-10 13:35:25 -04:00
Jeremy Wood 8ffd716190 Fix some checkstyle issues. 2023-09-10 13:34:36 -04:00
Ben Woo 99846b5567 Add javadocs and fix some checkstyles 2023-09-10 23:00:15 +08:00
Ben Woo 6f9f9085fd Refactor world results to remove success reason 2023-09-10 22:29:42 +08:00
Ben Woo 656d9ac208 Refactor map Attempt methods 2023-09-10 22:17:10 +08:00
Ben Woo 2fe6297b1d Fix unintended changes to result 2023-09-10 21:45:30 +08:00
Ben Woo c8fed72137 Refactor to Result<S, F> and Attempt<T, F> 2023-09-10 21:37:36 +08:00
Ben Woo f9877201f5 Revamp results to support value returns 2023-09-10 19:43:56 +08:00
Zax71andBen Woo d1bc67204b Update src/main/java/com/onarandombox/MultiverseCore/config/MVCoreConfigNodes.java
Co-authored-by: Ben Woo <30431861+benwoo1110@users.noreply.github.com>
2023-09-10 12:15:05 +01:00
Zax71 c8e1143e32 Implement requested changes 2023-09-10 10:22:13 +01:00
Ben Woo e318f1e86f Cleanup world purger and add docs 2023-09-10 15:03:05 +08:00
Ben Woo b780f5c2f3 Update gamerules command to new world manager api 2023-09-10 14:10:40 +08:00
Ben Woo 1740137d1e Merge branch 'MV5' into world-revamp-continue
# Conflicts:
#	src/main/java/com/onarandombox/MultiverseCore/commandtools/MVCommandCompletions.java
2023-09-10 14:05:41 +08:00
Ben Woo 323145ebf0 Merge pull request #3006 from Multiverse/ben/mv5/config-migrate
Implement worlds.yml config migrate
2023-09-10 14:04:03 +08:00
Ben Woo 1a2b88599a Merge pull request #3007 from Multiverse/dtm/mv5/world-revamp-continue-tweaks
WorldManager tweaks.
2023-09-10 14:01:18 +08:00
Ben Woo 903941eb01 Fix wildcard imports for worldmanager 2023-09-10 13:59:01 +08:00
Ben Woo b8c10c412d Improve gamerules command with filter and page flag 2023-09-10 13:56:50 +08:00
Ben Woo 95a1fddbe5 Fix some regression on command flag registering and completion 2023-09-10 13:54:44 +08:00
Jeremy Wood 1eb33c6972 Clean up some return counts in WorldManager. 2023-09-10 01:35:53 -04:00
Ben Woo b2ed43ba22 Add docs to new migration classes 2023-09-10 12:23:20 +08:00
Ben Woo c61c98ff5e Remove serializable including whitespace and newline 2023-09-10 12:03:35 +08:00
Ben Woo 13b9419b85 Improve and fix minor migration regressions 2023-09-10 11:55:00 +08:00
Jeremy Wood e81296015e Ignore DeclarationOrder check. 2023-09-09 23:54:05 -04:00
Jeremy Wood 6b40c3a190 Add interface for keeping world settings for options. 2023-09-09 23:53:45 -04:00
Ben Woo fcbaffc821 Implement basic config migration for worlds.yml 2023-09-10 00:50:58 +08:00
Jeremy Wood f556f6f98a Refactor populateWorldFromConfig to be smaller. 2023-09-09 11:48:54 -04:00
Jeremy Wood c340f16f63 Use different parameter number checks for methods and constructors. 2023-09-09 11:28:24 -04:00
Jeremy Wood 700b0cc81c Allow checkstyle suppression trailing comments. 2023-09-09 11:25:17 -04:00
Jeremy Wood 34b55e4b4d Merge pull request #3004 from Multiverse/dtm/mv5/world-revamp-continue-tweaks
Tweaks for world revamp
2023-09-09 11:19:22 -04:00
Jeremy Wood df0db292ed Fix incorrect world name var. 2023-09-09 11:19:10 -04:00
Jeremy Wood c1d2fe48f0 Reduce Result boilerplate in WorldManager. 2023-09-09 11:14:01 -04:00
Jeremy Wood ba5c054298 Add a bunch of missing package-info.java. 2023-09-09 10:54:10 -04:00
Jeremy Wood 503d054859 Temporarily reduce severity of PackageName check. 2023-09-09 10:52:59 -04:00
Jeremy Wood 6fd56e56e1 Create private message replacement methods in WorldManager. 2023-09-09 10:51:52 -04:00
Jeremy Wood 1affa421d3 Only report on warning/error. 2023-09-09 10:28:55 -04:00
Jeremy Wood 09e1e11016 Give pr write permission to checkstyle workflow. 2023-09-09 10:26:20 -04:00
Jeremy Wood 7a8bd674d2 Fix more checkstyle issues in WorldManager. 2023-09-09 10:23:13 -04:00
Ben Woo ac3666cf7c Merge pull request #3003 from Multiverse/ben/mv5/world-revamp-codestyle
Loosen up some codestyle
2023-09-09 22:21:45 +08:00
Jeremy Wood f5dc049b35 Loosen ClassFanOutComplexity check. 2023-09-09 10:14:59 -04:00
Jeremy Wood ffb578039f Try github-pr-review reporter for checkstyle workflow. 2023-09-09 10:02:10 -04:00
Jeremy Wood 654c12b627 Make checkstyle concessions. 2023-09-09 09:59:00 -04:00
Ben Woo c71bdd83d6 Merge pull request #2997 from Multiverse/better-flag-handling
Better flag handling
2023-09-09 20:05:21 +08:00
Ben Woo b70960d39c Add javadocs to new command flag methods 2023-09-09 20:02:50 +08:00
Ben Woo 2f65bf4597 Merge pull request #2992 from zax71/MV5-gamerules-command
Implement `/mv gamerules` command
2023-09-09 19:54:21 +08:00
Zax71 ee4a8c8ec9 Fix (some) of the checkstyle violations 2023-09-09 12:27:44 +01:00
Zax71 48ff8d8bd1 Switch to ContentDisplay API 2023-09-09 12:16:48 +01:00
Ben Woo 0f105b1777 pain: Add docs to the new world related classes 2023-09-09 13:46:32 +08:00
Ben Woo 4cbe2eaca9 Loosen up some codestyle 2023-09-09 12:32:37 +08:00
Ben Woo 8e95c22c4d Refactor and fix some world manager code style 2023-09-09 12:31:43 +08:00
Ben Woo 5c7c9ba465 Improve world config management with parsing of new and removed worlds on reload 2023-09-09 00:41:36 +08:00
Ben Woo b4617c1c1f Eradicate all reference of offline world 2023-09-08 23:41:26 +08:00
Ben Woo f0d2499dd2 Refactor multiverse world class and getters naming 2023-09-08 23:19:43 +08:00
Ben Woo 17f2f58c1d Fix clone command newworld replacement id 2023-09-08 23:10:47 +08:00
Ben Woo 27ff3b7a7b Merge pull request #3001 from Multiverse/dtm/mv5/world-revamp-continue-patch
Apply basic checkstyle fixes.
2023-09-08 22:43:14 +08:00
Jeremy Wood 8f439abd1b Merge remote-tracking branch 'origin/world-revamp-continue' into dtm/mv5/world-revamp-continue-patch
# Conflicts:
#	src/main/java/com/onarandombox/MultiverseCore/worldnew/WorldManager.java
2023-09-08 09:13:41 -04:00
Jeremy Wood 035005bac3 Apply basic checkstyle fixes to DataStore. 2023-09-08 09:08:30 -04:00
Jeremy Wood 324328f254 Apply basic checkstyle fixes to WorldConfigManager. 2023-09-08 09:07:46 -04:00
Jeremy Wood 7582a84cc6 Apply basic checkstyle fixes to WorldConfigNodes. 2023-09-08 09:07:21 -04:00
Ben Woo cadb931d4c Fix adjust spawn not applying 2023-09-08 21:05:57 +08:00
Jeremy Wood 93d23115ff Apply basic checkstyle fixes to WorldConfig. 2023-09-08 09:04:23 -04:00
Jeremy Wood 58d37e93ee Apply basic checkstyle fixes to NullLocation. 2023-09-08 09:03:10 -04:00
Jeremy Wood 11edd8e631 Apply basic checkstyle fixes to WorldPurger. 2023-09-08 09:02:17 -04:00
Jeremy Wood caba4100a3 Apply basic checkstyle fixes to OfflineWorld. 2023-09-08 08:59:36 -04:00
Jeremy Wood 7726cf3485 Apply basic checkstyle fixes to MVWorld. 2023-09-08 08:58:43 -04:00
Jeremy Wood 1ca6b20755 Apply basic checkstyle fixes to WorldManager. 2023-09-08 08:52:35 -04:00
Ben Woo 9c703ff329 Fix clone world ignore file 2023-09-08 19:51:08 +08:00
Ben Woo 0513865f43 Use Try<Void> for config loading and saving 2023-09-08 19:43:04 +08:00
Ben Woo f1ee2ee227 Merge branch 'MV5' into world-revamp-continue 2023-09-08 15:50:59 +08:00
Jeremy Wood 4f987da090 Merge remote-tracking branch 'origin/main' into MV5 2023-09-08 01:43:37 -04:00
Jeremy Wood 17129f68d2 Merge pull request #3000 from Multiverse/dtm/checkstyle/fix_lparen
Fix lparen issues in checkstyle.
2023-09-08 01:43:03 -04:00
Jeremy Wood e00b06692f Remove LPAREN from SeparatorWrap check. 2023-09-08 01:42:21 -04:00
Jeremy Wood c4063ed5e7 Merge pull request #2999 from Multiverse/dtm/mv5/merge_main
Merge main into MV5.
2023-09-08 01:26:46 -04:00
Jeremy Wood 25a5013a6c Merge remote-tracking branch 'origin/main' into dtm/mv5/merge_main 2023-09-08 01:22:29 -04:00
Jeremy Wood a2339fac2f Merge pull request #2998 from Multiverse/dtm/checkstyle/fix_checkstyle
Soften up checkstyle significantly.
2023-09-08 01:21:33 -04:00
Jeremy Wood 227cddab7c Soften up checkstyle significantly. 2023-09-08 01:19:06 -04:00
Ben Woo f9c6c441e1 Add back /mvtp shorthand command 2023-09-07 23:54:51 +08:00
Ben Woo 3cdf9736ec Refactor a better method of registering and using command flags 2023-09-07 23:31:54 +08:00
Ben Woo 89c6eb41cb Refactor clone world into multiple smaller methods 2023-09-07 22:53:53 +08:00
Ben Woo 7ab8f219dd Better copy folder implementation with try 2023-09-07 22:05:45 +08:00
Ben Woo 6ebcd40a50 Implement remaining locales for clone and regen 2023-09-07 12:20:28 +08:00
Ben Woo 6427881c98 Finish up clone command 2023-09-07 12:07:01 +08:00
Ben Woo 3ef72a993a Implement configurable transfer of data during regen 2023-09-07 11:50:30 +08:00
Ben Woo 9cb8724db2 Finish up regen world 2023-09-07 11:38:29 +08:00
Ben Woo a0fa27f926 Merge branch 'MV5' into world-revamp-continue 2023-09-07 10:30:35 +08:00
Ben Woo 0b7f3246a1 Remove GHA test checkstyle args 2023-09-07 10:30:11 +08:00
Ben Woo 7060e60ddd Merge branch 'MV5' into world-revamp-continue 2023-09-07 10:25:44 +08:00
Ben Woo a292c1bf7d Bump dependencies 2023-09-07 10:21:21 +08:00
Ben Woo 0c3d529285 Merge branch 'main' into MV5
# Conflicts:
#	config/mv_checks.xml
2023-09-07 10:04:54 +08:00
Ben Woo e84fb1f1ba Merge pull request #2996 from Multiverse/mockbukkit-bump
Bump MockBukkit with the onDisable fix
2023-09-07 10:04:05 +08:00
Ben Woo b51cd645bb Bump MockBukkit with the onDisable fix 2023-09-07 09:48:47 +08:00
Ben Woo ff88b30959 Merge pull request #2995 from Multiverse/dtm/no_gradle_checkstyle
Remove checkstyle from gradle.
2023-09-07 09:22:20 +08:00
Jeremy Wood fa6a01d690 Remove checkstyle from gradle. 2023-09-06 18:01:13 -04:00
Jeremy Wood 5f9a002a07 Merge pull request #2994 from Multiverse/dtm/checkstyle_upgrade
Upgrade Checkstyle & Rules.
2023-09-06 17:55:37 -04:00
Jeremy Wood 3198fcc4b1 Fix job name in pr.checkstyle.yml. 2023-09-06 17:54:19 -04:00
Jeremy Wood d50e8c1dde Remove checkstyle debug flag. 2023-09-06 17:49:59 -04:00
Jeremy Wood 87271aa4eb Revert "Test change that fails checkstyle."
This reverts commit 5b8984a492.
2023-09-06 17:49:41 -04:00
Jeremy Wood 5b8984a492 Test change that fails checkstyle. 2023-09-06 17:46:50 -04:00
Jeremy Wood 49fcadf434 Use the correct file extension for checkstyle config. 2023-09-06 17:43:25 -04:00
Jeremy Wood 950fe1217a Add reviewdog debug flag for checkstyle action. 2023-09-06 17:42:17 -04:00
Jeremy Wood 8b895d41f7 Add workflow for running and reporting checkstyle. 2023-09-06 17:37:31 -04:00
Jeremy Wood dcbcca9a62 Remove extra check. 2023-09-06 17:23:15 -04:00
Jeremy Wood bc830ee780 Configure Whitespace checkstyle. 2023-09-06 17:22:50 -04:00
Jeremy Wood 407dcb3125 Configure Regexp checkstyle. 2023-09-06 13:41:41 -04:00
Jeremy Wood 405a033d85 Configure Size Violations checkstyle. 2023-09-06 13:40:19 -04:00
Ben Woo 3f075169a4 Implement basic regen command 2023-09-07 00:27:25 +08:00
Ben Woo af2fc7c630 Implement basic clone command 2023-09-07 00:07:46 +08:00
Jeremy Wood 073d13cf4d Configure Naming Conventions checkstyle. 2023-09-06 12:05:47 -04:00
Jeremy Wood e8e8c4aff6 Configure Modifiers checkstyle. 2023-09-06 11:40:17 -04:00
Ben Woo 12aedc1942 Merge pull request #2993 from Multiverse/fix-binding
Fix binding plugin and bump MockBukkit
2023-09-06 23:33:11 +08:00
Ben Woo b78ea7c7ba Whoops wrong mockbukkit version 2023-09-06 23:22:38 +08:00
Ben Woo dbf0aeeb4c Add papermc repo for mockbukkit 2023-09-06 23:19:24 +08:00
Ben Woo 7246d433bc Fix binding plugin and bump MockBukkit 2023-09-06 23:07:16 +08:00
Jeremy Wood 67f2f1f6b0 Configure Miscellaneous checkstyle. 2023-09-06 10:03:44 -04:00
Jeremy Wood d7f236492b Configure Metrics checkstyle. 2023-09-06 09:43:37 -04:00
Jeremy Wood 086c3e8af0 Configure Imports checkstyle. 2023-09-06 09:26:00 -04:00
Jeremy Wood c62c1278ec Configure Coding checkstyle. 2023-09-06 09:17:31 -04:00
Jeremy Wood 1d47473cd3 Configure Class Design checkstyle. 2023-09-06 08:22:01 -04:00
Jeremy Wood f725723932 Configure Block Checks checkstyle. 2023-09-06 07:57:36 -04:00
Jeremy Wood 28edf86c96 Configure Annotation checkstyle. 2023-09-06 01:15:33 -04:00
Jeremy Wood ab2dd9d316 Configure Javadoc checkstyle. 2023-09-06 01:05:13 -04:00
Jeremy Wood e04b0faa85 Upgrade checkstyle to version 10.12.2. 2023-09-05 23:52:20 -04:00
Jeremy Wood 6a309f04dc Update dtd reference in mv_checks.xml. 2023-09-05 23:33:56 -04:00
Ben Woo f056dcdbc9 Better error handling of world folder deletion 2023-09-06 00:13:53 +08:00
Ben Woo d01a884025 Cleanup WorldManager and improve on locale results 2023-09-05 23:47:58 +08:00
Ben Woo eb5bb4e234 Implement locale error messages for wm result 2023-09-05 18:57:35 +08:00
Ben Woo 8fc2371077 Filter away already loaded worlds for getPotentialWorlds 2023-09-05 15:57:10 +08:00
Ben Woo fda0e038f5 Implement getPotentialWorlds 2023-09-05 15:54:51 +08:00
Ben Woo 80ff02a92b Improve import world result 2023-09-05 15:42:45 +08:00
Ben Woo e8ca95505b Implement new generator API 2023-09-05 15:17:27 +08:00
Ben Woo ec0000bc8a Fix wrong context optional check and arg being null 2023-09-05 00:21:32 +08:00
Ben Woo 82f47af924 Completely remove the old WorldManager from startup 2023-09-05 00:08:38 +08:00
Ben Woo fe26ccb1eb Make spawning amount apply and rename it 2023-09-04 23:58:47 +08:00
Ben Woo f519639893 Fix weather and spawning 2023-09-04 23:48:35 +08:00
Ben Woo 5278eccad2 Fix imports for reload command 2023-09-04 23:30:26 +08:00
Ben Woo 32fb25854f Migrate portal, entity and worldpurger to new wm 2023-09-04 23:30:13 +08:00
Ben Woo c253dc1322 Fix gamerule command permission 2023-09-04 21:51:22 +08:00
zax71 1ac54b7e1d Add i18n 2023-09-04 13:08:39 +01:00
zax71 3b7a801a0c Implement JoinDestination and EnableJoinDestination config options 2023-09-04 12:30:50 +01:00
Ben Woo 0a62081d03 Move weather handling to new wm 2023-09-04 13:37:29 +08:00
Ben Woo 0824108109 Move chat prefix to new wm and fix more imports 2023-09-04 11:33:53 +08:00
Ben Woo c62aa91db7 Move world listener to handle new world manager 2023-09-04 11:27:25 +08:00
Ben Woo 90eb1c882b Dumps command use new wm and fix some imports 2023-09-04 10:48:08 +08:00
Ben Woo 891f7ca136 Remove old wm reference in bstats, tests and placeholders 2023-09-04 10:34:32 +08:00
Ben Woo 55703e6f39 Merge pull request #2989 from zax71/MV5-fix-dumps-command
Fix /mv dumps to support ANSI and UTF-8 encoded log files
2023-09-04 09:59:30 +08:00
Ben Woo f280e2076c Minor cleanup 2023-09-04 09:54:00 +08:00
zax71 17dff457b2 Chore: codestyle changes 2023-09-03 17:36:14 +01:00
Ben Woo 4eb8dfbc67 Move command completion, context, conditions to new world manager api 2023-09-04 00:16:44 +08:00
Ben Woo 08b87cba39 Move destination to new world manager api 2023-09-03 23:42:38 +08:00
Ben Woo 791d8b653c Allow permission check for offline worlds 2023-09-03 23:40:08 +08:00
Ben Woo 6f673066a8 Fix list command permissions checking 2023-09-03 23:38:22 +08:00
Ben Woo f524c5bdde Implement proper spawn location 2023-09-03 23:25:10 +08:00
Ben Woo dc75e87223 Move entrycheck, playerlistener and worldnamechecker to api 2023-09-03 22:21:28 +08:00
Ben Woo d77d7032dd Update list command and fix importWorld bug 2023-09-03 16:15:55 +08:00
Ben Woo fa4391e543 Merge branch 'MV5' into world-revamp-continue 2023-09-03 15:52:56 +08:00
Ben Woo 046840f0d9 refactor: Remove deprecated and unused classes 2023-09-03 15:52:02 +08:00
Ben Woo 3356757c13 Implement proper reloading of worlds config 2023-09-03 15:39:57 +08:00
Ben Woo dff192f3ce Make MVWorld constructor non-public 2023-09-03 14:55:39 +08:00
Ben Woo f2a3d3f85a Refactor newMVWorld instance creation 2023-09-03 14:53:51 +08:00
Ben Woo 550dae92e9 Implement more world manager features 2023-09-03 14:35:27 +08:00
zax71 1fef714b8f Fix /mv dumps to support ANSI and UTF-8 encoded log files 2023-09-02 19:08:09 +01:00
zax71 b42b77b0bf implement /mv gamerules command 2023-09-02 18:04:31 +01:00
Ben Woo b154606922 Finish basic CRUD for new world management 2023-09-03 00:51:07 +08:00
Ben Woo 7828c92926 Add entryfee, spawning and spawn location 2023-09-02 23:07:39 +08:00
Ben Woo 1f7b8ffa96 Add remaining world properties methods 2023-09-02 22:30:06 +08:00
Ben Woo 35993419ca Implement basic load, unload and remove world 2023-09-02 21:59:53 +08:00
Ben Woo a8fbeb53d4 Update bukkit world when world config node set 2023-09-02 17:04:30 +08:00
Ben Woo e1eae48bc7 Implement basic create and delete world 2023-09-02 16:54:33 +08:00
Ben Woo 5dd22b5d9b Basic mvworld and offline world 2023-09-02 16:12:34 +08:00
Ben Woo 07b543a845 Implement AddWorldOptions to condense method parameters 2023-09-02 15:19:30 +08:00
Ben Woo f7295e2c2e Cleanup TODO messages 2023-09-02 14:50:10 +08:00
Ben Woo a7644b6866 Merge pull request #2975 from zax71/MV5-version-command
Implement `/mv dumps` command
2023-09-01 23:52:45 +08:00
Ben Woo 381f440a6b Merge branch 'MV5' into MV5-version-command 2023-09-01 23:42:55 +08:00
Ben Woo 4300d83c90 Merge pull request #2986 from zax71/MV5-coord-command
Add `/mv coordinates` command
2023-09-01 23:42:04 +08:00
Ben Woo adcbcdb7df Merge pull request #2987 from Multiverse/new-config-migrate
Do not migrate if new config file is created
2023-09-01 23:41:51 +08:00
Ben Woo b57b70aa28 Merge pull request #2988 from Multiverse/world-config-props
World config props
2023-09-01 23:41:38 +08:00
Ben Woo 7a8f468f98 Minor refactor to dumps command 2023-09-01 23:39:36 +08:00
Ben Woo 867f4a447d Better error handling for finding files in server directory 2023-09-01 23:33:30 +08:00
Ben Woo 55aac81258 Merge branch 'MV5' into pr/2975
# Conflicts:
#	src/main/java/com/onarandombox/MultiverseCore/world/SimpleMVWorldManager.java
2023-09-01 23:28:05 +08:00
Ben Woo 194dc8ef8a Fix error message i18n path key 2023-09-01 23:26:23 +08:00
Ben Woo c7c344730b Minor refactor to coord command and fix tests 2023-09-01 23:21:57 +08:00
Zax71andBen Woo f8b75c0781 Update src/main/java/com/onarandombox/MultiverseCore/commands/CoordinatesCommand.java
Co-authored-by: Ben Woo <30431861+benwoo1110@users.noreply.github.com>
2023-09-01 23:20:09 +08:00
Zax71 dc89161a04 refactor: rename permission 2023-09-01 23:20:08 +08:00
zax71 90522a014e Add /mv coordinates 2023-09-01 23:20:08 +08:00
Ben Woo 6effeacd1b Add getWorldConfig method 2023-09-01 11:20:25 +08:00
Ben Woo 42eadd91a5 Adda remaining properties methods to WorldConfig 2023-09-01 11:00:59 +08:00
Ben Woo 1b2f8889ce Do not migrate if new config file is created 2023-09-01 00:03:29 +08:00
Ben Woo 1e9f19b01f Merge pull request #2841 from Multiverse/list-command
feat: Implement list command
2023-08-31 23:58:56 +08:00
Ben Woo da1d059b84 Update list command to new api changes 2023-08-31 23:55:40 +08:00
Ben Woo 55805aa618 Merge branch 'MV5' into list-command
# Conflicts:
#	src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java
2023-08-31 23:34:10 +08:00
Ben Woo d1ff487a00 Merge pull request #2984 from Multiverse/worlds-config
Worlds config
2023-08-31 23:27:10 +08:00
Ben Woo 5208028e65 Add todo on comparing config file 2023-08-31 23:25:30 +08:00
Ben Woo 55fd08e0b1 Remove stray white spacing 2023-08-31 23:22:23 +08:00
Ben Woo 904bd8634a Improve tests for world config file 2023-08-31 23:21:27 +08:00
Ben Woo 02b02530bd Revert delete command changes 2023-08-31 23:02:19 +08:00
Ben Woo 5fca5b18b8 Remove from commands and add to tests 2023-08-31 22:58:33 +08:00
Ben Woo aa412b1060 Add todo for loading worlds 2023-08-31 15:17:51 +08:00
Ben Woo 54c8bac3d3 Config node automatically use the enum node serializer 2023-08-31 15:16:41 +08:00
Ben Woo decf20f95f Add basic tests for world config 2023-08-31 14:59:31 +08:00
Ben Woo 6888783d01 Implement world blacklist config 2023-08-31 14:21:33 +08:00
Ben Woo c569bc797f Implement node serialisation 2023-08-31 14:21:33 +08:00
Ben Woo 5dba9b5904 Starting to shift worlds.yml to new config api 2023-08-31 14:21:32 +08:00
Ben Woo 55b21bf17e Fix config tests 2023-08-31 14:14:55 +08:00
Ben Woo 4ff1663353 Temp fix to fix tests 2023-08-31 14:03:03 +08:00
zax71 ac6d42549d Reorder logic to make it more readable 2023-08-30 17:40:52 +01:00
zax71 b500afd8f0 Whitespace fixes 2023-08-30 17:28:04 +01:00
zax71 0c79c6577e Rename Services and LogsType enums 2023-08-30 17:26:15 +01:00
zax71 2b7d1412b5 Remove uploading message and print out directly 2023-08-30 17:23:19 +01:00
zax71 560a6d4d7e Fix whitespace 2023-08-30 17:16:51 +01:00
zax71 8444383f16 Update command syntax 2023-08-30 17:15:17 +01:00
zax71 de77d09eaa Move getBukkitConfig() and getServerProperties()` into FileUtils.java 2023-08-30 17:13:31 +01:00
zax71 69fdfcfd9f Fix syntax 2023-08-30 17:03:28 +01:00
Ben Woo cbf44cb918 Merge pull request #2928 from Multiverse/perm-revamp-3
feat: Revamp teleport world entry checking
2023-08-30 23:38:58 +08:00
Jeremy Wood cb7ee2fc26 Merge pull request #2974 from Multiverse/update-readme
docs: Improve the readme badges
2023-08-30 11:28:34 -04:00
zax71 bf663a76dc Add debug logging (in /mv debug 3) 2023-08-30 11:55:23 +01:00
zax71 4f756a4c2d Change flags used 2023-08-30 11:52:28 +01:00
Ben Woo d2b18b8545 Merge pull request #2982 from Multiverse/enum-flag
Specific flag builder for enum to streamline context and completion
2023-08-29 16:40:33 +08:00
Ben Woo 3800513dc5 Merge pull request #2983 from Multiverse/conditions-id
Fix command conditions not registering and lowercased
2023-08-29 12:16:17 +08:00
Ben Woo 74e7a1c9f3 Merge branch 'MV5' into perm-revamp-3 2023-08-29 10:55:52 +08:00
Ben Woo 0ddb5563be Fix command conditions not registering and lowercased 2023-08-29 10:54:22 +08:00
Ben Woo bf8bca3244 Specific flag builder for enum to streamline context and completion 2023-08-29 10:44:25 +08:00
Jeremy Wood 59d211ce92 Replace dependencies that were dropped accidentally. 2023-08-28 15:42:16 -04:00
Jeremy Wood cba5f7c9d1 Fix up MV5 gradle configurations. 2023-08-28 15:33:41 -04:00
Jeremy Wood 542f321889 Merge remote-tracking branch 'origin/main' into MV5
# Conflicts:
#	.github/workflows/promote_release.yml
#	.github/workflows/release.yml
#	build.gradle
#	src/main/java/com/onarandombox/MultiverseCore/commands/RegenCommand.java
#	src/main/java/com/onarandombox/MultiverseCore/listeners/MVPlayerListener.java
2023-08-28 15:31:34 -04:00
zax71 fa81f5b573 paste.gg and mclo.gs default 2023-08-28 16:45:57 +01:00
Jeremy Wood 2143930fac Merge pull request #2980 from Multiverse/remove-modirnth-plugin
Remove modrinth gradle plugin
2023-08-28 09:57:01 -04:00
zax71 5af06d9a0f Switch from hastebin to pastes.dev and fix non multi-file services 2023-08-28 14:38:42 +01:00
Ben Woo 5f12aa53b4 Remove modrinth gradle plugin 2023-08-28 00:15:39 +08:00
Jeremy Wood 1d371fb625 Merge pull request #2979 from Multiverse/hangar-api
Update hangar plugin deps bcu they changed the API
2023-08-27 12:09:40 -04:00
Ben Woo 320dc82b83 Update hangar plugin deps bcu they changed the API 2023-08-27 18:21:16 +08:00
Ben Woo e06536acd6 Command manager already a parent class field 2023-08-27 13:48:03 +08:00
Ben Woo 39c702a5fc Remove custom sendMessage method 2023-08-27 13:46:47 +08:00
Ben Woo 317b2c679f Minor code style fixes 2023-08-27 13:45:06 +08:00
Ben Woo 5e9739bda9 Merge branch 'MV5' into pr/2975
# Conflicts:
#	src/main/java/com/onarandombox/MultiverseCore/configuration/node/NodeGroup.java
2023-08-27 13:19:32 +08:00
Ben Woo 954e304f3a Merge pull request #2977 from zax71/codestyle-changes 2023-08-26 19:26:51 +08:00
zax71 1f7ad9d27f Add i18n 2023-08-26 11:53:15 +01:00
zax71 f261d88b4a Fix codestyle 2023-08-26 11:28:58 +01:00
zax71 949eb44447 Invert --include-plugin-list to --exclude-plugin-list 2023-08-26 11:25:10 +01:00
zax71 4750839497 Yeet all the wildcard imports 2023-08-26 11:19:11 +01:00
zax71 260777303c Implement /mv dumps command 2023-08-25 19:52:45 +01:00
Ben Woo 3683f93522 docs: Improve the readme badges 2023-08-25 13:25:53 +08:00
Jeremy Wood 288474cd20 Merge pull request #2973 from Multiverse/generic-test
feat: Generify test action
2023-08-24 22:40:54 -04:00
Ben Woo 16ceaa4c40 feat: Generify test action 2023-08-25 10:23:54 +08:00
Jeremy Wood e9f55e43ee Merge pull request #2972 from Multiverse/dtm/fix_pom_deps
Fix dependency set for maven pom.
2023-08-24 22:00:15 -04:00
Jeremy Wood 31f4f20bd8 Allow tests to see compileOnly dependencies. 2023-08-24 13:50:04 -04:00
Jeremy Wood bae909a9e8 Mark runtime dependency as provided in pom. 2023-08-24 13:49:48 -04:00
Jeremy Wood ee5408764f Fix dependency set for maven pom. 2023-08-24 13:28:02 -04:00
Ben Woo e2e0574baa Merge pull request #2971 from zax71/hangar-readme-badge
Add Hangar README.md badge
2023-08-24 23:49:00 +08:00
zax71 e1b6bf75b0 Add Hangar README.md badge 2023-08-24 16:44:53 +01:00
Ben Woo 7017689758 Merge pull request #2970 from Multiverse/optional-deps
feat: Add optional deps references
2023-08-24 22:52:47 +08:00
Ben Woo 58d51f57e5 feat: Add optional deps references 2023-08-24 22:45:36 +08:00
Jeremy Wood ccd417db3e Merge pull request #2969 from Multiverse/dtm/manual_hangar
Switch to manual only prereleases on Hangar.
2023-08-24 08:46:40 -04:00
Jeremy Wood 0eb67bee9c Switch to manual only prereleases on Hangar. 2023-08-24 08:44:39 -04:00
Ben Woo 9b22bdf2ab Merge pull request #2967 from Multiverse/generic-action
Generify actions and add hangar upload
2023-08-24 19:31:50 +08:00
Ben Woo 91e5d343cd Generify actions and add hangar upload 2023-08-24 17:04:57 +08:00
Ben Woo 743feea807 Merge pull request #2965 from Multiverse/fix-cancel-logic 2023-08-23 19:43:48 +08:00
Ben Woo d5d1c94566 fix: Cancel condition for platform upload 2023-08-23 13:00:47 +08:00
Ben Woo f67d8efb44 Merge pull request #2964 from Multiverse/actions-better 2023-08-23 11:45:00 +08:00
Ben Woo 70132c0da4 fix: Remove debug echos 2023-08-23 11:09:23 +08:00
Ben Woo 9c3914d409 Run upload to platform even if the other fails 2023-08-23 11:05:25 +08:00
Ben Woo db89482e29 fix: Use github output instead of env 2023-08-23 11:04:36 +08:00
Ben Woo fdb9125f3a Merge pull request #2963 from Multiverse/update-action
chore: Use major versioning for actions that supports
2023-08-23 10:58:20 +08:00
Ben Woo c3b17d33c3 chore: Use major versioning for actions that supports 2023-08-23 10:49:49 +08:00
Jeremy Wood e9d8db668f Merge pull request #2961 from Multiverse/update-semantic-action-version
fix: Version failing if more than pre.10
2023-08-22 13:43:10 -04:00
Ben Woo 60a4b6fc89 fix: Version failing if more than pre.10 2023-08-22 23:45:48 +08:00
Jeremy Wood f59267374f Merge pull request #2960 from Multiverse/revamp-actions
feat: Revamp github actions workflow
2023-08-22 10:29:24 -04:00
Ben Woo b1c0e94a4b fix: Update for production 2023-08-22 21:38:23 +08:00
Ben Woo 61254bfccb feat: Revamp github actions workflow 2023-08-22 21:35:10 +08:00
Ben Woo 3f5a17e39a Merge pull request #2958 from Multiverse/modrinth-label
chore: Add modrinth label to readme
2023-08-22 12:18:38 +08:00
Ben Woo 7c6f1b5fc4 chore: Add modrinth label to readme 2023-08-22 12:08:15 +08:00
Jeremy Wood 06b87801fe Merge pull request #2957 from Multiverse/directory-issue
fix: DBO file path issue
2023-08-21 23:59:54 -04:00
Ben Woo a92e5c95aa fix: DBO file path issue 2023-08-22 11:56:28 +08:00
Jeremy Wood 590972c933 Merge pull request #2956 from Multiverse/modrinth-versioning
Fix versioning
2023-08-21 23:51:26 -04:00
Ben Woo 007b7149a1 fix: DBO release type 2023-08-22 11:37:00 +08:00
Ben Woo 8b18ccbd1d fix: Modrinth task versioning 2023-08-22 11:36:20 +08:00
Jeremy Wood 73e0b30836 Merge pull request #2955 from Multiverse/tag-input-inconsistent
fix: Tag name and input inconsistency
2023-08-21 23:29:55 -04:00
Ben Woo 42c8e414c2 fix: Tag name and input inconsistency 2023-08-22 11:27:30 +08:00
Ben Woo 82a274bad2 Merge pull request #2954 from Multiverse/fix-release-type
fix: Release mode for release promotion
2023-08-22 11:14:08 +08:00
Ben Woo 8aa01026ea fix: Release mode for release promotion 2023-08-22 11:12:13 +08:00
Ben Woo 750d1ea4fa Merge pull request #2953 from Multiverse/fix-download-artifact
fix: Download artifact wrong file version
2023-08-22 11:02:38 +08:00
Ben Woo 586ac4a90e fix: Download artifact wrong file version 2023-08-22 10:56:59 +08:00
Jeremy Wood 816d5f86d6 Merge pull request #2952 from Multiverse/fix-version
fix: Version of fetch-gh-release-asset
2023-08-21 22:50:46 -04:00
Ben Woo 7e8ebfb8cd fix: Version of fetch-gh-release-asset 2023-08-22 10:47:50 +08:00
Jeremy Wood 350d228975 Merge pull request #2951 from Multiverse/release-actions
Revamp release actions
2023-08-21 22:44:19 -04:00
Ben Woo 2126efe27c fix: Remove error echo message 2023-08-22 10:24:52 +08:00
Ben Woo 3330bd3031 feat: Remove PR labeler and change "no version bump" to "no release" 2023-08-22 09:48:46 +08:00
Ben Woo 4f5b4126f4 Merge branch 'main' into release-actions 2023-08-21 23:26:04 +08:00
Ben Woo c4a80d7b78 feat: use new semantic release action for release promote 2023-08-21 23:22:35 +08:00
Ben Woo d31f7e9d87 fix: Modrinth upload action missing steps 2023-08-21 23:15:25 +08:00
Ben Woo 356d67edf4 feat: Use new semantic release action 2023-08-21 23:00:00 +08:00
Jeremy Wood 8865cfb53f Merge pull request #2948 from Multiverse/fix-null-teleporter
Fix teleporter reference being null
2023-08-20 23:23:15 -04:00
Ben Woo bf72328c37 feat: Complete release actions to DBO and Modrinth 2023-08-20 22:16:20 +08:00
Ben Woo 9a80620aa1 Fix teleporter reference being null 2023-08-20 20:26:52 +08:00
Ben Woo 982eb28f2a Merge pull request #2950 from Multiverse/dbo-upload
Add github action for DBO upload
2023-08-20 19:52:41 +08:00
Ben Woo 4ecd65a589 Add github action for DBO upload 2023-08-20 19:51:02 +08:00
Ben Woo 5fbe16ed5a Merge pull request #2949 from Multiverse/fix-regen-args
Fix regen args parsing logic
2023-08-20 19:50:40 +08:00
Ben Woo 582d256f38 Fix regen args parsing logic 2023-08-19 12:11:13 +08:00
Jeremy Wood 26e587805d Merge pull request #2947 from Multiverse/modrinth-for-promote-release
Upload to modrinth when manually promote release
2023-08-15 23:56:19 -04:00
Ben Woo 3ad2322db7 Upload to modrinth when manually promote release 2023-08-15 23:28:39 +08:00
Jeremy Wood 8764108edd Merge pull request #2946 from Multiverse/force-release
Remove line break from README.md
2023-08-15 10:52:13 -04:00
Jeremy Wood 5fa8e9acf6 Remove line break from README.md
This is just to force a new prerelease.
2023-08-15 10:51:47 -04:00
Jeremy Wood 0ead2da16f Merge pull request #2945 from Multiverse/modrinth-game-version
Fix add missing game version for modrinth
2023-08-15 10:46:59 -04:00
Ben Woo fd4bc7cf60 Fix add missing game version for modrinth 2023-08-15 22:35:10 +08:00
Jeremy Wood ad296fde1f Merge pull request #2944 from Multiverse/fix-modrinth-gha
Fix modrinth gha upload
2023-08-15 10:25:59 -04:00
Ben Woo 6f39a2c97d Fix modrinth gha upload 2023-08-15 14:54:16 +08:00
Jeremy Wood befb2b54d8 Merge pull request #2880 from Multiverse/modrinth-upload
feat: Add automatic Modrinth upload
2023-08-14 11:44:26 -04:00
Zax71 efcd14830e Remove unused GITHUB_TOKEN 2023-08-11 20:24:01 +01:00
Zax71 491bb2467f Add 1.20 to supported versions 2023-08-04 16:28:05 +01:00
Zax71 dfbe81c785 Implement requested changes 2023-08-03 11:11:29 +01:00
Ben Woo 8df371c90c refactor: Rename CheckResult to Result 2023-06-29 11:05:08 +08:00
Ben Woo ad47ab2340 feat: Revamp world entry checking 2023-06-29 11:05:08 +08:00
Ben Woo bd78b441ba Merge pull request #2929 from Multiverse/config_update
feat: Extract generic handler for config with ConfigurationSection
2023-06-29 11:03:14 +08:00
Ben Woo 3b384dbe6d docs: Add docs to new config classes 2023-06-28 20:18:26 +08:00
Ben Woo d1370bfb8c feat: Extract generic handler for config with ConfigurationSection 2023-06-28 19:41:33 +08:00
Ben Woo 314ce11630 Merge pull request #2930 from Multiverse/bump_papi
chore: Bump papi to 2.11.3
2023-06-28 19:40:19 +08:00
Ben Woo c2b943cf0a chore: Bump papi to 2.11.3 2023-06-28 19:37:36 +08:00
Zax71 986bafc13d Merge branch 'main' into modrinth-upload 2023-06-27 16:52:29 +01:00
Zax71 9b4613ce84 Support 1.13+ 2023-06-27 16:50:46 +01:00
Jeremy Wood 48e875d13e Merge pull request #2908 from Multiverse/dumptruckman/fix_classifier
Remove the published jar classifier for maven publish.
2023-04-05 08:48:36 -04:00
Jeremy Wood 14b54d5269 Remove the published jar classifier for maven publish.
Fixes #2906.
2023-04-05 08:38:37 -04:00
Jeremy Wood 1c24b17c90 Merge pull request #2872 from Multiverse/new-readme-2
Update README.md
2023-03-30 08:42:10 -04:00
Ben Woo 346ac94737 Merge branch 'main' into new-readme-2 2023-03-27 10:16:41 +08:00
zax71 6d351300de chore: remove Modrinth for now
Signed-off-by: zax71 <zabax32@gmail.com>
2023-03-26 18:26:23 +01:00
zax71 68411ae6bf Add correct number of newlines
Signed-off-by: zax71 <zabax32@gmail.com>
2023-03-02 12:54:20 +00:00
zax71 2c5e86c689 Add Modrinth Upload 2023-03-02 12:37:07 +00:00
zax71 c3eb0ee8bd Center Logo 2023-02-26 14:00:37 +00:00
zax71 6a8c0b6255 Update README.md 2023-02-26 13:56:56 +00:00
Ben Woo 72415cdae5 feat: Implement list command 2023-02-15 12:17:04 +08:00
534 changed files with 33655 additions and 18752 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
.gitea/CODEOWNERS linguist-detectable=false
+3
View File
@@ -0,0 +1,3 @@
# Pull requests request review from the eligible staff team(s).
# One approval from either an Admin or Developer satisfies branch protection.
* @trueog/Admins @trueog/Developers
+2
View File
@@ -0,0 +1,2 @@
github: Multiverse
open_collective: multiverse-plugins
+5 -5
View File
@@ -18,10 +18,10 @@ body:
When completing the report, please ensure all fields are filled with the correct details requested. Failure to do so will result in your issue being closed.
- type: input
id: mutliverse-version-info
id: multiverse-version-info
attributes:
label: '`/mv version -p` output'
description: Run `/mv version -p` in the console, then copy and paste the link from the output of the command into this box.
label: '`/mv dumps` output'
description: Run `/mv dumps` in the console, then copy and paste the link from the output of the command into this box. If `/mv dumps` command is not available, update multiverse to v5.
validations:
required: true
- type: input
@@ -29,7 +29,7 @@ body:
attributes:
label: Server logs
description: >
Include full startup log and console error (if any). upload all relevant logs to either https://paste.gg
Include full startup log and console error (if any). upload all relevant logs to either https://pastes.dev
or https://gist.github.com, save and the paste the link in this box.
validations:
required: true
@@ -54,7 +54,7 @@ body:
id: reproduce-steps
attributes:
label: Steps to reproduce
description: Provide detailed intructions to trigger the bug.
description: Provide detailed instructions to trigger the bug.
placeholder: |
Example:
1. Start a server with only multiverse installed.
-2
View File
@@ -1,2 +0,0 @@
prerelease:
- '*'
+34
View File
@@ -0,0 +1,34 @@
name: 'Call: GitHub Release'
on:
workflow_call:
inputs:
release_mode:
description: 'Release mode'
required: true
type: string
version_bump:
description: 'Version bump'
required: false
type: string
promote_from:
description: 'Promote from'
required: false
type: string
outputs:
release_created:
description: 'Release created'
value: ${{ jobs.github_release.outputs.release_created }}
tag_name:
description: 'Tag name'
value: ${{ jobs.github_release.outputs.tag_name }}
jobs:
github_release:
uses: ./.github/workflows/generic.github_release.yml
secrets: inherit
with:
plugin_name: multiverse-core
release_mode: ${{ inputs.release_mode }}
version_bump: ${{ inputs.version_bump }}
promote_from: ${{ inputs.promote_from }}
@@ -0,0 +1,83 @@
name: 'Call: Platform Uploads'
on:
workflow_call:
inputs:
target_tag:
description: 'Version to upload'
required: true
type: string
upload_modrinth:
description: 'Upload to modrinth.com'
required: true
type: string
upload_dbo:
description: 'Upload to dev.bukkit.org'
required: true
type: string
upload_hangar:
description: 'Upload to hangar.papermc.io'
required: true
type: string
secrets:
MODRINTH_TOKEN:
required: true
DBO_UPLOAD_API_TOKEN:
required: true
HANGAR_UPLOAD_TOKEN:
required: true
jobs:
platform_uploads:
uses: ./.github/workflows/generic.platform_uploads.yml
secrets: inherit
with:
plugin_name: multiverse-core
modrinth_project_id: 3wmN97b8
modrinth_dependencies: >
[
{"project_id": "qvdtDX3s", "dependency_type": "optional"},
{"project_id": "8VMk6P0I", "dependency_type": "optional"},
{"project_id": "vtawPsTo", "dependency_type": "optional"},
{"project_id": "WuErDeI1", "dependency_type": "optional"}
]
dbo_project_id: 30765
dbo_project_relations: >
[
{"slug": "multiverse-inventories", "type": "optionalDependency"},
{"slug": "multiverse-portals", "type": "optionalDependency"},
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
{"slug": "multiverse-signportals", "type": "optionalDependency"},
{"slug": "vault", "type": "optionalDependency"}
]
hangar_slug: Multiverse-Core
hangar_plugin_dependencies: >
{ "PAPER": [
{
"name": "Multiverse-Inventories",
"required": false,
"platforms": ["PAPER"]
},
{
"name": "Multiverse-Portals",
"required": false,
"platforms": ["PAPER"]
},
{
"name": "Multiverse-NetherPortals",
"required": false,
"platforms": ["PAPER"]
},
{
"name": "Multiverse-SignPortals",
"required": false,
"platforms": ["PAPER"]
}
]}
target_tag: ${{ inputs.target_tag }}
upload_modrinth: ${{ inputs.upload_modrinth }}
upload_dbo: ${{ inputs.upload_dbo }}
upload_hangar: ${{ inputs.upload_hangar }}
@@ -0,0 +1,39 @@
name: 'Dispatch: Create Release'
on:
workflow_dispatch:
inputs:
release_type:
description: 'Stable or pre-release'
required: true
type: choice
options:
- prerelease
- release
version_bump:
description: 'Version bump type'
required: true
type: choice
options:
- major
- minor
- patch
jobs:
github_release:
uses: ./.github/workflows/call.github_release.yml
secrets: inherit
with:
release_mode: ${{ inputs.release_type }}
version_bump: ${{ inputs.version_bump }}
platform_uploads:
needs: github_release
if: needs.github_release.outputs.release_created == 'true'
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ needs.github_release.outputs.tag_name }}
upload_modrinth: 'true'
upload_dbo: 'false'
upload_hangar: 'false'
+55
View File
@@ -0,0 +1,55 @@
name: 'Dispatch: Deploy Javadoc'
on:
workflow_dispatch:
inputs:
target_tag:
description: 'Version to generate javadoc'
required: true
replace_latest:
description: 'Replace the latest folder'
type: boolean
jobs:
javadocs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.target_tag }}
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: build javadoc
run: ./gradlew javadoc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ inputs.target_tag }}
- name: Copy javadoc to deploy folder
run: |
mkdir -p build/docs/javadoc-deploy/${{ inputs.target_tag }}
cp -r build/docs/javadoc/* build/docs/javadoc-deploy/${{ inputs.target_tag }}
- name: Copy javadoc to latest folder
if: inputs.replace_latest
run: |
mkdir -p build/docs/javadoc-deploy/latest
cp -r build/docs/javadoc/* build/docs/javadoc-deploy/latest
- name: Deploy javadoc to gh pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: build/docs/javadoc-deploy
branch: javadoc
target-folder: javadoc
clean: false
commit-message: Deploy javadoc for ${{ inputs.target_tag }}
@@ -0,0 +1,31 @@
name: 'Dispatch: Platform Uploads'
on:
workflow_dispatch:
inputs:
target_tag:
description: 'Version to upload'
required: true
type: string
upload_modrinth:
description: 'Upload to modrinth.com'
required: true
type: boolean
upload_dbo:
description: 'Upload to dev.bukkit.org'
required: true
type: boolean
upload_hangar:
description: 'Upload to hangar.papermc.io'
required: true
type: boolean
jobs:
dispatch_platform_uploads:
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ github.event.inputs.target_tag }}
upload_modrinth: ${{ github.event.inputs.upload_modrinth }}
upload_dbo: ${{ github.event.inputs.upload_dbo }}
upload_hangar: ${{ github.event.inputs.upload_hangar }}
@@ -0,0 +1,38 @@
name: 'Dispatch: Promote Release'
on:
workflow_dispatch:
inputs:
target_tag:
description: 'Version to promote'
required: true
jobs:
check_version:
runs-on: ubuntu-latest
steps:
- name: Verify input version is prerelease
run: |
if [[ "${{ github.event.inputs.target_tag }}" != *"pre"* ]]; then
echo "Version must be a prerelease"
exit 1
fi
github_release:
needs: check_version
uses: ./.github/workflows/call.github_release.yml
secrets: inherit
with:
release_mode: promote
promote_from: ${{ github.event.inputs.target_tag }}
platform_uploads:
needs: github_release
if: needs.github_release.outputs.release_created == 'true'
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ needs.github_release.outputs.tag_name }}
upload_modrinth: 'true'
upload_dbo: 'true'
upload_hangar: 'true'
+22
View File
@@ -0,0 +1,22 @@
name: 'Generic: Checkstyle'
on:
workflow_call:
jobs:
checkstyle:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
continue-on-error: true
steps:
- uses: actions/checkout@v5
- uses: dbelyaev/action-checkstyle@v3
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
checkstyle_version: 10.12.2
checkstyle_config: ./config/mv_checks.xml
level: warning
@@ -0,0 +1,131 @@
name: 'Generic: GitHub Release'
on:
workflow_call:
inputs:
# Plugin specific
plugin_name:
description: 'Plugin name'
required: true
type: string
# Common params
release_mode:
description: 'Release mode'
required: true
type: string
version_bump:
description: 'Version bump'
required: false
type: string
promote_from:
description: 'Promote from'
required: false
type: string
outputs:
release_created:
description: 'Release created'
value: ${{ jobs.github_release.outputs.release_created }}
tag_name:
description: 'Tag name'
value: ${{ jobs.github_release.outputs.tag_name }}
jobs:
github_release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Echo inputs
run: |
echo "release_mode: ${{ inputs.release_mode }}"
echo "version_bump: ${{ inputs.version_bump }}"
echo "promote_from: ${{ inputs.promote_from }}"
- uses: actions/checkout@v4
with:
ref: ${{ inputs.promote_from }}
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build to test
id: test
run: ./gradlew clean build -x assemble -x shadowJar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: release
if: steps.test.outcome == 'success'
uses: benwoo1110/semantic-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_mode: ${{ inputs.release_mode }}
version_bump: ${{ inputs.version_bump }}
promote_from: ${{ inputs.promote_from }}
- name: Publish package
if: steps.release.outputs.release_created == 'true'
run: >
./gradlew publish -x test
-PmultiverseUsername=${{ secrets.REPOSILITE_REPO_USERNAME }}
-PmultiversePassword=${{ secrets.REPOSILITE_REPO_PASSWORD }}
env:
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build for upload
id: build
if: steps.release.outputs.release_created == 'true'
run: ./gradlew build -x test
env:
GITHUB_VERSION: ${{ steps.release.outputs.tag_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact
if: steps.build.outcome == 'success'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/${{ inputs.plugin_name }}-${{ steps.release.outputs.tag_name }}.jar
asset_name: ${{ inputs.plugin_name }}-${{ steps.release.outputs.tag_name }}.jar
tag: ${{ steps.release.outputs.tag_name }}
- name: Generate javadoc
id: javadoc
if: steps.build.outcome == 'success'
run: ./gradlew javadoc -x test
env:
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload javadoc
if: steps.javadoc.outcome == 'success'
run: |
mkdir -p build/docs/javadoc-deploy/${{ steps.release.outputs.publish_version }}
cp -r build/docs/javadoc/* build/docs/javadoc-deploy/${{ steps.release.outputs.publish_version }}
- name: Override latest javadoc for stable release
if: steps.javadoc.outcome == 'success' && steps.release.outputs.release_type == 'release'
run: |
mkdir -p build/docs/javadoc-deploy/latest
cp -r build/docs/javadoc/* build/docs/javadoc-deploy/latest
- name: Deploy javadoc to gh pages
if: steps.javadoc.outcome == 'success'
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: build/docs/javadoc-deploy
branch: javadoc
target-folder: javadoc
clean: false
commit-message: Deploy javadoc for ${{ steps.release.outputs.tag_name }}
@@ -0,0 +1,140 @@
name: 'Generic: Platform Uploads'
on:
workflow_call:
inputs:
# Plugin specific params
plugin_name:
description: 'Plugin name'
required: true
type: string
modrinth_project_id:
description: 'modrinth.com project ID'
required: true
type: string
modrinth_dependencies:
description: 'modrinth.com project dependencies'
required: false
type: string
default: '[]'
dbo_project_id:
description: 'dev.bukkit.org project ID'
required: true
type: string
dbo_project_relations:
description: 'dev.bukkit.org project relations'
required: false
type: string
default: '[]'
hangar_slug:
description: 'hangar.papermc.io project slug'
required: true
type: string
hangar_plugin_dependencies:
description: 'hangar.papermc.io project dependencies'
required: false
type: string
default: '{}'
# Common params
target_tag:
description: 'Version to upload'
required: true
type: string
upload_modrinth:
description: 'Upload to modrinth.com'
required: true
type: string
upload_dbo:
description: 'Upload to dev.bukkit.org'
required: true
type: string
upload_hangar:
description: 'Upload to hangar.papermc.io'
required: true
type: string
secrets:
MODRINTH_TOKEN:
required: true
DBO_UPLOAD_API_TOKEN:
required: true
HANGAR_UPLOAD_TOKEN:
required: true
jobs:
platform_uploads:
runs-on: ubuntu-latest
steps:
- name: Get release info
id: release-info
uses: cardinalby/git-get-release-action@1.2.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ inputs.target_tag }}
- name: Download release artifact
id: release-artifact
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: tags/${{ steps.release-info.outputs.tag_name }}
file: ${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar
- name: Parse release type
id: parse-release-type
run: |
if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
echo Setting release_type to Beta
echo "release_type=Beta" >> $GITHUB_OUTPUT
else
echo Setting release_type to Release
echo "release_type=Release" >> $GITHUB_OUTPUT
fi
- name: Upload to Modrinth
if: ${{ !cancelled() && inputs.upload_modrinth == 'true' }}
uses: benwoo1110/modrinth-upload-action@v1
with:
api_token: ${{ secrets.MODRINTH_TOKEN }}
project_id: ${{ inputs.modrinth_project_id }}
version_number: ${{ steps.release-info.outputs.tag_name }}
files: '["${{ github.workspace }}/${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar"]'
name: ${{ steps.release-info.outputs.tag_name }}
changelog: ${{ steps.release-artifact.outputs.body }}
game_versions: 1.21.11, 1.21.10, 1.21.9, 1.21.8, 1.21.7, 1.21.6, 1.21.5, 1.21.4, 1.21.3, 1.21.2, 1.21.1, 1.21, 1.20.6, 1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2
version_type: ${{ steps.parse-release-type.outputs.release_type }}
loaders: bukkit, spigot, paper, purpur
dependencies: ${{ inputs.modrinth_dependencies }}
- name: Upload to DBO
if: ${{ !cancelled() && inputs.upload_dbo == 'true' }}
uses: benwoo1110/dbo-upload-action@v1
with:
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
project_id: ${{ inputs.dbo_project_id }}
changelog: ${{ steps.release-artifact.outputs.body }}
changelog_type: markdown
display_name: ${{ steps.release-info.outputs.tag_name }}
game_versions: 1.21.11, 1.21.10, 1.21.9, 1.21.8, 1.21.7, 1.21.6, 1.21.5, 1.21.4, 1.21.3, 1.21.2, 1.21.1, 1.21, 1.20.6, 1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2
release_type: ${{ steps.parse-release-type.outputs.release_type }}
project_relations: ${{ inputs.dbo_project_relations }}
file_path: ${{ github.workspace }}/${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar
- name: Upload to Hangar
if: ${{ !cancelled() && inputs.upload_hangar == 'true' }}
uses: benwoo1110/hangar-upload-action@v1
with:
api_token: ${{ secrets.HANGAR_UPLOAD_TOKEN }}
slug: ${{ inputs.hangar_slug }}
version: ${{ steps.release-info.outputs.tag_name }}
channel: ${{ steps.parse-release-type.outputs.release_type }}
files: '[{"path": "${{ github.workspace }}/${{ inputs.plugin_name }}-${{ steps.release-info.outputs.tag_name }}.jar", "platforms": ["PAPER"]}]'
description: ${{ steps.release-artifact.outputs.body }}
platform_dependencies: '{"PAPER": ["1.18.2-1.21.11"]}'
plugin_dependencies: ${{ inputs.hangar_plugin_dependencies }}
+48
View File
@@ -0,0 +1,48 @@
name: 'Generic: Test'
on:
workflow_call:
inputs:
plugin_name:
description: 'Plugin name'
required: true
type: string
jobs:
test-and-artifact:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run unit tests
run: ./gradlew build
env:
GITHUB_VERSION: pr${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Artifact output
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.plugin_name }}-pr${{ github.event.pull_request.number }}
path: build/libs/${{ inputs.plugin_name }}-pr${{ github.event.pull_request.number }}.jar
comment-artifact:
needs: test-and-artifact
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: benwoo1110/artifact-comment-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
+24
View File
@@ -0,0 +1,24 @@
name: 'Main: Prerelease'
on:
push:
branches: [main]
jobs:
github_release_on_push:
uses: ./.github/workflows/call.github_release.yml
secrets: inherit
with:
release_mode: prerelease
version_bump: prlabel
platform_uploads_on_push:
needs: github_release_on_push
if: needs.github_release_on_push.outputs.release_created == 'true'
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ needs.github_release_on_push.outputs.tag_name }}
upload_modrinth: 'true'
upload_dbo: 'false'
upload_hangar: 'false'
+9
View File
@@ -0,0 +1,9 @@
name: 'PR: Checkstyle'
on:
pull_request:
types: [opened, synchronize]
jobs:
checkstyle:
uses: ./.github/workflows/generic.checkstyle.yml
@@ -1,4 +1,4 @@
name: Require PR Labels
name: 'PR: Require Label'
on:
pull_request:
@@ -15,4 +15,4 @@ jobs:
with:
mode: exactly
count: 1
labels: "release:major, release:minor, release:patch, no version bump"
labels: "release:major, release:minor, release:patch, no release"
+11
View File
@@ -0,0 +1,11 @@
name: 'PR: Test'
on:
pull_request:
types: [opened, synchronize]
jobs:
test:
uses: ./.github/workflows/generic.test.yml
with:
plugin_name: multiverse-core
-17
View File
@@ -1,17 +0,0 @@
name: "Pull Request Labeler"
on:
pull_request_target:
types: [opened]
branches: [main]
jobs:
prerelease_labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
-90
View File
@@ -1,90 +0,0 @@
name: Manually promote last prerelease to release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to promote'
required: true
version-bump:
description: 'Version bump to apply - should usually match the version bump used for the prerelease since last release'
required: true
type: choice
options:
- 'patch'
- 'minor'
- 'major'
jobs:
manually_promote_release:
runs-on: ubuntu-latest
steps:
- name: Verify input version is prerelease
run: |
if [[ "${{ github.event.inputs.version }}" != *"pre"* ]]; then
echo "Version must be a prerelease"
exit 1
fi
- name: Get release info
id: get-release
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag: ${{ github.event.inputs.version }}
- uses: actions/checkout@v3
with:
ref: ${{ steps.get-release.outputs.tag_name }}
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Remove prerelease tag
run: |
echo "Removing prerelease tag from version"
echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x test -x checkstyleMain -x checkstyleTest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ env.VERSION }}
- name: Create release
id: release
uses: Multiverse/release-on-push-action@skip_prs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bump_version_scheme: ${{ github.event.inputs.version-bump }}
tag_prefix: ''
release_name: "<RELEASE_VERSION>"
use_github_release_notes: true
ref: ${{ steps.get-release.outputs.target_commitish }}
skip_prs: true
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ env.VERSION }}
- name: Upload release artifact
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
tag: ${{ steps.release.outputs.tag_name }}
-64
View File
@@ -1,64 +0,0 @@
name: Create Release Version & Publish Package
on:
push:
branches: [main]
jobs:
release_on_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Test & Build
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x assemble -x shadowJar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: release
uses: Multiverse/release-on-push-action@support_prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bump_version_scheme: norelease
tag_prefix: ''
release_name: "<RELEASE_VERSION>"
use_github_release_notes: true
- name: Modify version scheme
run: |
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
echo "Replacing prerelease version scheme with SNAPSHOT"
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
else
echo "Using release version scheme"
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
fi
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GITHUB_VERSION: ${{ env.VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
tag: ${{ steps.release.outputs.tag_name }}
-36
View File
@@ -1,36 +0,0 @@
name: Run unit tests against all PRs
on:
pull_request:
types: [opened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Run unit tests
uses: gradle/gradle-build-action@v2
with:
arguments: build -x checkstyleMain -x checkstyleTest -x javadoc
env:
GITHUB_VERSION: pr${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Artifact output
uses: actions/upload-artifact@v3
with:
name: multiverse-core-pr${{ github.event.pull_request.number }}
path: build/libs/multiverse-core-pr${{ github.event.pull_request.number }}.jar
+4
View File
@@ -0,0 +1,4 @@
kotlin version: 2.0.21
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
1. Kotlin compile daemon is ready
+29 -22
View File
@@ -1,44 +1,51 @@
![Multiverse 2](config/multiverse2-long.png)
<p align="center">
<img src="config/multiverse-banner.png" alt="Multiverse Logo">
</p>
[![Maven CI/CD](https://github.com/Multiverse/Multiverse-Core/actions/workflows/build.yml/badge.svg)](https://github.com/Multiverse/Multiverse-Core/actions/workflows/build.yml)
[![Release](https://img.shields.io/nexus/r/com.onarandombox.multiversecore/Multiverse-Core?label=release&server=https%3A%2F%2Frepo.onarandombox.com%2F)](https://dev.bukkit.org/projects/multiverse-core)
[![Dev builds](https://img.shields.io/nexus/s/com.onarandombox.multiversecore/Multiverse-Core?label=dev%20builds&server=http%3A%2F%2Frepo.onarandombox.com%2F)](https://ci.onarandombox.com/job/Multiverse-Core/)
[![Discord](https://img.shields.io/discord/325459248047980545?label=discord&logo=discord)](https://discord.gg/NZtfKky)
[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Ddumptruckman%26type%3Dpatrons&style=flat)](https://patreon.com/dumptruckman)
[![License](https://img.shields.io/github/license/Multiverse/Multiverse-Core)](LICENSE.md)
[![Modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/plugin/multiverse-core)
[![Hangar](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/hangar_vector.svg)](https://hangar.papermc.io/Multiverse/Multiverse-Core)
[![Bukkit](https://raw.githubusercontent.com/intergrav/devins-badges/refs/heads/v3/assets/cozy/available/bukkit_vector.svg)](https://dev.bukkit.org/projects/multiverse-core)
[![Spigot](https://raw.githubusercontent.com/intergrav/devins-badges/refs/heads/v3/assets/cozy/available/spigot_vector.svg)](https://www.spigotmc.org/resources/multiverse-core.390/)
[![Release](https://img.shields.io/github/v/release/multiverse/multiverse-core)](https://github.com/Multiverse/Multiverse-Core/releases/latest)
[![Pre-Release](https://img.shields.io/github/v/release/multiverse/multiverse-core?include_prereleases&label=Pre-release)](https://github.com/Multiverse/Multiverse-Core/releases)
[![Discord](https://img.shields.io/discord/325459248047980545?label=Discord&logo=discord)](https://discord.gg/NZtfKky)
[![Donate on Github Sponsor](https://img.shields.io/badge/Github%20Sponsor-Donate-pink?logo=githubsponsors)](https://github.com/sponsors/Multiverse)
[![Donate on Open Collective](https://img.shields.io/badge/Open%20Collective-Donate-blue?style=flat&logo=opencollective)](https://opencollective.com/multiverse-plugins)
# About
[Multiverse](https://modrinth.com/plugin/multiverse-core) was created at the dawn of Bukkit multiworld support. It has since then grown into a **complete world management solution!** Multiverse provides the easiest to use world management solution for your Minecraft server, big or small, and with great addons like [Portals](https://dev.bukkit.org/projects/multiverse-portals) and [NetherPortals](https://dev.bukkit.org/projects/multiverse-netherportals/), what's not to love!
About
========
[Multiverse](https://dev.bukkit.org/projects/multiverse-core) was created at the dawn of Bukkit multiworld support. It has since then grown into a **complete world management solution!** Multiverse provides the easiest to use world management solution for your Minecraft server, big or small, and with great addons like [Portals](https://dev.bukkit.org/projects/multiverse-portals) and [NetherPortals](https://dev.bukkit.org/projects/multiverse-netherportals/), what's not to love!
<br><br>
Now it's time to create your very own Multiverse server, do check out our [Wiki](https://github.com/Multiverse/Multiverse-Core/wiki) and [Usage Guide](https://github.com/Multiverse/Multiverse-Core/wiki/Basics) to get started. Feel free to hop onto our [Discord](https://discord.gg/NZtfKky) if you have any question or just want to have a chat with us!
### Amazing sub-modules available:
## Amazing sub-modules available:
* [Multiverse-NetherPortals](https://github.com/Multiverse/Multiverse-NetherPortals) -> Have separate nether and end worlds for each of your overworlds!
* [Multiverse-Portals](https://github.com/Multiverse/Multiverse-Portals) -> Make custom portals to go to any destination!
* [Multiverse-Inventories](https://github.com/Multiverse/Multiverse-Inventories) -> Have separated players stats and inventories per world or per group of worlds.
* [Multiverse-SignPortals](https://github.com/Multiverse/Multiverse-SignPortals) -> Signs as teleprompters!
* [Multiverse-SignPortals](https://github.com/Multiverse/Multiverse-SignPortals) -> Signs as teleporters!
Building
========
## Usage Guide
We have a cool new website hosting our Wiki: https://mvplugins.org
## Building
Simply build the source with Gradle:
```
./gradlew build
```
More details are available on the [build instructions wiki page](https://github.com/Multiverse/Multiverse-Core/wiki/Building).
## Contributing
Contributing
=======
**Want to help improve Multiverse?** There are several ways you can support and contribute to the project.
* Take a look at our "Bug: Unconfirmed" issues, where you can find issues that need extra testing and investigation.
* Want others to love Multiverse too? You can join the [Multiverse Discord community](https://discord.gg/NZtfKky) and help others with issues and setup!
* A Multiverse guru? You can update our [Wiki](https://github.com/Multiverse/Multiverse-Core/wiki) with your latest tip, tricks and guides! The wiki open for all to edit and improve.
* A Multiverse guru? You can update our [Wiki](https://github.com/Multiverse/multiverse-web) with your latest tip, tricks and guides! The wiki open for all to edit and improve.
* Love coding? You could look at ["State: Open to PR"](https://github.com/Multiverse/Multiverse-Core/labels/State%3A%20Open%20to%20PR) and ["Resolution: Accepted"](https://github.com/Multiverse/Multiverse-Core/labels/Resolution%3A%20Accepted) issues. We're always happy to receive bug fixes and feature additions as [pull requests](https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/).
* If you'd like to make a financial contribution to the project, do consider joining our [patreon](https://www.patreon.com/dumptruckman) or make a one-time donation [here](https://paypal.me/dumptruckman)!
* If you'd like to make a financial contribution to the project, do consider donating to our [Github Sponsors](https://github.com/sponsors/Multiverse) or [Open Collective](https://opencollective.com/multiverse-plugins)!
Additionally, we would like to give a big thanks to everyone that has supported Multiverse over the years, as well as those in the years to come. Thank you!
License
=======
## License
Multiverse-Core is licensed under BSD-3-Clause License. Please see [LICENSE.md](LICENSE.md) for more info.
-286
View File
@@ -1,286 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java-library'
id 'maven-publish'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id "org.jetbrains.kotlin.jvm" version "1.8.10"
}
version = System.getenv('GITHUB_VERSION') ?: 'local'
group = 'com.onarandombox.multiversecore'
description = 'Multiverse-Core'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
}
maven {
url = uri('https://repo.onarandombox.com/content/groups/public')
}
maven {
url = uri('https://hub.spigotmc.org/nexus/content/groups/public/')
}
maven {
url = uri('https://jitpack.io')
}
maven {
url = uri('https://repo.minebench.de/')
}
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
maven {
name = 'aikar repo'
url = uri('https://repo.aikar.co/content/groups/aikar/')
}
maven {
name = 'glaremasters repo'
url = 'https://repo.glaremasters.me/repository/towny/'
}
maven {
name = 'PlaceholderAPI'
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
configurations {
oldTestImplementation.extendsFrom implementation
oldTestRuntime.extendsFrom runtime
relocatedApi
compileClasspath.extendsFrom relocatedApi
runtimeClasspath.extendsFrom relocatedApi
testCompileClasspath.extendsFrom relocatedApi
testRuntimeClasspath.extendsFrom relocatedApi
oldTestCompileClasspath.extendsFrom relocatedApi
oldTestRuntimeClasspath.extendsFrom relocatedApi
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
// Economy
implementation('com.github.MilkBowl:VaultAPI:1.7.1') {
exclude group: 'org.bukkit', module: 'bukkit'
}
// PlaceholderAPI
implementation 'me.clip:placeholderapi:2.11.2'
// Command Framework
relocatedApi 'co.aikar:acf-paper:0.5.1-SNAPSHOT'
// Config
relocatedApi('me.main__.util:SerializationConfig:1.7') {
exclude group: 'org.bukkit', module: 'bukkit'
}
relocatedApi('io.github.townyadvanced.commentedconfiguration:CommentedConfiguration:1.0.1') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
// Utils
relocatedApi 'io.vavr:vavr:0.10.4'
relocatedApi 'org.glassfish.hk2:hk2-locator:3.0.3'
relocatedApi('com.dumptruckman.minecraft:Logging:1.1.1') {
exclude group: 'junit', module: 'junit'
}
relocatedApi 'de.themoep.idconverter:mappings:1.2-SNAPSHOT'
relocatedApi 'org.bstats:bstats-bukkit:2.2.1'
relocatedApi 'net.minidev:json-smart:2.4.8'
relocatedApi 'org.jetbrains:annotations:22.0.0'
relocatedApi 'io.papermc:paperlib:1.0.8'
// Tests
testImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10'
testImplementation 'com.github.seeseemelk:MockBukkit-v1.19:2.141.0'
testImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'junit', module: 'junit'
}
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'com.natpryce:hamkrest:1.8.0.1'
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.1.0'
// Old Tests
oldTestImplementation 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT'
oldTestImplementation('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'junit', module: 'junit'
}
oldTestImplementation 'junit:junit:4.13.1'
oldTestImplementation 'org.mockito:mockito-core:3.11.2'
oldTestImplementation 'commons-io:commons-io:2.7'
// Annotation Processors
annotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.0.3'
testAnnotationProcessor 'org.glassfish.hk2:hk2-metadata-generator:3.0.3'
}
java {
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
configurations {
[apiElements, runtimeElements].each {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
it.outgoing.artifact(shadowJar)
}
}
sourceSets {
oldTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/old-test/java')
}
resources.srcDir file('src/old-test/resources')
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
ext.bitlyAccessToken = System.getenv('BITLY_ACCESS_TOKEN') ?: 'bitly-access-token'
task prepareSource(type: Sync) {
inputs.property 'bitlyAccessToken', bitlyAccessToken
from sourceSets.main.java
into "$buildDir/src"
filter(ReplaceTokens, tokens: [
'bitly-access-token': bitlyAccessToken,
])
}
compileJava {
source = prepareSource.outputs
}
tasks.withType(JavaCompile) {
configure(options) {
options.compilerArgs << '-Aorg.glassfish.hk2.metadata.location=META-INF/hk2-locator/Multiverse-Core'
}
}
compileKotlin {
// We're not using Kotlin in the plugin itself, just tests!
enabled = false
}
configurations.findAll { !it.name.startsWith('test') }.each {
it.exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
processResources {
def props = [version: "${project.version}"]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
// This task should never be skipped. The tests depend on this having been run but we want the new version number
// that is created after tests are run and before we run again to publish.
outputs.upToDateWhen { false }
}
checkstyle {
toolVersion = '6.1.1'
configFile file('config/mv_checks.xml')
ignoreFailures = true
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
}
project.configurations.api.canBeResolved = true
shadowJar {
relocate 'co.aikar.commands', 'com.onarandombox.acf'
relocate 'com.dumptruckman.minecraft.util.Logging', 'com.onarandombox.MultiverseCore.utils.CoreLogging'
relocate 'com.dumptruckman.minecraft.util.DebugLog', 'com.onarandombox.MultiverseCore.utils.DebugFileLogger'
relocate 'de.themoep.idconverter', 'com.onarandombox.idconverter'
relocate 'io.github.townyadvanced.commentedconfiguration', 'com.onarandombox.commentedconfiguration'
relocate 'me.main__.util', 'com.onarandombox.serializationconfig'
relocate 'org.bstats', 'com.onarandombox.bstats'
relocate 'com.sun', 'com.onarandombox.sun'
relocate 'net.minidev', 'com.onarandombox.minidev'
relocate 'org.objectweb', 'com.onarandombox.objectweb'
relocate 'io.vavr', 'com.onarandombox.vavr'
relocate 'jakarta', 'com.onarandombox.jakarta'
relocate 'javassist', 'com.onarandombox.javassist'
relocate 'org.aopalliance', 'com.onarandombox.aopalliance'
relocate 'org.glassfish', 'com.onarandombox.glassfish'
relocate 'org.jvnet', 'com.onarandombox.jvnet'
relocate 'org.intellij', 'com.onarandombox.intellij'
relocate 'org.jetbrains', 'com.onarandombox.jetbrains'
relocate 'io.papermc.lib', 'com.onarandombox.paperlib'
configurations = [project.configurations.api, project.configurations.relocatedApi]
archiveFileName = "$baseName-$version.$extension"
dependencies {
exclude(dependency {
it.moduleGroup == 'org.jetbrains.kotlin'
})
}
}
build.dependsOn shadowJar
jar.enabled = false
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
+364
View File
@@ -0,0 +1,364 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import groovy.util.Node
import groovy.util.NodeList
import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.api.artifacts.Configuration
import org.gradle.api.credentials.PasswordCredentials
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.Sync
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.external.javadoc.StandardJavadocDocletOptions
import org.gradle.jvm.tasks.Jar
import org.gradle.language.jvm.tasks.ProcessResources
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java-library`
eclipse
`maven-publish`
id("com.gradleup.shadow") version "8.3.9"
kotlin("jvm") version "2.0.21"
}
group = "org.mvplugins.multiverse.core"
version = System.getenv("GITHUB_VERSION") ?: "5.3.4.17"
description = "Multiverse-Core"
val sourceSets = extensions.getByType<SourceSetContainer>()
val serverApi: Configuration by configurations.creating
val externalPlugin: Configuration by configurations.creating
val shadowed: Configuration by configurations.creating
repositories {
mavenLocal()
mavenCentral()
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
maven {
url = uri("https://repo.onarandombox.com/content/groups/public")
}
maven {
url = uri("https://hub.spigotmc.org/nexus/content/groups/public/")
}
maven {
url = uri("https://jitpack.io")
}
maven {
url = uri("https://repo.minebench.de/")
}
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
maven {
name = "aikar repo"
url = uri("https://repo.aikar.co/content/groups/aikar/")
}
maven {
name = "glaremasters repo"
url = uri("https://repo.glaremasters.me/repository/towny/")
}
maven {
name = "helpchatRepoReleases"
url = uri("https://repo.helpch.at/releases/")
}
maven {
name = "papermc repo"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
// Purpur API
maven("https://repo.purpurmc.org/snapshots")
}
// Configuration wiring like in the Groovy build
configurations["compileOnly"].extendsFrom(serverApi)
configurations["runtimeClasspath"].extendsFrom(serverApi)
configurations["implementation"].extendsFrom(externalPlugin)
configurations["compileClasspath"].extendsFrom(shadowed)
configurations["testCompileClasspath"].extendsFrom(shadowed)
configurations["testRuntimeClasspath"].extendsFrom(shadowed)
dependencies {
// Server API: Purpur 1.19.4
serverApi("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
// Economy
externalPlugin("com.github.MilkBowl:VaultAPI:1.7.1") {
exclude(group = "org.bukkit", module = "bukkit")
}
// PlaceholderAPI
externalPlugin("me.clip:placeholderapi:2.11.6")
// Command Framework
shadowed("co.aikar:acf-paper:0.5.1-SNAPSHOT")
// Config
shadowed("io.github.townyadvanced.commentedconfiguration:CommentedConfiguration:1.0.1") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
// Utils
shadowed("io.vavr:vavr:0.10.4")
shadowed("org.glassfish.hk2:hk2-locator:3.0.3")
shadowed("org.glassfish.hk2:hk2-inhabitant-generator:3.0.3") {
exclude(group = "org.apache.maven", module = "maven-core")
}
shadowed("com.dumptruckman.minecraft:Logging:1.1.1") {
exclude(group = "junit", module = "junit")
}
shadowed("de.themoep.idconverter:mappings:1.2-SNAPSHOT")
shadowed("org.bstats:bstats-bukkit:3.1.0") {
exclude(group = "org.bukkit", module = "bukkit")
}
shadowed("net.minidev:json-smart:2.4.9")
shadowed("org.jetbrains:annotations:22.0.0")
shadowed("io.papermc:paperlib:1.0.8")
// Tests
testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21")
testImplementation("com.github.seeseemelk:MockBukkit-v1.19:3.1.0")
testImplementation("com.googlecode.json-simple:json-simple:1.1.1") {
exclude(group = "junit", module = "junit")
}
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("com.natpryce:hamkrest:1.8.0.1")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
// Annotation Processors
annotationProcessor("org.glassfish.hk2:hk2-metadata-generator:3.0.3")
testAnnotationProcessor("org.glassfish.hk2:hk2-metadata-generator:3.0.3")
}
java {
// Plugin is compiled for Java 17 (GraalVM 17-friendly)
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
withSourcesJar()
withJavadocJar()
}
val bitlyAccessToken: String = System.getenv("BITLY_ACCESS_TOKEN") ?: "bitly-access-token"
// === Token-filtered source generation (prepareSource) ===
val prepareSource by tasks.registering(Sync::class) {
inputs.property("bitlyAccessToken", bitlyAccessToken)
from(sourceSets["main"].java)
// avoid deprecated buildDir getter
into(layout.buildDirectory.dir("src"))
filter<ReplaceTokens>(
"tokens" to mapOf(
"bitly-access-token" to bitlyAccessToken,
),
)
}
// Use ONLY the filtered sources for compileJava (fixes duplicate classes)
tasks.named<JavaCompile>("compileJava") {
dependsOn(prepareSource)
source = prepareSource.get().outputs.files.asFileTree
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}
tasks.named<JavaCompile>("compileTestJava") {
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.compilerArgs.add(
"-Aorg.glassfish.hk2.metadata.location=META-INF/hk2-locator/Multiverse-Core",
)
}
tasks.withType<Javadoc>().configureEach {
(options as StandardJavadocDocletOptions).encoding = "UTF-8"
}
tasks.named<KotlinCompile>("compileTestKotlin") {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
javaParameters.set(true)
}
}
// We're not using Kotlin in the plugin itself, just tests!
tasks.named<KotlinCompile>("compileKotlin") {
enabled = false
}
configurations
.filterNot { it.name.startsWith("test") }
.forEach {
it.exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
}
tasks.named<ProcessResources>("processResources") {
val props = mapOf("version" to project.version.toString())
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(props)
}
// Never up-to-date: tests depend on fresh version expansion
outputs.upToDateWhen { false }
}
tasks.named<Javadoc>("javadoc") {
source = sourceSets["main"].allJava
classpath = configurations["compileClasspath"]
}
// Removed: configurations["api"].isCanBeResolved = true (deprecated in Gradle 8/9)
val jarTask = tasks.named<Jar>("jar")
val shadowJarTask = tasks.named<ShadowJar>("shadowJar")
listOf("apiElements", "runtimeElements").forEach { configurationName ->
configurations.named(configurationName) {
outgoing.artifacts.removeIf { artifact ->
artifact.buildDependencies.getDependencies(null).contains(jarTask.get())
}
outgoing.artifact(shadowJarTask)
}
}
tasks.named<ShadowJar>("shadowJar") {
relocate("co.aikar", "org.mvplugins.multiverse.external.acf")
relocate("com.dumptruckman.minecraft.util.Logging", "org.mvplugins.multiverse.core.utils.CoreLogging")
relocate("com.dumptruckman.minecraft.util.DebugLog", "org.mvplugins.multiverse.core.utils.DebugFileLogger")
relocate("de.themoep.idconverter", "org.mvplugins.multiverse.external.idconverter")
relocate("io.github.townyadvanced.commentedconfiguration", "org.mvplugins.multiverse.external.commentedconfiguration")
relocate("me.main__.util", "org.mvplugins.multiverse.external.serializationconfig")
relocate("org.bstats", "org.mvplugins.multiverse.external.bstats")
relocate("com.sun", "org.mvplugins.multiverse.external.sun")
relocate("net.minidev", "org.mvplugins.multiverse.external.minidev")
relocate("org.objectweb", "org.mvplugins.multiverse.external.objectweb")
relocate("io.vavr", "org.mvplugins.multiverse.external.vavr")
relocate("jakarta", "org.mvplugins.multiverse.external.jakarta")
relocate("javassist", "org.mvplugins.multiverse.external.javassist")
relocate("org.aopalliance", "org.mvplugins.multiverse.external.aopalliance")
relocate("org.glassfish", "org.mvplugins.multiverse.external.glassfish")
relocate("org.jvnet", "org.mvplugins.multiverse.external.jvnet")
relocate("org.intellij", "org.mvplugins.multiverse.external.intellij")
relocate("org.jetbrains", "org.mvplugins.multiverse.external.jetbrains")
relocate("io.papermc.lib", "org.mvplugins.multiverse.external.paperlib")
configurations = listOf(project.configurations["shadowed"])
archiveClassifier.set("")
dependencies {
exclude { dependency ->
dependency.moduleGroup == "org.jetbrains.kotlin"
}
}
}
tasks.named("build") {
dependsOn("shadowJar")
}
tasks.named<Jar>("jar") {
enabled = false
}
tasks.named<Test>("test") {
useJUnitPlatform()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
pom.withXml {
val pomNode = asNode()
val dependenciesNode = (
(pomNode.get("dependencies") as? NodeList)
?.firstOrNull() as? Node
) ?: (pomNode.appendNode("dependencies") as Node)
val dependencyNodes = dependenciesNode.children().filterIsInstance<Node>().toList()
// Remove Kotlin dependency
dependencyNodes
.filter { dependencyNode ->
val groupIdNodes = dependencyNode.get("groupId") as? NodeList ?: return@filter false
val groupId = (groupIdNodes.firstOrNull() as? Node)?.text()
groupId == "org.jetbrains.kotlin"
}
.forEach { dependencyNode ->
dependenciesNode.remove(dependencyNode)
}
// Switch runtime deps to provided
dependencyNodes.forEach { dependencyNode ->
val scopeNodes = dependencyNode.get("scope") as? NodeList ?: return@forEach
val scopeNode = scopeNodes.firstOrNull() as? Node ?: return@forEach
if (scopeNode.text() == "runtime") {
scopeNode.setValue("provided")
}
}
// Add server API (Purpur) to pom as provided
configurations["serverApi"].allDependencies.forEach { dependency ->
val depNode = dependenciesNode.appendNode("dependency")
depNode.appendNode("groupId", dependency.group)
depNode.appendNode("artifactId", dependency.name)
depNode.appendNode("version", dependency.version)
depNode.appendNode("scope", "provided")
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Multiverse/Multiverse-Core")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
maven {
name = "multiverse"
val releasesRepoUrl = uri("https://repo.dumptruckman.com/multiverse-releases")
val snapshotsRepoUrl = uri("https://repo.dumptruckman.com/multiverse-snapshots")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials(PasswordCredentials::class)
}
maven {
// todo: remove before mv5 release
name = "multiverseBeta"
url = uri("https://repo.c0ding.party/multiverse-beta")
credentials(PasswordCredentials::class)
}
}
}
+1
View File
@@ -0,0 +1 @@
out.txt
+20
View File
@@ -0,0 +1,20 @@
filepath = "../src/main/resources/multiverse-core_en.properties"
enumList = []
with open(filepath) as f:
for line in f:
line = line.strip()
if len(line) == 0:
enumList.append("")
elif line.startswith("#"):
enumList.append(line.replace("#", "//"))
else:
parts = line.split("=")
if (len(parts) < 2):
continue
parts = parts[0].split(".")[1:]
enumList.append("_".join([p.upper() for p in parts]) + ",")
with open("out.txt", "w") as f:
f.write("\n".join(enumList))
Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

+625 -101
View File
@@ -6,136 +6,660 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!-- Future reference: valid severity values are 'ignore', 'info', 'warning', 'error' -->
<module name="Checker">
<module name="JavadocPackage">
<property name="allowLegacy" value="true"/>
</module>
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml"/>
<property name="severity" value="warning"/>
<!-- Javadoc Comments -->
<module name="JavadocPackage"/><!-- require package-info.java file -->
<!-- Miscellaneous -->
<module name="NewlineAtEndOfFile" />
<module name="OrderedProperties"/>
<module name="Translation"/>
<module name="FileLength"/>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="UniqueProperties"/>
<!-- Regexp -->
<module name="RegexpSingleline">
<property name="message" value="Line has trailing spaces."/>
<property name="format" value="\s+$"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
<property name="checkFormat" value="$1"/>
<!-- Size Violations -->
<module name="FileLength">
<property name="max" value="2000"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="checkFormat" value="$1"/>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
<!-- Whitespace -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker">
<!-- Make suppression possible -->
<module name="FileContentsHolder"/>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="SUPPRESS CHECKSTYLE: (\w+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: (\w+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="BEGIN CHECKSTYLE-SUPPRESSION\: ALL"/>
<property name="onCommentFormat" value="END CHECKSTYLE-SUPPRESSION\: ALL"/>
</module>
<!-- Actual checks -->
<module name="LineLength">
<property name="max" value="160"/>
<!-- Annotations -->
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, PACKAGE_DEF, ENUM_CONSTANT_DEF,
ENUM_DEF, METHOD_DEF, CTOR_DEF, RECORD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="AnnotationLocation"/>
<module name="AnnotationUseStyle"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<!-- Block Checks -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="tokens"
value="LITERAL_WHILE, LITERAL_TRY, LITERAL_FINALLY, LITERAL_DO, LITERAL_IF,
LITERAL_ELSE, LITERAL_FOR, INSTANCE_INIT, STATIC_INIT, LITERAL_SWITCH,
LITERAL_SYNCHRONIZED"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="(ignore|expect)"/>
</module>
<module name="LeftCurly">
<property name="ignoreEnums" value="false"/>
<property name="tokens"
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="NeedBraces">
<property name="id" value="SingleLineIf"/>
<property name="tokens" value="LITERAL_IF"/>
<property name="allowSingleLineStatement" value="true"/>
</module>
<module name="NeedBraces">
<property name="id" value="NoSingleLineControl"/>
<property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF, LITERAL_SWITCH"/>
</module>
<!-- Class Design -->
<module name="DesignForExtension">
<property name="severity" value="info"/>
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
<module name="MutableException"/>
<module name="OneTopLevelClass"/>
<module name="ThrowsCount">
<property name="max" value="2"/>
</module>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>
<!-- Coding -->
<module name="ArrayTrailingComma"/>
<module name="AvoidDoubleBraceInitialization"/>
<module name="AvoidNoArgumentSuperConstructorCall"/>
<module name="CovariantEquals"/>
<module name="DeclarationOrder">
<!-- Doesn't respect static methods at top -->
<property name="severity" value="ignore"/>
</module>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="EqualsAvoidNull"/>
<module name="EqualsHashCode"/>
<module name="FallThrough">
<property name="checkLastCaseGroup" value="true"/>
</module>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="setterCanReturnItsClass" value="true"/>
<property name="ignoreAbstractMethods" value="true"/>
<!-- Not smart enough -->
<property name="severity" value="ignore"/>
</module>
<module name="IllegalCatch"/>
<module name="IllegalThrows"/>
<module name="IllegalToken"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="IllegalType"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreHashCodeMethod" value="true"/>
<property name="ignoreAnnotationElementDefaults" value="true"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleStringLiterals">
</module>
<module name="MultipleVariableDeclarations"/>
<module name="NestedForDepth">
<property name="severity" value="warning"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="package"/><!-- We don't need javadoc for private methods -->
<property name="tokens" value="METHOD_DEF"/><!-- We don't need javadoc for constructors -->
<module name="NestedIfDepth"/>
<module name="NestedTryDepth"/>
<module name="NoClone"/>
<module name="NoFinalizer"/>
<module name="OneStatementPerLine"/>
<module name="PackageDeclaration"/>
<module name="ParameterAssignment"/>
<module name="RequireThis"/>
<module name="ReturnCount">
<property name="severity" value="info"/>
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<module name="UnnecessaryParentheses"/>
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration"/>
<module name="UnnecessarySemicolonInEnumeration"/>
<module name="UnnecessarySemicolonInTryWithResources"/>
<module name="UnusedLocalVariable"/>
<module name="VariableDeclarationUsageDistance">
<property name="allowedDistance" value="3"/>
<property name="validateBetweenScopes" value="false"/>
</module>
<module name="VariableDeclarationUsageDistance">
<property name="allowedDistance" value="5"/>
<property name="validateBetweenScopes" value="true"/>
</module>
<!-- Imports -->
<module name="AvoidStarImport"/>
<module name="IllegalImport">
<property name="illegalPkgs" value="sun"/>
</module>
<module name="ImportOrder">
<property name="option" value="bottom"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="separatedStaticGroups" value="true"/>
<property name="caseSensitive" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="groups"
value="java,javax,*,org.mvplugins"/>
<property name="staticGroups"
value="/^.*$/"/>
</module>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- Javadoc Comments -->
<module name="AtclauseOrder">
<property name="target"
value="CLASS_DEF, COMPACT_CTOR_DEF, CTOR_DEF, ENUM_DEF,
INTERFACE_DEF, METHOD_DEF, RECORD_DEF, VARIABLE_DEF"/>
</module>
<module name="InvalidJavadocPosition"/>
<module name="JavadocBlockTagLocation"/>
<module name="JavadocContentLocationCheck"/>
<module name="JavadocMethod">
<property name="accessModifiers" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="JavadocMethod">
<property name="accessModifiers" value="public"/>
</module>
<module name="JavadocMissingLeadingAsterisk"/>
<module name="JavadocMissingWhitespaceAfterAsterisk"/>
<module name="JavadocParagraph">
<property name="allowNewlineParagraph" value="true"/>
</module>
<module name="JavadocStyle">
<property name="scope" value="package"/>
</module>
<module name="JavadocTagContinuationIndentation"/>
<module name="JavadocType"/>
<module name="JavadocVariable">
<property name="scope" value="package"/><!-- We don't need javadoc for private variables -->
<property name="scope" value="package"/>
</module>
<module name="MissingJavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
</module>
<module name="MissingJavadocMethod">
<property name="scope" value="protected"/>
<property name="excludeScope" value="public"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="minLineCount" value="2"/>
</module>
<module name="MissingJavadocType">
<property name="scope" value="protected"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
RECORD_DEF, ANNOTATION_DEF"/>
<property name="excludeScope" value="nothing"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="RequireEmptyLineBeforeBlockTagGroup"/>
<module name="SingleLineJavadoc"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocStyle"/>
<module name="WriteTag">
<property name="tag" value="@author"/>
<property name="tagFormat" value="\S"/>
<property name="severity" value="ignore"/>
<property name="tagSeverity" value="warning"/>
</module>
<module name="ConstantName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
<property name="excludes" value="com.onarandombox.MultiverseCore.utils,com.onarandombox.MultiverseCore.configuration,com.onarandombox.MultiverseCore.commandsold,com.onarandombox.MultiverseCore.destination"/>
<!-- Metrics -->
<module name="BooleanExpressionComplexity"/>
<module name="ClassDataAbstractionCoupling">
<property name="max" value="7"/>
<property name="excludedClasses"
value="ArrayIndexOutOfBoundsException, ArrayList, Boolean, Byte, Character,
Class, Collection, Deprecated, Deque, Double, DoubleStream, EnumSet, Exception,
Float, FunctionalInterface, HashMap, HashSet, IllegalArgumentException,
IllegalStateException, IndexOutOfBoundsException, IntStream, Integer,
LinkedHashMap, LinkedHashSet, LinkedList, List, Long, LongStream, Map,
NullPointerException, Object, Optional, OptionalDouble, OptionalInt,
OptionalLong, Override, Queue, RuntimeException, SafeVarargs, SecurityException,
Set, Short, SortedMap, SortedSet, Stream, String, StringBuffer, StringBuilder,
SuppressWarnings, Throwable, TreeMap, TreeSet, UnsupportedOperationException,
Void, boolean, byte, char, double, float, int, long, short, var, void"/>
</module>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="true"/>
</module>
<module name="MethodLength">
<property name="severity" value="warning"/>
<property name="countEmpty" value="false"/>
</module>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter">
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter">
<property name="severity" value="warning"/>
</module>
<module name="WhitespaceAround">
<property name="severity" value="warning"/>
</module>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,INSTANCE_INIT,STATIC_INIT"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/><!-- We don't care if parameters hide fields. -->
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 0.5, 1, 2, 3"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Don't like errors for `final` missing
<module name="DesignForExtension"/>
<module name="FinalClass"/>
-->
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="protectedAllowed" value="true"/>
</module>
<module name="ArrayTypeStyle"/>
<!-- Don't like errors for `final` missing
<module name="FinalParameters"/>
-->
<module name="TodoComment">
<module name="ClassFanOutComplexity">
<property name="id" value="FanOutComplexityGettingTooHigh"/>
<property name="max" value="20"/>
<property name="excludedClasses"
value="ArrayIndexOutOfBoundsException, ArrayList, Boolean, Byte, Character,
Class, Collection, Deprecated, Deque, Double, DoubleStream, EnumSet, Exception,
Float, FunctionalInterface, HashMap, HashSet, IllegalArgumentException,
IllegalStateException, IndexOutOfBoundsException, IntStream, Integer,
LinkedHashMap, LinkedHashSet, LinkedList, List, Long, LongStream, Map,
NullPointerException, Object, Optional, OptionalDouble, OptionalInt,
OptionalLong, Override, Queue, RuntimeException, SafeVarargs, SecurityException,
Set, Short, SortedMap, SortedSet, Stream, String, StringBuffer, StringBuilder,
SuppressWarnings, Throwable, TreeMap, TreeSet, UnsupportedOperationException,
Void, boolean, byte, char, double, float, int, long, short, var, void"/>
<property name="severity" value="info"/>
</module>
<module name="ClassFanOutComplexity">
<property name="id" value="FanOutComplexityProbablyTooHigh"/>
<property name="max" value="35"/>
<property name="excludedClasses"
value="ArrayIndexOutOfBoundsException, ArrayList, Boolean, Byte, Character,
Class, Collection, Deprecated, Deque, Double, DoubleStream, EnumSet, Exception,
Float, FunctionalInterface, HashMap, HashSet, IllegalArgumentException,
IllegalStateException, IndexOutOfBoundsException, IntStream, Integer,
LinkedHashMap, LinkedHashSet, LinkedList, List, Long, LongStream, Map,
NullPointerException, Object, Optional, OptionalDouble, OptionalInt,
OptionalLong, Override, Queue, RuntimeException, SafeVarargs, SecurityException,
Set, Short, SortedMap, SortedSet, Stream, String, StringBuffer, StringBuilder,
SuppressWarnings, Throwable, TreeMap, TreeSet, UnsupportedOperationException,
Void, boolean, byte, char, double, float, int, long, short, var, void"/>
</module>
<module name="CyclomaticComplexity">
<property name="max" value="7"/>
<property name="severity" value="warning"/>
</module>
<module name="JavaNCSS">
<property name="methodMaximum" value="50"/>
<property name="classMaximum" value="1500"/>
<property name="fileMaximum" value="2000"/>
<property name="recordMaximum" value="150"/>
</module>
<module name="NPathComplexity">
<property name="max" value="200"/>
</module>
<!-- Miscellaneous -->
<module name="ArrayTypeStyle"/>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="CommentsIndentation">
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="4"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="8"/>
<property name="arrayInitIndent" value="4"/>
<property name="lineWrappingIndentation" value="8"/>
<property name="forceStrictCondition" value="false"/>
</module>
<module name="NoCodeInFile"/>
<module name="OuterTypeFilename"/>
<module name="TodoComment">
<property name="format" value="TODO"/>
<!-- TODO change back to warning after MV5 -->
<property name="severity" value="info"/>
</module>
<module name="TrailingComment">
<property name="legalComment" value="^\sSUPPRESS CHECKSTYLE:"/>
</module>
<module name="UncommentedMain"/>
<module name="UpperEll"/>
<module name="Indentation"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride"/>
<!-- Modifiers -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Naming Conventions -->
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="0"/>
<property name="allowedAbbreviations" value="MV"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF,
RECORD_COMPONENT_DEF"/>
</module>
<module name="AbstractClassName">
<property name="ignoreName" value="true"/>
<message key="name.invalidPattern"
value="Abstract class name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]{1,3}$"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ConstantName">
<message key="name.invalidPattern"
value="Constant name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="^[A-Z]{1,3}$"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalFinalVariableName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local final variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$|^[A-Z][A-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodName">
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z]{1,3}$"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="PackageName">
<property name="severity" value="info"/>
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="PatternVariableName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Pattern variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="RecordComponentName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Record component name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="RecordTypeParameterName">
<property name="format" value="^[A-Z]{1,3}$"/>
<message key="name.invalidPattern"
value="Record type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="StaticVariableName">
<message key="name.invalidPattern"
value="Static variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
ANNOTATION_DEF, RECORD_DEF"/>
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<!-- Size Violations -->
<module name="AnonInnerLength">
<property name="max" value="20"/>
</module>
<module name="ExecutableStatementCount">
<property name="max" value="30"/>
</module>
<module name="LambdaBodyLength">
<property name="id" value="LambdaGettingTooLong"/>
<property name="max" value="10"/>
<property name="severity" value="info"/>
</module>
<module name="LambdaBodyLength">
<property name="id" value="LambdaProbablyTooLong"/>
<property name="max" value="25"/>
</module>
<module name="MethodCount">
<property name="maxTotal" value="100"/>
<property name="maxPrivate" value="100"/>
<property name="maxPackage" value="100"/>
<property name="maxProtected" value="100"/>
<property name="maxPublic" value="100"/>
</module>
<module name="MethodLength">
<property name="max" value="50"/>
<property name="severity" value="warning"/>
</module>
<module name="OuterTypeNumber">
<property name="max" value="1"/>
</module>
<module name="ParameterNumber">
<property name="id" value="ConsiderLessMethodParameters"/>
<property name="max" value="4"/>
<property name="ignoreOverriddenMethods" value="true"/>
<property name="severity" value="info"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="ParameterNumber">
<property name="id" value="ProbablyTooManyMethodParameters"/>
<property name="max" value="10"/>
<property name="ignoreOverriddenMethods" value="true"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="ParameterNumber">
<property name="id" value="ConsiderLessConstructorParameters"/>
<property name="max" value="7"/>
<property name="ignoreOverriddenMethods" value="true"/>
<property name="severity" value="info"/>
<property name="tokens" value="CTOR_DEF"/>
</module>
<module name="ParameterNumber">
<property name="id" value="ProbablyTooManyConstructorParameters"/>
<property name="max" value="12"/>
<property name="ignoreOverriddenMethods" value="true"/>
<property name="tokens" value="CTOR_DEF"/>
</module>
<module name="RecordComponentNumber">
<property name="max" value="8"/>
</module>
<!-- Whitespace -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
<property name="tokens"
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF"/>
</module>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="MethodParamPad">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
</module>
<module name="NoLineWrap">
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
</module>
<module name="NoWhitespaceAfter">
<property name="tokens"
value="AT, INC, DEC, UNARY_MINUS,UNARY_PLUS,BNOT,LNOT,DOT,ARRAY_DECLARATOR,INDEX_OP,LITERAL_SYNCHRONIZED,METHOD_REF"/>
</module>
<module name="NoWhitespaceBefore">
<property name="id" value="AllowedWhitespaceBeforeWithoutLinebreak"/>
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, ELLIPSIS, LABELED_STAT"/>
</module>
<module name="NoWhitespaceBefore">
<property name="id" value="AllowedWhitespaceBeforeWithLinebreak"/>
<property name="tokens" value="DOT, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="OperatorWrap">
<property name="tokens"
value="QUESTION, COLON, EQUAL, NOT_EQUAL, DIV, PLUS, MINUS, STAR, MOD,
SR, BSR, GE, GT, SL, LE, LT, BXOR, BOR, LOR, BAND, LAND, LITERAL_INSTANCEOF,
TYPE_EXTENSION_AND, ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN,
STAR_ASSIGN, MOD_ASSIGN, SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN,
BOR_ASSIGN, BAND_ASSIGN, METHOD_REF"/>
</module>
<module name="ParenPad">
<property name="tokens"
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA,
RECORD_DEF"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapNl"/>
<property name="option" value="nl"/>
<property name="tokens" value="DOT, AT, METHOD_REF"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapEol"/>
<property name="option" value="eol"/>
<property name="tokens"
value="COMMA, SEMI, ELLIPSIS, RPAREN, ARRAY_DECLARATOR, RBRACK"/>
</module>
<module name="SingleSpaceSeparator"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter">
<property name="tokens"
value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE, LITERAL_RETURN,
LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, LITERAL_FINALLY, DO_WHILE, ELLIPSIS,
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_CATCH, LAMBDA,
LITERAL_YIELD, LITERAL_CASE"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="ignoreEnhancedForColon" value="false"/>
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks
may only be represented as '{}' when not part of a multi-block statement"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
</module>
</module>
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+21 -13
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +134,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Vendored
+12 -10
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
-5
View File
@@ -1,5 +0,0 @@
/*
* This file was generated by the Gradle 'init' task.
*/
rootProject.name = 'multiverse-core'
+11
View File
@@ -0,0 +1,11 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
url = uri("https://repo.onarandombox.com/multiverse-releases")
}
}
}
rootProject.name = "Multiverse-Core"
@@ -1,13 +0,0 @@
package co.aikar.commands;
import org.bukkit.command.CommandSender;
/**
* Exists just so we can extend BukkitCommandIssuer since it has a package-private constructor.
*/
public abstract class OpenBukkitCommandIssuer extends BukkitCommandIssuer {
protected OpenBukkitCommandIssuer(BukkitCommandManager manager, CommandSender sender) {
super(manager, sender);
}
}
@@ -1,426 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore;
import java.io.File;
import java.lang.annotation.Annotation;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.anchor.AnchorManager;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.MVCore;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.PluginLocales;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.economy.MVEconomist;
import com.onarandombox.MultiverseCore.inject.InjectableListener;
import com.onarandombox.MultiverseCore.inject.PluginInjection;
import com.onarandombox.MultiverseCore.placeholders.MultiverseCorePlaceholders;
import com.onarandombox.MultiverseCore.utils.TestingMode;
import com.onarandombox.MultiverseCore.utils.metrics.MetricsConfigurator;
import com.onarandombox.MultiverseCore.world.WorldProperties;
import io.vavr.control.Try;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import me.main__.util.SerializationConfig.SerializationConfig;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.java.JavaPluginLoader;
import org.glassfish.hk2.api.MultiException;
import org.glassfish.hk2.api.ServiceHandle;
import org.glassfish.hk2.api.ServiceLocator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
/**
* The implementation of the Multiverse-{@link MVCore}.
*/
@Service
public class MultiverseCore extends JavaPlugin implements MVCore {
private static final int PROTOCOL = 50;
private ServiceLocator serviceLocator;
@Inject
private MVCoreConfig config;
@Inject
private Provider<MVWorldManager> worldManagerProvider;
@Inject
private Provider<AnchorManager> anchorManagerProvider;
@Inject
private Provider<MVCommandManager> commandManagerProvider;
@Inject
private Provider<DestinationsProvider> destinationsProviderProvider;
@Inject
private Provider<MetricsConfigurator> metricsConfiguratorProvider;
@Inject
private Provider<MVEconomist> economistProvider;
@Inject
private Provider<PluginLocales> pluginLocalesProvider;
// Counter for the number of plugins that have registered with us
private int pluginCount;
/**
* This is the constructor for the MultiverseCore.
*/
public MultiverseCore() {
super();
}
@Override
public void onLoad() {
// Create our DataFolder
getDataFolder().mkdirs();
// Setup our Logging
Logging.init(this);
// Register our config classes
SerializationConfig.registerAll(WorldProperties.class);
SerializationConfig.initLogging(Logging.getLogger());
}
/**
* {@inheritDoc}
*/
@Override
public void onEnable() {
initializeDependencyInjection();
// Load our configs first as we need them for everything else.
if (config == null || !config.isLoaded()) {
Logging.severe("Your configs were not loaded.");
Logging.severe("Please check your configs and restart the server.");
this.getServer().getPluginManager().disablePlugin(this);
return;
}
Logging.setShowingConfig(shouldShowConfig());
var worldManager = worldManagerProvider.get();
worldManager.loadWorldsConfig();
worldManager.getDefaultWorldGenerators();
worldManager.loadDefaultWorlds();
worldManager.loadWorlds(true);
// Now set the firstspawnworld (after the worlds are loaded):
worldManager.setFirstSpawnWorld(config.getFirstSpawnLocation());
MVWorld firstSpawnWorld = worldManager.getFirstSpawnWorld();
if (firstSpawnWorld != null) {
config.setFirstSpawnLocation(firstSpawnWorld.getName());
}
//Setup economy here so vault is loaded
this.loadEconomist();
// Init all the other stuff
this.loadAnchors();
this.registerEvents();
this.setUpLocales();
this.registerCommands();
this.registerDestinations();
this.setupMetrics();
this.loadPlaceholderAPIIntegration();
this.saveAllConfigs();
this.logEnableMessage();
}
/**
* {@inheritDoc}
*/
@Override
public void onDisable() {
this.saveAllConfigs();
shutdownDependencyInjection();
Logging.shutdown();
}
private void initializeDependencyInjection() {
serviceLocator = PluginInjection.createServiceLocator(new MultiverseCorePluginBinder(this))
.andThenTry(locator -> {
PluginInjection.enable(this, locator);
})
.getOrElseThrow(exception -> {
Logging.severe("Failed to initialize dependency injection");
getServer().getPluginManager().disablePlugin(this);
return new RuntimeException(exception);
});
}
private void shutdownDependencyInjection() {
if (serviceLocator != null) {
PluginInjection.disable(this, serviceLocator);
serviceLocator = null;
}
}
private boolean shouldShowConfig() {
return !config.getSilentStart();
}
private void loadEconomist() {
Try.run(() -> economistProvider.get())
.onFailure(e -> {
Logging.severe("Failed to load economy integration");
e.printStackTrace();
});
}
private void loadAnchors() {
Try.of(() -> anchorManagerProvider.get())
.onSuccess(AnchorManager::loadAnchors)
.onFailure(e -> {
Logging.severe("Failed to load anchors");
e.printStackTrace();
});
}
/**
* Function to Register all the Events needed.
*/
private void registerEvents() {
var pluginManager = getServer().getPluginManager();
Try.run(() -> serviceLocator.getAllServices(InjectableListener.class)
.forEach(listener -> pluginManager.registerEvents(listener, this)))
.onFailure(e -> {
throw new RuntimeException("Failed to register listeners. Terminating...", e);
});
}
/**
* Register Multiverse-Core commands to Command Manager.
*/
private void registerCommands() {
Try.of(() -> commandManagerProvider.get())
.andThenTry(commandManager -> {
serviceLocator.getAllServices(MultiverseCommand.class)
.forEach(commandManager::registerCommand);
})
.onFailure(e -> {
Logging.severe("Failed to register commands");
e.printStackTrace();
});
}
/**
* Register locales
*/
private void setUpLocales() {
Try.of(() -> commandManagerProvider.get())
.andThen(commandManager -> {
commandManager.usePerIssuerLocale(true, true);
})
.mapTry(commandManager -> pluginLocalesProvider.get())
.andThen(pluginLocales -> {
pluginLocales.addFileResClassLoader(this);
pluginLocales.addMessageBundles("multiverse-core");
})
.onFailure(e -> {
Logging.severe("Failed to register locales");
e.printStackTrace();
});
}
/**
* Register all the destinations.
*/
private void registerDestinations() {
Try.of(() -> destinationsProviderProvider.get())
.andThenTry(destinationsProvider -> {
serviceLocator.getAllServices(Destination.class)
.forEach(destinationsProvider::registerDestination);
})
.onFailure(e -> {
Logging.severe("Failed to register destinations");
e.printStackTrace();
});
}
/**
* Setup bstats Metrics.
*/
private void setupMetrics() {
if (TestingMode.isDisabled()) {
// Load metrics
Try.of(() -> metricsConfiguratorProvider.get())
.onFailure(e -> {
Logging.severe("Failed to setup metrics");
e.printStackTrace();
});
} else {
Logging.info("Metrics are disabled in testing mode.");
}
}
/**
* Logs the enable message.
*/
private void logEnableMessage() {
Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors());
if (config.isShowingDonateMessage()) {
Logging.config("Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman");
Logging.config("One time donations are also appreciated: https://www.paypal.me/dumptruckman");
}
}
private void loadPlaceholderAPIIntegration() {
if (config.isRegisterPapiHook()
&& getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
Try.run(() -> serviceLocator.createAndInitialize(MultiverseCorePlaceholders.class))
.onFailure(e -> {
Logging.severe("Failed to load PlaceholderAPI integration.");
e.printStackTrace();
});
}
}
/**
* {@inheritDoc}
*/
@Override
public MVCore getCore() {
return this;
}
/**
* {@inheritDoc}
*/
@Override
public int getProtocolVersion() {
return PROTOCOL;
}
/**
* {@inheritDoc}
*/
@Override
public String getAuthors() {
List<String> authorsList = this.getDescription().getAuthors();
if (authorsList.size() == 0) {
return "";
}
StringBuilder authors = new StringBuilder();
authors.append(authorsList.get(0));
for (int i = 1; i < authorsList.size(); i++) {
if (i == authorsList.size() - 1) {
authors.append(" and ").append(authorsList.get(i));
} else {
authors.append(", ").append(authorsList.get(i));
}
}
return authors.toString();
}
/**
* {@inheritDoc}
*/
@Override
public int getPluginCount() {
return this.pluginCount;
}
@NotNull
@Override
public Logger getLogger() {
return Logging.getLogger();
}
/**
* {@inheritDoc}
*/
@Override
public void incrementPluginCount() {
this.pluginCount += 1;
}
/**
* {@inheritDoc}
*/
@Override
public void decrementPluginCount() {
this.pluginCount -= 1;
}
/**
* {@inheritDoc}
*/
@Override
public boolean saveAllConfigs() {
return config.save()
&& worldManagerProvider.get().saveWorldsConfig()
&& anchorManagerProvider.get().saveAnchors();
}
/**
* Gets the best service from this plugin that implements the given contract or has the given implementation.
*
* @param contractOrImpl The contract or concrete implementation to get the best instance of
* @param qualifiers The set of qualifiers that must match this service definition
* @return An instance of the contract or impl if it is a service and is already instantiated, null otherwise
* @throws MultiException if there was an error during service lookup
*/
@Nullable
public <T> T getService(@NotNull Class<T> contractOrImpl, Annotation... qualifiers) throws MultiException {
var handle = serviceLocator.getServiceHandle(contractOrImpl, qualifiers);
if (handle != null && handle.isActive()) {
return handle.getService();
}
return null;
}
/**
* Gets all services from this plugin that implement the given contract or have the given implementation and have
* the provided qualifiers.
*
* @param contractOrImpl The contract or concrete implementation to get the best instance of
* @param qualifiers The set of qualifiers that must match this service definition
* @return A list of services implementing this contract or concrete implementation. May not return null, but may
* return an empty list
* @throws MultiException if there was an error during service lookup
*/
@NotNull
public <T> List<T> getAllServices(
@NotNull Class<T> contractOrImpl,
Annotation... qualifiers
) throws MultiException {
var handles = serviceLocator.getAllServiceHandles(contractOrImpl, qualifiers);
return handles.stream()
.filter(ServiceHandle::isActive)
.map(ServiceHandle::getService)
.collect(Collectors.toList());
}
/**
* This is for unit testing ONLY. Do not use this constructor.
*
* @param loader The PluginLoader to use.
* @param description The Description file to use.
* @param dataFolder The folder that other datafiles can be found in.
* @param file The location of the plugin.
*/
public MultiverseCore(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
super(loader, description, dataFolder, file);
}
}
@@ -1,18 +0,0 @@
package com.onarandombox.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVCore;
import com.onarandombox.MultiverseCore.inject.binder.JavaPluginBinder;
import org.glassfish.hk2.utilities.binding.ScopedBindingBuilder;
import org.jetbrains.annotations.NotNull;
class MultiverseCorePluginBinder extends JavaPluginBinder<MultiverseCore> {
protected MultiverseCorePluginBinder(@NotNull MultiverseCore plugin) {
super(plugin);
}
@Override
protected ScopedBindingBuilder<MultiverseCore> bindPluginClass(ScopedBindingBuilder<MultiverseCore> bindingBuilder) {
return super.bindPluginClass(bindingBuilder).to(MVCore.class).to(MultiverseCore.class);
}
}
@@ -1,188 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.anchor;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.LocationManipulation;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import jakarta.inject.Inject;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jvnet.hk2.annotations.Service;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Manages anchors.
*/
@Service
public class AnchorManager {
private Map<String, Location> anchors;
private FileConfiguration anchorConfig;
private final Plugin plugin;
private final LocationManipulation locationManipulation;
private final MVCoreConfig config;
@Inject
public AnchorManager(
MultiverseCore plugin,
LocationManipulation locationManipulation,
MVCoreConfig config
) {
this.plugin = plugin;
this.locationManipulation = locationManipulation;
this.config = config;
this.anchors = new HashMap<String, Location>();
}
/**
* Loads all anchors.
*/
public void loadAnchors() {
this.anchors = new HashMap<String, Location>();
this.anchorConfig = YamlConfiguration.loadConfiguration(new File(this.plugin.getDataFolder(), "anchors.yml"));
this.ensureConfigIsPrepared();
ConfigurationSection anchorsSection = this.anchorConfig.getConfigurationSection("anchors");
Set<String> anchorKeys = anchorsSection.getKeys(false);
for (String key : anchorKeys) {
//world:x,y,z:pitch:yaw
Location anchorLocation = this.locationManipulation.stringToLocation(anchorsSection.getString(key, ""));
if (anchorLocation != null) {
Logging.config("Loading anchor: '%s'...", key);
this.anchors.put(key, anchorLocation);
} else {
Logging.warning("The location for anchor '%s' is INVALID.", key);
}
}
}
private void ensureConfigIsPrepared() {
if (this.anchorConfig.getConfigurationSection("anchors") == null) {
this.anchorConfig.createSection("anchors");
}
}
/**
* Saves all anchors.
* @return True if all anchors were successfully saved.
*/
public boolean saveAnchors() {
try {
this.anchorConfig.save(new File(this.plugin.getDataFolder(), "anchors.yml"));
return true;
} catch (IOException e) {
Logging.severe("Failed to save anchors.yml. Please check your file permissions.");
return false;
}
}
/**
* Gets the {@link Location} associated with an anchor.
* @param anchor The name of the anchor.
* @return The {@link Location}.
*/
public Location getAnchorLocation(String anchor) {
if (this.anchors.containsKey(anchor)) {
return this.anchors.get(anchor);
}
return null;
}
/**
* Saves an anchor.
* @param anchor The name of the anchor.
* @param location The location of the anchor as string.
* @return True if the anchor was successfully saved.
*/
public boolean saveAnchorLocation(String anchor, String location) {
Location parsed = this.locationManipulation.stringToLocation(location);
return parsed != null && this.saveAnchorLocation(anchor, parsed);
}
/**
* Saves an anchor.
* @param anchor The name of the anchor.
* @param l The {@link Location} of the anchor.
* @return True if the anchor was successfully saved.
*/
public boolean saveAnchorLocation(String anchor, Location l) {
if (l == null) {
return false;
}
this.anchorConfig.set("anchors." + anchor, this.locationManipulation.locationToString(l));
this.anchors.put(anchor, l);
return this.saveAnchors();
}
/**
* Gets all anchors.
* @return An unmodifiable {@link Set} containing all anchors.
*/
public Set<String> getAllAnchors() {
return Collections.unmodifiableSet(this.anchors.keySet());
}
/**
* Gets all anchors that the specified {@link Player} can access.
* @param p The {@link Player}.
* @return An unmodifiable {@link Set} containing all anchors the specified {@link Player} can access.
*/
public Set<String> getAnchors(Player p) {
if (p == null) {
return this.anchors.keySet();
}
Set<String> myAnchors = new HashSet<String>();
for (String anchor : this.anchors.keySet()) {
Location ancLoc = this.anchors.get(anchor);
if (ancLoc == null) {
continue;
}
String worldPerm = "multiverse.access." + ancLoc.getWorld().getName();
// Add to the list if we're not enforcing access
// OR
// We are enforcing access and the user has the permission.
if (!config.getEnforceAccess() ||
(config.getEnforceAccess() && p.hasPermission(worldPerm))) {
myAnchors.add(anchor);
} else {
Logging.finer(String.format("Not adding anchor %s to the list, user %s doesn't have the %s " +
"permission and 'enforceaccess' is enabled!",
anchor, p.getName(), worldPerm));
}
}
return Collections.unmodifiableSet(myAnchors);
}
/**
* Deletes the specified anchor.
* @param s The name of the anchor.
* @return True if the anchor was successfully deleted.
*/
public boolean deleteAnchor(String s) {
if (this.anchors.containsKey(s)) {
this.anchors.remove(s);
this.anchorConfig.set("anchors." + s, null);
return this.saveAnchors();
}
return false;
}
}
@@ -1,81 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Vehicle;
import org.jvnet.hk2.annotations.Contract;
/**
* Used to get block/location-related information.
*/
@Contract
public interface BlockSafety {
/**
* This function checks whether the block at the given coordinates are above air or not.
* @param l The {@link Location} of the block.
* @return True if the block at that {@link Location} is above air.
*/
boolean isBlockAboveAir(Location l);
/**
* Checks if a player can spawn safely at the given coordinates.
* @param world The {@link World}.
* @param x The x-coordinate.
* @param y The y-coordinate.
* @param z The z-coordinate.
* @return True if a player can spawn safely at the given coordinates.
*/
boolean playerCanSpawnHereSafely(World world, double x, double y, double z);
/**
* This function checks whether the block at the coordinates given is safe or not by checking for Lava/Fire/Air
* etc. This also ensures there is enough space for a player to spawn!
*
* @param l The {@link Location}
* @return Whether the player can spawn safely at the given {@link Location}
*/
boolean playerCanSpawnHereSafely(Location l);
/**
* Gets a safe bed spawn location OR null if the bed is invalid.
* @param l The location of the bead head (block with the pillow on it).
* @return Safe location around the bed or null if no location was found.
*/
Location getSafeBedSpawn(Location l);
/**
* Gets the location of the top block at the specified {@link Location}.
* @param l Any {@link Location}.
* @return The {@link Location} of the top-block.
*/
Location getTopBlock(Location l);
/**
* Gets the location of the top block at the specified {@link Location}.
* @param l Any {@link Location}.
* @return The {@link Location} of the top-block.
*/
Location getBottomBlock(Location l);
/**
* Checks if an entity would be on track at the specified {@link Location}.
* @param l The {@link Location}.
* @return True if an entity would be on tracks at the specified {@link Location}.
*/
boolean isEntitiyOnTrack(Location l);
/**
* Checks if the specified {@link Minecart} can spawn safely.
* @param cart The {@link Minecart}.
* @return True if the minecart can spawn safely.
*/
boolean canSpawnCartSafely(Minecart cart);
/**
* Checks if the specified {@link Vehicle} can spawn safely.
* @param vehicle The {@link Vehicle}.
* @return True if the vehicle can spawn safely.
*/
boolean canSpawnVehicleSafely(Vehicle vehicle);
}
@@ -1,58 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import java.util.Collection;
import co.aikar.commands.BukkitCommandIssuer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Contract;
@Contract
public interface Destination<T extends DestinationInstance> {
/**
* Returns the identifier or prefix that is required for this destination.
*
* <p>Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
* Please check the wiki when adding a custom destination!</p>
*
* @return The identifier or prefix that is required for this destination.
*/
@NotNull String getIdentifier();
/**
* Returns the destination instance for the given destination parameters.
*
* @param destinationParams The destination parameters. ex: p:MyPortal:nw
* @return The destination instance, or null if the destination parameters are invalid.
*/
@Nullable T getDestinationInstance(@Nullable String destinationParams);
/**
* Returns a list of possible destinations for the given destination parameters.
*
* @param issuer The command issuer.
* @param destinationParams The destination parameters. ex: p:MyPortal:nw
* @return A list of possible destinations.
*/
@NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer, @Nullable String destinationParams);
/**
* Should the Multiverse SafeTeleporter be used?
*
* <p>If not, MV will blindly take people to the location specified.</p>
*
* @return True if the SafeTeleporter will be used, false if not.
*/
boolean checkTeleportSafety();
/**
* Returns the teleporter to use for this destination.
*
* <p>By default, Multiverse will automatically use SafeTeleporter. If you want to use a different teleporter, you can
* override this method.</p>
*
* @return The custom teleporter to use for this destination. Return null to use the default teleporter.
*/
@Nullable Teleporter getTeleporter();
}
@@ -1,45 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface DestinationInstance {
/**
* Gets the exact location to teleport an entity to.
*
* @param teleportee The entity to teleport.
* @return The location to teleport to.
*/
@Nullable Location getLocation(@NotNull Entity teleportee);
/**
* Gets the velocity to apply to an entity after teleporting.
*
* @param teleportee The entity to teleport.
* @return A vector representing the speed/direction the player should travel when arriving at the destination.
*/
@Nullable Vector getVelocity(@NotNull Entity teleportee);
/**
* Gets the permission suffix to check for when teleporting to this destination.
* This is used for finer per world/player permissions, such as "multiverse.teleport.self.worldname".
*
* <p>For example, if the destination is "w:world", the permission suffix is "world".</p>
*
* @return The permission suffix.
*/
@Nullable String getFinerPermissionSuffix();
/**
* Serialises the destination instance to a savable string.
*
* <p>This is used when plugins save destinations to configuration,
* and when the destination is displayed to the user.</p>
*
* @return The serialised destination instance.
*/
@NotNull String serialise();
}
@@ -1,101 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Vehicle;
import org.bukkit.util.Vector;
import org.jvnet.hk2.annotations.Contract;
/**
* Used to manipulate locations.
*/
@Contract
public interface LocationManipulation {
/**
* Convert a Location into a Colon separated string to allow us to store it in text.
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding String2Loc function is {@link #stringToLocation}
*
* @param location The Location to save.
* @return The location as a string in this format: WORLD:x,y,z:yaw:pitch
*/
String locationToString(Location location);
/**
* This method simply does some rounding, rather than forcing a call to the server to get the blockdata.
*
* @param l The location to round to the block location
* @return A rounded location.
*/
Location getBlockLocation(Location l);
/**
* Returns a new location from a given string. The format is as follows:
* <p>
* WORLD:X,Y,Z:yaw:pitch
* <p>
* The corresponding Location2String function is {@link #stringToLocation}
*
* @param locationString The location represented as a string (WORLD:X,Y,Z:yaw:pitch)
* @return A new location defined by the string or null if the string was invalid.
*/
Location stringToLocation(String locationString);
/**
* Returns a colored string with the coords.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoords(Location l);
/**
* Converts a location to a printable readable formatted string including pitch/yaw.
*
* @param l The {@link Location}
* @return The {@link String}
*/
String strCoordsRaw(Location l);
/**
* Return the NESW Direction a Location is facing.
*
* @param location The {@link Location}
* @return The NESW Direction
*/
String getDirection(Location location);
/**
* Returns the float yaw position for the given cardinal direction.
*
* @param orientation The cardinal direction
* @return The yaw
*/
float getYaw(String orientation);
/**
* Returns a speed float from a given vector.
*
* @param v The {@link Vector}
* @return The speed
*/
float getSpeed(Vector v);
/**
* Returns a translated vector from the given direction.
*
* @param v The old {@link Vector}
* @param direction The new direction
* @return The translated {@link Vector}
*/
Vector getTranslatedVector(Vector v, String direction);
/**
* Returns the next Location that a {@link Vehicle} is traveling at.
*
* @param v The {@link Vehicle}
* @return The {@link Location}
*/
Location getNextBlock(Vehicle v);
}
@@ -1,231 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
import com.onarandombox.MultiverseCore.placeholders.MultiverseCorePlaceholders;
import io.vavr.control.Try;
import org.jvnet.hk2.annotations.Contract;
@Contract
public interface MVConfig {
/**
* Loads the config from disk.
* @return True if the config was loaded successfully.
*/
boolean load();
/**
* Whether the config has been loaded.
* @return True if the config has been loaded.
*/
boolean isLoaded();
/**
* Saves the config to disk.
*/
boolean save();
/**
* Gets the nodes for the config.
*
* @return The nodes for the config.
*/
NodeGroup getNodes();
/**
* Gets a property from the config.
*
* @param name The name of the property.
* @return A {@link Try} with the value of the property, otherwise a {@link Try.Failure} if there is no property by
* that name.
*/
Try<Object> getProperty(String name);
/**
* Sets a property in the config.
*
* @param name The name of the property.
* @param value The value of the property.
* @return An empty {@link Try} if the property was set successfully, otherwise a {@link Try.Failure} with the
* exception explaining why the property could not be set.
*/
Try<Void> setProperty(String name, Object value);
/**
* Sets world access permissions should be enforced.
* @param enforceAccess The new value.
*/
void setEnforceAccess(boolean enforceAccess);
/**
* Gets enforceAccess.
* @return enforceAccess.
*/
boolean getEnforceAccess();
/**
* Sets whether the game mode should be enforced.
* @param enforceGameMode The new value.
*/
void setEnforceGameMode(boolean enforceGameMode);
/**
* Gets enforceGameMode value.
* @return True if game mode should be enforced.
*/
boolean getEnforceGameMode();
/**
* Sets whether or not the automatic purge of entities is enabled.
*
* @param autopurge True if automatic purge should be enabled.
*/
void setAutoPurgeEntities(boolean autopurge);
/**
* Gets whether or not the automatic purge of entities is enabled.
*
* @return True if automatic purge is enabled.
*/
boolean isAutoPurgeEntities();
/**
* Sets teleportIntercept.
* @param teleportIntercept The new value.
*/
void setTeleportIntercept(boolean teleportIntercept);
/**
* Gets teleportIntercept.
* @return teleportIntercept.
*/
boolean getTeleportIntercept();
/**
* Sets firstSpawnOverride.
* @param firstSpawnOverride The new value.
*/
void setFirstSpawnOverride(boolean firstSpawnOverride);
/**
* Gets firstSpawnOverride.
* @return firstSpawnOverride.
*/
boolean getFirstSpawnOverride();
/**
* Sets firstSpawnWorld.
* @param firstSpawnWorld The new value.
*/
void setFirstSpawnLocation(String firstSpawnWorld);
/**
* Gets firstSpawnWorld.
* @return firstSpawnWorld.
*/
String getFirstSpawnLocation();
/**
* Sets whether or not to let Bukkit determine portal search radius on its own or if Multiverse should give input.
*
* @param useDefaultPortalSearch True to let Bukkit determine portal search radius on its own.
*/
void setUseCustomPortalSearch(boolean useDefaultPortalSearch);
/**
* Gets whether or not Bukkit will be determining portal search radius on its own or if Multiverse should help.
*
* @return True means Bukkit will use its own default values.
*/
boolean isUsingCustomPortalSearch();
/**
* Sets the radius at which vanilla style portals will be searched for to connect to worlds together.
*
* @param searchRadius The portal search radius.
*/
void setCustomPortalSearchRadius(int searchRadius);
/**
* Gets the radius at which vanilla style portals will be searched for to connect to worlds together.
*
* @return The portal search radius.
*/
int getCustomPortalSearchRadius();
/**
* Sets prefixChat.
* @param prefixChat The new value.
*/
void setEnablePrefixChat(boolean prefixChat);
/**
* Gets prefixChat.
* @return prefixChat.
*/
boolean isEnablePrefixChat();
/**
* Sets prefixChatFormat.
* @param prefixChatFormat The new value.
*/
void setPrefixChatFormat(String prefixChatFormat);
/**
* Gets prefixChatFormat.
* @return prefixChatFormat.
*/
String getPrefixChatFormat();
/**
* Sets whether to register the {@link MultiverseCorePlaceholders} class with PlaceholderAPI plugin.
* @param registerPapiHook The new value.
*/
void setRegisterPapiHook(boolean registerPapiHook);
/**
* Gets whether to register the {@link MultiverseCorePlaceholders} class with PlaceholderAPI plugin.
* @return registerPapiHook.
*/
boolean isRegisterPapiHook();
/**
* Sets globalDebug.
* @param globalDebug The new value.
*/
void setGlobalDebug(int globalDebug);
/**
* Gets globalDebug.
* @return globalDebug.
*/
int getGlobalDebug();
/**
* Sets whether to suppress startup messages.
*
* @param silentStart true to suppress messages.
*/
void setSilentStart(boolean silentStart);
/**
* Whether we are suppressing startup messages.
*
* @return true if we are suppressing startup messages.
*/
boolean getSilentStart();
/**
* Sets whether or not the donation/patreon messages are shown.
*
* @param idonotwanttodonate True if donation/patreon messages should be shown.
*/
void setShowDonateMessage(boolean idonotwanttodonate);
/**
* Gets whether or not the donation/patreon messages are shown.
*
* @return True if donation/patreon messages should be shown.
*/
boolean isShowingDonateMessage();
}
@@ -1,40 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
/**
* Multiverse 2 Core API
* <p>
* This API contains a bunch of useful things you can get out of Multiverse in general!
*/
public interface MVCore extends MVPlugin {
/**
* Saves all configs.
*
* @return Whether the config was successfully saved
*/
boolean saveAllConfigs();
/**
* Decrements the number of plugins that have specifically hooked into core.
*/
void decrementPluginCount();
/**
* Increments the number of plugins that have specifically hooked into core.
*/
void incrementPluginCount();
/**
* Returns the number of plugins that have specifically hooked into core.
*
* @return The number if plugins that have hooked into core.
*/
int getPluginCount();
}
@@ -1,142 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
/**
* A destination API for Multiverse
* Any plugin can add these to MV and when they are, any action that uses them (portals, MVTP, etc.) can use them!
*/
@Deprecated
public interface MVDestination {
/**
* Returns the identifier or prefix that is required for this destination.
* <p>
* Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a
* hash and cannot have duplicate values. Read that as your plugin cannot use 'p' because it's already used.
* Please check the wiki when adding a custom destination!
*
* @return The identifier or prefix that is required for this destination.
*/
String getIdentifier();
/**
* Allows you to determine if a Destination is valid for the type it thinks it is.
* <p>
* An example of this would be the exact destination. A valid string would be: e:0,0,0 where an invalid one would
* be e:1:2:3. The first string would return true the second would return false. This is simply a convenience
* method
* and does not even NEED to be called, but it's highly recommended if you're teleporting, but it's mainly for
* Multiverse Internal use.
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*
* @return True if the destination is valid, false if not.
*/
boolean isThisType(JavaPlugin plugin, String destination);
/**
* Returns the location a specific entity will spawn at when being teleported to this Destination.
* <p>
* To just retrieve the location as it is stored you can just pass null, but be warned some destinations may return
* null back to you if you do this. It is always safer to pass an actual entity. This is used so things like
* minecarts can be teleported.
* <p>
* Do not forget to use {@link #getVelocity()} as destinations can use this too!
*
* @param entity The entity to be teleported.
*
* @return The location of the entity.
*/
Location getLocation(Entity entity);
/**
* Returns the velocity vector for this destination.
* <p>
* Plugins wishing to fully support MVDestinations MUST implement this.
*
* @return A vector representing the speed/direction the player should travel when arriving
*/
Vector getVelocity();
/**
* Sets the destination string.
* <p>
* This should be used when you want to tell this destination object about a change in where it should take people.
* The destination param should be match the result from {@link #getIdentifier()}. A valid example would be that if
* {@link #getIdentifier()} returned "ow" our destination string could be "ow:TownCenter" but could not be
* "p:HomePortal"
*
* @param plugin The plugin who the type belongs to.
* @param destination The destination string. ex: p:MyPortal:nw
*/
void setDestination(JavaPlugin plugin, String destination);
/**
* Returns true if the destination is valid and players will be taken to it.
* <p>
* Even if destinations are in the correct format (p:MyPortal) MyPortal may not exist, and therefore this would
* return false.
*
* @return True if the destination is valid; false if not.
*/
boolean isValid();
/**
* Gives you a general friendly description of the type of destination.
* <p>
* For example, the PlayerDestination sets this to "Player". You can use this to show where a player will be taken.
*
* @return A friendly string description of the type of destination.
*/
String getType();
/**
* Gives you a specific name of the destination.
* <p>
* For example, the PlayerDestination sets this to The Player's Name.
*
* @return A friendly string stating the name of the destination.
*/
String getName();
/**
* Returns a string that can easily be saved in the config that contains all the details needed to rebuild this
* destination.
* <p>
* ex: e:0,0,0:50:50
*
* @return The savable config string.
*/
String toString();
/**
* Returns the permissions string required to go here.
* <p>
* ex: multiverse.access.world
* <p>
* NOTE: This is NOT the permission to use the teleport command.
*
* @return the permissions string required to go here.
*/
String getRequiredPermission();
/**
* Should the Multiverse SafeTeleporter be used?
* <p>
* If not, MV will blindly take people to the location specified.
*
* @return True if the SafeTeleporter will be used, false if not.
*/
boolean useSafeTeleporter();
}
@@ -1,36 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
/**
* This interface is implemented by every official Multiverse-plugin.
*/
public interface MVPlugin {
/**
* Gets the reference to MultiverseCore.
*
* @return A valid {@link com.onarandombox.MultiverseCore}.
*/
MVCore getCore();
/**
* Allows Multiverse or a plugin to query another Multiverse plugin to see what version its protocol is. This
* number
* should change when something will break the code.
*
* @return The Integer protocol version.
*/
int getProtocolVersion();
/**
* Parse the Authors Array into a readable String with ',' and 'and'.
*
* @return The readable authors-{@link String}
*/
String getAuthors();
}
@@ -1,675 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import java.util.List;
import com.onarandombox.MultiverseCore.exceptions.PropertyDoesNotExistException;
import com.onarandombox.MultiverseCore.world.configuration.AddProperties;
import com.onarandombox.MultiverseCore.world.configuration.AllowedPortalType;
import com.onarandombox.MultiverseCore.world.configuration.EnglishChatColor;
import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.permissions.Permission;
import org.jetbrains.annotations.Nullable;
/**
* The API for a Multiverse Handled World.
*/
public interface MVWorld {
/**
* Returns the Bukkit world object that this world describes.
*
* @return A {@link World}
*/
World getCBWorld();
/**
* Gets the name of this world. The name cannot be changed.
* <p>
* Note for plugin developers: Usually {@link #getAlias()}
* is what you want to use instead of this method.
*
* @return The name of the world as a String.
*/
String getName();
/**
* Gets the type of this world. As of 1.2 this will be:
* FLAT, NORMAL or VERSION_1_1
* <p>
* This is <b>not</b> the generator.
*
* @return The Type of this world.
*/
WorldType getWorldType();
/**
* Gets the environment of this world.
*
* @return A {@link org.bukkit.World.Environment}.
*/
World.Environment getEnvironment();
/**
* Sets the environment of a world.
* <p>
* Note: This will ONLY take effect once the world is unloaded/reloaded.
*
* @param environment A {@link org.bukkit.World.Environment}.
*/
void setEnvironment(World.Environment environment);
/**
* Gets the difficulty of this world.
*
* @return The difficulty of this world.
*/
Difficulty getDifficulty();
/**
* Sets the difficulty of this world and returns true if success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. {@code PEACEFUL}
*
* @param difficulty The difficulty to set the world to as a string.
* @return True if success, false if the provided string
* could not be translated to a difficulty.
* @deprecated Use {@link #setDifficulty(Difficulty)} or, if you have to
* pass a string, use {@link #setPropertyValue(String, String)} instead.
*/
@Deprecated
boolean setDifficulty(String difficulty);
/**
* Sets the difficulty of this world and returns {@code true} on success.
* Valid string values are either an integer of difficulty(0-3) or
* the name that resides in the Bukkit enum, ex. PEACEFUL
*
* @param difficulty The new difficulty.
* @return True if success, false if the operation failed... for whatever reason.
*/
boolean setDifficulty(Difficulty difficulty);
/**
* Gets the world seed of this world.
*
* @return The Long version of the seed.
*/
long getSeed();
/**
* Sets the seed of this world.
*
* @param seed A Long that is the seed.
*/
void setSeed(long seed);
/**
* Gets the generator of this world.
*
* @return The name of the generator.
*/
String getGenerator();
/**
* Sets the generator of this world.
*
* @param generator The new generator's name.
*/
void setGenerator(String generator);
/**
* Gets the help-message for a property.
* @param property The name of the property.
* @return The help-message.
* @throws PropertyDoesNotExistException Thrown if the property was not found.
*/
String getPropertyHelp(String property) throws PropertyDoesNotExistException;
/**
* Gets a property as {@link String}.
*
* @param property The name of a world property to get.
* @return The string-representation of that property.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
String getPropertyValue(String property) throws PropertyDoesNotExistException;
/**
* Sets a property to a given value.
*
* @param property The name of a world property to set.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was set, false if not.
* @throws PropertyDoesNotExistException Thrown if the property was not found in the world.
*/
boolean setPropertyValue(String property, String value) throws PropertyDoesNotExistException;
/**
* Adds a value to the given property. The property must be a {@link AddProperties}.
*
* @param property The name of a {@link AddProperties} to add a value to.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was added, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean addToVariable(String property, String value);
/**
* Removes a value from the given property. The property must be a {@link AddProperties}.
*
* @param property The name of a {@link AddProperties} to remove a value
* from.
* @param value A value in string representation, it will be parsed to the correct type.
* @return True if the value was removed, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean removeFromVariable(String property, String value);
/**
* Removes all values from the given property. The property must be a {@link AddProperties}.
*
* @param property The name of a {@link AddProperties} to clear.
* @return True if it was cleared, false if not.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean clearVariable(String property);
/**
* Clears a list property (sets it to []).
*
* @param property The property to clear.
* @return True if success, false if fail.
* @deprecated We changed the entire world-config-system. This is not compatible any more.
*/
@Deprecated
boolean clearList(String property);
// end of old config stuff
// permission stuff
/**
* Gets the lowercased name of the world. This method is required, since the permissables
* lowercase all permissions when recalculating.
* <p>
* Note: This also means if a user has worlds named: world and WORLD, that they can both
* exist, and both be teleported to independently, but their permissions **cannot** be
* uniqueified at this time. See bug report #.
*
* @return The lowercased name of the world.
*/
String getPermissibleName();
/**
* Gets the permission required to enter this world.
*
* @return The permission required to be exempt from charges to/from this world.
*/
Permission getAccessPermission();
/**
* Gets the permission required to be exempt when entering.
*
* @return The permission required to be exempt when entering.
*/
Permission getExemptPermission();
// end of permission stuff
/**
* Gets the alias of this world.
* <p>
* This alias allows users to have a world named "world" but show up in the list as "FernIsland"
*
* @return The alias of the world as a String.
*/
String getAlias();
/**
* Sets the alias of the world.
*
* @param alias A string that is the new alias.
*/
void setAlias(String alias);
/**
* Gets the color that this world's name/alias will display as.
*
* @return The color of this world.
*/
ChatColor getColor();
/**
* Sets the color that this world's name/alias will display as.
*
* @param color A valid color name.
* @return True if the color was set, false if not.
*/
boolean setColor(String color);
/**
* Gets the style that this world's name/alias will display as.
*
* @return The style of this world. {@code null} for "normal" style.
*/
ChatColor getStyle();
/**
* Sets the style that this world's name/alias will display as.
*
* @param style A valid style name.
* @return True if the style was set, false if not.
*/
boolean setStyle(String style);
/**
* Tells you if someone entered a valid color.
*
* @param color A string that may translate to a color.
* @return True if it is a color, false if not.
*
* @deprecated This has been moved: {@link EnglishChatColor#isValidAliasColor(String)}
*/
@Deprecated
boolean isValidAliasColor(String color);
/**
* Returns a very nicely colored string (using Alias and Color if they are set).
*
* @return A nicely colored string.
*/
String getColoredWorldString();
// animals&monster stuff
/**
* Gets whether or not animals are allowed to spawn in this world.
*
* @return True if ANY animal can, false if no animals can spawn.
*/
boolean canAnimalsSpawn();
/**
* Sets whether or not animals can spawn.
* If there are values in {@link #getAnimalList()} and this is false,
* those animals become the exceptions, and will spawn
*
* @param allowAnimalSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowAnimalSpawn(boolean allowAnimalSpawn);
/**
* Returns a list of animals. This list always negates the {@link #canAnimalsSpawn()} result.
*
* @return A list of animals that will spawn if {@link #canAnimalsSpawn()} is false.
*/
List<String> getAnimalList();
/**
* Gets whether or not monsters are allowed to spawn in this world.
*
* @return True if ANY monster can, false if no monsters can spawn.
*/
boolean canMonstersSpawn();
/**
* Sets whether or not monsters can spawn.
* If there are values in {@link #getMonsterList()} and this is false,
* those monsters become the exceptions, and will spawn
*
* @param allowMonsterSpawn True to allow spawning of monsters, false to prevent.
*/
void setAllowMonsterSpawn(boolean allowMonsterSpawn);
/**
* Returns a list of monsters. This list always negates the {@link #canMonstersSpawn()} result.
*
* @return A list of monsters that will spawn if {@link #canMonstersSpawn()} is false.
*/
List<String> getMonsterList();
// end of animal&monster stuff
/**
* Gets whether or not PVP is enabled in this world in some form (fake or not).
*
* @return True if players can take damage from other players.
*/
boolean isPVPEnabled();
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode.
*
* @param pvpMode True to enable PVP damage, false to disable it.
*/
void setPVPMode(boolean pvpMode);
/**
* Turn pvp on or off. This setting is used to set the world's PVP mode, and thus relies on fakePVP
*
* @return True if this world has fakepvp on
* @deprecated This is deprecated.
*/
@Deprecated
boolean getFakePVP();
/**
* Gets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @return True if the world will be hidden, false if not.
*/
boolean isHidden();
/**
* Sets whether or not this world will display in chat, mvw and mvl regardless if a user has the
* access permissions to go to this world.
*
* @param hidden Set
*/
void setHidden(boolean hidden);
/**
* Gets whether weather is enabled in this world.
*
* @return True if weather events will occur, false if not.
*/
boolean isWeatherEnabled();
/**
* Sets whether or not there will be weather events in a given world.
* If set to false, Multiverse will disable the weather in the world immediately.
*
* @param enableWeather True if weather events should occur in a world, false if not.
*/
void setEnableWeather(boolean enableWeather);
/**
* Gets whether or not CraftBukkit is keeping the chunks for this world in memory.
*
* @return True if CraftBukkit is keeping spawn chunks in memory.
*/
boolean isKeepingSpawnInMemory();
/**
* If true, tells Craftbukkit to keep a worlds spawn chunks loaded in memory (default: true)
* If not, CraftBukkit will attempt to free memory when players have not used that world.
* This will not happen immediately.
*
* @param keepSpawnInMemory If true, CraftBukkit will keep the spawn chunks loaded in memory.
*/
void setKeepSpawnInMemory(boolean keepSpawnInMemory);
/**
* Gets the spawn location of this world.
*
* @return The spawn location of this world.
*/
Location getSpawnLocation();
/**
* Sets the spawn location for a world.
*
* @param spawnLocation The spawn location for a world.
*/
void setSpawnLocation(Location spawnLocation);
/**
* Gets whether or not the hunger level of players will go down in a world.
*
* @return True if it will go down, false if it will remain steady.
*/
boolean getHunger();
/**
* Sets whether or not the hunger level of players will go down in a world.
*
* @param hungerEnabled True if hunger will go down, false to keep it at
* the level they entered a world with.
*/
void setHunger(boolean hungerEnabled);
/**
* Gets the GameMode of this world.
*
* @return The GameMode of this world.
*/
GameMode getGameMode();
/**
* Sets the game mode of this world.
*
* @param gameMode A valid game mode string (either
* an int ex. 0 or a string ex. creative).
* @return True if the game mode was successfully changed, false if not.
* @deprecated Use {@link #setGameMode(GameMode)} instead. If you have to
* pass a string, use {@link #setPropertyValue(String, String)}.
*/
@Deprecated
boolean setGameMode(String gameMode);
/**
* Sets the game mode of this world.
*
* @param gameMode The new {@link GameMode}.
* @return True if the game mode was successfully changed, false if not.
*/
boolean setGameMode(GameMode gameMode);
/**
* Gets the amount of currency it requires to enter this world.
*
* @return The amount it costs to enter this world.
*/
double getPrice();
/**
* Sets the price for entry to this world.
* You can think of this like an amount.
* The type can be set with {@link #setCurrency(Material)}
*
* @param price The Amount of money/item to enter the world.
*/
void setPrice(double price);
/**
* Gets the type of currency that will be used when users enter this world. A value of null indicates a non-item
* based currency is used.
*
* @return The type of currency that will be used when users enter this world.
*/
@Nullable
Material getCurrency();
/**
* Sets the type of item that will be required given the price is not 0.
* Use a value of null to specify a non-item based currency.
*
* @param item The Type of currency that will be used when users enter this world.
*/
void setCurrency(@Nullable Material item);
/**
* Gets the world players will respawn in if they die in this one.
*
* @return A world that exists on the server.
*/
World getRespawnToWorld();
/**
* Sets the world players will respawn in if they die in this one.
* Returns true upon success, false upon failure.
*
* @param respawnWorld The name of a world that exists on the server.
* @return True if respawnWorld existed, false if not.
*/
boolean setRespawnToWorld(String respawnWorld);
/**
* Gets the scaling value of this world.Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @return This world's non-negative, non-zero scale.
*/
double getScaling();
/**
* Sets the scale of this world. Really only has an effect if you use
* Multiverse-NetherPortals.
*
* @param scaling A scaling value, cannot be negative or 0.
* @return Whether the scale was set successfully.
*/
boolean setScaling(double scaling);
/**
* Gets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @return True if the world should heal (default), false if not.
*/
boolean getAutoHeal();
/**
* Sets whether or not a world will auto-heal players if the difficulty is on peaceful.
*
* @param heal True if the world will heal.
*/
void setAutoHeal(boolean heal);
/**
* Gets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @return True if Multiverse should adjust the spawn, false if not.
*/
boolean getAdjustSpawn();
/**
* Sets whether or not Multiverse should auto-adjust the spawn for this world.
*
* @param adjust True if multiverse should adjust the spawn, false if not.
*/
void setAdjustSpawn(boolean adjust);
/**
* Gets whether or not Multiverse should auto-load this world.
*
* @return True if Multiverse should auto-load this world.
*/
boolean getAutoLoad();
/**
* Sets whether or not Multiverse should auto-load this world.
* <p>
* True is default.
*
* @param autoLoad True if multiverse should autoload this world the spawn, false if not.
*/
void setAutoLoad(boolean autoLoad);
/**
* Gets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
*
* @return True if players dying in this world should respawn at their bed.
*/
boolean getBedRespawn();
/**
* Sets whether or not a player who dies in this world will respawn in their
* bed or follow the normal respawn pattern.
* <p>
* True is default.
*
* @param autoLoad True if players dying in this world respawn at their bed.
*/
void setBedRespawn(boolean autoLoad);
/**
* Sets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
* @param limit The new limit
*/
void setPlayerLimit(int limit);
/**
* Gets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
* @return The player limit
*/
int getPlayerLimit();
/**
* Same as {@link #getTime()}, but returns a string.
* @return The time as a short string: 12:34pm
*/
String getTime();
/**
* Sets the current time in a world.
* <p>
* This method will take the following formats:
* 11:37am
* 4:30p
* day(morning), night, noon, midnight
*
* @param timeAsString The formatted time to set the world to.
* @return True if the time was set, false if not.
*/
boolean setTime(String timeAsString);
/**
* Sets The types of portals that are allowed in this world.
*
* @param type The type of portals allowed in this world.
*/
void allowPortalMaking(AllowedPortalType type);
/**
* Gets which type(s) of portals are allowed to be constructed in this world.
*
* @return The type of portals that are allowed.
*/
AllowedPortalType getAllowedPortals();
// properties that are not "getter+setter" style
/**
* Gets a list of all the worlds that players CANNOT travel to from this world,
* regardless of their access permissions.
*
* @return A List of world names.
*/
List<String> getWorldBlacklist();
/**
* Gets all the names of all properties that can be SET.
*
* @return All property names, with alternating colors.
*/
String getAllPropertyNames();
/**
* Whether or not players are allowed to fly in this world.
*
* @return True if players allowed to fly in this world.
*/
boolean getAllowFlight();
/**
* Sets whether or not players are allowed to fly in this world.
*
* @param allowFlight True to allow flight in this world.
*/
void setAllowFlight(final boolean allowFlight);
}
@@ -1,325 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.api;
import java.util.Collection;
import java.util.List;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldType;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.generator.ChunkGenerator;
import org.jvnet.hk2.annotations.Contract;
/**
* Multiverse 2 World Manager API
* <p>
* This API contains all of the world managing
* functions that your heart desires!
*/
@Contract
public interface MVWorldManager {
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator);
/**
* Add a new World to the Multiverse Setup.
*
* @param name World Name
* @param env Environment Type
* @param seedString The seed in the form of a string.
* If the seed is a Long,
* it will be interpreted as such.
* @param type The Type of the world to be made.
* @param generateStructures If true, this world will get NPC villages.
* @param generator The Custom generator plugin to use.
* @param useSpawnAdjust If true, multiverse will search for a safe spawn. If not, It will not modify the level.dat.
* @return True if the world is added, false if not.
*/
boolean addWorld(String name, Environment env, String seedString, WorldType type, Boolean generateStructures,
String generator, boolean useSpawnAdjust);
/**
* Make a copy of a world.
*
* @param oldName
* Name of world to be copied
* @param newName
* Name of world to be created
* @return True if the world is copied successfully, false if not.
*/
boolean cloneWorld(String oldName, String newName);
/**
* Remove the world from the Multiverse list, from the config and deletes
* the folder.
*
* @param name
* The name of the world to remove
* @return True if success, false if failure.
*/
boolean deleteWorld(String name);
/**
* Remove the world from the Multiverse list, from the
* config if wanted, and deletes the folder.
*
* @param name The name of the world to remove
* @param removeConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeConfig);
/**
*
* @param name The name of the world to remove
* @param removeFromConfig If true(default), we'll remove the entries from the
* config. If false, they'll stay and the world may come back.
* @param deleteWorldFolder If true the world folder will be completely deleted. If false
* only the contents of the world folder will be deleted
* @return True if success, false if failure.
*/
boolean deleteWorld(String name, boolean removeFromConfig, boolean deleteWorldFolder);
/**
* Unload a world from Multiverse.
*
* @param name Name of the world to unload
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name);
/**
* Unload a world from Multiverse with option to prevent calling unloadWorld in Bukkit.
*
* @param name Name of the world to unload
* @param unloadBukkit True if Bukkit world should be unloaded
* @return True if the world was unloaded, false if not.
*/
boolean unloadWorld(String name, boolean unloadBukkit);
/**
* Loads the world. Only use this if the world has been
* unloaded with {@link #unloadWorld(String)}.
*
* @param name The name of the world to load
* @return True if success, false if failure.
*/
boolean loadWorld(String name);
/**
* Removes all players from the specified world.
*
* @param name World to remove players from.
*/
void removePlayersFromWorld(String name);
/**
* Test if a given chunk generator is valid.
*
* @param generator The generator name.
* @param generatorID The generator id.
* @param worldName The worldName to use as the default.
* @return A {@link ChunkGenerator} or null
*/
ChunkGenerator getChunkGenerator(String generator, String generatorID, String worldName);
/**
* Returns a list of all the worlds Multiverse knows about.
*
* @return A list of {@link MVWorld}.
*/
Collection<MVWorld> getMVWorlds();
/**
* Returns a {@link MVWorld} if it exists, and null if it does not.
* This will search name AND alias.
*
* @param name The name or alias of the world to get.
* @return A {@link MVWorld} or null.
*/
MVWorld getMVWorld(String name);
/**
* Returns a {@link MVWorld} if the world with name given exists, and null if it does not.
* This will search optionally for alias names.
*
* @param name The name or optionally the alias of the world to get.
* @param checkAliases Indicates whether to check for world alias name.
* @return A {@link MVWorld} or null.
*/
MVWorld getMVWorld(String name, boolean checkAliases);
/**
* Returns a {@link MVWorld} if it exists, and null if it does not.
*
* @param world The Bukkit world to check.
* @return A {@link MVWorld} or null.
*/
MVWorld getMVWorld(World world);
/**
* Checks to see if the given name is a valid {@link MVWorld}
* Searches based on world name AND alias.
*
* @param name The name or alias of the world to check.
* @return True if the world exists, false if not.
*/
boolean isMVWorld(String name);
/**
* Checks to see if the given name is a valid {@link MVWorld}.
* Optionally searches by alias is specified.
*
* @param name The name or alias of the world to check.
* @param checkAliases Indicates whether to check for world alias name.
* @return True if the world exists, false if not.
*/
boolean isMVWorld(String name, boolean checkAliases);
/**
* Checks to see if the given world is a valid {@link MVWorld}.
*
* @param world The Bukkit world to check.
* @return True if the world has been loaded into MV2, false if not.
*/
boolean isMVWorld(World world);
/**
* Load the Worlds &amp; Settings from the configuration file.
*
* @param forceLoad If set to true, this will perform a total
* reset and not just load new worlds.
*/
void loadWorlds(boolean forceLoad);
/**
* Loads the Worlds &amp; Settings for any worlds that bukkit loaded before us.
* <p>
* This way people will _always_ have some worlds in the list.
*/
void loadDefaultWorlds();
/**
* Gets the world players will spawn in on first join.
* Currently this always returns worlds.get(0) from Bukkit.
*
* @return A Multiverse world that players will spawn in or null if no MV world has been set.
*/
MVWorld getSpawnWorld();
/**
* Gets the list of worlds in the config, but unloaded.
*
* @return A List of worlds as strings.
*/
List<String> getUnloadedWorlds();
/**
* This method populates an internal list and needs to be called after multiverse initialization.
*/
void getDefaultWorldGenerators();
/**
* Load the config from a file.
*
* @return A loaded configuration.
*/
FileConfiguration loadWorldsConfig();
/**
* Saves the world config to disk.
*
* @return True if success, false if fail.
*/
boolean saveWorldsConfig();
/**
* Remove the world from the Multiverse list and from the config.
*
* @param name The name of the world to remove
* @return True if success, false if failure.
*/
boolean removeWorldFromConfig(String name);
/**
* Sets the initial spawn world for new players.
*
* @param world The World new players should spawn in.
*/
void setFirstSpawnWorld(String world);
/**
* Gets the world players should spawn in first.
*
* @return The {@link MVWorld} new players should spawn in.
*/
MVWorld getFirstSpawnWorld();
/**
* Regenerates a world.
*
* @param name Name of the world to regenerate
* @param useNewSeed If a new seed should be used
* @param randomSeed If the new seed should be random
* @param seed The seed of the world.
*
* @return True if success, false if fail.
*/
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed);
/**
* Regenerates a world.
*
* @param name Name of the world to regenerate
* @param useNewSeed If a new seed should be used
* @param randomSeed If the new seed should be random
* @param seed The seed of the world.
* @param keepGameRules If GameRules should be kept on world regen.
*
* @return True if success, false if fail.
*/
boolean regenWorld(String name, boolean useNewSeed, boolean randomSeed, String seed, boolean keepGameRules);
boolean isKeepingSpawnInMemory(World world);
/**
* Checks whether Multiverse knows about a provided unloaded world. This
* method will check the parameter against the alias mappings.
*
* @param name The name of the unloaded world
* @param includeLoaded The value to return if the world is loaded
*
* @return True if the world exists and is unloaded. False if the world
* does not exist. {@code includeLoaded} if the world exists and is loaded.
*/
boolean hasUnloadedWorld(String name, boolean includeLoaded);
/**
* Get all the possible worlds that Multiverse has detected to be importable.
*
* @return A collection of world names that are deemed importable.
*/
Collection<String> getPotentialWorlds();
}
@@ -1,87 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import java.util.concurrent.CompletableFuture;
import co.aikar.commands.BukkitCommandIssuer;
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
import com.onarandombox.MultiverseCore.teleportation.TeleportResult;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.jvnet.hk2.annotations.Contract;
/**
* Used to safely teleport people.
*/
@Contract
public interface SafeTTeleporter extends Teleporter {
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @return A safe {@link Location}.
*/
Location getSafeLocation(Location l);
/**
* Gets the next safe location around the given location.
* @param l A {@link Location}.
* @param tolerance The tolerance.
* @param radius The radius.
* @return A safe {@link Location}.
*/
Location getSafeLocation(Location l, int tolerance, int radius);
/**
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who performed the teleport command.
* @param teleportee Entity to teleport
* @param destination Destination to teleport them to
* @return true for success, false for failure
*/
@Deprecated
TeleportResult safelyTeleport(BukkitCommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination);
/**
* Safely teleport the entity to the MVDestination. This will perform checks to see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who performed the teleport command.
* @param teleportee Entity to teleport
* @param destination Destination to teleport them to
* @return true for success, false for failure
*/
CompletableFuture<TeleportResult> safelyTeleportAsync(BukkitCommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination);
/**
* Safely teleport the entity to the Location. This may perform checks to
* see if the place is safe, and if
* it's not, will adjust the final destination accordingly.
*
* @param teleporter Person who issued the teleport command.
* @param teleportee Entity to teleport.
* @param location Location to teleport them to.
* @param safely Should the destination be checked for safety before teleport?
* @return true for success, false for failure.
*/
TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location,
boolean safely);
/**
* Returns a safe location for the entity to spawn at.
*
* @param entity The entity to spawn
* @param destination The MVDestination to take the entity to.
* @return A new location to spawn the entity at.
*/
Location getSafeLocation(Entity entity, DestinationInstance destination);
/**
* Finds a portal-block next to the specified {@link Location}.
* @param l The {@link Location}
* @return The next portal-block's {@link Location}.
*/
Location findPortalBlockNextTo(Location l);
}
@@ -1,33 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import java.util.concurrent.CompletableFuture;
import co.aikar.commands.BukkitCommandIssuer;
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
import com.onarandombox.MultiverseCore.teleportation.TeleportResult;
import org.bukkit.entity.Entity;
import org.jvnet.hk2.annotations.Contract;
@Contract
public interface Teleporter {
/**
* Teleport the entity to the Multiverse Destination.
*
* @param teleporter Person who performed the teleport command.
* @param teleportee Entity to teleport
* @param destination Destination to teleport them to
* @return true for success, false for failure
*/
@Deprecated
TeleportResult teleport(BukkitCommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination);
/**
* Teleport the entity to the Multiverse Destination.
*
* @param teleporter Person who performed the teleport command.
* @param teleportee Entity to teleport
* @param destination Destination to teleport them to
* @return true for success, false for failure
*/
CompletableFuture<TeleportResult> teleportAsync(BukkitCommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination);
}
@@ -1,70 +0,0 @@
package com.onarandombox.MultiverseCore.api;
import java.util.List;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.jvnet.hk2.annotations.Contract;
/**
* Used to remove animals from worlds that don't belong there.
*/
@Contract
public interface WorldPurger {
/**
* Synchronizes the given worlds with their settings.
*
* @param worlds A list of {@link MVWorld}
*/
void purgeWorlds(List<MVWorld> worlds);
/**
* Convenience method for {@link #purgeWorld(MVWorld, java.util.List, boolean, boolean)} that takes the settings from the world-config.
*
* @param world The {@link MVWorld}.
*/
void purgeWorld(MVWorld world);
/**
* Clear all animals/monsters that do not belong to a world according to the config.
*
* @param mvworld The {@link MVWorld}.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
*/
void purgeWorld(MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters);
/**
* Clear all animals/monsters that do not belong to a world according to the config.
*
* @param mvworld The {@link MVWorld}.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
* @param sender The {@link CommandSender} that initiated the action. He will/should be notified.
*/
void purgeWorld(MVWorld mvworld, List<String> thingsToKill, boolean negateAnimals,
boolean negateMonsters, CommandSender sender);
/**
* Determines whether the specified creature should be killed.
*
* @param e The creature.
* @param thingsToKill A {@link List} of animals/monsters to be killed.
* @param negateAnimals Whether the monsters in the list should be negated.
* @param negateMonsters Whether the animals in the list should be negated.
* @return {@code true} if the creature should be killed, otherwise {@code false}.
*/
boolean shouldWeKillThisCreature(Entity e, List<String> thingsToKill, boolean negateAnimals, boolean negateMonsters);
/**
* Determines whether the specified creature should be killed and automatically reads the params from a world object.
*
* @param w The world.
* @param e The creature.
* @return {@code true} if the creature should be killed, otherwise {@code false}.
*/
boolean shouldWeKillThisCreature(MVWorld w, Entity e);
}
@@ -1,5 +0,0 @@
/**
* The Multiverse-API, containing lots of interfaces that can be quite useful for other
* plugins when interacting with Multiverse.
*/
package com.onarandombox.MultiverseCore.api;
@@ -1,53 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class CheckCommand extends MultiverseCommand {
private final DestinationsProvider destinationsProvider;
@Inject
public CheckCommand(@NotNull MVCommandManager commandManager, @NotNull DestinationsProvider destinationsProvider) {
super(commandManager);
this.destinationsProvider = destinationsProvider;
}
@Subcommand("check")
@CommandPermission("multiverse.core.check")
@CommandCompletion("@players @destinations|@mvworlds")
@Syntax("<player> <destination>")
@Description("{@@mv-core.check.description}")
public void onCheckCommand(BukkitCommandIssuer issuer,
@Syntax("<player>")
@Description("{@@mv-core.check.player.description}")
Player player,
@Syntax("<destination>")
@Description("{@@mv-core.check.destination.description}")
ParsedDestination<?> destination
) {
issuer.sendInfo(MVCorei18n.CHECK_CHECKING,
"{player}", player.getName(),
"{destination}", destination.toString());
//TODO More detailed output on permissions required.
this.destinationsProvider.checkTeleportPermissions(issuer, player, destination);
}
}
@@ -1,61 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.CommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class CloneCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public CloneCommand(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@Subcommand("clone")
@CommandPermission("multiverse.core.clone")
@CommandCompletion("@mvworlds:scope=both @empty")
@Syntax("<world> <new world name>")
@Description("{@@mv-core.clone.description}")
public void onCloneCommand(CommandIssuer issuer,
@Conditions("validWorldName:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.clone.world.description}")
String worldName,
@Single
@Conditions("validWorldName:scope=new")
@Syntax("<new world name>")
@Description("{@@mv-core.clone.newWorld.description}")
String newWorldName
) {
issuer.sendInfo(MVCorei18n.CLONE_CLONING,
"{world}", worldName,
"{newWorld}", newWorldName);
if (!this.worldManager.cloneWorld(worldName, newWorldName)) {
issuer.sendError(MVCorei18n.CLONE_FAILED);
return;
}
issuer.sendInfo(MVCorei18n.CLONE_SUCCESS,
"{world}", newWorldName);
}
}
@@ -1,73 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.commandtools.MVCommandIssuer;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.context.MVConfigValue;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import com.onarandombox.MultiverseCore.exceptions.MultiverseException;
import io.vavr.control.Option;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class ConfigCommand extends MultiverseCommand {
private final MVCoreConfig config;
@Inject
public ConfigCommand(@NotNull MVCommandManager commandManager, @NotNull MVCoreConfig config) {
super(commandManager);
this.config = config;
}
@Subcommand("config")
@CommandPermission("multiverse.core.config")
@CommandCompletion("@mvconfigs")
@Syntax("<name> [new-value]")
@Description("") //TODO
public void onConfigCommand(MVCommandIssuer issuer,
@Syntax("<name>")
@Description("") //TODO
String name,
@Optional
@Single
@Syntax("[new-value]")
@Description("") //TODO
MVConfigValue value
) {
if (value == null) {
showConfigValue(issuer, name);
return;
}
updateConfigValue(issuer, name, value.getValue());
}
private void showConfigValue(MVCommandIssuer issuer, String name) {
config.getProperty(name)
.onSuccess(value -> issuer.sendMessage(name + "is currently set to " + value))
.onFailure(e -> issuer.sendMessage(e.getMessage()));
}
private void updateConfigValue(MVCommandIssuer issuer, String name, Object value) {
config.setProperty(name, value)
.onSuccess(ignore -> {
config.save();
issuer.sendMessage("Successfully set " + name + " to " + value);
})
.onFailure(ignore -> issuer.sendMessage("Unable to set " + name + " to " + value + "."))
.onFailure(MultiverseException.class, e -> Option.of(e.getMVMessage()).peek(issuer::sendError));
}
}
@@ -1,29 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class ConfirmCommand extends MultiverseCommand {
@Inject
public ConfirmCommand(@NotNull MVCommandManager commandManager) {
super(commandManager);
}
@Subcommand("confirm")
@CommandPermission("multiverse.core.confirm")
@Description("{@@mv-core.confirm.description}")
public void onConfirmCommand(@NotNull BukkitCommandIssuer issuer) {
this.commandManager.getCommandQueueManager().runQueuedCommand(issuer.getIssuer());
}
}
@@ -1,143 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
import jakarta.inject.Inject;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldType;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class CreateCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public CreateCommand(
@NotNull MVCommandManager commandManager,
@NotNull MVWorldManager worldManager,
@NotNull UnsafeCallWrapper unsafeCallWrapper
) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvcreate")
.add(CommandValueFlag.builder("--seed", String.class)
.addAlias("-s")
.completion(() -> Collections.singleton(String.valueOf(new Random().nextLong())))
.build())
.add(CommandValueFlag.builder("--generator", String.class)
.addAlias("-g")
.completion(() -> Arrays.stream(Bukkit.getServer().getPluginManager().getPlugins())
.filter(Plugin::isEnabled)
.filter(genplugin -> unsafeCallWrapper.wrap(
() -> genplugin.getDefaultWorldGenerator("world", ""),
genplugin.getName(),
"Get generator"
) != null)
.map(genplugin -> genplugin.getDescription().getName())
.collect(Collectors.toList()))
.build())
.add(CommandValueFlag.builder("--world-type", WorldType.class)
.addAlias("-t")
.context((value) -> {
try {
return WorldType.valueOf(value.toUpperCase());
} catch (IllegalArgumentException e) {
throw new InvalidCommandArgument("Invalid world type: " + value);
}
})
.completion(() -> {
List<String> types = new ArrayList<>();
for (WorldType type : WorldType.values()) {
types.add(type.name().toLowerCase());
}
return types;
})
.build())
.add(CommandFlag.builder("--adjust-spawn")
.addAlias("-n")
.build())
.add(CommandFlag.builder("--no-structures")
.addAlias("-a")
.build())
.build());
}
@Subcommand("create")
@CommandPermission("multiverse.core.create")
@CommandCompletion("@empty @flags:groupName=mvcreate")
@Syntax("<name> <environment> --seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
@Description("{@@mv-core.create.description}")
public void onCreateCommand(BukkitCommandIssuer issuer,
@Conditions("validWorldName:scope=new")
@Syntax("<name>")
@Description("{@@mv-core.create.name.description}")
String worldName,
@Syntax("<environment>")
@Description("{@@mv-core.create.environment.description}")
World.Environment environment,
@Optional
@Syntax("--seed [seed] --generator [generator[:id]] --world-type [worldtype] --adjust-spawn --no-structures")
@Description("{@@mv-core.create.flags.description}")
String[] flags
) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES, "{worldName}", worldName);
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ENVIRONMENT, "{environment}", environment.name());
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_SEED, "{seed}", parsedFlags.flagValue("--seed", "RANDOM", String.class));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_WORLDTYPE, "{worldType}", parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class).name());
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_ADJUSTSPAWN, "{adjustSpawn}", String.valueOf(parsedFlags.hasFlag("--adjust-spawn")));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_GENERATOR, "{generator}", parsedFlags.flagValue("--generator", "null", String.class));
issuer.sendInfo(MVCorei18n.CREATE_PROPERTIES_STRUCTURES, "{structures}", String.valueOf(!parsedFlags.hasFlag("--no-structures")));
issuer.sendInfo(MVCorei18n.CREATE_LOADING);
if (!worldManager.addWorld(
worldName,
environment,
parsedFlags.flagValue("--seed", String.class),
parsedFlags.flagValue("--world-type", WorldType.NORMAL, WorldType.class),
parsedFlags.hasFlag("--adjust-spawn"),
parsedFlags.flagValue("--generator", String.class),
parsedFlags.hasFlag("--no-structures")
)) {
issuer.sendError(MVCorei18n.CREATE_FAILED, "{worldName}", worldName);
return;
}
issuer.sendInfo(MVCorei18n.CREATE_SUCCESS, "{worldName}", worldName);
}
}
@@ -1,67 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.MessageType;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class DeleteCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public DeleteCommand(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@Subcommand("delete")
@CommandPermission("multiverse.core.delete")
@CommandCompletion("@mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.delete.description}")
public void onDeleteCommand(BukkitCommandIssuer issuer,
@Single
@Conditions("validWorldName:scope=both")
@Syntax("<world>")
@Description("The world you want to delete.")
String worldName
) {
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
issuer.getIssuer(),
() -> {
issuer.sendInfo(MVCorei18n.DELETE_DELETING,
"{world}", worldName);
if (!this.worldManager.deleteWorld(worldName)) {
issuer.sendError(MVCorei18n.DELETE_FAILED,
"{world}", worldName);
return;
}
issuer.sendInfo(MVCorei18n.DELETE_SUCCESS,
"{world}", worldName);
},
this.commandManager.formatMessage(
issuer,
MessageType.INFO,
MVCorei18n.DELETE_PROMPT,
"{world}", worldName)
));
}
}
@@ -1,79 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Flags;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.context.GameRuleValue;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.bukkit.GameRule;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class GameruleCommand extends MultiverseCommand {
@Inject
public GameruleCommand(@NotNull MVCommandManager commandManager) {
super(commandManager);
}
@Subcommand("gamerule")
@CommandPermission("multiverse.core.gamerule")
@CommandCompletion("@gamerules true|false|@range:1-10 @mvworlds:multiple|*")
@Syntax("<Gamerule> <Gamerule value> [World or *]")
@Description("{@@mv-core.gamerule.description}")
public void onGameruleCommand(BukkitCommandIssuer issuer,
@Syntax("<Gamerule>")
@Description("{@@mv-core.gamerule.gamerule.description}")
GameRule gamerule,
@Syntax("<Value>")
@Description("{@@mv-core.gamerule.value.description}")
GameRuleValue gameRuleValue,
@Flags("resolve=issuerAware")
@Syntax("[World or *]")
@Description("{@@mv-core.gamerule.world.description}")
MVWorld[] worlds
) {
Object value = gameRuleValue.getValue();
boolean success = true;
for(MVWorld world : worlds) {
// Set gamerules and add false to list if it fails
if (!world.getCBWorld().setGameRule(gamerule, value)) {
issuer.sendError(MVCorei18n.GAMERULE_FAILED,
"{gamerule}", gamerule.getName(),
"{value}", value.toString(),
"{world}", world.getName(),
"{type}", gamerule.getType().getName());
success = false;
}
}
// Tell user if it was successful
if (success) {
if (worlds.length == 1) {
issuer.sendInfo(MVCorei18n.GAMERULE_SUCCESS_SINGLE,
"{gamerule}", gamerule.getName(),
"{value}", value.toString(),
"{world}", worlds[0].getName());
}
else if (worlds.length > 1) {
issuer.sendInfo(MVCorei18n.GAMERULE_SUCCESS_MULTIPLE,
"{gamerule}", gamerule.getName(),
"{value}", value.toString(),
"{count}", String.valueOf(worlds.length));
}
}
}
}
@@ -1,104 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.Arrays;
import java.util.stream.Collectors;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import com.onarandombox.MultiverseCore.utils.UnsafeCallWrapper;
import jakarta.inject.Inject;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class ImportCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public ImportCommand(
@NotNull MVCommandManager commandManager,
@NotNull MVWorldManager worldManager,
@NotNull UnsafeCallWrapper unsafeCallWrapper
) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvimport")
.add(CommandValueFlag.builder("--generator", String.class)
.addAlias("-g")
.completion(() -> Arrays.stream(Bukkit.getServer().getPluginManager().getPlugins())
.filter(Plugin::isEnabled)
.filter(genplugin -> unsafeCallWrapper.wrap(
() -> genplugin.getDefaultWorldGenerator("world", ""),
genplugin.getName(),
"Get generator"
) != null)
.map(genplugin -> genplugin.getDescription().getName())
.collect(Collectors.toList()))
.build())
.add(CommandFlag.builder("--adjust-spawn")
.addAlias("-a")
.build())
.build());
}
@Subcommand("import")
@CommandPermission("multiverse.core.import")
@CommandCompletion("@mvworlds:scope=potential @flags:groupName=mvimport")
@Syntax("<name> <env> --generator [generator[:id]] --adjust-spawn")
@Description("{@@mv-core.import.description")
public void onImportCommand(BukkitCommandIssuer issuer,
@Conditions("validWorldName:scope=new")
@Syntax("<name>")
@Description("{@@mv-core.import.name.description}")
String worldName,
@Syntax("<env>")
@Description("{@@mv-core.import.env.description}")
World.Environment environment,
@Optional
@Syntax("--generator [generator[:id]] --adjust-spawn")
@Description("{@@mv-core.import.other.description}")
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
issuer.sendInfo(MVCorei18n.IMPORT_IMPORTING,
"{world}", worldName);
if (!this.worldManager.addWorld(
worldName, environment,
null,
null,
null,
parsedFlags.flagValue("--generator", String.class),
parsedFlags.hasFlag("--adjust-spawn"))
) {
issuer.sendError(MVCorei18n.IMPORT_FAILED);
return;
}
issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS);
}
}
@@ -1,56 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class LoadCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public LoadCommand(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@Subcommand("load")
@CommandPermission("multiverse.core.load")
@CommandCompletion("@mvworlds:scope=unloaded")
@Syntax("<world>")
@Description("{@@mv-core.load.description}")
public void onLoadCommand(BukkitCommandIssuer issuer,
@Single
@Conditions("validWorldName:scope=unloaded")
@Syntax("<world>")
@Description("{@@mv-core.load.world.description}")
String worldName
) {
issuer.sendInfo(MVCorei18n.LOAD_LOADING,
"{world}", worldName);
if (!this.worldManager.loadWorld(worldName)) {
issuer.sendError(MVCorei18n.LOAD_FAILED,
"{world}", worldName);
return;
}
issuer.sendInfo(MVCorei18n.LOAD_SUCCESS,
"{world}", worldName);
}
}
@@ -1,97 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.Collections;
import java.util.Random;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.MessageType;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
import com.onarandombox.MultiverseCore.commandtools.queue.QueuedCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class RegenCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public RegenCommand(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
registerFlagGroup(CommandFlagGroup.builder("mvregen")
.add(CommandValueFlag.builder("--seed", String.class)
.addAlias("-s")
.completion(() -> Collections.singleton(String.valueOf(new Random().nextLong())))
.optional()
.build())
.add(CommandFlag.builder("--keep-gamerules")
.addAlias("-k")
.build())
.build());
}
@Subcommand("regen")
@CommandPermission("multiverse.core.regen")
@CommandCompletion("@mvworlds:scope=both @flags:groupName=mvregen")
@Syntax("<world> --seed [seed] --keep-gamerules")
@Description("{@@mv-core.regen.description}")
public void onRegenCommand(BukkitCommandIssuer issuer,
@Conditions("validWorldName:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.regen.world.description}")
String worldName,
@Optional
@Syntax("--seed [seed] --keep-gamerules")
@Description("{@@mv-core.regen.other.description}")
String[] flags
) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
this.commandManager.getCommandQueueManager().addToQueue(new QueuedCommand(
issuer.getIssuer(),
() -> {
issuer.sendInfo(MVCorei18n.REGEN_REGENERATING,
"{world}", worldName);
if (!this.worldManager.regenWorld(
worldName,
parsedFlags.hasFlag("--seed"),
!parsedFlags.hasFlagValue("--seed"),
parsedFlags.flagValue("--seed", String.class),
parsedFlags.hasFlag("--keep-gamerules")
)) {
issuer.sendError(MVCorei18n.REGEN_FAILED,
"{world}", worldName);
return;
}
issuer.sendInfo(MVCorei18n.REGEN_SUCCESS,
"{world}", worldName);
},
this.commandManager.formatMessage(
issuer,
MessageType.INFO,
MVCorei18n.REGEN_PROMPT,
"{world}", worldName)
));
}
}
@@ -1,71 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.List;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.anchor.AnchorManager;
import com.onarandombox.MultiverseCore.api.MVCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import com.onarandombox.MultiverseCore.event.MVConfigReloadEvent;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class ReloadCommand extends MultiverseCommand {
private final MVCoreConfig config;
private final AnchorManager anchorManager;
private final MVWorldManager worldManager;
private final PluginManager pluginManager;
@Inject
public ReloadCommand(
@NotNull MVCommandManager commandManager,
@NotNull MVCoreConfig config,
@NotNull AnchorManager anchorManager,
@NotNull MVWorldManager worldManager,
@NotNull PluginManager pluginManager
) {
super(commandManager);
this.config = config;
this.anchorManager = anchorManager;
this.worldManager = worldManager;
this.pluginManager = pluginManager;
}
@Subcommand("reload")
@CommandPermission("multiverse.core.reload")
@Description("{@@mv-core.reload.description}")
public void onReloadCommand(@NotNull BukkitCommandIssuer issuer) {
issuer.sendInfo(MVCorei18n.RELOAD_RELOADING);
this.config.load();
this.worldManager.loadWorldsConfig();
this.worldManager.loadWorlds(true);
this.anchorManager.loadAnchors();
List<String> configsLoaded = new ArrayList<>();
configsLoaded.add("Multiverse-Core - config.yml");
configsLoaded.add("Multiverse-Core - worlds.yml");
configsLoaded.add("Multiverse-Core - anchors.yml");
MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded);
this.pluginManager.callEvent(configReload);
// @TODO: replace this sendMessage and format the configsLoaded above, maybe?
configReload.getAllConfigsLoaded().forEach(issuer::sendMessage);
issuer.sendInfo(MVCorei18n.RELOAD_SUCCESS);
}
}
@@ -1,52 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class RemoveCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public RemoveCommand(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@Subcommand("remove")
@CommandPermission("multiverse.core.remove")
@CommandCompletion("@mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.remove.description}")
public void onRemoveCommand(BukkitCommandIssuer issuer,
@Single
@Conditions("mvworlds:scope=both")
@Syntax("<world>")
@Description("{@@mv-core.remove.world.description}")
String worldName
) {
if (!this.worldManager.removeWorldFromConfig(worldName)) {
issuer.sendError(MVCorei18n.REMOVE_FAILED);
return;
}
issuer.sendInfo(MVCorei18n.REMOVE_SUCCESS,
"{world}", worldName);
}
}
@@ -1,69 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.CommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Flags;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.bukkit.entity.Player;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class TeleportCommand extends MultiverseCommand {
private final DestinationsProvider destinationsProvider;
@Inject
public TeleportCommand(MVCommandManager commandManager, DestinationsProvider destinationsProvider) {
super(commandManager);
this.destinationsProvider = destinationsProvider;
}
@Subcommand("teleport|tp")
@CommandCompletion("@players|@mvworlds:playerOnly|@destinations:playerOnly @mvworlds|@destinations")
@Syntax("[player] <destination>")
@Description("{@@mv-core.teleport.description}")
public void onTeleportCommand(BukkitCommandIssuer issuer,
@Flags("resolve=issuerAware")
@Syntax("[player]")
@Description("{@@mv-core.teleport.player.description}")
Player[] players,
@Syntax("<destination>")
@Description("{@@mv-core.teleport.destination.description}")
ParsedDestination<?> destination
) {
// TODO Add warning if teleporting too many players at once.
CompletableFuture.allOf(Arrays.stream(players)
.map(player -> this.destinationsProvider.playerTeleportAsync(issuer, player, destination))
.toArray(CompletableFuture[]::new))
.thenRun(() -> {
String playerName = players.length == 1
? issuer.getPlayer() == players[0] ? "you" : players[0].getName()
: players.length + " players";
issuer.sendInfo(MVCorei18n.TELEPORT_SUCCESS,
"{player}", playerName, "{destination}", destination.toString());
});
}
@Override
public boolean hasPermission(CommandIssuer issuer) {
return this.destinationsProvider.hasAnyTeleportPermission(issuer);
}
}
@@ -1,54 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class UnloadCommand extends MultiverseCommand {
private final MVWorldManager worldManager;
@Inject
public UnloadCommand(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
super(commandManager);
this.worldManager = worldManager;
}
@Subcommand("unload")
@CommandPermission("multiverse.core.unload")
@CommandCompletion("@mvworlds")
@Syntax("<world>")
@Description("{@@mv-core.unload.description}")
public void onUnloadCommand(BukkitCommandIssuer issuer,
@Syntax("<world>")
@Description("{@@mv-core.unload.world.description}")
MVWorld world
) {
issuer.sendInfo(MVCorei18n.UNLOAD_UNLOADING,
"{world}", world.getColoredWorldString());
//TODO API: Should be able to use MVWorld object directly
if (!this.worldManager.unloadWorld(world.getName())) {
issuer.sendError(MVCorei18n.UNLOAD_FAILURE,
"{world}", world.getColoredWorldString());
return;
}
issuer.sendInfo(MVCorei18n.UNLOAD_SUCCESS,
"{world}", world.getColoredWorldString());
}
}
@@ -1,39 +0,0 @@
package com.onarandombox.MultiverseCore.commands;
import co.aikar.commands.CommandHelp;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.HelpCommand;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
import jakarta.inject.Inject;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
@CommandAlias("mv")
public class UsageCommand extends MultiverseCommand {
@Inject
public UsageCommand(@NotNull MVCommandManager commandManager) {
super(commandManager);
}
@HelpCommand
@Subcommand("help")
@CommandPermission("multiverse.core.help")
@CommandCompletion("@commands:mv")
@Syntax("[filter] [page]")
@Description("{@@mv-core.usage.description}")
public void onUsageCommand(CommandHelp help) {
if (help.getIssuer().isPlayer()) {
// Prevent flooding the chat
help.setPerPage(4);
}
this.commandManager.showUsage(help);
}
}
@@ -1,146 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.CommandIssuer;
import co.aikar.commands.PaperCommandCompletions;
import co.aikar.commands.RegisteredCommand;
import co.aikar.commands.RootCommand;
import com.google.common.collect.Sets;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
import jakarta.inject.Inject;
import org.bukkit.GameRule;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
public class MVCommandCompletions extends PaperCommandCompletions {
protected final MVCommandManager commandManager;
private final MVWorldManager worldManager;
private final DestinationsProvider destinationsProvider;
@Inject
public MVCommandCompletions(
@NotNull MVCommandManager mvCommandManager,
@NotNull MVWorldManager worldManager,
@NotNull DestinationsProvider destinationsProvider,
@NotNull MVCoreConfig config
) {
super(mvCommandManager);
this.commandManager = mvCommandManager;
this.worldManager = worldManager;
this.destinationsProvider = destinationsProvider;
registerAsyncCompletion("commands", this::suggestCommands);
registerAsyncCompletion("destinations", this::suggestDestinations);
registerAsyncCompletion("flags", this::suggestFlags);
registerStaticCompletion("gamerules", this::suggestGamerules);
registerStaticCompletion("mvconfigs", config.getNodes().getNames());
registerAsyncCompletion("mvworlds", this::suggestMVWorlds);
setDefaultCompletion("destinations", ParsedDestination.class);
setDefaultCompletion("flags", String[].class);
setDefaultCompletion("gamerules", GameRule.class);
setDefaultCompletion("mvworlds", MVWorld.class);
}
private Collection<String> suggestCommands(BukkitCommandCompletionContext context) {
String rootCmdName = context.getConfig();
if (rootCmdName == null) {
return Collections.emptyList();
}
RootCommand rootCommand = this.commandManager.getRegisteredRootCommands().stream()
.unordered()
.filter(c -> c.getCommandName().equals(rootCmdName))
.findFirst()
.orElse(null);
if (rootCommand == null) {
return Collections.emptyList();
}
return rootCommand.getSubCommands().entries().stream()
.filter(entry -> checkPerms(context.getIssuer(), entry.getValue()))
.map(Map.Entry::getKey)
.filter(cmdName -> !cmdName.startsWith("__"))
.collect(Collectors.toList());
}
private boolean checkPerms(CommandIssuer issuer, RegisteredCommand<?> command) {
return this.commandManager.hasPermission(issuer, command.getRequiredPermissions());
}
private Collection<String> suggestDestinations(BukkitCommandCompletionContext context) {
if (context.hasConfig("playerOnly") && !context.getIssuer().isPlayer()) {
return Collections.emptyList();
}
return this.destinationsProvider
.suggestDestinations((BukkitCommandIssuer)context.getIssuer(), context.getInput());
}
private Collection<String> suggestFlags(@NotNull BukkitCommandCompletionContext context) {
return this.commandManager.getFlagsManager().suggest(
context.getConfig("groupName", ""), context.getContextValue(String[].class));
}
private Collection<String> suggestGamerules() {
return Arrays.stream(GameRule.values()).map(GameRule::getName).collect(Collectors.toList());
}
private Collection<String> suggestMVWorlds(BukkitCommandCompletionContext context) {
if (context.hasConfig("playerOnly") && !context.getIssuer().isPlayer()) {
return Collections.emptyList();
}
if (!context.hasConfig("multiple")) {
return getMVWorldNames(context);
}
String input = context.getInput();
int lastComma = input.lastIndexOf(',');
String currentWorldsString = input.substring(0, lastComma + 1);
Set<String> currentWorlds = Sets.newHashSet(input.split(","));
return getMVWorldNames(context).stream()
.filter(world -> !currentWorlds.contains(world))
.map(world -> currentWorldsString + world)
.collect(Collectors.toList());
}
private List<String> getMVWorldNames(BukkitCommandCompletionContext context) {
String scope = context.getConfig("scope", "loaded");
List<String> worlds = new ArrayList<>();
switch (scope) {
case "both":
worlds.addAll(worldManager.getUnloadedWorlds());
case "loaded":
worldManager.getMVWorlds()
.stream()
.map(MVWorld::getName)
.forEach(worlds::add);
break;
case "unloaded":
worlds.addAll(worldManager.getUnloadedWorlds());
break;
case "potential":
worlds.addAll(worldManager.getPotentialWorlds());
break;
}
return worlds;
}
}
@@ -1,356 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.PaperCommandContexts;
import co.aikar.commands.contexts.ContextResolver;
import com.google.common.base.Strings;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.context.GameRuleValue;
import com.onarandombox.MultiverseCore.commandtools.context.MVConfigValue;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import com.onarandombox.MultiverseCore.configuration.node.Node;
import com.onarandombox.MultiverseCore.configuration.node.ValueNode;
import com.onarandombox.MultiverseCore.destination.DestinationsProvider;
import com.onarandombox.MultiverseCore.destination.ParsedDestination;
import com.onarandombox.MultiverseCore.display.filters.ContentFilter;
import com.onarandombox.MultiverseCore.display.filters.DefaultContentFilter;
import com.onarandombox.MultiverseCore.display.filters.RegexContentFilter;
import com.onarandombox.MultiverseCore.utils.PlayerFinder;
import io.vavr.control.Option;
import jakarta.inject.Inject;
import org.bukkit.GameRule;
import org.bukkit.entity.Player;
import org.jvnet.hk2.annotations.Service;
@Service
public class MVCommandContexts extends PaperCommandContexts {
private final MVCommandManager mvCommandManager;
private final DestinationsProvider destinationsProvider;
private final MVWorldManager worldManager;
private final MVCoreConfig config;
@Inject
public MVCommandContexts(
MVCommandManager mvCommandManager,
DestinationsProvider destinationsProvider,
MVWorldManager worldManager,
MVCoreConfig config
) {
super(mvCommandManager);
this.mvCommandManager = mvCommandManager;
this.destinationsProvider = destinationsProvider;
this.worldManager = worldManager;
this.config = config;
registerIssuerOnlyContext(BukkitCommandIssuer.class, BukkitCommandExecutionContext::getIssuer);
registerIssuerOnlyContext(MVCommandIssuer.class, this::parseMVCommandIssuer);
registerOptionalContext(ContentFilter.class, this::parseContentFilter);
registerContext(ParsedDestination.class, this::parseDestination);
registerContext(GameRule.class, this::parseGameRule);
registerContext(GameRuleValue.class, this::parseGameRuleValue);
registerContext(MVConfigValue.class, this::parseMVConfigValue);
registerIssuerAwareContext(MVWorld.class, this::parseMVWorld);
registerIssuerAwareContext(MVWorld[].class, this::parseMVWorldArray);
registerIssuerAwareContext(Player.class, this::parsePlayer);
registerIssuerAwareContext(Player[].class, this::parsePlayerArray);
}
private MVCommandIssuer parseMVCommandIssuer(BukkitCommandExecutionContext context) {
if (context.getIssuer() instanceof MVCommandIssuer) {
return (MVCommandIssuer) context.getIssuer();
}
return mvCommandManager.getCommandIssuer(context.getSender());
}
private ContentFilter parseContentFilter(BukkitCommandExecutionContext context) {
if (Strings.isNullOrEmpty(context.getFirstArg())) {
return DefaultContentFilter.get();
}
String filterString = context.popFirstArg();
return RegexContentFilter.fromString(filterString);
}
private ParsedDestination<?> parseDestination(BukkitCommandExecutionContext context) {
String destination = context.popFirstArg();
if (Strings.isNullOrEmpty(destination)) {
throw new InvalidCommandArgument("No destination specified.");
}
ParsedDestination<?> parsedDestination = destinationsProvider.parseDestination(destination);
if (parsedDestination == null) {
throw new InvalidCommandArgument("The destination " + destination + " is not valid.");
}
return parsedDestination;
}
private GameRule<?> parseGameRule(BukkitCommandExecutionContext context) {
String gameRuleName = context.popFirstArg();
if (Strings.isNullOrEmpty(gameRuleName)) {
throw new InvalidCommandArgument("No game rule specified.");
}
GameRule<?> gameRule = GameRule.getByName(gameRuleName);
if (gameRule == null) {
throw new InvalidCommandArgument("The game rule " + gameRuleName + " is not valid.");
}
return gameRule;
}
private GameRuleValue parseGameRuleValue(BukkitCommandExecutionContext context) {
GameRule<?> gameRule = (GameRule<?>) context.getResolvedArg(GameRule.class);
if (gameRule == null) {
throw new InvalidCommandArgument("No game rule specified.");
}
String valueString = context.getFirstArg();
if (Strings.isNullOrEmpty(valueString)) {
throw new InvalidCommandArgument("No game rule value specified.");
}
ContextResolver<?, BukkitCommandExecutionContext> resolver = getResolver(gameRule.getType());
if (resolver == null) {
return new GameRuleValue(valueString);
}
Object resolvedValue = resolver.getContext(context);
if (resolvedValue == null) {
throw new InvalidCommandArgument("The game rule value " + valueString + " is not valid for game rule " + gameRule.getName() + ".");
}
return new GameRuleValue(resolvedValue);
}
private MVConfigValue parseMVConfigValue(BukkitCommandExecutionContext context) {
String configName = (String) context.getResolvedArg(String.class);
if (Strings.isNullOrEmpty(configName)) {
throw new InvalidCommandArgument("No config name specified.");
}
Option<Node> node = config.getNodes().findNode(configName);
if (node.isEmpty()) {
throw new InvalidCommandArgument("The config " + configName + " is not valid.");
}
String valueString = context.getFirstArg();
if (Strings.isNullOrEmpty(valueString)) {
throw new InvalidCommandArgument("No config value specified.");
}
if (!(node.get() instanceof ValueNode)) {
context.popFirstArg();
return new MVConfigValue(valueString);
}
ContextResolver<?, BukkitCommandExecutionContext> resolver = getResolver(((ValueNode<?>) node.get()).getType());
if (resolver == null) {
context.popFirstArg();
return new MVConfigValue(valueString);
}
Object resolvedValue = resolver.getContext(context);
if (resolvedValue == null) {
throw new InvalidCommandArgument("The config value " + valueString + " is not valid for config " + configName + ".");
}
return new MVConfigValue(resolvedValue);
}
private MVWorld parseMVWorld(BukkitCommandExecutionContext context) {
String resolve = context.getFlagValue("resolve", "");
// Get world based on sender only
if (resolve.equals("issuerOnly")) {
if (context.getIssuer().isPlayer()) {
return worldManager.getMVWorld(context.getIssuer().getPlayer().getWorld());
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("This command can only be used by a player in a Multiverse World.");
}
String worldName = context.getFirstArg();
MVWorld world = worldManager.getMVWorld(worldName);
// Get world based on input, fallback to sender if input is not a world
if (resolve.equals("issuerAware")) {
if (world != null) {
context.popFirstArg();
return world;
}
if (context.getIssuer().isPlayer()) {
return worldManager.getMVWorld(context.getIssuer().getPlayer().getWorld());
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("Player is not in a Multiverse World.");
}
// Get world based on input only
if (world != null) {
context.popFirstArg();
return world;
}
if (!context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("World " + worldName + " is not a loaded multiverse world.");
}
private MVWorld[] parseMVWorldArray(BukkitCommandExecutionContext context) {
String resolve = context.getFlagValue("resolve", "");
MVWorld playerWorld = null;
if (context.getIssuer().isPlayer()) {
playerWorld = worldManager.getMVWorld(context.getIssuer().getPlayer().getWorld());
}
// Get world based on sender only
if (resolve.equals("issuerOnly")) {
if (playerWorld != null) {
return new MVWorld[]{playerWorld};
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("This command can only be used by a player in a Multiverse World.");
}
String worldStrings = context.getFirstArg();
String[] worldNames = worldStrings.split(",");
Set<MVWorld> worlds = new HashSet<>(worldNames.length);
for (String worldName : worldNames) {
if ("*".equals(worldName)) {
worlds.addAll(worldManager.getMVWorlds());
break;
}
MVWorld world = worldManager.getMVWorld(worldName);
if (world == null) {
throw new InvalidCommandArgument("World " + worldName + " is not a loaded multiverse world.");
}
worlds.add(world);
}
// Get world based on input, fallback to sender if input is not a world
if (resolve.equals("issuerAware")) {
if (!worlds.isEmpty()) {
context.popFirstArg();
return worlds.toArray(new MVWorld[0]);
}
if (playerWorld != null) {
return new MVWorld[]{playerWorld};
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("Player is not in a Multiverse World.");
}
// Get world based on input only
if (!worlds.isEmpty()) {
context.popFirstArg();
return worlds.toArray(new MVWorld[0]);
}
if (!context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("World " + worldStrings + " is not a loaded multiverse world.");
}
private Player parsePlayer(BukkitCommandExecutionContext context) {
String resolve = context.getFlagValue("resolve", "");
// Get player based on sender only
if (resolve.equals("issuerOnly")) {
if (context.getIssuer().isPlayer()) {
return context.getIssuer().getPlayer();
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("This command can only be used by a player.");
}
String playerIdentifier = context.getFirstArg();
Player player = PlayerFinder.get(playerIdentifier, context.getSender());
// Get player based on input, fallback to sender if input is not a player
if (resolve.equals("issuerAware")) {
if (player != null) {
context.popFirstArg();
return player;
}
if (context.getIssuer().isPlayer()) {
return context.getIssuer().getPlayer();
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("Invalid player: " + playerIdentifier
+ ". Either specify an online player or use this command as a player.");
}
// Get player based on input only
if (player != null) {
context.popFirstArg();
return player;
}
if (!context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("Player " + playerIdentifier + " not found.");
}
private Player[] parsePlayerArray(BukkitCommandExecutionContext context) {
String resolve = context.getFlagValue("resolve", "");
// Get player based on sender only
if (resolve.equals("issuerOnly")) {
if (context.getIssuer().isPlayer()) {
return new Player[]{context.getIssuer().getPlayer()};
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("This command can only be used by a player.");
}
String playerIdentifier = context.getFirstArg();
Player[] players = PlayerFinder.getMulti(playerIdentifier, context.getSender()).toArray(new Player[0]);
// Get player based on input, fallback to sender if input is not a player
if (resolve.equals("issuerAware")) {
if (players.length > 0) {
context.popFirstArg();
return players;
}
if (context.getIssuer().isPlayer()) {
return new Player[]{context.getIssuer().getPlayer()};
}
if (context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("Invalid player: " + playerIdentifier
+ ". Either specify an online player or use this command as a player.");
}
// Get player based on input only
if (players.length > 0) {
context.popFirstArg();
return players;
}
if (!context.isOptional()) {
return null;
}
throw new InvalidCommandArgument("Player " + playerIdentifier + " not found.");
}
}
@@ -1,48 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools;
import co.aikar.commands.MessageType;
import co.aikar.commands.OpenBukkitCommandIssuer;
import co.aikar.locales.MessageKeyProvider;
import com.onarandombox.MultiverseCore.utils.message.Message;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class MVCommandIssuer extends OpenBukkitCommandIssuer {
private final MVCommandManager commandManager;
MVCommandIssuer(@NotNull MVCommandManager commandManager, @NotNull CommandSender sender) {
super(commandManager, sender);
this.commandManager = commandManager;
}
@Override
public MVCommandManager getManager() {
return commandManager;
}
public void sendError(Message message) {
sendMessage(MessageType.ERROR, message);
}
public void sendSyntax(Message message) {
sendMessage(MessageType.SYNTAX, message);
}
public void sendInfo(Message message) {
sendMessage(MessageType.INFO, message);
}
private void sendMessage(MessageType messageType, Message message) {
if (message instanceof MessageKeyProvider) {
sendMessage(messageType, (MessageKeyProvider) message, message.getReplacements());
} else {
var formatter = getManager().getFormat(messageType);
if (formatter != null) {
sendMessage(formatter.format(message.formatted()));
} else {
sendMessage(message.formatted());
}
}
}
}
@@ -1,136 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools;
import java.util.List;
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.BukkitLocales;
import co.aikar.commands.CommandCompletions;
import co.aikar.commands.CommandContexts;
import co.aikar.commands.CommandHelp;
import co.aikar.commands.HelpEntry;
import co.aikar.commands.PaperCommandManager;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagsManager;
import com.onarandombox.MultiverseCore.commandtools.queue.CommandQueueManager;
import jakarta.inject.Inject;
import jakarta.inject.Provider;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
/**
* Main class to manage permissions.
*/
@Service
public class MVCommandManager extends PaperCommandManager {
private final CommandFlagsManager flagsManager;
private final CommandQueueManager commandQueueManager;
private final Provider<MVCommandContexts> commandContextsProvider;
private final Provider<MVCommandCompletions> commandCompletionsProvider;
@Inject
public MVCommandManager(
@NotNull MultiverseCore plugin,
@NotNull CommandFlagsManager flagsManager,
@NotNull CommandQueueManager commandQueueManager,
@NotNull Provider<MVCommandContexts> commandContextsProvider,
@NotNull Provider<MVCommandCompletions> commandCompletionsProvider,
@NotNull MVWorldManager worldManager
) {
super(plugin);
this.flagsManager = flagsManager;
this.commandQueueManager = commandQueueManager;
this.commandContextsProvider = commandContextsProvider;
this.commandCompletionsProvider = commandCompletionsProvider;
MVCommandConditions.load(this, worldManager);
this.enableUnstableAPI("help");
}
void loadLanguages(PluginLocales locales) {
if (this.locales == null) {
this.locales = locales;
this.locales.loadLanguages();
}
}
@Override
public BukkitLocales getLocales() {
return this.locales;
}
/**
* Gets class responsible for flag handling.
*
* @return A not-null {@link CommandFlagsManager}.
*/
public synchronized @NotNull CommandFlagsManager getFlagsManager() {
return flagsManager;
}
/**
* Manager for command that requires /mv confirm before execution.
*
* @return A non-null {@link CommandQueueManager}.
*/
public synchronized @NotNull CommandQueueManager getCommandQueueManager() {
return commandQueueManager;
}
/**
* Gets class responsible for parsing string args into objects.
*
* @return A not-null {@link CommandContexts}.
*/
@Override
public synchronized @NotNull CommandContexts<BukkitCommandExecutionContext> getCommandContexts() {
if (this.contexts == null) {
this.contexts = commandContextsProvider.get();
}
return this.contexts;
}
/**
* Gets class responsible for tab-completion handling.
*
* @return A not-null {@link CommandCompletions}.
*/
@Override
public synchronized @NotNull CommandCompletions<BukkitCommandCompletionContext> getCommandCompletions() {
if (this.completions == null) {
this.completions = commandCompletionsProvider.get();
}
return this.completions;
}
/**
* Standardise usage command formatting for all mv modules.
*
* @param help The target {@link CommandHelp}.
*/
public void showUsage(@NotNull CommandHelp help) {
List<HelpEntry> entries = help.getHelpEntries();
if (entries.size() == 1) {
getHelpFormatter().showDetailedHelp(help, entries.get(0));
return;
}
help.showHelp();
}
public @NotNull MVCommandIssuer getConsoleCommandIssuer() {
return getCommandIssuer(Bukkit.getConsoleSender());
}
@Override
public @NotNull MVCommandIssuer getCommandIssuer(Object issuer) {
if (!(issuer instanceof CommandSender)) {
throw new IllegalArgumentException(issuer.getClass().getName() + " is not a Command Issuer.");
} else {
return new MVCommandIssuer(this, (CommandSender)issuer);
}
}
}
@@ -1,35 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools;
import co.aikar.commands.BaseCommand;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagsManager;
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Contract;
@Contract
public abstract class MultiverseCommand extends BaseCommand {
protected final MVCommandManager commandManager;
private String flagGroupName;
protected MultiverseCommand(@NotNull MVCommandManager commandManager) {
this.commandManager = commandManager;
}
protected CommandFlagsManager getFlagsManager() {
return commandManager.getFlagsManager();
}
protected void registerFlagGroup(@NotNull CommandFlagGroup flagGroup) {
if (flagGroupName != null) {
throw new IllegalStateException("Flag group already registered! (name: " + flagGroupName + ")");
}
getFlagsManager().registerFlagGroup(flagGroup);
flagGroupName = flagGroup.getName();
}
protected @NotNull ParsedCommandFlags parseFlags(@NotNull String[] flags) {
return getFlagsManager().parse(flagGroupName, flags);
}
}
@@ -1,13 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools.context;
public class GameRuleValue {
private final Object value;
public GameRuleValue(Object value) {
this.value = value;
}
public Object getValue() {
return value;
}
}
@@ -1,13 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools.context;
public class MVConfigValue {
private final Object value;
public MVConfigValue(Object value) {
this.value = value;
}
public Object getValue() {
return value;
}
}
@@ -1,172 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools.flags;
import java.util.Collection;
import java.util.function.Function;
import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a flag with a value.
*
* @param <T> The type of the value.
*/
public class CommandValueFlag<T> extends CommandFlag {
/**
* A builder for a flag.
*
* @param key The key for the new flag.
* @param type The type of the value.
* @return The builder.
*/
public static @NotNull <T> Builder<T, ?> builder(@NotNull String key, @NotNull Class<T> type) {
return new Builder<>(key, type);
}
private final Class<T> type;
private final boolean optional;
private final T defaultValue;
private final Function<String, T> context;
private final Supplier<Collection<String>> completion;
/**
* Creates a new flag.
*
* @param builder The builder.
*/
protected CommandValueFlag(@NotNull Builder<T, ?> builder) {
super(builder);
type = builder.type;
optional = builder.optional;
defaultValue = builder.defaultValue;
context = builder.context;
completion = builder.completion;
}
/**
* Get the type of the value.
*
* @return The type of the value.
*/
public @NotNull Class<T> getType() {
return type;
}
/**
* Check if it is optional for users to specify a value.
*
* @return True if the value is optional, false otherwise.
*/
public boolean isOptional() {
return optional;
}
/**
* Get the default value. May be null.
*
* @return The default value.
*/
public @Nullable T getDefaultValue() {
return defaultValue;
}
/**
* Get the context. May be null for {@link String} value type.
*
* @return The context.
*/
public @Nullable Function<String, T> getContext() {
return context;
}
/**
* Get the completion. May be null.
*
* @return The completion.
*/
public @Nullable Supplier<Collection<String>> getCompletion() {
return completion;
}
/**
* A builder for a flag.
*
* @param <T> The type of the value.
* @param <S> The type of the builder.
*/
public static class Builder<T, S extends Builder<T, S>> extends CommandFlag.Builder<S> {
private final Class<T> type;
private boolean optional = false;
private T defaultValue = null;
private Function<String, T> context = null;
private Supplier<Collection<String>> completion = null;
/**
* Create a new builder.
*
* @param key The key for the new flag.
* @param type The type of the value.
*/
public Builder(@NotNull String key, @NotNull Class<T> type) {
super(key);
this.type = type;
}
/**
* Set the flag as optional for users to specify a value.
*
* @return The builder.
*/
public @NotNull S optional() {
this.optional = true;
return (S) this;
}
/**
* Set the default value. Used if optional is true and user does not specify a value.
*
* @param defaultValue The default value.
* @return The builder.
*/
public @NotNull S defaultValue(@NotNull T defaultValue) {
this.defaultValue = defaultValue;
return (S) this;
}
/**
* Set the context callback for parsing string into value type.
*
* @param context The context.
* @return The builder.
*/
public @NotNull S context(@NotNull Function<String, T> context) {
this.context = context;
return (S) this;
}
/**
* Set the completion callback for autocomplete.
*
* @param completion The completion.
* @return The builder.
*/
public @NotNull S completion(@NotNull Supplier<Collection<String>> completion) {
this.completion = completion;
return (S) this;
}
/**
* Build the flag.
*
* @return The flag.
*/
@Override
public @NotNull CommandFlag build() {
if (context == null && !String.class.equals(type)) {
throw new IllegalStateException("Context is required for none-string value flags");
}
return new CommandValueFlag<>(this);
}
}
}
@@ -1,61 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools.flags;
import java.util.HashMap;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Object to contain the results of the flags present and its values.
*/
public class ParsedCommandFlags
{
public static final ParsedCommandFlags EMPTY = new ParsedCommandFlags();
private final Map<String, Object> flagValues;
public ParsedCommandFlags() {
flagValues = new HashMap<>();
}
/**
* Add a flag result to the parsed flags.
*
* @param key The key of the flag.
* @param value The value of the flag.
*/
void addFlagResult(@NotNull String key, @Nullable Object value) {
flagValues.put(key, value);
}
/**
* Check if a flag is present.
*
* @param key The key of the flag.
* @return True if the flag is present, false otherwise.
*/
public boolean hasFlag(@Nullable String key) {
return this.flagValues.containsKey(key);
}
public boolean hasFlagValue(@Nullable String key) {
return flagValue(key, Object.class) != null;
}
/**
* Get the value of a flag.
*
* @param key The key of the flag.
* @return The value of the flag, null if flag does not exist or no value.
*/
public @Nullable <T> T flagValue(@Nullable String key, @NotNull Class<T> type) {
Object value = this.flagValues.get(key);
return (T) value;
}
public @NotNull <T> T flagValue(@Nullable String key, @NotNull T defaultValue, @NotNull Class<T> type) {
T value = flagValue(key, type);
return value != null ? value : defaultValue;
}
}
@@ -1,5 +0,0 @@
/**
* This package contains all the flags parsing classes.
*
*/
package com.onarandombox.MultiverseCore.commandtools.flags;
@@ -1,166 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2020. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commandtools.queue;
import java.util.Map;
import java.util.WeakHashMap;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import jakarta.inject.Inject;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.block.data.type.CommandBlock;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
/**
* <p>Manages the queuing of dangerous commands that require {@code /mv confirm} before executing.</p>
*
* <p>Each sender can only have one command in queue at any given time. When a queued command is added
* for a sender that already has a command in queue, it will replace the old queued command.</p>
*/
@Service
public class CommandQueueManager {
private static final long TICKS_PER_SECOND = 20;
private static final DummyCommandBlockSender COMMAND_BLOCK = new DummyCommandBlockSender();
private final Plugin plugin;
private final Map<CommandSender, QueuedCommand> queuedCommandMap;
@Inject
public CommandQueueManager(@NotNull MultiverseCore plugin) {
this.plugin = plugin;
this.queuedCommandMap = new WeakHashMap<>();
}
/**
* Adds a {@link QueuedCommand} into queue.
*
* @param queuedCommand The queued command to add.
*/
public void addToQueue(QueuedCommand queuedCommand) {
CommandSender targetSender = parseSender(queuedCommand.getSender());
// Since only one command is stored in queue per sender, we remove the old one.
this.removeFromQueue(targetSender);
Logging.finer("Add new command to queue for sender %s.", targetSender.getName());
this.queuedCommandMap.put(targetSender, queuedCommand);
queuedCommand.setExpireTask(runExpireLater(queuedCommand));
queuedCommand.getSender().sendMessage(queuedCommand.getPrompt());
queuedCommand.getSender().sendMessage(String.format("Run %s/mv confirm %sto continue. This will expire in %s seconds.",
ChatColor.GREEN, ChatColor.WHITE, queuedCommand.getValidDuration()));
}
/**
* Expire task that removes a {@link QueuedCommand} from queue after valid duration defined.
*
* @param queuedCommand Command to run the expire task on.
* @return The expire {@link BukkitTask}.
*/
@NotNull
private BukkitTask runExpireLater(@NotNull QueuedCommand queuedCommand) {
return Bukkit.getScheduler().runTaskLater(
this.plugin,
expireRunnable(queuedCommand),
queuedCommand.getValidDuration() * TICKS_PER_SECOND
);
}
/**
* Runnable responsible for expiring the queued command.
*
* @param queuedCommand Command to create the expire task on.
* @return The expire runnable.
*/
@NotNull
private Runnable expireRunnable(@NotNull QueuedCommand queuedCommand) {
return () -> {
CommandSender targetSender = parseSender(queuedCommand.getSender());
QueuedCommand matchingQueuedCommand = this.queuedCommandMap.get(targetSender);
if (!queuedCommand.equals(matchingQueuedCommand) || queuedCommand.getExpireTask().isCancelled()) {
// To be safe, but this shouldn't happen since we cancel old commands before add new once.
Logging.finer("This is an old queue command already.");
return;
}
queuedCommand.getSender().sendMessage("Your queued command has expired.");
this.queuedCommandMap.remove(queuedCommand.getSender());
};
}
/**
* Runs the command in queue for the given sender, if any.
*
* @param sender {@link CommandSender} that confirmed the command.
* @return True if queued command ran successfully, else false.
*/
public boolean runQueuedCommand(@NotNull CommandSender sender) {
CommandSender targetSender = parseSender(sender);
QueuedCommand queuedCommand = this.queuedCommandMap.get(targetSender);
if (queuedCommand == null) {
sender.sendMessage(ChatColor.RED + "You do not have any commands in queue.");
return false;
}
Logging.finer("Running queued command...");
queuedCommand.getAction().run();
return removeFromQueue(targetSender);
}
/**
* Since only one command is stored in queue per sender, we remove the old one.
*
* @param sender The {@link CommandSender} that executed the command.
* @return True if queue command is removed from sender successfully, else false.
*/
public boolean removeFromQueue(@NotNull CommandSender sender) {
CommandSender targetSender = parseSender(sender);
QueuedCommand previousCommand = this.queuedCommandMap.remove(targetSender);
if (previousCommand == null) {
Logging.finer("No queue command to remove for sender %s.", targetSender.getName());
return false;
}
previousCommand.getExpireTask().cancel();
Logging.finer("Removed queue command for sender %s.", targetSender.getName());
return true;
}
/**
* To allow all CommandBlocks to be a common sender with use of {@link DummyCommandBlockSender}.
* So confirm command can be used for a queued command on another command block.
*
* @param sender The sender to parse.
* @return The sender, or if its a command block, a {@link DummyCommandBlockSender}.
*/
@NotNull
private CommandSender parseSender(@NotNull CommandSender sender) {
Logging.finer("Sender is of class %s.", sender.getClass().getName());
if (isCommandBlock(sender)) {
Logging.finer("Is command block.");
return COMMAND_BLOCK;
}
return sender;
}
/**
* Checks if the sender is a command block.
*
* @param sender The sender to check.
* @return True if sender is a command block, else false.
*/
private boolean isCommandBlock(@NotNull CommandSender sender) {
return sender instanceof BlockCommandSender
&& ((BlockCommandSender) sender).getBlock().getBlockData() instanceof CommandBlock;
}
}
@@ -1,121 +0,0 @@
package com.onarandombox.MultiverseCore.commandtools.queue;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Set;
import java.util.UUID;
/**
* Used by {@link CommandQueueManager}, so different commands block can be recognised as one.
*/
class DummyCommandBlockSender implements CommandSender {
@Override
public void sendMessage(@NotNull String message) {
throw new UnsupportedOperationException();
}
@Override
public void sendMessage(@NotNull String[] messages) {
throw new UnsupportedOperationException();
}
@Override
public void sendMessage(@Nullable UUID uuid, @NotNull String s) {
throw new UnsupportedOperationException();
}
@Override
public void sendMessage(@Nullable UUID uuid, @NotNull String[] strings) {
throw new UnsupportedOperationException();
}
@Override
public @NotNull Server getServer() {
return Bukkit.getServer();
}
@Override
public @NotNull String getName() {
return "DummyCommandBlockSender";
}
@NotNull
@Override
public Spigot spigot() {
throw new UnsupportedOperationException();
}
@Override
public boolean isPermissionSet(@NotNull String name) {
throw new UnsupportedOperationException();
}
@Override
public boolean isPermissionSet(@NotNull Permission perm) {
throw new UnsupportedOperationException();
}
@Override
public boolean hasPermission(@NotNull String name) {
throw new UnsupportedOperationException();
}
@Override
public boolean hasPermission(@NotNull Permission perm) {
throw new UnsupportedOperationException();
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) {
throw new UnsupportedOperationException();
}
@Override
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
throw new UnsupportedOperationException();
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) {
throw new UnsupportedOperationException();
}
@Override
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
throw new UnsupportedOperationException();
}
@Override
public void removeAttachment(@NotNull PermissionAttachment attachment) {
throw new UnsupportedOperationException();
}
@Override
public void recalculatePermissions() {
throw new UnsupportedOperationException();
}
@Override
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
throw new UnsupportedOperationException();
}
@Override
public boolean isOp() {
throw new UnsupportedOperationException();
}
@Override
public void setOp(boolean value) {
throw new UnsupportedOperationException();
}
}
@@ -1,99 +0,0 @@
/******************************************************************************
* Multiverse 2 Copyright (c) the Multiverse Team 2020. *
* Multiverse 2 is licensed under the BSD License. *
* For more information please check the README.md file included *
* with this project. *
******************************************************************************/
package com.onarandombox.MultiverseCore.commandtools.queue;
import co.aikar.commands.BukkitCommandIssuer;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.NotNull;
/**
* Represents a single command used in {@link CommandQueueManager} for confirming before running potentially
* dangerous action.
*/
public class QueuedCommand {
private static final String DEFAULT_PROMPT_MESSAGE = "The command you are trying to run is deemed dangerous.";
private static final int DEFAULT_VALID_TIME = 10;
private final CommandSender sender;
private final Runnable action;
private final String prompt;
private final int validDuration;
private BukkitTask expireTask;
public QueuedCommand(BukkitCommandIssuer issuer, Runnable action) {
this(issuer.getIssuer(), action, DEFAULT_PROMPT_MESSAGE, DEFAULT_VALID_TIME);
}
public QueuedCommand(BukkitCommandIssuer issuer, Runnable action, String prompt) {
this(issuer.getIssuer(), action, prompt, DEFAULT_VALID_TIME);
}
public QueuedCommand(BukkitCommandIssuer issuer, Runnable action, int validDuration) {
this(issuer.getIssuer(), action, DEFAULT_PROMPT_MESSAGE, validDuration);
}
public QueuedCommand(CommandSender sender, Runnable action) {
this(sender, action, DEFAULT_PROMPT_MESSAGE, DEFAULT_VALID_TIME);
}
public QueuedCommand(CommandSender sender, Runnable action, String prompt) {
this(sender, action, prompt, DEFAULT_VALID_TIME);
}
public QueuedCommand(CommandSender sender, Runnable action, int validDuration) {
this(sender, action, DEFAULT_PROMPT_MESSAGE, validDuration);
}
/**
* Creates a new queue command, to be registered at {@link CommandQueueManager#addToQueue(QueuedCommand)}.
*
* @param sender The sender that ran the command needed for confirmation.
* @param action The logic to execute upon confirming.
* @param prompt Question to ask sender to confirm.
* @param validDuration Duration in which the command is valid for confirm in seconds.
*/
public QueuedCommand(CommandSender sender, Runnable action, String prompt, int validDuration) {
this.sender = sender;
this.action = action;
this.prompt = prompt;
this.validDuration = validDuration;
}
@NotNull
CommandSender getSender() {
return sender;
}
@NotNull
String getPrompt() {
return prompt;
}
int getValidDuration() {
return validDuration;
}
@NotNull
Runnable getAction() {
return action;
}
@NotNull
BukkitTask getExpireTask() {
return expireTask;
}
void setExpireTask(@NotNull BukkitTask expireTask) {
if (this.expireTask != null) {
throw new IllegalStateException("This queue command already has an expire task. You can't register twice!");
}
this.expireTask = expireTask;
}
}
@@ -1,262 +0,0 @@
package com.onarandombox.MultiverseCore.config;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVConfig;
import com.onarandombox.MultiverseCore.configuration.handle.CommentedYamlConfigHandle;
import com.onarandombox.MultiverseCore.configuration.migration.BooleanMigratorAction;
import com.onarandombox.MultiverseCore.configuration.migration.ConfigMigrator;
import com.onarandombox.MultiverseCore.configuration.migration.IntegerMigratorAction;
import com.onarandombox.MultiverseCore.configuration.migration.InvertBoolMigratorAction;
import com.onarandombox.MultiverseCore.configuration.migration.MoveMigratorAction;
import com.onarandombox.MultiverseCore.configuration.migration.VersionMigrator;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
import io.vavr.control.Try;
import jakarta.inject.Inject;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;
@Service
public class MVCoreConfig implements MVConfig {
public static final String CONFIG_FILENAME = "config.yml";
public static final double CONFIG_VERSION = 5.0;
private final Path configPath;
private final MVCoreConfigNodes configNodes;
private final CommentedYamlConfigHandle configHandle;
@Inject
MVCoreConfig(@NotNull MultiverseCore core, @NotNull PluginManager pluginManager) {
this.configPath = Path.of(core.getDataFolder().getPath(), CONFIG_FILENAME);
this.configNodes = new MVCoreConfigNodes(pluginManager);
this.configHandle = CommentedYamlConfigHandle.builder(configPath)
.logger(Logging.getLogger())
.nodes(configNodes.getNodes())
.migrator(ConfigMigrator.builder(configNodes.VERSION)
.addVersionMigrator(VersionMigrator.builder(5.0)
.addAction(MoveMigratorAction.of("multiverse-configuration.enforceaccess", "world.enforce-access"))
.addAction(BooleanMigratorAction.of("world.enforce-access"))
.addAction(MoveMigratorAction.of("multiverse-configuration.prefixchat", "messaging.enable-chat-prefix"))
.addAction(BooleanMigratorAction.of("messaging.enable-chat-prefix"))
.addAction(MoveMigratorAction.of("multiverse-configuration.prefixchatformat", "messaging.chat-prefix-format"))
.addAction(MoveMigratorAction.of("multiverse-configuration.teleportintercept", "world.teleport-intercept"))
.addAction(BooleanMigratorAction.of("world.teleport-intercept"))
.addAction(MoveMigratorAction.of("multiverse-configuration.firstspawnoverride", "spawn.first-spawn-override"))
.addAction(BooleanMigratorAction.of("spawn.first-spawn-override"))
//.addAction(MoveMigratorAction.of("multiverse-configuration.displaypermerrors", ""))
.addAction(MoveMigratorAction.of("multiverse-configuration.globaldebug", "misc.global-debug"))
.addAction(IntegerMigratorAction.of("misc.global-debug"))
.addAction(MoveMigratorAction.of("multiverse-configuration.silentstart", "misc.silent-start"))
.addAction(BooleanMigratorAction.of("misc.silent-start"))
.addAction(MoveMigratorAction.of("multiverse-configuration.firstspawnworld", "spawn.first-spawn-location"))
.addAction(MoveMigratorAction.of("multiverse-configuration.defaultportalsearch", "portal.use-custom-portal-search"))
.addAction(BooleanMigratorAction.of("portal.use-custom-portal-search"))
.addAction(InvertBoolMigratorAction.of("portal.use-custom-portal-search"))
.addAction(MoveMigratorAction.of("multiverse-configuration.portalsearchradius", "portal.custom-portal-search-radius"))
.addAction(IntegerMigratorAction.of("portal.custom-portal-search-radius"))
.addAction(MoveMigratorAction.of("multiverse-configuration.autopurge", "world.auto-purge-entities"))
.addAction(BooleanMigratorAction.of("world.auto-purge-entities"))
.addAction(MoveMigratorAction.of("multiverse-configuration.idonotwanttodonate", "misc.show-donation-message"))
.addAction(BooleanMigratorAction.of("misc.show-donation-message"))
.addAction(InvertBoolMigratorAction.of("misc.show-donation-message"))
.build())
.build())
.build();
load();
save();
}
private void migrateFromOldConfigFile() {
String content;
try {
content = Files.readString(configPath);
} catch (IOException e) {
return;
}
// Remove the old config section if it is still in the old ConfigurationSerializable.
content = content.replace("==: com.onarandombox.MultiverseCore.MultiverseCoreConfiguration", "");
try {
Files.writeString(configPath, content);
} catch (IOException e) {
// ignore
}
}
@Override
public boolean load() {
migrateFromOldConfigFile();
return configHandle.load();
}
@Override
public boolean isLoaded() {
return configHandle.isLoaded();
}
@Override
public boolean save() {
configHandle.save();
return true;
}
@Override
public NodeGroup getNodes() {
return configNodes.getNodes();
}
@Override
public Try<Object> getProperty(String name) {
return configHandle.get(name);
}
@Override
public Try<Void> setProperty(String name, Object value) {
return configHandle.set(name, value);
}
@Override
public void setEnforceAccess(boolean enforceAccess) {
configHandle.set(configNodes.ENFORCE_ACCESS, enforceAccess);
}
@Override
public boolean getEnforceAccess() {
return configHandle.get(configNodes.ENFORCE_ACCESS);
}
@Override
public void setEnforceGameMode(boolean enforceGameMode) {
configHandle.set(configNodes.ENFORCE_GAMEMODE, enforceGameMode);
}
@Override
public boolean getEnforceGameMode() {
return configHandle.get(configNodes.ENFORCE_GAMEMODE);
}
@Override
public void setAutoPurgeEntities(boolean autopurge) {
configHandle.set(configNodes.AUTO_PURGE_ENTITIES, autopurge);
}
@Override
public boolean isAutoPurgeEntities() {
return configHandle.get(configNodes.AUTO_PURGE_ENTITIES);
}
@Override
public void setTeleportIntercept(boolean teleportIntercept) {
configHandle.set(configNodes.TELEPORT_INTERCEPT, teleportIntercept);
}
@Override
public boolean getTeleportIntercept() {
return configHandle.get(configNodes.TELEPORT_INTERCEPT);
}
@Override
public void setFirstSpawnOverride(boolean firstSpawnOverride) {
configHandle.set(configNodes.FIRST_SPAWN_OVERRIDE, firstSpawnOverride);
}
@Override
public boolean getFirstSpawnOverride() {
return configHandle.get(configNodes.FIRST_SPAWN_OVERRIDE);
}
@Override
public void setFirstSpawnLocation(String firstSpawnWorld) {
configHandle.set(configNodes.FIRST_SPAWN_LOCATION, firstSpawnWorld);
}
@Override
public String getFirstSpawnLocation() {
return configHandle.get(configNodes.FIRST_SPAWN_LOCATION);
}
@Override
public void setUseCustomPortalSearch(boolean useDefaultPortalSearch) {
configHandle.set(configNodes.USE_CUSTOM_PORTAL_SEARCH, useDefaultPortalSearch);
}
@Override
public boolean isUsingCustomPortalSearch() {
return configHandle.get(configNodes.USE_CUSTOM_PORTAL_SEARCH);
}
@Override
public void setCustomPortalSearchRadius(int searchRadius) {
configHandle.set(configNodes.CUSTOM_PORTAL_SEARCH_RADIUS, searchRadius);
}
@Override
public int getCustomPortalSearchRadius() {
return configHandle.get(configNodes.CUSTOM_PORTAL_SEARCH_RADIUS);
}
@Override
public void setEnablePrefixChat(boolean prefixChat) {
configHandle.set(configNodes.ENABLE_CHAT_PREFIX, prefixChat);
}
@Override
public boolean isEnablePrefixChat() {
return configHandle.get(configNodes.ENABLE_CHAT_PREFIX);
}
@Override
public void setPrefixChatFormat(String prefixChatFormat) {
configHandle.set(configNodes.CHAT_PREFIX_FORMAT, prefixChatFormat);
}
@Override
public String getPrefixChatFormat() {
return configHandle.get(configNodes.CHAT_PREFIX_FORMAT);
}
@Override
public void setRegisterPapiHook(boolean registerPapiHook) {
configHandle.set(configNodes.REGISTER_PAPI_HOOK, registerPapiHook);
}
@Override
public boolean isRegisterPapiHook() {
return configHandle.get(configNodes.REGISTER_PAPI_HOOK);
}
@Override
public void setGlobalDebug(int globalDebug) {
configHandle.set(configNodes.GLOBAL_DEBUG, globalDebug);
}
@Override
public int getGlobalDebug() {
return configHandle.get(configNodes.GLOBAL_DEBUG);
}
@Override
public void setSilentStart(boolean silentStart) {
configHandle.set(configNodes.SILENT_START, silentStart);
}
@Override
public boolean getSilentStart() {
return configHandle.get(configNodes.SILENT_START);
}
@Override
public void setShowDonateMessage(boolean showDonateMessage) {
configHandle.set(configNodes.SHOW_DONATION_MESSAGE, showDonateMessage);
}
@Override
public boolean isShowingDonateMessage() {
return configHandle.get(configNodes.SHOW_DONATION_MESSAGE);
}
}
@@ -1,216 +0,0 @@
package com.onarandombox.MultiverseCore.config;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.configuration.node.ConfigHeaderNode;
import com.onarandombox.MultiverseCore.configuration.node.ConfigNode;
import com.onarandombox.MultiverseCore.configuration.node.Node;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
import com.onarandombox.MultiverseCore.event.MVDebugModeEvent;
import com.onarandombox.MultiverseCore.exceptions.MultiverseException;
import io.github.townyadvanced.commentedconfiguration.setting.CommentedNode;
import io.vavr.control.Try;
import org.bukkit.plugin.PluginManager;
class MVCoreConfigNodes {
private final NodeGroup nodes = new NodeGroup();
private PluginManager pluginManager;
MVCoreConfigNodes(PluginManager pluginManager) {
this.pluginManager = pluginManager;
}
public NodeGroup getNodes() {
return nodes;
}
private <N extends Node> N node(N node) {
nodes.add(node);
return node;
}
private final ConfigHeaderNode HEADER = node(ConfigHeaderNode.builder("world") // TODO hacky way to get the header to the top of the file
.comment("####################################################################################################")
.comment("# #")
.comment("# █▀▄▀█ █░█ █░░ ▀█▀ █ █░█ █▀▀ █▀█ █▀ █▀▀   █▀▀ █▀█ █▀█ █▀▀ #")
.comment("# █░▀░█ █▄█ █▄▄ ░█░ █ ▀▄▀ ██▄ █▀▄ ▄█ ██▄   █▄▄ █▄█ █▀▄ ██▄ #")
.comment("# #")
.comment("# #")
.comment("# WIKI: https://github.com/Multiverse/Multiverse-Core/wiki #")
.comment("# DISCORD: https://discord.gg/NZtfKky #")
.comment("# BUG REPORTS: https://github.com/Multiverse/Multiverse-Core/issues #")
.comment("# #")
.comment("# #")
.comment("# Each option in this file is documented and explained here: #")
.comment("# ==> https://github.com/Multiverse/Multiverse-Core/wiki/config.yml #")
.comment("# #")
.comment("# #")
.comment("# New options are added to this file automatically. If you manually made changes #")
.comment("# to this file while your server is running, please run `/mv reload` command. #")
.comment("# #")
.comment("####################################################################################################")
.comment("")
.comment("")
.build());
// private final ConfigHeaderNode WORLD_HEADER = node(ConfigHeaderNode.builder("world")
// .comment("")
// .comment("")
// .build());
public final ConfigNode<Boolean> ENFORCE_ACCESS = node(ConfigNode.builder("world.enforce-access", Boolean.class)
.comment("This setting will prevent players from entering worlds they don't have access to.")
.comment("If this is set to false, players will be able to enter any world they want.")
.comment("If this is set to true, players will only be able to enter worlds they have")
.comment("the `mv.access.<worldname>` permission.")
.defaultValue(false)
.name("enforce-access")
.build());
public final ConfigNode<Boolean> ENFORCE_GAMEMODE = node(ConfigNode.builder("world.enforce-gamemode", Boolean.class)
.comment("")
.comment("Sets whether Multiverse will should enforce gamemode on world change.")
.comment("If enabled, players will be forced into the gamemode of the world they are entering, unless they have")
.comment("the `mv.bypass.gamemode.<worldname>` permission.")
.defaultValue(true)
.name("enforce-gamemode")
.build());
public final ConfigNode<Boolean> AUTO_PURGE_ENTITIES = node(ConfigNode.builder("world.auto-purge-entities", Boolean.class)
.comment("")
.comment("Sets whether Multiverse will purge mobs and entities with be automatically.")
.defaultValue(false)
.name("auto-purge-entities")
.build());
public final ConfigNode<Boolean> TELEPORT_INTERCEPT = node(ConfigNode.builder("world.teleport-intercept", Boolean.class)
.comment("")
.comment("If this is set to true, Multiverse will enforce access permissions for all teleportation,")
.comment("including teleportation from other plugins.")
.defaultValue(true)
.name("teleport-intercept")
.build());
private final ConfigHeaderNode SPAWN_HEADER = node(ConfigHeaderNode.builder("spawn")
.comment("")
.comment("")
.build());
public final ConfigNode<Boolean> FIRST_SPAWN_OVERRIDE = node(ConfigNode.builder("spawn.first-spawn-override", Boolean.class)
.comment("Sets whether Multiverse will override the first spawn location of a world.")
.comment("If enabled, Multiverse will set the first spawn location of a world to the spawn location of the world.")
.comment("If disabled, it will default to server.properties settings.")
.defaultValue(true)
.name("first-spawn-override")
.build());
public final ConfigNode<String> FIRST_SPAWN_LOCATION = node(ConfigNode.builder("spawn.first-spawn-location", String.class)
.comment("")
.comment("Sets the world that Multiverse will use as the location for players that first join the server.")
.comment("This only applies if first-spawn-override is set to true.")
.defaultValue("")
.name("first-spawn-location")
.build());
private final ConfigHeaderNode PORTAL_HEADER = node(ConfigHeaderNode.builder("portal")
.comment("")
.comment("")
.build());
public final ConfigNode<Boolean> USE_CUSTOM_PORTAL_SEARCH = node(ConfigNode.builder("portal.use-custom-portal-search", Boolean.class)
.comment("This config option defines whether or not Multiverse should interfere with's Bukkit's default portal search radius.")
.comment("Setting it to false would mean you want to simply let Bukkit decides the search radius itself.")
.defaultValue(false)
.name("use-custom-portal-search")
.build());
public final ConfigNode<Integer> CUSTOM_PORTAL_SEARCH_RADIUS = node(ConfigNode.builder("portal.custom-portal-search-radius", Integer.class)
.comment("")
.comment("This config option defines the search radius Multiverse should use when searching for a portal.")
.comment("This only applies if use-custom-portal-search is set to true.")
.defaultValue(128)
.name("custom-portal-search-radius")
.validator(value -> value < 0
? Try.failure(new MultiverseException("The value must be greater than or equal to 0.", null))
: Try.success(null))
.build());
private final ConfigHeaderNode MESSAGING_HEADER = node(ConfigHeaderNode.builder("messaging")
.comment("")
.comment("")
.build());
public final ConfigNode<Boolean> ENABLE_CHAT_PREFIX = node(ConfigNode.builder("messaging.enable-chat-prefix", Boolean.class)
.comment("This config option defines whether or not Multiverse should prefix the chat with the world name.")
.comment("This only applies if use-custom-portal-search is set to true.")
.defaultValue(false)
.name("enable-chat-prefix")
.build());
public final ConfigNode<String> CHAT_PREFIX_FORMAT = node(ConfigNode.builder("messaging.chat-prefix-format", String.class)
.comment("")
.comment("This config option defines the format Multiverse should use when prefixing the chat with the world name.")
.comment("This only applies if enable-chat-prefix is set to true.")
.defaultValue("[%world%]%chat%")
.name("chat-prefix-format")
.build());
public final ConfigNode<Boolean> REGISTER_PAPI_HOOK = node(ConfigNode.builder("messaging.register-papi-hook", Boolean.class)
.comment("")
.comment("This config option defines whether or not Multiverse should register the PlaceholderAPI hook.")
.comment("This only applies if PlaceholderAPI is installed.")
.defaultValue(true)
.name("register-papi-hook")
.build());
private final ConfigHeaderNode MISC_HEADER = node(ConfigHeaderNode.builder("misc")
.comment("")
.comment("")
.build());
public final ConfigNode<Integer> GLOBAL_DEBUG = node(ConfigNode.builder("misc.global-debug", Integer.class)
.comment("This is our debug flag to help identify issues with Multiverse.")
.comment("If you are having issues with Multiverse, please set this to 3 and then post your log to pastebin.com")
.comment("Otherwise, there's no need to touch this. If not instructed by a wiki page or developer.")
.comment(" 0 = Off, No debug messages")
.comment(" 1 = fine")
.comment(" 2 = finer")
.comment(" 3 = finest")
.defaultValue(0)
.name("global-debug")
.validator(value -> (value < 0 || value > 3)
? Try.failure(new MultiverseException("Debug level must be between 0 and 3.", null))
: Try.success(null))
.onSetValue((oldValue, newValue) -> {
int level = Logging.getDebugLevel();
Logging.setDebugLevel(newValue);
if (level != Logging.getDebugLevel()) {
pluginManager.callEvent(new MVDebugModeEvent(level));
}
})
.build());
public final ConfigNode<Boolean> SILENT_START = node(ConfigNode.builder("misc.silent-start", Boolean.class)
.comment("")
.comment("If true, the startup console messages will no longer show.")
.defaultValue(false)
.name("silent-start")
.onSetValue((oldValue, newValue) -> Logging.setShowingConfig(!newValue))
.build());
public final ConfigNode<Boolean> SHOW_DONATION_MESSAGE = node(ConfigNode.builder("misc.show-donation-message", Boolean.class)
.comment("")
.comment("If you don't want to donate, you can set this to false and Multiverse will stop nagging you.")
.defaultValue(true)
.name("show-donation-message")
.build());
public final ConfigNode<Double> VERSION = node(ConfigNode.builder("version", Double.class)
.comment("")
.comment("")
.comment("This just signifies the version number so we can see what version of config you have.")
.comment("NEVER TOUCH THIS VALUE")
.defaultValue(MVCoreConfig.CONFIG_VERSION)
.name(null)
.build());
}
@@ -1,93 +0,0 @@
package com.onarandombox.MultiverseCore.configuration.handle;
import java.nio.file.Path;
import java.util.logging.Logger;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.configuration.migration.ConfigMigrator;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
import com.onarandombox.MultiverseCore.configuration.node.CommentedNode;
import com.onarandombox.MultiverseCore.configuration.node.ValueNode;
import io.github.townyadvanced.commentedconfiguration.CommentedConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Configuration handle for commented YAML files.
*/
public class CommentedYamlConfigHandle extends FileConfigHandle<CommentedConfiguration> {
/**
* Creates a new builder for a {@link CommentedYamlConfigHandle}.
*
* @param configPath The path to the config file.
* @return The builder.
*/
public static @NotNull Builder builder(@NotNull Path configPath) {
return new Builder(configPath);
}
protected CommentedYamlConfigHandle(@NotNull Path configPath, @Nullable Logger logger, @Nullable NodeGroup nodes, @Nullable ConfigMigrator migrator) {
super(configPath, logger, nodes, migrator);
}
/**
* {@inheritDoc}
*/
@Override
protected boolean loadConfigObject() {
config = new CommentedConfiguration(configPath, logger);
return config.load();
}
/**
* {@inheritDoc}
*/
@Override
protected void setUpNodes() {
if (nodes == null || nodes.isEmpty()) {
return;
}
CommentedConfiguration oldConfig = config;
this.config = new CommentedConfiguration(configPath, logger);
nodes.forEach(node -> {
if (node instanceof CommentedNode typedNode) {
if (typedNode.getComments().length > 0) {
config.addComment(typedNode.getPath(), typedNode.getComments());
}
}
if (node instanceof ValueNode valueNode) {
set(valueNode, oldConfig.getObject(valueNode.getPath(), valueNode.getType(), valueNode.getDefaultValue())).onFailure(e -> {
Logging.warning("Failed to set node " + valueNode.getPath() + " to " + valueNode.getDefaultValue());
setDefault(valueNode);
});
}
});
}
/**
* {@inheritDoc}
*/
@Override
public boolean save() {
config.save();
return true;
}
public static class Builder extends FileConfigHandle.Builder<CommentedConfiguration, Builder> {
protected Builder(@NotNull Path configPath) {
super(configPath);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull CommentedYamlConfigHandle build() {
return new CommentedYamlConfigHandle(configPath, logger, nodes, migrator);
}
}
}
@@ -1,258 +0,0 @@
package com.onarandombox.MultiverseCore.configuration.handle;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.logging.Logger;
import com.dumptruckman.minecraft.util.Logging;
import com.onarandombox.MultiverseCore.configuration.migration.ConfigMigrator;
import com.onarandombox.MultiverseCore.configuration.node.ConfigNodeNotFoundException;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
import com.onarandombox.MultiverseCore.configuration.node.ValueNode;
import com.onarandombox.MultiverseCore.exceptions.MultiverseException;
import io.vavr.control.Try;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Generic configuration handle for file based configurations.
* @param <C> The configuration type.
*/
abstract class FileConfigHandle<C extends FileConfiguration> {
protected final @NotNull Path configPath;
protected final @NotNull File configFile;
protected final @Nullable Logger logger;
protected final @Nullable NodeGroup nodes;
protected final @Nullable ConfigMigrator migrator;
protected C config;
protected FileConfigHandle(@NotNull Path configPath, @Nullable Logger logger, @Nullable NodeGroup nodes, @Nullable ConfigMigrator migrator) {
this.configPath = configPath;
this.configFile = configPath.toFile();
this.logger = logger;
this.nodes = nodes;
this.migrator = migrator;
}
/**
* Loads the configuration.
*
* @return True if the configuration was loaded successfully, false otherwise.
*/
public boolean load() {
if (!createConfigFile()) {
Logging.severe("Failed to create config file: %s", configFile.getName());
return false;
}
if (!loadConfigObject()) {
Logging.severe("Failed to load config file: %s", configFile.getName());
return false;
}
migrateConfig();
setUpNodes();
return true;
}
/**
* Create a new config file if file does not exist
*
* @return True if file exist or created successfully, otherwise false.
*/
protected boolean createConfigFile() {
if (configFile.exists()) {
return true;
}
try {
if (!configFile.createNewFile()) {
return false;
}
Logging.info("Created new config file: %s", configFile.getName());
} catch (IOException e) {
return false;
}
return true;
}
/**
* Loads the configuration object.
*
* @return True if the configuration was loaded successfully, false otherwise.
*/
protected abstract boolean loadConfigObject();
/**
* Migrates the configuration.
*/
protected void migrateConfig() {
if (migrator != null) {
migrator.migrate(config);
}
}
/**
* Sets up the nodes.
*/
protected abstract void setUpNodes();
/**
* Saves the configuration.
*/
public abstract boolean save();
/**
* Checks if the configuration is loaded.
*
* @return True if the configuration is loaded, false otherwise.
*/
public boolean isLoaded() {
return config != null;
}
/**
* Gets the configuration.
*
* @return The configuration.
*/
public C getConfig() {
return config;
}
/**
* Gets the value of a node, if the node has a default value, it will be returned if the node is not found.
* @param name The name of the node.
* @return The value of the node.
*/
public Try<Object> get(@Nullable String name) {
return nodes.findNode(name, ValueNode.class)
.toTry(() -> new ConfigNodeNotFoundException(name))
.map(node -> get((ValueNode<Object>) node));
}
/**
* Gets the value of a node, if the node has a default value, it will be returned if the node is not found.
*
* @param node The node to get the value of.
* @return The value of the node.
*/
public <T> T get(@NotNull ValueNode<T> node) {
return config.getObject(node.getPath(), node.getType(), node.getDefaultValue());
}
/**
* Sets the value of a node, if the validator is not null, it will be tested first.
*
* @param name The name of the node.
* @param value The value to set.
* @return True if the value was set, false otherwise.
*/
public Try<Void> set(@Nullable String name, Object value) {
return nodes.findNode(name, ValueNode.class)
.toTry(() -> new ConfigNodeNotFoundException(name))
.flatMap(node -> set(node, value));
}
/**
* Sets the value of a node, if the validator is not null, it will be tested first.
*
* @param node The node to set the value of.
* @param value The value to set.
* @return True if the value was set, false otherwise.
* @param <T> The type of the node value.
*/
public <T> Try<Void> set(@NotNull ValueNode<T> node, T value) {
return node.validate(value).map(ignore -> {
T oldValue = get(node);
config.set(node.getPath(), value);
node.onSetValue(oldValue, get(node));
return null;
});
}
/**
* Sets the default value of a node.
*
* @param node The node to set the default value of.
*/
public void setDefault(@NotNull ValueNode node) {
config.set(node.getPath(), node.getDefaultValue());
}
/**
* Builder for {@link FileConfigHandle}.
*
* @param <C> The configuration type.
* @param <B> The builder type.
*/
public static abstract class Builder<C extends FileConfiguration, B extends Builder<C, B>> {
protected @NotNull Path configPath;
protected @Nullable Logger logger;
protected @Nullable NodeGroup nodes;
protected @Nullable ConfigMigrator migrator;
protected Builder(@NotNull Path configPath) {
this.configPath = configPath;
}
/**
* Sets the logger.
*
* @param logger The logger.
* @return The builder.
*/
public B logger(@Nullable Logger logger) {
this.logger = logger;
return self();
}
/**
* Sets the logger.
*
* @param plugin The plugin to get the logger from.
* @return The builder.
*/
public B logger(Plugin plugin) {
this.logger = plugin.getLogger();
return self();
}
/**
* Sets the nodes.
*
* @param nodes The nodes.
* @return The builder.
*/
public B nodes(@Nullable NodeGroup nodes) {
this.nodes = nodes;
return self();
}
/**
* Sets the migrator.
*
* @param migrator The migrator.
* @return The builder.
*/
public B migrator(@Nullable ConfigMigrator migrator) {
this.migrator = migrator;
return self();
}
/**
* Builds the configuration handle.
*
* @return The configuration handle.
*/
public abstract @NotNull FileConfigHandle<C> build();
@SuppressWarnings("unchecked")
protected B self() {
return (B) this;
}
}
}
@@ -1,97 +0,0 @@
package com.onarandombox.MultiverseCore.configuration.handle;
import java.io.IOException;
import java.nio.file.Path;
import java.util.logging.Logger;
import com.onarandombox.MultiverseCore.configuration.migration.ConfigMigrator;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
import com.onarandombox.MultiverseCore.configuration.node.ValueNode;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Configuration handle for YAML files.
*/
public class YamlConfigHandle extends FileConfigHandle<YamlConfiguration> {
/**
* Creates a new builder for {@link YamlConfigHandle}.
*
* @param configPath The path to the config file.
* @return The builder.
*/
public static @NotNull Builder<? extends Builder> builder(@NotNull Path configPath) {
return new Builder<>(configPath);
}
protected YamlConfigHandle(@NotNull Path configPath, @Nullable Logger logger, @Nullable NodeGroup nodes, @Nullable ConfigMigrator migrator) {
super(configPath, logger, nodes, migrator);
}
/**
* {@inheritDoc}
*/
@Override
protected boolean loadConfigObject() {
config = new YamlConfiguration();
try {
config.load(configFile);
} catch (IOException | InvalidConfigurationException e) {
return false;
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
protected void setUpNodes() {
if (nodes == null || nodes.isEmpty()) {
return;
}
YamlConfiguration oldConfig = config;
config = new YamlConfiguration();
nodes.forEach(node -> {
if (node instanceof ValueNode valueNode) {
set(valueNode, oldConfig.getObject(valueNode.getPath(), valueNode.getType(), valueNode.getDefaultValue()));
}
});
}
/**
* {@inheritDoc}
*/
@Override
public boolean save() {
try {
config.save(configFile);
} catch (IOException e) {
return false;
}
return true;
}
/**
* Builder for {@link YamlConfigHandle}.
* @param <B> The type of the builder.
*/
public static class Builder<B extends Builder<B>> extends FileConfigHandle.Builder<YamlConfiguration, B> {
protected Builder(@NotNull Path configPath) {
super(configPath);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull YamlConfigHandle build() {
return new YamlConfigHandle(configPath, logger, nodes, migrator);
}
}
}
@@ -1,172 +0,0 @@
package com.onarandombox.MultiverseCore.configuration.node;
import java.util.function.BiConsumer;
import java.util.function.Function;
import io.vavr.control.Option;
import io.vavr.control.Try;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A node that contains a value.
* @param <T> The type of the value.
*/
public class ConfigNode<T> extends ConfigHeaderNode implements ValueNode<T> {
/**
* Creates a new builder for a {@link ConfigNode}.
*
* @param path The path of the node.
* @param type The type of the value.
* @return The new builder.
* @param <T> The type of the value.
*/
public static @NotNull <T> ConfigNode.Builder<T, ? extends ConfigNode.Builder<T, ?>> builder(
@NotNull String path,
@NotNull Class<T> type
) {
return new ConfigNode.Builder<>(path, type);
}
protected final @Nullable String name;
protected final @NotNull Class<T> type;
protected final @Nullable T defaultValue;
protected final @Nullable Function<T, Try<Void>> validator;
protected final @Nullable BiConsumer<T, T> onSetValue;
protected ConfigNode(
@NotNull String path,
@NotNull String[] comments,
@Nullable String name,
@NotNull Class<T> type,
@Nullable T defaultValue,
@Nullable Function<T, Try<Void>> validator,
@Nullable BiConsumer<T, T> onSetValue
) {
super(path, comments);
this.name = name;
this.type = type;
this.defaultValue = defaultValue;
this.validator = validator;
this.onSetValue = onSetValue;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull Option<String> getName() {
return Option.of(name);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull Class<T> getType() {
return type;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable T getDefaultValue() {
return defaultValue;
}
/**
* {@inheritDoc}
*/
@Override
public Try<Void> validate(@Nullable T value) {
if (validator != null) {
return validator.apply(value);
}
return Try.success(null);
}
/**
* {@inheritDoc}
*/
@Override
public void onSetValue(@Nullable T oldValue, @Nullable T newValue) {
if (onSetValue != null) {
onSetValue.accept(oldValue, newValue);
}
}
/**
* Builder for {@link ConfigNode}.
*
* @param <T> The type of the value.
* @param <B> The type of the builder.
*/
public static class Builder<T, B extends ConfigNode.Builder<T, B>> extends ConfigHeaderNode.Builder<B> {
protected @Nullable String name;
protected @NotNull final Class<T> type;
protected @Nullable T defaultValue;
protected @Nullable Function<T, Try<Void>> validator;
protected @Nullable BiConsumer<T, T> onSetValue;
/**
* Creates a new builder.
*
* @param path The path of the node.
* @param type The type of the value.
*/
protected Builder(@NotNull String path, @NotNull Class<T> type) {
super(path);
this.name = path;
this.type = type;
}
/**
* Sets the default value for this node.
*
* @param defaultValue The default value.
* @return This builder.
*/
public @NotNull B defaultValue(@NotNull T defaultValue) {
this.defaultValue = defaultValue;
return (B) this;
}
/**
* Sets the name of this node. Used for identifying the node from user input.
*
* @param name The name of this node.
* @return This builder.
*/
public @NotNull B name(@Nullable String name) {
this.name = name;
return (B) this;
}
public @NotNull B validator(@NotNull Function<T, Try<Void>> validator) {
this.validator = validator;
return (B) this;
}
/**
* Sets the action to be performed when the value is set.
*
* @param onSetValue The action to be performed.
* @return This builder.
*/
public @NotNull B onSetValue(@NotNull BiConsumer<T, T> onSetValue) {
this.onSetValue = onSetValue;
return (B) this;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull ConfigNode<T> build() {
return new ConfigNode<>(path, comments.toArray(new String[0]), name, type, defaultValue, validator, onSetValue);
}
}
}
@@ -1,46 +0,0 @@
package com.onarandombox.MultiverseCore.configuration.node;
import io.vavr.control.Option;
import io.vavr.control.Try;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface ValueNode<T> extends Node {
/**
* Gets the name of this node. Used for identifying the node from user input.
*
* @return An {@link Option} containing the name of this node, or {@link Option.None} if the node has no name.
*/
@NotNull Option<String> getName();
/**
* Gets the class type {@link T} of the node value.
*
* @return The class type of the node value.
*/
@NotNull Class<T> getType();
/**
* Gets the default value with type {@link T} of the node.
*
* @return The default value of the node.
*/
@Nullable T getDefaultValue();
/**
* Validates the value of this node.
*
* @param value The value to validate.
* @return True if the value is valid, false otherwise.
*/
Try<Void> validate(@Nullable T value);
/**
* Called when the value of this node is set.
*
* @param oldValue The old value.
* @param newValue The new value.
*/
void onSetValue(@Nullable T oldValue, @Nullable T newValue);
}
@@ -1,213 +0,0 @@
package com.onarandombox.MultiverseCore.destination;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import co.aikar.commands.BukkitCommandIssuer;
import co.aikar.commands.CommandIssuer;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.DestinationInstance;
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
import com.onarandombox.MultiverseCore.api.Teleporter;
import com.onarandombox.MultiverseCore.teleportation.TeleportResult;
import jakarta.inject.Inject;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.PluginManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
/**
* Provides destinations for teleportation.
*/
@Service
public class DestinationsProvider {
private static final String SEPARATOR = ":";
private static final String PERMISSION_PREFIX = "multiverse.teleport.";
private final PluginManager pluginManager;
private final SafeTTeleporter safeTTeleporter;
private final Map<String, Destination<?>> destinationMap;
/**
* Creates a new destinations provider.
*/
@Inject
public DestinationsProvider(@NotNull PluginManager pluginManager, @NotNull SafeTTeleporter safeTTeleporter) {
this.pluginManager = pluginManager;
this.safeTTeleporter = safeTTeleporter;
this.destinationMap = new HashMap<>();
}
/**
* Adds a destination to the provider.
*
* @param destination The destination.
*/
public void registerDestination(@NotNull Destination<?> destination) {
this.destinationMap.put(destination.getIdentifier(), destination);
this.registerDestinationPerms(destination);
}
private void registerDestinationPerms(@NotNull Destination<?> destination) {
pluginManager.addPermission(new Permission(PERMISSION_PREFIX + "self." + destination.getIdentifier()));
pluginManager.addPermission(new Permission(PERMISSION_PREFIX + "other." + destination.getIdentifier()));
}
/**
* Suggest tab completions for a destination string.
*
* @param issuer The command issuer.
* @param deststring The current destination string.
* @return A collection of tab completions.
*/
public @NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer,
@Nullable String deststring
) {
return destinationMap.values().stream()
.filter(destination -> issuer.hasPermission(PERMISSION_PREFIX + "self." + destination.getIdentifier())
|| issuer.hasPermission(PERMISSION_PREFIX + "other." + destination.getIdentifier()))
.map(destination -> destination.suggestDestinations(issuer, deststring).stream()
.map(s -> destination.getIdentifier() + SEPARATOR + s)
.collect(Collectors.toList()))
.flatMap(Collection::stream)
.collect(Collectors.toList());
}
/**
* Converts a destination string to a destination object.
*
* @param destinationString The destination string.
* @return The destination object, or null if invalid format.
*/
public ParsedDestination<?> parseDestination(String destinationString) {
String[] items = destinationString.split(SEPARATOR, 2);
String idString = items[0];
String destinationParams;
Destination<?> destination;
if (items.length < 2) {
// Assume world destination
destination = this.getDestinationById("w");
destinationParams = items[0];
} else {
destination = this.getDestinationById(idString);
destinationParams = items[1];
}
if (destination == null) {
return null;
}
DestinationInstance destinationInstance = destination.getDestinationInstance(destinationParams);
if (destinationInstance == null) {
return null;
}
return new ParsedDestination<>(destination, destinationInstance);
}
/**
* Gets a destination by its identifier.
*
* @param identifier The identifier.
* @return The destination, or null if not found.
*/
public @Nullable Destination<?> getDestinationById(@Nullable String identifier) {
return this.destinationMap.get(identifier);
}
/**
* Teleports the teleportee to the destination.
*
* @param teleporter The teleporter.
* @param teleportee The teleportee.
* @param destination The destination.
*/
public CompletableFuture<TeleportResult> playerTeleportAsync(@NotNull BukkitCommandIssuer teleporter,
@NotNull Player teleportee,
@NotNull ParsedDestination<?> destination
) {
if (!checkTeleportPermissions(teleporter, teleportee, destination)) {
return CompletableFuture.completedFuture(TeleportResult.FAIL_PERMISSION);
}
return teleportAsync(teleporter, teleportee, destination);
}
/**
* Teleports the teleportee to the destination.
*
* @param teleporter The teleporter.
* @param teleportee The teleportee.
* @param destination The destination.
*/
public CompletableFuture<TeleportResult> teleportAsync(@NotNull BukkitCommandIssuer teleporter,
@NotNull Entity teleportee,
@NotNull ParsedDestination<?> destination
) {
Teleporter teleportHandler = destination.getDestination().getTeleporter();
if (teleportHandler == null) {
teleportHandler = safeTTeleporter;
}
return teleportHandler.teleportAsync(teleporter, teleportee, destination);
}
/**
* Checks if the teleporter has permission to teleport the teleportee to the destination.
*
* @param teleporter The teleporter.
* @param teleportee The teleportee.
* @param destination The destination.
* @return True if the teleporter has permission, false otherwise.
*/
public boolean checkTeleportPermissions(CommandIssuer teleporter, Entity teleportee, ParsedDestination<?> destination) {
//TODO Move permission checking to a separate class
String permission = PERMISSION_PREFIX
+ (teleportee.equals(teleporter.getIssuer()) ? "self" : "other") + "."
+ destination.getDestination().getIdentifier();
if (!teleporter.hasPermission(permission)) {
teleporter.sendMessage("You don't have permission to teleport to this destination.");
return false;
}
//TODO Config whether to use finer permission
String finerPermissionSuffix = destination.getDestinationInstance().getFinerPermissionSuffix();
if (finerPermissionSuffix == null || finerPermissionSuffix.isEmpty()) {
return true;
}
String finerPermission = permission + "." + finerPermissionSuffix;
if (!teleporter.hasPermission(finerPermission)) {
teleporter.sendMessage("You don't have permission to teleport to this destination.");
return false;
}
return true;
}
/**
* Checks if the issuer has permission to teleport to at least one destination.
*
* @param issuer The issuer.
* @return True if the issuer has permission, false otherwise.
*/
public boolean hasAnyTeleportPermission(CommandIssuer issuer) {
for (Destination<?> destination : this.destinationMap.values()) {
String permission = PERMISSION_PREFIX + "self." + destination.getIdentifier();
if (issuer.hasPermission(permission)) {
return true;
}
permission = PERMISSION_PREFIX + "other." + destination.getIdentifier();
if (issuer.hasPermission(permission)) {
return true;
}
}
return false;
}
}
@@ -1,85 +0,0 @@
package com.onarandombox.MultiverseCore.destination;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.DestinationInstance;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A parsed destination.
*
* @param <S> The destination instance type.
*/
public class ParsedDestination<S extends DestinationInstance> {
private final Destination<S> destination;
private final DestinationInstance destinationInstance;
/**
* Creates a new parsed destination.
*
* @param destination The destination.
* @param destinationInstance The destination instance.
*/
public ParsedDestination(Destination<S> destination, DestinationInstance destinationInstance) {
this.destination = destination;
this.destinationInstance = destinationInstance;
}
/**
* Shortcut for {@link Destination#getIdentifier()}.
*
* @return The destination identifier.
*/
public @NotNull String getIdentifier() {
return destination.getIdentifier();
}
/**
* Shortcut for {@link DestinationInstance#getLocation(Entity)}.
*
* @param teleportee The entity to teleport.
* @return The location to teleport to.
*/
public @Nullable Location getLocation(@NotNull Entity teleportee) {
return destinationInstance.getLocation(teleportee);
}
/**
* Shortcut for {@link DestinationInstance#getFinerPermissionSuffix()}.
*
* @return The finer permission suffix.
*/
public @Nullable String getFinerPermissionSuffix() {
return destinationInstance.getFinerPermissionSuffix();
}
/**
* Gets the destination.
*
* @return The destination.
*/
public Destination<S> getDestination() {
return destination;
}
/**
* Gets the destination instance.
*
* @return The destination instance.
*/
public DestinationInstance getDestinationInstance() {
return destinationInstance;
}
/**
* Converts to saveable string representation of this destination.
*
* @return Serialized string.
*/
@Override
public String toString() {
return getIdentifier() + ":" + destinationInstance.serialise();
}
}
@@ -1,68 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import java.util.Collection;
import co.aikar.commands.BukkitCommandIssuer;
import com.onarandombox.MultiverseCore.anchor.AnchorManager;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.Teleporter;
import jakarta.inject.Inject;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
@Service
public class AnchorDestination implements Destination<AnchorDestinationInstance> {
private final AnchorManager anchorManager;
@Inject
public AnchorDestination(AnchorManager anchorManager) {
this.anchorManager = anchorManager;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String getIdentifier() {
return "a";
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable AnchorDestinationInstance getDestinationInstance(@Nullable String destinationParams) {
Location anchorLocation = this.anchorManager.getAnchorLocation(destinationParams);
if (anchorLocation == null) {
return null;
}
return new AnchorDestinationInstance(destinationParams, anchorLocation);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer, @Nullable String destinationParams) {
return this.anchorManager.getAnchors(issuer.getPlayer());
}
/**
* {@inheritDoc}
*/
@Override
public boolean checkTeleportSafety() {
return true;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Teleporter getTeleporter() {
return null;
}
}
@@ -1,56 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import com.onarandombox.MultiverseCore.api.DestinationInstance;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class AnchorDestinationInstance implements DestinationInstance {
private final String anchorName;
private final Location anchorLocation;
/**
* Constructor.
*
* @param anchorName The name of the anchor.
* @param anchorLocation The location of the anchor.
*/
public AnchorDestinationInstance(@NotNull String anchorName, @NotNull Location anchorLocation) {
this.anchorName = anchorName;
this.anchorLocation = anchorLocation;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Location getLocation(@NotNull Entity teleportee) {
return anchorLocation;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Vector getVelocity(@NotNull Entity teleportee) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable String getFinerPermissionSuffix() {
return anchorName;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String serialise() {
return anchorName;
}
}
@@ -1,69 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import co.aikar.commands.BukkitCommandIssuer;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.Teleporter;
import com.onarandombox.MultiverseCore.utils.PlayerFinder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
@Service
public class BedDestination implements Destination<BedDestinationInstance> {
public static final String OWN_BED_STRING = "playerbed";
public BedDestination() {
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String getIdentifier() {
return "b";
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable BedDestinationInstance getDestinationInstance(@Nullable String destinationParams) {
Player player = PlayerFinder.get(destinationParams);
if (player == null && !destinationParams.equals(OWN_BED_STRING)) {
return null;
}
return new BedDestinationInstance(player);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer, @Nullable String destinationParams) {
List<String> collect = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
collect.add(OWN_BED_STRING);
return collect;
}
/**
* {@inheritDoc}
*/
@Override
public boolean checkTeleportSafety() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Teleporter getTeleporter() {
return null;
}
}
@@ -1,60 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import com.onarandombox.MultiverseCore.api.DestinationInstance;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class BedDestinationInstance implements DestinationInstance {
private final Player player;
/**
* Constructor.
*
* @param player The player whose bed to use.
*/
public BedDestinationInstance(Player player) {
this.player = player;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Location getLocation(@NotNull Entity teleportee) {
if (player != null) {
return player.getBedSpawnLocation();
}
if (teleportee instanceof Player) {
return ((Player) teleportee).getBedSpawnLocation();
}
return null;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Vector getVelocity(@NotNull Entity teleportee) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable String getFinerPermissionSuffix() {
return player != null ? player.getName() : BedDestination.OWN_BED_STRING;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String serialise() {
return player != null ? player.getName() : BedDestination.OWN_BED_STRING;
}
}
@@ -1,103 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import java.util.Collection;
import java.util.Collections;
import co.aikar.commands.BukkitCommandIssuer;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.Teleporter;
import jakarta.inject.Inject;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
@Service
public class CannonDestination implements Destination<CannonDestinationInstance> {
private final MVWorldManager worldManager;
@Inject
public CannonDestination(MVWorldManager worldManager) {
this.worldManager = worldManager;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String getIdentifier() {
return "ca";
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable CannonDestinationInstance getDestinationInstance(@Nullable String destinationParams) {
String[] params = destinationParams.split(":");
if (params.length != 5) {
return null;
}
String worldName = params[0];
String coordinates = params[1];
String pitch = params[2];
String yaw = params[3];
String speed = params[4];
String[] coordinatesParams = coordinates.split(",");
if (coordinatesParams.length != 3) {
return null;
}
MVWorld world = this.worldManager.getMVWorld(worldName);
if (world == null) {
return null;
}
Location location;
double dSpeed;
try {
location = new Location(
world.getCBWorld(),
Double.parseDouble(coordinatesParams[0]),
Double.parseDouble(coordinatesParams[1]),
Double.parseDouble(coordinatesParams[2]),
Float.parseFloat(yaw),
Float.parseFloat(pitch)
);
dSpeed = Double.parseDouble(speed);
} catch (NumberFormatException e) {
return null;
}
return new CannonDestinationInstance(location, dSpeed);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer, @Nullable String destinationParams) {
return Collections.singleton("");
}
/**
* {@inheritDoc}
*/
@Override
public boolean checkTeleportSafety() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Teleporter getTeleporter() {
return null;
}
}
@@ -1,65 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import com.onarandombox.MultiverseCore.api.DestinationInstance;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class CannonDestinationInstance implements DestinationInstance {
private final Location location;
private final double speed;
/**
* Constructor.
*
* @param location The location to teleport to.
* @param speed The speed to fire the player at.
*/
public CannonDestinationInstance(@NotNull Location location, double speed) {
this.location = location;
this.speed = speed;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Location getLocation(@NotNull Entity teleportee) {
return location;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Vector getVelocity(@NotNull Entity teleportee) {
double pitchRadians = Math.toRadians(location.getPitch());
double yawRadians = Math.toRadians(location.getYaw());
double x = Math.sin(yawRadians) * speed * -1;
double y = Math.sin(pitchRadians) * speed * -1;
double z = Math.cos(yawRadians) * speed;
// Account for the angle they were pointed, and take away velocity
x = Math.cos(pitchRadians) * x;
z = Math.cos(pitchRadians) * z;
return new Vector(x, y, z);
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable String getFinerPermissionSuffix() {
return location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String serialise() {
return location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw() + ":" + this.speed;
}
}
@@ -1,106 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import java.util.Collection;
import java.util.Collections;
import co.aikar.commands.BukkitCommandIssuer;
import com.onarandombox.MultiverseCore.api.Destination;
import com.onarandombox.MultiverseCore.api.MVWorld;
import com.onarandombox.MultiverseCore.api.MVWorldManager;
import com.onarandombox.MultiverseCore.api.Teleporter;
import jakarta.inject.Inject;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jvnet.hk2.annotations.Service;
@Service
public class ExactDestination implements Destination<ExactDestinationInstance> {
private final MVWorldManager worldManager;
@Inject
public ExactDestination(MVWorldManager worldManager) {
this.worldManager = worldManager;
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String getIdentifier() {
return "e";
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable ExactDestinationInstance getDestinationInstance(@Nullable String destinationParams) {
String[] items = destinationParams.split(":");
if (items.length < 2) {
return null;
}
String worldName = items[0];
String coordinates = items[1];
String[] coordinatesParams = coordinates.split(",");
if (coordinatesParams.length != 3) {
return null;
}
MVWorld world = this.worldManager.getMVWorld(worldName);
if (world == null) {
return null;
}
Location location;
try {
location = new Location(
world.getCBWorld(),
Double.parseDouble(coordinatesParams[0]),
Double.parseDouble(coordinatesParams[1]),
Double.parseDouble(coordinatesParams[2])
);
} catch (NumberFormatException e) {
return null;
}
if (items.length == 4) {
String pitch = items[2];
String yaw = items[3];
try {
location.setPitch(Float.parseFloat(pitch));
location.setYaw(Float.parseFloat(yaw));
} catch (NumberFormatException e) {
return null;
}
}
return new ExactDestinationInstance(location);
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull Collection<String> suggestDestinations(@NotNull BukkitCommandIssuer issuer, @Nullable String destinationParams) {
return Collections.singleton("");
}
/**
* {@inheritDoc}
*/
@Override
public boolean checkTeleportSafety() {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Teleporter getTeleporter() {
return null;
}
}
@@ -1,54 +0,0 @@
package com.onarandombox.MultiverseCore.destination.core;
import com.onarandombox.MultiverseCore.api.DestinationInstance;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ExactDestinationInstance implements DestinationInstance {
private final Location location;
/**
* Constructor.
*
* @param location The location to teleport to.
*/
public ExactDestinationInstance(Location location) {
this.location = location;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Location getLocation(@NotNull Entity teleportee) {
return location;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable Vector getVelocity(@NotNull Entity teleportee) {
return null;
}
/**
* {@inheritDoc}
*/
@Override
public @Nullable String getFinerPermissionSuffix() {
return location.getWorld().getName();
}
/**
* {@inheritDoc}
*/
@Override
public @NotNull String serialise() {
return location.getWorld().getName() + ":" + location.getX() + "," + location.getY()
+ "," + location.getZ() + ":" + location.getPitch() + ":" + location.getYaw();
}
}
Loaded 100 of 534 files, more files were not shown because too many files have changed in this diff. Show more