242 Commits
Author SHA1 Message Date
NotAlexNoyle 7db997d5f6 Update canonical Gitea link 2026-10-31 11:46:37 -04:00
NotAlexNoyle 82900988eb Exclude CODEOWNERS from language statistics 2026-10-27 08:25:11 -04:00
NotAlexNoyle 26b31874ad Add CODEOWNERS (one staff approval) 2026-10-27 08:25:11 -04:00
NotAlexNoyle 9f5a4065d9 Fix PlayerBounties-OG head compatibility 2026-03-27 10:53:12 -04:00
NotAlexNoyle d150f0ddc2 Add PlayerHeads-OG Compatibility 2026-03-26 10:16:11 -04:00
NotAlexNoyle 1e6613dc32 Use TrueOG Network config file 2026-01-27 22:22:41 -05:00
NotAlexNoyle b45037511f Milestone towards tracking config files on git. Waiting on true-og/SubstAgent update 2026-01-01 07:56:08 -05:00
NotAlexNoyle bb1846d086 Update gradle to 8.14.3 2025-08-20 10:33:38 -04:00
NotAlexNoyle 731b2d9190 Remove accidental clone 2025-06-27 14:19:24 -04:00
NotAlexNoyle 90503ae619 Update gradle to 8.14.2, add auto formatting 2025-06-25 01:49:57 -04:00
NotAlexNoyle bec6ca0205 Update gradle to 8.14.1 and shadow to 8.3.6 2025-06-13 16:23:25 -04:00
NotAlexNoyle e80ab17dec Update gradle 2025-05-30 13:02:22 -04:00
NotAlexNoyle ec983c8e1a Stop suppressing fork builds 2025-01-03 07:39:29 -05:00
NotAlexNoyle 2a7bb93f78 Merge branch 'PlayPro:master' into master 2025-01-03 07:36:22 -05:00
Intelli b3db65d07d Fixed NotSerializableException when logging items containing attribute data 2024-12-09 16:37:29 -07:00
NotAlexNoyle 0e341c9a96 Clean up 2024-12-09 10:12:29 -05:00
NotAlexNoyle 84e265d570 Add gradle wrapper 2024-12-09 10:11:27 -05:00
NotAlexNoyle 20e2081abd Initial release 2024-12-09 09:31:17 -05:00
NotAlexNoyle 2d7b67bbd9 Merge branch 'PlayPro:master' into master 2024-12-08 14:43:06 -05:00
Intelli f729c8a126 Fixed NullPointerException when breaking/placing certain skulls on Paper servers (fixes #643) 2024-12-05 17:01:57 -07:00
Intelli e5ec7ede72 Disable processor information when running on Android 2024-11-28 19:41:52 -07:00
Intelli 65705508c5 Build against 1.21.1 to resolve IncompatibleClassChangeError (upstream issue) 2024-11-05 11:56:57 -07:00
Intelli 2654562585 Changed minimum supported MC version to 1.16 2024-11-05 11:06:33 -07:00
Intelli 011865de56 Fixed IncompatibleClassChangeError on entity kills for MC 1.21.1 and earlier 2024-11-05 10:34:13 -07:00
Intelli 9958d372e3 Fixed IncompatibleClassChangeError when breaking paintings in 1.21.1 and earlier 2024-11-05 10:17:55 -07:00
Intelli 2780a9af27 Fixed NotSerializableException when sacrificing entities (fixes #666) 2024-11-04 14:31:00 -07:00
Intelli ad4b0ddf24 Fixed NoSuchMethodError when killing entities on Spigot servers 2024-11-04 13:59:18 -07:00
Shotadft(承太劇場)andIntelli 25cef3e5c5 Change to Japanese (#660)
* Update ja.yml

* Update ja.yml

* Update ja.yml

---------

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2024-10-28 17:57:32 -06:00
NotAlexNoyle 830c4a0041 Purge log4j 2024-10-19 20:09:06 +00:00
Intelli 2327dbcf78 Fixed SQLiteException when performing purges on SQLite databases (fixes #654) 2024-10-07 19:59:46 -06:00
Intelli eaa8c5c5c1 Fixed v23.1 patch script not triggering on v23.0 installs when using SQLite 2024-10-03 18:37:13 -06:00
Intelli 70ffeacbc0 Fixed NoClassDefFoundError when attempting to load plugin on 32-bit Windows 2024-10-03 15:56:29 -06:00
Intelli 385c11a3aa Finalized extension system 2024-10-03 15:51:18 -06:00
Intelli 88b19efc89 Improve Extension handling 2024-09-29 18:56:07 -06:00
Intelli c7406a01a7 Fix compilation error 2024-09-29 18:47:30 -06:00
Intelli 0f0c89845c Added separate version check for CoreProtect Edge 2024-09-29 18:40:05 -06:00
Intelli de978fce2c Added base changes for database migration command (unfinished) 2024-09-29 18:35:37 -06:00
DarkSnakeX fc0c8ff9ac Update es.yml (#633)
Added new lines that were not covered on the old translation file.
2024-09-03 12:55:47 -06:00
Intelli edadebf8c2 Run v23.1 patch script on v23.0 builds 2024-08-20 14:16:27 -06:00
Intelli ea1b86c034 Only start CoreProtect on supported Minecraft versions 2024-08-20 14:13:44 -06:00
Intelli c493a0dece Added support for Community Edition builds 2024-08-19 20:55:43 -06:00
Wang Siu Kao cff6be6d90 Update Traditional Chinese translation (#618) 2024-08-19 16:17:23 -06:00
Intelli 7ab0704002 Improved how CPU information is displayed under /co status 2024-08-15 20:48:42 -06:00
Intelli cae29f257d Fixed NullPointerException when attempting to roll back skulls with texture data 2024-08-15 20:48:21 -06:00
Intelli c6f8be9043 Fixed NoClassDefFoundError if JNA is missing on system 2024-08-15 19:55:21 -06:00
Intelli 1cf940e201 Improved MySQL index handling on radius lookups (fixes #599) 2024-08-15 19:23:39 -06:00
Intelli d2bffb2103 Fixed errors pertaining the CPU lib on startup on some systems (fixes #591) 2024-08-15 19:04:31 -06:00
Intelli 64eedb0aa3 Added "include" parameter to purge tab completion 2024-08-15 18:28:02 -06:00
Intelli 8ab582d6d1 Fixed old turtle scute item data displaying as air 2024-08-15 17:51:03 -06:00
Intelli 3194c35bb9 Fixed purge include parameter not functioning correctly for SQLite databases 2024-08-13 20:11:16 -06:00
Intelli 888df067f9 Fixed Villager type not being rolled back correctly in MC 1.21+ 2024-07-25 16:40:36 -06:00
Intelli fda87e2f6a Updated language file 2024-07-24 14:27:49 -06:00
Intelli 9aea18749d Fixed backwards compatibility with entity serialization 2024-07-24 14:04:46 -06:00
Intelli 06208a69b0 Added logging for skull skin textures on Paper servers 2024-07-23 20:09:05 -06:00
Intelli a93bf2f047 Fixed NotSerializableException when killing certain entities (fixes #589) 2024-07-23 20:06:18 -06:00
Intelli 77a4a9476a Hide all errors regarding CPU info (fixes #591) 2024-07-23 13:21:46 -06:00
ac0792b9ef Update de.yml (#518)
* Update de.yml

some changes for the lang file

* Improve /co help inspect translations

Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com>

* Formatting fixes

Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com>

* Update lang/de.yml

Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com>

* Update lang/de.yml

Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com>

---------

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
Co-authored-by: Daniel Scherf <35780068+dlsf@users.noreply.github.com>
2024-07-23 13:05:05 -06:00
Intelli da227afe33 Added primary thread error when running a rollback via API (implements #456) 2024-07-09 18:59:16 -06:00
Intelli 4bf4f4eb92 Prepped logging for skull skin textures on Paper servers 2024-07-09 18:51:46 -06:00
Intelli dbd8723752 Added CPU & RAM information to /co status 2024-07-09 18:02:49 -06:00
Intelli e093970992 Fixed inventory sorting mods generating unnecessary threads 2024-07-08 19:54:06 -06:00
jd07159 63074715d3 Improve Korean translation (#566) 2024-07-08 13:32:41 -06:00
Intelli 24a09b49d2 Added base Korean translation file 2024-07-08 11:42:08 -06:00
Intelli d4cc7ec729 Hide item serialization errors unless using development branch 2024-07-06 12:07:31 -06:00
Intelli 4af95632d5 Fix inventory drag event not properly checking if a player is dragging within their own inventory 2024-07-06 12:03:54 -06:00
Intelli c67e69755d Fixed IllegalStateException error on some servers during server shutdowns. 2024-07-06 11:45:32 -06:00
Intelli ce8c194e0d Fixed IncompatibleClassChangeError on inventory transactions (fixes #571) 2024-06-24 17:02:01 -06:00
Intelli 40e7f04774 Added support for logging Crafter transactions (#565) 2024-06-18 16:10:09 -06:00
Intelli fa1de08c0d Use proper adapter for EntityType.END_CRYSTAL 2024-06-18 16:04:35 -06:00
Intelli 49eb176ee6 Fixed invalid method name from previous commit 2024-06-17 18:52:25 -06:00
Intelli aaa7a3536a Hide item deserialization errors unless using development branch (fixes #550) 2024-06-17 18:49:43 -06:00
Intelli 957bf70c26 Hide entity deserialization errors unless using development branch (fixes #552) 2024-06-17 18:44:46 -06:00
Intelli 3d32320a33 Added support for MC 1.21 block/entity types 2024-06-17 18:31:33 -06:00
Intelli 3e8083becf Fixed wind charges incorrectly logging false #explosion data (fixes #555) 2024-06-17 18:06:04 -06:00
Intelli 057a635030 Added logging for dispensers removing blocks from the world 2024-06-17 17:51:01 -06:00
Intelli aa2ee7225c Added logging for droppers adding items to other containers 2024-06-17 17:34:18 -06:00
Intelli 37fc9af300 Added MC 1.21 support 2024-06-17 17:30:18 -06:00
Intelli 371e496351 Changed "#endercrystal" to now log as "#end_crystal" 2024-06-17 15:56:58 -06:00
Intelli e781d9ef01 Skip namespace remapping on Paper 1.20.5+ 2024-06-17 15:00:33 -06:00
Preva1l d2edaceae7 Change Folia check to be compatible with ShreddedPaper (#551)
ShreddedPaper is fully compatible with all folia plugins if don't check if its folia, BUT we have an empty class for RegionizedServer as MOST plugins will check for this, please be like everyone else!
2024-06-08 11:16:06 -06:00
Intelli ca59ff25df Changed "#endercrystal" to now log as "#ender_crystal" 2024-05-27 13:46:59 -06:00
Intelli cfb53f766e Fixed NullPointerException on Mohist servers when processing inventory transactions 2024-05-19 12:36:38 -06:00
lukyn76 e7c5078035 Fix typo (#543) 2024-05-15 10:15:18 -06:00
Intelli 5242973fe8 Fixed NullPointerException when hopper destination block is missing 2024-05-14 16:26:34 -06:00
Intelli e99a4a86d0 Update build version 2024-05-13 17:47:50 -06:00
Intelli 48b1fe22d3 Set Maven to build against Java 21 2024-05-13 17:46:16 -06:00
Intelli 29225a4a59 Set current API documentation version as v10 2024-05-13 17:43:49 -06:00
Intelli e6557ab5f3 Added #button, #container, #door, and #pressure_plate tags 2024-05-13 17:21:14 -06:00
Intelli 5859958ec2 Simplified tag handling 2024-05-13 17:16:17 -06:00
Intelli 5bc28b3e05 Added ability to specify specific block types in the purge command 2024-05-13 16:13:55 -06:00
Intelli b41e40acc0 Minor refactoring on Rollback class 2024-05-12 12:16:48 -06:00
Intelli 5a49ef8447 Cleanup 2024-05-12 11:47:25 -06:00
TelesphoreoandIntelli 42af5dc7a1 Fix FAWE logging on newer builds (#528)
* Fix FAWE logging on newer builds

* fix regular WE logging

* Fix registering of FAWE for event bus

* Remove jcenter

* Add missing `replaceBlocks` method

* Remove FAWE toggle entirely

* oops, i can't do it that way

---------

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2024-05-12 11:43:36 -06:00
Intelli dbb44ab5b9 Only validate skull owner name length if using MySQL 2024-05-11 15:09:50 -06:00
Intelli d18a023e73 Fixed MysqlDataTruncation error when logging custom skull data 2024-05-11 15:08:16 -06:00
Intelli 377a6f55b9 Added #shulker_box tag to target all shulker box types (#493) 2024-05-11 13:16:58 -06:00
Intelli e61b8a4d9b Fixed unnecessary database transactions when consumer is empty (fixes #511) 2024-05-11 13:06:29 -06:00
Intelli 3b9d8726d9 Fixed obfuscation in item names making tooltips unreadable (fixes #487) 2024-05-09 22:44:29 -06:00
Intelli 48d2030766 Fixed NoSuchMethodError for arrows on MC 1.20/1.20.1 2024-05-09 12:25:57 -06:00
Intelli 86ace6c326 Added required version for disabling block logging in documentation 2024-05-09 12:08:43 -06:00
Intelli 346b4b8b20 Fixed occasional NullPointerException while processing hopper transactions (fixes #539) 2024-05-08 13:18:42 -06:00
Intelli 704f0aaf9b Update build version 2024-05-07 17:51:02 -06:00
Intelli 4daaf6cc02 Fixed lookups on legacy data not matching against legacy materials 2024-05-07 14:18:43 -06:00
Intelli 5426e69fb8 Improved hopper logging to prevent infinite attempts on failed pushes
E.g. when a hopper is repeatedly trying to push into a smoker, but no items are actually being transferred
2024-05-07 14:08:59 -06:00
Intelli 6023c21ba9 Fixed hopper pulls performing container validation on source block 2024-05-06 19:19:48 -06:00
Intelli 3e3496ad12 Corrected version references in API v10 documentation 2024-05-06 18:18:56 -06:00
Intelli f3c631bbf5 Added thread-safe logPlacement and logRemoval API methods 2024-05-03 12:57:27 -06:00
Intelli d8ad48beb8 Fixed entity deaths not always being logged in MC 1.19 and earlier (fixes #515) 2024-05-02 13:03:53 -06:00
Intelli 053f7d5c7d Fixed NoSuchMethodError when shooting or dropping arrows (fixes #535) 2024-05-02 12:52:51 -06:00
Nahuel Dolores a4c37da8ee Ditch weak map world references and use names instead (#533) 2024-04-25 14:05:48 -06:00
Intelli b1598a022a Fixed broken commit 32688c5 2024-04-21 14:08:37 -06:00
Intelli 32688c55cf Fixed block spread cache not always being properly utilized 2024-04-19 19:17:35 -06:00
Intelli a239b51ed1 Fixed teleports not working on some systems (fixes #491) 2024-02-07 12:49:36 -07:00
Intelli af1d4402eb Fixed hopper transactions not always being logged (fixes #490) 2024-01-24 17:44:18 -07:00
Intelli f7fea2b298 Added more detailed entity death reasons (such as suffocation). 2024-01-04 20:57:35 -07:00
Intelli 15e8cd5b88 Fixed zombies killed by wither roses not being logged when skip-generic-data is enabled (fixes #309) 2024-01-04 20:56:21 -07:00
Intelli c91f460e42 Fixed ConcurrentModificationException while using queueLookup API method (fixes #481) 2024-01-04 20:23:05 -07:00
Intelli 7424037795 Fixed teleport shortcut not properly handling extremely large numbers 2024-01-04 20:09:38 -07:00
Intelli ba6a55fff6 Fixed NullPointerException when rolling back player heads (fixes #473) 2024-01-04 19:48:31 -07:00
Intelli 1c57ba52aa Fixed item frames logging incorrect item amounts (fixes #477) 2024-01-04 18:23:53 -07:00
Intelli 4308d4afca Updated documentation for blacklist.txt 2024-01-04 18:09:20 -07:00
Intelli 7c61a33571 Added ability to exclude specific block types in blacklist (implements #444) 2024-01-04 17:56:30 -07:00
Intelli 172c6440db Added container transaction logging for decorated pots 2024-01-04 17:44:46 -07:00
Intelli d8a669ed6c Fixed legacy short grass data rolling back as air in MC 1.20.3+ 2024-01-04 16:45:36 -07:00
Intelli 66b77ee75a Improved safety block handling during rollback teleports (#328) 2023-10-12 11:28:53 -06:00
Intelli 488392cdbc Added missing new method to WorldEditBlockState 2023-10-12 10:50:16 -06:00
Intelli b48dcec589 CoreProtect v22.2 release 2023-09-25 14:36:37 -06:00
Intelli e49913bc09 Fixed item names containing vertical bars displaying incorrectly (fixes #450) 2023-09-25 14:27:02 -06:00
Intelli d944c2bd89 Fixed SQLFeatureNotSupportedException when logging entity data (fixes #455) 2023-09-25 14:04:50 -06:00
Intelli f76b0d45bd Clear entityBlockMapper cache after 5 seconds 2023-09-22 15:51:38 -06:00
Intelli 9f3196dc97 Fixed rollbacks not checking world when teleporting players. (Fixes #453) 2023-09-18 15:46:33 -06:00
Intelli 69c163468f CoreProtect v22.1 release 2023-08-29 15:34:24 -06:00
Intelli 34421b64f7 Check that using CampfireStartEvent before comparing campfire types 2023-08-23 17:08:20 -06:00
Intelli 0edf160f43 Added hidden "enable-ssl" database option (default: false) 2023-08-23 16:31:40 -06:00
Intelli 45d4642086 Fixed tree growth still being logged when disabled via config 2023-08-23 16:21:37 -06:00
Take-John af35a98b1d Fix CoreProtect API hasPlaced() and hasRemoved() (#434) (#435) 2023-08-22 17:54:42 -06:00
Take-John 950cf9460b Add clause "implements Cancellable" (#431) 2023-08-22 17:52:41 -06:00
Intelli 1b6d2ec667 Fixed dropper transactions not being logged when using Paper 2023-08-08 16:57:51 -06:00
Intelli d7910262be Added support for displaying lore in item tooltips (#420) 2023-08-08 15:46:45 -06:00
Intelli 8459181f77 Fixed IndexOutOfBoundsException when modifying signs on Paper 1.17-1.19 2023-08-01 17:49:55 -06:00
Intelli 58f4a76d75 CoreProtect v22.0 release 2023-07-31 18:39:57 -06:00
Intelli a46deeb6ba Fixed typo in API documentation 2023-07-28 15:42:40 -06:00
Jeff P 7fd50a0507 Add method override for FAWE logging (#417) 2023-07-24 13:48:42 -06:00
Intelli 9e1d5af97d Fixed NullPointerException while logging container transactions 2023-07-19 17:12:00 -06:00
ianiiaannn 4cce566e37 Update Traditional Chinese translation (#392)
* Update Phrase to make strings correctly split by fullwidth colons (U+FF1A)

* Fix Traditional Chinese translation

* Replace U+FF1A with `: `
2023-07-19 14:35:25 -06:00
Intelli 703c36f356 Added automatic forward compatibility for extended logging of new wood types 2023-07-17 18:41:05 -06:00
Intelli 1dd293c5a4 Renamed "mysql-maximum-pool-size" to "maximum-pool-size" 2023-07-17 17:33:57 -06:00
1331b8d0c5 Added hidden "unknown-user" logging option (default: false) (#397)
* Allow unknown user logging (attempt to patch a bug of tnt splashing blocks and it not being logged)

* Changed "unknown-logging" to be hidden (default: false)

* Update BlockFormListener.java

---------

Co-authored-by: Radiant <i.like.using.discord@gmail.com>
Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2023-07-17 17:25:35 -06:00
violetcandIntelli 2476aa2ea8 Utilize internal cache in StructureGrowthProcess (#371)
* Use whoPlacedCache

* Still perform database lookup if cache is empty

---------

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2023-07-17 16:55:16 -06:00
Keno MedenbachandIntelli 6045799fea Make MySQL maximumPoolSize configurable (#411)
* Make MySQL maximumPoolSize configurable

* Correctly assign default value to mysql-maximum-pool-size

---------

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2023-07-17 16:47:52 -06:00
Intelli 342fadd0f6 Fixed invalid config values defaulting to zero rather than default value 2023-07-17 16:42:12 -06:00
Intelli e81c84671c Update CONTRIBUTING.md 2023-07-15 12:45:59 -06:00
Intelli e501046073 Fixed sign edits being logged even if no changes were made 2023-07-14 15:27:30 -06:00
Intelli c6a0f20fff Improved logic for logging brushing of suspicious blocks 2023-07-14 14:59:18 -06:00
Intelli 05aebe7544 Added logging for brushing suspicious blocks (implement #409) 2023-07-14 14:29:36 -06:00
Intelli 36ad62007f Added missing break keywords in BukkitAdapter 2023-07-13 19:44:04 -06:00
Intelli bdde2d36be Fixed signs using SpigotAdapter instead of BukkitAdapter 2023-07-13 19:41:51 -06:00
Intelli f32a3e7c5e Fixed Folia teleportation not using adapter 2023-07-13 19:27:53 -06:00
Intelli c7cf035564 Check that CampfireStartEvent exists before registering 2023-07-13 19:27:03 -06:00
Intelli d4997cca60 Added extended support for new cherry/bamboo blocks 2023-07-13 19:10:48 -06:00
Intelli 355eea1cf9 @kugge: Fixed Folia teleportation in unloaded chunks (#368) 2023-07-13 18:35:49 -06:00
Intelli d7b76135c8 Reduced MySQL connection lifetime from 5m to 1m (fix #362) 2023-07-13 18:07:15 -06:00
Intelli 1a06e6a6bf Made PreLogEvent cancellable (implements #325) 2023-07-13 17:55:00 -06:00
Intelli e7a6f21d88 Added inventory transaction logging for placing items on a campfire (#357) 2023-07-13 17:28:14 -06:00
Intelli 5973206bb3 Added interaction logging for chiseled bookshelves 2023-07-13 15:51:04 -06:00
Intelli 1e007c98a4 Cleanup 2023-07-13 14:43:09 -06:00
Intelli df9b478be7 Split up MySQL upgrade query to resolve issues from interrupted queries 2023-07-13 13:56:27 -06:00
Intelli 054beb700b Fixed ConcurrentModificationException in ProjectileLaunchEvent 2023-07-13 13:49:13 -06:00
Intelli 47a000a57f Added support for hanging signs 2023-07-13 13:06:47 -06:00
Intelli cde18dc529 Update formatting 2023-07-12 16:33:50 -06:00
asdanjer d200616fe1 Improved performance of ItemStack merging (fix #385) 2023-07-12 16:29:22 -06:00
Intelli e0d65453b6 Added logging for destruction of suspicious sand/gravel 2023-07-12 16:26:38 -06:00
Intelli d414db1c0b Added item mapping for torchflower seeds 2023-07-12 15:58:47 -06:00
Intelli b0469924a7 Build project against Folia 1.20.1 2023-07-12 15:19:47 -06:00
Intelli 4e43a42662 Added logging and rollback support for double sided signs 2023-07-12 15:17:14 -06:00
Intelli 7e97e12969 Added inventory transaction logging for chiseled bookshelves 2023-07-08 14:55:24 -06:00
Intelli d7d53bf9e2 Fixed NullPointerException while performing rollbacks 2023-07-08 13:57:36 -06:00
Intelli b9309482cf Fix config typo 2023-07-08 13:52:00 -06:00
Intelli 410eba5559 Fixed Folia detection 2023-06-19 18:59:58 -06:00
ByteExceptionMandIntelli 814ae4d9d5 Fixed NullPointerException when breaking/placing a spawner (#380)
* fix: Make Util#getEntityId parameter nullable

* Removed JetBrains Nullable

* Updated to follow contribution guidelines

---------

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2023-06-13 17:14:09 -06:00
Intelli d64ec8d911 Updated HikariCP dependency from 4.0.3 to 5.0.1 2023-05-21 15:42:28 -06:00
Intelli 5d90f25211 Fixed logging and lookup issues after performing "/co reload" (fix #366) 2023-05-05 16:47:56 -06:00
Intelli 7825f61e45 Fixed NullPointerException when processing transactions for dyed armor 2023-04-09 13:19:02 -06:00
Intelli 7e49c95832 Fixed InventoryClickEvent exception when using Magma 2023-04-08 17:38:31 -06:00
Intelli 4b9e69c40f Fixed tree/mushroom growth not respecting config file when using bonemeal (...)
Fixed mushroom growth logging invalid data when using bonemeal
2023-04-06 13:55:57 -06:00
Sofiane H. Djerbi f2934fd876 Fix Folia Teleportation (#349) 2023-04-03 18:15:16 -06:00
Intelli f706bcf38e Added repeating task support to Scheduler 2023-03-31 16:43:27 -06:00
Intelli fe6023450c Added missing methods to WorldEditBlockState 2023-03-29 19:11:48 -06:00
Intelli ace870b930 Fixed item frame & armor stand logging under Folia 2023-03-24 18:10:11 -06:00
Intelli 7170e29452 Added support for Folia 2023-03-23 19:45:44 -06:00
Intelli 29345e2fb1 Use HumanEntity instead of Player when logging item crafting (fix #336) 2023-03-13 13:32:22 -06:00
Amir a22db638fa Updated examples in commands.md (#323)
When I first looked at the documentation, I did not recognize that you can enter such values ​​in the <user> field. Thought I needed to clarify that this is possible.
2023-02-01 12:42:00 -07:00
Intelli de3c326203 Corrected Spanish translation 2023-01-12 12:51:42 -07:00
Intelli acb71a83a2 Fixed performLookup in API not returning valid block data (#308) 2023-01-03 12:17:09 -07:00
Intelli 3ffed30b1e Updated exclusions (Maven/Gradle) 2022-12-21 19:56:32 -07:00
Intelli 5d6fd60d40 Added tooltips to lookups that display item names and enchantments (#67) 2022-12-21 19:11:34 -07:00
Intelli 20710a00de Added legacy component serialization support for signs in Paper 1.17+ 2022-12-20 14:37:22 -07:00
Intelli 5eabee6504 Added logging for dragon egg teleportation (#303) 2022-12-19 16:05:02 -07:00
Intelli 97eb0d777b Fixed incorrect amounts when dispensing items in Paper 1.19.3+ 2022-12-19 14:57:46 -07:00
Intelli 61847f2f8d Changed minimum required version to Spigot 1.15 2022-12-15 16:45:24 -07:00
Intelli 12f2000085 Fixed sign lookups displaying incorrectly when containing hex colors 2022-12-15 16:06:41 -07:00
Intelli 66e32c02bf Added player interaction logging for jukeboxes 2022-12-15 15:36:19 -07:00
Intelli 9da1343f7f Add logging and rollback support for jukebox transactions 2022-12-15 15:25:53 -07:00
Intelli 272ecae858 Fixed networking API connections being reset when reloading config
Credit: https://github.com/PlayPro/CoreProtect/pull/211/files#diff-1342ad937bb4d40012db93a64c02a41e92f2d6f35b069435f464af03aca69b00 (@vacla)
2022-12-10 14:12:33 -07:00
Intelli 3db2159292 Updated versions listed in README 2022-12-09 18:51:04 -07:00
Intelli 78ef45d049 CoreProtect v21.3 release 2022-12-09 14:55:54 -07:00
Intelli 2f28183261 Fixed NoSuchMethodErrorr when stopping server using Paper 1.14 2022-12-08 17:55:30 -07:00
Intelli d82f92e06b Fixed tab completion not fully respecting player permissions (#226) 2022-12-08 17:35:03 -07:00
Intelli ce5c1c50bf Added logging for player inventory transactions with allays 2022-12-08 16:24:53 -07:00
Intelli 026b9ce322 Fixed IllegalStateException when modifying containers using FAWE 2022-12-08 13:56:14 -07:00
Intelli 3cedc69205 Added extended support for mangrove blocks 2022-12-07 19:52:54 -07:00
Intelli f4fe410141 Added logging and rollback support for tadpole age data 2022-12-07 19:14:44 -07:00
Intelli e3b82858b4 Updated config description regarding donation keys 2022-12-07 18:56:18 -07:00
Intelli 990f90bab9 Rename #sculk to #sculk_catalyst 2022-12-07 18:38:40 -07:00
Ryan HustonandIntelli 3b349c9d07 Add support for 1.19 specific features. (#239)
* Added support for 1.19 specific features.

* Removed leftover import from testing

* Added missing sculk materials for the catalyst and changed user field to #sculk

* Reverted version to v21.2

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2022-12-07 18:26:45 -07:00
Intelli 319d104622 Fixed NullPointerException when killing NPC (#261) 2022-12-07 17:49:50 -07:00
Intelli 9f8c2e8a2f Set Hikari maxLifetime to 5m, keepaliveTime to 1m (fixes #199) 2022-09-26 15:22:07 -06:00
Intelli fcd789ef5b Bump mkdocs from 1.2.3 to 1.3.1 2022-09-09 16:01:48 -06:00
dkim19375 b450f4d05a Make version comparisons by long - Support WorldEdit 7.2.11 Beta 1 (#240) (Fixes #245) 2022-06-27 20:15:23 -06:00
Intelli 606c043bf0 Fixed NullPointerException when processing hopper transactions 2022-04-19 20:07:56 -06:00
Intelli 4b056d9474 Added default Turkish language file 2022-04-19 20:00:53 -06:00
Intelli 1cca7bc573 Updated de.yml (fixes #203) 2022-04-13 19:41:18 -06:00
Intelli 204456d6c5 Fixed queueLookup API method returning data in wrong order 2022-03-25 16:50:05 -06:00
Intelli d34b60dc8f Improved database index handling 2022-03-24 19:16:57 -06:00
Intelli 070c5139e1 Fixed IllegalArgumentException when processing corrupt data 2022-03-24 17:11:58 -06:00
流光溢彩Last 1974838f74 Update v21.0 Simplified Chinese translation. (#182)
* Update v21.0 Simplified Chinese translation.

* 完善翻译
2022-03-23 19:08:47 -06:00
Intelli acdfb3515b Fixed NullPointerException on disable if plugin failed to load 2022-03-23 18:56:53 -06:00
vaclaandIntelli 8cdf99429d Added Networking API (#180)
* sent data to client

* send more data + debug + add docs + switch to handshake

* add diff between container and normal changes

* fix docs

* changes according guidelines

* make requested changes + cleanup

* correct documentation

* Improved Networking API documentation

* Moved networking API channel registration out of main class

* Cleanup

* Removed debug on chat/command lookups

* Optimized array merging

* Fixed ClassCastException when running console commands

* Skip preparing networking data if not a channel player

* Renamed "networking-debug" to "network-debug"

* Fixed failed handshake still registering players

* Adjusted networking phrases

* Renamed pluginchannel to channel

Co-authored-by: Intelli <contact@intelli.software>
2022-03-23 18:49:46 -06:00
Intelli e848d65b93 Added missing command/permissions to documentation 2022-03-22 17:24:54 -06:00
Intelli 85ebd53e5f Minor Spanish tweaks 2022-03-21 18:48:40 -06:00
KrazyxWolfandIntelli 209c63b009 Improved Spanish translation (#179)
* Not too literal spanish

* Fixes and adjustments

* Fix

* Minor fixes

Co-authored-by: Intelli <6790859+Intelli@users.noreply.github.com>
2022-03-21 18:21:08 -06:00
Intelli 8fd41ac231 CoreProtect v21.2 release 2022-03-21 16:45:42 -06:00
Intelli 703d52bcc7 Changed inventory lookups to always require a username 2022-03-21 16:42:30 -06:00
Intelli aea0c82fd7 Fixed typos in API documentation 2022-03-21 15:19:16 -06:00
Intelli 01ed2e9f97 Fixed NullPointerException when logging player projectile data 2022-03-21 15:12:58 -06:00
Intelli 5861570f8a Added post-rollback sorting for player inventories 2022-03-20 17:34:24 -06:00
Intelli 840eb3b4ee Added hidden "disable-wal" database option (default: false) 2022-03-20 16:37:20 -06:00
Intelli 92e030f3e8 Fixed WAL checkpointing not running on some systems 2022-03-20 16:29:51 -06:00
Intelli d97f5482ee Fixed rollbacks/restores not correctly updating all blocks (#175) 2022-03-20 16:03:54 -06:00
Intelli 2763952dc6 Fixed deprecated display width warnings for MySQL databases 2022-03-11 18:16:16 -07:00
Intelli 3011aece46 Fixed inventory rollbacks not modifying player equipment slots (#170) 2022-03-11 17:20:52 -07:00
Intelli dedba3c57f Added command example to blacklist documentation 2022-03-10 16:42:13 -07:00
240 changed files with 25213 additions and 7903 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
+4 -4
View File
@@ -10,13 +10,13 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v1
+6 -15
View File
@@ -53,21 +53,7 @@ nbproject
target
dependency-reduced-pom.xml
test/
# Wrapper files
mvnw
mvnw.cmd
#################
## Gradle
#################
build
gradle
# Wrapper files
gradlew
gradlew.bat
#################
## Visual Studio
@@ -195,4 +181,9 @@ Desktop.ini
hs_err_pid*
# Documentation dev folder
docs/dev/
docs/dev/
# Extensions
/src/main/java/net/coreprotect/extensions/*.java
!/src/main/java/net/coreprotect/extensions/Extensions.java
!/src/main/java/net/coreprotect/extensions/PlayerBountiesHeadCompatibility.java
+2 -2
View File
@@ -10,7 +10,7 @@ Please note we have a code of conduct, please follow it in all your interactions
- For consistency, please only use spaces for indentation.
- Use descriptiveCamelCase for variable/method names. Names containing underscore or abbreviations should be changed.
- Restrict changes in a commit to a single event or section of code (e.g. refactor BlockBreakEvent and BlockPlaceEvent in separate commits)
- Attempt to keep the amount of code modified in a single commit small and readable.
- Attempt to keep the amount of code modified in a single pull request small and readable.
- Please utilize [SonarLint](https://www.sonarlint.org) in your IDE. Contributions are automatically analyzed.
- When adding new functionality, please also be sure to update the documentation as well.
- Use common sense. If you have a suggestion for a contribution guideline, post it on Discord.
@@ -148,4 +148,4 @@ at [https://www.contributor-covenant.org/translations][translations].
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
[translations]: https://www.contributor-covenant.org/translations
+10 -27
View File
@@ -1,29 +1,20 @@
![CoreProtect](https://userfolio.com/uploads/coreprotect-banner-v19.png)
[![Artistic License 2.0](https://img.shields.io/github/license/PlayPro/CoreProtect?&logo=github)](LICENSE)
[![GitHub Workflows](https://github.com/PlayPro/CoreProtect/actions/workflows/build.yml/badge.svg)](https://github.com/PlayPro/CoreProtect/actions)
[![Netlify Status](https://img.shields.io/netlify/c1d26a0f-65c5-4e4b-95d7-e08af671ab67)](https://app.netlify.com/sites/coreprotect/deploys)
[![CodeFactor](https://www.codefactor.io/repository/github/playpro/coreprotect/badge)](https://www.codefactor.io/repository/github/playpro/coreprotect)
[![Join us on Discord](https://img.shields.io/discord/348680641560313868.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/b4DZ4jy)
CoreProtect
CoreProtect-OG
===========
CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
CoreProtect-OG is a soft fork of [CoreProtect](https://github.com/PlayPro/CoreProtect/) maintained for 1.19.4 by [TrueOG Network](https://true-og.net). CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
For a detailed description of the plugin, please visit [spigotmc.org/resources/coreprotect.8631](https://www.spigotmc.org/resources/coreprotect.8631/).
For a detailed description of the plugin, please visit [coreprotect.net](https://coreprotect.net).
| Quick Links | |
| --- | --- |
| CoreProtect Discord: | [discord.gg/b4DZ4jy](https://discord.gg/b4DZ4jy) |
| CoreProtect Patreon: | [patreon.com/coreprotect](https://www.patreon.com/coreprotect) |
| CoreProtect Documentation: | [docs.coreprotect.net](https://docs.coreprotect.net) |
| Downloads for MC 1.14 - 1.18: | [spigotmc.org/resources/coreprotect.8631](https://www.spigotmc.org/resources/coreprotect.8631/) |
| Downloads for MC 1.8 - 1.12: | [coreprotect.net/legacy](https://coreprotect.net/legacy/) |
bStats
------
[![bStats Graph Data](https://bstats.org/signatures/bukkit/CoreProtect.svg)](https://bstats.org/plugin/bukkit/CoreProtect)
# Changes from CoreProtect:
- Compatibility with [PlayerBounties-OG](https://git.trueog.net/trueog/PlayerBounties-OG) player heads in backups and restores.
- Replaced FAWE with standard WorldEdit.
- Removed 1.21 server code.
- Replaced deprecated function calls (<1.19.4).
- Builds with TrueOG Network live config files.
API
------
@@ -41,15 +32,7 @@ Maven
<dependency>
<groupId>net.coreprotect</groupId>
<artifactId>coreprotect</artifactId>
<version>21.0</version>
<version>22.4</version>
<scope>provided</scope>
</dependency>
```
Contributing
------
CoreProtect is an open source project, and gladly accepts community contributions.
If you'd like to contribute, please read our contributing guidelines here: [CONTRIBUTING.md](CONTRIBUTING.md)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CONTRIBUTING.md#code-of-conduct)
-88
View File
@@ -1,88 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.palantir.git-version' version '0.13.0'
}
group = 'net.coreprotect'
String projectVersion = '21.1'
String projectBranch = ''
version = projectVersion // `version` might be modified, we don't always want that (e.g. plugin.yml)
description = 'Provides block protection for your server.'
sourceCompatibility = '17'
if (System.getenv("BUILD_NUMBER") != null) {
// Being built in Jenkins, append Build ID
version += "-${System.getenv("BUILD_NUMBER")}"
} else if (!(version ==~ '^[^.]*\\.[^.]*\\.[^.]*$')) { // Thanks https://stackoverflow.com/a/9949200/1709894
// Append the Git hash if 'version' has less than two periods
version += "-${gitVersion()}"
}
logger.info("Building version $version")
repositories {
jcenter()
maven { url = 'https://hub.spigotmc.org/nexus/content/groups/public/' }
maven { url = 'https://papermc.io/repo/repository/maven-public/' }
maven { url = 'https://repo.codemc.org/repository/maven-public/' }
maven { url = 'https://maven.enginehub.org/repo/' }
}
dependencies {
compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT') {
exclude group: 'org.bukkit'
}
compileOnly 'io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT'
implementation 'org.bstats:bstats-bukkit-lite:1.8'
implementation 'com.zaxxer:HikariCP:4.0.3'
}
jar {
archiveClassifier.set("original")
}
artifacts {
archives shadowJar
}
shadowJar {
dependencies {
// #toString because #getGroup technically returns an Object
relocate('org.bstats', project.group.toString())
relocate('com.zaxxer', project.group.toString())
}
archiveClassifier.set(null)
}
ext {
author = 'Intelli'
resourceTokens = [
'project.version': projectVersion,
'project.branch': projectBranch,
]
}
processResources {
include 'plugin.yml'
// Whole lotta boilerplate to get the same functionality as Maven here.
// Replace this if Gradle ever lets us configure the filter before filtering.
filter(new Transformer<String, String>() {
@Override
String transform(String s) {
ReplaceTokens replaceTokens = new ReplaceTokens(new StringReader(s))
replaceTokens.setBeginToken('${')
replaceTokens.setEndToken('}')
resourceTokens.forEach { key, val ->
def token = new ReplaceTokens.Token()
token.setKey(key.toString())
token.setValue(val.toString())
replaceTokens.addConfiguredToken(token)
}
return replaceTokens.readLines().join('\n')
}
})
}
+123
View File
@@ -0,0 +1,123 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
/* ------------------------------ Plugins ------------------------------ */
plugins {
id("java") // Import Java plugin.
id("java-library") // Import Java Library plugin.
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
id("checkstyle") // Import Checkstyle plugin.
eclipse // Import Eclipse plugin.
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
}
/* --------------------------- JDK / Kotlin ---------------------------- */
java {
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
toolchain { // Select Java toolchain.
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
}
}
kotlin { jvmToolchain(17) }
/* ----------------------------- Metadata ------------------------------ */
group = "net.coreprotect"
val version = "22.5" // Declare plugin version (will be in .jar).
val apiVersion = "1.19" // Declare minecraft server target version.
description = "Provides block protection for your server."
logger.info("Building version $version")
/* ----------------------------- Resources ----------------------------- */
tasks.named<ProcessResources>("processResources") {
val props = mapOf("version" to version, "apiVersion" to apiVersion)
inputs.properties(props) // Indicates to rerun if version changes.
filesMatching("plugin.yml") { expand(props) }
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
}
/* ---------------------------- Repos ---------------------------------- */
repositories {
mavenCentral() // Import the Maven Central Maven Repository.
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
maven("https://repo.papermc.io/repository/maven-public") // Import the PaperMC Maven Repository.
maven("https://repo.codemc.org/repository/maven-public") // Import the CodeMC Maven Repository.
maven("https://maven.enginehub.org/repo") // Import the EngineHub Maven Repository.
}
/* ---------------------- Java project deps ---------------------------- */
dependencies {
compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT")
implementation(platform("com.intellectualsites.bom:bom-newest:1.45"))
implementation("com.zaxxer:HikariCP:5.0.1")
implementation("com.github.oshi:oshi-core:6.6.5")
}
/* ---------------------- Reproducible jars ---------------------------- */
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
/* ----------------------------- Shadow -------------------------------- */
artifacts { add("archives", tasks.named("shadowJar")) }
tasks.named<ShadowJar>("shadowJar") {
dependencies {
relocate("com.zaxxer", project.group.toString())
exclude(dependency("com.google.code.gson:.*"))
exclude(dependency("org.intellij:.*"))
exclude(dependency("org.jetbrains:.*"))
exclude(dependency("org.slf4j:.*"))
}
exclude("io.github.miniplaceholders.*") // Exclude the MiniPlaceholders package from being shadowed.
archiveClassifier.set("") // Use empty string instead of null.
minimize()
}
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
/* --------------------------- Javac opts ------------------------------- */
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-parameters") // Enable reflection for java code.
options.isFork = true // Run javac in its own process.
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
options.encoding = "UTF-8" // Use UTF-8 file encoding.
}
/* ----------------------------- Auto Formatting ------------------------ */
spotless {
java {
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
removeUnusedImports() // Remove imports that aren't being called.
}
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
}
}
checkstyle {
toolVersion = "10.18.1" // Declare checkstyle version to use.
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
}
tasks.named("compileJava") {
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
}
tasks.named("spotlessCheck") {
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
}
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
<property name="severity" value="error"/>
</module>
<module name="TreeWalker">
<module name="FinalLocalVariable"/>
<module name="AvoidStarImport"/>
<module name="Indentation">
<property name="severity" value="ignore"/>
</module>
</module>
<module name="RegexpSingleline">
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="ignoreCase" value="true"/>
<property name="severity" value="warning"/>
</module>
<module name="RegexpSingleline">
<property name="format" value="(?&lt;!\w)fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="severity" value="warning"/>
</module>
</module>
+404
View File
@@ -0,0 +1,404 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="23">
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
</profile>
</profiles>
+3 -3
View File
@@ -4,8 +4,8 @@ The CoreProtect API enables you to log your own block changes, perform lookups,
| API Details | |
| --- | --- |
| **API Version:** | 9 |
| **Plugin Version:** | v21.0+ |
| **API Version:** | 10 |
| **Plugin Version:** | v22.4+ |
| **Maven:** | [maven.playpro.com](https://maven.playpro.com) |
*Documentation for the API version 9 can be found [here](/api/version/v9/).*
*Documentation for the API version 10 can be found [here](/api/version/v10/).*
+99
View File
@@ -0,0 +1,99 @@
# Networking API
The CoreProtect Networking API allows clients to receive data using packets.
| Networking Details | |
|-------------------------|--------|
| **Networking Version:** | 1 |
| **Plugin Version:** | v21.3+ |
---
## Packets
The server will not respond unless the player has the correct permission, which is `coreprotect.networking`.
---
## Server to Client
### Data Packet
Sends data from the database.
* Channel: `coreprotect:data`
| Type: `Int` | 1 | 2 | 3 | 4 |
|-------------|------------------------|------------------------|--------------------|--------------------|
| | Time: `long` | Time: `long` | Time: `long` | Time: `long` |
| | Phrase selector: `UTF` | Phrase selector: `UTF` | Result User: `UTF` | Result User: `UTF` |
| | Result User: `UTF` | Result User: `UTF` | Message: `UTF` | Target: `UTF` |
| | Target: `UTF` | Amount: `Int` | Sign: `Boolean` | |
| | Amount: `Int` | X: `Int` | X: `Int` | |
| | X: `Int` | Y: `Int` | Y: `Int` | |
| | Y: `Int` | Z: `Int` | Z: `Int` | |
| | Z: `Int` | World name: `UTF` | World name: `UTF` | |
| | World name: `UTF` | | | |
| | Rolledback: `Boolean` | | | |
| | isContainer: `Boolean` | | | |
| | Added: `Boolean` | | | |
Example (Fabric):
```
ByteArrayInputStream in = new ByteArrayInputStream(buf.getWrittenBytes());
DataInputStream dis = new DataInputStream(in);
int type = dis.readInt();
long time = dis.readLong();
String selector = dis.readUTF();
String resultUser = dis.readUTF();
String target = dis.readUTF();
int amount = dis.readInt();
int x = dis.readInt();
int y = dis.readInt();
int z = dis.readInt();
String worldName = dis.readUTF();
boolean rolledback = dis.readBoolean();
boolean isContainer = dis.readBoolean();
boolean added = dis.readBoolean();
```
### Handshake Packet
Sends handshake if player is registered.
* Channel: `coreprotect:handshake`
* Registered: `Boolean`
---
## Client to Server
### Handshake Packet
Sends handshake to register
* Channel: `coreprotect:handshake`
* Mod Version: `UTF`
* Mod Id: `UTF`
* CoreProtect Protocol: `Int`
Example (Fabric):
```
PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer());
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
DataOutputStream msgOut = new DataOutputStream(msgBytes);
msgOut.writeUTF(modVersion);
msgOut.writeUTF(modId);
msgOut.writeInt(coreprotectProtocol);
packetByteBuf.writeBytes(msgBytes.toByteArray());
```
---
## Debugging
### /co network-debug
Allows you to debug the networking API if you are registered and have correct permissions.
To utilize the command, `network-debug: true` must be set in the CoreProtect `config.yml`.
**Example**
`/co network-debug <type>`
___
+526
View File
@@ -0,0 +1,526 @@
# API Version 10
The CoreProtect API enables you to log your own block changes, perform lookups, rollbacks, restores, and more.
| API Details | |
| --- | --- |
| **API Version:** | 10 |
| **Plugin Version:** | v22.4+ |
| **Maven:** | [maven.playpro.com](https://maven.playpro.com) |
---
## Upgrading from API v9
The changes from the previous API version are as follows:
- The following methods have been added:
```java
logPlacement(String user, BlockState blockState)
logRemoval(String user, BlockState blockState)
```
---
## Getting Started
Ensure you're using CoreProtect 22.4 or higher. Add it as an external jar to your plugin in your IDE.
Alternatively, if using Maven, you can add it via the repository [https://maven.playpro.com](https://maven.playpro.com) (net.coreprotect, 22.4).
The first thing you need to do is get access to CoreProtect. You can do this by using code similar to the following:
```java
import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI;
private CoreProtectAPI getCoreProtect() {
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
// Check that CoreProtect is loaded
if (plugin == null || !(plugin instanceof CoreProtect)) {
return null;
}
// Check that the API is enabled
CoreProtectAPI CoreProtect = ((CoreProtect) plugin).getAPI();
if (CoreProtect.isEnabled() == false) {
return null;
}
// Check that a compatible version of the API is loaded
if (CoreProtect.APIVersion() < 10) {
return null;
}
return CoreProtect;
}
```
With this code, you can then access the API with a call like the following:
```java
CoreProtectAPI api = getCoreProtect();
if (api != null){ // Ensure we have access to the API
api.testAPI(); // Will print out "[CoreProtect] API test successful." in the console.
}
```
Yay, you're now using the CoreProtect API!
---
## API Overview
### Available Methods
```java
boolean isEnabled()
void testAPI()
List<String[]> performLookup(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)
List<String[]> performRollback(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)
List<String[]> performRestore(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)
List<String[]> blockLookup(Block block, int time)
List<String[]> sessionLookup(String user, int time)
List<String[]> queueLookup(Block block)
ParseResult parseResult(String[] result)
boolean logChat(Player player, String message)
boolean logCommand(Player player, String command)
boolean logPlacement(String user, BlockState blockState)
boolean logPlacement(String user, Location location, Material type, BlockData blockData)
boolean logRemoval(String user, BlockState blockState)
boolean logRemoval(String user, Location location, Material type, BlockData blockData)
boolean logContainerTransaction(String user, Location location)
boolean logInteraction(String user, Location location)
boolean hasPlaced(String user, Block block, int time, int offset)
boolean hasRemoved(String user, Block block, int time, int offset)
void performPurge(int time)
```
---
### Available Events
*The following events are emitted by CoreProtect.*
#### CoreProtectPreLogEvent
Fired when a CoreProtect logger is about to log an action. Cancellable.
| Property | Description | Mutable |
| --- | --- | --- |
| User | The name of the user under which this action will be logged. | Yes |
| Cancelled | If cancelled, the action won't be logged to the database. | Yes |
---
### Method Usage
*Detailed method information is listed below.*
#### `isEnabled()`
Calling this will return true if the server has the CoreProtect API enabled, and false if it does not.
---
#### `testAPI()`
Running this will print out "[CoreProtect] API Test Successful." in the server console.
---
#### `performLookup(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)`
This will perform a lookup.
* **time:** Specify the amount of time to search back. "5" would return results from the last 5 seconds.
* **restrict_users:** Specify any usernames to perform the lookup on. Can be set to "null" if both a radius and a location are specified.
* **exclude_users:** Specify any usernames to exclude from the lookup. Can be set to "null".
* **restrict_blocks:** Specify a list of EntityType's or Material's to restrict the search to. Can be set to "null".
* **exclude_blocks:** Specify a list of EntityType's or Material's to exclude from the search. Can be set to "null".
* **action_list:** Specify a list of action types to restrict the search to. Can be set to "null"
* **radius:** Specify a radius to restrict the search to. A location must be specified if using this. Set to "0" to disable.
* **radius_location:** Specify a location to search around. Can be set to "null" if no radius is specified, and a user is specified.
---
#### `performRollback(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)`
This will perform a rollback. Method must be called async.
* **time:** Specify the amount of time to rollback. "5" would return results from the last 5 seconds.
* **restrict_users:** Specify any usernames to perform the rollback on. Can be set to "null" if both a radius and a location are specified.
* **exclude_users:** Specify any usernames to exclude from the rollback. Can be set to "null".
* **restrict_blocks:** Specify a list of EntityType's or Material's to restrict the rollback to. Can be set to "null".
* **exclude_blocks:** Specify a list of EntityType's or Material's to exclude from the rollback. Can be set to "null".
* **action_list:** Specify a list of action types to restrict the rollback to. Can be set to "null"
* **radius:** Specify a radius to restrict the rollback to. A location must be specified if using this. Set to "0" to disable.
* **radius_location:** Specify a location to rollback around. Can be set to "null" if no radius is specified, and a user is specified.
---
#### `performRestore(int time, List<String> restrict_users, List<String> exclude_users, List<Object> restrict_blocks, List<Object> exclude_blocks, List<Integer> action_list, int radius, Location radius_location)`
This will perform a restore.
* **time:** Specify the amount of time to restore. "5" would return results from the last 5 seconds.
* **restrict_users:** Specify any usernames to perform the restore on. Can be set to "null" if both a radius and a location are specified.
* **exclude_users:** Specify any usernames to exclude from the restore. Can be set to "null".
* **restrict_blocks:** Specify a list of EntityType's or Material's to restrict the restore to. Can be set to "null".
* **exclude_blocks:** Specify a list of EntityType's or Material's to exclude from the restore. Can be set to "null".
* **action_list:** Specify a list of action types to restrict the restore to. Can be set to "null"
* **radius:** Specify a radius to restrict the restore to. A location must be specified if using this. Set to "0" to disable.
* **radius_location:** Specify a location to restore around. Can be set to "null" if no radius is specified, and a user is specified.
---
#### `blockLookup(Block block, int time)`
This will perform a full lookup on a single block.
* **block:** The block to perform the lookup on.
* **time:** Specify the amount of time to lookup. "5" would return results from the last 5 seconds.
---
#### `queueLookup(Block block)`
This will search the consumer queue for changes on a block not yet saved in the database.
* **block:** The block to perform the lookup on.
---
#### `sessionLookup(String user, int time)`
This will perform a session lookup on a single player.
* **user:** The username to perform the lookup on.
* **time:** Specify the amount of time to lookup. "5" would return results from the last 5 seconds.
---
#### `ParseResult parseResult(String[] result)`
This will parse results from a lookup. You'll then be able to view the following:
* **getX():** Get the X coordinate of the block.
* **getY():** Get the Y coordinate of the block.
* **getZ():** Get the Z coordinate of the block.
* **getType():** Get the Material of the block.
* **getBlockData():** Get the BlockData of the block.
* **getPlayer():** Get the username as a string.
* **getTimestamp():** Get the time of the action.
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
* **isRolledBack():** If the block is currently rolled back or not.
* **worldName():** The name of the world the block is located in.
---
#### `logPlacement(String user, BlockState blockState)`
This will log a block as being placed. *(Thread safe)*
* **user:** Specify the username to log as having placed the block.
* **blockState:** Specify the BlockState of the block you're logging.
---
#### `logPlacement(String user, Location location, Material type, BlockData blockData)`
This will log a block as being placed.
* **user:** Specify the username to log as having placed the block.
* **location:** Specify the location of the block you're logging.
* **type:** Specify the Material of the block you're logging.
* **blockData:** Specify the BlockData of the block you're logging. Can be set to "null".
---
#### `logRemoval(String user, BlockState blockState)`
This will log a block as being removed/broken. *(Thread safe)*
* **user:** Specify the username to log as having removed the block.
* **blockState:** Specify the BlockState of the block you're logging.
---
#### `logRemoval(String user, Location location, Material type, BlockData blockData)`
This will log a block as being removed/broken, and will log the block's inventory (if applicable).
* **user:** Specify the username to log as having removed the block.
* **location:** Specify the location of the block you're logging.
* **type:** Specify the Material of the block you're logging.
* **blockData:** Specify the BlockData of the block you're logging. Can be set to "null".
---
#### `logContainerTransaction(String user, Location location)`
This will log any transactions made to a block's inventory immediately after calling the method.
* **user:** Specify the username to log as having added/removed the items.
* **location:** Specify the location of the block inventory you're logging.
---
#### `logInteraction(String user, Location location)`
This will log a block as having been interacted with.
* **user:** Specify the username to log as having caused the interaction.
* **location:** Specify the location of the interaction you're logging.
---
#### `hasPlaced(String user, Block block, int time, int offset)`
This will return true if a user has already placed a block at the location within the specified time limit.
* **user:** The username you're checking to see if they've placed a block already.
* **block:** The block you're checking.
* **time:** How far back to check. "5" would only check through the last 5 seconds of logged blocks.
* **offset:** A time offset. "2" would ignore the last 2 seconds of most recently ignored data. (0 = no offset)
---
#### `hasRemoved(String user, Block block, int time, int offset)`
This will return true if a user has already removed a block at the location within the specified time limit.
* **user:** The username you're checking to see if they've removed a block already.
* **block:** The block you're checking.
* **time:** How far back to check. "5" would only check through the last 5 seconds of logged blocks.
* **offset:** A time offset. "2" would ignore the last 2 seconds of most recently ignored data. (0 = no offset)
---
#### `performPurge(int time)`
This will perform a purge on the CoreProtect database.
* **time:** Purge any data earlier than this. "120" would purge any data older than 120 seconds (2 minutes).
---
### Examples
- Get the last 60 seconds of block data for the user "Notch".
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.performLookup(60, Arrays.asList("Notch"), null, null, null, null, 0, null);
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
// ...
}
}
}
```
---
- Get the last 60 seconds of block data for the user "Notch", excluding dirt and grass blocks.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<Object> exclude = Arrays.asList(Material.DIRT, Material.GRASS);
List<String[]> lookup = CoreProtect.performLookup(60, Arrays.asList("Notch"), null, null, exclude, null, 0, null);
if (lookup != null){
for (String[] value : lookup){
ParseResult result = CoreProtect.parseResult(value);
int x = result.getX();
int y = result.getY();
int z = result.getZ();
// ...
}
}
}
```
---
- Get the last 60 seconds of block data within 5 blocks of a location.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.performLookup(60, null, null, null, null, null, 5, location);
if (lookup != null){
for (String[] value : lookup){
ParseResult result = CoreProtect.parseResult(value);
int x = result.getX();
int y = result.getY();
int z = result.getZ();
// ...
}
}
}
```
---
- Rollbacks / restores use the same code structure as the above examples. For example:
```java
class BasicThread implements Runnable {
@Override
public void run() {
try {
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.performRollback(60, Arrays.asList("Notch"), null, null, null, null, 0, null);
if (lookup != null){
for (String[] value : lookup){
ParseResult result = CoreProtect.parseResult(value);
int x = result.getX();
int y = result.getY();
int z = result.getZ();
// ...
}
}
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
```
---
- Check if the user "Notch" has already placed a block at a location within the last 60 seconds.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean hasPlaced = CoreProtect.hasPlaced("Notch", block, 60, 0);
// Search queue for pending changes
if (!hasPlaced){
List<String[]> lookup = CoreProtect.queueLookup(block);
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
if (parseResult.getActionId()==1 && parseResult.getPlayer().equals("Notch")){
hasPlaced = true;
break;
}
}
}
}
```
---
- Get the last 60 seconds of block data for a specific block.
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
// ...
}
}
}
```
---
- Get the last 1 day of session data for the user "Notch".
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.sessionLookup("Notch", (24 * 60 * 60));
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
int action = parseResult.getActionId(); // 0 = logout, 1 = login
// ...
}
}
}
```
---
- Log the placement of a block at a location by the user "Notch".
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean success = CoreProtect.logPlacement("Notch", block.getLocation(), block.getType(), block.getData());
}
```
---
- Log adding/remove items in a chest (or some other block inventory).
```java
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean success = CoreProtect.logContainerTransaction("Notch", inventory.getLocation());
// modify your container contents immediately after (e.g. [i]inventory.addItem(itemStack);[/i])
}
```
---
- Perform a multi-threaded placement check to see if the user "Notch" has already placed a block at a location within the last 60 seconds. This ignores the most recent 1 second of logged data, to account for the fact that that new block data may have already been logged, depending on your code.
```java
final Block block = null; //Should be an actual block
class BasicThread implements Runnable {
@Override
public void run() {
try {
CoreProtectAPI CoreProtect = getCoreProtect();
if (CoreProtect != null){ // Ensure we have access to the API
boolean hasPlaced = CoreProtect.hasPlaced("Notch", block, 60, 1);
}
}
catch (Exception e){
e.printStackTrace();
}
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
```
---
+7 -7
View File
@@ -203,7 +203,7 @@ This will parse results from a lookup. You'll then be able to view the following
* **getZ():** Get the Z coordinate of the block.
* **getType():** Get the Material of the block.
* **getBlockData():** Get the BlockData of the block.
* **getPlayer():** Get the username as a string..
* **getPlayer():** Get the username as a string.
* **getTimestamp():** Get the time of the action.
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
@@ -296,7 +296,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
//...
// ...
}
}
}
@@ -316,7 +316,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -335,7 +335,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -358,7 +358,7 @@ public void run() {
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -392,11 +392,11 @@ if (CoreProtect!=null){ //Ensure we have access to the API
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
if (lookup!=null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(value);
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
//...
// ...
}
}
}
+7 -7
View File
@@ -203,7 +203,7 @@ This will parse results from a lookup. You'll then be able to view the following
* **getZ():** Get the Z coordinate of the block.
* **getType():** Get the Material of the block.
* **getBlockData():** Get the BlockData of the block.
* **getPlayer():** Get the username as a string..
* **getPlayer():** Get the username as a string.
* **getTimestamp():** Get the time of the action.
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
@@ -296,7 +296,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
//...
// ...
}
}
}
@@ -316,7 +316,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -335,7 +335,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -358,7 +358,7 @@ public void run() {
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -392,11 +392,11 @@ if (CoreProtect!=null){ //Ensure we have access to the API
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
if (lookup!=null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(value);
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
//...
// ...
}
}
}
+14 -11
View File
@@ -89,6 +89,8 @@ List<String[]> blockLookup(Block block, int time)
List<String[]> sessionLookup(String user, int time)
List<String[]> queueLookup(Block block)
ParseResult parseResult(String[] result)
boolean logChat(Player player, String message)
@@ -118,11 +120,12 @@ void performPurge(int time)
#### CoreProtectPreLogEvent
Fired when a CoreProtect logger is about to log an action. Not cancellable.
Fired when a CoreProtect logger is about to log an action. Cancellable.
| Property | Description | Mutable |
| --- | --- | --- |
| User | The name of the user under which this action will be logged. | Yes |
| Cancelled | If cancelled, the action won't be logged to the database. | Yes |
---
@@ -222,7 +225,7 @@ This will parse results from a lookup. You'll then be able to view the following
* **getZ():** Get the Z coordinate of the block.
* **getType():** Get the Material of the block.
* **getBlockData():** Get the BlockData of the block.
* **getPlayer():** Get the username as a string..
* **getPlayer():** Get the username as a string.
* **getTimestamp():** Get the time of the action.
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
@@ -315,7 +318,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
//...
// ...
}
}
}
@@ -335,7 +338,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -354,7 +357,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -377,7 +380,7 @@ public void run() {
int x = result.getX();
int y = result.getY();
int z = result.getZ();
//...
// ...
}
}
}
@@ -404,7 +407,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
if (!hasPlaced){
List<String[]> lookup = CoreProtect.queueLookup(block);
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(value);
ParseResult parseResult = CoreProtect.parseResult(result);
if (parseResult.getActionId()==1 && parseResult.getPlayer().equals("Notch")){
hasPlaced = true;
break;
@@ -423,11 +426,11 @@ if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(value);
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
//...
// ...
}
}
}
@@ -442,12 +445,12 @@ if (CoreProtect != null){ // Ensure we have access to the API
List<String[]> lookup = CoreProtect.sessionLookup("Notch", (24 * 60 * 60));
if (lookup != null){
for (String[] result : lookup){
ParseResult parseResult = CoreProtect.parseResult(value);
ParseResult parseResult = CoreProtect.parseResult(result);
int x = parseResult.getX();
int y = parseResult.getY();
int z = parseResult.getZ();
int action = parseResult.getActionId(); // 0 = logout, 1 = login
//...
// ...
}
}
}
+14 -4
View File
@@ -15,6 +15,7 @@ ___
| [/co purge](#co-purge) | Delete old block data |
| [/co reload](#co-reload) | Reload the configuration file |
| [/co status](#co-status) | View the plugin status |
| [/co consumer](#co-consumer) | Toggle consumer processing |
### Alias Commands
@@ -92,7 +93,7 @@ Purge old block data. Useful for freeing up space on your HDD if you don't need
| Command | Parameters |
| --- | --- |
| /co purge | `t:<time> r:<world>` |
| /co purge | `t:<time> r:<world> i:<include>` |
For example, `/co purge t:30d` will delete all data older than one month, and only keep the last 30 days of data.
@@ -100,8 +101,12 @@ For example, `/co purge t:30d` will delete all data older than one month, and on
> If used from the console, only data older than 24 hours can be purged.
**Purging Worlds**
You can also optionally specify a world in CoreProtect v19+.
For example, `/co purge t:30d r:#world_nether` will delete all data older than one month in the Nether, without deleting data in any other worlds.
You can optionally specify a world in CoreProtect v19+.
For example, `/co purge t:30d r:#world_nether` will delete all data older than one month in the Nether, without removing data in any other worlds.
**Purging Blocks**
You can optionally specify block types in CoreProtect v23+.
For example, `/co purge t:30d i:stone,dirt` will delete all stone and dirt data older than one month, without removing other block data.
**MySQL Optimization**
In CoreProtect v2.15+, adding "#optimize" to the end of the command (e.g. `/co purge t:30d #optimize`) will also optimize your tables and reclaim disk space.
@@ -119,6 +124,10 @@ ___
Displays the plugin status and version information.
___
### /co consumer
Console command to pause or resume consumer queue processing.
___
## Parameter Details
@@ -128,6 +137,7 @@ ___
* Example: `u:Notch`
* Example: `u:Notch,Intelli`
* Example: `u:#fire,#tnt,#creeper,#explosion`
---
@@ -271,4 +281,4 @@ Lookup commands are generally the same as rollback commands. The primary differe
* `/co lookup u:Notch a:username`
*(lookup previous usernames used by Notch)*
___
___
+7 -3
View File
@@ -18,14 +18,18 @@ Secondary configuration files override the value specified in config.yml. If you
## Disabling Logging
To disable logging for specific users or commands, simply do the following:
To disable logging for specific users, blocks or commands, simply do the following:
1. In the CoreProtect plugin directory, create a file named `blacklist.txt`.
2. Enter the names of the users (or commands) you'd like to disable logging for (each username on a new line).
3. Either restart your server, or type "/co reload" in-game.
This can be used to disable logging for non-player users, such as "#tnt". For example, if you'd like to disable logging for the user "Notch" and for TNT explosions, the blacklist.txt file would look like this:
This can be used to disable logging for non-player users, such as "#creeper". For example, if you'd like to disable logging for the user "Notch", TNT explosions, stone blocks, and the "/help" command, the blacklist.txt file would look like this:
```text
Notch
#tnt
```
/help
minecraft:stone
```
*Please note that to disable logging for blocks, CoreProtect v23+ is required, and you must include the namespace. For example, to disable logging for dirt, you must add it as "minecraft:dirt".*
+6 -3
View File
@@ -12,6 +12,9 @@ A list of all commands that can be used within CoreProtect.
[**CoreProtect Permissions**](/permissions/)
A list of all permissions that can be used with CoreProtect.
[**CoreProtect Language Codes**](/languages/)
A list of all language codes that can be used with CoreProtect.
[**CoreProtect API Documentation**](/api/)
Log your own block changes, perform lookups, rollbacks, restores, and more.
@@ -19,7 +22,7 @@ Log your own block changes, perform lookups, rollbacks, restores, and more.
A list of plugins and tools that are compatible with CoreProtect.
[**Per-World Configuration Files**](/config/#per-world-configuration)
Log your own block changes, perform lookups, rollbacks, restores, and more.
Modify the logging settings for a specific world on your server.
[**Disable Logging for Specific Users or Commands**](/config/#disabling-logging)
Log your own block changes, perform lookups, rollbacks, restores, and more.
[**Disable Logging With a Blacklist**](/config/#disabling-logging)
Disable logging for specific users, blocks or commands.
+9
View File
@@ -35,6 +35,12 @@ The following permissions can be used to restrict functionality within the plugi
&nbsp;
* **coreprotect.status** *(default: op)*
Allows access to the CoreProtect status command.
&nbsp;
* **coreprotect.consumer** *(default: op)*
Allows access to the CoreProtect consumer command.
&nbsp;
* **coreprotect.networking** *(default: op)*
Allows access to the CoreProtect networking API.
---
@@ -58,6 +64,9 @@ The following permissions can be used to restrict functionality within the plugi
* **coreprotect.lookup.inventory** *(default: op)*
Can be optionally used as a negative permission to prevent inventory lookups.
&nbsp;
* **coreprotect.lookup.item** *(default: op)*
Can be optionally used as a negative permission to prevent item lookups.
&nbsp;
* **coreprotect.lookup.kill** *(default: op)*
Can be optionally used as a negative permission to prevent entity kill lookups.
&nbsp;
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+251
View File
@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/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/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# 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\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
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.
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=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# 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, 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" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+94
View File
@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@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 ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
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
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
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
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+38 -38
View File
@@ -1,14 +1,14 @@
# CoreProtect Language File (de)
ACTION_NOT_SUPPORTED: "Diese Aktion wird nicht unterstützt."
AMOUNT_BLOCK: "{0} {block|blöcke}"
AMOUNT_CHUNK: "{0} {Brocken|Brocken}"
AMOUNT_BLOCK: "{0} {Block|Blöcke}"
AMOUNT_CHUNK: "{0} {Chunk|Chunks}"
AMOUNT_ENTITY: "{0} {Entität|Entitäten}"
AMOUNT_ITEM: "{0} {Artikel|Artikel}"
AMOUNT_ITEM: "{0} {Item|Items}"
API_TEST: "API-Test erfolgreich."
CACHE_ERROR: "WARNUNG: Fehler beim Validieren {0} Zwischenspeicher."
CACHE_RELOAD: "Erzwingen des Nachladens von {kartierung|welt} Caches aus der Datenbank."
CHECK_CONFIG: "Bitte überprüfen Sie config.yml"
CHECK_CONFIG: "Bitte überprüfe die config.yml"
COMMAND_CONSOLE: "Bitte führen Sie den Befehl von der Konsole aus."
COMMAND_NOT_FOUND: "Befehl \"{0}\" nicht gefunden."
COMMAND_THROTTLED: "Bitte warten Sie einen Moment und versuchen Sie es erneut."
@@ -18,7 +18,7 @@ CONTAINER_HEADER: "Containertransaktionen"
DATABASE_BUSY: "Datenbank beschäftigt. Bitte versuchen Sie es später erneut."
DATABASE_INDEX_ERROR: "Datenbankindizes können nicht validiert werden."
DATABASE_LOCKED_1: "Datenbank gesperrt. Warte bis zu 15 Sekunden..."
DATABASE_LOCKED_2: "Datenbank wird bereits verwendet. Bitte versuche es erneut."
DATABASE_LOCKED_2: "Datenbank wird bereits verwendet. Bitte versuche es später erneut."
DATABASE_LOCKED_3: "Um die Datenbanksperre zu deaktivieren, setzen Sie \"database-lock: false\"."
DATABASE_LOCKED_4: "Das Deaktivieren der Datenbanksperre kann zu Datenbeschädigungen führen."
DATABASE_UNREACHABLE: "Datenbank ist nicht erreichbar. Daten verwerfen und herunterfahren."
@@ -27,12 +27,12 @@ DIRT_BLOCK: "Platziere einen Schmutzblock unter dir."
DISABLE_SUCCESS: "Erfolg! Deaktiviert {0}"
ENABLE_FAILED: "{0} war nicht in der Lage zu starten."
ENABLE_SUCCESS: "{0} ist jetzt aktiviert!"
ENJOY_COREPROTECT: "Genießen {0}? Tritt unser... bei Discord!"
FINISHING_CONVERSION: "Abschluss der Datenkonvertierung. Warten Sie mal..."
FINISHING_LOGGING: "Abschluss der Datenprotokollierung. Warten Sie mal..."
ENJOY_COREPROTECT: "Dir gefällt {0}? Tritt unserem Discord bei!"
FINISHING_CONVERSION: "Abschluss der Datenkonvertierung. Bitte warten..."
FINISHING_LOGGING: "Abschluss der Datenprotokollierung. Bitte warten..."
FIRST_VERSION: "Anfangs-DB: {0}"
GLOBAL_LOOKUP: "Geben Sie keinen Radius an, um eine globale Suche durchzuführen."
GLOBAL_ROLLBACK: "Benutzen \"{0}\" um eine globale {Rollback|Wiederherstellung}"
GLOBAL_ROLLBACK: "Benutze \"{0}\" um einen globalen {Rollback|Restore}"
HELP_ACTION_1: "Beschränken Sie die Suche auf eine Aktion."
HELP_ACTION_2: "Beispiele: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "Zusätzliche Informationen anzeigen."
@@ -41,13 +41,13 @@ HELP_EXCLUDE_2: "Beispiele: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} Hilfe"
HELP_INCLUDE_1: "Fügen Sie Blöcke/Entitäten ein."
HELP_INCLUDE_2: "Beispiele: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "Wenn der Inspektor aktiviert ist, können Sie:"
HELP_INSPECT_2: "Klicken Sie mit der linken Maustaste, um die Platzierung anzuzeigen."
HELP_INSPECT_3: "Klicken Sie mit der rechten Maustaste, um benachbarte Entfernungen anzuzeigen."
HELP_INSPECT_4: "Platzieren Sie einen Block, um die Entfernung zu sehen."
HELP_INSPECT_5: "Legen Sie einen Block in Flüssigkeit, um die Platzierung zu sehen."
HELP_INSPECT_6: "Klicken Sie mit der rechten Maustaste, um Truhentransaktionen anzuzeigen."
HELP_INSPECT_7: "Tipp: Sie können einfach \"/co i\" verwenden."
HELP_INSPECT_1: "Mit dem Inspector kannst du Folgendes tun:"
HELP_INSPECT_2: "Linksklicke einen Block, um zu sehen, wer ihn platziert hat"
HELP_INSPECT_3: "Rechtsklick auf einen Block zeigt Änderungen an Nachbarn an"
HELP_INSPECT_4: "Platziere einen Block, um Änderungen an seinem Ort zu sehen"
HELP_INSPECT_5: "So kann man auch Änderungen an Flüssigkeiten etc. sehen"
HELP_INSPECT_6: "Rechtsklicke Türen, Truhen, etc., um Zugriffe zu sehen"
HELP_INSPECT_7: "Tipp: Benutze \"/co i\" für schnelleren Zugriff"
HELP_INSPECT_COMMAND: "Schaltet den Blockinspektor um."
HELP_LIST: "Zeigt eine Liste aller Befehle an."
HELP_LOOKUP_1: "Befehlsverknüpfung."
@@ -55,13 +55,13 @@ HELP_LOOKUP_2: "Weitere Seiten anzeigen."
HELP_LOOKUP_COMMAND: "Blockdaten nachschlagen."
HELP_NO_INFO: "Informationen zum Befehl \"{0}\" nicht gefunden."
HELP_PARAMETER: "Bitte sehen Sie \"{0}\" für detaillierte Parameterinformationen."
HELP_PARAMS_1: "Führen Sie die {Nachschlagen|Rollback|Wiederherstellen}."
HELP_PARAMS_2: "Geben Sie die Benutzer an {Nachschlagen|Rollback|Wiederherstellen}."
HELP_PARAMS_3: "Geben Sie die Zeit an, um {Nachschlagen|Rollback|Wiederherstellen}."
HELP_PARAMS_4: "Beschränken Sie die {Nachschlagen|Rollback|Wiederherstellen} zu einem Radius."
HELP_PARAMS_5: "Beschränken Sie die {Nachschlagen|Rollback|Wiederherstellen} zu einer Aktion."
HELP_PARAMS_6: "Einschließen von Blöcken/Entitäten in die {Nachschlagen|Rollback|Wiederherstellen}."
HELP_PARAMS_7: "Sperren/Benutzer von der ausschließen {Nachschlagen|Rollback|Wiederherstellen}."
HELP_PARAMS_1: "Führe einen {Lookup|Rollback|Restore} durch."
HELP_PARAMS_2: "Spieler, für die der {Lookup|Rollback|Restore} gemacht werden soll."
HELP_PARAMS_3: "Zeitspanne, für die der {Lookup|Rollback|Restore} gemacht werden soll."
HELP_PARAMS_4: "Radius, in dem der {Lookup|Rollback|Restore} gemacht werden soll."
HELP_PARAMS_5: "Aktion, für die der {Lookup|Rollback|Restore} gemacht werden soll."
HELP_PARAMS_6: "Schließe Blöcke/Entitäten in den {Lookup|Rollback|Restore} ein."
HELP_PARAMS_7: "Schließe Blöcke/Benutzer von dem {Lookup|Rollback|Restore} aus."
HELP_PURGE_1: "Alte Daten entfernen."
HELP_PURGE_2: "Beispielsweise, \"{0}\" löscht alle Daten, die älter als einen Monat sind, und behält nur die Daten der letzten 30 Tage."
HELP_PURGE_COMMAND: "Alte Blockdaten löschen."
@@ -78,7 +78,7 @@ HELP_TIME_2: "Beispiele: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "Geben Sie die Benutzer an."
HELP_USER_2: "Beispiele: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" kann mit dieser Aktion nicht verwendet werden."
INSPECTOR_ERROR: "Inspektor schon {aktiviert|deaktiviert}."
INSPECTOR_ERROR: "Inspektor bereits {aktiviert|deaktiviert}."
INSPECTOR_TOGGLED: "Inspektor jetzt {aktiviert|deaktiviert}."
INTEGRATION_ERROR: "Unfähig zu {initialisieren|deaktivieren} {0} Protokollierung."
INTEGRATION_SUCCESS: "{0} erfolgreich anmelden {initialisiert|deaktiviert}."
@@ -104,18 +104,18 @@ LINK_WIKI_BLOCK: "Blocknamen: {0}"
LINK_WIKI_ENTITY: "Entitätsnamen: {0}"
LOGGING_ITEMS: "{0} Elemente, die noch zu loggen sind. Warten Sie mal..."
LOGGING_TIME_LIMIT: "Zeitlimit für die Protokollierung erreicht. Daten verwerfen und herunterfahren."
LOOKUP_BLOCK: "{0} {platziert|kaputt} {1}."
LOOKUP_BLOCK: "{0} {platziert|entfernt} {1}."
LOOKUP_CONTAINER: "{0} {hinzugefügt|entfernt} {1} {2}."
LOOKUP_HEADER: "{0} Ergebnisse"
LOOKUP_INTERACTION: "{0} {angeklickt|getötet} {1}."
LOOKUP_ITEM: "{0} {abgeholt|abgeworfen} {1} {2}."
LOOKUP_LOGIN: "{0} eingeloggt {rein|raus}."
LOOKUP_ITEM: "{0} {aufgehoben|weggeworfen} {1} {2}."
LOOKUP_LOGIN: "{0} {ein|aus}geloggt."
LOOKUP_PAGE: "Seite {0}"
LOOKUP_PROJECTILE: "{0} {geworfen|geschossen} {1} {2}."
LOOKUP_ROWS_FOUND: "{0} {Reihe|Reihen} gefunden."
LOOKUP_SEARCHING: "Suche nachschlagen. Warten Sie mal..."
LOOKUP_STORAGE: "{0} {hinterlegt|abgehoben} {1} {2}."
LOOKUP_TIME: "{0} vor"
LOOKUP_TIME: "vor {0}"
LOOKUP_USERNAME: "{0} Eingeloggt als {1}."
MAXIMUM_RADIUS: "Das Maximum {Nachschlagen|Rollback|Wiederherstellen} Radius ist {0}."
MISSING_ACTION_USER: "Um diese Aktion zu verwenden, geben Sie bitte einen Benutzer an."
@@ -126,10 +126,10 @@ MISSING_ROLLBACK_RADIUS: "Sie haben nicht angegeben a {Zurücksetzen|Wiederherst
MISSING_ROLLBACK_USER: "Sie haben nicht angegeben a {Zurücksetzen|Wiederherstellen} Benutzer."
MYSQL_UNAVAILABLE: "Verbindung zu nicht möglich MySQL Server."
NO_DATA: "Keine Daten gefunden bei {0}."
NO_DATA_LOCATION: "Nein {Daten|Transaktionen|Interaktionen|Nachrichten} gefunden."
NO_DATA_LOCATION: "Keine {Daten|Transaktionen|Interaktionen|Nachrichten} gefunden."
NO_PERMISSION: "Du hast keine Erlaubnis das zu tun."
NO_RESULTS: "Keine Ergebnisse gefunden."
NO_RESULTS_PAGE: "Nein {Ergebnisse|Daten} für diese Seite gefunden."
NO_RESULTS_PAGE: "Keine {Ergebnisse|Daten} für diese Seite gefunden."
NO_ROLLBACK: "Nein {ausstehend|zurück} Rollback/Wiederherstellung gefunden."
PATCH_INTERRUPTED: "Upgrade unterbrochen. Werde es beim Neustart nochmal versuchen."
PATCH_OUTDATED_1: "Datenbanken, die älter als sind, können nicht aktualisiert werden {0}."
@@ -160,22 +160,22 @@ PURGE_SUCCESS: "Datenbereinigung erfolgreich."
RELOAD_STARTED: "Konfiguration wird neu geladen - bitte warten."
RELOAD_SUCCESS: "Konfiguration erfolgreich neu geladen."
ROLLBACK_ABORTED: "Rollback oder Wiederherstellung abgebrochen."
ROLLBACK_CHUNKS_FOUND: "Gefunden {0} {Brocken|Brocken} ändern."
ROLLBACK_CHUNKS_MODIFIED: "Geändert {0}/{1} {Brocken|Brocken}."
ROLLBACK_CHUNKS_FOUND: "{0} {bearbeiteter|bearbeitete} {Chunk|Chunks} gefunden."
ROLLBACK_CHUNKS_MODIFIED: "{0}/{1} {Chunk|Chunks} bearbeitet."
ROLLBACK_COMPLETED: "{Rollback|Wiederherstellen|Vorschau} abgeschlossen für \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "Ausgeschlossen {Benutzer|Benutzer}: \"{0}\"."
ROLLBACK_INCLUDE: "{Eingeschlossen|Ausgeschlossen} {Block|Entität|Ziel} {Typ|Typen}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "Ein Rollback/Restore ist bereits im Gange."
ROLLBACK_LENGTH: "Zeit genommen: {0} {Sekunde|Sekunden}."
ROLLBACK_LENGTH: "Zeit beansprucht: {0} {Sekunde|Sekunden}."
ROLLBACK_MODIFIED: "{Modifiziert|Modifiziert} {0}."
ROLLBACK_RADIUS: "Radius: {0} {block|blöcke}."
ROLLBACK_RADIUS: "Radius: {0} {Block|Blöcke}."
ROLLBACK_SELECTION: "Radius eingestellt auf \"{0}\"."
ROLLBACK_STARTED: "{Rollback|Wiederherstellen|Vorschau} begann am \"{0}\"."
ROLLBACK_STARTED: "{Rollback|Restore|Vorschau} gestartet für \"{0}\"."
ROLLBACK_TIME: "Zeitspanne: {0}."
ROLLBACK_WORLD_ACTION: "Beschränkt auf {Welt|Aktion} \"{0}\"."
SIGN_HEADER: "Nachrichten signieren"
STATUS_CONSUMER: "Verbraucher: {0} {Artikel|Artikel} in der Warteschleife."
STATUS_DATABASE: "Datenbank: Verwenden {0}."
STATUS_CONSUMER: "Warteschleife: {0} {Datensatz|Datensätze}"
STATUS_DATABASE: "Datenbank: {0}."
STATUS_INTEGRATION: "{0}: Integration {aktiviert|deaktiviert}."
STATUS_LICENSE: "Lizenz: {0}"
STATUS_VERSION: "Version: {0}"
@@ -198,4 +198,4 @@ USING_SQLITE: "Verwenden von SQLite zur Datenspeicherung."
VALID_DONATION_KEY: "Gültiger Spendenschlüssel."
VERSION_NOTICE: "Ausführung {0} ist nun verfügbar."
VERSION_REQUIRED: "{0} {1} oder höher erforderlich."
WORLD_NOT_FOUND: "Welt \"{0}\" nicht gefunden."
WORLD_NOT_FOUND: "Welt \"{0}\" nicht gefunden."
+9 -1
View File
@@ -15,6 +15,7 @@ COMMAND_THROTTLED: "Please wait a moment and try again."
CONSUMER_ERROR: "Consumer queue processing already {paused|resumed}."
CONSUMER_TOGGLED: "Consumer queue processing has been {paused|resumed}."
CONTAINER_HEADER: "Container Transactions"
CPU_CORES: "CPU cores."
DATABASE_BUSY: "Database busy. Please try again later."
DATABASE_INDEX_ERROR: "Unable to validate database indexes."
DATABASE_LOCKED_1: "Database locked. Waiting up to 15 seconds..."
@@ -23,8 +24,9 @@ DATABASE_LOCKED_3: "To disable database locking, set \"database-lock: false\"."
DATABASE_LOCKED_4: "Disabling database locking can result in data corruption."
DATABASE_UNREACHABLE: "Database is unreachable. Discarding data and shutting down."
DEVELOPMENT_BRANCH: "Development branch detected, skipping patch scripts."
DIRT_BLOCK: "Placed a dirt block under you."
DIRT_BLOCK: "Placed a temporary safety block under you."
DISABLE_SUCCESS: "Success! Disabled {0}"
DONATION_KEY_REQUIRED: "A valid donation key is required for that command."
ENABLE_FAILED: "{0} was unable to start."
ENABLE_SUCCESS: "{0} has been successfully enabled!"
ENJOY_COREPROTECT: "Enjoy {0}? Join our Discord!"
@@ -125,6 +127,8 @@ MISSING_PARAMETERS: "Please use \"{0}\"."
MISSING_ROLLBACK_RADIUS: "You did not specify a {rollback|restore} radius."
MISSING_ROLLBACK_USER: "You did not specify a {rollback|restore} user."
MYSQL_UNAVAILABLE: "Unable to connect to MySQL server."
NETWORK_CONNECTION: "Connection by {0} {successful|failed}. Using {1} {2}."
NETWORK_TEST: "Network test data has been successful sent."
NO_DATA: "No data found at {0}."
NO_DATA_LOCATION: "No {data|transactions|interactions|messages} found at this location."
NO_PERMISSION: "You do not have permission to do that."
@@ -144,6 +148,7 @@ PREVIEW_CANCELLED: "Preview cancelled."
PREVIEW_CANCELLING: "Cancelling preview..."
PREVIEW_IN_GAME: "You can only preview rollbacks in-game."
PREVIEW_TRANSACTION: "You can't preview {container|inventory} transactions."
PRIMARY_THREAD_ERROR: "That API method can't be used on the primary thread."
PURGE_ABORTED: "Purge failed. Database may be corrupt."
PURGE_ERROR: "Unable to process {0} data!"
PURGE_FAILED: "Purge failed. Please try again later."
@@ -157,6 +162,7 @@ PURGE_REPAIRING: "Attempting to repair. This may take some time..."
PURGE_ROWS: "{0} {row|rows} of data deleted."
PURGE_STARTED: "Data purge started on \"{0}\"."
PURGE_SUCCESS: "Data purge successful."
RAM_STATS: "{0}GB / {1}GB RAM"
RELOAD_STARTED: "Reloading configuration - please wait."
RELOAD_SUCCESS: "Configuration successfully reloaded."
ROLLBACK_ABORTED: "Rollback or restore aborted."
@@ -178,6 +184,7 @@ STATUS_CONSUMER: "Consumer: {0} {item|items} in queue."
STATUS_DATABASE: "Database: Using {0}."
STATUS_INTEGRATION: "{0}: Integration {enabled|disabled}."
STATUS_LICENSE: "License: {0}"
STATUS_SYSTEM: "System: {0}"
STATUS_VERSION: "Version: {0}"
TELEPORTED: "Teleported to {0}."
TELEPORTED_SAFETY: "Teleported you to safety."
@@ -196,6 +203,7 @@ USER_OFFLINE: "The user \"{0}\" is not online."
USING_MYSQL: "Using MySQL for data storage."
USING_SQLITE: "Using SQLite for data storage."
VALID_DONATION_KEY: "Valid donation key."
VERSION_INCOMPATIBLE: "{0} {1} is not supported."
VERSION_NOTICE: "Version {0} is now available."
VERSION_REQUIRED: "{0} {1} or higher is required."
WORLD_NOT_FOUND: "World \"{0}\" not found."
+172 -166
View File
@@ -1,201 +1,207 @@
# CoreProtect Language File (es)
ACTION_NOT_SUPPORTED: "Esa acción no es compatible."
ACTION_NOT_SUPPORTED: "Está acción no es compatible con el comando."
AMOUNT_BLOCK: "{0} {bloque|bloques}"
AMOUNT_CHUNK: "{0} {trozo|trozos}"
AMOUNT_CHUNK: "{0} {chunk|chunks}"
AMOUNT_ENTITY: "{0} {entidad|entidades}"
AMOUNT_ITEM: "{0} {artículo|artículos}"
API_TEST: "Prueba de API exitosa."
CACHE_ERROR: "ADVERTENCIA: Error al validar {0} cache."
CACHE_RELOAD: "Forzando la recarga de {mapeo|mundo} cachés de la base de datos."
CHECK_CONFIG: "Por favor revise config.yml"
COMMAND_CONSOLE: "Ejecute el comando desde la consola."
COMMAND_NOT_FOUND: "Comando \"{0}\" extraviado."
COMMAND_THROTTLED: "Espere un momento y vuelva a intentarlo."
CONSUMER_ERROR: "Procesamiento de colas de consumidores ya {en pausa|reanudado}."
CONSUMER_TOGGLED: "El procesamiento de la cola del consumidor ha sido {en pausa|reanudado}."
CONTAINER_HEADER: "Transacciones de contenedores"
DATABASE_BUSY: "Base de datos ocupado. Por favor, inténtelo de nuevo más tarde."
DATABASE_INDEX_ERROR: "No se pueden validar los índices de la base de datos."
DATABASE_LOCKED_1: "Base de datos bloqueada. Esperando hasta 15 segundos..."
DATABASE_LOCKED_2: "La base de datos ya está en uso. Inténtalo de nuevo."
DATABASE_LOCKED_3: "Para deshabilitar el bloqueo de la base de datos, establezca \"database-lock: false\"."
DATABASE_LOCKED_4: "La desactivación del bloqueo de la base de datos puede provocar daños en los datos."
DATABASE_UNREACHABLE: "La base de datos es inalcanzable. Descartando datos y cerrando."
DEVELOPMENT_BRANCH: "Se detectó una rama de desarrollo, omitiendo los scripts de parches."
DIRT_BLOCK: "Colocó un bloque de tierra debajo de usted."
DISABLE_SUCCESS: "¡Éxito! Discapacitado {0}"
ENABLE_FAILED: "{0} fue incapaz de comenzar."
ENABLE_SUCCESS: "{0} ahora está habilitado!"
ENJOY_COREPROTECT: "Disfrutar {0}? Únete a nuestro Discord!"
FINISHING_CONVERSION: "Terminando la conversión de datos. Espere por favor..."
FINISHING_LOGGING: "Terminando el registro de datos. Espere por favor..."
FIRST_VERSION: "DB inicial: {0}"
GLOBAL_LOOKUP: "No especifique un radio para realizar una búsqueda global."
GLOBAL_ROLLBACK: "Usar \"{0}\" para hacer un global {deshacer|restaurar}"
HELP_ACTION_1: "Restrinja la búsqueda a una acción."
AMOUNT_ITEM: "{0} {objeto|objetos}"
API_TEST: "Testeo de la API exitosa."
CACHE_ERROR: "ADVERTENCIA: Error mientras se validaba el caché {0}."
CACHE_RELOAD: "Forzando recarga de cachés desde la base de datos de {mapeado|mundo}."
CHECK_CONFIG: "Por favor revise su config.yml"
COMMAND_CONSOLE: "Intente ejecutar el comando desde la consola."
COMMAND_NOT_FOUND: "Comando \"{0}\" no encontrado."
COMMAND_THROTTLED: "Espere un momento e intente nuevamente."
CONSUMER_ERROR: "La espera en el procesamiento del consumidor ha sido {pausada|continuada}."
CONSUMER_TOGGLED: "Consumer queue processing has been {pausado|continuado}."
CONTAINER_HEADER: "Transacciones del contenedor"
CPU_CORES: "CPU cores."
DATABASE_BUSY: "Base de datos ocupada. Intente más tarde."
DATABASE_INDEX_ERROR: "Imposible validar los indices de la base de datos."
DATABASE_LOCKED_1: "Base de datos bloqueada. Espere en los siguientes 15 segundos..."
DATABASE_LOCKED_2: "Base de datos ya en uso. Intente nuevamente."
DATABASE_LOCKED_3: "Para desactivar el bloqueo de la base de datos, coloque \"database-lock: false\"."
DATABASE_LOCKED_4: "Desactivando el bloqueo en la base de datos resultaría en una posible corrupción de datos."
DATABASE_UNREACHABLE: "No se pudo alcanzar la base de datos. Descartando datos y apagando."
DEVELOPMENT_BRANCH: "Rama de desarrollo detectada, saltando scripts de parche."
DIRT_BLOCK: "Se ha colocado un bloque de tierra debajo de tí."
DISABLE_SUCCESS: "¡Se ha desactivado exitosamente {0}!"
ENABLE_FAILED: "Imposible de iniciar {0}."
ENABLE_SUCCESS: "¡{0} ha sido exitosamente activado!"
ENJOY_COREPROTECT: "¿Disfrutando {0}? ¡Ingrese a nuestro Discord!"
FINISHING_CONVERSION: "Terminando la conversión de datos. Espere..."
FINISHING_LOGGING: "Terminando el registro de datos. Espere..."
FIRST_VERSION: "Base de datos inicial: {0}"
GLOBAL_LOOKUP: "No especificaste el radio para una busqueda global."
GLOBAL_ROLLBACK: "Usa \"{0}\" para hacer un {respaldo|restauración} global"
HELP_ACTION_1: "Restringir la busqueda a una acción."
HELP_ACTION_2: "Ejemplos: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "Muestra información adicional."
HELP_EXCLUDE_1: "Excluir bloques / usuarios."
HELP_COMMAND: "Mostrar información sobre un comando."
HELP_EXCLUDE_1: "Excluir bloques/usuarios."
HELP_EXCLUDE_2: "Ejemplos: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} Ayudar"
HELP_INCLUDE_1: "Incluya bloques / entidades."
HELP_HEADER: "Ayuda {0}"
HELP_INCLUDE_1: "Incluir bloques/entidades exactos."
HELP_INCLUDE_2: "Ejemplos: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "Con el inspector habilitado, puede:"
HELP_INSPECT_2: "Haga clic con el botón izquierdo para ver la ubicación."
HELP_INSPECT_3: "Haga clic derecho para ver las eliminaciones adyacentes."
HELP_INSPECT_4: "Coloque un bloque para ver la eliminación."
HELP_INSPECT_5: "Coloque un bloque en líquido para ver la ubicación."
HELP_INSPECT_6: "Haga clic derecho para ver las transacciones del cofre."
HELP_INSPECT_7: "Sugerencia: puede usar solo \"/co i\"."
HELP_INSPECT_COMMAND: "Alterna el inspector de bloques."
HELP_INSPECT_1: "Con el inspeccionador activo, puedes hacer lo siguiente:"
HELP_INSPECT_2: "Clic izquierdo para ver quien colocó ese bloque."
HELP_INSPECT_3: "Clic derecho para ver quien rompió el bloque de encima."
HELP_INSPECT_4: "Coloca un bloque para ver si se ha roto alguno en la zona."
HELP_INSPECT_5: "Coloca el bloque en un liquido (etc) para ver quien lo colocó."
HELP_INSPECT_6: "Clic derecho sobre un cofres y ver sus transacciones."
HELP_INSPECT_7: "Consejo: Puedes usar \"/co i\" para un acceso rápido."
HELP_INSPECT_COMMAND: "Alterna el revisor de bloques."
HELP_LIST: "Muestra una lista de todos los comandos."
HELP_LOOKUP_1: "Atajo de comando."
HELP_LOOKUP_2: "Ver páginas adicionales."
HELP_LOOKUP_COMMAND: "Búsqueda de datos de bloques."
HELP_NO_INFO: "Información para el mando \"{0}\" extraviado."
HELP_PARAMETER: "Por favor mira \"{0}\" para obtener información detallada sobre los parámetros."
HELP_PARAMS_1: "Realizar el {buscar|deshacer|restaurar}."
HELP_PARAMS_2: "Especifique los usuarios para {buscar|deshacer|restaurar}."
HELP_PARAMS_3: "Especifique el tiempo para {buscar|deshacer|restaurar}."
HELP_PARAMS_4: "Restringir el {buscar|deshacer|restaurar} a un radio."
HELP_PARAMS_5: "Restringir el {buscar|deshacer|restaurar} a una acción."
HELP_PARAMS_6: "Incluir bloques / entidades en el {buscar|deshacer|restaurar}."
HELP_PARAMS_7: "Excluir bloques / usuarios del {buscar|deshacer|restaurar}."
HELP_PURGE_1: "Eliminar datos antiguos."
HELP_PURGE_2: "Por ejemplo, \"{0}\" eliminará todos los datos anteriores a un mes y solo conservará los datos de los últimos 30 días."
HELP_PURGE_COMMAND: "Elimina los datos del bloque antiguo."
HELP_RADIUS_1: "Especifique un área de radio."
HELP_RADIUS_2: "Ejemplos: [r:10] (Solo haga cambios dentro de las 10 cuadras de usted)"
HELP_RELOAD_COMMAND: "Vuelve a cargar el archivo de configuración."
HELP_RESTORE_COMMAND: "Restaurar los datos del bloque."
HELP_ROLLBACK_COMMAND: "Revertir los datos del bloque."
HELP_STATUS: "Ver el estado del complemento."
HELP_STATUS_COMMAND: "Muestra el estado del complemento."
HELP_TELEPORT: "Teletransportarse."
HELP_TIME_1: "Especifique la hora."
HELP_LOOKUP_1: "Atajo de comandos."
HELP_LOOKUP_2: "Mostrar páginas adicionales."
HELP_LOOKUP_COMMAND: "Busqueda de bloques avanzada."
HELP_NO_INFO: "Información para el comando \"{0}\" no encontrada."
HELP_PARAMETER: "Revisa \"{0}\" para una información más detallada."
HELP_PARAMS_1: "Ingrese la {búsqueda|respaldo|restauración}."
HELP_PARAMS_2: "Especifique al usuario a {buscar|respaldar|restaurar}."
HELP_PARAMS_3: "Especifique la cantidad de tiempo a {buscar|respaldar|restaurar}."
HELP_PARAMS_4: "Especifique el radio de area a {buscar|respaldar|restaurar}."
HELP_PARAMS_5: "Restringir la {búsqueda|respaldo|restauración} a una acción dada."
HELP_PARAMS_6: "Incluir bloques/entidades exactas a {buscar|respaldar|restaurar}."
HELP_PARAMS_7: "Excluir bloques/usuarios a {buscar|respaldar|resturar}."
HELP_PURGE_1: "Eliminar los datos en un tiempo dado."
HELP_PURGE_2: "Por ejemplo, \"{0}\" eliminará los datos que sean más viejos, y solo mantendrá lo que está en los 30d."
HELP_PURGE_COMMAND: "Elimina los datos de bloques viejos."
HELP_RADIUS_1: "Especifica un radio del area."
HELP_RADIUS_2: "Ejemplos: [r:10] (Solo cambiará 10 bloques delante de ti)"
HELP_RELOAD_COMMAND: "Recarga los archivos de configuración."
HELP_RESTORE_COMMAND: "Restaurar los datos de bloques."
HELP_ROLLBACK_COMMAND: "Restaurar bloques."
HELP_STATUS: "Muestra el estado del plugin y su información."
HELP_STATUS_COMMAND: "Muestra el estado del plugin."
HELP_TELEPORT: "Teletransportar a una coordenada."
HELP_TIME_1: "Especifique una cantidad de tiempo."
HELP_TIME_2: "Ejemplos: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "Especifique los usuarios."
HELP_USER_1: "Especifica al usuario para buscar."
HELP_USER_2: "Ejemplos: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" no se puede utilizar con esa acción."
INSPECTOR_ERROR: "Inspector ya {habilitado|deshabilitado}."
INSPECTOR_TOGGLED: "Inspector ahora {habilitado|deshabilitado}."
INTEGRATION_ERROR: "Incapaz de {inicializar|deshabilitar} {0} Inicio sesión."
INTEGRATION_SUCCESS: "{0} registrando exitosamente {inicializado|deshabilitado}."
INTEGRATION_VERSION: "Inválido {0} versión encontrada."
INCOMPATIBLE_ACTION: "\"{0}\" no puede ser usado para esta acción."
INSPECTOR_ERROR: "Inspeccionador ya {activado|desactivado}."
INSPECTOR_TOGGLED: "Inspeccionador {activado|desactivado}."
INTEGRATION_ERROR: "Imposible {inicializar|desactivar} los registros {0}."
INTEGRATION_SUCCESS: "Registros en {0} han sido correctamente {inicializados|desactivados}."
INTEGRATION_VERSION: "Versión inválida {0} encontrada."
INTERACTIONS_HEADER: "Interacciones del jugador"
INVALID_ACTION: "Esa no es una acción válida."
INVALID_BRANCH_1: "Versión de complemento no válida (la rama no se ha configurado)."
INVALID_BRANCH_2: "Para continuar, establezca la rama del proyecto en \"desarrollo\"."
INVALID_BRANCH_3: "La ejecución de código de desarrollo puede provocar daños en los datos."
INVALID_CONTAINER: "Primero inspeccione un contenedor válido."
INVALID_DONATION_KEY: "Clave de donación no válida."
INVALID_INCLUDE: "\"{0}\" es un valor no válido."
INVALID_INCLUDE_COMBO: "Esa es una combinación de tipos no válida."
INVALID_RADIUS: "Ingrese un radio válido."
INVALID_SELECTION: "{0} selección no encontrada."
INVALID_USERNAME: "\"{0}\" es un nombre de usuario no válido."
INVALID_ACTION: "No es una acción válida."
INVALID_BRANCH_1: "Versión del plugin inválida (la rama no ha sido definida)."
INVALID_BRANCH_2: "Para continuar, coloque la rama del proyecto a \"development\"."
INVALID_BRANCH_3: "Ejecutar códigos en desarrollo puede resultar en una corrupción de datos."
INVALID_CONTAINER: "Intente inspeccionar un contenedor válido primero."
INVALID_DONATION_KEY: "Clave de donación inválida."
INVALID_INCLUDE: "\"{0}\" es un bloque inválido/ o nombre de entidad."
INVALID_INCLUDE_COMBO: "Es una combinación inválida de bloque/entidad."
INVALID_RADIUS: "Coloque un radio válido."
INVALID_SELECTION: "{0} sección no encontrada."
INVALID_USERNAME: "\"{0}\" no es usuario existente."
INVALID_WORLD: "Especifique un mundo válido."
LATEST_VERSION: "Última versión: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "Descargar: {0}"
LINK_DOWNLOAD: "Descarga: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "Nombres de bloque: {0}"
LINK_WIKI_BLOCK: "Nombres de bloques: {0}"
LINK_WIKI_ENTITY: "Nombres de entidades: {0}"
LOGGING_ITEMS: "{0} elementos que quedan por registrar. Espere por favor..."
LOGGING_TIME_LIMIT: "Se alcanzó el límite de tiempo de registro. Descartando datos y cerrando."
LOOKUP_BLOCK: "{0} {colocado|roto} {1}."
LOOKUP_CONTAINER: "{0} {añadido|eliminado} {1} {2}."
LOGGING_ITEMS: "{0} objetos restantes por registrar. Espere un momento..."
LOGGING_TIME_LIMIT: "Limite de tiempo de registros. Descartamdo pérdida de información."
LOOKUP_BLOCK: "{0} {colocó|rompió} {1}."
LOOKUP_CONTAINER: "{0} {agregó|removió} {1} {2}."
LOOKUP_HEADER: "{0} Resultados"
LOOKUP_INTERACTION: "{0} {clickeado|muerto} {1}."
LOOKUP_ITEM: "{0} {recogido|caído} {1} {2}."
LOOKUP_LOGIN: "{0} registrado {adentro|afuera}."
LOOKUP_INTERACTION: "{0} {clickeó|mató} {1}."
LOOKUP_ITEM: "{0} {recogió|soltó} {1} {2}."
LOOKUP_LOGIN: "{0} ha {entrado|salido}."
LOOKUP_PAGE: "Página {0}"
LOOKUP_PROJECTILE: "{0} {tiró|disparó} {1} {2}."
LOOKUP_ROWS_FOUND: "{0} {fila|filas} encontró."
LOOKUP_SEARCHING: "Búsqueda de búsqueda. Espere por favor..."
LOOKUP_STORAGE: "{0} {depositado|retirado} {1} {2}."
LOOKUP_TIME: "{0} atrás"
LOOKUP_USERNAME: "{0} Conectado como {1}."
MAXIMUM_RADIUS: "El maximo {buscar|deshacer|restaurar} el radio es {0}."
MISSING_ACTION_USER: "Para utilizar esa acción, especifique un usuario."
MISSING_LOOKUP_TIME: "Por favor, especifique el tiempo para {buscar|deshacer|restaurar}."
MISSING_LOOKUP_USER: "Especifique un usuario o {bloque|radio}."
MISSING_PARAMETERS: "Por favor use \"{0}\"."
MISSING_ROLLBACK_RADIUS: "No especificó un {deshacer|restaurar} radio."
MISSING_ROLLBACK_USER: "No especificó un {deshacer|restaurar} usuario."
MYSQL_UNAVAILABLE: "Incapaz de conectarse a MySQL servidor."
NO_DATA: "No se encontraron datos en {0}."
NO_DATA_LOCATION: "No se encontraron {datos|transacciones|interacciones|mensajes}."
NO_PERMISSION: "No tienes permiso para hacer eso."
NO_RESULTS: "No se han encontrado resultados."
NO_RESULTS_PAGE: "No {resultados|datos} encontrado para esa página."
NO_ROLLBACK: "No {pendiente|anterior} deshacer / restaurar encontrado."
PATCH_INTERRUPTED: "Actualización interrumpida. Intentará de nuevo al reiniciar."
PATCH_OUTDATED_1: "No se pueden actualizar las bases de datos anteriores a {0}."
PATCH_OUTDATED_2: "Actualice con una versión compatible de CoreProtect."
PATCH_PROCESSING: "Procesando nuevos datos. Espere por favor..."
PATCH_SKIP_UPDATE: "Salto a la comba {tabla|índice} {actualización|creación|eliminación} en {0}."
PATCH_STARTED: "Ejecutando {0} potenciar. Espere por favor..."
PATCH_SUCCESS: "Actualizado con éxito a {0}."
PATCH_UPGRADING: "Actualización de la base de datos en curso. Espere por favor..."
LOOKUP_ROWS_FOUND: "{0} {fila|filas} encontradas."
LOOKUP_SEARCHING: "Busqueda iniciada. Espere..."
LOOKUP_STORAGE: "{0} {depositó|retiró} {1} {2}."
LOOKUP_TIME: "Hace {0}"
LOOKUP_USERNAME: "{0} entró como {1}."
MAXIMUM_RADIUS: "El radio máximo de {búsqueda|retorno|restauración} es {0}."
MISSING_ACTION_USER: "Para usar esta acción, especifique a un usuario."
MISSING_LOOKUP_TIME: "Especifique la cantidad de tiempo para {buscar|retornar|restaurar}."
MISSING_LOOKUP_USER: "Especifique un usuario o {bloque|radio} para buscar."
MISSING_PARAMETERS: "Usa \"{0}\"."
MISSING_ROLLBACK_RADIUS: "No especificaste un radio para {retornar|resturar}."
MISSING_ROLLBACK_USER: "No especificaste a un usuario para {retornar|restaurar}."
MYSQL_UNAVAILABLE: "No se pudo conectar con el servidor de MySQL."
NETWORK_CONNECTION: "Conexión por {0} {exitosa|fallida}. Usando {1} {2}."
NETWORK_TEST: "Los datos de la prueba de red se han enviado con éxito."
NO_DATA: "Sin datos para {0}."
NO_DATA_LOCATION: "Sin {datos|transacciones|interacciones|mensajes} encontrados acá."
NO_PERMISSION: "No tienes permisos para hacer esto."
NO_RESULTS: "No se hallaron resultados."
NO_RESULTS_PAGE: "Sin {resultados|datos} encontados para esta página."
NO_ROLLBACK: "No hay rollbacks {pendientes|previos} encontrados."
PATCH_INTERRUPTED: "Mejora interrumpida. Se intentará nuevamente en el reinicio."
PATCH_OUTDATED_1: "No se puede mejorar base de datos más antiguas de {0}."
PATCH_OUTDATED_2: "Actualice con una versión soportada de CoreProtect."
PATCH_PROCESSING: "Procesando nueva información. Espere un momento..."
PATCH_SKIP_UPDATE: "Saltando {tabla|índice} {actualización|creación|remoción} en {0}."
PATCH_STARTED: "Intentando actualizar {0}. Espere..."
PATCH_SUCCESS: "Exitosamente actualizada a {0}."
PATCH_UPGRADING: "Mejora de base de datos en progreso. Espere un momento..."
PLEASE_SELECT: "Seleccione: \"{0}\" o \"{1}\"."
PREVIEW_CANCELLED: "Vista previa cancelada."
PREVIEW_CANCELLING: "Cancelando vista previa..."
PREVIEW_IN_GAME: "Solo puedes obtener una vista previa de las reversiones en el juego."
PREVIEW_TRANSACTION: "No puedes previsualizar {contenedor|inventario} actas."
PURGE_ABORTED: "La purga falló. La base de datos puede estar dañada."
PURGE_ERROR: "No se puede procesar {0} ¡datos!"
PURGE_FAILED: "La purga falló. Por favor, inténtelo de nuevo más tarde."
PURGE_IN_PROGRESS: "Purga en curso. Por favor, inténtelo de nuevo más tarde."
PURGE_MINIMUM_TIME: "Solo puede depurar datos anteriores a {0} {días|horas}."
PURGE_NOTICE_1: "Tenga en cuenta que esto puede llevar algún tiempo."
PURGE_NOTICE_2: "No reinicie su servidor hasta que haya terminado."
PURGE_OPTIMIZING: "Optimización de la base de datos. Espere por favor..."
PREVIEW_CANCELLED: "Muestra cancelada."
PREVIEW_CANCELLING: "Cancelando muestra..."
PREVIEW_IN_GAME: "Solo puedes mostrar respaldos en el juego."
PREVIEW_TRANSACTION: "No puedes mostrar transacciones de {contenedor|inventario}."
PRIMARY_THREAD_ERROR: "Ese método de API no se puede usar en el hilo principal."
PURGE_ABORTED: "Purga fallida. La base de datos debe estar corrupta."
PURGE_ERROR: "¡No se pudo procesar {0} datos!"
PURGE_FAILED: "Purga fallida. Intente nuevamente."
PURGE_IN_PROGRESS: "Purga en progreso. Intentelo nuevamente."
PURGE_MINIMUM_TIME: "Solo puedes limpiar datos viejos desde {0} {días|horas}."
PURGE_NOTICE_1: "Ten en cuenta que va a demorar un poco."
PURGE_NOTICE_2: "No reinicies el servidor hasta que se complete."
PURGE_OPTIMIZING: "Optimizando base de datos. Espere..."
PURGE_PROCESSING: "Procesando {0} datos..."
PURGE_REPAIRING: "Intentando reparar. Esto puede tomar algo de tiempo..."
PURGE_ROWS: "{0} {fila|filas} de datos eliminados."
PURGE_STARTED: "La depuración de datos comenzó el \"{0}\"."
PURGE_REPAIRING: "Intentando reparar. Esto tomará algo de tiempo..."
PURGE_ROWS: "{0} {fila|filas} de datos limpiados."
PURGE_STARTED: "Purga de datos iniciada en \"{0}\"."
PURGE_SUCCESS: "Purga de datos exitosa."
RELOAD_STARTED: "Recargando la configuración - espere."
RELOAD_SUCCESS: "Configuración recargada correctamente."
ROLLBACK_ABORTED: "Reversión o restauración abortada."
ROLLBACK_CHUNKS_FOUND: "Encontró {0} {trozo|trozos} Modificar."
ROLLBACK_CHUNKS_MODIFIED: "Modificado {0}/{1} {trozo|trozos}."
ROLLBACK_COMPLETED: "{Retroceder|Restaurar|Vista previa} completado para \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "Excluido {usuario|usuarios}: \"{0}\"."
RAM_STATS: "{0}GB / {1}GB RAM"
RELOAD_STARTED: "Recargando configuración - espere."
RELOAD_SUCCESS: "Configuración exitosamente recargada."
ROLLBACK_ABORTED: "Retorno o restauración abortado."
ROLLBACK_CHUNKS_FOUND: "Encontrado {0} {chunk|chunks} para modificar."
ROLLBACK_CHUNKS_MODIFIED: "Se han modificado {0}/{1} {chunk|chunks}."
ROLLBACK_COMPLETED: "{Respaldo|Restauración|Muestra} completado por \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "Excluir al {usuario|usuarios}: \"{0}\"."
ROLLBACK_INCLUDE: "{Incluido|Excluido} {bloque|entidad|objetivo} {tipo|tipos}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "Ya se está realizando una reversión / restauración."
ROLLBACK_LENGTH: "Tiempo tomado: {0} {segundo|segundos}."
ROLLBACK_IN_PROGRESS: "Un retorno/resturación ya está en progreso."
ROLLBACK_LENGTH: "Tiempo gastado: {0} {segundo|segundos}."
ROLLBACK_MODIFIED: "{Modificado|Modificando} {0}."
ROLLBACK_RADIUS: "Radio: {0} {bloque|bloques}."
ROLLBACK_SELECTION: "Radio establecido en \"{0}\"."
ROLLBACK_STARTED: "{Retroceder|Restaurar|Vista previa} comenzó en \"{0}\"."
ROLLBACK_TIME: "Intervalo de tiempo: {0}."
ROLLBACK_WORLD_ACTION: "Prohibido para {mundo|acción} \"{0}\"."
SIGN_HEADER: "Firmar mensajes"
STATUS_CONSUMER: "Consumidor: {0} {artículo|artículos} en la cola."
ROLLBACK_SELECTION: "Radio definido a \"{0}\"."
ROLLBACK_STARTED: "{Retorno|Restauración|Muestra} iniciado en \"{0}\"."
ROLLBACK_TIME: "Tiempo hecho: {0}."
ROLLBACK_WORLD_ACTION: "Restringido para {mundo|acción} \"{0}\"."
SIGN_HEADER: "Mensajes de cartel"
STATUS_CONSUMER: "Consumidor: {0} {objeto|objetos} en espera."
STATUS_DATABASE: "Base de datos: Usando {0}."
STATUS_INTEGRATION: "{0}: Integración {habilitado|deshabilitado}."
STATUS_INTEGRATION: "{0}: Integración {activada|desactivada}."
STATUS_LICENSE: "Licencia: {0}"
STATUS_SYSTEM: "Sistema: {0}"
STATUS_VERSION: "Versión: {0}"
TELEPORTED: "Teletransportado a {0}."
TELEPORTED_SAFETY: "Te teletransportó a un lugar seguro."
TELEPORT_PLAYERS: "El comando de teletransporte solo puede ser utilizado por jugadores."
TELEPORTED_SAFETY: "Te he teletransportado a un lugar seguro."
TELEPORT_PLAYERS: "El comando de teletransporte solo puede ser usado por jugadores."
TIME_DAYS: "{0} {día|días}"
TIME_HOURS: "{0} {hora|horas}"
TIME_MINUTES: "{0} {minuto|minutos}"
TIME_SECONDS: "{0} {segundo|segundos}"
TIME_WEEKS: "{0} {semana|semanas}"
UPDATE_ERROR: "Se produjo un error al buscar actualizaciones."
UPDATE_HEADER: "{0} Actualizar"
UPDATE_NOTICE: "Darse cuenta: {0} Ya está disponible."
UPGRADE_IN_PROGRESS: "Actualización en curso. Por favor, inténtelo de nuevo más tarde."
USER_NOT_FOUND: "Usuario \"{0}\" extraviado."
USER_OFFLINE: "El usuario \"{0}\" no está en línea."
USING_MYSQL: "Utilizando MySQL para el almacenamiento de datos."
USING_SQLITE: "Utilizando SQLite para el almacenamiento de datos."
UPDATE_ERROR: "Un error ocurrió mientras se revisaban las actualizaciones."
UPDATE_HEADER: "Actualización {0}"
UPDATE_NOTICE: "Noticia: {0} está disponible."
UPGRADE_IN_PROGRESS: "Actualización en progreso. Intente nuevamente."
USER_NOT_FOUND: "Usuario \"{0}\" no encontrado."
USER_OFFLINE: "El usuario \"{0}\" no está conectado."
USING_MYSQL: "Usando MySQL para el guardado de información."
USING_SQLITE: "Usando SQLite para el guardado de información."
VALID_DONATION_KEY: "Clave de donación válida."
VERSION_NOTICE: "Versión {0} Ya está disponible."
VERSION_REQUIRED: "{0} {1} se requiere o superior."
WORLD_NOT_FOUND: "Mundo \"{0}\" extraviado."
VERSION_NOTICE: "Versión {0} está disponible."
VERSION_REQUIRED: "{0} {1} o súperior es requerida."
WORLD_NOT_FOUND: "Mundo \"{0}\" inexistente."
+44 -44
View File
@@ -6,8 +6,8 @@ AMOUNT_CHUNK: "{0} {チャンク|チャンク}"
AMOUNT_ENTITY: "{0} {エンティティ|エンティティ}"
AMOUNT_ITEM: "{0} {item|items}"
API_TEST: "APIテストが成功しました。"
CACHE_ERROR: "警告:検証中にエラーが発生しました {0} キャッシュ。"
CACHE_RELOAD: "のリロードを強制する {マッピング|世界} データベースからのキャッシュ。"
CACHE_ERROR: "警告:検証中にエラーが発生しました {0}"
CACHE_RELOAD: "{マッピング|世界} のリロードを強制する(データベースからのキャッシュ)"
CHECK_CONFIG: "config.ymlを確認してください"
COMMAND_CONSOLE: "コンソールからコマンドを実行してください。"
COMMAND_NOT_FOUND: "指示 \"{0}\" 見つかりません。"
@@ -15,7 +15,7 @@ COMMAND_THROTTLED: "しばらく待ってから、もう一度お試しくださ
CONSUMER_ERROR: "すでにコンシューマキュー処理 {一時停止|再開}。"
CONSUMER_TOGGLED: "消費者キューの処理は {一時停止|再開}。"
CONTAINER_HEADER: "コンテナトランザクション"
DATABASE_BUSY: "データベースがビジーです。後でもう一度やり直してください。"
DATABASE_BUSY: "データベースが無効です。後でもう一度やり直してください。"
DATABASE_INDEX_ERROR: "データベースインデックスを検証できません。"
DATABASE_LOCKED_1: "データベースがロックされています。最大15秒待機しています..."
DATABASE_LOCKED_2: "データベースはすでに使用されています。もう一度やり直してください。"
@@ -25,11 +25,11 @@ DATABASE_UNREACHABLE: "データベースにアクセスできません。デー
DEVELOPMENT_BRANCH: "開発ブランチが検出され、パッチスクリプトをスキップしました。"
DIRT_BLOCK: "あなたの下にダートブロックを置きました。"
DISABLE_SUCCESS: "成功!無効 {0}"
ENABLE_FAILED: "{0} 開始できませんでした。"
ENABLE_SUCCESS: "{0} これで有効になります!"
ENJOY_COREPROTECT: "楽しみ {0}?私たちに参加する Discord!"
ENABLE_FAILED: "{0} を開始できませんでした。"
ENABLE_SUCCESS: "これで {0} は有効になります!"
ENJOY_COREPROTECT: "{0} を楽しんでいますか?私たちのDiscordに参加しましょう!"
FINISHING_CONVERSION: "データ変換を終了します。お待ちください..."
FINISHING_LOGGING: "データロギングの終了。お待ちください..."
FINISHING_LOGGING: "データの記録が終了します。お待ちください..."
FIRST_VERSION: "初期DB:{0}"
GLOBAL_LOOKUP: "グローバルルックアップを実行するために半径を指定しないでください。"
GLOBAL_ROLLBACK: "つかいます \"{0}「グローバルに {ロールバック|復元}"
@@ -47,14 +47,14 @@ HELP_INSPECT_3: "右クリックして、隣接する削除を表示します。
HELP_INSPECT_4: "ブロックを配置して、削除を確認します。"
HELP_INSPECT_5: "ブロックを液体に入れて配置を確認します。"
HELP_INSPECT_6: "右クリックしてチェストトランザクションを表示します。"
HELP_INSPECT_7: "ヒント:「/coi」だけを使用できます。"
HELP_INSPECT_7: "ヒント:「/co i」を使用して犯人を追跡できます"
HELP_INSPECT_COMMAND: "ブロックインスペクターを切り替えます。"
HELP_LIST: "すべてのコマンドのリストを表示します。"
HELP_LOOKUP_1: "コマンドショートカット。"
HELP_LOOKUP_2: "追加のページを表示します。"
HELP_LOOKUP_COMMAND: "ルックアップブロックデータ。"
HELP_NO_INFO: "コマンドの情報 \"{0}\" 見つかりません。"
HELP_PARAMETER: "見てください \"{0}詳細なパラメータ情報については、「」を参照してください。"
HELP_PARAMETER: "詳細なパラメータ情報については、「{0}」を参照してください。"
HELP_PARAMS_1: "を実行します {ルックアップ|ロールバック|復元}。"
HELP_PARAMS_2: "ユーザーを指定して {ルックアップ|ロールバック|復元}。"
HELP_PARAMS_3: "時間を指定します {ルックアップ|ロールバック|復元}。"
@@ -72,14 +72,14 @@ HELP_RESTORE_COMMAND: "ブロックデータを復元します。"
HELP_ROLLBACK_COMMAND: "ブロックデータをロールバックします。"
HELP_STATUS: "プラグインのステータスを表示します。"
HELP_STATUS_COMMAND: "プラグインのステータスを表示します。"
HELP_TELEPORT: "テレポート。"
HELP_TELEPORT: "テレポートします。"
HELP_TIME_1: "時間を指定します。"
HELP_TIME_2: "例:[t:2w,5d,7h,2m,10s]、 [t:5d2h]、 [t:2.50h]"
HELP_USER_1: "ユーザーを指定します。"
HELP_USER_2: "例:[u:Notch]、 [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "「」{0}「そのアクションでは使用できません。"
INSPECTOR_ERROR: "すでに検査官 {有効|無効}。"
INSPECTOR_TOGGLED: "今インスペクター {有効|無効}。"
INCOMPATIBLE_ACTION: "そのアクションで「{0}」は使用できません。"
INSPECTOR_ERROR: "検査官モードが{有効|無効}です。"
INSPECTOR_TOGGLED: "検査官モードが{有効|無効}になりました。"
INTEGRATION_ERROR: "できません {初期化|無効化} {0} ロギング。"
INTEGRATION_SUCCESS: "{0} 正常にロギング {初期化|無効}。"
INTEGRATION_VERSION: "無効 {0} バージョンが見つかりました。"
@@ -88,22 +88,22 @@ INVALID_ACTION: "それは有効なアクションではありません。"
INVALID_BRANCH_1: "プラグインのバージョンが無効です(ブランチが設定されていません)。"
INVALID_BRANCH_2: "続行するには、プロジェクトブランチを「開発」に設定します。"
INVALID_BRANCH_3: "開発コードを実行すると、データが破損する可能性があります。"
INVALID_CONTAINER: "最初に有効なコンテナを調べてください。"
INVALID_CONTAINER: "最初に有効な貨物ブロックを調べてください。"
INVALID_DONATION_KEY: "寄付キーが無効です。"
INVALID_INCLUDE: "「」{0}\" は無効な値です。"
INVALID_INCLUDE: "「{0}」は無効な値です。"
INVALID_INCLUDE_COMBO: "これは無効な型の組み合わせです。"
INVALID_RADIUS: "有効な半径を入力してください。"
INVALID_SELECTION: "{0} 選択が見つかりません。"
INVALID_USERNAME: "「」{0}\" は無効なユーザー名です。"
INVALID_USERNAME: "「{0}」は無効なユーザー名です。"
INVALID_WORLD: "有効なワールドを指定してください。"
LATEST_VERSION: "最新バージョン: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "ダウンロード:{0}"
LINK_DOWNLOAD: "ダウンロード: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "ブロック名:{0}"
LINK_WIKI_ENTITY: "エンティティ名:{0}"
LINK_WIKI_BLOCK: "ブロック名: {0}"
LINK_WIKI_ENTITY: "エンティティ名: {0}"
LOGGING_ITEMS: "{0} ログに残されたアイテム。お待ちください..."
LOGGING_TIME_LIMIT: "ロギングの制限時間に達しました。データを破棄してシャットダウンします。"
LOGGING_TIME_LIMIT: "記録制限時間に達しました。データを破棄してシャットダウンします。"
LOOKUP_BLOCK: "{0} {配置|壊れた} {1}。"
LOOKUP_CONTAINER: "{0} {追加|削除} {1} {2}。"
LOOKUP_HEADER: "{0} 結果"
@@ -112,20 +112,20 @@ LOOKUP_ITEM: "{0} {拾った|落とした} {1} {2}。"
LOOKUP_LOGIN: "{0} ログに記録されます {in|out}。"
LOOKUP_PAGE: "ページ {0}"
LOOKUP_PROJECTILE: "{0} {投げた|ショット} {1} {2}。"
LOOKUP_ROWS_FOUND: "{0} {行|行} 見つかった。"
LOOKUP_ROWS_FOUND: "{0} {行|行} 見つかりました。"
LOOKUP_SEARCHING: "ルックアップ検索。お待ちください..."
LOOKUP_STORAGE: "{0} {預け入れ|撤回} {1} {2}。"
LOOKUP_TIME: "{0} 前に"
LOOKUP_USERNAME: "{0} としてログイン {1}。"
LOOKUP_USERNAME: "{1}が{0}としてログイン"
MAXIMUM_RADIUS: "最大 {ルックアップ|ロールバック|復元} 半径は {0}。"
MISSING_ACTION_USER: "そのアクションを使用するには、ユーザーを指定してください。"
MISSING_LOOKUP_TIME: "時間を指定してください {ルックアップ|ロールバック|復元}。"
MISSING_LOOKUP_USER: "ユーザーを指定するか、 {ブロック|半径}。"
MISSING_PARAMETERS: "使ってください \"{0}\" 。"
MISSING_LOOKUP_TIME: "時間を指定してください({ルックアップ|ロールバック|復元})"
MISSING_LOOKUP_USER: "ユーザーを指定するか、 {ブロック|半径}を指定してください。"
MISSING_PARAMETERS: "\"{0}\"のパラメーターは存在していません。"
MISSING_ROLLBACK_RADIUS: "指定しませんでした {ロールバック|復元} 半径。"
MISSING_ROLLBACK_USER: "指定しませんでした {ロールバック|復元} ユーザー。"
MYSQL_UNAVAILABLE: "接続できません MySQL サーバ。"
NO_DATA: "でデータが見つかりません {0}。"
NO_DATA: "{0}でデータが見つかりません。"
NO_DATA_LOCATION: "番号 {データ|トランザクション|相互作用|メッセージ} 見つかった。"
NO_PERMISSION: "あなたにはそれをする許可がありません。"
NO_RESULTS: "結果が見つかりません。"
@@ -133,7 +133,7 @@ NO_RESULTS_PAGE: "番号 {結果|データ} そのページで見つかりまし
NO_ROLLBACK: "番号 {保留中|前へ} ロールバック/復元が見つかりました。"
PATCH_INTERRUPTED: "アップグレードが中断されました。再起動時に再試行します。"
PATCH_OUTDATED_1: "古いデータベースをアップグレードできません {0}。"
PATCH_OUTDATED_2: "サポートされているバージョンでアップグレードしてください CoreProtect。"
PATCH_OUTDATED_2: "CoreProtectがサポートされているバージョンでアップグレードしてください。"
PATCH_PROCESSING: "新しいデータを処理しています。お待ちください..."
PATCH_SKIP_UPDATE: "スキップ {テーブル|インデックス} {更新|作成|削除} の上 {0}。"
PATCH_STARTED: "実行する {0} アップグレード。お待ちください..."
@@ -145,24 +145,24 @@ PREVIEW_CANCELLING: "プレビューをキャンセルしています..."
PREVIEW_IN_GAME: "ゲーム内でのみロールバックをプレビューできます。"
PREVIEW_TRANSACTION: "プレビューできません {コンテナ|在庫} トランザクション。"
PURGE_ABORTED: "パージに失敗しました。データベースが破損している可能性があります。"
PURGE_ERROR: "処理できません {0} データ!"
PURGE_ERROR: "{0} のデータを処理できません"
PURGE_FAILED: "パージに失敗しました。後でもう一度やり直してください。"
PURGE_IN_PROGRESS: "進行中のパージ。後でもう一度やり直してください。"
PURGE_MINIMUM_TIME: "パージできるのは、より古いデータのみです。 {0} {日|時間}。"
PURGE_MINIMUM_TIME: "分離できるのは、より古いデータのみです。({0}{日|時間})"
PURGE_NOTICE_1: "これには時間がかかる場合がありますのでご注意ください。"
PURGE_NOTICE_2: "完了するまでサーバーを再起動しないでください。"
PURGE_OPTIMIZING: "データベースの最適化。お待ちください..."
PURGE_PROCESSING: "処理 {0} データ..."
PURGE_PROCESSING: "{0} のデータを処理中..."
PURGE_REPAIRING: "修復しようとしています。これには時間がかかる場合があります..."
PURGE_ROWS: "{0} {行|行} 削除されたデータの。"
PURGE_STARTED: "データの削除は \"で開始されました{0}\" 。"
PURGE_SUCCESS: "データのパージに成功しました。"
PURGE_ROWS: "{0}{行|行} のデータが削除されました。"
PURGE_STARTED: "データの削除は\"{0}\"で開始されました。"
PURGE_SUCCESS: "データの分離に成功しました。"
RELOAD_STARTED: "構成の再読み込み-しばらくお待ちください。"
RELOAD_SUCCESS: "構成が正常に再ロードされました。"
ROLLBACK_ABORTED: "ロールバックまたは復元が中止されました。"
ROLLBACK_CHUNKS_FOUND: "見つかった {0} {チャンク|チャンク} 変更します。"
ROLLBACK_CHUNKS_MODIFIED: "変更 {0}/{1} {チャンク|チャンク}。"
ROLLBACK_COMPLETED: "{ロールバック|復元|プレビュー} 「のために完成{0}\" 。"
ROLLBACK_COMPLETED: "{ロールバック|復元|プレビュー} のために完成{0}\" 。"
ROLLBACK_EXCLUDED_USERS: "除外 {ユーザー|ユーザー}: \"{0}\" 。"
ROLLBACK_INCLUDE: "{含まれる|除外される} {ブロック|エンティティ|ターゲット} {タイプ|タイプ}: \"{0}\" 。"
ROLLBACK_IN_PROGRESS: "ロールバック/復元はすでに進行中です。"
@@ -172,14 +172,14 @@ ROLLBACK_RADIUS: "半径:{0} {ブロック|ブロック}。"
ROLLBACK_SELECTION: "半径を「{0}\" 。"
ROLLBACK_STARTED: "{ロールバック|復元|プレビュー} 「で始まった{0}\" 。"
ROLLBACK_TIME: "時間範囲:{0}。"
ROLLBACK_WORLD_ACTION: "に制限 {世界|アクション} 「」{0}\" 。"
ROLLBACK_WORLD_ACTION: "{0}{世界|アクション}に制限があります。"
SIGN_HEADER: "メッセージに署名する"
STATUS_CONSUMER: "消費者: {0} {item|items} 順番待ち。"
STATUS_DATABASE: "データベース: 使用する {0}。"
STATUS_INTEGRATION: "{0}: 統合 {有効|無効}。"
STATUS_DATABASE: "データベース: 使用する {0}"
STATUS_INTEGRATION: "{0}: 統合 {有効|無効}"
STATUS_LICENSE: "ライセンス: {0}"
STATUS_VERSION: "バージョン: {0}"
TELEPORTED: "にテレポート {0}。"
TELEPORTED: "{0} にテレポート"
TELEPORTED_SAFETY: "安全にテレポートしました。"
TELEPORT_PLAYERS: "テレポートコマンドはプレイヤーだけが使用できます。"
TIME_DAYS: "{0} {日|日}"
@@ -189,13 +189,13 @@ TIME_SECONDS: "{0} {秒|秒}"
TIME_WEEKS: "{0} {週|週}"
UPDATE_ERROR: "更新の確認中にエラーが発生しました。"
UPDATE_HEADER: "{0} アップデート"
UPDATE_NOTICE: "知らせ:{0} 現在利用できます。"
UPDATE_NOTICE: "お知らせ: {0} が現在利用できます。"
UPGRADE_IN_PROGRESS: "アップグレードが進行中です。後でもう一度やり直してください。"
USER_NOT_FOUND: "ユーザー \"{0}\" 見つかりません。"
USER_OFFLINE: "ユーザー \"{0}\" はオンラインではありません。"
USING_MYSQL: "使用する MySQL データストレージ用。"
USING_SQLITE: "使用する SQLite データストレージ用。"
VALID_DONATION_KEY: "有効な寄付キー。"
VERSION_NOTICE: "バージョン {0} 現在利用できます。"
USING_MYSQL: "MySQL データストレージを使用します。"
USING_SQLITE: "SQLite データストレージを使用します。"
VALID_DONATION_KEY: "有効な寄付キーが必要です。"
VERSION_NOTICE: "バージョン {0} が現在利用できます。"
VERSION_REQUIRED: "{0} {1} 以上が必要です。"
WORLD_NOT_FOUND: "世界 \"{0}\" 見つかりません。"
WORLD_NOT_FOUND: "世界 \"{0}\" は見つかりませんでした。"
+203
View File
@@ -0,0 +1,203 @@
# CoreProtect Language File (ko)
ACTION_NOT_SUPPORTED: "해당 명령어는 해당 작업을 지원하지 않습니다."
AMOUNT_BLOCK: "{0} {블록|블록}"
AMOUNT_CHUNK: "{0} {청크|청크}"
AMOUNT_ENTITY: "{0} {엔티티|엔티티}"
AMOUNT_ITEM: "{0} {항목|항목}"
API_TEST: "API 테스트가 성공했습니다."
CACHE_ERROR: "경고: {0} 캐시를 검증하는 중 오류가 발생했습니다."
CACHE_RELOAD: "데이터베이스에서 {매핑|월드} 캐시를 강제로 다시 로드합니다."
CHECK_CONFIG: "config.yml을 확인하세요"
COMMAND_CONSOLE: "콘솔에서 명령어를 실행하세요."
COMMAND_NOT_FOUND: "\"{0}\" 명령어를 찾을 수 없습니다."
COMMAND_THROTTLED: "잠시 기다렸다가 다시 시도하십시오."
CONSUMER_ERROR: "소비자 대기열 처리가 이미 {일시 중지|재개}되있습니다!"
CONSUMER_TOGGLED: "소비자 대기열 처리가 {일시 중지|재개}되었습니다."
CONTAINER_HEADER: "컨테이너 기록"
DATABASE_BUSY: "데이터베이스가 사용 중입니다. 나중에 다시 시도하십시오."
DATABASE_INDEX_ERROR: "데이터베이스 인덱스의 유효성을 검사할 수 없습니다."
DATABASE_LOCKED_1: "데이터베이스가 잠겼습니다. 최대 15초 대기 중..."
DATABASE_LOCKED_2: "데이터베이스가 이미 사용 중입니다. 다시 시도하십시오."
DATABASE_LOCKED_3: "데이터베이스 잠금을 비활성화하려면 \"database-lock: false\"로 설정하세요."
DATABASE_LOCKED_4: "데이터베이스 잠금을 비활성화하면 데이터가 손상될 수 있습니다."
DATABASE_UNREACHABLE: "데이터베이스에 연결할 수 없습니다. 데이터를 삭제하고 종료합니다."
DEVELOPMENT_BRANCH: "개발 브랜치가 감지되어 패치 스크립트를 건너뜁니다."
DIRT_BLOCK: "당신 아래에 흙 블록을 설치했습니다."
DISABLE_SUCCESS: "성공! {0} 비활성화됨"
ENABLE_FAILED: "{0}을(를) 시작할 수 없습니다."
ENABLE_SUCCESS: "{0}이(가) 성공적으로 활성화되었습니다!"
ENJOY_COREPROTECT: "{0}을(를) 사용중이신가요? Discord 서버에 참여해보세요!"
FINISHING_CONVERSION: "데이터 변환을 완료하는 중입니다. 잠시 기다려 주세요..."
FINISHING_LOGGING: "데이터 로깅을 완료하는 중입니다. 잠시 기다려 주십시오..."
FIRST_VERSION: "초기 DB: {0}"
GLOBAL_LOOKUP: "전체 조회를 수행하려면 반경을 지정하지 마세요."
GLOBAL_ROLLBACK: "전역 {롤백|복원}을 수행하려면 \"{0}\"을(를) 사용하세요."
HELP_ACTION_1: "특정 작업으로 조회를 제한합니다."
HELP_ACTION_2: "예: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a :kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "해당 명령어에 대한 추가 정보를 표시합니다."
HELP_EXCLUDE_1: "블록/사용자를 제외합니다."
HELP_EXCLUDE_2: "예: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} 도움말"
HELP_INCLUDE_1: "특정 블록/엔티티를 포함합니다."
HELP_INCLUDE_2: "예: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "로그 조사가 활성화되면 다음을 수행할 수 있습니다:"
HELP_INSPECT_2: "누가 그 블록을 설치했는지 보려면 블록을 마우스 왼쪽 버튼으로 클릭하세요."
HELP_INSPECT_3: "블록을 마우스 오른쪽 버튼으로 클릭하면 인접한 블록이 깨졌는지 확인할 수 있습니다."
HELP_INSPECT_4: "블록을 배치하여 해당 위치에서 어떤 블록이 깨졌는지 확인하세요."
HELP_INSPECT_5: "누가 설치했는지 확인하려면 액체(등)에 블록을 배치하세요."
HELP_INSPECT_6: "문, 상자 등을 마우스 오른쪽 버튼으로 클릭하면 누가 마지막으로 사용했는지 확인할 수 있습니다."
HELP_INSPECT_7: "팁: 더 빠른 액세스를 위해 \"/co i\"명령어를 사용할 수 있습니다."
HELP_INSPECT_COMMAND: "블록 로그 조사를 켜거나 끕니다."
HELP_LIST: "모든 명령어 목록을 표시합니다."
HELP_LOOKUP_1: "명령어 단축키."
HELP_LOOKUP_2: "로그를 보려면 블록을 검사한 후 사용하세요."
HELP_LOOKUP_COMMAND: "고급 블록 데이터 조회."
HELP_NO_INFO: "\"{0}\" 명령어에 대한 정보를 찾을 수 없습니다."
HELP_PARAMETER: "자세한 매개변수 정보는 \"{0}\"을 참조하세요."
HELP_PARAMS_1: "{조회|롤백|복원}을(를) 수행하세요."
HELP_PARAMS_2: "{조회|롤백|복원}할 사용자를 지정하세요."
HELP_PARAMS_3: "{조회|롤백|복원}에 걸리는 시간을 지정하세요."
HELP_PARAMS_4: "{조회|롤백|복원}을(를) 제한할 반경 영역을 지정하세요."
HELP_PARAMS_5: "{조회|롤백|복원}을(를) 특정 작업으로 제한합니다."
HELP_PARAMS_6: "{조회|롤백|복원}에 특정 블록/엔티티를 포함합니다."
HELP_PARAMS_7: "{조회|롤백|복원}에서 블록/사용자를 제외합니다."
HELP_PURGE_1: "지정된 시간보다 오래된 데이터를 삭제합니다."
HELP_PURGE_2: "예를 들어 \"{0}\"은(는) 한 달이 지난 모든 데이터를 삭제하고 지난 30일 동안의 데이터만 보관합니다."
HELP_PURGE_COMMAND: "오래된 블록 데이터를 삭제합니다."
HELP_RADIUS_1: "반경 영역을 지정하세요."
HELP_RADIUS_2: "예: [r:10] (10블록 이내에서만 변경하세요.)"
HELP_RELOAD_COMMAND: "구성 파일을 다시 로드합니다."
HELP_RESTORE_COMMAND: "블록 데이터를 복원합니다."
HELP_ROLLBACK_COMMAND: "블록 데이터를 롤백합니다."
HELP_STATUS: "플러그인 상태 및 버전 정보를 확인하세요."
HELP_STATUS_COMMAND: "플러그인 상태를 표시합니다."
HELP_TELEPORT: "특정 위치로 순간이동합니다."
HELP_TIME_1: "조회 시간을 지정하세요."
HELP_TIME_2: "예: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "조회할 사용자를 지정하세요."
HELP_USER_2: "예: [u:notch], [u:notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\"은(는) 해당 작업과 함께 사용할 수 없습니다."
INSPECTOR_ERROR: "로그 조사가 이미 {활성화|비활성화}되있습니다!"
INSPECTOR_TOGGLED: "로그 조사가 {활성화|비활성화}되었습니다."
INTEGRATION_ERROR: "{0} 로깅을 {초기화|비활성화}할 수 없습니다."
INTEGRATION_SUCCESS: "{0} 로깅이 성공적으로 {초기화|비활성화}되었습니다."
INTEGRATION_VERSION: "잘못된 {0} 버전이 발견되었습니다."
INTERACTIONS_HEADER: "플레이어 상호작용"
INVALID_ACTION: "유효하지 않은 작업입니다."
INVALID_BRANCH_1: "잘못된 플러그인 버전(브랜치가 설정되지 않음)."
INVALID_BRANCH_2: "계속하려면 프로젝트 브랜치를 \"development\"로 설정하세요."
INVALID_BRANCH_3: "개발 코드를 실행하면 데이터 손상이 발생할 수 있습니다."
INVALID_CONTAINER: "먼저 유효한 컨테이너를 검사하세요."
INVALID_DONATION_KEY: "잘못된 후원 키입니다."
INVALID_INCLUDE: "\"{0}\"은(는) 잘못된 블록/엔티티 이름입니다."
INVALID_INCLUDE_COMBO: "잘못된 블록/엔티티 조합입니다."
INVALID_RADIUS: "유효한 반경을 입력하세요."
INVALID_SELECTION: "{0} 선택을 찾을 수 없습니다."
INVALID_USERNAME: "\"{0}\"은(는) 잘못된 사용자 이름입니다."
INVALID_WORLD: "유효한 월드를 지정하세요."
LATEST_VERSION: "최신 버전: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "다운로드: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "블록 이름: {0}"
LINK_WIKI_ENTITY: "엔티티 이름: {0}"
LOGGING_ITEMS: "{0} 아이템이 남았습니다. 잠시만 기다려 주세요..."
LOGGING_TIME_LIMIT: "로깅 시간 제한에 도달했습니다. 데이터를 폐기하고 종료합니다."
LOOKUP_BLOCK: "{0}이(가) {1}을(를) {설치|파괴}했습니다."
LOOKUP_CONTAINER: "{0}이(가) {2}에서 {1}을(를) {추가|제거}했습니다."
LOOKUP_HEADER: "{0} 조회 결과"
LOOKUP_INTERACTION: "{0}이(가) {1}을(를) {클릭|처치}했습니다."
LOOKUP_ITEM: "{0}이(가) {2}에서 {1}을(를) {획득|드롭}했습니다."
LOOKUP_LOGIN: "{0}이(가) {로그인|로그아웃}했습니다."
LOOKUP_PAGE: "페이지 {0}"
LOOKUP_PROJECTILE: "{0}이(가) {2}에서 {1}을(를) {던졌|발사했}습니다.."
LOOKUP_ROWS_FOUND: "{0} {열|열}이 발견되었습니다."
LOOKUP_SEARCHING: "조회 중입니다. 잠시만 기다려 주세요..."
LOOKUP_STORAGE: "{0}이(가) {2}에서 {1}을(를) {추가|제거}했습니다."
LOOKUP_TIME: "{0} 전"
LOOKUP_USERNAME: "{0}이(가) {1}으로 로그인했습니다."
MAXIMUM_RADIUS: "최대 {조회|롤백|복원} 반경은 {0}입니다."
MISSING_ACTION_USER: "해당 작업을 사용하려면 사용자를 지정하세요."
MISSING_LOOKUP_TIME: "{조회|롤백|복원}할 시간을 지정하세요."
MISSING_LOOKUP_USER: "조회할 사용자 또는 {블록|반경}을 지정하세요."
MISSING_PARAMETERS: "\"{0}\"을(를) 사용하세요."
MISSING_ROLLBACK_RADIUS: "{롤백|복원} 반경을 지정하지 않았습니다."
MISSING_ROLLBACK_USER: "{롤백|복원} 사용자를 지정하지 않았습니다."
MYSQL_UNAVAILABLE: "MySQL 서버에 연결할 수 없습니다."
NETWORK_CONNECTION: "{0} 연결 {성공|실패}. {1} {2} 사용 중."
NETWORK_TEST: "네트워크 테스트 데이터가 성공적으로 전송되었습니다."
NO_DATA: "{0}에서 데이터를 찾을 수 없습니다."
NO_DATA_LOCATION: "해당 위치에서 {데이터|거래|상호작용|메시지}(을)를 찾을 수 없습니다."
NO_PERMISSION: "해당 작업을 수행할 권한이 없습니다."
NO_RESULTS: "결과를 찾을 수 없습니다."
NO_RESULTS_PAGE: "해당 페이지에 대한 {결과|데이터}를 찾을 수 없습니다."
NO_ROLLBACK: "{보류 중인|이전} 롤백/복원을 찾을 수 없습니다."
PATCH_INTERRUPTED: "업그레이드가 중단되었습니다. 다시 시작할 때 재시도합니다."
PATCH_OUTDATED_1: "{0}보다 오래된 데이터베이스를 업그레이드할 수 없습니다."
PATCH_OUTDATED_2: "지원되는 CoreProtect 버전으로 업그레이드하세요."
PATCH_PROCESSING: "새 데이터를 처리 중입니다. 잠시 기다려 주세요..."
PATCH_SKIP_UPDATE: "{0}에서 {테이블|인덱스} {업데이트|생성|제거}를 건너뜁니다."
PATCH_STARTED: "{0} 업그레이드를 수행 중입니다. 잠시 기다려 주세요..."
PATCH_SUCCESS: "{0}으로 성공적으로 업그레이드되었습니다."
PATCH_UPGRADING: "데이터베이스 업그레이드가 진행 중입니다. 잠시 기다려 주세요..."
PLEASE_SELECT: "다음을 선택하세요: \"{0}\" 또는 \"{1}\"."
PREVIEW_CANCELLED: "미리보기가 취소되었습니다."
PREVIEW_CANCELLING: "미리보기 취소 중..."
PREVIEW_IN_GAME: "롤백을 미리보려면 게임 내에서만 가능합니다."
PREVIEW_TRANSACTION: "{컨테이너|인벤토리} 기록을 미리볼 수 없습니다."
PURGE_ABORTED: "삭제 실패. 데이터베이스가 손상되었을 수 있습니다."
PURGE_ERROR: "{0} 데이터를 처리할 수 없습니다!"
PURGE_FAILED: "삭제 실패. 나중에 다시 시도하세요."
PURGE_IN_PROGRESS: "삭제가 진행 중입니다. 나중에 다시 시도하세요."
PURGE_MINIMUM_TIME: "{0} {일|시간}보다 오래된 데이터만 삭제할 수 있습니다."
PURGE_NOTICE_1: "이 작업은 시간이 걸릴 수 있습니다."
PURGE_NOTICE_2: "완료될 때까지 서버를 재시작하지 마세요."
PURGE_OPTIMIZING: "데이터베이스 최적화 중입니다. 잠시 기다려 주세요..."
PURGE_PROCESSING: "{0} 데이터를 처리 중입니다..."
PURGE_REPAIRING: "복구 시도 중입니다. 시간이 걸릴 수 있습니다..."
PURGE_ROWS: "{0} {열|열}의 데이터가 삭제되었습니다."
PURGE_STARTED: "\"{0}\"에서 데이터 삭제가 시작되었습니다."
PURGE_SUCCESS: "데이터 삭제가 성공적으로 완료되었습니다."
RELOAD_STARTED: "구성 리로드 중 - 잠시 기다려 주세요."
RELOAD_SUCCESS: "구성이 성공적으로 리로드되었습니다."
ROLLBACK_ABORTED: "롤백 또는 복원이 중단되었습니다."
ROLLBACK_CHUNKS_FOUND: "{0} {청크|청크}를 수정할 준비가 되었습니다."
ROLLBACK_CHUNKS_MODIFIED: "{1} 중 {0} {청크|청크}를 수정했습니다."
ROLLBACK_COMPLETED: "\"{0}\"에 대한 {롤백이|복원이|미리보기가} 완료되었습니다."
ROLLBACK_EXCLUDED_USERS: "제외된 {사용자|사용자}: \"{0}\"."
ROLLBACK_INCLUDE: "{포함된|제외된} {블록|엔티티|대상} {타입|타입}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "롤백/복원이 이미 진행 중입니다."
ROLLBACK_LENGTH: "소요 시간: {0} {초|초}."
ROLLBACK_MODIFIED: "{0}이(가) {수정됨|수정 중}."
ROLLBACK_RADIUS: "반경: {0} {블록|블록}."
ROLLBACK_SELECTION: "반경이 \"{0}\"로 설정되었습니다."
ROLLBACK_STARTED: "\"{0}\"에서 {롤백이|복원이|미리보기가} 시작되었습니다."
ROLLBACK_TIME: "시간 범위: {0}."
ROLLBACK_WORLD_ACTION: "{월드|작업} \"{0}\"으로 제한됨."
SIGN_HEADER: "표지판 메시지"
STATUS_CONSUMER: "소비자: 대기 중인 {0} {항목|항목들}."
STATUS_DATABASE: "데이터베이스: {0} 사용 중."
STATUS_INTEGRATION: "{0}: 통합 {활성화됨|비활성화됨}."
STATUS_LICENSE: "라이선스: {0}"
STATUS_VERSION: "버전: {0}"
TELEPORTED: "{0}(으)로 텔레포트되었습니다."
TELEPORTED_SAFETY: "안전하게 텔레포트되었습니다."
TELEPORT_PLAYERS: "텔레포트 명령어는 플레이어만 사용할 수 있습니다."
TIME_DAYS: "{0} {일|일}"
TIME_HOURS: "{0} {시간|시간}"
TIME_MINUTES: "{0} {분|분}"
TIME_SECONDS: "{0} {초|초}"
TIME_WEEKS: "{0} {주|주}"
UPDATE_ERROR: "업데이트 확인 중 오류가 발생했습니다."
UPDATE_HEADER: "{0} 업데이트"
UPDATE_NOTICE: "알림: {0}이(가) 이제 사용할 수 있습니다."
UPGRADE_IN_PROGRESS: "업그레이드가 진행 중입니다. 나중에 다시 시도하세요."
USER_NOT_FOUND: "사용자 \"{0}\"을(를) 찾을 수 없습니다."
USER_OFFLINE: "사용자 \"{0}\"이(가) 온라인 상태가 아닙니다."
USING_MYSQL: "데이터 저장에 MySQL을 사용 중입니다."
USING_SQLITE: "데이터 저장에 SQLite를 사용 중입니다."
VALID_DONATION_KEY: "유효한 후원 키입니다."
VERSION_NOTICE: "버전 {0}(를) 이제 사용할 수 있습니다."
VERSION_REQUIRED: "{0} {1} 이상이 필요합니다."
WORLD_NOT_FOUND: " \"{0}\"을(를) 찾을 수 없습니다."
+201
View File
@@ -0,0 +1,201 @@
# CoreProtect Language File (tr)
ACTION_NOT_SUPPORTED: "Bu işlem desteklenmiyor."
AMOUNT_BLOCK: "{0} {blok|bloklar}"
AMOUNT_CHUNK: "{0} {yığın|parçalar}"
AMOUNT_ENTITY: "{0} {varlık|kuruluşlar}"
AMOUNT_ITEM: "{0} {öğe|öğeler}"
API_TEST: "API testi başarılı."
CACHE_ERROR: "UYARI: Doğrulama sırasında hata {0} önbellek."
CACHE_RELOAD: "Yeniden yüklemeye zorlama {haritalama|dünya} veritabanından önbellekler."
CHECK_CONFIG: "Lütfen config.yml'yi kontrol edin"
COMMAND_CONSOLE: "Lütfen komutu konsoldan çalıştırın."
COMMAND_NOT_FOUND: "Emretmek \"{0}\" bulunamadı."
COMMAND_THROTTLED: "Lütfen biraz bekleyin ve tekrar deneyin."
CONSUMER_ERROR: "Tüketici kuyruğu işleme zaten {duraklatıldı|devam ettirildi}."
CONSUMER_TOGGLED: "Tüketici kuyruğu işleme {duraklatıldı|devam ettirildi}."
CONTAINER_HEADER: "Konteyner İşlemleri"
DATABASE_BUSY: "Veritabanı meşgul. Lütfen daha sonra tekrar deneyiniz."
DATABASE_INDEX_ERROR: "Veritabanı dizinleri doğrulanamıyor."
DATABASE_LOCKED_1: "Veritabanı kilitlendi. 15 saniyeye kadar bekleniyor..."
DATABASE_LOCKED_2: "Veritabanı zaten kullanılıyor. Lütfen tekrar deneyin."
DATABASE_LOCKED_3: "Veritabanı kilitlemeyi devre dışı bırakmak için \"veritabanı kilidi: yanlış\" olarak ayarlayın."
DATABASE_LOCKED_4: "Veritabanı kilitlemeyi devre dışı bırakmak, verilerin bozulmasına neden olabilir."
DATABASE_UNREACHABLE: "Veritabanına erişilemiyor. Verileri atma ve kapatma."
DEVELOPMENT_BRANCH: "Geliştirme dalı algılandı, yama komut dosyaları atlandı."
DIRT_BLOCK: "Altına bir toprak bloğu yerleştirdi."
DISABLE_SUCCESS: "Başarı! Engelli {0}"
ENABLE_FAILED: "{0} başlayamadı."
ENABLE_SUCCESS: "{0} şimdi etkinleştirildi!"
ENJOY_COREPROTECT: "Eğlence {0}? Bize katılın Discord!"
FINISHING_CONVERSION: "Veri dönüştürme işlemi tamamlanıyor. Lütfen bekle..."
FINISHING_LOGGING: "Veri kaydının tamamlanması. Lütfen bekle..."
FIRST_VERSION: "İlk Veri Tabanı: {0}"
GLOBAL_LOOKUP: "Genel arama yapmak için bir yarıçap belirlemeyin."
GLOBAL_ROLLBACK: "Kullanmak \"{0}\" küresel yapmak {geri alma|geri yükleme}"
HELP_ACTION_1: "Aramayı bir eylemle sınırlayın."
HELP_ACTION_2: "Örnekler: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "Ek bilgileri görüntüleyin."
HELP_EXCLUDE_1: "Blokları/kullanıcıları hariç tutun."
HELP_EXCLUDE_2: "Örnekler: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} Yardım"
HELP_INCLUDE_1: "Blokları/varlıkları dahil et."
HELP_INCLUDE_2: "Örnekler: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "Müfettiş etkinken şunları yapabilirsiniz:"
HELP_INSPECT_2: "Yerleşimi görmek için sol tıklayın."
HELP_INSPECT_3: "Bitişik kaldırmaları görmek için sağ tıklayın."
HELP_INSPECT_4: "Kaldırma işlemini görmek için bir blok yerleştirin."
HELP_INSPECT_5: "Yerleşimi görmek için sıvıya bir blok yerleştirin."
HELP_INSPECT_6: "Sandık işlemlerini görmek için sağ tıklayın."
HELP_INSPECT_7: "İpucu: Yalnızca \"/co i\" kullanabilirsiniz."
HELP_INSPECT_COMMAND: "Blok denetçisini değiştirir."
HELP_LIST: "Tüm komutların bir listesini görüntüler."
HELP_LOOKUP_1: "Komut kısayolu."
HELP_LOOKUP_2: "Ek sayfaları görüntüleyin."
HELP_LOOKUP_COMMAND: "Blok verilerini arayın."
HELP_NO_INFO: "Komut için bilgi \"{0}\" bulunamadı."
HELP_PARAMETER: "Bakınız \"{0}\" detaylı parametre bilgisi için."
HELP_PARAMS_1: "Gerçekleştir {arama|geri alma|geri yükleme}."
HELP_PARAMS_2: "Kullanıcıları belirtin {arama|geri alma|geri yükleme}."
HELP_PARAMS_3: "Zamanı belirtin {arama|geri alma|geri yükleme}."
HELP_PARAMS_4: "kısıtlamak {arama|geri alma|geri yükleme} bir yarıçapa."
HELP_PARAMS_5: "kısıtlamak {arama|geri alma|geri yükleme} bir eyleme."
HELP_PARAMS_6: "Blokları/varlıkları dahil et {arama|geri alma|geri yükleme}."
HELP_PARAMS_7: "Blokları/kullanıcıları {arama|geri alma|geri yükleme}."
HELP_PURGE_1: "Eski verileri kaldırın."
HELP_PURGE_2: "Örneğin, \"{0}\" bir aydan eski tüm verileri silecek ve yalnızca son 30 güne ait verileri tutacaktır."
HELP_PURGE_COMMAND: "Eski blok verilerini silin."
HELP_RADIUS_1: "Bir yarıçap alanı belirtin."
HELP_RADIUS_2: "Örnekler: [r:10] (Sadece 10 blok içinde değişiklik yapın)"
HELP_RELOAD_COMMAND: "Yapılandırma dosyasını yeniden yükler."
HELP_RESTORE_COMMAND: "Blok verilerini geri yükleyin."
HELP_ROLLBACK_COMMAND: "Geri alma blok verileri."
HELP_STATUS: "Eklenti durumunu görüntüleyin."
HELP_STATUS_COMMAND: "Eklenti durumunu görüntüler."
HELP_TELEPORT: "Işınlanma."
HELP_TIME_1: "Zamanı belirtin."
HELP_TIME_2: "Örnekler: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "Kullanıcıları belirtin."
HELP_USER_2: "Örnekler: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" bu eylemle kullanılamaz."
INSPECTOR_ERROR: "Müfettiş zaten {etkin|devre dışı}."
INSPECTOR_TOGGLED: "Müfettiş şimdi {etkin|devre dışı}."
INTEGRATION_ERROR: "Olanaksız {başlat|devre dışı bırak} {0} Kerestecilik."
INTEGRATION_SUCCESS: "{0} başarıyla giriş yapmak {başlatıldı|devre dışı}."
INTEGRATION_VERSION: "Geçersiz {0} sürüm bulundu."
INTERACTIONS_HEADER: "Oyuncu Etkileşimleri"
INVALID_ACTION: "Bu geçerli bir eylem değil."
INVALID_BRANCH_1: "Geçersiz eklenti sürümü (dal ayarlanmadı)."
INVALID_BRANCH_2: "Devam etmek için proje dalını \"geliştirme\" olarak ayarlayın."
INVALID_BRANCH_3: "Geliştirme kodunu çalıştırmak, verilerin bozulmasına neden olabilir."
INVALID_CONTAINER: "Lütfen önce geçerli bir kapsayıcıyı inceleyin."
INVALID_DONATION_KEY: "Geçersiz bağış anahtarı."
INVALID_INCLUDE: "\"{0}\" geçersiz bir değerdir."
INVALID_INCLUDE_COMBO: "Bu geçersiz bir tür birleşimidir."
INVALID_RADIUS: "Lütfen geçerli bir yarıçap girin."
INVALID_SELECTION: "{0} seçim bulunamadı."
INVALID_USERNAME: "\"{0}\" geçersiz bir kullanıcı adıdır."
INVALID_WORLD: "Lütfen geçerli bir dünya belirtin."
LATEST_VERSION: "En son sürüm: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "İndirmek: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "Blok İsimleri: {0}"
LINK_WIKI_ENTITY: "Varlık Adları: {0}"
LOGGING_ITEMS: "{0} günlüğe bırakılan öğeler. Lütfen bekle..."
LOGGING_TIME_LIMIT: "Günlüğe kaydetme zaman sınırına ulaşıldı. Verileri atma ve kapatma."
LOOKUP_BLOCK: "{0} {yerleştirilmiş|kırıldı} {1}."
LOOKUP_CONTAINER: "{0} {eklendi|kaldırıldı} {1} {2}."
LOOKUP_HEADER: "{0} Sonuçlar"
LOOKUP_INTERACTION: "{0} {tıklandı|öldürüldü} {1}."
LOOKUP_ITEM: "{0} {aldı|bıraktı} {1} {2}."
LOOKUP_LOGIN: "{0} günlüğe kaydedildi {içeri|dışarı}."
LOOKUP_PAGE: "Sayfa {0}"
LOOKUP_PROJECTILE: "{0} {fırlattı|vuruş} {1} {2}."
LOOKUP_ROWS_FOUND: "{0} {satır|satır} kurmak."
LOOKUP_SEARCHING: "Arama arama. Lütfen bekle..."
LOOKUP_STORAGE: "{0} {yatırıldı|geri çekildi} {1} {2}."
LOOKUP_TIME: "{0} evvel"
LOOKUP_USERNAME: "{0} olarak giriş yaptı {1}."
MAXIMUM_RADIUS: "Maksimum {arama|geri alma|geri yükleme} yarıçap {0}."
MISSING_ACTION_USER: "Bu eylemi kullanmak için lütfen bir kullanıcı belirtin."
MISSING_LOOKUP_TIME: "Lütfen zamanı belirtin {arama|geri alma|geri yükleme}."
MISSING_LOOKUP_USER: "Lütfen bir kullanıcı belirtin veya {blok|yarıçap}."
MISSING_PARAMETERS: "Lütfen kullan \"{0}\"."
MISSING_ROLLBACK_RADIUS: "bir belirtmemişsin {geri alma|geri yükleme} yarıçap."
MISSING_ROLLBACK_USER: "bir belirtmemişsin {geri alma|geri yükleme} kullanıcı."
MYSQL_UNAVAILABLE: "Bağlantı kurulamıyor MySQL sunucu."
NO_DATA: "şurada veri bulunamadı {0}."
NO_DATA_LOCATION: "Numara {veri|işlemler|etkileşimler|mesajlar} kurmak."
NO_PERMISSION: "Bunu yapmaya iznin yok."
NO_RESULTS: "Sonuç bulunamadı."
NO_RESULTS_PAGE: "Numara {sonuçlar|veri} o sayfa için bulundu."
NO_ROLLBACK: "Numara {beklemede|önceki} geri alma/geri yükleme bulundu."
PATCH_INTERRUPTED: "Yükseltme kesintiye uğradı. Yeniden başlatıldığında tekrar deneyecek."
PATCH_OUTDATED_1: "Daha eski veritabanları yükseltilemiyor {0}."
PATCH_OUTDATED_2: "Lütfen desteklenen bir sürümle yükseltin CoreProtect."
PATCH_PROCESSING: "Yeni veriler işleniyor. Lütfen bekle..."
PATCH_SKIP_UPDATE: "Atlama {tablo|dizin} {güncelleme|oluşturma|kaldırma} üzerinde {0}."
PATCH_STARTED: "performans {0} Yükselt. Lütfen bekle..."
PATCH_SUCCESS: "Başarıyla yükseltildi {0}."
PATCH_UPGRADING: "Veritabanı yükseltmesi devam ediyor. Lütfen bekle..."
PLEASE_SELECT: "Lütfen seçin: \"{0}\" veya \"{1}\"."
PREVIEW_CANCELLED: "Önizleme iptal edildi."
PREVIEW_CANCELLING: "Önizleme iptal ediliyor..."
PREVIEW_IN_GAME: "Geri almaları yalnızca oyun içinde önizleyebilirsiniz."
PREVIEW_TRANSACTION: "önizleme yapamazsınız {konteyner|envanter} işlemler."
PURGE_ABORTED: "Temizleme başarısız oldu. Veritabanı bozuk olabilir."
PURGE_ERROR: "işlenemiyor {0} veri!"
PURGE_FAILED: "Temizleme başarısız oldu. Lütfen daha sonra tekrar deneyiniz."
PURGE_IN_PROGRESS: "Temizleme işlemi devam ediyor. Lütfen daha sonra tekrar deneyiniz."
PURGE_MINIMUM_TIME: "Yalnızca şu tarihten daha eski verileri temizleyebilirsiniz: {0} {gün|saat}."
PURGE_NOTICE_1: "Lütfen bunun biraz zaman alabileceğini unutmayın."
PURGE_NOTICE_2: "Tamamlanana kadar sunucunuzu yeniden başlatmayın."
PURGE_OPTIMIZING: "Veritabanını optimize etme. Lütfen bekle..."
PURGE_PROCESSING: "İşleme {0} veri..."
PURGE_REPAIRING: "Tamir etmeye çalışmak. Bu biraz zaman alabilir..."
PURGE_ROWS: "{0} {satır|satır} silinen veriler."
PURGE_STARTED: "Veri temizleme başladı \"{0}\"."
PURGE_SUCCESS: "Veri temizleme başarılı."
RELOAD_STARTED: "Yapılandırma yeniden yükleniyor - lütfen bekleyin."
RELOAD_SUCCESS: "Yapılandırma başarıyla yeniden yüklendi."
ROLLBACK_ABORTED: "Geri alma veya geri yükleme iptal edildi."
ROLLBACK_CHUNKS_FOUND: "Kurmak {0} {yığın|parçalar} düzenlemek."
ROLLBACK_CHUNKS_MODIFIED: "Değiştirilmiş {0}/{1} {yığın|parçalar}."
ROLLBACK_COMPLETED: "{Geri Alma|Geri Yükleme|Önizleme} için tamamlandı \"{0}\"."
ROLLBACK_EXCLUDED_USERS: "Hariç tutulan {kullanıcı|kullanıcılar}: \"{0}\"."
ROLLBACK_INCLUDE: "{Dahil|Hariç} {blok|varlık|hedef} {tip|tür}: \"{0}\"."
ROLLBACK_IN_PROGRESS: "Halihazırda bir geri alma/geri yükleme işlemi devam ediyor."
ROLLBACK_LENGTH: "Geçen süre: {0} {saniye|saniye}."
ROLLBACK_MODIFIED: "{Değiştirildi|Değiştiriliyor} {0}."
ROLLBACK_RADIUS: "yarıçap: {0} {blok|bloklar}."
ROLLBACK_SELECTION: "Yarıçap \" olarak ayarlandı{0}\"."
ROLLBACK_STARTED: "{Geri Alma|Geri Yükleme|Önizleme} başladı \"{0}\"."
ROLLBACK_TIME: "Zaman aralığı: {0}."
ROLLBACK_WORLD_ACTION: "Sınırlı {dünya|eylem} \"{0}\"."
SIGN_HEADER: "Mesajları İmzala"
STATUS_CONSUMER: "Tüketici: {0} {öğe|öğeler} sırada."
STATUS_DATABASE: "Veri tabanı: kullanma {0}."
STATUS_INTEGRATION: "{0}: Entegrasyon {etkin|devre dışı}."
STATUS_LICENSE: "Lisans: {0}"
STATUS_VERSION: "Sürüm: {0}"
TELEPORTED: "Işınlandı {0}."
TELEPORTED_SAFETY: "Sizi emniyete ışınladım."
TELEPORT_PLAYERS: "Teleport komutu sadece oyuncular tarafından kullanılabilir."
TIME_DAYS: "{0} {gün|gün}"
TIME_HOURS: "{0} {saat|saat}"
TIME_MINUTES: "{0} {dakika|dakika}"
TIME_SECONDS: "{0} {saniye|saniye}"
TIME_WEEKS: "{0} {hafta|hafta}"
UPDATE_ERROR: "Güncellemeler kontrol edilirken bir hata oluştu."
UPDATE_HEADER: "{0} Güncelleme"
UPDATE_NOTICE: "Fark etme: {0} şimdi kullanılabilir."
UPGRADE_IN_PROGRESS: "Yükseltme devam ediyor. Lütfen daha sonra tekrar deneyiniz."
USER_NOT_FOUND: "kullanıcı \"{0}\" bulunamadı."
USER_OFFLINE: "Kullanıcı \"{0}\" çevrimiçi değil."
USING_MYSQL: "kullanma MySQL veri depolama için."
USING_SQLITE: "kullanma SQLite veri depolama için."
VALID_DONATION_KEY: "Geçerli bağış anahtarı."
VERSION_NOTICE: "sürüm {0} şimdi kullanılabilir."
VERSION_REQUIRED: "{0} {1} veya daha yüksek gereklidir."
WORLD_NOT_FOUND: "Dünya \"{0}\" bulunamadı."
+7 -7
View File
@@ -10,11 +10,11 @@ API_TEST: "API 测试成功。"
CACHE_ERROR: "警告: 验证缓存 {0} 时出错。"
CACHE_RELOAD: "正在强制从数据库中重新加载{映射|世界}的缓存。"
CHECK_CONFIG: "请检查 config.yml 文件"
COMMAND_CONSOLE: "请从控制台运行命令。"
COMMAND_CONSOLE: "请在控制台中运行此命令。"
COMMAND_NOT_FOUND: "找不到命令 \"{0}\""
COMMAND_THROTTLED: "请稍等片刻,然后重试。"
CONSUMER_ERROR: "消费者队列处理已经 {暂停|继续}."
CONSUMER_TOGGLED: "消费者队列处理已 {暂停|继续}."
CONSUMER_ERROR: "数据处理队列已经{暂停|恢复}。"
CONSUMER_TOGGLED: "数据处理队列现已{暂停|恢复}。"
CONTAINER_HEADER: "容器物品变更记录"
DATABASE_BUSY: "数据库繁忙,请稍后重试。"
DATABASE_INDEX_ERROR: "无法验证数据库索引。"
@@ -112,7 +112,7 @@ LOOKUP_INTERACTION: "{0} {点击|击杀} {1}."
LOOKUP_ITEM: "{0} {拾起|丢弃} {1} {2}."
LOOKUP_LOGIN: "{0} {登入|离开}."
LOOKUP_PAGE: "第 {0} 页"
LOOKUP_PROJECTILE: "{0} {扔|射} {1} {2}."
LOOKUP_PROJECTILE: "{0} {扔出|发射} {1} {2}."
LOOKUP_ROWS_FOUND: "已找到 {0}{行|行}。"
LOOKUP_SEARCHING: "正在搜索,请稍等..."
LOOKUP_STORAGE: "{0} {放入|取出} {1} {2}."
@@ -144,7 +144,7 @@ PLEASE_SELECT: "请选择: \"{0}\"或\"{1}\"。"
PREVIEW_CANCELLED: "预览已取消。"
PREVIEW_CANCELLING: "正在取消预览..."
PREVIEW_IN_GAME: "你只能在游戏中预览回滚操作。"
PREVIEW_TRANSACTION: "您无法预览 {集装箱|库存} 交易。"
PREVIEW_TRANSACTION: "你不能预览{容器|背包}物品交换。"
PURGE_ABORTED: "清除失败,数据库可能已损坏。"
PURGE_ERROR: "无法处理 {0} 数据!"
PURGE_FAILED: "数据清除失败,请稍后再试。"
@@ -193,10 +193,10 @@ UPDATE_HEADER: "{0} 更新"
UPDATE_NOTICE: "注意: {0} 现在可用。"
UPGRADE_IN_PROGRESS: "正在进行升级,请稍后再试。"
USER_NOT_FOUND: "玩家\"{0}\"未找到。"
USER_OFFLINE: "用户 \"{0}\"不在线。"
USER_OFFLINE: "玩家\"{0}\"不在线。"
USING_MYSQL: "使用 MySQL 用于数据存储。"
USING_SQLITE: "使用 SQLite 用于数据存储。"
VALID_DONATION_KEY: "有效的捐赠密钥。"
VERSION_NOTICE: "版本 {0} 现在可用。"
VERSION_REQUIRED: "{0} 需要使用 {1} 或更高版本。"
WORLD_NOT_FOUND: "找不到世界 \"{0}\"。"
WORLD_NOT_FOUND: "找不到世界 \"{0}\"。"
+99 -93
View File
@@ -1,8 +1,8 @@
# CoreProtect Language File (zh-TW)
# Translators: whitebear13579, Flandre_tw
# Translators: whitebear13579, flandretw, ianiiaannn, hanshans135
ACTION_NOT_SUPPORTED: "此指令不支援該操作。"
AMOUNT_BLOCK: "{0} 個{方塊|方塊}"
ACTION_NOT_SUPPORTED: "此指令不支援該行為。"
AMOUNT_BLOCK: "{0} 格{方塊|方塊}"
AMOUNT_CHUNK: "{0} 個{區塊|區塊}"
AMOUNT_ENTITY: "{0} 個{實體|實體}"
AMOUNT_ITEM: "{0} 個{物品|物品}"
@@ -10,52 +10,53 @@ API_TEST: "API 測試成功。"
CACHE_ERROR: "警告: 驗證快取 {0} 時出現錯誤。"
CACHE_RELOAD: "正在強制從資料庫中重新載入{鏡像|世界}快取。"
CHECK_CONFIG: "請檢查 config.yml 檔案。"
COMMAND_CONSOLE: "請從控制台運行命令。"
COMMAND_NOT_FOUND: "未知的指令 \"{0}\"。"
COMMAND_CONSOLE: "請從控制台執行此指令。"
COMMAND_NOT_FOUND: "未知的指令「{0}」。"
COMMAND_THROTTLED: "請稍後再試。"
CONSUMER_ERROR: "消費者隊列處理已經 {暫停|繼續}."
CONSUMER_TOGGLED: "消費者隊列處理已 {暫停|繼續}."
CONTAINER_HEADER: "儲存容器變更記錄。"
CONSUMER_ERROR: "消費者隊列處理已經{暫停|繼續}."
CONSUMER_TOGGLED: "消費者隊列處理已{暫停|繼續}."
CONTAINER_HEADER: "儲存容器變更紀錄。"
CPU_CORES: "CPU核心."
DATABASE_BUSY: "資料庫繁忙,請稍後再試。"
DATABASE_INDEX_ERROR: "無法驗證資料庫索引。"
DATABASE_LOCKED_1: "資料庫已被鎖定,請等待 15 秒後再試……"
DATABASE_LOCKED_1: "資料庫已被鎖定,請稍後 15 秒後再試……"
DATABASE_LOCKED_2: "資料庫正在使用,請稍後再試一次。"
DATABASE_LOCKED_3: "若要關閉資料庫鎖定功能,請設定 \"database-lock: false\"。"
DATABASE_LOCKED_4: "關閉資料庫鎖定功能,可能導致資料損壞。"
DATABASE_UNREACHABLE: "資料庫無法存取,正在拋棄資料並關閉。"
DEVELOPMENT_BRANCH: "檢測到正在使用開發分支的版本,已跳過使用補丁腳本。"
DATABASE_LOCKED_3: "若要停用資料庫鎖定功能,請設定「database-lock: false」。"
DATABASE_LOCKED_4: "停用資料庫鎖定功能可能導致資料毀損。"
DATABASE_UNREACHABLE: "資料庫無法存取,正在拋棄資料並停用。"
DEVELOPMENT_BRANCH: "檢測到正在使用開發分支的版本,已跳過資料庫版本更新。"
DIRT_BLOCK: "已在你的下方放置了泥土。"
DISABLE_SUCCESS: "執行成功 ! 關閉 {0} !"
DISABLE_SUCCESS: "執行成功!已停用 {0}!"
ENABLE_FAILED: "無法啟用 {0}。"
ENABLE_SUCCESS: "已經成功啟用 {0} !"
ENJOY_COREPROTECT: "喜歡 {0} 嗎 ? 加入我們的 Discord !"
ENABLE_SUCCESS: "已經成功啟用 {0}!"
ENJOY_COREPROTECT: "喜歡 {0} 嗎?加入我們的 Discord!"
FINISHING_CONVERSION: "正在完成資料轉換,請稍候……"
FINISHING_LOGGING: "正在完成資料記錄,請稍候……"
FIRST_VERSION: "初始化資料庫: {0}"
FINISHING_LOGGING: "正在完成紀錄檔處理,請稍候……"
FIRST_VERSION: "資料庫初始化版本: {0}"
GLOBAL_LOOKUP: "請勿指定範圍來進行全面的搜尋。"
GLOBAL_ROLLBACK: "使用 \"{0}\" 來進行全面的{回滾|恢復}。"
HELP_ACTION_1: "將搜尋限制為某個行為。"
GLOBAL_ROLLBACK: "使用「{0}」來進行全面的{回滾|恢復}。"
HELP_ACTION_1: "僅過濾某個行為。"
HELP_ACTION_2: "範例: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
HELP_COMMAND: "顯示該指令的更多資訊。"
HELP_EXCLUDE_1: "排除方塊/玩家"
HELP_EXCLUDE_2: "範例: [e:stone], [e:Notch], [e:stone,Notch]"
HELP_HEADER: "{0} 說明"
HELP_INCLUDE_1: "包括指定的方塊/實體"
HELP_INCLUDE_1: "僅過濾指定的方塊/實體"
HELP_INCLUDE_2: "範例: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
HELP_INSPECT_1: "當檢查器啟用後,你可以執行以下操作:"
HELP_INSPECT_2: "對你欲查詢的方塊點擊左鍵,可以查看方塊放置記錄。"
HELP_INSPECT_3: "對你欲查詢的方塊點擊右鍵,可以查看相鄰方塊破壞記錄。"
HELP_INSPECT_4: "對你欲查詢的位置放置方塊,可以查看放置位置破壞記錄。"
HELP_INSPECT_5: "對你欲查詢的液體中放置方塊,可以查看液體變更記錄。"
HELP_INSPECT_6: "對你欲查詢的門、儲物箱等方塊點擊右鍵,可以查看使用記錄。"
HELP_INSPECT_7: "小提醒: 你可以使用 \"/co i\" 來加快搜尋的速度。"
HELP_INSPECT_COMMAND: "開啟或關閉檢查器。"
HELP_INSPECT_2: "對你欲查詢的方塊點擊左鍵,可以查看方塊放置紀錄。"
HELP_INSPECT_3: "對你欲查詢的方塊點擊右鍵,可以查看相鄰方塊破壞紀錄。"
HELP_INSPECT_4: "對你欲查詢的位置放置方塊,可以查看放置位置破壞紀錄。"
HELP_INSPECT_5: "對你欲查詢的液體中放置方塊,可以查看液體變更紀錄。"
HELP_INSPECT_6: "對你欲查詢的門、儲物箱等方塊點擊右鍵,可以查看使用紀錄。"
HELP_INSPECT_7: "小提醒: 你可以使用「/co i」來快速啟用或停用檢查器。"
HELP_INSPECT_COMMAND: "啟用或停用檢查器。"
HELP_LIST: "顯示所有指令列表。"
HELP_LOOKUP_1: "指令捷徑"
HELP_LOOKUP_2: "在使用檢查器檢查後以便查看日誌。"
HELP_LOOKUP_COMMAND: "進階查詢方塊的資料。"
HELP_NO_INFO: "未找到 \"{0}\" 的相關指令資訊。"
HELP_PARAMETER: "若需查看相關詳細參數資訊,請查閱 \"{0}\"。"
HELP_LOOKUP_COMMAND: "進階查詢方塊資料。"
HELP_NO_INFO: "未找到「{0}」的相關指令資訊。"
HELP_PARAMETER: "若需查看相關詳細參數資訊,請查閱「{0}」。"
HELP_PARAMS_1: "執行{查詢|回滾|恢復}。"
HELP_PARAMS_2: "指定需要{查詢|回滾|恢復}的玩家。"
HELP_PARAMS_3: "指定需要{查詢|回滾|恢復}的時間範圍。"
@@ -63,12 +64,12 @@ HELP_PARAMS_4: "指定限制{查詢|回滾|恢復}的範圍。"
HELP_PARAMS_5: "將{查詢|回滾|恢復}限制在某個行為。"
HELP_PARAMS_6: "在{查詢|回滾|恢復}中指定特定的實體/方塊。"
HELP_PARAMS_7: "從{查詢|回滾|恢復}中排除特定的方塊/玩家。"
HELP_PURGE_1: "刪除了指定時間範圍的資料。"
HELP_PURGE_2: "舉例來說,\"{0}\" 將會刪除超過一個月的所有方塊資料,只保留最近 30 天的資料。"
HELP_PURGE_COMMAND: "刪除舊的方塊資料。"
HELP_PURGE_1: "清除指定時間範圍內的資料。"
HELP_PURGE_2: "舉例來說,「{0}」將會清除超過一個月的所有資料,只保留最近 30 天的資料。"
HELP_PURGE_COMMAND: "清除舊資料。"
HELP_RADIUS_1: "指定半徑範圍。"
HELP_RADIUS_2: "範例: [r:10] (僅會更改你周圍的 10 格方塊)"
HELP_RELOAD_COMMAND: "重新載入配置檔案。"
HELP_RADIUS_2: "範例: [r:10](僅會更改你周圍的 10 格方塊)"
HELP_RELOAD_COMMAND: "重新載入設定檔。"
HELP_RESTORE_COMMAND: "恢復方塊資料。"
HELP_ROLLBACK_COMMAND: "回滾方塊資料。"
HELP_STATUS: "查看插件狀態與版本資訊。"
@@ -78,107 +79,112 @@ HELP_TIME_1: "指定搜尋的時間範圍。"
HELP_TIME_2: "範例: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
HELP_USER_1: "指定要搜尋的玩家。"
HELP_USER_2: "範例: [u:Notch], [u:Notch,#enderman]"
INCOMPATIBLE_ACTION: "\"{0}\" 不能用於此操作。"
INSPECTOR_ERROR: "已{開啟|關閉}檢查器了。"
INSPECTOR_TOGGLED: "已{開啟|關閉}檢查器。"
INTEGRATION_ERROR: "無法{初始化|關閉} {0} 日誌記錄。"
INTEGRATION_SUCCESS: "{0} 成功記錄{初始化|關閉}。"
INTEGRATION_VERSION: "發現 {0} 版本無效。"
INCOMPATIBLE_ACTION: "「{0}」不能用於此行為。"
INSPECTOR_ERROR: "檢查器已經{啟用|停用}了。"
INSPECTOR_TOGGLED: "已{啟用|停用}檢查器。"
INTEGRATION_ERROR: "無法{初始化|停用}{0}紀錄檔。"
INTEGRATION_SUCCESS: "{0} 紀錄檔已成功{初始化|停用}。"
INTEGRATION_VERSION: "{0} 的版本無效。"
INTERACTIONS_HEADER: "玩家互動"
INVALID_ACTION: "這不是有效的行為。"
INVALID_BRANCH_1: "插件版本無效 (未設定分支)。"
INVALID_BRANCH_2: "若要繼續行為,請將你的項目分之設定為 \"development\"。"
INVALID_BRANCH_3: "執行開發中的插件可能會導致資料損毀。"
INVALID_CONTAINER: "請先檢查有效的容器。"
INVALID_DONATION_KEY: "無效的捐贈金鑰。"
INVALID_INCLUDE: "\"{0}\" 是無效的方塊/實體名稱。"
INVALID_INCLUDE_COMBO: "這是無效的方塊/實體組合。"
INVALID_RADIUS: "請輸入有效的範圍。"
INVALID_SELECTION: "未找到選擇 {0} 的內容。"
INVALID_USERNAME: "\"{0}\" 是無效的玩家名稱。"
INVALID_WORLD: "請指定有效的世界。"
INVALID_ACTION: "此並非有效的行為。"
INVALID_BRANCH_1: "插件版本無效(未設定分支)。"
INVALID_BRANCH_2: "若要繼續,請將分支設定為「development」。"
INVALID_BRANCH_3: "執行開發中的插件版本可能會導致資料損毀。"
INVALID_CONTAINER: "此並非有效的容器。"
INVALID_DONATION_KEY: "無效的贊助金鑰。"
INVALID_INCLUDE: "「{0}」為無效的方塊/實體名稱。"
INVALID_INCLUDE_COMBO: "此為無效的方塊/實體組合。"
INVALID_RADIUS: "此並非有效的範圍。"
INVALID_SELECTION: "「{0}」為無效的選擇範圍。"
INVALID_USERNAME: "「{0}」為無效的使用者名稱。"
INVALID_WORLD: "此並非有效的世界。"
LATEST_VERSION: "最新版本: {0}"
LINK_DISCORD: "Discord: {0}"
LINK_DOWNLOAD: "下載: {0}"
LINK_PATREON: "Patreon: {0}"
LINK_WIKI_BLOCK: "方塊名稱: {0}"
LINK_WIKI_ENTITY: "實體名稱: {0}"
LOGGING_ITEMS: "還剩 {0} 項要進行記錄,請稍候……"
LOGGING_TIME_LIMIT: "已達到記錄的時間上限,正在刪除資料並關閉……"
LOGGING_ITEMS: "還剩 {0} 項要進行紀錄,請稍候……"
LOGGING_TIME_LIMIT: "已達到紀錄的時間上限,正在捨棄資料並停用……"
LOOKUP_BLOCK: "{0} {放置|破壞} {1}。"
LOOKUP_CONTAINER: "{0} {新增|刪除} {1} {2}。"
LOOKUP_HEADER: "{0} 搜尋結果。"
LOOKUP_CONTAINER: "{0} {存入|取出} {1} {2}。"
LOOKUP_HEADER: "{0} 條搜尋結果。"
LOOKUP_INTERACTION: "{0} {點擊|殺死} {1}。"
LOOKUP_ITEM: "{0} {撿起|拋棄} {1} {2}。"
LOOKUP_LOGIN: "{0} 已登{入|出}。"
LOOKUP_PAGE: "第 {0} 頁"
LOOKUP_PROJECTILE: "{0} {扔|射} {1} {2}."
LOOKUP_ROWS_FOUND: "已找到 {0} {行|行}。"
LOOKUP_ROWS_FOUND: "已找到 {0} {條|條}。"
LOOKUP_SEARCHING: "正在搜尋,請稍候……"
LOOKUP_STORAGE: "{0} {存|取} {1} {2}。"
LOOKUP_STORAGE: "{0} {存入|取出} {1} {2}。"
LOOKUP_TIME: "{0} 前"
LOOKUP_USERNAME: "{0} 以 {1} 的身分登入。"
MAXIMUM_RADIUS: "最大 {查詢|回滾|恢復} 的範圍為 {0}。"
MISSING_ACTION_USER: "若要使用此操作,請指定玩家。"
LOOKUP_USERNAME: "{0} 已改變使用者名稱為 {1}。"
MAXIMUM_RADIUS: "最大{查詢|回滾|恢復}的範圍為 {0}。"
MISSING_ACTION_USER: "若要使用此行為,請指定玩家。"
MISSING_LOOKUP_TIME: "請指定{查詢|回滾|恢復}的時間範圍。"
MISSING_LOOKUP_USER: "請指定搜尋的玩家或是{方塊|範圍}。"
MISSING_PARAMETERS: "請使用 \"{0}\"。"
MISSING_PARAMETERS: "請使用「{0}」。"
MISSING_ROLLBACK_RADIUS: "你沒有指定{回滾|恢復}的範圍。"
MISSING_ROLLBACK_USER: "你沒有指定{回滾|恢復}的玩家。"
MYSQL_UNAVAILABLE: "無法連線到 MySQL 伺服器。"
NO_DATA: "找不到 {0} §f的資料。"
NO_DATA_LOCATION: "找不到這個位置的{資料|交易|互動|訊息}。"
NETWORK_CONNECTION: "連接到 {0} {成功|失敗}. 使用 {1} {2}."
NETWORK_TEST: "網絡測試數據已成功發送。"
NO_DATA: "未找到 {0} §f的資料。"
NO_DATA_LOCATION: "未找到此位置的{資料|交易|互動|訊息}。"
NO_PERMISSION: "你沒有使用該操作的權限。"
NO_RESULTS: "未找到相關結果。"
NO_RESULTS_PAGE: "未找到該頁面相關的{結果|資料}。"
NO_ROLLBACK: "未找到{待處理|上一個}回滾/恢復。"
PATCH_INTERRUPTED: "更新已中斷 ! 將會在下次重新啟動時再次嘗試。"
PATCH_INTERRUPTED: "更新已中斷!將會在下次啟動時再次嘗試。"
PATCH_OUTDATED_1: "無法更新早於 {0} 的資料庫。"
PATCH_OUTDATED_2: "請使用受到支援的 CoreProtect 版本。"
PATCH_PROCESSING: "正在處理新資訊,請稍候……"
PATCH_SKIP_UPDATE: "已在 {0} 上跳過{列表|索引}的{更新|建立|刪除}。"
PATCH_SKIP_UPDATE: "已在 {0} 上跳過{資料表|索引}的{更新|建立|清除}。"
PATCH_STARTED: "正在執行 {0} 更新,請稍候……"
PATCH_SUCCESS: "已成功升級到 {0}。"
PATCH_UPGRADING: "正在進行資料庫升級,請稍候……"
PLEASE_SELECT: "請選擇: \"{0}\" 或是 \"{1}\"。"
PATCH_SUCCESS: "資料庫已成功更新到 {0}。"
PATCH_UPGRADING: "正在進行資料庫更新,請稍候……"
PLEASE_SELECT: "請選擇:「{0}」或是「{1}」。"
PREVIEW_CANCELLED: "預覽已取消。"
PREVIEW_CANCELLING: "正在取消預覽……"
PREVIEW_IN_GAME: "你只能在遊戲中預覽回滾。"
PREVIEW_TRANSACTION: "您無法預覽 {集裝箱|庫存} 交易。"
PREVIEW_TRANSACTION: "您無法預覽{集裝箱|庫存}交易。"
PRIMARY_THREAD_ERROR: "該API方法不能在主線程上使用。"
PURGE_ABORTED: "清除失敗,你的資料可能已損毀。"
PURGE_ERROR: "無法處理 {0} 條資料 !"
PURGE_ERROR: "無法處理 {0} 筆資料!"
PURGE_FAILED: "清除失敗,請稍後再試。"
PURGE_IN_PROGRESS: "正在執行清除作業,請稍後再試。"
PURGE_MINIMUM_TIME: "你只能清除早於 {0} {天|小時}的資料。"
PURGE_NOTICE_1: "請注意,此操作可能需要一些時間。"
PURGE_NOTICE_2: "在完成此程序前請不要重新啟動伺服器。"
PURGE_OPTIMIZING: "正在最佳化資料庫,請稍候……"
PURGE_PROCESSING: "正在處理 {0} 資料……"
PURGE_REPAIRING: "正在嘗試修復此問題,這可能需要一些時間。"
PURGE_ROWS: "已刪除 {0} {行|行}資料。"
PURGE_STARTED: "資料刪除開始於 \"{0}\"。"
PURGE_PROCESSING: "正在清除 {0} 筆資料……"
PURGE_REPAIRING: "正在嘗試修復問題,這可能需要一些時間。"
PURGE_ROWS: "已清除 {0} {筆|筆}資料。"
PURGE_STARTED: "資料清除開始於「{0}」。"
PURGE_SUCCESS: "成功清除資料。"
RELOAD_STARTED: "正在重新載入配置檔案 - 請稍候……"
RELOAD_SUCCESS: "成功重新載入配置檔案。"
ROLLBACK_ABORTED: "已中止回滾/恢復。"
RAM_STATS: "{0}GB / {1}GB 記憶體"
RELOAD_STARTED: "正在重新載入設定檔——請稍候……"
RELOAD_SUCCESS: "成功重新載入設定檔。"
ROLLBACK_ABORTED: "已中斷回滾/恢復。"
ROLLBACK_CHUNKS_FOUND: "找到 {0} 個{區塊|區塊}需要修改。"
ROLLBACK_CHUNKS_MODIFIED: "已修改 {0}/{1}個{區塊|區塊}。"
ROLLBACK_COMPLETED: "已完成 \"{0}\" 的{回滾|恢復|預覽}。"
ROLLBACK_EXCLUDED_USERS: "已排除{玩家|玩家}: \"{0}\"。"
ROLLBACK_INCLUDE: "{包括|不包括}{方塊|實體|目標}{類型|類型}: \"{0}\"。"
ROLLBACK_COMPLETED: "已完成「{0}」的{回滾|恢復|預覽}。"
ROLLBACK_EXCLUDED_USERS: "已排除{玩家|玩家}「{0}」。"
ROLLBACK_INCLUDE: "{包括|不包括}{方塊|實體|目標}{類型|類型}「{0}」。"
ROLLBACK_IN_PROGRESS: "已在進行回滾/恢復。"
ROLLBACK_LENGTH: "花費時間: {0} {秒|秒}。"
ROLLBACK_MODIFIED: "{已修改|正在修改} {0}。"
ROLLBACK_RADIUS: "範圍: {0} {方塊|方塊}。"
ROLLBACK_SELECTION: "範圍設定為 \"{0}\"。"
ROLLBACK_STARTED: "{回滾|恢復|預覽}開始於 \"{0}\"。"
ROLLBACK_RADIUS: "範圍: {0} 格{方塊|方塊}。"
ROLLBACK_SELECTION: "選擇範圍為「{0}」。"
ROLLBACK_STARTED: "{回滾|恢復|預覽}開始於「{0}」。"
ROLLBACK_TIME: "時間範圍: {0}。"
ROLLBACK_WORLD_ACTION: "限制{世界|互動} \"{0}\"。"
ROLLBACK_WORLD_ACTION: "限制{世界|行為}「{0}」。"
SIGN_HEADER: "簽名訊息"
STATUS_CONSUMER: "玩家: {0} 個{物品|物品}已在隊列中。"
STATUS_CONSUMER: "消費者隊列: {0} 筆{資料|資料}在隊列中。"
STATUS_DATABASE: "資料庫: 使用 {0}。"
STATUS_INTEGRATION: "{0}: 整合{開啟|關閉}。"
STATUS_INTEGRATION: "{0}: 整合{啟用|停用}。"
STATUS_LICENSE: "憑證: {0}"
STATUS_SYSTEM: "系統: {0}"
STATUS_VERSION: "版本: {0}"
TELEPORTED: "傳送到 {0}。"
TELEPORTED_SAFETY: "已將你傳送到安全的區域。"
@@ -192,11 +198,11 @@ UPDATE_ERROR: "檢查更新時發生錯誤。"
UPDATE_HEADER: "{0} 更新"
UPDATE_NOTICE: "通知: {0} 現已推出。"
UPGRADE_IN_PROGRESS: "正在進行更新,請稍後再試。"
USER_NOT_FOUND: "找不到玩家 \"{0}\"。"
USER_OFFLINE: "用戶 \"{0}\"不在線。"
USER_NOT_FOUND: "未找到玩家「{0}」。"
USER_OFFLINE: "用戶「{0}」不在線上。"
USING_MYSQL: "使用 MySQL 進行資料儲存。"
USING_SQLITE: "使用 SQLite 進行資料儲存。"
VALID_DONATION_KEY: "有效的贈品金鑰"
VALID_DONATION_KEY: "有效的贊助金鑰"
VERSION_NOTICE: "版本 {0} 現已推出。"
VERSION_REQUIRED: "{0} 需要使用 {1} 或更高版本。"
WORLD_NOT_FOUND: "世界: \"{0}\" 不存在。"
WORLD_NOT_FOUND: "世界「{0}」不存在。"
-124
View File
@@ -1,124 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.coreprotect</groupId>
<artifactId>CoreProtect</artifactId>
<version>21.1</version>
<properties>
<project.branch></project.branch>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*:*:*</artifact>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.c</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/services/**</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>net.coreprotect</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer</pattern>
<shadedPattern>net.coreprotect</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>paper-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>enginehub-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
</repositories>
<dependencies>
<!--
paper-api (<= 1.16): com.destroystokyo.paper
spigot-api: org.spigotmc
bukkit: org.bukkit
-->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit-lite</artifactId>
<version>1.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>4.0.3</version>
</dependency>
</dependencies>
</project>
+1 -1
View File
@@ -1 +1 @@
mkdocs==1.2.3
mkdocs==1.3.1
+1
View File
@@ -0,0 +1 @@
rootProject.name = "CoreProtect-OG"
+136 -65
View File
@@ -1,11 +1,12 @@
package net.coreprotect;
import java.io.File;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bstats.bukkit.MetricsLite;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
import org.bukkit.plugin.java.JavaPlugin;
import net.coreprotect.command.CommandHandler;
@@ -14,7 +15,6 @@ import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.database.Database;
import net.coreprotect.language.Language;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.ListenerHandler;
@@ -22,8 +22,9 @@ import net.coreprotect.listener.player.PlayerQuitListener;
import net.coreprotect.paper.PaperAdapter;
import net.coreprotect.thread.CacheHandler;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Teleport;
import net.coreprotect.utility.Util;
public final class CoreProtect extends JavaPlugin {
@@ -36,10 +37,12 @@ public final class CoreProtect extends JavaPlugin {
* @return This CoreProtect instance
*/
public static CoreProtect getInstance() {
return instance;
}
private CoreProtectAPI api = new CoreProtectAPI();
private final CoreProtectAPI api = new CoreProtectAPI();
/**
* Get the CoreProtect API
@@ -47,18 +50,23 @@ public final class CoreProtect extends JavaPlugin {
* @return The CoreProtect API
*/
public CoreProtectAPI getAPI() {
return api;
}
@Override
public void onEnable() {
instance = this;
ConfigHandler.path = this.getDataFolder().getPath() + File.separator;
Language.loadPhrases();
boolean start = performVersionChecks();
if (start) {
try {
Consumer.initialize(); // Prepare consumer (keep this here)
new ListenerHandler(this);
getCommand("coreprotect").setExecutor(CommandHandler.getInstance());
@@ -68,144 +76,207 @@ public final class CoreProtect extends JavaPlugin {
getCommand("co").setExecutor(CommandHandler.getInstance());
getCommand("co").setTabCompleter(new TabHandler());
boolean exists = (new File(ConfigHandler.path)).exists();
final boolean exists = (new File(ConfigHandler.path)).exists();
if (!exists) {
new File(ConfigHandler.path).mkdir();
}
start = ConfigHandler.performInitialization(true); // Perform any necessary initialization
}
catch (Exception e) {
e.printStackTrace();
} catch (Exception error) {
error.printStackTrace();
start = false;
}
}
if (start) {
PluginDescriptionFile pluginDescription = this.getDescription();
Util.sendConsoleComponentStartup(Bukkit.getServer().getConsoleSender(), Phrase.build(Phrase.ENABLE_SUCCESS, ConfigHandler.EDITION_NAME));
Util.sendConsoleComponentStartup(Bukkit.getServer().getConsoleSender(),
Phrase.build(Phrase.ENABLE_SUCCESS, ConfigHandler.EDITION_NAME));
if (Config.getGlobal().MYSQL) {
Chat.console(Phrase.build(Phrase.USING_MYSQL));
}
else {
} else {
Chat.console(Phrase.build(Phrase.USING_SQLITE));
}
Chat.console("--------------------");
Chat.console(Phrase.build(Phrase.ENJOY_COREPROTECT, pluginDescription.getName()));
Chat.console(Phrase.build(Phrase.ENJOY_COREPROTECT, getPluginMeta().getName()));
Chat.console(Phrase.build(Phrase.LINK_DISCORD, "www.coreprotect.net/discord/"));
Chat.console("--------------------");
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
Scheduler.scheduleSyncDelayedTask(this, () -> {
try {
Thread networkHandler = new Thread(new NetworkHandler(true, true));
final Thread networkHandler = new Thread(new NetworkHandler(true, true));
networkHandler.start();
} catch (Exception error) {
error.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}, 0);
Thread cacheCleanUpThread = new Thread(new CacheHandler());
final Thread cacheCleanUpThread = new Thread(new CacheHandler());
cacheCleanUpThread.start();
Consumer.startConsumer();
// Enabling bStats
try {
new MetricsLite(this, 2876);
}
catch (Exception e) {
// Failed to connect to bStats server or something else went wrong.
}
}
else {
} else {
Chat.console(Phrase.build(Phrase.ENABLE_FAILED, ConfigHandler.EDITION_NAME));
getServer().getPluginManager().disablePlugin(this);
}
}
@Override
public void onDisable() {
safeShutdown(this);
}
private static boolean performVersionChecks() {
try {
String[] bukkitVersion = Bukkit.getServer().getBukkitVersion().split("[-.]");
if (Util.newVersion(bukkitVersion[0] + "." + bukkitVersion[1], ConfigHandler.SPIGOT_VERSION)) {
Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Spigot", ConfigHandler.SPIGOT_VERSION));
return false;
}
String[] javaVersion = (System.getProperty("java.version").replaceAll("[^0-9.]", "") + ".0").split("\\.");
if (Util.newVersion(javaVersion[0] + "." + javaVersion[1], ConfigHandler.JAVA_VERSION)) {
Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Java", ConfigHandler.JAVA_VERSION));
final String[] bukkitVersion = Bukkit.getServer().getBukkitVersion().split("[-.]");
if (Util.newVersion(bukkitVersion[0] + "." + bukkitVersion[1], ConfigHandler.MINECRAFT_VERSION)) {
Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Minecraft", ConfigHandler.MINECRAFT_VERSION));
return false;
}
if (ConfigHandler.EDITION_BRANCH.length() == 0) {
Chat.sendConsoleMessage(Color.RED + "[CoreProtect] " + Phrase.build(Phrase.INVALID_BRANCH_1));
Chat.sendConsoleMessage(Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.INVALID_BRANCH_2));
Chat.sendConsoleMessage(Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.INVALID_BRANCH_3));
if (Util.newVersion(ConfigHandler.LATEST_VERSION, bukkitVersion[0] + "." + bukkitVersion[1])
&& Util.isBranch("master"))
{
Chat.console(Phrase.build(Phrase.VERSION_INCOMPATIBLE, "Minecraft",
bukkitVersion[0] + "." + bukkitVersion[1]));
return false;
}
final String[] javaVersion = (System.getProperty("java.version").replaceAll("[^0-9.]", "") + ".0")
.split("\\.");
if (Util.newVersion(javaVersion[0] + "." + javaVersion[1], ConfigHandler.JAVA_VERSION)) {
Chat.console(Phrase.build(Phrase.VERSION_REQUIRED, "Java", ConfigHandler.JAVA_VERSION));
return false;
}
ConfigHandler.SERVER_VERSION = Integer.parseInt(bukkitVersion[1]);
}
catch (Exception e) {
e.printStackTrace();
} catch (Exception error) {
error.printStackTrace();
return false;
}
return true;
}
private static void safeShutdown(CoreProtect plugin) {
try {
/* if server is stopping, log disconnections of online players */
if (PaperAdapter.ADAPTER.isStopping(plugin.getServer())) {
for (Player player : plugin.getServer().getOnlinePlayers()) {
PlayerQuitListener.queuePlayerQuit(player);
if (ConfigHandler.serverRunning && PaperAdapter.ADAPTER.isStopping(plugin.getServer())) {
plugin.getServer().getOnlinePlayers().forEach(PlayerQuitListener::queuePlayerQuit);
}
if (!ConfigHandler.isFolia) {
final Iterator<Entry<Location, BlockData>> iterator = Teleport.revertBlocks.entrySet().iterator();
while (iterator.hasNext()) {
final Entry<Location, BlockData> entry = iterator.next();
entry.getKey().getBlock().setBlockData(entry.getValue());
iterator.remove();
}
}
ConfigHandler.serverRunning = false;
long shutdownTime = System.currentTimeMillis();
final long shutdownTime = System.currentTimeMillis();
long alertTime = shutdownTime + (10 * 1000);
if (ConfigHandler.converterRunning) {
Chat.console(Phrase.build(Phrase.FINISHING_CONVERSION));
}
else {
} else {
Chat.console(Phrase.build(Phrase.FINISHING_LOGGING));
}
if (ConfigHandler.migrationRunning) {
ConfigHandler.purgeRunning = false;
}
while ((Consumer.isRunning() || ConfigHandler.converterRunning) && !ConfigHandler.purgeRunning) {
long time = System.currentTimeMillis();
final long time = System.currentTimeMillis();
if (time >= alertTime) {
if (!ConfigHandler.converterRunning) {
int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
int consumerCount = Consumer.getConsumerSize(consumerId) + Process.getCurrentConsumerSize();
Chat.console(Phrase.build(Phrase.LOGGING_ITEMS, String.format("%,d", consumerCount)));
final int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
final int consumerCount = Consumer.getConsumerSize(consumerId)
+ Process.getCurrentConsumerSize();
Chat.console(Phrase.build(Phrase.LOGGING_ITEMS, "%,d".formatted(consumerCount)));
}
alertTime = alertTime + (30 * 1000);
}
else if (!ConfigHandler.databaseReachable && (time - shutdownTime) >= (5 * 60 * 1000)) {
} else if (!ConfigHandler.databaseReachable && (time - shutdownTime) >= (5 * 60 * 1000)) {
Chat.console(Phrase.build(Phrase.DATABASE_UNREACHABLE));
break;
}
else if ((time - shutdownTime) >= (15 * 60 * 1000)) {
} else if ((time - shutdownTime) >= (15 * 60 * 1000)) {
Chat.console(Phrase.build(Phrase.LOGGING_TIME_LIMIT));
break;
}
Thread.sleep(100);
}
Database.closeConnection();
Chat.console(Phrase.build(Phrase.DISABLE_SUCCESS, "CoreProtect v" + plugin.getDescription().getVersion()));
}
catch (Exception e) {
e.printStackTrace();
ConfigHandler.performDisable();
Chat.console(Phrase.build(Phrase.DISABLE_SUCCESS, "CoreProtect v" + plugin.getPluginMeta().getVersion()));
} catch (Exception error) {
error.printStackTrace();
}
}
}
}
+407 -65
View File
@@ -7,7 +7,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import net.coreprotect.api.BlockAPI;
import net.coreprotect.api.QueueLookup;
import net.coreprotect.api.SessionLookup;
import net.coreprotect.config.Config;
import net.coreprotect.consumer.Queue;
import net.coreprotect.database.Database;
import net.coreprotect.database.Lookup;
import net.coreprotect.database.rollback.Rollback;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.player.InventoryChangeListener;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -18,83 +29,97 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import net.coreprotect.api.BlockAPI;
import net.coreprotect.api.QueueLookup;
import net.coreprotect.api.SessionLookup;
import net.coreprotect.config.Config;
import net.coreprotect.consumer.Queue;
import net.coreprotect.database.Database;
import net.coreprotect.database.Lookup;
import net.coreprotect.database.Rollback;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.player.InventoryChangeListener;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Util;
public class CoreProtectAPI extends Queue {
public class ParseResult {
String[] parse;
public ParseResult(String[] data) {
parse = data;
}
public int getActionId() {
return Integer.parseInt(parse[7]);
}
public String getActionString() {
int actionID = Integer.parseInt(parse[7]);
if (parse.length < 13 && Integer.parseInt(parse[6]) == SessionLookup.ID) {
switch (actionID) {
case 0:
return "logout";
case 1:
return "login";
default:
return "unknown";
}
}
String result = "unknown";
if (actionID == 0) {
result = "break";
}
else if (actionID == 1) {
} else if (actionID == 1) {
result = "place";
}
else if (actionID == 2) {
} else if (actionID == 2) {
result = "click";
}
else if (actionID == 3) {
} else if (actionID == 3) {
result = "kill";
}
return result;
}
@Deprecated
public int getData() {
return Integer.parseInt(parse[6]);
}
public String getPlayer() {
return parse[1];
}
@Deprecated
public int getTime() {
return Integer.parseInt(parse[0]);
}
public long getTimestamp() {
return Long.parseLong(parse[0]) * 1000L;
}
public Material getType() {
if (parse.length < 13) {
return null;
}
int actionID = this.getActionId();
@@ -102,367 +127,636 @@ public class CoreProtectAPI extends Queue {
String typeName;
if (actionID == 3) {
typeName = Util.getEntityType(type).name();
}
else {
} else {
typeName = Util.getType(type).name().toLowerCase(Locale.ROOT);
typeName = Util.nameFilter(typeName, this.getData());
}
return Util.getType(typeName);
}
public BlockData getBlockData() {
if (parse.length < 13) {
return null;
}
String blockData = parse[12];
if (blockData == null || blockData.length() == 0) {
return getType().createBlockData();
}
return Bukkit.getServer().createBlockData(blockData);
}
public int getX() {
return Integer.parseInt(parse[2]);
}
public int getY() {
return Integer.parseInt(parse[3]);
}
public int getZ() {
return Integer.parseInt(parse[4]);
}
public boolean isRolledBack() {
if (parse.length < 13) {
return false;
}
return (Integer.parseInt(parse[8]) == 1 || Integer.parseInt(parse[8]) == 3);
}
public String worldName() {
return Util.getWorldName(Integer.parseInt(parse.length < 13 ? parse[5] : parse[9]));
}
}
private static Map<Object, Boolean> parseList(List<Object> list) {
Map<Object, Boolean> result = new HashMap<>();
if (list != null) {
for (Object value : list) {
if (value instanceof Material || value instanceof EntityType) {
result.put(value, false);
}
else if (value instanceof Integer) {
} else if (value instanceof Integer) {
Material material = Util.getType((Integer) value);
result.put(material, false);
}
}
}
return result;
}
public int APIVersion() {
return 9;
return 10;
}
public List<String[]> blockLookup(Block block, int time) {
if (Config.getGlobal().API_ENABLED) {
return BlockAPI.performLookup(block, time);
}
return null;
}
public List<String[]> queueLookup(Block block) {
return QueueLookup.performLookup(block);
}
public List<String[]> sessionLookup(String user, int time) {
return SessionLookup.performLookup(user, time);
}
public boolean hasPlaced(String user, Block block, int time, int offset) {
// Determine if a user has placed a block at this location in the last # of seconds.
// Determine if a user has placed a block at this location in the last # of
// seconds.
boolean match = false;
if (Config.getGlobal().API_ENABLED) {
long timestamp = System.currentTimeMillis() / 1000L;
long offsetTime = timestamp - offset;
long timestamp = System.currentTimeMillis();
long offsetTime = timestamp - offset * 1000L;
List<String[]> check = blockLookup(block, time);
for (String[] value : check) {
ParseResult result = parseResult(value);
if (user.equalsIgnoreCase(result.getPlayer()) && result.getActionId() == 1 && result.getTimestamp() <= offsetTime) {
if (user.equalsIgnoreCase(result.getPlayer()) && result.getActionId() == 1
&& result.getTimestamp() <= offsetTime)
{
match = true;
break;
}
}
}
return match;
}
public boolean hasRemoved(String user, Block block, int time, int offset) {
// Determine if a user has removed a block at this location in the last # of seconds.
// Determine if a user has removed a block at this location in the last # of
// seconds.
boolean match = false;
if (Config.getGlobal().API_ENABLED) {
long timestamp = System.currentTimeMillis() / 1000L;
long offsetTime = timestamp - offset;
long timestamp = System.currentTimeMillis();
long offsetTime = timestamp - offset * 1000L;
List<String[]> check = blockLookup(block, time);
for (String[] value : check) {
ParseResult result = parseResult(value);
if (user.equalsIgnoreCase(result.getPlayer()) && result.getActionId() == 0 && result.getTimestamp() <= offsetTime) {
if (user.equalsIgnoreCase(result.getPlayer()) && result.getActionId() == 0
&& result.getTimestamp() <= offsetTime)
{
match = true;
break;
}
}
}
return match;
}
public boolean isEnabled() {
return Config.getGlobal().API_ENABLED;
}
public boolean logChat(Player player, String message) {
if (Config.getGlobal().API_ENABLED && player != null && Config.getConfig(player.getWorld()).PLAYER_MESSAGES) {
if (message != null) {
if (message.length() > 0 && !message.startsWith("/")) {
long timestamp = System.currentTimeMillis() / 1000L;
Queue.queuePlayerChat(player, message, timestamp);
return true;
}
}
}
return false;
}
public boolean logCommand(Player player, String command) {
if (Config.getGlobal().API_ENABLED && player != null && Config.getConfig(player.getWorld()).PLAYER_COMMANDS) {
if (command != null) {
if (command.length() > 0 && command.startsWith("/")) {
long timestamp = System.currentTimeMillis() / 1000L;
Queue.queuePlayerCommand(player, command, timestamp);
return true;
}
}
}
return false;
}
public boolean logInteraction(String user, Location location) {
if (Config.getGlobal().API_ENABLED) {
if (user != null && location != null) {
if (user.length() > 0) {
Queue.queuePlayerInteraction(user, location.getBlock().getState(), location.getBlock().getType());
return true;
}
}
}
return false;
}
public boolean logContainerTransaction(String user, Location location) {
if (Config.getGlobal().API_ENABLED) {
return InventoryChangeListener.inventoryTransaction(user, location, null);
}
return false;
}
public boolean logPlacement(String user, BlockState blockState) {
if (!Config.getGlobal().API_ENABLED) {
return false;
}
if (blockState == null || user == null || user.length() == 0) {
return false;
}
Queue.queueBlockPlace(user, blockState, blockState.getType(), null, blockState.getType(), -1, 0,
blockState.getBlockData().getAsString());
return true;
}
public boolean logPlacement(String user, Location location, Material type, BlockData blockData) {
if (Config.getGlobal().API_ENABLED) {
if (user != null && location != null) {
if (user.length() > 0) {
Block block = location.getBlock();
BlockState blockState = block.getState();
String blockDataString = null;
if (blockData != null) {
blockDataString = blockData.getAsString();
}
Queue.queueBlockPlace(user, blockState, block.getType(), null, type, -1, 0, blockDataString);
return true;
}
}
}
return false;
}
@Deprecated
public boolean logPlacement(String user, Location location, Material type, byte data) {
if (Config.getGlobal().API_ENABLED) {
if (user != null && location != null) {
if (user.length() > 0) {
Queue.queueBlockPlace(user, location.getBlock().getState(), location.getBlock().getType(), null, type, data, 1, null);
Queue.queueBlockPlace(user, location.getBlock().getState(), location.getBlock().getType(), null,
type, data, 1, null);
return true;
}
}
}
return false;
}
public boolean logRemoval(String user, BlockState blockState) {
if (!Config.getGlobal().API_ENABLED) {
return false;
}
if (blockState == null || user == null || user.length() == 0) {
return false;
}
Queue.queueBlockBreak(user, blockState, blockState.getType(), blockState.getBlockData().getAsString(), 0);
return true;
}
public boolean logRemoval(String user, Location location, Material type, BlockData blockData) {
if (Config.getGlobal().API_ENABLED) {
if (user != null && location != null) {
if (user.length() > 0) {
String blockDataString = null;
if (blockData != null) {
blockDataString = blockData.getAsString();
}
Block block = location.getBlock();
Database.containerBreakCheck(user, block.getType(), block, null, location);
Queue.queueBlockBreak(user, location.getBlock().getState(), type, blockDataString, 0);
return true;
}
}
}
return false;
}
@Deprecated
public boolean logRemoval(String user, Location location, Material type, byte data) {
if (Config.getGlobal().API_ENABLED) {
if (user != null && location != null) {
if (user.length() > 0) {
Queue.queueBlockBreak(user, location.getBlock().getState(), type, type.createBlockData().getAsString(), data);
Queue.queueBlockBreak(user, location.getBlock().getState(), type,
type.createBlockData().getAsString(), data);
return true;
}
}
}
return false;
}
public ParseResult parseResult(String[] results) {
return new ParseResult(results);
}
public List<String[]> performLookup(int time, List<String> restrictUsers, List<String> excludeUsers, List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius, Location radiusLocation) {
public List<String[]> performLookup(int time, List<String> restrictUsers, List<String> excludeUsers,
List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius,
Location radiusLocation)
{
if (Config.getGlobal().API_ENABLED) {
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks), restrictUsers, excludeUsers, actionList, 0, 1, -1, -1, false);
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks),
restrictUsers, excludeUsers, actionList, 0, 1, -1, -1, false);
}
return null;
}
@Deprecated
public List<String[]> performLookup(String user, int time, int radius, Location location, List<Object> restrict, List<Object> exclude) {
public List<String[]> performLookup(String user, int time, int radius, Location location, List<Object> restrict,
List<Object> exclude)
{
if (Config.getGlobal().API_ENABLED) {
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 0, 1, -1, -1, false);
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 0, 1, -1, -1,
false);
}
return null;
}
public List<String[]> performPartialLookup(int time, List<String> restrictUsers, List<String> excludeUsers, List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius, Location radiusLocation, int limitOffset, int limitCount) {
public List<String[]> performPartialLookup(int time, List<String> restrictUsers, List<String> excludeUsers,
List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius,
Location radiusLocation, int limitOffset, int limitCount)
{
if (Config.getGlobal().API_ENABLED) {
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks), restrictUsers, excludeUsers, actionList, 0, 1, limitOffset, limitCount, true);
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks),
restrictUsers, excludeUsers, actionList, 0, 1, limitOffset, limitCount, true);
}
return null;
}
@Deprecated
public List<String[]> performPartialLookup(String user, int time, int radius, Location location, List<Object> restrict, List<Object> exclude, int limitOffset, int limitCount) {
public List<String[]> performPartialLookup(String user, int time, int radius, Location location,
List<Object> restrict, List<Object> exclude, int limitOffset, int limitCount)
{
if (Config.getGlobal().API_ENABLED) {
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 0, 1, limitOffset, limitCount, true);
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 0, 1, limitOffset,
limitCount, true);
}
return null;
}
public void performPurge(int time) {
Server server = Bukkit.getServer();
server.dispatchCommand(server.getConsoleSender(), "co purge t:" + time + "s");
}
public List<String[]> performRestore(int time, List<String> restrictUsers, List<String> excludeUsers, List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius, Location radiusLocation) {
public List<String[]> performRestore(int time, List<String> restrictUsers, List<String> excludeUsers,
List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius,
Location radiusLocation)
{
if (Config.getGlobal().API_ENABLED) {
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks), restrictUsers, excludeUsers, actionList, 1, 2, -1, -1, false);
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks),
restrictUsers, excludeUsers, actionList, 1, 2, -1, -1, false);
}
return null;
}
@Deprecated
public List<String[]> performRestore(String user, int time, int radius, Location location, List<Object> restrict, List<Object> exclude) {
public List<String[]> performRestore(String user, int time, int radius, Location location, List<Object> restrict,
List<Object> exclude)
{
if (Config.getGlobal().API_ENABLED) {
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 1, 2, -1, -1, false);
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 1, 2, -1, -1,
false);
}
return null;
}
public List<String[]> performRollback(int time, List<String> restrictUsers, List<String> excludeUsers, List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius, Location radiusLocation) {
public List<String[]> performRollback(int time, List<String> restrictUsers, List<String> excludeUsers,
List<Object> restrictBlocks, List<Object> excludeBlocks, List<Integer> actionList, int radius,
Location radiusLocation)
{
if (Config.getGlobal().API_ENABLED) {
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks), restrictUsers, excludeUsers, actionList, 0, 2, -1, -1, false);
return processData(time, radius, radiusLocation, parseList(restrictBlocks), parseList(excludeBlocks),
restrictUsers, excludeUsers, actionList, 0, 2, -1, -1, false);
}
return null;
}
@Deprecated
public List<String[]> performRollback(String user, int time, int radius, Location location, List<Object> restrict, List<Object> exclude) {
public List<String[]> performRollback(String user, int time, int radius, Location location, List<Object> restrict,
List<Object> exclude)
{
if (Config.getGlobal().API_ENABLED) {
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 0, 2, -1, -1, false);
return processData(user, time, radius, location, parseList(restrict), parseList(exclude), 0, 2, -1, -1,
false);
}
return null;
}
private List<String[]> processData(int time, int radius, Location location, Map<Object, Boolean> restrictBlocksMap, Map<Object, Boolean> excludeBlocks, List<String> restrictUsers, List<String> excludeUsers, List<Integer> actionList, int action, int lookup, int offset, int rowCount, boolean useLimit) {
private List<String[]> processData(int time, int radius, Location location, Map<Object, Boolean> restrictBlocksMap,
Map<Object, Boolean> excludeBlocks, List<String> restrictUsers, List<String> excludeUsers,
List<Integer> actionList, int action, int lookup, int offset, int rowCount, boolean useLimit)
{
// You need to either specify time/radius or time/user
List<String[]> result = new ArrayList<>();
List<String> uuids = new ArrayList<>();
if (restrictUsers == null) {
restrictUsers = new ArrayList<>();
}
if (excludeUsers == null) {
excludeUsers = new ArrayList<>();
}
if (actionList == null) {
actionList = new ArrayList<>();
}
List<Object> restrictBlocks = new ArrayList<>(restrictBlocksMap.keySet());
if (actionList.size() == 0 && restrictBlocks.size() > 0) {
boolean addedMaterial = false;
boolean addedEntity = false;
for (Object argBlock : restrictBlocks) {
if (argBlock instanceof Material && !addedMaterial) {
actionList.add(0);
actionList.add(1);
addedMaterial = true;
}
else if (argBlock instanceof EntityType && !addedEntity) {
} else if (argBlock instanceof EntityType && !addedEntity) {
actionList.add(3);
addedEntity = true;
}
}
}
if (actionList.size() == 0) {
actionList.add(0);
actionList.add(1);
}
actionList.removeIf(actionListItem -> actionListItem > 3);
if (restrictUsers.size() == 0) {
restrictUsers.add("#global");
}
long timestamp = System.currentTimeMillis() / 1000L;
@@ -470,80 +764,128 @@ public class CoreProtectAPI extends Queue {
long endTime = 0;
if (radius < 1) {
radius = -1;
}
if (restrictUsers.contains("#global") && radius == -1) {
return null;
}
if (radius > -1 && location == null) {
return null;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection != null) {
Statement statement = connection.createStatement();
boolean restrictWorld = false;
if (radius > 0) {
restrictWorld = true;
}
if (location == null) {
restrictWorld = false;
}
Integer[] argRadius = null;
if (location != null && radius > 0) {
int xMin = location.getBlockX() - radius;
int xMax = location.getBlockX() + radius;
int zMin = location.getBlockZ() - radius;
int zMax = location.getBlockZ() + radius;
argRadius = new Integer[] { radius, xMin, xMax, null, null, zMin, zMax, 0 };
}
if (lookup == 1) {
if (location != null) {
restrictWorld = true;
}
if (useLimit) {
result = Lookup.performPartialLookup(statement, null, uuids, restrictUsers, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, null, startTime, endTime, offset, rowCount, restrictWorld, true);
result = Lookup.performPartialLookup(statement, null, uuids, restrictUsers, restrictBlocks,
excludeBlocks, excludeUsers, actionList, location, argRadius, null, startTime, endTime,
offset, rowCount, restrictWorld, true);
} else {
result = Lookup.performLookup(statement, null, uuids, restrictUsers, restrictBlocks,
excludeBlocks, excludeUsers, actionList, location, argRadius, startTime, endTime,
restrictWorld, true);
}
else {
result = Lookup.performLookup(statement, null, uuids, restrictUsers, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, startTime, endTime, restrictWorld, true);
}
}
else {
} else {
if (!Bukkit.isPrimaryThread()) {
boolean verbose = false;
result = Rollback.performRollbackRestore(statement, null, uuids, restrictUsers, null, restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, startTime, endTime, restrictWorld, false, verbose, action, 0);
result = Rollback.performRollbackRestore(statement, null, uuids, restrictUsers, null,
restrictBlocks, excludeBlocks, excludeUsers, actionList, location, argRadius, startTime,
endTime, restrictWorld, false, verbose, action, 0);
} else {
Chat.console(Phrase.build(Phrase.PRIMARY_THREAD_ERROR));
}
}
statement.close();
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
@Deprecated
private List<String[]> processData(String user, int time, int radius, Location location, Map<Object, Boolean> restrictBlocks, Map<Object, Boolean> excludeBlocks, int action, int lookup, int offset, int rowCount, boolean useLimit) {
private List<String[]> processData(String user, int time, int radius, Location location,
Map<Object, Boolean> restrictBlocks, Map<Object, Boolean> excludeBlocks, int action, int lookup, int offset,
int rowCount, boolean useLimit)
{
ArrayList<String> restrictUsers = new ArrayList<>();
if (user != null) {
restrictUsers.add(user);
}
return processData(time, radius, location, restrictBlocks, excludeBlocks, restrictUsers, null, null, action, lookup, offset, rowCount, useLimit);
return processData(time, radius, location, restrictBlocks, excludeBlocks, restrictUsers, null, null, action,
lookup, offset, rowCount, useLimit);
}
public void testAPI() {
Chat.console(Phrase.build(Phrase.API_TEST));
}
}
@@ -5,22 +5,24 @@ import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.block.Block;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.utility.Util;
import org.bukkit.block.Block;
public class BlockAPI {
public static List<String[]> performLookup(Block block, int offset) {
List<String[]> result = new ArrayList<>();
try (Connection connection = Database.getConnection(false, 1000)) {
if (block == null) {
return result;
}
int x = block.getX();
@@ -30,18 +32,25 @@ public class BlockAPI {
int worldId = Util.getWorldId(block.getWorld().getName());
int checkTime = 0;
if (offset > 0) {
checkTime = time - offset;
}
if (connection == null) {
return result;
}
Statement statement = connection.createStatement();
String query = "SELECT time,user,action,type,data,blockdata,rolled_back FROM " + ConfigHandler.prefix + "block " + Util.getWidIndex("block") + "WHERE wid = '" + worldId + "' AND x = '" + x + "' AND z = '" + z + "' AND y = '" + y + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
String query = "SELECT time,user,action,type,data,blockdata,rolled_back FROM " + ConfigHandler.prefix
+ "block " + Util.getWidIndex("block") + "WHERE wid = '" + worldId + "' AND x = '" + x
+ "' AND z = '" + z + "' AND y = '" + y + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
ResultSet results = statement.executeQuery(query);
while (results.next()) {
String resultTime = results.getString("time");
int resultUserId = results.getInt("user");
String resultAction = results.getString("action");
@@ -50,23 +59,33 @@ public class BlockAPI {
byte[] resultBlockData = results.getBytes("blockdata");
String resultRolledBack = results.getString("rolled_back");
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
UserStatement.loadName(connection, resultUserId);
}
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
String blockData = Util.byteDataToString(resultBlockData, resultType);
String[] lookupData = new String[] { resultTime, resultUser, String.valueOf(x), String.valueOf(y), String.valueOf(z), String.valueOf(resultType), resultData, resultAction, resultRolledBack, String.valueOf(worldId), blockData };
String[] lookupData = new String[] { resultTime, resultUser, String.valueOf(x), String.valueOf(y),
String.valueOf(z), String.valueOf(resultType), resultData, resultAction, resultRolledBack,
String.valueOf(worldId), blockData };
String[] lineData = Util.toStringArray(lookupData);
result.add(lineData);
}
results.close();
statement.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
@@ -1,45 +1,56 @@
package net.coreprotect.api;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import net.coreprotect.config.Config;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.consumer.Queue;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.utility.Util;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
public class QueueLookup extends Queue {
private QueueLookup() {
throw new IllegalStateException("API class");
}
public static List<String[]> performLookup(Block block) {
List<String[]> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try {
int consumerCount = 0;
int currentConsumerSize = Process.getCurrentConsumerSize();
if (currentConsumerSize == 0) {
consumerCount = Consumer.getConsumerSize(0) + Consumer.getConsumerSize(1);
}
else {
} else {
int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
consumerCount = Consumer.getConsumerSize(consumerId) + currentConsumerSize;
}
if (consumerCount == 0) {
return result;
}
int currentConsumer = Consumer.currentConsumer;
@@ -48,16 +59,24 @@ public class QueueLookup extends Queue {
Map<Integer, Object> consumerObject = Consumer.consumerObjects.get(currentConsumer);
Location oldLocation = block.getLocation();
for (Object[] data : consumerData) {
ListIterator<Object[]> iterator = consumerData.listIterator();
while (iterator.hasNext()) {
Object[] data = iterator.next();
int id = (int) data[0];
int action = (int) data[1];
if (action != Process.BLOCK_BREAK && action != Process.BLOCK_PLACE) {
continue;
}
String[] userData = users.get(id);
Object objectData = consumerObject.get(id);
if (userData != null && objectData != null && (objectData instanceof BlockState) && ((BlockState) objectData).getLocation().equals(oldLocation)) {
if (userData != null && objectData != null && (objectData instanceof BlockState)
&& ((BlockState) objectData).getLocation().equals(oldLocation))
{
Material blockType = (Material) data[2];
int legacyData = (int) data[3];
String blockData = (String) data[7];
@@ -68,18 +87,27 @@ public class QueueLookup extends Queue {
int resultType = Util.getBlockId(blockType);
int time = (int) (System.currentTimeMillis() / 1000L);
String[] lookupData = new String[] { String.valueOf(time), user, String.valueOf(location.getBlockX()), String.valueOf(location.getBlockY()), String.valueOf(location.getBlockZ()), String.valueOf(resultType), String.valueOf(legacyData), String.valueOf(action), "0", String.valueOf(wid), blockData };
String[] lookupData = new String[] { String.valueOf(time), user,
String.valueOf(location.getBlockX()), String.valueOf(location.getBlockY()),
String.valueOf(location.getBlockZ()), String.valueOf(resultType),
String.valueOf(legacyData), String.valueOf(action), "0", String.valueOf(wid), blockData };
String[] lineData = Util.toStringArray(lookupData);
result.add(lineData);
}
}
}
catch (Exception e) {
Collections.reverse(result);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
@@ -6,7 +6,6 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
@@ -17,36 +16,52 @@ public class SessionLookup {
public static final int ID = 0;
private SessionLookup() {
throw new IllegalStateException("API class");
}
public static List<String[]> performLookup(String user, int offset) {
List<String[]> result = new ArrayList<>();
if (!Config.getGlobal().API_ENABLED) {
return result;
}
try (Connection connection = Database.getConnection(false, 1000)) {
if (connection == null || user == null) {
return result;
}
String type = String.valueOf(ID);
int time = (int) (System.currentTimeMillis() / 1000L);
int checkTime = 0;
if (offset > 0) {
checkTime = time - offset;
}
if (ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT)) == null) {
UserStatement.loadId(connection, user, null);
}
int userId = ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT));
try (Statement statement = connection.createStatement()) {
String query = "SELECT time,user,wid,x,y,z,action FROM " + ConfigHandler.prefix + "session WHERE user = '" + userId + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
String query = "SELECT time,user,wid,x,y,z,action FROM " + ConfigHandler.prefix
+ "session WHERE user = '" + userId + "' AND time > '" + checkTime + "' ORDER BY rowid DESC";
ResultSet results = statement.executeQuery(query);
while (results.next()) {
String resultTime = results.getString("time");
int resultUserId = results.getInt("user");
String resultWorldId = results.getString("wid");
@@ -56,21 +71,31 @@ public class SessionLookup {
String resultAction = results.getString("action");
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
UserStatement.loadName(connection, resultUserId);
}
String resultUser = ConfigHandler.playerIdCacheReversed.get(resultUserId);
String[] lookupData = new String[] { resultTime, resultUser, resultX, resultY, resultZ, resultWorldId, type, resultAction };
String[] lookupData = new String[] { resultTime, resultUser, resultX, resultY, resultZ,
resultWorldId, type, resultAction };
result.add(lookupData);
}
results.close();
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
@@ -2,24 +2,33 @@ package net.coreprotect.bukkit;
import java.util.List;
import java.util.Map;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.utility.Util;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.FaceAttachable;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.utility.Util;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionType;
public class BukkitAdapter implements BukkitInterface {
@@ -30,126 +39,379 @@ public class BukkitAdapter implements BukkitInterface {
public static final int BUKKIT_V1_16 = 16;
public static final int BUKKIT_V1_17 = 17;
public static final int BUKKIT_V1_18 = 18;
public static final int BUKKIT_V1_19 = 19;
public static final int BUKKIT_V1_20 = 20;
public static void loadAdapter() {
switch (ConfigHandler.SERVER_VERSION) {
case BUKKIT_V1_13:
case BUKKIT_V1_14:
BukkitAdapter.ADAPTER = new BukkitAdapter();
break;
case BUKKIT_V1_15:
BukkitAdapter.ADAPTER = new Bukkit_v1_15();
break;
case BUKKIT_V1_16:
BukkitAdapter.ADAPTER = new Bukkit_v1_16();
BukkitAdapter.ADAPTER = new BukkitAdapter();
break;
case BUKKIT_V1_17:
BukkitAdapter.ADAPTER = new Bukkit_v1_17();
break;
case BUKKIT_V1_18:
default:
BukkitAdapter.ADAPTER = new Bukkit_v1_18();
break;
case BUKKIT_V1_19:
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
break;
default:
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
break;
}
}
@Override
public String parseLegacyName(String name) {
return name;
}
@Override
public int getLegacyBlockId(Material material) {
return -1;
}
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
return false;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
return false;
}
@Override
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot) {
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list,
List<List<Map<String, Object>>> metadata, int slot)
{
return false;
}
@Override
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map) {
return false;
}
@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof Directional) {
return (scanMin < 5 && scanBlock.getRelative(((Directional) blockData).getFacing().getOppositeFace()).getLocation().equals(block.getLocation()));
if (blockData instanceof Directional && blockData instanceof FaceAttachable) {
Directional directional = (Directional) blockData;
FaceAttachable faceAttachable = (FaceAttachable) blockData;
boolean scanButton = false;
switch (faceAttachable.getAttachedFace()) {
case WALL:
scanButton = (scanMin < 5 && scanBlock.getRelative(directional.getFacing().getOppositeFace())
.getLocation().equals(block.getLocation()));
break;
case FLOOR:
scanButton = (scanMin == 5);
break;
case CEILING:
scanButton = (scanMin == 6);
break;
default:
break;
}
return scanButton;
}
return true; // unvalidated attachments default to true
}
@Override
public boolean isWall(BlockData blockData) {
return false;
}
@Override
public void sendSignChange(Player player, Sign sign) {
return;
}
@Override
public int getMinHeight(World world) {
return 0;
}
@Override
public Material getBucketContents(Material material) {
return Material.AIR;
}
@Override
public boolean isItemFrame(Material material) {
return (material == Material.ITEM_FRAME);
}
@Override
public Material getFrameType(Entity entity) {
return Material.ITEM_FRAME;
}
@Override
public Material getFrameType(EntityType type) {
return type == EntityType.ITEM_FRAME ? Material.ITEM_FRAME : null;
}
@Override
public Class<?> getFrameClass(Material material) {
return ItemFrame.class;
}
@Override
public boolean isGlowing(Sign sign) {
public boolean isGlowing(Sign sign, boolean isFront) {
return false;
}
@Override
public void setGlowing(Sign sign, boolean set) {
return;
public boolean isWaxed(Sign sign) {
return false;
}
@Override
public boolean isInvisible(Material material) {
return Util.isAir(material);
}
@Override
public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack) {
return null;
}
@Override
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
return;
}
@Override
public void setColor(Sign sign, boolean isFront, int color) {
if (!isFront) {
return;
}
sign.setColor(DyeColor.getByColor(Color.fromRGB(color)));
}
@Override
public void setWaxed(Sign sign, boolean isWaxed) {
return;
}
@Override
public int getColor(Sign sign, boolean isFront) {
if (isFront) {
return sign.getColor().getColor().asRGB();
}
return 0;
}
@Override
public Material getPlantSeeds(Material material) {
switch (material) {
case WHEAT:
material = Material.WHEAT_SEEDS;
break;
case PUMPKIN_STEM:
material = Material.PUMPKIN_SEEDS;
break;
case MELON_STEM:
material = Material.MELON_SEEDS;
break;
case BEETROOTS:
material = Material.BEETROOT_SEEDS;
break;
default:
}
return material;
}
@Override
public boolean isDecoratedPot(Material material) {
return false;
}
@Override
public boolean isSuspiciousBlock(Material material) {
return false;
}
@Override
public boolean isSign(Material material) {
return Tag.SIGNS.isTagged(material);
}
@Override
public boolean isChiseledBookshelf(Material material) {
return false;
}
@Override
public boolean isBookshelfBook(Material material) {
return false;
}
@Override
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) {
return null;
}
@Override
public String getLine(Sign sign, int line) {
if (line < 4) {
return sign.getLine(line);
} else {
return "";
}
}
@Override
public void setLine(Sign sign, int line, String string) {
if (string == null) {
string = "";
}
if (line < 4) {
sign.setLine(line, string);
}
}
@Override
public boolean isSignFront(SignChangeEvent event) {
return true;
}
@Override
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack) {
PotionData data = arrow.getBasePotionData();
if (data.getType() != PotionType.valueOf("UNCRAFTABLE")) {
itemStack = new ItemStack(Material.TIPPED_ARROW);
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
meta.setBasePotionData(data);
for (PotionEffect effect : arrow.getCustomEffects()) {
meta.addCustomEffect(effect, false);
}
itemStack.setItemMeta(meta);
}
return itemStack;
}
@Override
public EntityType getEntityType(Material material) {
switch (material) {
case END_CRYSTAL:
return EntityType.valueOf("ENDER_CRYSTAL");
default:
return EntityType.UNKNOWN;
}
}
@Override
public Object getRegistryKey(Object value) {
return value;
}
@Override
public Object getRegistryValue(String key, Object tClass) {
return null;
}
}
@@ -2,16 +2,18 @@ package net.coreprotect.bukkit;
import java.util.List;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.inventory.meta.ItemMeta;
@@ -34,26 +36,59 @@ public interface BukkitInterface {
public boolean setEntityMeta(Entity entity, Object value, int count);
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot);
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list,
List<List<Map<String, Object>>> metadata, int slot);
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map);
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin);
public boolean isWall(BlockData blockData);
public boolean isItemFrame(Material material);
public boolean isGlowing(Sign sign);
public boolean isGlowing(Sign sign, boolean isFront);
public boolean isInvisible(Material material);
public boolean isWaxed(Sign sign);
public int getMinHeight(World world);
public int getLegacyBlockId(Material material);
public void sendSignChange(Player player, Sign sign);
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing);
public void setGlowing(Sign sign, boolean b);
public void setColor(Sign sign, boolean isFront, int color);
public void setWaxed(Sign sign, boolean isWaxed);
public int getColor(Sign sign, boolean isFront);
public Material getPlantSeeds(Material material);
public boolean isDecoratedPot(Material material);
public boolean isSuspiciousBlock(Material material);
public boolean isSign(Material material);
public boolean isChiseledBookshelf(Material material);
public boolean isBookshelfBook(Material material);
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event);
public String getLine(Sign sign, int line);
public void setLine(Sign sign, int line, String string);
public boolean isSignFront(SignChangeEvent event);
public ItemStack getArrowMeta(Arrow arrow, ItemStack itemStack);
public EntityType getEntityType(Material material);
public Object getRegistryKey(Object value);
public Object getRegistryValue(String key, Object tClass);
}
@@ -1,105 +0,0 @@
package net.coreprotect.bukkit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SuspiciousStewMeta;
import org.bukkit.potion.PotionEffect;
public class Bukkit_v1_15 extends BukkitAdapter implements BukkitInterface {
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
if (entity instanceof Bee) {
Bee bee = (Bee) entity;
info.add(bee.getAnger());
info.add(bee.hasNectar());
info.add(bee.hasStung());
}
else {
return false;
}
return true;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
if (entity instanceof Bee) {
Bee bee = (Bee) entity;
if (count == 0) {
int set = (int) value;
bee.setAnger(set);
}
else if (count == 1) {
boolean set = (Boolean) value;
bee.setHasNectar(set);
}
else if (count == 2) {
boolean set = (Boolean) value;
bee.setHasStung(set);
}
}
else {
return false;
}
return true;
}
@Override
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot) {
if (itemMeta instanceof SuspiciousStewMeta) {
SuspiciousStewMeta meta = (SuspiciousStewMeta) itemMeta;
SuspiciousStewMeta subMeta = meta.clone();
meta.clearCustomEffects();
list.add(meta.serialize());
metadata.add(list);
if (subMeta.hasCustomEffects()) {
for (PotionEffect effect : subMeta.getCustomEffects()) {
list = new ArrayList<>();
list.add(effect.serialize());
metadata.add(list);
}
}
}
else {
return false;
}
return true;
}
@Override
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map) {
if ((rowType == Material.SUSPICIOUS_STEW)) {
for (Map<String, Object> suspiciousStewData : map) {
SuspiciousStewMeta meta = (SuspiciousStewMeta) itemstack.getItemMeta();
PotionEffect effect = new PotionEffect(suspiciousStewData);
meta.addCustomEffect(effect, true);
itemstack.setItemMeta(meta);
}
}
else {
return false;
}
return true;
}
@Override
public void sendSignChange(Player player, Sign sign) {
player.sendSignChange(sign.getLocation(), sign.getLines(), sign.getColor());
}
}
@@ -1,118 +0,0 @@
package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.FaceAttachable;
import org.bukkit.block.data.type.Wall;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Piglin;
import org.bukkit.entity.Zoglin;
import net.coreprotect.model.BlockGroup;
public class Bukkit_v1_16 extends Bukkit_v1_15 implements BukkitInterface {
public Bukkit_v1_16() {
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO, Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT, Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH, Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS, Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN));
BlockGroup.TRACK_BOTTOM = new HashSet<>(Arrays.asList(Material.WEEPING_VINES));
BlockGroup.TRACK_SIDE = new HashSet<>(Arrays.asList(Material.WALL_TORCH, Material.REDSTONE_WALL_TORCH, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.ACTIVATOR_RAIL, Material.WHITE_BED, Material.ORANGE_BED, Material.MAGENTA_BED, Material.LIGHT_BLUE_BED, Material.YELLOW_BED, Material.LIME_BED, Material.PINK_BED, Material.GRAY_BED, Material.LIGHT_GRAY_BED, Material.CYAN_BED, Material.PURPLE_BED, Material.BLUE_BED, Material.BROWN_BED, Material.GREEN_BED, Material.RED_BED, Material.BLACK_BED, Material.LADDER, Material.ACACIA_WALL_SIGN, Material.BIRCH_WALL_SIGN, Material.DARK_OAK_WALL_SIGN, Material.JUNGLE_WALL_SIGN, Material.OAK_WALL_SIGN, Material.SPRUCE_WALL_SIGN, Material.VINE, Material.COCOA, Material.TRIPWIRE_HOOK, Material.WHITE_WALL_BANNER, Material.ORANGE_WALL_BANNER, Material.MAGENTA_WALL_BANNER, Material.LIGHT_BLUE_WALL_BANNER, Material.YELLOW_WALL_BANNER, Material.LIME_WALL_BANNER, Material.PINK_WALL_BANNER, Material.GRAY_WALL_BANNER, Material.LIGHT_GRAY_WALL_BANNER, Material.CYAN_WALL_BANNER, Material.PURPLE_WALL_BANNER, Material.BLUE_WALL_BANNER, Material.BROWN_WALL_BANNER, Material.GREEN_WALL_BANNER, Material.RED_WALL_BANNER, Material.BLACK_WALL_BANNER, Material.SOUL_WALL_TORCH, Material.CRIMSON_WALL_SIGN, Material.WARPED_WALL_SIGN));
BlockGroup.DOORS = new HashSet<>(Arrays.asList(Material.OAK_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR, Material.JUNGLE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR, Material.CRIMSON_DOOR, Material.WARPED_DOOR));
BlockGroup.BUTTONS = new HashSet<>(Arrays.asList(Material.STONE_BUTTON, Material.OAK_BUTTON, Material.ACACIA_BUTTON, Material.BIRCH_BUTTON, Material.DARK_OAK_BUTTON, Material.JUNGLE_BUTTON, Material.SPRUCE_BUTTON, Material.POLISHED_BLACKSTONE_BUTTON, Material.CRIMSON_BUTTON, Material.WARPED_BUTTON));
BlockGroup.PRESSURE_PLATES = new HashSet<>(Arrays.asList(Material.STONE_PRESSURE_PLATE, Material.ACACIA_PRESSURE_PLATE, Material.BIRCH_PRESSURE_PLATE, Material.DARK_OAK_PRESSURE_PLATE, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, Material.JUNGLE_PRESSURE_PLATE, Material.LIGHT_WEIGHTED_PRESSURE_PLATE, Material.OAK_PRESSURE_PLATE, Material.SPRUCE_PRESSURE_PLATE, Material.CRIMSON_PRESSURE_PLATE, Material.WARPED_PRESSURE_PLATE, Material.POLISHED_BLACKSTONE_PRESSURE_PLATE));
BlockGroup.VINES = new HashSet<>(Arrays.asList(Material.VINE, Material.WEEPING_VINES, Material.TWISTING_VINES));
BlockGroup.LIGHTABLES = new HashSet<>(Arrays.asList(Material.CAMPFIRE, Material.SOUL_CAMPFIRE));
BlockGroup.FIRE = new HashSet<>(Arrays.asList(Material.FIRE, Material.SOUL_FIRE));
BlockGroup.LANTERNS = new HashSet<>(Arrays.asList(Material.LANTERN, Material.SOUL_LANTERN));
BlockGroup.SOUL_BLOCKS = new HashSet<>(Arrays.asList(Material.SOUL_SAND, Material.SOUL_SOIL));
BlockGroup.INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.ACACIA_FENCE_GATE, Material.DISPENSER, Material.NOTE_BLOCK, Material.CHEST, Material.FURNACE, Material.LEVER, Material.REPEATER, Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.BREWING_STAND, Material.ANVIL, Material.CHIPPED_ANVIL, Material.DAMAGED_ANVIL, Material.ENDER_CHEST, Material.TRAPPED_CHEST, Material.COMPARATOR, Material.HOPPER, Material.DROPPER, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.GRINDSTONE, Material.LOOM, Material.SMOKER, Material.CRAFTING_TABLE, Material.CARTOGRAPHY_TABLE, Material.ENCHANTING_TABLE, Material.SMITHING_TABLE, Material.STONECUTTER, Material.CRIMSON_FENCE_GATE, Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
BlockGroup.SAFE_INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.LEVER, Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.ACACIA_FENCE_GATE, Material.CRIMSON_FENCE_GATE, Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
BlockGroup.UPDATE_STATE = new HashSet<>(Arrays.asList(Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FURNACE, Material.BLAST_FURNACE, Material.SMOKER, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.REPEATER, Material.REDSTONE_LAMP, Material.BEACON, Material.COMPARATOR, Material.DAYLIGHT_DETECTOR, Material.REDSTONE_BLOCK, Material.HOPPER, Material.CHEST, Material.TRAPPED_CHEST, Material.ACTIVATOR_RAIL, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.SHROOMLIGHT, Material.RESPAWN_ANCHOR, Material.CRYING_OBSIDIAN, Material.TARGET));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH));
}
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
if (entity instanceof Piglin) {
Piglin piglin = (Piglin) entity;
info.add(piglin.isBaby());
}
else if (entity instanceof Zoglin) {
Zoglin zoglin = (Zoglin) entity;
info.add(zoglin.isBaby());
}
else if (super.getEntityMeta(entity, info)) {
return true;
}
else {
return false;
}
return true;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
if (entity instanceof Piglin) {
Piglin piglin = (Piglin) entity;
if (count == 0) {
boolean set = (Boolean) value;
piglin.setBaby(set);
}
}
else if (entity instanceof Zoglin) {
Zoglin zoglin = (Zoglin) entity;
if (count == 0) {
boolean set = (Boolean) value;
zoglin.setBaby(set);
}
}
else if (super.setEntityMeta(entity, value, count)) {
return true;
}
else {
return false;
}
return true;
}
@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof Directional && blockData instanceof FaceAttachable) {
Directional directional = (Directional) blockData;
FaceAttachable faceAttachable = (FaceAttachable) blockData;
boolean scanButton = false;
switch (faceAttachable.getAttachedFace()) {
case WALL:
scanButton = (scanMin < 5 && scanBlock.getRelative(directional.getFacing().getOppositeFace()).getLocation().equals(block.getLocation()));
break;
case FLOOR:
scanButton = (scanMin == 5);
break;
case CEILING:
scanButton = (scanMin == 6);
break;
default:
break;
}
return scanButton;
}
return true; // unvalidated attachments default to true
}
@Override
public boolean isWall(BlockData blockData) {
return (blockData instanceof Wall);
}
}
@@ -5,7 +5,8 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.Util;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@@ -24,96 +25,182 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BundleMeta;
import org.bukkit.inventory.meta.ItemMeta;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.Util;
public class Bukkit_v1_17 extends Bukkit_v1_16 implements BukkitInterface {
public class Bukkit_v1_17 extends BukkitAdapter implements BukkitInterface {
public Bukkit_v1_17() {
BlockGroup.TRACK_ANY = new HashSet<>(Arrays.asList(Material.PISTON_HEAD, Material.LEVER, Material.BELL, Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER, Material.GLOW_LICHEN));
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO, Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT, Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH, Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS, Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN, Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
BlockGroup.TRACK_TOP_BOTTOM = new HashSet<>(Arrays.asList(Material.POINTED_DRIPSTONE, Material.BIG_DRIPLEAF_STEM));
BlockGroup.TRACK_BOTTOM = new HashSet<>(Arrays.asList(Material.WEEPING_VINES, Material.CAVE_VINES, Material.CAVE_VINES_PLANT, Material.HANGING_ROOTS));
BlockGroup.VINES = new HashSet<>(Arrays.asList(Material.VINE, Material.WEEPING_VINES, Material.TWISTING_VINES, Material.CAVE_VINES));
BlockGroup.CANDLES = new HashSet<>(Arrays.asList(Material.CANDLE, Material.BLACK_CANDLE, Material.BLUE_CANDLE, Material.BROWN_CANDLE, Material.CYAN_CANDLE, Material.GRAY_CANDLE, Material.GREEN_CANDLE, Material.LIGHT_BLUE_CANDLE, Material.LIGHT_GRAY_CANDLE, Material.LIME_CANDLE, Material.MAGENTA_CANDLE, Material.ORANGE_CANDLE, Material.PINK_CANDLE, Material.PURPLE_CANDLE, Material.RED_CANDLE, Material.WHITE_CANDLE, Material.YELLOW_CANDLE, Material.CANDLE_CAKE, Material.BLACK_CANDLE_CAKE, Material.BLUE_CANDLE_CAKE, Material.BROWN_CANDLE_CAKE, Material.CYAN_CANDLE_CAKE, Material.GRAY_CANDLE_CAKE, Material.GREEN_CANDLE_CAKE, Material.LIGHT_BLUE_CANDLE_CAKE, Material.LIGHT_GRAY_CANDLE_CAKE, Material.LIME_CANDLE_CAKE, Material.MAGENTA_CANDLE_CAKE, Material.ORANGE_CANDLE_CAKE, Material.PINK_CANDLE_CAKE, Material.PURPLE_CANDLE_CAKE, Material.RED_CANDLE_CAKE, Material.WHITE_CANDLE_CAKE, Material.YELLOW_CANDLE_CAKE));
BlockGroup.AMETHYST = new HashSet<>(Arrays.asList(Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER));
BlockGroup.UPDATE_STATE = new HashSet<>(Arrays.asList(Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FURNACE, Material.BLAST_FURNACE, Material.SMOKER, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.REPEATER, Material.REDSTONE_LAMP, Material.BEACON, Material.COMPARATOR, Material.DAYLIGHT_DETECTOR, Material.REDSTONE_BLOCK, Material.HOPPER, Material.CHEST, Material.TRAPPED_CHEST, Material.ACTIVATOR_RAIL, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.SHROOMLIGHT, Material.RESPAWN_ANCHOR, Material.CRYING_OBSIDIAN, Material.TARGET, Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER, Material.CAVE_VINES, Material.CAVE_VINES_PLANT, Material.GLOW_LICHEN, Material.LIGHT, Material.LAVA_CAULDRON));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF, Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
BlockGroup.TRACK_ANY = new HashSet<>(Arrays.asList(Material.PISTON_HEAD, Material.LEVER, Material.BELL,
Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD,
Material.AMETHYST_CLUSTER, Material.GLOW_LICHEN));
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO,
Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE,
Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING,
Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING,
Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION,
Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP,
Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY,
Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT,
Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN,
Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER,
Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER,
Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER,
Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER,
Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW,
Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM,
Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER,
Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY,
Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH,
Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS,
Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN,
Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
BlockGroup.TRACK_TOP_BOTTOM = new HashSet<>(
Arrays.asList(Material.POINTED_DRIPSTONE, Material.BIG_DRIPLEAF_STEM));
BlockGroup.TRACK_BOTTOM = new HashSet<>(Arrays.asList(Material.WEEPING_VINES, Material.CAVE_VINES,
Material.CAVE_VINES_PLANT, Material.HANGING_ROOTS));
BlockGroup.VINES = new HashSet<>(
Arrays.asList(Material.VINE, Material.WEEPING_VINES, Material.TWISTING_VINES, Material.CAVE_VINES));
BlockGroup.CANDLES = new HashSet<>(Arrays.asList(Material.CANDLE, Material.BLACK_CANDLE, Material.BLUE_CANDLE,
Material.BROWN_CANDLE, Material.CYAN_CANDLE, Material.GRAY_CANDLE, Material.GREEN_CANDLE,
Material.LIGHT_BLUE_CANDLE, Material.LIGHT_GRAY_CANDLE, Material.LIME_CANDLE, Material.MAGENTA_CANDLE,
Material.ORANGE_CANDLE, Material.PINK_CANDLE, Material.PURPLE_CANDLE, Material.RED_CANDLE,
Material.WHITE_CANDLE, Material.YELLOW_CANDLE, Material.CANDLE_CAKE, Material.BLACK_CANDLE_CAKE,
Material.BLUE_CANDLE_CAKE, Material.BROWN_CANDLE_CAKE, Material.CYAN_CANDLE_CAKE,
Material.GRAY_CANDLE_CAKE, Material.GREEN_CANDLE_CAKE, Material.LIGHT_BLUE_CANDLE_CAKE,
Material.LIGHT_GRAY_CANDLE_CAKE, Material.LIME_CANDLE_CAKE, Material.MAGENTA_CANDLE_CAKE,
Material.ORANGE_CANDLE_CAKE, Material.PINK_CANDLE_CAKE, Material.PURPLE_CANDLE_CAKE,
Material.RED_CANDLE_CAKE, Material.WHITE_CANDLE_CAKE, Material.YELLOW_CANDLE_CAKE));
BlockGroup.AMETHYST = new HashSet<>(Arrays.asList(Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD,
Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER));
BlockGroup.UPDATE_STATE = new HashSet<>(Arrays.asList(Material.TORCH, Material.WALL_TORCH,
Material.REDSTONE_WIRE, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FURNACE,
Material.BLAST_FURNACE, Material.SMOKER, Material.LEVER, Material.REDSTONE_TORCH,
Material.REDSTONE_WALL_TORCH, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.REPEATER,
Material.REDSTONE_LAMP, Material.BEACON, Material.COMPARATOR, Material.DAYLIGHT_DETECTOR,
Material.REDSTONE_BLOCK, Material.HOPPER, Material.CHEST, Material.TRAPPED_CHEST,
Material.ACTIVATOR_RAIL, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.SHROOMLIGHT,
Material.RESPAWN_ANCHOR, Material.CRYING_OBSIDIAN, Material.TARGET, Material.SMALL_AMETHYST_BUD,
Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER,
Material.CAVE_VINES, Material.CAVE_VINES_PLANT, Material.GLOW_LICHEN, Material.LIGHT,
Material.LAVA_CAULDRON));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER,
Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH,
Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING,
Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA,
Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH, Material.DANDELION,
Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP,
Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY,
Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH,
Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH,
Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL,
Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH,
Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF,
Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
BlockGroup.VERTICAL_TOP_BOTTOM = new HashSet<>(Arrays.asList(Material.BIG_DRIPLEAF_STEM));
}
@Override
public String parseLegacyName(String name) {
switch (name) {
case "GRASS_PATH":
name = "DIRT_PATH";
break;
default:
break;
}
return name;
}
@Override
public int getLegacyBlockId(Material material) {
switch (material) {
case DIRT_PATH:
return Util.getBlockId("GRASS_PATH", false);
default:
return -1;
}
}
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
if (entity instanceof Axolotl) {
Axolotl axolotl = (Axolotl) entity;
info.add(axolotl.getVariant());
}
else if (entity instanceof Goat) {
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
info.add(goat.isScreaming());
}
else if (super.getEntityMeta(entity, info)) {
} else if (super.getEntityMeta(entity, info)) {
return true;
}
else {
} else {
return false;
}
return true;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
if (entity instanceof Axolotl) {
Axolotl axolotl = (Axolotl) entity;
if (count == 0) {
org.bukkit.entity.Axolotl.Variant set = (org.bukkit.entity.Axolotl.Variant) value;
axolotl.setVariant(set);
}
}
else if (entity instanceof Goat) {
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
if (count == 0) {
boolean set = (Boolean) value;
goat.setScreaming(set);
}
}
else if (super.setEntityMeta(entity, value, count)) {
} else if (super.setEntityMeta(entity, value, count)) {
return true;
}
else {
} else {
return false;
}
return true;
}
@Override
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot) {
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list,
List<List<Map<String, Object>>> metadata, int slot)
{
if (itemMeta instanceof BundleMeta) {
BundleMeta meta = (BundleMeta) itemMeta;
BundleMeta subMeta = (BundleMeta) meta.clone();
meta.setItems(null);
@@ -121,115 +208,177 @@ public class Bukkit_v1_17 extends Bukkit_v1_16 implements BukkitInterface {
metadata.add(list);
if (subMeta.hasItems()) {
list = new ArrayList<>();
for (ItemStack itemStack : subMeta.getItems()) {
Map<String, Object> itemMap = Util.serializeItemStack(itemStack, null, slot);
if (itemMap.size() > 0) {
list.add(itemMap);
}
}
metadata.add(list);
}
}
else if (super.getItemMeta(itemMeta, list, metadata, slot)) {
} else if (super.getItemMeta(itemMeta, list, metadata, slot)) {
return true;
}
else {
} else {
return false;
}
return true;
}
@Override
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map) {
if ((rowType == Material.BUNDLE)) {
BundleMeta meta = (BundleMeta) itemstack.getItemMeta();
for (Map<String, Object> itemData : map) {
ItemStack itemStack = Util.unserializeItemStack(itemData);
if (itemStack != null) {
meta.addItem(itemStack);
}
}
itemstack.setItemMeta(meta);
}
else if (super.setItemMeta(rowType, itemstack, map)) {
} else if (super.setItemMeta(rowType, itemstack, map)) {
return true;
}
else {
} else {
return false;
}
return true;
}
@Override
public boolean isAttached(Block block, Block scanBlock, BlockData blockData, int scanMin) {
if (blockData instanceof PointedDripstone) {
PointedDripstone pointedDripstone = (PointedDripstone) blockData;
BlockFace blockFace = pointedDripstone.getVerticalDirection();
boolean adjacent = scanBlock.getRelative(blockFace.getOppositeFace()).getLocation().equals(block.getLocation());
boolean adjacent = scanBlock.getRelative(blockFace.getOppositeFace()).getLocation()
.equals(block.getLocation());
if (!adjacent) {
return false;
}
}
else if (!super.isAttached(block, scanBlock, blockData, scanMin)) {
} else if (!super.isAttached(block, scanBlock, blockData, scanMin)) {
return false;
}
return true;
}
@Override
public int getMinHeight(World world) {
return world.getMinHeight();
}
@Override
public Material getBucketContents(Material material) {
return (material == Material.POWDER_SNOW_BUCKET ? Material.POWDER_SNOW : Material.AIR);
}
@Override
public boolean isItemFrame(Material material) {
return (material == Material.ITEM_FRAME || material == Material.GLOW_ITEM_FRAME);
}
@Override
public Material getFrameType(Entity entity) {
return (entity instanceof GlowItemFrame) ? Material.GLOW_ITEM_FRAME : Material.ITEM_FRAME;
}
@Override
public Material getFrameType(EntityType type) {
switch (type) {
case ITEM_FRAME:
return Material.ITEM_FRAME;
case GLOW_ITEM_FRAME:
return Material.GLOW_ITEM_FRAME;
default:
return null;
}
}
@Override
public Class<?> getFrameClass(Material material) {
return (material == Material.GLOW_ITEM_FRAME) ? GlowItemFrame.class : ItemFrame.class;
}
@Override
public boolean isGlowing(Sign sign) {
public boolean isGlowing(Sign sign, boolean isFront) {
if (!isFront) {
return false;
}
return sign.isGlowingText();
}
@Override
public void setGlowing(Sign sign, boolean set) {
sign.setGlowingText(set);
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
if (!isFront) {
return;
}
sign.setGlowingText(isGlowing);
}
@Override
public boolean isInvisible(Material material) {
return material.isAir() || material == Material.LIGHT;
}
}
@@ -9,23 +9,31 @@ public class Bukkit_v1_18 extends Bukkit_v1_17 implements BukkitInterface {
@Override
public ItemStack adjustIngredient(MerchantRecipe recipe, ItemStack itemStack) {
try {
if (hasAdjust == null) {
hasAdjust = true;
MerchantRecipe.class.getMethod("adjust", ItemStack.class); // Bukkit 1.18.1+
}
else if (Boolean.FALSE.equals(hasAdjust)) {
} else if (Boolean.FALSE.equals(hasAdjust)) {
return null;
}
ItemStack adjustedStack = itemStack.clone();
recipe.adjust(adjustedStack);
return adjustedStack;
}
catch (Exception e) {
} catch (Exception e) {
hasAdjust = false;
return null;
}
}
}
@@ -0,0 +1,204 @@
package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import net.coreprotect.model.BlockGroup;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Frog;
import org.bukkit.entity.Goat;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Tadpole;
public class Bukkit_v1_19 extends Bukkit_v1_18 implements BukkitInterface {
public Bukkit_v1_19() {
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO,
Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE,
Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING,
Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING,
Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN,
Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM,
Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP,
Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM,
Material.REDSTONE_WIRE, Material.WHEAT, Material.MANGROVE_SIGN, Material.ACACIA_SIGN,
Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN,
Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER,
Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER,
Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER,
Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER,
Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS,
Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT,
Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC,
Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART,
Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH,
Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS,
Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN,
Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
BlockGroup.TRACK_SIDE = new HashSet<>(Arrays.asList(Material.WALL_TORCH, Material.REDSTONE_WALL_TORCH,
Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.ACTIVATOR_RAIL,
Material.WHITE_BED, Material.ORANGE_BED, Material.MAGENTA_BED, Material.LIGHT_BLUE_BED,
Material.YELLOW_BED, Material.LIME_BED, Material.PINK_BED, Material.GRAY_BED, Material.LIGHT_GRAY_BED,
Material.CYAN_BED, Material.PURPLE_BED, Material.BLUE_BED, Material.BROWN_BED, Material.GREEN_BED,
Material.RED_BED, Material.BLACK_BED, Material.LADDER, Material.MANGROVE_WALL_SIGN,
Material.ACACIA_WALL_SIGN, Material.BIRCH_WALL_SIGN, Material.DARK_OAK_WALL_SIGN,
Material.JUNGLE_WALL_SIGN, Material.OAK_WALL_SIGN, Material.SPRUCE_WALL_SIGN, Material.VINE,
Material.COCOA, Material.TRIPWIRE_HOOK, Material.WHITE_WALL_BANNER, Material.ORANGE_WALL_BANNER,
Material.MAGENTA_WALL_BANNER, Material.LIGHT_BLUE_WALL_BANNER, Material.YELLOW_WALL_BANNER,
Material.LIME_WALL_BANNER, Material.PINK_WALL_BANNER, Material.GRAY_WALL_BANNER,
Material.LIGHT_GRAY_WALL_BANNER, Material.CYAN_WALL_BANNER, Material.PURPLE_WALL_BANNER,
Material.BLUE_WALL_BANNER, Material.BROWN_WALL_BANNER, Material.GREEN_WALL_BANNER,
Material.RED_WALL_BANNER, Material.BLACK_WALL_BANNER, Material.SOUL_WALL_TORCH,
Material.CRIMSON_WALL_SIGN, Material.WARPED_WALL_SIGN));
BlockGroup.DOORS = new HashSet<>(Arrays.asList(Material.OAK_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR,
Material.JUNGLE_DOOR, Material.MANGROVE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR,
Material.CRIMSON_DOOR, Material.WARPED_DOOR));
BlockGroup.BUTTONS = new HashSet<>(Arrays.asList(Material.STONE_BUTTON, Material.OAK_BUTTON,
Material.MANGROVE_BUTTON, Material.ACACIA_BUTTON, Material.BIRCH_BUTTON, Material.DARK_OAK_BUTTON,
Material.JUNGLE_BUTTON, Material.SPRUCE_BUTTON, Material.POLISHED_BLACKSTONE_BUTTON,
Material.CRIMSON_BUTTON, Material.WARPED_BUTTON));
BlockGroup.PRESSURE_PLATES = new HashSet<>(Arrays.asList(Material.STONE_PRESSURE_PLATE,
Material.MANGROVE_PRESSURE_PLATE, Material.ACACIA_PRESSURE_PLATE, Material.BIRCH_PRESSURE_PLATE,
Material.DARK_OAK_PRESSURE_PLATE, Material.HEAVY_WEIGHTED_PRESSURE_PLATE,
Material.JUNGLE_PRESSURE_PLATE, Material.LIGHT_WEIGHTED_PRESSURE_PLATE, Material.OAK_PRESSURE_PLATE,
Material.SPRUCE_PRESSURE_PLATE, Material.CRIMSON_PRESSURE_PLATE, Material.WARPED_PRESSURE_PLATE,
Material.POLISHED_BLACKSTONE_PRESSURE_PLATE));
BlockGroup.INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE,
Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.MANGROVE_FENCE_GATE,
Material.ACACIA_FENCE_GATE, Material.DISPENSER, Material.NOTE_BLOCK, Material.CHEST, Material.FURNACE,
Material.LEVER, Material.REPEATER, Material.MANGROVE_TRAPDOOR, Material.ACACIA_TRAPDOOR,
Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR,
Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.BREWING_STAND, Material.ANVIL,
Material.CHIPPED_ANVIL, Material.DAMAGED_ANVIL, Material.ENDER_CHEST, Material.TRAPPED_CHEST,
Material.COMPARATOR, Material.HOPPER, Material.DROPPER, Material.SHULKER_BOX,
Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX,
Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX,
Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX,
Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX,
Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX,
Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.GRINDSTONE,
Material.LOOM, Material.SMOKER, Material.CRAFTING_TABLE, Material.CARTOGRAPHY_TABLE,
Material.ENCHANTING_TABLE, Material.SMITHING_TABLE, Material.STONECUTTER, Material.CRIMSON_FENCE_GATE,
Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
BlockGroup.SAFE_INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.LEVER, Material.MANGROVE_TRAPDOOR,
Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR,
Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.SPRUCE_FENCE_GATE,
Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE,
Material.MANGROVE_FENCE_GATE, Material.ACACIA_FENCE_GATE, Material.CRIMSON_FENCE_GATE,
Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER,
Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH,
Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING,
Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER,
Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FERN, Material.DEAD_BUSH,
Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET,
Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP,
Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH,
Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER,
Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE,
Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT,
Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF,
Material.BIG_DRIPLEAF, Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
BlockGroup.SCULK = new HashSet<>(
Arrays.asList(Material.SCULK, Material.SCULK_VEIN, Material.SCULK_SENSOR, Material.SCULK_SHRIEKER));
}
@Override
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
if (entity instanceof Frog) {
Frog frog = (Frog) entity;
info.add(BukkitAdapter.ADAPTER.getRegistryKey(frog.getVariant()));
} else if (entity instanceof Tadpole) {
Tadpole tadpole = (Tadpole) entity;
info.add(tadpole.getAge());
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
info.add(goat.isScreaming());
info.add(goat.hasLeftHorn());
info.add(goat.hasRightHorn());
} else if (super.getEntityMeta(entity, info)) {
return true;
} else {
return false;
}
return true;
}
@Override
public boolean setEntityMeta(Entity entity, Object value, int count) {
if (entity instanceof Frog) {
Frog frog = (Frog) entity;
if (count == 0) {
if (value instanceof String) {
value = BukkitAdapter.ADAPTER.getRegistryValue((String) value, Frog.Variant.class);
}
Frog.Variant set = (Frog.Variant) value;
frog.setVariant(set);
}
} else if (entity instanceof Tadpole) {
Tadpole tadpole = (Tadpole) entity;
if (count == 0) {
int set = (int) value;
tadpole.setAge(set);
}
} else if (entity instanceof Goat) {
Goat goat = (Goat) entity;
boolean set = (Boolean) value;
if (count == 0) {
goat.setScreaming(set);
} else if (count == 1) {
goat.setLeftHorn(set);
} else if (count == 2) {
goat.setRightHorn(set);
}
} else if (super.setEntityMeta(entity, value, count)) {
return true;
} else {
return false;
}
return true;
}
}
@@ -1,21 +1,23 @@
package net.coreprotect.command;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class ApplyCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long startTime = (Long) list.get(0);
long endTime = (Long) list.get(1);
@@ -23,25 +25,41 @@ public class ApplyCommand {
Location location = (Location) list.get(3);
boolean valid = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("#preview")) {
valid = true;
args[i] = args[i].replaceAll("#preview", "");
}
}
if (!valid) {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
} else {
ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
}
} else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,21 +1,23 @@
package net.coreprotect.command;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class CancelCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long startTime = (Long) list.get(0);
long endTime = (Long) list.get(1);
@@ -23,25 +25,41 @@ public class CancelCommand {
Location location = (Location) list.get(3);
boolean valid = false;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("#preview")) {
valid = true;
args[i] = args[i].replaceAll("#preview", "#preview_cancel");
}
}
if (!valid) {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
} else {
ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
}
} else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.FIRST));
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
File diff suppressed because it is too large. Load diff
@@ -1,69 +1,105 @@
package net.coreprotect.command;
import java.util.Locale;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
public class ConsumerCommand {
private ConsumerCommand() {
throw new IllegalStateException("Command class");
}
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
if (!(player instanceof ConsoleCommandSender)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_CONSOLE));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_CONSOLE));
return;
}
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (args.length == 2) {
String action = args[1].toLowerCase(Locale.ROOT);
boolean pauseCommand = (action.equals("pause") || action.equals("disable") || action.equals("stop"));
boolean resumeCommand = (action.equals("resume") || action.equals("enable") || action.equals("start"));
if (pauseCommand || resumeCommand) {
if (ConfigHandler.pauseConsumer) {
if (pauseCommand) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_ERROR, Selector.FIRST)); // already paused
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_ERROR, Selector.FIRST)); // already paused
} else {
ConfigHandler.pauseConsumer = false;
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.SECOND)); // now started
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.SECOND)); // now started
}
}
else {
} else {
if (resumeCommand) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_ERROR, Selector.SECOND)); // already running
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_ERROR, Selector.SECOND)); // already running
} else {
ConfigHandler.pauseConsumer = true;
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.FIRST)); // now paused
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.CONSUMER_TOGGLED, Selector.FIRST)); // now paused
}
}
return;
}
}
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, Color.WHITE, "/co consumer <pause|resume>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, Color.WHITE, "/co consumer <pause|resume>"));
}
}
@@ -1,27 +1,35 @@
package net.coreprotect.command;
import java.util.Locale;
import org.bukkit.command.CommandSender;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
public class HelpCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
if (permission) {
if (resultc > 1) {
String helpcommand_original = args[1];
String helpcommand = args[1].toLowerCase(Locale.ROOT);
helpcommand = helpcommand.replaceAll("[^a-zA-Z]", "");
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA
+ Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
if (helpcommand.equals("help")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co help " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LIST));
}
else if (helpcommand.equals("inspect") || helpcommand.equals("inspector") || helpcommand.equals("in")) {
Chat.sendMessage(player,
Color.DARK_AQUA + "/co help " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LIST));
} else if (helpcommand.equals("inspect") || helpcommand.equals("inspector")
|| helpcommand.equals("in"))
{
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.HELP_INSPECT_1));
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_2));
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_3));
@@ -29,101 +37,188 @@ public class HelpCommand {
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_5));
Chat.sendMessage(player, "* " + Phrase.build(Phrase.HELP_INSPECT_6));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_INSPECT_7));
}
else if (helpcommand.equals("params") || helpcommand.equals("param") || helpcommand.equals("parameters") || helpcommand.equals("parameter")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_2, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_3, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_4, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_5, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_6, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_7, Selector.FIRST));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
}
else if (helpcommand.equals("rollback") || helpcommand.equals("rollbacks") || helpcommand.equals("rb") || helpcommand.equals("ro")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co rollback " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_2, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_3, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_4, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_5, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_6, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_7, Selector.SECOND));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
}
else if (helpcommand.equals("restore") || helpcommand.equals("restores") || helpcommand.equals("re") || helpcommand.equals("rs")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co restore " + Color.GREY + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_2, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_3, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_4, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_5, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_6, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PARAMS_7, Selector.THIRD));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
}
else if (helpcommand.equals("lookup") || helpcommand.equals("lookups") || helpcommand.equals("l")) {
} else if (helpcommand.equals("params") || helpcommand.equals("param")
|| helpcommand.equals("parameters") || helpcommand.equals("parameter"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup " + Color.GREY + "<params> " + Color.WHITE
+ "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_2, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_3, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_4, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_5, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_6, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_7, Selector.FIRST));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
} else if (helpcommand.equals("rollback") || helpcommand.equals("rollbacks") || helpcommand.equals("rb")
|| helpcommand.equals("ro"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co rollback " + Color.GREY + "<params> " + Color.WHITE
+ "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_2, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_3, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_4, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_5, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_6, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_7, Selector.SECOND));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
} else if (helpcommand.equals("restore") || helpcommand.equals("restores") || helpcommand.equals("re")
|| helpcommand.equals("rs"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co restore " + Color.GREY + "<params> " + Color.WHITE
+ "- " + Phrase.build(Phrase.HELP_PARAMS_1, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_2, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_3, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_4, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_5, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_6, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "| " + Color.GREY + "e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PARAMS_7, Selector.THIRD));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help <param>"));
} else if (helpcommand.equals("lookup") || helpcommand.equals("lookups") || helpcommand.equals("l")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup <params>");
Chat.sendMessage(player, Color.DARK_AQUA + "/co l <params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_1));
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup <page> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_2));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help params"));
}
else if (helpcommand.equals("purge") || helpcommand.equals("purges")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co purge t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + "" + Phrase.build(Phrase.HELP_PURGE_2, "/co purge t:30d"));
}
else if (helpcommand.equals("reload")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co reload " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RELOAD_COMMAND));
}
else if (helpcommand.equals("status")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co status " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_STATUS));
}
else if (helpcommand.equals("teleport")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co teleport <world> <x> <y> <z> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_TELEPORT));
}
else if (helpcommand.equals("u") || helpcommand.equals("user") || helpcommand.equals("users") || helpcommand.equals("uuser") || helpcommand.equals("uusers")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup u:<users> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_USER_1));
Chat.sendMessage(player, Color.DARK_AQUA + "/co l <params> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_LOOKUP_1));
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup <page> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_LOOKUP_2));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_PARAMETER, "/co help params"));
} else if (helpcommand.equals("purge") || helpcommand.equals("purges")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co purge t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_PURGE_1));
Chat.sendMessage(player,
Color.GREY + Color.ITALIC + "" + Phrase.build(Phrase.HELP_PURGE_2, "/co purge t:30d"));
} else if (helpcommand.equals("reload")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co reload " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_RELOAD_COMMAND));
} else if (helpcommand.equals("status")) {
Chat.sendMessage(player,
Color.DARK_AQUA + "/co status " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_STATUS));
} else if (helpcommand.equals("teleport")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co teleport <world> <x> <y> <z> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_TELEPORT));
} else if (helpcommand.equals("u") || helpcommand.equals("user") || helpcommand.equals("users")
|| helpcommand.equals("uuser") || helpcommand.equals("uusers"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup u:<users> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_USER_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_USER_2));
}
else if (helpcommand.equals("t") || helpcommand.equals("time") || helpcommand.equals("ttime")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup t:<time> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_TIME_1));
} else if (helpcommand.equals("t") || helpcommand.equals("time") || helpcommand.equals("ttime")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup t:<time> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_TIME_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_TIME_2));
}
else if (helpcommand.equals("r") || helpcommand.equals("radius") || helpcommand.equals("rradius")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup r:<radius> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RADIUS_1));
} else if (helpcommand.equals("r") || helpcommand.equals("radius") || helpcommand.equals("rradius")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup r:<radius> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_RADIUS_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_RADIUS_2));
}
else if (helpcommand.equals("a") || helpcommand.equals("action") || helpcommand.equals("actions") || helpcommand.equals("aaction")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup a:<action> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_ACTION_1));
} else if (helpcommand.equals("a") || helpcommand.equals("action") || helpcommand.equals("actions")
|| helpcommand.equals("aaction"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup a:<action> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_ACTION_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_ACTION_2));
}
else if (helpcommand.equals("i") || helpcommand.equals("include") || helpcommand.equals("iinclude") || helpcommand.equals("b") || helpcommand.equals("block") || helpcommand.equals("blocks") || helpcommand.equals("bblock") || helpcommand.equals("bblocks")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup i:<include> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_INCLUDE_1));
} else if (helpcommand.equals("i") || helpcommand.equals("include") || helpcommand.equals("iinclude")
|| helpcommand.equals("b") || helpcommand.equals("block") || helpcommand.equals("blocks")
|| helpcommand.equals("bblock") || helpcommand.equals("bblocks"))
{
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup i:<include> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_INCLUDE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_INCLUDE_2));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.LINK_WIKI_ENTITY, "https://coreprotect.net/wiki-entities"));
}
else if (helpcommand.equals("e") || helpcommand.equals("exclude") || helpcommand.equals("eexclude")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup e:<exclude> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_EXCLUDE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC
+ Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
Chat.sendMessage(player, Color.GREY + Color.ITALIC
+ Phrase.build(Phrase.LINK_WIKI_ENTITY, "https://coreprotect.net/wiki-entities"));
} else if (helpcommand.equals("e") || helpcommand.equals("exclude") || helpcommand.equals("eexclude")) {
Chat.sendMessage(player, Color.DARK_AQUA + "/co lookup e:<exclude> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_EXCLUDE_1));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.HELP_EXCLUDE_2));
Chat.sendMessage(player, Color.GREY + Color.ITALIC + Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
}
else {
Chat.sendMessage(player, Color.WHITE + Phrase.build(Phrase.HELP_NO_INFO, Color.WHITE, "/co help " + helpcommand_original));
Chat.sendMessage(player, Color.GREY + Color.ITALIC
+ Phrase.build(Phrase.LINK_WIKI_BLOCK, "https://coreprotect.net/wiki-blocks"));
} else {
Chat.sendMessage(player, Color.WHITE
+ Phrase.build(Phrase.HELP_NO_INFO, Color.WHITE, "/co help " + helpcommand_original));
}
} else {
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA
+ Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.DARK_AQUA + "/co help " + Color.GREY + "<command> " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "inspect " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_INSPECT_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "rollback " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_ROLLBACK_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "restore " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RESTORE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "lookup " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "purge " + Color.DARK_AQUA
+ "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "reload " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_RELOAD_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "status " + Color.WHITE + "- "
+ Phrase.build(Phrase.HELP_STATUS_COMMAND));
}
else {
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.HELP_HEADER, "CoreProtect") + Color.WHITE + " -----");
Chat.sendMessage(player, Color.DARK_AQUA + "/co help " + Color.GREY + "<command> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "inspect " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_INSPECT_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "rollback " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_ROLLBACK_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "restore " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RESTORE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "lookup " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_LOOKUP_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "purge " + Color.DARK_AQUA + "<params> " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_PURGE_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "reload " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_RELOAD_COMMAND));
Chat.sendMessage(player, Color.DARK_AQUA + "/co " + Color.GREY + "status " + Color.WHITE + "- " + Phrase.build(Phrase.HELP_STATUS_COMMAND));
}
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
@@ -1,52 +1,75 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
public class InspectCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
if (permission) {
int command = -1;
ConfigHandler.inspecting.putIfAbsent(player.getName(), false);
if (args.length > 1) {
String action = args[1];
if (action.equalsIgnoreCase("on")) {
command = 1;
}
else if (action.equalsIgnoreCase("off")) {
} else if (action.equalsIgnoreCase("off")) {
command = 0;
}
}
if (!ConfigHandler.inspecting.get(player.getName())) {
if (command == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_ERROR, Selector.SECOND)); // already disabled
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.FIRST)); // now enabled
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_ERROR, Selector.SECOND)); // already disabled
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.FIRST)); // now enabled
ConfigHandler.inspecting.put(player.getName(), true);
}
}
else {
} else {
if (command == 1) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_ERROR, Selector.FIRST)); // already enabled
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.SECOND)); // now disabled
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_ERROR, Selector.FIRST)); // already enabled
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INSPECTOR_TOGGLED, Selector.SECOND)); // now disabled
ConfigHandler.inspecting.put(player.getName(), false);
}
}
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,34 @@
package net.coreprotect.command;
import net.coreprotect.config.Config;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.channel.PluginChannelListener;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
public class NetworkDebugCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
if (!permission || !Config.getGlobal().NETWORK_DEBUG) {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
try {
PluginChannelListener.getInstance().sendTest(player, args.length == 2 ? args[1] : "");
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -8,11 +8,9 @@ import java.sql.ResultSetMetaData;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Locale;
import java.util.Map;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
@@ -24,79 +22,230 @@ import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatMessage;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class PurgeCommand extends Consumer {
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
Location location = CommandHandler.parseLocation(player, args);
final Integer[] argRadius = CommandHandler.parseRadius(args, player, location);
final List<Integer> argAction = CommandHandler.parseAction(args);
final List<Object> argBlocks = CommandHandler.parseRestricted(player, args, argAction);
final Map<Object, Boolean> argExclude = CommandHandler.parseExcluded(player, args, argAction);
final List<String> argExcludeUsers = CommandHandler.parseExcludedUsers(player, args);
final long[] argTime = CommandHandler.parseTime(args);
final int argWid = CommandHandler.parseWorld(args, false, false);
final List<Integer> argAction = CommandHandler.parseAction(args);
final List<Integer> supportedActions = Arrays.asList();
long startTime = argTime[1] > 0 ? argTime[0] : 0;
long endTime = argTime[1] > 0 ? argTime[1] : argTime[0];
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
if (argBlocks == null || argExclude == null || argExcludeUsers == null) {
return;
}
if (ConfigHandler.converterRunning || ConfigHandler.migrationRunning) {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
if (resultc <= 1) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return;
}
if (endTime <= 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co purge t:<time>"));
return;
}
if (argRadius != null) {
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.INVALID_WORLD)).build());
return;
}
if (argWid == -1) {
String worldName = CommandHandler.parseWorldName(args, false);
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.WORLD_NOT_FOUND, worldName)).build());
return;
}
for (int action : argAction) {
if (!supportedActions.contains(action)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
// Functions.sendMessage(player, new ChatMessage("Please specify a valid purge action.").build());
return;
}
}
if (player instanceof Player && endTime < 2592000) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "30", Selector.FIRST)); // 30 days
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PURGE_MINIMUM_TIME, "30", Selector.FIRST)); // 30 days
return;
} else if (endTime < 86400) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PURGE_MINIMUM_TIME, "24", Selector.SECOND)); // 24 hours
return;
}
else if (endTime < 86400) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_MINIMUM_TIME, "24", Selector.SECOND)); // 24 hours
for (int action : argAction) {
if (!supportedActions.contains(action)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
// Functions.sendMessage(player, new ChatMessage("Please specify a valid purge
// action.").build());
return;
}
}
StringBuilder restrict = new StringBuilder();
String includeBlock = "";
String includeEntity = "";
boolean hasBlock = false;
boolean item = false;
boolean entity = false;
int restrictCount = 0;
if (argBlocks.size() > 0) {
StringBuilder includeListMaterial = new StringBuilder();
StringBuilder includeListEntity = new StringBuilder();
for (Object restrictTarget : argBlocks) {
String targetName = "";
if (restrictTarget instanceof Material) {
targetName = ((Material) restrictTarget).name();
if (includeListMaterial.length() == 0) {
includeListMaterial = includeListMaterial.append(Util.getBlockId(targetName, false));
} else {
includeListMaterial.append(",").append(Util.getBlockId(targetName, false));
}
/* Include legacy IDs */
int legacyId = BukkitAdapter.ADAPTER.getLegacyBlockId((Material) restrictTarget);
if (legacyId > 0) {
includeListMaterial.append(",").append(legacyId);
}
targetName = ((Material) restrictTarget).name().toLowerCase(Locale.ROOT);
item = (!item ? !(((Material) restrictTarget).isBlock()) : item);
hasBlock = true;
} else if (restrictTarget instanceof EntityType) {
targetName = ((EntityType) restrictTarget).name();
if (includeListEntity.length() == 0) {
includeListEntity = includeListEntity.append(Util.getEntityId(targetName, false));
} else {
includeListEntity.append(",").append(Util.getEntityId(targetName, false));
}
targetName = ((EntityType) restrictTarget).name().toLowerCase(Locale.ROOT);
entity = true;
}
if (restrictCount == 0) {
restrict = restrict.append("" + targetName + "");
} else {
restrict.append(", ").append(targetName);
}
restrictCount++;
}
includeBlock = includeListMaterial.toString();
includeEntity = includeListEntity.toString();
}
if (entity) {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
return;
}
boolean optimizeCheck = false;
for (String arg : args) {
if (arg.trim().equalsIgnoreCase("#optimize")) {
optimizeCheck = true;
break;
}
}
final StringBuilder restrictTargets = restrict;
final String includeBlockFinal = includeBlock;
final boolean optimize = optimizeCheck;
final boolean hasBlockRestriction = hasBlock;
final int restrictCountFinal = restrictCount;
class BasicThread implements Runnable {
@Override
public void run() {
try {
long timestamp = (System.currentTimeMillis() / 1000L);
long timeStart = startTime > 0 ? (timestamp - startTime) : 0;
long timeEnd = timestamp - endTime;
@@ -104,32 +253,54 @@ public class PurgeCommand extends Consumer {
Connection connection = null;
for (int i = 0; i <= 5; i++) {
connection = Database.getConnection(false, 500);
if (connection != null) {
break;
}
Thread.sleep(1000);
}
if (connection == null) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.DATABASE_BUSY));
return;
}
if (argWid > 0) {
String worldName = CommandHandler.parseWorldName(args, false);
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_STARTED, worldName));
}
else {
} else {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_STARTED, "#global"));
}
if (hasBlockRestriction) {
Chat.sendGlobalMessage(player,
Phrase.build(Phrase.ROLLBACK_INCLUDE, restrictTargets.toString(), Selector.FIRST,
Selector.FIRST, (restrictCountFinal == 1 ? Selector.FIRST : Selector.SECOND))); // include
}
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_NOTICE_1));
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_NOTICE_2));
ConfigHandler.purgeRunning = true;
while (!Consumer.pausedSuccess) {
Thread.sleep(1);
}
Consumer.isPaused = true;
String query = "";
@@ -138,255 +309,401 @@ public class PurgeCommand extends Consumer {
String purgePrefix = "tmp_" + ConfigHandler.prefix;
if (!Config.getGlobal().MYSQL) {
query = "ATTACH DATABASE '" + ConfigHandler.path + ConfigHandler.sqlite + ".tmp' AS tmp_db";
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
purgePrefix = "tmp_db." + ConfigHandler.prefix;
}
Integer[] lastVersion = Patch.getDatabaseVersion(connection, true);
boolean newVersion = Util.newVersion(lastVersion, Util.getInternalPluginVersion());
if (newVersion && !ConfigHandler.EDITION_BRANCH.contains("-dev")) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
Consumer.isPaused = false;
ConfigHandler.purgeRunning = false;
return;
}
if (!Config.getGlobal().MYSQL) {
for (String table : ConfigHandler.databaseTables) {
try {
query = "DROP TABLE IF EXISTS " + purgePrefix + table + "";
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
Database.createDatabaseTables(purgePrefix, true);
Database.createDatabaseTables(purgePrefix, null, Config.getGlobal().MYSQL, true);
}
List<String> purgeTables = Arrays.asList("sign", "container", "item", "skull", "session", "chat", "command", "entity", "block");
List<String> worldTables = Arrays.asList("sign", "container", "item", "session", "chat", "command", "block");
List<String> purgeTables = Arrays.asList("sign", "container", "item", "skull", "session", "chat",
"command", "entity", "block");
List<String> worldTables = Arrays.asList("sign", "container", "item", "session", "chat", "command",
"block");
List<String> restrictTables = Arrays.asList("block");
List<String> excludeTables = Arrays.asList("database_lock"); // don't insert data into these tables
for (String table : ConfigHandler.databaseTables) {
String tableName = table.replaceAll("_", " ");
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_PROCESSING, tableName));
if (!Config.getGlobal().MYSQL) {
String columns = "";
ResultSet rs = connection.createStatement().executeQuery("SELECT * FROM " + purgePrefix + table);
ResultSet rs = connection.createStatement()
.executeQuery("SELECT * FROM " + purgePrefix + table);
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int columnCount = resultSetMetaData.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
String name = resultSetMetaData.getColumnName(i);
if (columns.length() == 0) {
columns = name;
}
else {
} else {
columns = columns + "," + name;
}
}
rs.close();
boolean error = false;
if (!excludeTables.contains(table)) {
try {
boolean purge = true;
String timeLimit = "";
if (purgeTables.contains(table)) {
String blockRestriction = "(";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type NOT IN(" + includeBlockFinal + ") OR (type IN("
+ includeBlockFinal + ") AND ";
} else if (hasBlockRestriction) {
purge = false;
}
if (argWid > 0 && worldTables.contains(table)) {
timeLimit = " WHERE (wid = '" + argWid + "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart + "')) OR wid != '" + argWid + "'";
}
else if (argWid == 0) {
timeLimit = " WHERE (time >= '" + timeEnd + "' OR time < '" + timeStart + "')";
timeLimit = " WHERE (" + blockRestriction + "wid = '" + argWid
+ "' AND (time >= '" + timeEnd + "' OR time < '" + timeStart
+ "'))) OR (wid != '" + argWid + "')";
} else if (argWid == 0 && purge) {
timeLimit = " WHERE " + blockRestriction + "(time >= '" + timeEnd
+ "' OR time < '" + timeStart + "'))";
}
}
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + timeLimit;
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM "
+ ConfigHandler.prefix + table + timeLimit;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
error = true;
e.printStackTrace();
}
}
if (error) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_ERROR, tableName));
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_REPAIRING));
try {
query = "DELETE FROM " + purgePrefix + table;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
try {
query = "REINDEX " + ConfigHandler.prefix + table;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
try {
String index = " NOT INDEXED";
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM " + ConfigHandler.prefix + table + index;
query = "INSERT INTO " + purgePrefix + table + " SELECT " + columns + " FROM "
+ ConfigHandler.prefix + table + index;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
abort = true;
break;
}
try {
boolean purge = purgeTables.contains(table);
String blockRestriction = "";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type IN(" + includeBlockFinal + ") AND ";
} else if (hasBlockRestriction) {
purge = false;
}
String worldRestriction = "";
if (argWid > 0 && worldTables.contains(table)) {
worldRestriction = " AND wid = '" + argWid + "'";
}
else if (argWid > 0) {
} else if (argWid > 0) {
purge = false;
}
if (purge) {
query = "DELETE FROM " + purgePrefix + table + " WHERE time < '" + timeEnd + "' AND time >= '" + timeStart + "'" + worldRestriction;
query = "DELETE FROM " + purgePrefix + table + " WHERE " + blockRestriction
+ "time < '" + timeEnd + "' AND time >= '" + timeStart + "'"
+ worldRestriction;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
if (purgeTables.contains(table)) {
int oldCount = 0;
try {
query = "SELECT COUNT(*) as count FROM " + ConfigHandler.prefix + table + " LIMIT 0, 1";
query = "SELECT COUNT(*) as count FROM " + ConfigHandler.prefix + table
+ " LIMIT 0, 1";
preparedStmt = connection.prepareStatement(query);
ResultSet resultSet = preparedStmt.executeQuery();
while (resultSet.next()) {
oldCount = resultSet.getInt("count");
}
resultSet.close();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
int new_count = 0;
try {
query = "SELECT COUNT(*) as count FROM " + purgePrefix + table + " LIMIT 0, 1";
preparedStmt = connection.prepareStatement(query);
ResultSet resultSet = preparedStmt.executeQuery();
while (resultSet.next()) {
new_count = resultSet.getInt("count");
}
resultSet.close();
preparedStmt.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
removed = removed + (oldCount - new_count);
}
}
if (Config.getGlobal().MYSQL) {
try {
boolean purge = purgeTables.contains(table);
String blockRestriction = "";
if (hasBlockRestriction && restrictTables.contains(table)) {
blockRestriction = "type IN(" + includeBlockFinal + ") AND ";
} else if (hasBlockRestriction) {
purge = false;
}
String worldRestriction = "";
if (argWid > 0 && worldTables.contains(table)) {
worldRestriction = " AND wid = '" + argWid + "'";
}
else if (argWid > 0) {
} else if (argWid > 0) {
purge = false;
}
if (purge) {
query = "DELETE FROM " + ConfigHandler.prefix + table + " WHERE time < '" + timeEnd + "' AND time >= '" + timeStart + "'" + worldRestriction;
query = "DELETE FROM " + ConfigHandler.prefix + table + " WHERE " + blockRestriction
+ "time < '" + timeEnd + "' AND time >= '" + timeStart + "'"
+ worldRestriction;
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
removed = removed + preparedStmt.getUpdateCount();
preparedStmt.close();
}
}
catch (Exception e) {
} catch (Exception e) {
if (!ConfigHandler.serverRunning) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
return;
}
e.printStackTrace();
}
}
}
if (Config.getGlobal().MYSQL && optimize) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_OPTIMIZING));
for (String table : ConfigHandler.databaseTables) {
query = "OPTIMIZE LOCAL TABLE " + ConfigHandler.prefix + table + "";
preparedStmt = connection.prepareStatement(query);
preparedStmt.execute();
preparedStmt.close();
}
}
connection.close();
if (abort) {
if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).delete();
}
ConfigHandler.loadDatabase();
Chat.sendGlobalMessage(player, Color.RED + Phrase.build(Phrase.PURGE_ABORTED));
Consumer.isPaused = false;
ConfigHandler.purgeRunning = false;
return;
}
if (!Config.getGlobal().MYSQL) {
(new File(ConfigHandler.path + ConfigHandler.sqlite)).delete();
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp")).renameTo(new File(ConfigHandler.path + ConfigHandler.sqlite));
(new File(ConfigHandler.path + ConfigHandler.sqlite + ".tmp"))
.renameTo(new File(ConfigHandler.path + ConfigHandler.sqlite));
}
ConfigHandler.loadDatabase();
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_SUCCESS));
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_ROWS, NumberFormat.getInstance().format(removed), (removed == 1 ? Selector.FIRST : Selector.SECOND)));
}
catch (Exception e) {
Chat.sendGlobalMessage(player,
Phrase.build(Phrase.PURGE_ROWS, NumberFormat.getInstance().format(removed),
(removed == 1 ? Selector.FIRST : Selector.SECOND)));
} catch (Exception e) {
Chat.sendGlobalMessage(player, Phrase.build(Phrase.PURGE_FAILED));
e.printStackTrace();
}
Consumer.isPaused = false;
ConfigHandler.purgeRunning = false;
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
}
}
@@ -1,66 +1,104 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.language.Phrase;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.command.CommandSender;
public class ReloadCommand {
protected static void runCommand(final CommandSender player, boolean permission, String[] args) {
if (permission) {
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (ConfigHandler.lookupThrottle.get(player.getName()) != null) {
Object[] lookupThrottle = ConfigHandler.lookupThrottle.get(player.getName());
if ((boolean) lookupThrottle[0] || ((System.currentTimeMillis() - (long) lookupThrottle[1])) < 100) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
return;
}
}
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
class BasicThread implements Runnable {
@Override
public void run() {
try {
if (Consumer.isPaused) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.RELOAD_STARTED));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.RELOAD_STARTED));
}
while (Consumer.isPaused) {
Thread.sleep(1);
}
Consumer.isPaused = true;
ConfigHandler.performInitialization(false);
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.RELOAD_SUCCESS));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.RELOAD_SUCCESS));
Thread networkHandler = new Thread(new NetworkHandler(false, false));
networkHandler.start();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
Consumer.isPaused = false;
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
ConfigHandler.lookupThrottle.put(player.getName(),
new Object[]
{ false, System.currentTimeMillis() });
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
@@ -6,7 +6,17 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.ContainerRollback;
import net.coreprotect.database.Database;
import net.coreprotect.database.lookup.PlayerLookup;
import net.coreprotect.database.rollback.Rollback;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -19,20 +29,12 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.ContainerRollback;
import net.coreprotect.database.Database;
import net.coreprotect.database.Rollback;
import net.coreprotect.database.lookup.PlayerLookup;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
public class RollbackRestoreCommand {
protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args, Location argLocation, long forceStart, long forceEnd) {
protected static void runCommand(CommandSender player, Command command, boolean permission, String[] args,
Location argLocation, long forceStart, long forceEnd)
{
Location lo = (argLocation != null ? argLocation : CommandHandler.parseLocation(player, args));
List<String> argUuids = new ArrayList<>();
List<String> argUsers = CommandHandler.parseUsers(args);
@@ -54,203 +56,346 @@ public class RollbackRestoreCommand {
String corecommand = args[0].toLowerCase(Locale.ROOT);
if (argBlocks == null || argExclude == null || argExcludeUsers == null) {
return;
}
/* check for invalid block/entity combinations (include) */
boolean hasBlock = false;
boolean hasEntity = false;
for (Object arg : argBlocks) {
if (arg instanceof Material) {
hasBlock = true;
}
else if (arg instanceof EntityType) {
} else if (arg instanceof EntityType) {
hasEntity = true;
if (argAction.size() == 0) {
argAction.add(3);
}
else if (!argAction.contains(3)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
} else if (!argAction.contains(3)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
return;
}
}
}
/* check for invalid block/entity combinations (exclude) */
for (Object arg : argExclude.keySet()) {
if (arg instanceof Material) {
hasBlock = true;
}
else if (arg instanceof EntityType) {
} else if (arg instanceof EntityType) {
hasEntity = true;
if (argAction.size() == 0) {
argAction.add(3);
}
else if (!argAction.contains(3)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
} else if (!argAction.contains(3)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
return;
}
}
}
if (hasBlock && hasEntity) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_INCLUDE_COMBO));
return;
}
if (count) {
LookupCommand.runCommand(player, command, permission, args);
return;
}
if (ConfigHandler.converterRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.UPGRADE_IN_PROGRESS));
return;
}
if (ConfigHandler.purgeRunning) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PURGE_IN_PROGRESS));
return;
}
if (argWid == -1) {
String worldName = CommandHandler.parseWorldName(args, true);
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.WORLD_NOT_FOUND, worldName));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.WORLD_NOT_FOUND, worldName));
return;
}
if (preview > 0 && (!(player instanceof Player))) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_IN_GAME));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_IN_GAME));
return;
}
if (argAction.contains(-1)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_ACTION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_ACTION));
return;
}
if (worldedit && argRadius == null) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_SELECTION, "WorldEdit"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_SELECTION, "WorldEdit"));
return;
}
if (argRadius != null && argRadius[0] == -1) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_RADIUS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_RADIUS));
return;
}
if (ConfigHandler.activeRollbacks.get(player.getName()) != null) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_IN_PROGRESS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_IN_PROGRESS));
return;
}
if (ConfigHandler.lookupThrottle.get(player.getName()) != null) {
Object[] lookupThrottle = ConfigHandler.lookupThrottle.get(player.getName());
if ((boolean) lookupThrottle[0] || ((System.currentTimeMillis() - (long) lookupThrottle[1])) < 100) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
return;
}
}
if (preview > 1 && forceStart <= 0) {
preview = 1;
}
if (permission) {
int a = 0;
if (corecommand.equals("restore") || corecommand.equals("rs") || corecommand.equals("re")) {
a = 1;
}
final int finalAction = a;
int DEFAULT_RADIUS = Config.getGlobal().DEFAULT_RADIUS;
if ((player instanceof Player || player instanceof BlockCommandSender) && argRadius == null && DEFAULT_RADIUS > 0 && !forceglobal && !argAction.contains(11)) {
if ((player instanceof Player || player instanceof BlockCommandSender) && argRadius == null
&& DEFAULT_RADIUS > 0 && !forceglobal && !argAction.contains(11))
{
Location location = lo;
int xmin = location.getBlockX() - DEFAULT_RADIUS;
int xmax = location.getBlockX() + DEFAULT_RADIUS;
int zmin = location.getBlockZ() - DEFAULT_RADIUS;
int zmax = location.getBlockZ() + DEFAULT_RADIUS;
argRadius = new Integer[] { DEFAULT_RADIUS, xmin, xmax, null, null, zmin, zmax, 0 };
}
// if (arg_radius==-2)arg_radius = -1;
int g = 1;
if (argUsers.contains("#global")) {
if (argRadius == null) {
g = 0;
}
}
if (argUsers.size() == 0 && (argWid > 0 || forceglobal) && argRadius == null) {
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.FIRST));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.FIRST));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_USER, Selector.SECOND));
}
return;
}
if (argAction.contains(4) && argAction.contains(11)) { // a:inventory
if (argUsers.size() == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ACTION_USER));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ACTION_USER));
return;
}
argExclude.put(Material.FIRE, false);
argExclude.put(Material.WATER, false);
argExclude.put(Material.FARMLAND, false);
argExcludeUsers.add("#hopper");
}
else if (!argAction.contains(4) && Config.getGlobal().EXCLUDE_TNT && !argExclude.containsKey(Material.TNT) && !argBlocks.contains(Material.TNT)) {
} else if (!argAction.contains(4) && Config.getGlobal().EXCLUDE_TNT && !argExclude.containsKey(Material.TNT)
&& !argBlocks.contains(Material.TNT))
{
argExclude.put(Material.TNT, true);
}
if (g == 1 && (argUsers.size() > 0 || (argUsers.size() == 0 && argRadius != null))) {
Integer MAX_RADIUS = Config.getGlobal().MAX_RADIUS;
if (argRadius != null) {
int radiusValue = argRadius[0];
if (radiusValue > MAX_RADIUS && MAX_RADIUS > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MAXIMUM_RADIUS, MAX_RADIUS.toString(), (finalAction == 0 ? Selector.SECOND : Selector.THIRD)));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.GLOBAL_ROLLBACK, "r:#global", (finalAction == 0 ? Selector.FIRST : Selector.SECOND)));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MAXIMUM_RADIUS, MAX_RADIUS.toString(),
(finalAction == 0 ? Selector.SECOND : Selector.THIRD)));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.GLOBAL_ROLLBACK, "r:#global",
(finalAction == 0 ? Selector.FIRST : Selector.SECOND)));
return;
}
}
if (argAction.size() > 0) {
if (argAction.contains(4)) {
if (argUsers.contains("#global") || (argUsers.size() == 0 && argRadius == null)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ACTION_USER));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ACTION_USER));
return;
}
else if (preview > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_TRANSACTION, !argAction.contains(11) ? Selector.FIRST : Selector.SECOND));
} else if (preview > 0) {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PREVIEW_TRANSACTION,
!argAction.contains(11) ? Selector.FIRST : Selector.SECOND));
return;
}
}
if (argAction.contains(8) || (argAction.contains(11) && !argAction.contains(4)) || (!argAction.contains(0) && !argAction.contains(1) && !argAction.contains(3) && !argAction.contains(4))) {
if (argAction.contains(8) || (argAction.contains(11) && !argAction.contains(4))
|| (!argAction.contains(0) && !argAction.contains(1) && !argAction.contains(3)
&& !argAction.contains(4)))
{
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ACTION_NOT_SUPPORTED));
}
return;
}
}
if (argUsers.size() == 0) {
argUsers.add("#global");
}
List<String> rollbackusers = argUsers;
int c = 0;
for (String ruser : rollbackusers) {
List<Player> players = Bukkit.getServer().matchPlayer(ruser); // here
for (Player p : players) {
if (p.getName().equalsIgnoreCase(ruser)) {
ruser = p.getName();
rollbackusers.set(c, ruser);
}
}
c++;
if (argAction.contains(4) && argAction.contains(11)) {
Player onlineUser = Bukkit.getServer().getPlayer(ruser);
if (onlineUser == null || !onlineUser.isOnline()) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.USER_OFFLINE, ruser));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.USER_OFFLINE, ruser));
return;
}
}
}
int wid = 0;
@@ -258,29 +403,45 @@ public class RollbackRestoreCommand {
int y = 0;
int z = 0;
if (rollbackusers.contains("#container")) {
if (argAction.contains(11)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_USERNAME, "#container"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_USERNAME, "#container"));
return;
}
boolean valid = false;
if (ConfigHandler.lookupType.get(player.getName()) != null) {
int lookupType = ConfigHandler.lookupType.get(player.getName());
if (lookupType == 1) {
valid = true;
}
else if (lookupType == 5) {
} else if (lookupType == 5) {
if (ConfigHandler.lookupUlist.get(player.getName()).contains("#container")) {
valid = true;
}
}
}
if (valid) {
if (preview > 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_TRANSACTION, Selector.FIRST));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.PREVIEW_TRANSACTION, Selector.FIRST));
return;
}
else {
} else {
String lcommand = ConfigHandler.lookupCommand.get(player.getName());
String[] data = lcommand.split("\\.");
x = Integer.parseInt(data[0]);
@@ -293,9 +454,13 @@ public class RollbackRestoreCommand {
lo = new Location(Bukkit.getServer().getWorld(Util.getWorldName(wid)), x, y, z);
Block block = lo.getBlock();
if (block.getState() instanceof Chest) {
BlockFace[] blockFaces = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
BlockFace[] blockFaces = new BlockFace[] { BlockFace.NORTH, BlockFace.EAST,
BlockFace.SOUTH, BlockFace.WEST };
for (BlockFace face : blockFaces) {
if (block.getRelative(face, 1).getState() instanceof Chest) {
Block relative = block.getRelative(face, 1);
int x2 = relative.getX();
int z2 = relative.getZ();
@@ -304,30 +469,43 @@ public class RollbackRestoreCommand {
lo.setX(newX);
lo.setZ(newZ);
break;
}
}
}
}
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_CONTAINER));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.INVALID_CONTAINER));
return;
}
}
final List<String> rollbackusers2 = rollbackusers;
if (startTime > 0) {
long unixtimestamp = (System.currentTimeMillis() / 1000L);
long timeStart = unixtimestamp - startTime;
long timeEnd = endTime > 0 ? (unixtimestamp - endTime) : 0;
if (forceStart > 0) {
timeStart = forceStart;
timeEnd = forceEnd;
}
final long finalTimeStart = timeStart;
final long finalTimeEnd = timeEnd;
final Integer[] radius = argRadius;
try {
final CommandSender player2 = player;
final int noisy = argNoisy;
final String rtime = ts;
@@ -344,147 +522,257 @@ public class RollbackRestoreCommand {
ConfigHandler.activeRollbacks.put(player.getName(), true);
class BasicThread2 implements Runnable {
@Override
public void run() {
try (Connection connection = Database.getConnection(false, 1000)) {
ConfigHandler.lookupThrottle.put(player.getName(), new Object[] { true, System.currentTimeMillis() });
ConfigHandler.lookupThrottle.put(player.getName(),
new Object[]
{ true, System.currentTimeMillis() });
int action = finalAction;
Location location = locationFinal;
if (connection != null) {
Statement statement = connection.createStatement();
String baduser = "";
boolean exists = false;
for (String check : rollbackusers2) {
if (!check.equals("#global") && !check.equals("#container")) {
exists = PlayerLookup.playerExists(connection, check);
if (!exists) {
baduser = check;
break;
}
}
else {
} else {
exists = true;
}
}
if (exists) {
for (String check : euserlist) {
if (!check.equals("#global") && !check.equals("#hopper")) {
exists = PlayerLookup.playerExists(connection, check);
if (!exists) {
baduser = check;
break;
}
}
else if (check.equals("#global")) {
} else if (check.equals("#global")) {
baduser = "#global";
exists = false;
}
}
}
if (exists) {
boolean restrictWorld = false;
if (radius != null) {
restrictWorld = true;
}
if (location == null) {
restrictWorld = false;
}
if (finalArgWid > 0) {
restrictWorld = true;
location = new Location(Bukkit.getServer().getWorld(Util.getWorldName(finalArgWid)), 0, 0, 0);
location = new Location(
Bukkit.getServer().getWorld(Util.getWorldName(finalArgWid)), 0,
0, 0);
}
boolean verbose = false;
if (noisy == 1) {
verbose = true;
}
String users = "";
for (String value : rollbackusers2) {
if (users.length() == 0) {
users = "" + value + "";
}
else {
} else {
users = users + ", " + value;
}
}
if (users.equals("#global") && restrictWorld) {
// chat output only, don't pass into any functions
users = "#" + location.getWorld().getName();
}
if (finalPreview == 2) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.PREVIEW_CANCELLING));
}
else if (finalPreview == 1) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.THIRD));
}
else if (action == 0) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.FIRST));
}
else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.SECOND));
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- " + Phrase.build(Phrase.PREVIEW_CANCELLING));
} else if (finalPreview == 1) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- "
+ Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.THIRD));
} else if (action == 0) {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- "
+ Phrase.build(Phrase.ROLLBACK_STARTED, users, Selector.FIRST));
} else {
Chat.sendMessage(player2,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.ROLLBACK_STARTED, users,
Selector.SECOND));
}
if (finalArgAction.contains(5)) {
ContainerRollback.performContainerRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, finalTimeStart, finalTimeEnd, restrictWorld, false, verbose, action);
}
else {
Rollback.performRollbackRestore(statement, player2, uuidList, rollbackusers2, rtime, blist, elist, euserlist, finalArgAction, location, radius, finalTimeStart, finalTimeEnd, restrictWorld, false, verbose, action, finalPreview);
ContainerRollback.performContainerRollbackRestore(statement, player2,
uuidList, rollbackusers2, rtime, blist, elist, euserlist,
finalArgAction, location, radius, finalTimeStart, finalTimeEnd,
restrictWorld, false, verbose, action);
} else {
Rollback.performRollbackRestore(statement, player2, uuidList,
rollbackusers2, rtime, blist, elist, euserlist, finalArgAction,
location, radius, finalTimeStart, finalTimeEnd, restrictWorld,
false, verbose, action, finalPreview);
}
if (finalPreview < 2) {
List<Object> list = new ArrayList<>();
list.add(finalTimeStart);
list.add(finalTimeEnd);
list.add(finalArgs);
list.add(locationFinal);
ConfigHandler.lastRollback.put(player2.getName(), list);
}
} else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE
+ "- " + Phrase.build(Phrase.USER_NOT_FOUND, baduser));
}
else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.USER_NOT_FOUND, baduser));
}
statement.close();
} else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.DATABASE_BUSY));
}
else {
Chat.sendMessage(player2, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.DATABASE_BUSY));
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
if (ConfigHandler.activeRollbacks.get(player2.getName()) != null) {
ConfigHandler.activeRollbacks.remove(player2.getName());
}
ConfigHandler.lookupThrottle.put(player2.getName(), new Object[] { false, System.currentTimeMillis() });
ConfigHandler.lookupThrottle.put(player2.getName(),
new Object[]
{ false, System.currentTimeMillis() });
}
}
Runnable runnable = new BasicThread2();
Thread thread = new Thread(runnable);
thread.start();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
else {
} else {
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.SECOND));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.THIRD));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.SECOND));
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_LOOKUP_TIME, Selector.THIRD));
}
}
}
else {
} else {
if (finalAction == 0) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.FIRST)); // rollback
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.SECOND)); // restore
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.FIRST)); // rollback
} else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_ROLLBACK_RADIUS, Selector.SECOND)); // restore
}
}
} else {
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
}
}
}
@@ -1,11 +1,6 @@
package net.coreprotect.command;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
@@ -17,117 +12,240 @@ import net.coreprotect.patch.Patch;
import net.coreprotect.thread.NetworkHandler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
public class StatusCommand {
private static ConcurrentHashMap<String, Boolean> alert = new ConcurrentHashMap<>();
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
class BasicThread implements Runnable {
@Override
public void run() {
try {
CoreProtect instance = CoreProtect.getInstance();
PluginDescriptionFile pdfFile = instance.getDescription();
String versionCheck = "";
if (Config.getGlobal().CHECK_UPDATES) {
String latestVersion = NetworkHandler.latestVersion();
if (latestVersion != null) {
versionCheck = " (" + Phrase.build(Phrase.LATEST_VERSION, "v" + latestVersion) + ")";
}
}
Chat.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "-----");
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_VERSION, Color.WHITE, ConfigHandler.EDITION_NAME + " v" + pdfFile.getVersion() + ".") + versionCheck);
Chat.sendMessage(player,
Color.WHITE + "----- " + Color.DARK_AQUA + "CoreProtect"
+ (Util.isCommunityEdition() ? " " + ConfigHandler.COMMUNITY_EDITION : "")
+ Color.WHITE + " -----");
Chat.sendMessage(player,
Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_VERSION, Color.WHITE,
ConfigHandler.EDITION_NAME + " v" + pdfFile.getVersion() + ".")
+ versionCheck);
String donationKey = NetworkHandler.donationKey();
if (donationKey != null) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE, Phrase.build(Phrase.VALID_DONATION_KEY)) + " (" + donationKey + ")");
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE, Phrase.build(Phrase.INVALID_DONATION_KEY)) + Color.GREY + Color.ITALIC + " (" + Phrase.build(Phrase.CHECK_CONFIG) + ")");
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE,
Phrase.build(Phrase.VALID_DONATION_KEY)) + " (" + donationKey + ")");
} else {
Chat.sendMessage(player,
Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_LICENSE, Color.WHITE,
Phrase.build(Phrase.INVALID_DONATION_KEY))
+ Color.GREY + Color.ITALIC + " (" + Phrase.build(Phrase.CHECK_CONFIG) + ")");
}
/*
CoreProtect show RAM usage
Items processed (since server start)
Items processed (last 60 minutes)
* Items processed (since server start) Items processed (last 60 minutes)
*/
// Using MySQL/SQLite (Database Size: 587MB)
String firstVersion = Patch.getFirstVersion();
if (firstVersion.length() > 0) {
firstVersion = " (" + Phrase.build(Phrase.FIRST_VERSION, firstVersion) + ")";
}
if (Config.getGlobal().MYSQL) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "MySQL") + firstVersion);
}
else {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "SQLite") + firstVersion);
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "MySQL") + firstVersion);
} else {
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_DATABASE, Color.WHITE, "SQLite") + firstVersion);
}
if (ConfigHandler.worldeditEnabled) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.FIRST));
}
else if (instance.getServer().getPluginManager().getPlugin("WorldEdit") != null) {
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.SECOND));
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.FIRST));
} else if (instance.getServer().getPluginManager().getPlugin("WorldEdit") != null) {
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.STATUS_INTEGRATION, Color.WHITE, "WorldEdit", Selector.SECOND));
}
try {
int consumerCount = 0;
int currentConsumerSize = Process.getCurrentConsumerSize();
if (currentConsumerSize == 0) {
consumerCount = Consumer.getConsumerSize(0) + Consumer.getConsumerSize(1);
}
else {
} else {
int consumerId = (Consumer.currentConsumer == 1) ? 1 : 0;
consumerCount = Consumer.getConsumerSize(consumerId) + currentConsumerSize;
}
if (consumerCount >= 1 && (player instanceof Player)) {
if (Config.getConfig(((Player) player).getWorld()).PLAYER_COMMANDS) {
consumerCount = consumerCount - 1;
}
}
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.STATUS_CONSUMER, Color.WHITE, String.format("%,d", consumerCount), (consumerCount == 1 ? Selector.FIRST : Selector.SECOND)));
}
catch (Exception e) {
Chat.sendMessage(player,
Color.DARK_AQUA + Phrase.build(Phrase.STATUS_CONSUMER, Color.WHITE,
String.format("%,d", consumerCount),
(consumerCount == 1 ? Selector.FIRST : Selector.SECOND)));
} catch (Exception e) {
e.printStackTrace();
}
// Functions.sendMessage(player, Color.DARK_AQUA + "Website: " + Color.WHITE + "www.coreprotect.net/updates/");
try {
// Functions.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DISCORD, Color.WHITE + "www.coreprotect.net/discord/").replaceFirst(":", ":" + Color.WHITE));
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.LINK_DISCORD, Color.WHITE, "www.coreprotect.net/discord/"));
Chat.sendMessage(player, Color.DARK_AQUA + Phrase.build(Phrase.LINK_PATREON, Color.WHITE, "www.patreon.com/coreprotect/"));
String cpuInfo = "";
if (ConfigHandler.processorInfo != null) {
String modelName = ConfigHandler.processorInfo.getProcessorIdentifier().getName();
if (modelName.contains(" CPU")) {
String[] split = modelName.split(" CPU")[0].split(" ");
modelName = split[split.length - 1];
} else if (modelName.contains(" Processor")) {
String[] split = modelName.split(" Processor")[0].split(" ");
modelName = split[split.length - 1];
}
String cpuSpeed = String.valueOf(ConfigHandler.processorInfo.getMaxFreq());
cpuSpeed = String.format("%.2f", Long.valueOf(cpuSpeed) / 1000000000.0);
cpuInfo = "x" + Runtime.getRuntime().availableProcessors() + " " + cpuSpeed + "GHz "
+ modelName + ".";
} else {
cpuInfo = "x" + Runtime.getRuntime().availableProcessors() + " "
+ Phrase.build(Phrase.CPU_CORES);
}
int mb = 1024 * 1024;
Runtime runtime = Runtime.getRuntime();
String usedRAM = String.format("%.2f",
Double.valueOf((runtime.totalMemory() - runtime.freeMemory()) / mb) / 1000.0);
String totalRAM = String.format("%.2f", Double.valueOf(runtime.maxMemory() / mb) / 1000.0);
String systemInformation = Phrase.build(Phrase.RAM_STATS, usedRAM, totalRAM);
if (cpuInfo.length() > 0) {
systemInformation = cpuInfo + " (" + systemInformation + ")";
}
Chat.sendMessage(player,
Color.DARK_AQUA + Phrase.build(Phrase.STATUS_SYSTEM, Color.WHITE, systemInformation));
} catch (Exception e) {
e.printStackTrace();
}
// Functions.sendMessage(player, Color.DARK_AQUA + "Website: " + Color.WHITE +
// "www.coreprotect.net/updates/");
// Functions.sendMessage(player, Color.DARK_AQUA +
// Phrase.build(Phrase.LINK_DISCORD, Color.WHITE +
// "www.coreprotect.net/discord/").replaceFirst(":", ":" + Color.WHITE));
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.LINK_DISCORD, Color.WHITE, "www.coreprotect.net/discord/"));
Chat.sendMessage(player, Color.DARK_AQUA
+ Phrase.build(Phrase.LINK_PATREON, Color.WHITE, "www.patreon.com/coreprotect/"));
if (player.isOp() && alert.get(player.getName()) == null) {
alert.put(player.getName(), true);
if (instance.getServer().getPluginManager().getPlugin("CoreEdit") == null) {
Thread.sleep(500);
/*
Functions.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA + "Recommended Plugin " + Color.WHITE + "-----");
Functions.sendMessage(player, Color.DARK_AQUA + "Notice: " + Color.WHITE + "Enjoy CoreProtect? Check out CoreEdit!");
Functions.sendMessage(player, Color.DARK_AQUA + "Download: " + Color.WHITE + "www.coreedit.net/download/");
*/
* Functions.sendMessage(player, Color.WHITE + "----- " + Color.DARK_AQUA +
* "Recommended Plugin " + Color.WHITE + "-----"); Functions.sendMessage(player,
* Color.DARK_AQUA + "Notice: " + Color.WHITE +
* "Enjoy CoreProtect? Check out CoreEdit!"); Functions.sendMessage(player,
* Color.DARK_AQUA + "Download: " + Color.WHITE + "www.coreedit.net/download/");
*/
}
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
Runnable runnable = new BasicThread();
Thread thread = new Thread(runnable);
thread.start();
}
}
@@ -7,7 +7,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
import net.coreprotect.config.ConfigHandler;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
@@ -17,60 +17,99 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import net.coreprotect.config.ConfigHandler;
public class TabHandler implements TabCompleter {
// private static String[] COMMANDS = new String[] { "help", "inspect", "rollback", "restore", "lookup", "purge", "reload", "status", "near", "undo" }; // max 10!
private static String[] HELP = new String[] { "inspect", "rollback", "restore", "lookup", "purge", "teleport", "status", "params", "users", "time", "radius", "action", "include", "exclude" };
private static String[] PARAMS = new String[] { "user:", "time:", "radius:", "action:", "include:", "exclude:", "#container" };
private static String[] ACTIONS = new String[] { "block", "+block", "-block", "click", "kill", "+container", "-container", "container", "chat", "command", "+inventory", "-inventory", "inventory", "item", "+item", "-item", "sign", "session", "+session", "-session", "username" };
// private static String[] COMMANDS = new String[] { "help", "inspect",
// "rollback", "restore", "lookup", "purge",
// "reload", "status", "near", "undo" }; // max 10!
private static String[] HELP = new String[] { "inspect", "rollback", "restore", "lookup", "purge", "teleport",
"status", "params", "users", "time", "radius", "action", "include", "exclude" };
private static String[] PARAMS = new String[] { "user:", "time:", "radius:", "action:", "include:", "exclude:",
"#container" };
private static String[] ACTIONS = new String[] { "block", "+block", "-block", "click", "kill", "+container",
"-container", "container", "chat", "command", "+inventory", "-inventory", "inventory", "item", "+item",
"-item", "sign", "session", "+session", "-session", "username" };
private static String[] NUMBERS = new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
private static String[] TIMES = new String[] { "w", "d", "h", "m", "s" };
private static ArrayList<String> materials = null;
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player) || args.length == 0) {
return null;
}
if (args.length == 1) {
String argument = args[0].toLowerCase(Locale.ROOT);
List<String> completions = new ArrayList<>();
if (sender.hasPermission("coreprotect.help")) {
completions.add("help");
}
if (sender.hasPermission("coreprotect.inspect")) {
completions.add("inspect");
}
if (sender.hasPermission("coreprotect.rollback")) {
completions.add("rollback");
}
if (sender.hasPermission("coreprotect.restore")) {
completions.add("restore");
}
if (sender.hasPermission("coreprotect.lookup")) {
completions.add("lookup");
}
if (sender.hasPermission("coreprotect.purge")) {
completions.add("purge");
}
if (sender.hasPermission("coreprotect.reload")) {
completions.add("reload");
}
if (sender.hasPermission("coreprotect.status")) {
completions.add("status");
}
if (sender.hasPermission("coreprotect.lookup.near")) {
completions.add("near");
}
if (sender.hasPermission("coreprotect.restore")) {
completions.add("undo");
}
return StringUtil.copyPartialMatches(argument, completions, new ArrayList<>(completions.size()));
}
else if (args.length > 1) {
} else if (args.length > 1) {
String argument0 = args[0].toLowerCase(Locale.ROOT);
String argument1 = args[1].toLowerCase(Locale.ROOT);
String currentArg = args[args.length - 1].toLowerCase(Locale.ROOT).trim();
@@ -89,319 +128,548 @@ public class TabHandler implements TabCompleter {
boolean validContainer = false;
boolean pageLookup = false;
if (ConfigHandler.lookupType.get(sender.getName()) != null && ConfigHandler.lookupPage.get(sender.getName()) != null) {
if (ConfigHandler.lookupType.get(sender.getName()) != null
&& ConfigHandler.lookupPage.get(sender.getName()) != null)
{
pageLookup = true;
}
for (int i = 1; i < args.length; i++) {
String arg = args[i].toLowerCase(Locale.ROOT);
if (arg.equals("#container")) {
hasContainer = true;
}
else if (arg.equals("#count") || arg.equals("#sum")) {
} else if (arg.equals("#count") || arg.equals("#sum")) {
hasCount = true;
}
else if (arg.equals("#preview")) {
} else if (arg.equals("#preview")) {
hasPreview = true;
}
else if ((!arg.contains(":") && !args[i - 1].contains(":") && args.length > (i + 1)) || arg.contains("u:") || arg.contains("user:") || arg.contains("users:") || arg.contains("p:")) {
} else if ((!arg.contains(":") && !args[i - 1].contains(":") && args.length > (i + 1))
|| arg.contains("u:") || arg.contains("user:") || arg.contains("users:") || arg.contains("p:"))
{
hasUser = true;
}
else if (arg.contains("page:")) {
} else if (arg.contains("page:")) {
hasPage = true;
}
else if (arg.contains("a:") || arg.contains("action:")) {
} else if (arg.contains("a:") || arg.contains("action:")) {
hasAction = true;
}
else if (arg.contains("i:") || arg.contains("include:") || arg.contains("item:") || arg.contains("items:") || arg.contains("b:") || arg.contains("block:") || arg.contains("blocks:")) {
} else if (arg.contains("i:") || arg.contains("include:") || arg.contains("item:")
|| arg.contains("items:") || arg.contains("b:") || arg.contains("block:")
|| arg.contains("blocks:"))
{
hasInclude = true;
}
else if (arg.contains("t:") || arg.contains("time:")) {
} else if (arg.contains("t:") || arg.contains("time:")) {
hasTime = true;
}
else if (arg.contains("e:") || arg.contains("exclude:")) {
} else if (arg.contains("e:") || arg.contains("exclude:")) {
hasExclude = true;
}
else if (arg.contains("r:") || arg.contains("radius:")) {
} else if (arg.contains("r:") || arg.contains("radius:")) {
hasRadius = true;
}
}
if (!hasContainer) {
if (ConfigHandler.lookupType.get(sender.getName()) != null) {
int lookupType = ConfigHandler.lookupType.get(sender.getName());
if (lookupType == 1) {
validContainer = true;
}
else if (lookupType == 5) {
} else if (lookupType == 5) {
if (ConfigHandler.lookupUlist.get(sender.getName()).contains("#container")) {
validContainer = true;
}
}
}
}
if (lastArg.equals("a:") || lastArg.equals("action:")) {
if ((lastArg.equals("a:") || lastArg.equals("action:")) && (sender.hasPermission("coreprotect.lookup")
|| sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore")))
{
List<String> completions = new ArrayList<>(Arrays.asList(ACTIONS));
return StringUtil.copyPartialMatches(currentArg, completions, new ArrayList<>(completions.size()));
}
else if (currentArg.startsWith("a:") || currentArg.startsWith("action:")) {
} else if ((currentArg.startsWith("a:") || currentArg.startsWith("action:"))
&& (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback")
|| sender.hasPermission("coreprotect.restore")))
{
String arg = "";
String[] split = currentArg.split(":", 2);
String filter = split[0] + ":";
if (split.length > 1) {
arg = split[1];
}
List<String> completions = new ArrayList<>(Arrays.asList(ACTIONS));
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + completions.get(index));
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
}
else if (lastArg.equals("u:") || lastArg.equals("user:") || lastArg.equals("users:") || lastArg.equals("p:")) {
} else if ((lastArg.equals("u:") || lastArg.equals("user:") || lastArg.equals("users:")
|| lastArg.equals("p:"))
&& (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback")
|| sender.hasPermission("coreprotect.restore")))
{
return null;
}
else if (currentArg.startsWith("u:") || currentArg.startsWith("user:") || currentArg.startsWith("users:") || currentArg.startsWith("p:")) {
} else if ((currentArg.startsWith("u:") || currentArg.startsWith("user:") || currentArg.startsWith("users:")
|| currentArg.startsWith("p:"))
&& (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback")
|| sender.hasPermission("coreprotect.restore")))
{
String arg = "";
String[] split = currentArg.split(":", 2);
String filter = split[0] + ":";
if (split.length > 1) {
arg = split[1];
}
List<String> completions = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
List<String> completions = Bukkit.getOnlinePlayers().stream().map(Player::getName)
.collect(Collectors.toList());
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + completions.get(index));
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
}
else if (lastArg.equals("t:") || lastArg.equals("time:") || currentArg.startsWith("t:") || currentArg.startsWith("time:")) {
} else if ((lastArg.equals("t:") || lastArg.equals("time:") || currentArg.startsWith("t:")
|| currentArg.startsWith("time:"))
&& (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback")
|| sender.hasPermission("coreprotect.restore")
|| sender.hasPermission("coreprotect.purge")))
{
String filter = lastArg;
String arg = "";
if (currentArg.contains(":")) {
String[] split = currentArg.split(":", 2);
filter = split[0] + ":";
if (split.length > 1) {
arg = split[1];
}
}
else {
} else {
filter = "";
arg = currentArg;
}
List<String> completions = new ArrayList<>();
if (arg.chars().allMatch(Character::isDigit)) {
boolean addNumbers = true;
if (currentArg.length() > 0) {
char lastChar = currentArg.charAt(currentArg.length() - 1);
if (Character.isDigit(lastChar)) {
completions.addAll(Arrays.asList(TIMES));
addNumbers = false;
}
}
if (addNumbers) {
completions.addAll(Arrays.asList(NUMBERS));
}
}
completions = new ArrayList<>(completions);
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + arg + completions.get(index));
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
}
else if (lastArg.equals("page:") || currentArg.startsWith("page:")) {
} else if ((lastArg.equals("page:") || currentArg.startsWith("page:"))
&& (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.lookup.near")
|| sender.hasPermission("coreprotect.inspect")))
{
String filter = lastArg;
String arg = "";
if (currentArg.contains(":")) {
String[] split = currentArg.split(":", 2);
filter = split[0] + ":";
if (split.length > 1) {
arg = split[1];
}
}
else {
} else {
filter = "";
arg = currentArg;
}
if (arg.chars().allMatch(Character::isDigit)) {
List<String> completions = new ArrayList<>(Arrays.asList(NUMBERS));
if (arg.length() < 1) {
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + arg + completions.get(index));
}
if (arg.length() == 0) {
completions.remove(0);
}
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
return StringUtil.copyPartialMatches(filter + arg, completions,
new ArrayList<>(completions.size()));
}
}
else if (lastArg.equals("r:") || lastArg.equals("radius:") || currentArg.startsWith("r:") || currentArg.startsWith("radius:")) {
} else if ((lastArg.equals("r:") || lastArg.equals("radius:") || currentArg.startsWith("r:")
|| currentArg.startsWith("radius:"))
&& (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback")
|| sender.hasPermission("coreprotect.restore")
|| sender.hasPermission("coreprotect.purge")))
{
String filter = lastArg;
String arg = "";
if (currentArg.contains(":")) {
String[] split = currentArg.split(":", 2);
filter = split[0] + ":";
if (split.length > 1) {
arg = split[1];
}
}
else {
} else {
filter = "";
arg = currentArg;
}
if (!argument0.equals("purge") && arg.chars().allMatch(Character::isDigit)) {
List<String> completions = new ArrayList<>(Arrays.asList(NUMBERS));
if (arg.length() < 2) {
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + arg + completions.get(index));
}
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
}
else if (argument0.equals("purge") || arg.startsWith("#")) {
return StringUtil.copyPartialMatches(filter + arg, completions,
new ArrayList<>(completions.size()));
} else if (argument0.equals("purge") || arg.startsWith("#")) {
ArrayList<String> params = new ArrayList<>();
params.add("#global");
if (!argument0.equals("purge") && sender.getServer().getPluginManager().getPlugin("WorldEdit") != null) {
if (!argument0.equals("purge")
&& sender.getServer().getPluginManager().getPlugin("WorldEdit") != null)
{
params.add("#worldedit");
}
List<World> worlds = sender.getServer().getWorlds();
for (World world : worlds) {
params.add("#" + world.getName());
}
List<String> completions = new ArrayList<>(params);
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + completions.get(index));
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
return StringUtil.copyPartialMatches(filter + arg, completions,
new ArrayList<>(completions.size()));
}
}
else if (lastArg.equals("i:") || lastArg.equals("include:") || lastArg.equals("item:") || lastArg.equals("items:") || lastArg.equals("b:") || lastArg.equals("block:") || lastArg.equals("blocks:") || currentArg.startsWith("i:") || currentArg.startsWith("include:") || currentArg.startsWith("item:") || currentArg.startsWith("items:") || currentArg.startsWith("b:") || currentArg.startsWith("block:") || currentArg.startsWith("blocks:") || lastArg.equals("e:") || lastArg.equals("exclude:") || currentArg.startsWith("e:") || currentArg.startsWith("exclude:")) {
} else if ((sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback")
|| sender.hasPermission("coreprotect.restore"))
&& (lastArg.equals("i:") || lastArg.equals("include:") || lastArg.equals("item:")
|| lastArg.equals("items:") || lastArg.equals("b:") || lastArg.equals("block:")
|| lastArg.equals("blocks:") || currentArg.startsWith("i:")
|| currentArg.startsWith("include:") || currentArg.startsWith("item:")
|| currentArg.startsWith("items:") || currentArg.startsWith("b:")
|| currentArg.startsWith("block:") || currentArg.startsWith("blocks:")
|| lastArg.equals("e:") || lastArg.equals("exclude:") || currentArg.startsWith("e:")
|| currentArg.startsWith("exclude:")))
{
String filter = lastArg;
String arg = "";
if (currentArg.contains(":")) {
String[] split = currentArg.split(":", 2);
filter = split[0] + ":";
if (split.length > 1) {
arg = split[1];
}
}
else {
} else {
filter = "";
arg = currentArg;
}
if (materials == null) {
List<Material> addList = Arrays.asList(Material.ARMOR_STAND);
List<Material> excludeList = Arrays.asList(Material.GRASS);
List<Material> excludeList = Arrays.asList();
Set<String> materialList = new HashSet<>();
Material[] materialValues = Material.values();
for (Material material : materialValues) {
if (material.isBlock() || material.isItem()) {
materialList.add(material.name().toLowerCase(Locale.ROOT));
}
}
for (Material exclude : excludeList) {
materialList.remove(exclude.name().toLowerCase(Locale.ROOT));
}
for (Material add : addList) {
materialList.add(add.name().toLowerCase(Locale.ROOT));
}
// add custom tags
for (String tag : CommandHandler.getTags().keySet()) {
materialList.add(tag);
}
materials = new ArrayList<>(materialList);
}
List<String> completions = new ArrayList<>(materials);
for (int index = 0; index < completions.size(); index++) {
completions.set(index, filter + completions.get(index));
}
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
}
else if (args.length == 2) {
if (argument0.equals("help")) {
} else if (args.length == 2) {
if (argument0.equals("help") && sender.hasPermission("coreprotect.help")) {
List<String> completions = new ArrayList<>(Arrays.asList(HELP));
return StringUtil.copyPartialMatches(argument1, completions, new ArrayList<>(completions.size()));
}
else if (argument0.equals("purge")) {
List<String> completions = new ArrayList<>(Arrays.asList("t:", "r:"));
} else if (argument0.equals("purge") && sender.hasPermission("coreprotect.purge")) {
List<String> completions = new ArrayList<>(Arrays.asList("t:", "r:", "i:"));
return StringUtil.copyPartialMatches(argument1, completions, new ArrayList<>(completions.size()));
}
else if (argument0.equals("l") || argument0.equals("lookup") || argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro") || argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re")) {
List<String> completions = new ArrayList<>(filterParams(true, argument0, argument1, hasUser, hasAction, hasInclude, hasExclude, hasRadius, hasTime, hasContainer, hasCount, hasPreview, pageLookup, validContainer));
completions.addAll(Bukkit.getOnlinePlayers().stream().filter(player -> player.getName().toLowerCase(Locale.ROOT).startsWith(argument1)).map(Player::getName).collect(Collectors.toList()));
} else if ((sender.hasPermission("coreprotect.lookup")
&& (argument0.equals("l") || argument0.equals("lookup")))
|| (sender.hasPermission("coreprotect.rollback")
&& (argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro")))
|| (sender.hasPermission("coreprotect.restore")
&& (argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re"))))
{
List<String> completions = new ArrayList<>(filterParams(true, argument0, argument1, hasUser,
hasAction, hasInclude, hasExclude, hasRadius, hasTime, hasContainer, hasCount, hasPreview,
pageLookup, validContainer));
completions.addAll(Bukkit.getOnlinePlayers().stream()
.filter(player -> player.getName().toLowerCase(Locale.ROOT).startsWith(argument1))
.map(Player::getName).collect(Collectors.toList()));
return StringUtil.copyPartialMatches(argument1, completions, new ArrayList<>(completions.size()));
}
}
else if (args.length == 3 && argument0.equals("purge")) {
} else if (args.length == 3 && argument0.equals("purge") && sender.hasPermission("coreprotect.purge")) {
if (argument1.startsWith("t:")) {
List<String> completions = new ArrayList<>(Arrays.asList("r:"));
return StringUtil.copyPartialMatches(args[2].toLowerCase(Locale.ROOT), completions, new ArrayList<>(completions.size()));
}
else if (argument1.startsWith("r:")) {
List<String> completions = new ArrayList<>(Arrays.asList("r:", "i:"));
return StringUtil.copyPartialMatches(args[2].toLowerCase(Locale.ROOT), completions,
new ArrayList<>(completions.size()));
} else if (argument1.startsWith("r:") || argument1.startsWith("i:")) {
List<String> completions = new ArrayList<>(Arrays.asList("t:"));
return StringUtil.copyPartialMatches(args[2].toLowerCase(Locale.ROOT), completions, new ArrayList<>(completions.size()));
return StringUtil.copyPartialMatches(args[2].toLowerCase(Locale.ROOT), completions,
new ArrayList<>(completions.size()));
}
return Arrays.asList("");
}
else if (argument0.equals("l") || argument0.equals("lookup") || argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro") || argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re")) {
} else if ((sender.hasPermission("coreprotect.lookup")
&& (argument0.equals("l") || argument0.equals("lookup")))
|| (sender.hasPermission("coreprotect.rollback")
&& (argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro")))
|| (sender.hasPermission("coreprotect.restore")
&& (argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re"))))
{
if ((!argument0.equals("l") && !argument0.equals("lookup")) || !hasPage) {
ArrayList<String> params = filterParams(false, argument0, currentArg, hasUser, hasAction, hasInclude, hasExclude, hasRadius, hasTime, hasContainer, hasCount, hasPreview, pageLookup, validContainer);
ArrayList<String> params = filterParams(false, argument0, currentArg, hasUser, hasAction,
hasInclude, hasExclude, hasRadius, hasTime, hasContainer, hasCount, hasPreview, pageLookup,
validContainer);
List<String> completions = new ArrayList<>(params);
return StringUtil.copyPartialMatches(currentArg, completions, new ArrayList<>(completions.size()));
}
}
}
return Arrays.asList("");
}
private ArrayList<String> filterParams(boolean firstParam, String lastArgument, String argument, boolean hasUser, boolean hasAction, boolean hasInclude, boolean hasExclude, boolean hasRadius, boolean hasTime, boolean hasContainer, boolean hasCount, boolean hasPreview, boolean pageLookup, boolean validContainer) {
private ArrayList<String> filterParams(boolean firstParam, String lastArgument, String argument, boolean hasUser,
boolean hasAction, boolean hasInclude, boolean hasExclude, boolean hasRadius, boolean hasTime,
boolean hasContainer, boolean hasCount, boolean hasPreview, boolean pageLookup, boolean validContainer)
{
ArrayList<String> params = new ArrayList<>();
for (String param : PARAMS) {
if (param.equals("user:") && !hasUser) {
params.add(param);
}
else if (param.equals("action:") && !hasAction) {
} else if (param.equals("action:") && !hasAction) {
params.add(param);
}
else if (param.equals("include:") && !hasInclude) {
} else if (param.equals("include:") && !hasInclude) {
params.add(param);
}
else if (param.equals("exclude:") && !hasExclude) {
} else if (param.equals("exclude:") && !hasExclude) {
params.add(param);
}
else if (param.equals("radius:") && !hasRadius) {
} else if (param.equals("radius:") && !hasRadius) {
params.add(param);
}
else if (param.equals("time:") && !hasTime) {
} else if (param.equals("time:") && !hasTime) {
params.add(param);
}
else if (param.equals("#container") && !hasContainer && !hasRadius && validContainer) {
} else if (param.equals("#container") && !hasContainer && !hasRadius && validContainer) {
params.add(param);
}
}
if (firstParam && pageLookup && (lastArgument.equals("l") || lastArgument.equals("lookup"))) {
params.add("page:");
}
else if (!firstParam && argument.startsWith("#")) {
} else if (!firstParam && argument.startsWith("#")) {
if (!hasCount) {
params.add("#count");
}
if (!hasPreview) {
params.add("#preview");
}
}
return params;
}
}
@@ -1,58 +1,78 @@
package net.coreprotect.command;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatMessage;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Teleport;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.ChatMessage;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Teleport;
import net.coreprotect.utility.Util;
public class TeleportCommand {
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
int resultc = args.length;
if (!permission) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
return;
}
if (!(player instanceof Player)) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.TELEPORT_PLAYERS));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.TELEPORT_PLAYERS));
return;
}
if (ConfigHandler.teleportThrottle.get(player.getName()) != null) {
Object[] lookupThrottle = ConfigHandler.teleportThrottle.get(player.getName());
if ((boolean) lookupThrottle[0] || ((System.currentTimeMillis() - (long) lookupThrottle[1])) < 500) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_THROTTLED));
Chat.sendMessage(player,
Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_THROTTLED));
return;
}
}
if (resultc < 3) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
return;
}
String worldName = args[1];
int wid = Util.matchWorld(worldName);
if (wid == -1 && resultc >= 5) {
Chat.sendMessage(player, new ChatMessage(Phrase.build(Phrase.WORLD_NOT_FOUND, worldName)).build());
return;
}
Location location = ((Player) player).getLocation().clone();
World world = location.getWorld();
if (wid > -1) {
world = Bukkit.getServer().getWorld(Util.getWorldName(wid));
}
String x = null;
@@ -60,36 +80,55 @@ public class TeleportCommand {
String z = null;
for (int i = 1; i < args.length; i++) {
if (i == 1 && wid > -1) {
continue;
}
if (x == null) {
x = args[i].replaceAll("[^0-9.\\-]", "");
}
else if (z == null) {
} else if (z == null) {
z = args[i].replaceAll("[^0-9.\\-]", "");
}
else if (y == null) {
} else if (y == null) {
y = z;
z = args[i].replaceAll("[^0-9.\\-]", "");
}
}
if (y == null) {
if (location.getBlockY() > 63) {
location.setY(63);
}
y = Double.toString(location.getY());
}
String xValidate = x.replaceAll("[^.\\-]", "");
String yValidate = y.replaceAll("[^.\\-]", "");
String zValidate = z.replaceAll("[^.\\-]", "");
if ((x.length() == 0 || x.length() >= 12 || x.equals(xValidate)) || (y.length() == 0 || y.length() >= 12 || y.equals(yValidate)) || (z.length() == 0 || z.length() >= 12 || z.equals(zValidate))) {
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
if ((x.length() == 0 || x.length() >= 12 || x.equals(xValidate))
|| (y.length() == 0 || y.length() >= 12 || y.equals(yValidate))
|| (z.length() == 0 || z.length() >= 12 || z.equals(zValidate)))
{
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.MISSING_PARAMETERS, "/co teleport <world> <x> <y> <z>"));
return;
}
location.setWorld(world);
@@ -99,13 +138,21 @@ public class TeleportCommand {
int chunkX = location.getBlockX() >> 4;
int chunkZ = location.getBlockZ() >> 4;
if (location.getWorld().isChunkLoaded(chunkX, chunkZ) == false) {
location.getWorld().getChunkAt(location);
}
Scheduler.runTask(CoreProtect.getInstance(), () -> {
// Teleport the player to a safe location
Teleport.performSafeTeleport(((Player) player), location, true);
if (!location.getWorld().isChunkLoaded(chunkX, chunkZ)) {
location.getWorld().getChunkAt(location);
}
// Teleport the player to a safe location
Teleport.performSafeTeleport(((Player) player), location, true);
}, location);
ConfigHandler.teleportThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
}
}
@@ -1,53 +1,74 @@
package net.coreprotect.command;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.language.Phrase;
import net.coreprotect.language.Selector;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
public class UndoCommand {
protected static void runCommand(CommandSender user, Command command, boolean permission, String[] args) {
try {
if (ConfigHandler.lastRollback.get(user.getName()) != null) {
List<Object> list = ConfigHandler.lastRollback.get(user.getName());
long startTime = (Long) list.get(0);
long endTime = (Long) list.get(1);
args = (String[]) list.get(2);
Location location = (Location) list.get(3);
for (String arg : args) {
if (arg.equals("#preview")) {
CancelCommand.runCommand(user, command, permission, args);
return;
}
}
boolean valid = true;
if (args[0].equals("rollback") || args[0].equals("rb") || args[0].equals("ro")) {
args[0] = "restore";
}
else if (args[0].equals("restore") || args[0].equals("rs") || args[0].equals("re")) {
} else if (args[0].equals("restore") || args[0].equals("rs") || args[0].equals("re")) {
args[0] = "rollback";
}
else {
} else {
valid = false;
}
if (valid) {
ConfigHandler.lastRollback.remove(user.getName());
RollbackRestoreCommand.runCommand(user, command, permission, args, location, startTime, endTime);
}
} else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- "
+ Phrase.build(Phrase.NO_ROLLBACK, Selector.SECOND));
}
else {
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_ROLLBACK, Selector.SECOND));
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,42 +1,51 @@
package net.coreprotect.command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.World;
import net.coreprotect.worldedit.WorldEditLogger;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class WorldEditHandler {
protected static Integer[] runWorldEditCommand(CommandSender user) {
Integer[] result = null;
try {
WorldEditPlugin worldEdit = WorldEditLogger.getWorldEdit(user.getServer());
if (worldEdit != null && user instanceof Player) {
LocalSession session = worldEdit.getSession((Player) user);
World world = session.getSelectionWorld();
if (world != null) {
Region region = session.getSelection(world);
if (region != null && world.getName().equals(((Player) user).getWorld().getName())) {
BlockVector3 block = region.getMinimumPoint();
int x = block.getBlockX();
int y = block.getBlockY();
int z = block.getBlockZ();
int x = block.x();
int y = block.y();
int z = block.z();
int width = region.getWidth();
int height = region.getHeight();
int length = region.getLength();
int max = width;
if (height > max) {
max = height;
}
if (length > max) {
max = length;
}
int xMin = x;
int xMax = x + (width - 1);
int yMin = y;
@@ -44,13 +53,21 @@ public class WorldEditHandler {
int zMin = z;
int zMax = z + (length - 1);
result = new Integer[] { max, xMin, xMax, yMin, yMax, zMin, zMax, 1 };
}
}
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
+243 -108
View File
@@ -1,33 +1,29 @@
package net.coreprotect.config;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.CompletableFuture;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import net.coreprotect.CoreProtect;
import net.coreprotect.language.Language;
import net.coreprotect.thread.Scheduler;
public class Config extends Language {
private static final Map<String, String[]> HEADERS = new HashMap<>();
private static final Map<String, String> DEFAULT_VALUES = new LinkedHashMap<>();
private static final Map<String, Config> CONFIG_BY_WORLD_NAME = new HashMap<>();
private static final WeakHashMap<World, Config> CONFIG_BY_WORLD = new WeakHashMap<>();
private static final String DEFAULT_FILE_HEADER = "# CoreProtect Config";
public static final String LINE_SEPARATOR = "\n";
private static final Config GLOBAL = new Config();
@@ -41,12 +37,14 @@ public class Config extends Language {
public String MYSQL_USERNAME;
public String MYSQL_PASSWORD;
public String LANGUAGE;
public boolean ENABLE_AWE;
public boolean ENABLE_SSL;
public boolean DISABLE_WAL;
public boolean HOVER_EVENTS;
public boolean DATABASE_LOCK;
public boolean LOG_CANCELLED_CHAT;
public boolean HOPPER_FILTER_META;
public boolean EXCLUDE_TNT;
public boolean NETWORK_DEBUG;
public boolean MYSQL;
public boolean CHECK_UPDATES;
public boolean API_ENABLED;
@@ -70,6 +68,7 @@ public class Config extends Language {
public boolean TREE_GROWTH;
public boolean MUSHROOM_GROWTH;
public boolean VINE_GROWTH;
public boolean SCULK_SPREAD;
public boolean PORTALS;
public boolean WATER_FLOW;
public boolean LAVA_FLOW;
@@ -82,13 +81,16 @@ public class Config extends Language {
public boolean PLAYER_MESSAGES;
public boolean PLAYER_COMMANDS;
public boolean PLAYER_SESSIONS;
public boolean UNKNOWN_LOGGING;
public boolean USERNAME_CHANGES;
public boolean WORLDEDIT;
public int MAXIMUM_POOL_SIZE;
public int MYSQL_PORT;
public int DEFAULT_RADIUS;
public int MAX_RADIUS;
static {
DEFAULT_VALUES.put("donation-key", "");
DEFAULT_VALUES.put("use-mysql", "false");
DEFAULT_VALUES.put("table-prefix", "co_");
@@ -122,6 +124,7 @@ public class Config extends Language {
DEFAULT_VALUES.put("tree-growth", "true");
DEFAULT_VALUES.put("mushroom-growth", "true");
DEFAULT_VALUES.put("vine-growth", "true");
DEFAULT_VALUES.put("sculk-spread", "true");
DEFAULT_VALUES.put("portals", "true");
DEFAULT_VALUES.put("water-flow", "true");
DEFAULT_VALUES.put("lava-flow", "true");
@@ -137,56 +140,128 @@ public class Config extends Language {
DEFAULT_VALUES.put("username-changes", "true");
DEFAULT_VALUES.put("worldedit", "true");
HEADERS.put("donation-key", new String[] { "# CoreProtect is donationware. For more information, visit our project page." });
HEADERS.put("use-mysql", new String[] { "# MySQL is optional and not required.", "# If you prefer to use MySQL, enable the following and fill out the fields." });
HEADERS.put("language", new String[] { "# If modified, will automatically attempt to translate languages phrases.", "# List of language codes: https://coreprotect.net/languages/" });
HEADERS.put("check-updates", new String[] { "# If enabled, CoreProtect will check for updates when your server starts up.", "# If an update is available, you'll be notified via your server console.", });
HEADERS.put("api-enabled", new String[] { "# If enabled, other plugins will be able to utilize the CoreProtect API.", });
HEADERS.put("verbose", new String[] { "# If enabled, extra data is displayed during rollbacks and restores.", "# Can be manually triggered by adding \"#verbose\" to your rollback command." });
HEADERS.put("default-radius", new String[] { "# If no radius is specified in a rollback or restore, this value will be", "# used as the radius. Set to \"0\" to disable automatically adding a radius." });
HEADERS.put("max-radius", new String[] { "# The maximum radius that can be used in a command. Set to \"0\" to disable.", "# To run a rollback or restore without a radius, you can use \"r:#global\"." });
HEADERS.put("rollback-items", new String[] { "# If enabled, items taken from containers (etc) will be included in rollbacks." });
HEADERS.put("rollback-entities", new String[] { "# If enabled, entities, such as killed animals, will be included in rollbacks." });
HEADERS.put("skip-generic-data", new String[] { "# If enabled, generic data, like zombies burning in daylight, won't be logged." });
HEADERS.put("donation-key",
new String[]
{ "# CoreProtect is donationware. Obtain a donation key from coreprotect.net/donate/" });
HEADERS.put("use-mysql",
new String[]
{ "# MySQL is optional and not required.",
"# If you prefer to use MySQL, enable the following and fill out the fields." });
HEADERS.put("language",
new String[]
{ "# If modified, will automatically attempt to translate languages phrases.",
"# List of language codes: https://coreprotect.net/languages/" });
HEADERS.put("check-updates",
new String[]
{ "# If enabled, CoreProtect will check for updates when your server starts up.",
"# If an update is available, you'll be notified via your server console.", });
HEADERS.put("api-enabled",
new String[]
{ "# If enabled, other plugins will be able to utilize the CoreProtect API.", });
HEADERS.put("verbose",
new String[]
{ "# If enabled, extra data is displayed during rollbacks and restores.",
"# Can be manually triggered by adding \"#verbose\" to your rollback command." });
HEADERS.put("default-radius",
new String[]
{ "# If no radius is specified in a rollback or restore, this value will be",
"# used as the radius. Set to \"0\" to disable automatically adding a radius." });
HEADERS.put("max-radius",
new String[]
{ "# The maximum radius that can be used in a command. Set to \"0\" to disable.",
"# To run a rollback or restore without a radius, you can use \"r:#global\"." });
HEADERS.put("rollback-items",
new String[]
{ "# If enabled, items taken from containers (etc) will be included in rollbacks." });
HEADERS.put("rollback-entities",
new String[]
{ "# If enabled, entities, such as killed animals, will be included in rollbacks." });
HEADERS.put("skip-generic-data",
new String[]
{ "# If enabled, generic data, like zombies burning in daylight, won't be logged." });
HEADERS.put("block-place", new String[] { "# Logs blocks placed by players." });
HEADERS.put("block-break", new String[] { "# Logs blocks broken by players." });
HEADERS.put("natural-break", new String[] { "# Logs blocks that break off of other blocks; for example, a sign or torch", "# falling off of a dirt block that a player breaks. This is required for", "# beds/doors to properly rollback." });
HEADERS.put("block-movement", new String[] { "# Properly track block movement, such as sand or gravel falling." });
HEADERS.put("natural-break",
new String[]
{ "# Logs blocks that break off of other blocks; for example, a sign or torch",
"# falling off of a dirt block that a player breaks. This is required for",
"# beds/doors to properly rollback." });
HEADERS.put("block-movement",
new String[]
{ "# Properly track block movement, such as sand or gravel falling." });
HEADERS.put("pistons", new String[] { "# Properly track blocks moved by pistons." });
HEADERS.put("block-burn", new String[] { "# Logs blocks that burn up in a fire." });
HEADERS.put("block-ignite", new String[] { "# Logs when a block naturally ignites, such as from fire spreading." });
HEADERS.put("block-ignite",
new String[]
{ "# Logs when a block naturally ignites, such as from fire spreading." });
HEADERS.put("explosions", new String[] { "# Logs explosions, such as TNT and Creepers." });
HEADERS.put("entity-change", new String[] { "# Track when an entity changes a block, such as an Enderman destroying blocks." });
HEADERS.put("entity-change",
new String[]
{ "# Track when an entity changes a block, such as an Enderman destroying blocks." });
HEADERS.put("entity-kills", new String[] { "# Logs killed entities, such as killed cows and enderman." });
HEADERS.put("sign-text", new String[] { "# Logs text on signs. If disabled, signs will be blank when rolled back." });
HEADERS.put("buckets", new String[] { "# Logs lava and water sources placed/removed by players who are using buckets." });
HEADERS.put("sign-text",
new String[]
{ "# Logs text on signs. If disabled, signs will be blank when rolled back." });
HEADERS.put("buckets",
new String[]
{ "# Logs lava and water sources placed/removed by players who are using buckets." });
HEADERS.put("leaf-decay", new String[] { "# Logs natural tree leaf decay." });
HEADERS.put("tree-growth", new String[] { "# Logs tree growth. Trees are linked to the player who planted the sappling." });
HEADERS.put("tree-growth",
new String[]
{ "# Logs tree growth. Trees are linked to the player who planted the sapling." });
HEADERS.put("mushroom-growth", new String[] { "# Logs mushroom growth." });
HEADERS.put("vine-growth", new String[] { "# Logs natural vine growth." });
HEADERS.put("sculk-spread", new String[] { "# Logs the spread of sculk blocks from sculk catalysts." });
HEADERS.put("portals", new String[] { "# Logs when portals such as Nether portals generate naturally." });
HEADERS.put("water-flow", new String[] { "# Logs water flow. If water destroys other blocks, such as torches,", "# this allows it to be properly rolled back." });
HEADERS.put("lava-flow", new String[] { "# Logs lava flow. If lava destroys other blocks, such as torches,", "# this allows it to be properly rolled back." });
HEADERS.put("liquid-tracking", new String[] { "# Allows liquid to be properly tracked and linked to players.", "# For example, if a player places water which flows and destroys torches,", "# it can all be properly restored by rolling back that single player." });
HEADERS.put("item-transactions", new String[] { "# Track item transactions, such as when a player takes items from", "# a chest, furnace, or dispenser." });
HEADERS.put("water-flow",
new String[]
{ "# Logs water flow. If water destroys other blocks, such as torches,",
"# this allows it to be properly rolled back." });
HEADERS.put("lava-flow",
new String[]
{ "# Logs lava flow. If lava destroys other blocks, such as torches,",
"# this allows it to be properly rolled back." });
HEADERS.put("liquid-tracking",
new String[]
{ "# Allows liquid to be properly tracked and linked to players.",
"# For example, if a player places water which flows and destroys torches,",
"# it can all be properly restored by rolling back that single player." });
HEADERS.put("item-transactions",
new String[]
{ "# Track item transactions, such as when a player takes items from",
"# a chest, furnace, or dispenser." });
HEADERS.put("item-drops", new String[] { "# Logs items dropped by players." });
HEADERS.put("item-pickups", new String[] { "# Logs items picked up by players." });
HEADERS.put("hopper-transactions", new String[] { "# Track all hopper transactions, such as when a hopper removes items from a", "# chest, furnace, or dispenser." });
HEADERS.put("player-interactions", new String[] { "# Track player interactions, such as when a player opens a door, presses", "# a button, or opens a chest. Player interactions can't be rolled back." });
HEADERS.put("hopper-transactions",
new String[]
{ "# Track all hopper transactions, such as when a hopper removes items from a",
"# chest, furnace, or dispenser." });
HEADERS.put("player-interactions",
new String[]
{ "# Track player interactions, such as when a player opens a door, presses",
"# a button, or opens a chest. Player interactions can't be rolled back." });
HEADERS.put("player-messages", new String[] { "# Logs messages that players send in the chat." });
HEADERS.put("player-commands", new String[] { "# Logs all commands used by players." });
HEADERS.put("player-sessions", new String[] { "# Logs the logins and logouts of players." });
HEADERS.put("username-changes", new String[] { "# Logs when a player changes their Minecraft username." });
HEADERS.put("worldedit", new String[] { "# Logs changes made via the plugin \"WorldEdit\" if it's in use on your server." });
HEADERS.put("worldedit",
new String[]
{ "# Logs changes made via the plugin \"WorldEdit\" if it's in use on your server." });
}
private void readValues() {
this.ENABLE_AWE = this.getBoolean("enable-awe", false);
this.ENABLE_SSL = this.getBoolean("enable-ssl", false);
this.DISABLE_WAL = this.getBoolean("disable-wal", false);
this.HOVER_EVENTS = this.getBoolean("hover-events", true);
this.DATABASE_LOCK = this.getBoolean("database-lock", true);
this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true);
this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
this.NETWORK_DEBUG = this.getBoolean("network-debug", false);
this.UNKNOWN_LOGGING = this.getBoolean("unknown-logging", false);
this.MAXIMUM_POOL_SIZE = this.getInt("maximum-pool-size", 10);
this.DONATION_KEY = this.getString("donation-key");
this.MYSQL = this.getBoolean("use-mysql");
this.PREFIX = this.getString("table-prefix");
@@ -220,6 +295,7 @@ public class Config extends Language {
this.TREE_GROWTH = this.getBoolean("tree-growth");
this.MUSHROOM_GROWTH = this.getBoolean("mushroom-growth");
this.VINE_GROWTH = this.getBoolean("vine-growth");
this.SCULK_SPREAD = this.getBoolean("sculk-spread");
this.PORTALS = this.getBoolean("portals");
this.WATER_FLOW = this.getBoolean("water-flow");
this.LAVA_FLOW = this.getBoolean("lava-flow");
@@ -234,92 +310,140 @@ public class Config extends Language {
this.PLAYER_SESSIONS = this.getBoolean("player-sessions");
this.USERNAME_CHANGES = this.getBoolean("username-changes");
this.WORLDEDIT = this.getBoolean("worldedit");
}
public static void init() throws IOException {
parseConfig(loadFiles(ConfigFile.CONFIG));
// pass variables to ConfigFile.parseConfig(ConfigFile.loadFiles());
}
public static Config getGlobal() {
return GLOBAL;
}
// returns a world specific config if it exists, otherwise the global config
public static Config getConfig(final World world) {
Config ret = CONFIG_BY_WORLD.get(world);
return getConfig(world.getName());
}
public static Config getConfig(final String worldName) {
Config ret = CONFIG_BY_WORLD_NAME.get(worldName);
if (ret == null) {
ret = CONFIG_BY_WORLD_NAME.getOrDefault(world.getName(), GLOBAL);
CONFIG_BY_WORLD.put(world, ret);
ret = CONFIG_BY_WORLD_NAME.getOrDefault(worldName, GLOBAL);
CONFIG_BY_WORLD_NAME.put(worldName, ret);
}
return ret;
}
public Config() {
this.config = new LinkedHashMap<>();
}
public void setDefaults(final Config defaults) {
this.defaults = defaults;
}
private String get(final String key, final String dfl) {
String configured = this.config.get(key);
if (configured == null) {
if (dfl != null) {
return dfl;
}
if (this.defaults == null) {
configured = DEFAULT_VALUES.get(key);
}
else {
} else {
configured = this.defaults.config.getOrDefault(key, DEFAULT_VALUES.get(key));
}
}
return configured;
}
private boolean getBoolean(final String key) {
final String configured = this.get(key, null);
return configured != null && configured.startsWith("t");
return configured != null && StringUtils.startsWith(configured, "t");
}
private boolean getBoolean(final String key, final boolean dfl) {
final String configured = this.get(key, null);
return configured == null ? dfl : configured.startsWith("t");
return configured == null ? dfl : StringUtils.startsWith(configured, "t");
}
private int getInt(final String key) {
return this.getInt(key, 0);
}
private int getInt(final String key, final int dfl) {
String configured = this.get(key, null);
if (configured == null) {
return dfl;
}
configured = configured.replaceAll("[^0-9]", "");
return configured.isEmpty() ? 0 : Integer.parseInt(configured);
return StringUtils.isEmpty(configured) ? dfl : Integer.parseInt(configured);
}
private String getString(final String key) {
final String configured = this.get(key, null);
return configured == null ? "" : configured;
}
public void clearConfig() {
this.config.clear();
}
public void loadDefaults() {
this.clearConfig();
this.readValues();
}
public void load(final InputStream in) throws IOException {
// if we fail reading, we will not corrupt our current config.
final Map<String, String> newConfig = new LinkedHashMap<>(this.config.size());
ConfigFile.load(in, newConfig, false);
@@ -328,92 +452,130 @@ public class Config extends Language {
this.config.putAll(newConfig);
this.readValues();
}
private static Map<String, byte[]> loadFiles(String fileName) throws IOException {
final CoreProtect plugin = CoreProtect.getInstance();
final File configFolder = plugin.getDataFolder();
if (!configFolder.exists()) {
configFolder.mkdirs();
}
final Map<String, byte[]> map = new HashMap<>();
final File globalFile = new File(configFolder, fileName);
if (globalFile.exists()) {
// we always add options to the global config
final byte[] data = Files.readAllBytes(globalFile.toPath());
map.put("config", data);
if (!globalFile.exists() || globalFile.length() == 0) {
// can't modify GLOBAL, we're likely off-main here
final Config temp = new Config();
temp.load(new ByteArrayInputStream(data));
temp.addMissingOptions(globalFile);
}
else {
final Config temp = new Config();
temp.loadDefaults();
temp.addMissingOptions(globalFile);
}
try (final InputStream in = plugin.getResource(fileName)) {
if (in == null) {
throw new IOException("Missing bundled resource: " + fileName);
}
Files.copy(in, globalFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
map.put("config", Files.readAllBytes(globalFile.toPath()));
final File[] files = configFolder.listFiles((File file) -> StringUtils.endsWith(file.getName(), ".yml"));
if (files != null) {
for (final File worldConfigFile : files) {
final String name = worldConfigFile.getName();
if (name.equals(ConfigFile.CONFIG) || name.equals(ConfigFile.LANGUAGE)) {
continue;
}
map.put(StringUtils.substring(name, 0, name.length() - ".yml".length()),
Files.readAllBytes(worldConfigFile.toPath()));
for (final File worldConfigFile : configFolder.listFiles((File file) -> file.getName().endsWith(".yml"))) {
final String name = worldConfigFile.getName();
if (name.equals(ConfigFile.CONFIG) || name.equals(ConfigFile.LANGUAGE)) {
continue;
}
map.put(name.substring(0, name.length() - ".yml".length()), Files.readAllBytes(worldConfigFile.toPath()));
}
return map;
}
// this should only be called on the main thread
private static void parseConfig(final Map<String, byte[]> data) {
if (!Bukkit.isPrimaryThread()) {
// we call reloads asynchronously
// for now this solution is good enough to ensure we only modify on the main thread
// for now this solution is good enough to ensure we only modify on the main
// thread
final CompletableFuture<Void> complete = new CompletableFuture<>();
Bukkit.getScheduler().runTask(CoreProtect.getInstance(), () -> {
Scheduler.runTask(CoreProtect.getInstance(), () -> {
try {
parseConfig(data);
}
catch (final Throwable thr) {
} catch (final Throwable thr) {
if (thr instanceof ThreadDeath) {
throw (ThreadDeath) thr;
}
complete.completeExceptionally(thr);
return;
}
complete.complete(null);
});
complete.join();
return;
}
CONFIG_BY_WORLD_NAME.clear();
CONFIG_BY_WORLD.clear();
// we need to load global first since it is used for config defaults
final byte[] defaultData = data.get("config");
if (defaultData != null) {
try {
GLOBAL.load(new ByteArrayInputStream(defaultData));
}
catch (final IOException ex) {
} catch (final IOException ex) {
throw new RuntimeException(ex); // shouldn't happen
}
}
else {
} else {
GLOBAL.loadDefaults();
}
for (final Map.Entry<String, byte[]> entry : data.entrySet()) {
final String worldName = entry.getKey();
if (worldName.equals("config")) {
if ("config".equals(worldName)) {
continue;
}
final byte[] fileData = entry.getValue();
@@ -421,52 +583,25 @@ public class Config extends Language {
config.setDefaults(GLOBAL);
try {
config.load(new ByteArrayInputStream(fileData));
}
catch (final IOException ex) {
} catch (final IOException ex) {
throw new RuntimeException(ex); // shouldn't happen
}
CONFIG_BY_WORLD_NAME.put(worldName, config);
}
}
public void addMissingOptions(final File file) throws IOException {
final boolean writeHeader = !file.exists() || file.length() == 0;
try (final FileOutputStream fout = new FileOutputStream(file, true)) {
OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(fout), StandardCharsets.UTF_8);
if (writeHeader) {
out.append(DEFAULT_FILE_HEADER);
out.append(LINE_SEPARATOR);
}
for (final Map.Entry<String, String> entry : DEFAULT_VALUES.entrySet()) {
final String key = entry.getKey();
final String defaultValue = entry.getValue();
return;
final String configuredValue = this.config.get(key);
if (configuredValue != null) {
continue;
}
final String[] header = HEADERS.get(key);
if (header != null) {
out.append(LINE_SEPARATOR);
for (final String headerLine : header) {
out.append(headerLine);
out.append(LINE_SEPARATOR);
}
}
out.append(key);
out.append(": ");
out.append(defaultValue);
out.append(LINE_SEPARATOR);
}
out.close();
}
}
}
}
@@ -22,7 +22,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import net.coreprotect.CoreProtect;
import net.coreprotect.language.Language;
import net.coreprotect.language.Phrase;
@@ -39,20 +38,27 @@ public class ConfigFile extends Config {
private final HashMap<String, String> lang;
public static void init(String fileName) throws IOException {
for (Phrase phrase : Phrase.values()) {
DEFAULT_VALUES.put(phrase.name(), phrase.getPhrase());
USER_VALUES.put(phrase.name(), phrase.getUserPhrase());
}
boolean isCache = fileName.startsWith(".");
loadFiles(fileName, isCache);
}
public ConfigFile() {
this.lang = new LinkedHashMap<>();
}
public void load(final InputStream in, String fileName, boolean isCache) throws IOException {
// if we fail reading, we will not corrupt our current config.
final Map<String, String> newConfig = new LinkedHashMap<>(this.lang.size());
ConfigFile.load(in, newConfig, true);
@@ -61,32 +67,50 @@ public class ConfigFile extends Config {
this.lang.putAll(newConfig);
for (final Entry<String, String> entry : this.lang.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (DEFAULT_VALUES.containsKey(key) && value.length() > 0 && (!isCache || DEFAULT_VALUES.get(key).equals(USER_VALUES.get(key)))) {
if (DEFAULT_VALUES.containsKey(key) && value.length() > 0
&& (!isCache || DEFAULT_VALUES.get(key).equals(USER_VALUES.get(key))))
{
Phrase phrase = Phrase.valueOf(key);
if (!isCache) {
Language.setUserPhrase(phrase, value);
}
Language.setTranslatedPhrase(phrase, value);
}
}
}
// this function will close in
public static void load(final InputStream in, final Map<String, String> config, boolean forceCase) throws IOException {
public static void load(final InputStream in, final Map<String, String> config, boolean forceCase)
throws IOException
{
try (final InputStream in0 = in) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
if (line.startsWith("#")) {
continue;
}
final int split = line.indexOf(':');
if (split == -1) {
continue;
}
String key = line.substring(0, split).trim();
@@ -94,38 +118,51 @@ public class ConfigFile extends Config {
// Strip out single and double quotes from the start/end of the value
if (value.length() >= 2 && value.startsWith("'") && value.endsWith("'")) {
value = value.replaceAll("^'|'$", "");
value = value.replace("''", "'");
value = value.replace("\\'", "'");
value = value.replace("\\\\", "\\");
}
else if (value.length() >= 2 && value.startsWith("\"") && value.endsWith("\"")) {
} else if (value.length() >= 2 && value.startsWith("\"") && value.endsWith("\"")) {
value = value.replaceAll("^\"|\"$", "");
value = value.replace("\\\"", "\"");
value = value.replace("\\\\", "\\");
}
if (forceCase) {
key = key.toUpperCase(Locale.ROOT);
}
config.put(key, value);
}
reader.close();
}
}
private static Map<String, byte[]> loadFiles(String fileName, boolean isCache) throws IOException {
final CoreProtect plugin = CoreProtect.getInstance();
final File configFolder = plugin.getDataFolder();
if (!configFolder.exists()) {
configFolder.mkdirs();
}
final Map<String, byte[]> map = new HashMap<>();
final File globalFile = new File(configFolder, fileName);
if (globalFile.exists()) {
// we always add options to the global config
final byte[] data = Files.readAllBytes(globalFile.toPath());
map.put("config", data);
@@ -133,80 +170,112 @@ public class ConfigFile extends Config {
final ConfigFile temp = new ConfigFile();
temp.load(new ByteArrayInputStream(data), fileName, isCache);
temp.addMissingOptions(globalFile);
}
else {
} else {
final ConfigFile temp = new ConfigFile();
temp.addMissingOptions(globalFile);
}
return map;
}
@Override
public void addMissingOptions(final File file) throws IOException {
if (file.getName().startsWith(".")) {
return;
}
final boolean writeHeader = !file.exists() || file.length() == 0;
try (final FileOutputStream fout = new FileOutputStream(file, true)) {
OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(fout), StandardCharsets.UTF_8);
if (writeHeader) {
out.append(DEFAULT_FILE_HEADER);
out.append(Config.LINE_SEPARATOR);
}
for (final Entry<String, String> entry : DEFAULT_VALUES.entrySet()) {
final String key = entry.getKey();
final String defaultValue = entry.getValue().replaceAll("\"", "\\\\\"");
final String configuredValue = this.lang.get(key);
if (configuredValue != null) {
continue;
}
out.append(Config.LINE_SEPARATOR);
out.append(key);
out.append(": ");
out.append("\"" + defaultValue + "\"");
}
out.close();
}
}
public static void modifyLine(String fileName, String oldLine, String newLine) {
try {
Path path = Paths.get(ConfigHandler.path + fileName);
List<String> lines = Files.readAllLines(path);
for (int i = 0; i < lines.size(); i++) {
if (lines.get(i).equalsIgnoreCase(oldLine)) {
if (newLine != null && newLine.length() > 0) {
lines.set(i, newLine);
}
else {
} else {
lines.remove(i);
}
break;
}
}
if (lines.size() > 0) {
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from being added
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from
// being added
Files.write(path, (lines.remove(lines.size() - 1).isEmpty() ? lines : lines), StandardCharsets.UTF_8);
Files.write(path, lastLine.getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
lines.clear();
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
public static void sortFile(String fileName) {
try {
Path path = Paths.get(ConfigHandler.path + fileName);
List<String> lines = Files.readAllLines(path);
List<String> sort = lines.subList(2, lines.size());
@@ -215,22 +284,33 @@ public class ConfigFile extends Config {
lines.addAll(sort);
if (lines.size() > 0) {
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from being added
String lastLine = lines.get(lines.size() - 1); // append the final line to prevent a line separator from
// being added
Files.write(path, (lines.remove(lines.size() - 1).isEmpty() ? lines : lines), StandardCharsets.UTF_8);
Files.write(path, lastLine.getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
lines.clear();
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
public static void resetCache(String cacheName, String fileName) throws IOException {
File file = new File(CoreProtect.getInstance().getDataFolder(), cacheName);
if (file.length() > 0) {
new FileOutputStream(file).close();
init(fileName);
}
}
}
@@ -1,5 +1,7 @@
package net.coreprotect.config;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import java.io.File;
import java.io.RandomAccessFile;
import java.sql.Connection;
@@ -11,24 +13,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.consumer.Queue;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.language.Phrase;
import net.coreprotect.listener.ListenerHandler;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.paper.PaperAdapter;
import net.coreprotect.patch.Patch;
@@ -36,14 +27,24 @@ import net.coreprotect.spigot.SpigotAdapter;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Color;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import oshi.hardware.CentralProcessor;
public class ConfigHandler extends Queue {
public static int SERVER_VERSION = 0;
public static final int EDITION_VERSION = 2;
public static final String EDITION_BRANCH = Util.getBranch();
public static final String EDITION_NAME = Util.getPluginName();
public static final String COMMUNITY_EDITION = "Community Edition";
public static final String JAVA_VERSION = "11.0";
public static final String SPIGOT_VERSION = "1.14";
public static final String MINECRAFT_VERSION = "1.16";
public static final String LATEST_VERSION = "1.21";
public static String path = "plugins/CoreProtect/";
public static String sqlite = "database.db";
public static String host = "127.0.0.1";
@@ -52,12 +53,18 @@ public class ConfigHandler extends Queue {
public static String username = "root";
public static String password = "";
public static String prefix = "co_";
public static String prefixConfig = "co_";
public static int maximumPoolSize = 10;
public static HikariDataSource hikariDataSource = null;
public static final CentralProcessor processorInfo = Util.getProcessorInfo();
public static final boolean isSpigot = Util.isSpigot();
public static final boolean isPaper = Util.isPaper();
public static final boolean isFolia = Util.isFolia();
public static volatile boolean serverRunning = false;
public static volatile boolean converterRunning = false;
public static volatile boolean purgeRunning = false;
public static volatile boolean migrationRunning = false;
public static volatile boolean pauseConsumer = false;
public static volatile boolean worldeditEnabled = false;
public static volatile boolean databaseReachable = true;
@@ -68,7 +75,9 @@ public class ConfigHandler extends Queue {
public static volatile int artId = 0;
private static <K, V> Map<K, V> syncMap() {
return Collections.synchronizedMap(new HashMap<>());
}
public static Map<String, Integer> worlds = syncMap();
@@ -98,6 +107,7 @@ public class ConfigHandler extends Queue {
public static ConcurrentHashMap<String, List<ItemStack>> itemsSell = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, List<ItemStack>> itemsBuy = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, Object[]> hopperAbort = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, Object[]> hopperSuccess = new ConcurrentHashMap<>();
public static Map<String, List<ItemStack[]>> forceContainer = syncMap();
public static Map<String, Integer> lookupType = syncMap();
public static Map<String, Object[]> lookupThrottle = syncMap();
@@ -118,54 +128,79 @@ public class ConfigHandler extends Queue {
public static Map<Integer, String> playerIdCacheReversed = syncMap();
public static Map<String, List<Object>> lastRollback = syncMap();
public static Map<String, Boolean> activeRollbacks = syncMap();
public static Map<UUID, Object[]> entityBlockMapper = syncMap();
public static Map<String, Object[]> entityBlockMapper = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Long, Long> populatedChunks = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, String> language = new ConcurrentHashMap<>();
public static List<String> databaseTables = new ArrayList<>();
private static void checkPlayers(Connection connection) {
ConfigHandler.playerIdCache.clear();
ConfigHandler.playerIdCacheReversed.clear();
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
if (ConfigHandler.playerIdCache.get(player.getName().toLowerCase(Locale.ROOT)) == null) {
UserStatement.loadId(connection, player.getName(), player.getUniqueId().toString());
}
}
}
private static void loadBlacklist() {
try {
ConfigHandler.blacklist.clear();
String blacklist = ConfigHandler.path + "blacklist.txt";
boolean exists = (new File(blacklist)).exists();
if (exists) {
RandomAccessFile blfile = new RandomAccessFile(blacklist, "rw");
long blc = blfile.length();
if (blc > 0) {
while (blfile.getFilePointer() < blfile.length()) {
String blacklistUser = blfile.readLine().replaceAll(" ", "").toLowerCase(Locale.ROOT);
if (blacklistUser.length() > 0) {
ConfigHandler.blacklist.put(blacklistUser, true);
}
}
}
blfile.close();
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
private static void loadConfig() {
try {
Config.init();
ConfigFile.init(ConfigFile.LANGUAGE); // load user phrases
ConfigFile.init(ConfigFile.LANGUAGE_CACHE); // load translation cache
// Enforce "co_" table prefix if using SQLite.
if (!Config.getGlobal().MYSQL) {
ConfigHandler.prefixConfig = Config.getGlobal().PREFIX;
Config.getGlobal().PREFIX = "co_";
}
ConfigHandler.host = Config.getGlobal().MYSQL_HOST;
@@ -173,66 +208,92 @@ public class ConfigHandler extends Queue {
ConfigHandler.database = Config.getGlobal().MYSQL_DATABASE;
ConfigHandler.username = Config.getGlobal().MYSQL_USERNAME;
ConfigHandler.password = Config.getGlobal().MYSQL_PASSWORD;
ConfigHandler.maximumPoolSize = Config.getGlobal().MAXIMUM_POOL_SIZE;
ConfigHandler.prefix = Config.getGlobal().PREFIX;
ConfigHandler.loadBlacklist(); // Load the blacklist file if it exists.
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
public static void loadDatabase() {
// close old pool when we reload the database, e.g. in purge command
Database.closeConnection();
if (!Config.getGlobal().MYSQL) {
try {
File tempFile = File.createTempFile("CoreProtect_" + System.currentTimeMillis(), ".tmp");
tempFile.setExecutable(true);
boolean canExecute = false;
try {
canExecute = tempFile.canExecute();
}
catch (Exception exception) {
} catch (Exception exception) {
// execute access denied by security manager
}
if (!canExecute) {
File tempFolder = new File("cache");
boolean exists = tempFolder.exists();
if (!exists) {
tempFolder.mkdir();
}
System.setProperty("java.io.tmpdir", "cache");
}
tempFile.delete();
Class.forName("org.sqlite.JDBC");
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
else {
HikariConfig config = new HikariConfig();
try {
Class.forName("com.mysql.cj.jdbc.Driver");
config.setDriverClassName("com.mysql.cj.jdbc.Driver");
}
catch (Exception e) {
config.setDriverClassName("com.mysql.jdbc.Driver");
}
config.setJdbcUrl("jdbc:mysql://" + ConfigHandler.host + ":" + ConfigHandler.port + "/" + ConfigHandler.database);
} else {
HikariConfig config = new HikariConfig();
try {
Class.forName("com.mysql.cj.jdbc.Driver");
config.setDriverClassName("com.mysql.cj.jdbc.Driver");
} catch (Exception e) {
config.setDriverClassName("com.mysql.jdbc.Driver");
}
config.setJdbcUrl(
"jdbc:mysql://" + ConfigHandler.host + ":" + ConfigHandler.port + "/" + ConfigHandler.database);
config.setUsername(ConfigHandler.username);
config.setPassword(ConfigHandler.password);
config.setMaximumPoolSize(ConfigHandler.maximumPoolSize);
config.setMaxLifetime(60000);
config.addDataSourceProperty("characterEncoding", "UTF-8");
config.addDataSourceProperty("connectionTimeout", "10000");
/* https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration */
/* https://cdn.oreillystatic.com/en/assets/1/event/21/Connector_J%20Performance%20Gems%20Presentation.pdf */
/*
* https://cdn.oreillystatic.com/en/assets/1/event/21/Connector_J%20Performance%
* 20Gems%20Presentation.pdf
*/
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
@@ -243,16 +304,20 @@ public class ConfigHandler extends Queue {
config.addDataSourceProperty("maintainTimeStats", "false");
/* Disable SSL to suppress the unverified server identity warning */
config.addDataSourceProperty("allowPublicKeyRetrieval", "true");
config.addDataSourceProperty("useSSL", "false");
config.addDataSourceProperty("useSSL", Config.getGlobal().ENABLE_SSL);
ConfigHandler.hikariDataSource = new HikariDataSource(config);
}
Database.createDatabaseTables(ConfigHandler.prefix, false);
Database.createDatabaseTables(ConfigHandler.prefix, null, Config.getGlobal().MYSQL, false);
}
public static void loadTypes(Statement statement) {
try {
String query = "SELECT id,material FROM " + ConfigHandler.prefix + "material_map";
ResultSet rs = statement.executeQuery(query);
ConfigHandler.materials.clear();
@@ -260,14 +325,19 @@ public class ConfigHandler extends Queue {
materialId = 0;
while (rs.next()) {
int id = rs.getInt("id");
String material = rs.getString("material");
ConfigHandler.materials.put(material, id);
ConfigHandler.materialsReversed.put(id, material);
if (id > materialId) {
materialId = id;
}
}
rs.close();
query = "SELECT id,data FROM " + ConfigHandler.prefix + "blockdata_map";
@@ -277,14 +347,19 @@ public class ConfigHandler extends Queue {
blockdataId = 0;
while (rs.next()) {
int id = rs.getInt("id");
String data = rs.getString("data");
ConfigHandler.blockdata.put(data, id);
ConfigHandler.blockdataReversed.put(id, data);
if (id > blockdataId) {
blockdataId = id;
}
}
rs.close();
query = "SELECT id,art FROM " + ConfigHandler.prefix + "art_map";
@@ -294,14 +369,19 @@ public class ConfigHandler extends Queue {
artId = 0;
while (rs.next()) {
int id = rs.getInt("id");
String art = rs.getString("art");
ConfigHandler.art.put(art, id);
ConfigHandler.artReversed.put(id, art);
if (id > artId) {
artId = id;
}
}
rs.close();
query = "SELECT id,entity FROM " + ConfigHandler.prefix + "entity_map";
@@ -311,23 +391,33 @@ public class ConfigHandler extends Queue {
entityId = 0;
while (rs.next()) {
int id = rs.getInt("id");
String entity = rs.getString("entity");
ConfigHandler.entities.put(entity, id);
ConfigHandler.entitiesReversed.put(id, entity);
if (id > entityId) {
entityId = id;
}
}
rs.close();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
public static void loadWorlds(Statement statement) {
try {
String query = "SELECT id,world FROM " + ConfigHandler.prefix + "world";
ResultSet rs = statement.executeQuery(query);
ConfigHandler.worlds.clear();
@@ -335,76 +425,112 @@ public class ConfigHandler extends Queue {
worldId = 0;
while (rs.next()) {
int id = rs.getInt("id");
String world = rs.getString("world");
ConfigHandler.worlds.put(world, id);
ConfigHandler.worldsReversed.put(id, world);
if (id > worldId) {
worldId = id;
}
}
rs.close();
List<World> worlds = Bukkit.getServer().getWorlds();
for (World world : worlds) {
String worldname = world.getName();
if (ConfigHandler.worlds.get(worldname) == null) {
int id = worldId + 1;
ConfigHandler.worlds.put(worldname, id);
ConfigHandler.worldsReversed.put(id, worldname);
worldId = id;
Queue.queueWorldInsert(id, worldname);
}
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
private static boolean checkDatabaseLock(Statement statement) {
try {
if (Config.getGlobal().DATABASE_LOCK) {
boolean locked = true;
boolean lockMessage = false;
int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
int waitTime = unixtimestamp + 15;
while (locked) {
locked = false;
unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
int checkTime = unixtimestamp - 15;
String query = "SELECT * FROM " + ConfigHandler.prefix + "database_lock WHERE rowid='1' AND status='1' AND time >= '" + checkTime + "' LIMIT 1";
String query = "SELECT * FROM " + ConfigHandler.prefix
+ "database_lock WHERE rowid='1' AND status='1' AND time >= '" + checkTime + "' LIMIT 1";
ResultSet rs = statement.executeQuery(query);
while (rs.next()) {
if (unixtimestamp < waitTime) {
if (!lockMessage) {
Chat.sendConsoleMessage("[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_1));
lockMessage = true;
}
Thread.sleep(1000);
}
else {
Chat.sendConsoleMessage(Color.RED + "[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_2));
Chat.sendConsoleMessage(Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_3));
Chat.sendConsoleMessage(Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_4));
} else {
Chat.sendConsoleMessage(
Color.RED + "[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_2));
Chat.sendConsoleMessage(
Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_3));
Chat.sendConsoleMessage(
Color.GREY + "[CoreProtect] " + Phrase.build(Phrase.DATABASE_LOCKED_4));
return false;
}
locked = true;
}
rs.close();
}
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
public static boolean performInitialization(boolean startup) {
try {
BukkitAdapter.loadAdapter();
SpigotAdapter.loadAdapter();
PaperAdapter.loadAdapter();
@@ -413,12 +539,20 @@ public class ConfigHandler extends Queue {
ConfigHandler.loadConfig(); // Load (or create) the configuration file.
ConfigHandler.loadDatabase(); // Initialize MySQL and create tables if necessary.
}
catch (Exception e) {
if (startup) {
ListenerHandler.registerNetworking(); // Register channels for networking API
}
} catch (Exception e) {
e.printStackTrace();
}
try (Connection connection = Database.getConnection(true, 0)) {
Statement statement = connection.createStatement();
ConfigHandler.checkPlayers(connection);
@@ -427,33 +561,58 @@ public class ConfigHandler extends Queue {
// Initialize WorldEdit logging
if (Util.checkWorldEdit()) {
PluginManager pluginManager = Bukkit.getServer().getPluginManager();
Plugin worldEditPlugin = pluginManager.getPlugin("WorldEdit");
if (worldEditPlugin != null && worldEditPlugin.isEnabled()) {
Util.loadWorldEdit();
}
}
else if (ConfigHandler.worldeditEnabled) {
} else if (ConfigHandler.worldeditEnabled) {
Util.unloadWorldEdit();
}
ConfigHandler.serverRunning = true; // Set as running before patching
boolean validVersion = Patch.versionCheck(statement); // Minor upgrades & version check
boolean databaseLock = true;
if (startup) {
// Check that database isn't already in use
databaseLock = ConfigHandler.checkDatabaseLock(statement);
}
statement.close();
return validVersion && databaseLock;
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public static void performDisable() {
try {
Database.closeConnection();
ListenerHandler.unregisterNetworking(); // Unregister channels for networking API
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -6,14 +6,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.process.Process;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack;
public class Consumer extends Process implements Runnable, Thread.UncaughtExceptionHandler {
@@ -25,51 +23,80 @@ public class Consumer extends Process implements Runnable, Thread.UncaughtExcept
protected static volatile boolean pausedSuccess = false;
public static ConcurrentHashMap<Integer, ArrayList<Object[]>> consumer = new ConcurrentHashMap<>(4, 0.75f, 2);
// public static ConcurrentHashMap<Integer, Integer[]> consumer_id = new ConcurrentHashMap<>();
// public static ConcurrentHashMap<Integer, Integer[]> consumer_id = new
// ConcurrentHashMap<>();
public static Map<Integer, Integer[]> consumer_id = Collections.synchronizedMap(new HashMap<>());
public static ConcurrentHashMap<Integer, Map<Integer, String[]>> consumerUsers = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, String>> consumerStrings = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, Object[]>> consumerSigns = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, ItemStack[]>> consumerContainers = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, Object>> consumerInventories = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, List<BlockState>>> consumerBlockList = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, List<Object[]>>> consumerObjectArrayList = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, List<Object>>> consumerObjectList = new ConcurrentHashMap<>(4, 0.75f, 2);
public static ConcurrentHashMap<Integer, Map<Integer, String[]>> consumerUsers = new ConcurrentHashMap<>(4, 0.75f,
2);
public static ConcurrentHashMap<Integer, Map<Integer, Object>> consumerObjects = new ConcurrentHashMap<>(4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, String>> consumerStrings = new ConcurrentHashMap<>(4, 0.75f,
2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, Object[]>> consumerSigns = new ConcurrentHashMap<>(4, 0.75f,
2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, ItemStack[]>> consumerContainers = new ConcurrentHashMap<>(4,
0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, Object>> consumerInventories = new ConcurrentHashMap<>(4,
0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, List<BlockState>>> consumerBlockList = new ConcurrentHashMap<>(
4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, List<Object[]>>> consumerObjectArrayList = new ConcurrentHashMap<>(
4, 0.75f, 2);
@Deprecated
public static ConcurrentHashMap<Integer, Map<Integer, List<Object>>> consumerObjectList = new ConcurrentHashMap<>(4,
0.75f, 2);
public static ConcurrentHashMap<Integer, Map<Integer, Object>> consumerObjects = new ConcurrentHashMap<>(4, 0.75f,
2);
// ^merge maps into single object based map
private static void errorDelay() {
try {
Thread.sleep(30000); // 30 seconds
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
protected static int newConsumerId(int consumer) {
int id = Consumer.consumer_id.get(consumer)[0];
Consumer.consumer_id.put(consumer, new Integer[] { id + 1, 1 });
return id;
}
public static int getConsumerSize(int id) {
if (id == 0 || id == 1) {
return Consumer.consumer.get(id).size();
}
return 0;
}
public static void initialize() {
Consumer.consumer.put(0, new ArrayList<>());
Consumer.consumer.put(1, new ArrayList<>());
Consumer.consumer_id.put(0, new Integer[] { 0, 0 });
@@ -92,64 +119,99 @@ public class Consumer extends Process implements Runnable, Thread.UncaughtExcept
Consumer.consumerObjectList.put(1, new HashMap<>());
Consumer.consumerContainers.put(0, new HashMap<>());
Consumer.consumerContainers.put(1, new HashMap<>());
}
public static boolean isRunning() {
return consumerThread != null && consumerThread.isAlive();
}
private static void pauseConsumer(int process_id) {
try {
while ((ConfigHandler.serverRunning || ConfigHandler.converterRunning) && (Consumer.isPaused || ConfigHandler.pauseConsumer || ConfigHandler.purgeRunning || Consumer.consumer_id.get(process_id)[1] == 1)) {
while ((ConfigHandler.serverRunning || ConfigHandler.converterRunning || ConfigHandler.migrationRunning)
&& (Consumer.isPaused || ConfigHandler.pauseConsumer || ConfigHandler.purgeRunning
|| Consumer.consumer_id.get(process_id)[1] == 1))
{
pausedSuccess = true;
Thread.sleep(100);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
pausedSuccess = false;
}
@Override
public void run() {
boolean lastRun = false;
while (ConfigHandler.serverRunning || ConfigHandler.converterRunning || !lastRun) {
if (!ConfigHandler.serverRunning && !ConfigHandler.converterRunning) {
lastRun = true;
}
try {
int process_id = 0;
if (currentConsumer == 0) {
currentConsumer = 1;
}
else {
} else {
process_id = 1;
currentConsumer = 0;
}
Thread.sleep(500);
pauseConsumer(process_id);
Process.processConsumer(process_id, lastRun);
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
errorDelay();
}
}
}
@Override
public void uncaughtException(Thread thread, Throwable e) {
e.printStackTrace();
Bukkit.getPluginManager().disablePlugin(CoreProtect.getInstance());
}
public static void startConsumer() {
if (!isRunning()) {
consumerThread = new Thread(new Consumer());
consumerThread.setUncaughtExceptionHandler(new Consumer());
consumerThread.start();
}
}
}
+283 -72
View File
@@ -2,7 +2,15 @@ package net.coreprotect.consumer;
import java.util.ArrayList;
import java.util.List;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.listener.block.BlockUtil;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -17,122 +25,181 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.listener.block.BlockUtil;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.Util;
public class Queue {
protected static synchronized int modifyForceContainer(String id, ItemStack[] container) {
List<ItemStack[]> forceList = ConfigHandler.forceContainer.get(id);
if (forceList == null) {
return 0;
}
if (container == null) {
forceList.remove(0);
}
else {
} else {
forceList.add(container);
}
return forceList.size();
}
protected static synchronized int getChestId(String id) {
int chestId = ConfigHandler.loggingChest.getOrDefault(id, -1) + 1;
ConfigHandler.loggingChest.put(id, chestId);
return chestId;
}
protected static synchronized int getItemId(String id) {
int chestId = ConfigHandler.loggingItem.getOrDefault(id, -1) + 1;
ConfigHandler.loggingItem.put(id, chestId);
return chestId;
}
private static synchronized void addConsumer(int currentConsumer, Object[] data) {
Consumer.consumer.get(currentConsumer).add(data);
}
private static synchronized void queueStandardData(int consumerId, int currentConsumer, String[] user, Object object) {
private static synchronized void queueStandardData(int consumerId, int currentConsumer, String[] user,
Object object)
{
Consumer.consumerUsers.get(currentConsumer).put(consumerId, user);
Consumer.consumerObjects.get(currentConsumer).put(consumerId, object);
Consumer.consumer_id.put(currentConsumer, new Integer[] { Consumer.consumer_id.get(currentConsumer)[0], 0 });
}
protected static void queueAdvancedBreak(String user, BlockState block, Material type, String blockData, int data, Material breakType, int blockNumber) {
protected static void queueAdvancedBreak(String user, BlockState block, Material type, String blockData, int data,
Material breakType, int blockNumber)
{
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.BLOCK_BREAK, type, data, breakType, 0, blockNumber, blockData });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.BLOCK_BREAK, type, data, breakType, 0, blockNumber, blockData });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queueArtInsert(int id, String name) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.ART_INSERT, null, 0, null, 0, id, null });
queueStandardData(consumerId, currentConsumer, new String[] { null, null }, name);
}
protected static void queueBlockBreak(String user, BlockState block, Material type, String blockData, int extraData) {
protected static void queueBlockBreak(String user, BlockState block, Material type, String blockData,
int extraData)
{
queueBlockBreak(user, block, type, blockData, null, extraData, 0);
}
protected static void queueBlockBreakValidate(final String user, final Block block, final BlockState blockState, final Material type, final String blockData, final int extraData, int ticks) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
protected static void queueBlockBreakValidate(final String user, final Block block, final BlockState blockState,
final Material type, final String blockData, final int extraData, int ticks)
{
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
try {
if (!block.getType().equals(type)) {
queueBlockBreak(user, blockState, type, blockData, null, extraData, 0);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}, ticks);
}, block.getLocation(), ticks);
}
protected static void queueBlockBreak(String user, BlockState block, Material type, String blockData, Material breakType, int extraData, int blockNumber) {
protected static void queueBlockBreak(String user, BlockState block, Material type, String blockData,
Material breakType, int extraData, int blockNumber)
{
if (type == Material.SPAWNER && block instanceof CreatureSpawner) { // Mob spawner
CreatureSpawner mobSpawner = (CreatureSpawner) block;
extraData = Util.getSpawnerType(mobSpawner.getSpawnedType());
}
else if (type == Material.IRON_DOOR || BlockGroup.DOORS.contains(type) || type.equals(Material.SUNFLOWER) || type.equals(Material.LILAC) || type.equals(Material.TALL_GRASS) || type.equals(Material.LARGE_FERN) || type.equals(Material.ROSE_BUSH) || type.equals(Material.PEONY)) { // Double plant
} else if (type == Material.IRON_DOOR || BlockGroup.DOORS.contains(type) || type.equals(Material.SUNFLOWER)
|| type.equals(Material.LILAC) || type.equals(Material.TALL_GRASS) || type.equals(Material.LARGE_FERN)
|| type.equals(Material.ROSE_BUSH) || type.equals(Material.PEONY))
{ // Double plant
if (block.getBlockData() instanceof Bisected) {
if (((Bisected) block.getBlockData()).getHalf().equals(Half.TOP)) {
if (blockNumber == 5) {
return;
}
if (block.getY() > BukkitAdapter.ADAPTER.getMinHeight(block.getWorld())) {
block = block.getWorld().getBlockAt(block.getX(), block.getY() - 1, block.getZ()).getState();
if (type != block.getType()) {
return;
}
blockData = block.getBlockData().getAsString();
}
}
}
}
else if (type.name().endsWith("_BED") && block.getBlockData() instanceof Bed) {
} else if (type.name().endsWith("_BED") && block.getBlockData() instanceof Bed) {
if (((Bed) block.getBlockData()).getPart().equals(Part.HEAD)) {
return;
}
}
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.BLOCK_BREAK, type, extraData, breakType, 0, blockNumber, blockData });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.BLOCK_BREAK, type, extraData, breakType, 0, blockNumber, blockData });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queueBlockPlace(String user, BlockState blockLocation, Material blockType, BlockState blockReplaced, Material forceType, int forceD, int forceData, String blockData) {
protected static void queueBlockPlace(String user, BlockState blockLocation, Material blockType,
BlockState blockReplaced, Material forceType, int forceD, int forceData, String blockData)
{
// If force_data equals "1", current block data will be used in consumer.
Material type = blockType;
int data = 0;
@@ -140,208 +207,327 @@ public class Queue {
int replaceData = 0;
if (type == Material.SPAWNER && blockLocation instanceof CreatureSpawner) { // Mob spawner
CreatureSpawner mobSpawner = (CreatureSpawner) blockLocation;
data = Util.getSpawnerType(mobSpawner.getSpawnedType());
forceData = 1;
}
if (blockReplaced != null) {
replaceType = blockReplaced.getType();
replaceData = 0;
if ((replaceType == Material.IRON_DOOR || BlockGroup.DOORS.contains(replaceType) || replaceType.equals(Material.SUNFLOWER) || replaceType.equals(Material.LILAC) || replaceType.equals(Material.TALL_GRASS) || replaceType.equals(Material.LARGE_FERN) || replaceType.equals(Material.ROSE_BUSH) || replaceType.equals(Material.PEONY)) && replaceData >= 8) { // Double plant top half
BlockState blockBelow = blockReplaced.getWorld().getBlockAt(blockReplaced.getX(), blockReplaced.getY() - 1, blockReplaced.getZ()).getState();
if ((replaceType == Material.IRON_DOOR || BlockGroup.DOORS.contains(replaceType)
|| replaceType.equals(Material.SUNFLOWER) || replaceType.equals(Material.LILAC)
|| replaceType.equals(Material.TALL_GRASS) || replaceType.equals(Material.LARGE_FERN)
|| replaceType.equals(Material.ROSE_BUSH) || replaceType.equals(Material.PEONY))
&& replaceData >= 8)
{ // Double plant top half
BlockState blockBelow = blockReplaced.getWorld()
.getBlockAt(blockReplaced.getX(), blockReplaced.getY() - 1, blockReplaced.getZ()).getState();
Material belowType = blockBelow.getType();
Queue.queueBlockBreak(user, blockBelow, belowType, blockBelow.getBlockData().getAsString(), 0);
}
}
if (forceType != null) {
type = forceType;
forceData = 1;
}
if (forceD != -1) {
data = forceD;
forceData = 1;
}
String replacedBlockData = null;
if (blockReplaced != null) {
replacedBlockData = blockReplaced.getBlockData().getAsString();
}
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.BLOCK_PLACE, type, data, replaceType, replaceData, forceData, blockData, replacedBlockData });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.BLOCK_PLACE, type, data, replaceType, replaceData, forceData, blockData,
replacedBlockData });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, blockLocation);
}
protected static void queueBlockPlaceDelayed(final String user, final Location placed, final Material type, final String blockData, final BlockState replaced, int ticks) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
protected static void queueBlockPlaceDelayed(final String user, final Location placed, final Material type,
final String blockData, final BlockState replaced, int ticks)
{
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
try {
queueBlockPlace(user, placed.getBlock().getState(), type, replaced, null, -1, 0, blockData);
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}, ticks);
}, placed, ticks);
}
protected static void queueBlockPlaceValidate(final String user, final BlockState blockLocation, final Block block, final BlockState blockReplaced, final Material forceT, final int forceD, final int forceData, final String blockData, int ticks) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
protected static void queueBlockPlaceValidate(final String user, final BlockState blockLocation, final Block block,
final BlockState blockReplaced, final Material forceT, final int forceD, final int forceData,
final String blockData, int ticks)
{
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
try {
Material blockType = block.getType();
if (blockType.equals(forceT)) {
BlockState blockStateLocation = blockLocation;
if (Config.getConfig(blockLocation.getWorld()).BLOCK_MOVEMENT) {
blockStateLocation = BlockUtil.gravityScan(blockLocation.getLocation(), blockType, user).getState();
blockStateLocation = BlockUtil.gravityScan(blockLocation.getLocation(), blockType, user)
.getState();
}
queueBlockPlace(user, blockStateLocation, blockType, blockReplaced, forceT, forceD, forceData, blockData);
queueBlockPlace(user, blockStateLocation, blockType, blockReplaced, forceT, forceD, forceData,
blockData);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}, ticks);
}, blockLocation.getLocation(), ticks);
}
protected static void queueBlockGravityValidate(final String user, final Location location, final Block block, final Material blockType, int ticks) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
protected static void queueBlockGravityValidate(final String user, final Location location, final Block block,
final Material blockType, int ticks)
{
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
try {
Block placementBlock = BlockUtil.gravityScan(location, blockType, user);
if (!block.equals(placementBlock)) {
queueBlockPlace(user, placementBlock.getState(), blockType, null, blockType, -1, 0, null);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}, ticks);
}, location, ticks);
}
protected static void queueContainerBreak(String user, Location location, Material type, ItemStack[] oldInventory) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.CONTAINER_BREAK, type, 0, null, 0, 0, null });
Consumer.consumerContainers.get(currentConsumer).put(consumerId, oldInventory);
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
}
protected static synchronized void queueContainerTransaction(String user, Location location, Material type, Object inventory, int chestId) {
protected static synchronized void queueContainerTransaction(String user, Location location, Material type,
Object inventory, int chestId)
{
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.CONTAINER_TRANSACTION, type, 0, null, 0, chestId, null });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.CONTAINER_TRANSACTION, type, 0, null, 0, chestId, null });
Consumer.consumerInventories.get(currentConsumer).put(consumerId, inventory);
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
}
protected static void queueItemTransaction(String user, Location location, int time, int offset, int itemId) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.ITEM_TRANSACTION, null, offset, null, time, itemId, null });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.ITEM_TRANSACTION, null, offset, null, time, itemId, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
}
protected static void queueEntityInsert(int id, String name) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.ENTITY_INSERT, null, 0, null, 0, id, null });
queueStandardData(consumerId, currentConsumer, new String[] { null, null }, name);
}
protected static void queueEntityKill(String user, Location location, List<Object> data, EntityType type) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.ENTITY_KILL, null, 0, null, 0, 0 });
Consumer.consumerObjectList.get(currentConsumer).put(consumerId, data);
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, new Object[] { location.getBlock().getState(), type, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null },
new Object[]
{ location.getBlock().getState(), type, null });
}
protected static void queueEntitySpawn(String user, BlockState block, EntityType type, int data) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.ENTITY_SPAWN, null, 0, null, 0, data, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, new Object[] { block, type });
}
protected static void queueMaterialInsert(int id, String name) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.MATERIAL_INSERT, null, 0, null, 0, id, null });
queueStandardData(consumerId, currentConsumer, new String[] { null, null }, name);
}
protected static void queueBlockDataInsert(int id, String data) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.BLOCKDATA_INSERT, null, 0, null, 0, id, null });
queueStandardData(consumerId, currentConsumer, new String[] { null, null }, data);
}
protected static void queueNaturalBlockBreak(String user, BlockState block, Block relative, Material type, String blockData, int data) {
protected static void queueNaturalBlockBreak(String user, BlockState block, Block relative, Material type,
String blockData, int data)
{
List<BlockState> blockStates = new ArrayList<>();
if (relative != null) {
blockStates.add(relative.getState());
}
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.NATURAL_BLOCK_BREAK, type, data, null, 0, 0, blockData });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.NATURAL_BLOCK_BREAK, type, data, null, 0, 0, blockData });
Consumer.consumerBlockList.get(currentConsumer).put(consumerId, blockStates);
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queuePlayerChat(Player player, String message, long timestamp) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_CHAT, null, 0, null, 0, 0, null });
Consumer.consumerStrings.get(currentConsumer).put(consumerId, message);
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, new Object[] { timestamp, player.getLocation().clone() });
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null },
new Object[]
{ timestamp, player.getLocation().clone() });
}
protected static void queuePlayerCommand(Player player, String message, long timestamp) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_COMMAND, null, 0, null, 0, 0, null });
Consumer.consumerStrings.get(currentConsumer).put(consumerId, message);
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, new Object[] { timestamp, player.getLocation().clone() });
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null },
new Object[]
{ timestamp, player.getLocation().clone() });
}
protected static void queuePlayerInteraction(String user, BlockState block, Material type) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_INTERACTION, type, 0, null, 0, 0, null });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.PLAYER_INTERACTION, type, 0, null, 0, 0, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queuePlayerKill(String user, Location location, String player) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_KILL, null, 0, null, 0, 0, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, new Object[] { location.getBlock().getState(), player });
queueStandardData(consumerId, currentConsumer, new String[] { user, null },
new Object[]
{ location.getBlock().getState(), player });
}
protected static void queuePlayerLogin(Player player, int time, int configSessions, int configUsernames) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
String uuid = player.getUniqueId().toString();
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_LOGIN, null, configSessions, null, configUsernames, time, null });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.PLAYER_LOGIN, null, configSessions, null, configUsernames, time, null });
Consumer.consumerStrings.get(currentConsumer).put(consumerId, uuid);
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), uuid }, player.getLocation().clone());
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), uuid },
player.getLocation().clone());
}
protected static void queuePlayerQuit(Player player, int time) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.PLAYER_LOGOUT, null, 0, null, 0, time, null });
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null }, player.getLocation().clone());
queueStandardData(consumerId, currentConsumer, new String[] { player.getName(), null },
player.getLocation().clone());
}
protected static void queueRollbackUpdate(String user, Location location, List<Object[]> list, int table, int action) {
protected static void queueRollbackUpdate(String user, Location location, List<Object[]> list, int table,
int action)
{
if (location == null) {
location = new Location(Bukkit.getServer().getWorlds().get(0), 0, 0, 0);
}
int currentConsumer = Consumer.currentConsumer;
@@ -349,47 +535,72 @@ public class Queue {
addConsumer(currentConsumer, new Object[] { consumerId, table, null, 0, null, 0, action, null });
Consumer.consumerObjectArrayList.get(currentConsumer).put(consumerId, list);
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
}
protected static void queueSignText(String user, Location location, int action, int color, boolean glowing, String line1, String line2, String line3, String line4, int offset) {
protected static void queueSignText(String user, Location location, int action, int color, int colorSecondary,
boolean frontGlowing, boolean backGlowing, boolean isWaxed, boolean isFront, String line1, String line2,
String line3, String line4, String line5, String line6, String line7, String line8, int offset)
{
/*
if (line1.length() == 0 && line2.length() == 0 && line3.length() == 0 && line4.length() == 0) {
return;
}
*/
* if (line1.length() == 0 && line2.length() == 0 && line3.length() == 0 &&
* line4.length() == 0) { return; }
*/
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.SIGN_TEXT, null, color, null, action, offset, null });
Consumer.consumerSigns.get(currentConsumer).put(consumerId, new Object[] { (glowing == true ? 1 : 0), line1, line2, line3, line4 });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.SIGN_TEXT, null, color, null, action, offset, null });
Consumer.consumerSigns.get(currentConsumer).put(consumerId,
new Object[]
{ colorSecondary, Util.getSignData(frontGlowing, backGlowing), isWaxed, isFront, line1, line2, line3,
line4, line5, line6, line7, line8 });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
}
protected static void queueSignUpdate(String user, BlockState block, int action, int time) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.SIGN_UPDATE, null, action, null, 0, time, null });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.SIGN_UPDATE, null, action, null, 0, time, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queueSkullUpdate(String user, BlockState block, int rowId) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.SKULL_UPDATE, null, 0, null, 0, rowId, null });
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queueStructureGrow(String user, BlockState block, List<BlockState> blockList, int replacedListSize) {
protected static void queueStructureGrow(String user, BlockState block, List<BlockState> blockList,
int replacedListSize)
{
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.STRUCTURE_GROWTH, null, 0, null, 0, replacedListSize, null });
addConsumer(currentConsumer,
new Object[]
{ consumerId, Process.STRUCTURE_GROWTH, null, 0, null, 0, replacedListSize, null });
Consumer.consumerBlockList.get(currentConsumer).put(consumerId, blockList);
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, block);
}
protected static void queueWorldInsert(int id, String world) {
int currentConsumer = Consumer.currentConsumer;
int consumerId = Consumer.newConsumerId(currentConsumer);
addConsumer(currentConsumer, new Object[] { consumerId, Process.WORLD_INSERT, null, 0, null, 0, id, null });
queueStandardData(consumerId, currentConsumer, new String[] { null, null }, world);
}
}
@@ -2,7 +2,6 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.sql.Statement;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.MaterialStatement;
import net.coreprotect.language.Phrase;
@@ -11,25 +10,39 @@ import net.coreprotect.utility.Chat;
class ArtInsertProcess {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name, int materialId) {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name,
int materialId)
{
if (name instanceof String) {
String query = "SELECT id FROM " + ConfigHandler.prefix + "art_map WHERE id = '" + materialId + "' LIMIT 0, 1";
String query = "SELECT id FROM " + ConfigHandler.prefix + "art_map WHERE id = '" + materialId
+ "' LIMIT 0, 1";
boolean hasMaterial = MaterialStatement.hasMaterial(statement, query);
if (!hasMaterial) {
MaterialStatement.insert(preparedStmt, batchCount, materialId, (String) name);
// validate ID maps to ensure mapping wasn't reloaded from database prior to this insertion completing
// validate ID maps to ensure mapping wasn't reloaded from database prior to
// this insertion completing
ConfigHandler.art.put((String) name, materialId);
ConfigHandler.artReversed.put(materialId, (String) name);
if (materialId > ConfigHandler.artId) {
ConfigHandler.artId = materialId;
}
}
else {
} else {
Chat.console(Phrase.build(Phrase.CACHE_ERROR, "art"));
Chat.console(Phrase.build(Phrase.CACHE_RELOAD, Selector.FIRST));
ConfigHandler.loadTypes(statement);
}
}
}
}
@@ -2,27 +2,37 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.List;
import net.coreprotect.database.logger.BlockBreakLogger;
import net.coreprotect.database.logger.SkullBreakLogger;
import net.coreprotect.utility.Util;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.block.Skull;
import net.coreprotect.database.logger.BlockBreakLogger;
import net.coreprotect.database.logger.SkullBreakLogger;
import net.coreprotect.utility.Util;
class BlockBreakProcess {
static void process(PreparedStatement preparedStmt, PreparedStatement preparedStmtSkulls, int batchCount, int processId, int id, Material blockType, int blockDataId, Material replaceType, int forceData, String user, Object object, String blockData) {
static void process(PreparedStatement preparedStmt, PreparedStatement preparedStmtSkulls, int batchCount,
int processId, int id, Material blockType, int blockDataId, Material replaceType, int forceData,
String user, Object object, String blockData)
{
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
List<Object> meta = Util.processMeta(block);
if (block instanceof Skull) {
SkullBreakLogger.log(preparedStmt, preparedStmtSkulls, batchCount, user, block);
} else {
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), Util.getBlockId(blockType),
blockDataId, meta, block.getBlockData().getAsString(), blockData);
}
else {
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), Util.getBlockId(blockType), blockDataId, meta, block.getBlockData().getAsString(), blockData);
}
}
}
}
@@ -2,7 +2,6 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.sql.Statement;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.MaterialStatement;
import net.coreprotect.language.Phrase;
@@ -11,25 +10,39 @@ import net.coreprotect.utility.Chat;
class BlockDataInsertProcess {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name, int materialId) {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name,
int materialId)
{
if (name instanceof String) {
String query = "SELECT id FROM " + ConfigHandler.prefix + "blockdata_map WHERE id = '" + materialId + "' LIMIT 0, 1";
String query = "SELECT id FROM " + ConfigHandler.prefix + "blockdata_map WHERE id = '" + materialId
+ "' LIMIT 0, 1";
boolean hasMaterial = MaterialStatement.hasMaterial(statement, query);
if (!hasMaterial) {
MaterialStatement.insert(preparedStmt, batchCount, materialId, (String) name);
// validate ID maps to ensure mapping wasn't reloaded from database prior to this insertion completing
// validate ID maps to ensure mapping wasn't reloaded from database prior to
// this insertion completing
ConfigHandler.blockdata.put((String) name, materialId);
ConfigHandler.blockdataReversed.put(materialId, (String) name);
if (materialId > ConfigHandler.blockdataId) {
ConfigHandler.blockdataId = materialId;
}
}
else {
} else {
Chat.console(Phrase.build(Phrase.CACHE_ERROR, "blockdata"));
Chat.console(Phrase.build(Phrase.CACHE_RELOAD, Selector.FIRST));
ConfigHandler.loadTypes(statement);
}
}
}
}
@@ -2,29 +2,49 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import net.coreprotect.database.logger.BlockPlaceLogger;
import net.coreprotect.database.logger.SkullPlaceLogger;
import net.coreprotect.utility.Util;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
class BlockPlaceProcess {
static void process(PreparedStatement preparedStmt, PreparedStatement preparedStmtSkulls, int batchCount, Material blockType, int blockData, Material replaceType, int replaceData, int forceData, String user, Object object, String newBlockData, String replacedBlockData) {
static void process(PreparedStatement preparedStmt, PreparedStatement preparedStmtSkulls, int batchCount,
Material blockType, int blockData, Material replaceType, int replaceData, int forceData, String user,
Object object, String newBlockData, String replacedBlockData)
{
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
List<Object> meta = Util.processMeta(block);
if (blockType.equals(Material.SKELETON_SKULL) || blockType.equals(Material.SKELETON_WALL_SKULL) || blockType.equals(Material.WITHER_SKELETON_SKULL) || blockType.equals(Material.WITHER_SKELETON_WALL_SKULL) || blockType.equals(Material.ZOMBIE_HEAD) || blockType.equals(Material.ZOMBIE_WALL_HEAD) || blockType.equals(Material.PLAYER_HEAD) || blockType.equals(Material.PLAYER_WALL_HEAD) || blockType.equals(Material.CREEPER_HEAD) || blockType.equals(Material.CREEPER_WALL_HEAD) || blockType.equals(Material.DRAGON_HEAD) || blockType.equals(Material.DRAGON_WALL_HEAD)) {
SkullPlaceLogger.log(preparedStmt, preparedStmtSkulls, batchCount, user, block, Util.getBlockId(replaceType), replaceData);
}
else if (forceData == 1) {
BlockPlaceLogger.log(preparedStmt, batchCount, user, block, Util.getBlockId(replaceType), replaceData, blockType, blockData, true, meta, newBlockData, replacedBlockData);
}
else {
BlockPlaceLogger.log(preparedStmt, batchCount, user, block, Util.getBlockId(replaceType), replaceData, blockType, blockData, false, meta, newBlockData, replacedBlockData);
if (blockType.equals(Material.SKELETON_SKULL) || blockType.equals(Material.SKELETON_WALL_SKULL)
|| blockType.equals(Material.WITHER_SKELETON_SKULL)
|| blockType.equals(Material.WITHER_SKELETON_WALL_SKULL) || blockType.equals(Material.ZOMBIE_HEAD)
|| blockType.equals(Material.ZOMBIE_WALL_HEAD) || blockType.equals(Material.PLAYER_HEAD)
|| blockType.equals(Material.PLAYER_WALL_HEAD) || blockType.equals(Material.CREEPER_HEAD)
|| blockType.equals(Material.CREEPER_WALL_HEAD) || blockType.equals(Material.DRAGON_HEAD)
|| blockType.equals(Material.DRAGON_WALL_HEAD))
{
SkullPlaceLogger.log(preparedStmt, preparedStmtSkulls, batchCount, user, block,
Util.getBlockId(replaceType), replaceData);
} else if (forceData == 1) {
BlockPlaceLogger.log(preparedStmt, batchCount, user, block, Util.getBlockId(replaceType), replaceData,
blockType, blockData, true, meta, newBlockData, replacedBlockData);
} else {
BlockPlaceLogger.log(preparedStmt, batchCount, user, block, Util.getBlockId(replaceType), replaceData,
blockType, blockData, false, meta, newBlockData, replacedBlockData);
}
}
}
}
@@ -2,25 +2,32 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.Map;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.ContainerBreakLogger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.ContainerBreakLogger;
class ContainerBreakProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Material type, String user, Object object) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Material type,
String user, Object object)
{
if (object instanceof Location) {
Location location = (Location) object;
Map<Integer, ItemStack[]> containers = Consumer.consumerContainers.get(processId);
if (containers.get(id) != null) {
ItemStack[] container = containers.get(id);
ContainerBreakLogger.log(preparedStmt, batchCount, user, location, type, container);
containers.remove(id);
}
}
}
}
@@ -1,49 +1,138 @@
package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.Set;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.ContainerLogger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
class ContainerTransactionProcess {
static void process(PreparedStatement preparedStmtContainer, PreparedStatement preparedStmtItems, int batchCount, int processId, int id, Material type, int forceData, String user, Object object) {
static void process(PreparedStatement preparedStmtContainer, PreparedStatement preparedStmtItems, int batchCount,
int processId, int id, Material type, int forceData, String user, Object object)
{
if (object instanceof Location) {
Location location = (Location) object;
Map<Integer, Object> inventories = Consumer.consumerInventories.get(processId);
if (inventories.get(id) != null) {
Object inventory = inventories.get(id);
String transactingChestId = location.getWorld().getUID().toString() + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ();
String loggingChestId = user.toLowerCase(Locale.ROOT) + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ();
String transactingChestId = location.getWorld().getUID().toString() + "." + location.getBlockX() + "."
+ location.getBlockY() + "." + location.getBlockZ();
String loggingChestId = user.toLowerCase(Locale.ROOT) + "." + location.getBlockX() + "."
+ location.getBlockY() + "." + location.getBlockZ();
if (ConfigHandler.loggingChest.get(loggingChestId) != null) {
int current_chest = ConfigHandler.loggingChest.get(loggingChestId);
if (ConfigHandler.oldContainer.get(loggingChestId) == null) {
return;
}
int force_size = 0;
if (ConfigHandler.forceContainer.get(loggingChestId) != null) {
force_size = ConfigHandler.forceContainer.get(loggingChestId).size();
}
if (current_chest == forceData || force_size > 0) { // This prevents client side chest sorting mods from messing things up.
ContainerLogger.log(preparedStmtContainer, preparedStmtItems, batchCount, user, type, inventory, location);
if (current_chest == forceData || force_size > 0) { // This prevents client side chest sorting mods
// from messing things up.
ContainerLogger.log(preparedStmtContainer, preparedStmtItems, batchCount, user, type, inventory,
location);
List<ItemStack[]> old = ConfigHandler.oldContainer.get(loggingChestId);
if (old.size() == 0) {
ConfigHandler.oldContainer.remove(loggingChestId);
ConfigHandler.loggingChest.remove(loggingChestId);
ConfigHandler.transactingChest.remove(transactingChestId);
}
} else if (loggingChestId.startsWith("#hopper")) {
List<Object> transactingChest = ConfigHandler.transactingChest.get(transactingChestId);
if (force_size == 0 && ConfigHandler.oldContainer
.getOrDefault(loggingChestId, Collections.synchronizedList(new ArrayList<>()))
.size() == 1 && transactingChest != null && transactingChest.isEmpty())
{
int loopCount = ConfigHandler.loggingChest.getOrDefault(loggingChestId, 0);
int maxInventorySize = (99 * 54);
try {
Inventory checkInventory = (Inventory) inventory;
maxInventorySize = checkInventory.getSize() * checkInventory.getMaxStackSize();
} catch (Exception e) {
// use default of 5,346
}
if (loopCount > maxInventorySize) {
ItemStack[] destinationContents = null;
ItemStack movedItem = null;
String hopperPush = "#hopper-push." + location.getBlockX() + "." + location.getBlockY()
+ "." + location.getBlockZ();
Object[] hopperPushData = ConfigHandler.hopperSuccess.remove(hopperPush);
if (hopperPushData != null) {
destinationContents = (ItemStack[]) hopperPushData[0];
movedItem = (ItemStack) hopperPushData[1];
}
if (destinationContents != null) {
Set<ItemStack> movedItems = new HashSet<>();
Object[] lastAbort = ConfigHandler.hopperAbort.get(hopperPush);
if (lastAbort != null
&& Arrays.equals(destinationContents, (ItemStack[]) lastAbort[1]))
{
((Set<?>) lastAbort[0])
.forEach(itemStack -> movedItems.add((ItemStack) itemStack));
}
movedItems.add(movedItem);
ConfigHandler.hopperAbort.put(hopperPush,
new Object[]
{ movedItems, destinationContents });
}
}
}
}
}
inventories.remove(id);
}
}
}
}
@@ -2,7 +2,6 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.sql.Statement;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.MaterialStatement;
import net.coreprotect.language.Phrase;
@@ -11,25 +10,39 @@ import net.coreprotect.utility.Chat;
class EntityInsertProcess {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name, int materialId) {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name,
int materialId)
{
if (name instanceof String) {
String query = "SELECT id FROM " + ConfigHandler.prefix + "entity_map WHERE id = '" + materialId + "' LIMIT 0, 1";
String query = "SELECT id FROM " + ConfigHandler.prefix + "entity_map WHERE id = '" + materialId
+ "' LIMIT 0, 1";
boolean hasMaterial = MaterialStatement.hasMaterial(statement, query);
if (!hasMaterial) {
MaterialStatement.insert(preparedStmt, batchCount, materialId, (String) name);
// validate ID maps to ensure mapping wasn't reloaded from database prior to this insertion completing
// validate ID maps to ensure mapping wasn't reloaded from database prior to
// this insertion completing
ConfigHandler.entities.put((String) name, materialId);
ConfigHandler.entitiesReversed.put(materialId, (String) name);
if (materialId > ConfigHandler.entityId) {
ConfigHandler.entityId = materialId;
}
}
else {
} else {
Chat.console(Phrase.build(Phrase.CACHE_ERROR, "entity"));
Chat.console(Phrase.build(Phrase.CACHE_RELOAD, Selector.FIRST));
ConfigHandler.loadTypes(statement);
}
}
}
}
@@ -3,27 +3,34 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.List;
import java.util.Map;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.EntityKillLogger;
import net.coreprotect.utility.Util;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType;
class EntityKillProcess {
static void process(PreparedStatement preparedStmt, PreparedStatement preparedStmtEntities, int batchCount, int processId, int id, Object object, String user) {
static void process(PreparedStatement preparedStmt, PreparedStatement preparedStmtEntities, int batchCount,
int processId, int id, Object object, String user)
{
if (object instanceof Object[]) {
BlockState block = (BlockState) ((Object[]) object)[0];
EntityType type = (EntityType) ((Object[]) object)[1];
Map<Integer, List<Object>> objectLists = Consumer.consumerObjectList.get(processId);
if (objectLists.get(id) != null) {
List<Object> objectList = objectLists.get(id);
int entityId = Util.getEntityId(type);
EntityKillLogger.log(preparedStmt, preparedStmtEntities, batchCount, user, block, objectList, entityId);
objectLists.remove(id);
}
}
}
}
@@ -2,23 +2,26 @@ package net.coreprotect.consumer.process;
import java.sql.Statement;
import java.util.List;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.EntityStatement;
import net.coreprotect.utility.entity.EntityUtil;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType;
class EntitySpawnProcess {
static void process(Statement statement, Object object, int rowId) {
if (object instanceof Object[]) {
BlockState block = (BlockState) ((Object[]) object)[0];
EntityType type = (EntityType) ((Object[]) object)[1];
String query = "SELECT data FROM " + ConfigHandler.prefix + "entity WHERE rowid='" + rowId + "' LIMIT 0, 1";
List<Object> data = EntityStatement.getData(statement, block, query);
EntityUtil.spawnEntity(block, type, data);
}
}
}
@@ -2,28 +2,46 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.Locale;
import org.bukkit.Location;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Queue;
import net.coreprotect.database.logger.ItemLogger;
import org.bukkit.Location;
class ItemTransactionProcess extends Queue {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, int forceData, int time, int offset, String user, Object object) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, int forceData, int time,
int offset, String user, Object object)
{
if (object instanceof Location) {
Location location = (Location) object;
String loggingItemId = user.toLowerCase(Locale.ROOT) + "." + location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ();
String loggingItemId = user.toLowerCase(Locale.ROOT) + "." + location.getBlockX() + "."
+ location.getBlockY() + "." + location.getBlockZ();
if (ConfigHandler.loggingItem.get(loggingItemId) != null) {
int current_chest = ConfigHandler.loggingItem.get(loggingItemId);
if (ConfigHandler.itemsPickup.get(loggingItemId) == null && ConfigHandler.itemsDrop.get(loggingItemId) == null && ConfigHandler.itemsThrown.get(loggingItemId) == null && ConfigHandler.itemsShot.get(loggingItemId) == null && ConfigHandler.itemsBreak.get(loggingItemId) == null && ConfigHandler.itemsDestroy.get(loggingItemId) == null && ConfigHandler.itemsCreate.get(loggingItemId) == null && ConfigHandler.itemsSell.get(loggingItemId) == null && ConfigHandler.itemsBuy.get(loggingItemId) == null) {
if (ConfigHandler.itemsPickup.get(loggingItemId) == null
&& ConfigHandler.itemsDrop.get(loggingItemId) == null
&& ConfigHandler.itemsThrown.get(loggingItemId) == null
&& ConfigHandler.itemsShot.get(loggingItemId) == null
&& ConfigHandler.itemsBreak.get(loggingItemId) == null
&& ConfigHandler.itemsDestroy.get(loggingItemId) == null
&& ConfigHandler.itemsCreate.get(loggingItemId) == null
&& ConfigHandler.itemsSell.get(loggingItemId) == null
&& ConfigHandler.itemsBuy.get(loggingItemId) == null)
{
return;
}
if (current_chest == forceData) {
int currentTime = (int) (System.currentTimeMillis() / 1000L);
if (currentTime > time) {
ItemLogger.log(preparedStmt, batchCount, location, offset, user);
ConfigHandler.itemsPickup.remove(loggingItemId);
ConfigHandler.itemsDrop.remove(loggingItemId);
@@ -35,12 +53,19 @@ class ItemTransactionProcess extends Queue {
ConfigHandler.itemsSell.remove(loggingItemId);
ConfigHandler.itemsBuy.remove(loggingItemId);
ConfigHandler.loggingItem.remove(loggingItemId);
}
else {
} else {
Queue.queueItemTransaction(user, location, time, offset, forceData);
}
}
}
}
}
}
@@ -2,7 +2,6 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.sql.Statement;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.MaterialStatement;
import net.coreprotect.language.Phrase;
@@ -11,25 +10,39 @@ import net.coreprotect.utility.Chat;
class MaterialInsertProcess {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name, int materialId) {
static void process(PreparedStatement preparedStmt, Statement statement, int batchCount, Object name,
int materialId)
{
if (name instanceof String) {
String query = "SELECT id FROM " + ConfigHandler.prefix + "material_map WHERE id = '" + materialId + "' LIMIT 0, 1";
String query = "SELECT id FROM " + ConfigHandler.prefix + "material_map WHERE id = '" + materialId
+ "' LIMIT 0, 1";
boolean hasMaterial = MaterialStatement.hasMaterial(statement, query);
if (!hasMaterial) {
MaterialStatement.insert(preparedStmt, batchCount, materialId, (String) name);
// validate ID maps to ensure mapping wasn't reloaded from database prior to this insertion completing
// validate ID maps to ensure mapping wasn't reloaded from database prior to
// this insertion completing
ConfigHandler.materials.put((String) name, materialId);
ConfigHandler.materialsReversed.put(materialId, (String) name);
if (materialId > ConfigHandler.materialId) {
ConfigHandler.materialId = materialId;
}
}
else {
} else {
Chat.console(Phrase.build(Phrase.CACHE_ERROR, "material"));
Chat.console(Phrase.build(Phrase.CACHE_RELOAD, Selector.FIRST));
ConfigHandler.loadTypes(statement);
}
}
}
}
@@ -4,32 +4,45 @@ import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.Lookup;
import net.coreprotect.database.logger.BlockBreakLogger;
import net.coreprotect.utility.Util;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
class NaturalBlockBreakProcess {
static void process(Statement statement, PreparedStatement preparedStmt, int batchCount, int processId, int id, String user, Object object, Material blockType, int blockData, String overrideData) {
static void process(Statement statement, PreparedStatement preparedStmt, int batchCount, int processId, int id,
String user, Object object, Material blockType, int blockData, String overrideData)
{
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
Map<Integer, List<BlockState>> blockLists = Consumer.consumerBlockList.get(processId);
if (blockLists.get(id) != null) {
List<BlockState> blockStateList = blockLists.get(id);
for (BlockState blockState : blockStateList) {
String removed = Lookup.whoRemovedCache(blockState);
if (removed.length() > 0) {
user = removed;
}
}
blockLists.remove(id);
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), Util.getBlockId(blockType), blockData, null, block.getBlockData().getAsString(), overrideData);
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), Util.getBlockId(blockType),
blockData, null, block.getBlockData().getAsString(), overrideData);
}
}
}
}
@@ -2,29 +2,38 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.Map;
import org.bukkit.Location;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.ChatLogger;
import org.bukkit.Location;
class PlayerChatProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, String user) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object,
String user)
{
if (!(object instanceof Object[])) {
return;
}
Object[] data = (Object[]) object;
if (data[1] instanceof Location) {
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
if (strings.get(id) != null) {
String message = strings.get(id);
Long timestamp = (Long) data[0];
Location location = (Location) data[1];
ChatLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
strings.remove(id);
}
}
}
}
@@ -2,29 +2,38 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.Map;
import org.bukkit.Location;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.CommandLogger;
import org.bukkit.Location;
class PlayerCommandProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, String user) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object,
String user)
{
if (!(object instanceof Object[])) {
return;
}
Object[] data = (Object[]) object;
if (data[1] instanceof Location) {
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
if (strings.get(id) != null) {
String message = strings.get(id);
Long timestamp = (Long) data[0];
Location location = (Location) data[1];
CommandLogger.log(preparedStmt, batchCount, timestamp, location, user, message);
strings.remove(id);
}
}
}
}
@@ -1,18 +1,21 @@
package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import net.coreprotect.database.logger.PlayerInteractLogger;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import net.coreprotect.database.logger.PlayerInteractLogger;
class PlayerInteractionProcess {
static void process(PreparedStatement preparedStmt, int batchCount, String user, Object object, Material type) {
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
PlayerInteractLogger.log(preparedStmt, batchCount, user, block, type);
}
}
}
@@ -1,18 +1,21 @@
package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import org.bukkit.block.BlockState;
import net.coreprotect.database.logger.PlayerKillLogger;
import org.bukkit.block.BlockState;
class PlayerKillProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int id, Object object, String user) {
if (object instanceof Object[]) {
BlockState block = (BlockState) ((Object[]) object)[0];
String player = (String) ((Object[]) object)[1];
PlayerKillLogger.log(preparedStmt, batchCount, user, block, player);
}
}
}
@@ -3,27 +3,37 @@ package net.coreprotect.consumer.process;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Map;
import org.bukkit.Location;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.PlayerSessionLogger;
import net.coreprotect.database.logger.UsernameLogger;
import org.bukkit.Location;
class PlayerLoginProcess {
static void process(Connection connection, PreparedStatement preparedStmt, int batchCount, int processId, int id, Object object, int configSessions, int configUsernames, int time, String user) {
static void process(Connection connection, PreparedStatement preparedStmt, int batchCount, int processId, int id,
Object object, int configSessions, int configUsernames, int time, String user)
{
if (object instanceof Location) {
Map<Integer, String> strings = Consumer.consumerStrings.get(processId);
if (strings.get(id) != null) {
String uuid = strings.get(id);
Location location = (Location) object;
UsernameLogger.log(connection, user, uuid, configUsernames, time);
if (configSessions == 1) {
PlayerSessionLogger.log(preparedStmt, batchCount, user, location, time, 1);
}
strings.remove(id);
}
}
}
}
@@ -1,17 +1,20 @@
package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import org.bukkit.Location;
import net.coreprotect.database.logger.PlayerSessionLogger;
import org.bukkit.Location;
class PlayerLogoutProcess {
static void process(PreparedStatement preparedStmt, int batchCount, Object object, int time, String user) {
if (object instanceof Location) {
Location location = (Location) object;
PlayerSessionLogger.log(preparedStmt, batchCount, user, location, time, 0);
}
}
}
@@ -7,13 +7,12 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Material;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.UserStatement;
import org.bukkit.Material;
public class Process {
@@ -50,51 +49,84 @@ public class Process {
private static volatile int currentConsumerSize = 0;
public static int getCurrentConsumerSize() {
return currentConsumerSize;
}
protected static void updateLockTable(Statement statement, int locked) {
try {
int unixTimestamp = (int) (System.currentTimeMillis() / 1000L);
int timeSinceLastUpdate = unixTimestamp - lastLockUpdate;
if (timeSinceLastUpdate >= 15 || locked == 0) {
statement.executeUpdate("UPDATE " + ConfigHandler.prefix + "database_lock SET status = '" + locked + "', time = '" + unixTimestamp + "' WHERE rowid = '1'");
statement.executeUpdate("UPDATE " + ConfigHandler.prefix + "database_lock SET status = '" + locked
+ "', time = '" + unixTimestamp + "' WHERE rowid = '1'");
lastLockUpdate = unixTimestamp;
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
protected static void processConsumer(int processId, boolean lastRun) {
try (Connection connection = Database.getConnection(false, 500)) {
if (connection == null) {
return;
}
Consumer.isPaused = true;
Statement statement = connection.createStatement();
Database.performCheckpoint(statement, Config.getGlobal().MYSQL);
Consumer.isPaused = true;
ArrayList<Object[]> consumerData = Consumer.consumer.get(processId);
Map<Integer, String[]> users = Consumer.consumerUsers.get(processId);
Map<Integer, Object> consumerObject = Consumer.consumerObjects.get(processId);
int consumerDataSize = consumerData.size();
currentConsumerSize = consumerDataSize;
Database.beginTransaction(statement);
if (currentConsumerSize == 0) { // No data, skip processing
updateLockTable(statement, (lastRun ? 0 : 1));
statement.close();
Consumer.consumer_id.put(processId, new Integer[] { 0, 0 });
Consumer.isPaused = false;
return;
}
Database.beginTransaction(statement, Config.getGlobal().MYSQL);
// Scan through usernames, ensure everything is loaded in memory.
for (Entry<Integer, String[]> entry : users.entrySet()) {
String[] data = entry.getValue();
if (data != null) {
String user = data[0];
String uuid = data[1];
if (user != null && ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT)) == null) {
UserStatement.loadId(connection, user, uuid);
}
}
}
updateLockTable(statement, (lastRun ? 0 : 1));
Database.commitTransaction(statement);
Database.commitTransaction(statement, Config.getGlobal().MYSQL);
// Create prepared statements
PreparedStatement preparedStmtSigns = Database.prepareStatement(connection, Database.SIGN, false);
@@ -113,10 +145,12 @@ public class Process {
PreparedStatement preparedStmtBlockdata = Database.prepareStatement(connection, Database.BLOCKDATA, false);
// Scan through consumer data
Database.beginTransaction(statement);
Database.beginTransaction(statement, Config.getGlobal().MYSQL);
for (int i = 0; i < consumerDataSize; i++) {
Object[] data = consumerData.get(i);
if (data != null) {
int id = (int) data[0];
int action = (int) data[1];
Material blockType = (Material) data[2];
@@ -126,34 +160,46 @@ public class Process {
int forceData = (int) data[6];
if (users.get(id) != null && consumerObject.get(id) != null) {
String user = users.get(id)[0];
Object object = consumerObject.get(id);
try {
switch (action) {
case Process.BLOCK_BREAK:
BlockBreakProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, processId, id, blockType, blockData, replaceType, forceData, user, object, (String) data[7]);
BlockBreakProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, processId, id,
blockType, blockData, replaceType, forceData, user, object,
(String) data[7]);
break;
case Process.BLOCK_PLACE:
BlockPlaceProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, blockType, blockData, replaceType, replaceData, forceData, user, object, (String) data[7], (String) data[8]);
BlockPlaceProcess.process(preparedStmtBlocks, preparedStmtSkulls, i, blockType,
blockData, replaceType, replaceData, forceData, user, object,
(String) data[7], (String) data[8]);
break;
case Process.SIGN_TEXT:
SignTextProcess.process(preparedStmtSigns, i, processId, id, forceData, user, object, replaceData, blockData);
SignTextProcess.process(preparedStmtSigns, i, processId, id, forceData, user,
object, replaceData, blockData);
break;
case Process.CONTAINER_BREAK:
ContainerBreakProcess.process(preparedStmtContainers, i, processId, id, blockType, user, object);
ContainerBreakProcess.process(preparedStmtContainers, i, processId, id, blockType,
user, object);
break;
case Process.PLAYER_INTERACTION:
PlayerInteractionProcess.process(preparedStmtBlocks, i, user, object, blockType);
break;
case Process.CONTAINER_TRANSACTION:
ContainerTransactionProcess.process(preparedStmtContainers, preparedStmtItems, i, processId, id, blockType, forceData, user, object);
ContainerTransactionProcess.process(preparedStmtContainers, preparedStmtItems, i,
processId, id, blockType, forceData, user, object);
break;
case Process.ITEM_TRANSACTION:
ItemTransactionProcess.process(preparedStmtItems, i, processId, id, forceData, replaceData, blockData, user, object);
ItemTransactionProcess.process(preparedStmtItems, i, processId, id, forceData,
replaceData, blockData, user, object);
break;
case Process.STRUCTURE_GROWTH:
StructureGrowthProcess.process(statement, preparedStmtBlocks, i, processId, id, user, object, forceData);
StructureGrowthProcess.process(statement, preparedStmtBlocks, i, processId, id,
user, object, forceData);
break;
case Process.ROLLBACK_UPDATE:
RollbackUpdateProcess.process(statement, processId, id, forceData, 0);
@@ -186,22 +232,26 @@ public class Process {
PlayerCommandProcess.process(preparedStmtCommand, i, processId, id, object, user);
break;
case Process.PLAYER_LOGIN:
PlayerLoginProcess.process(connection, preparedStmtSession, i, processId, id, object, blockData, replaceData, forceData, user);
PlayerLoginProcess.process(connection, preparedStmtSession, i, processId, id,
object, blockData, replaceData, forceData, user);
break;
case Process.PLAYER_LOGOUT:
PlayerLogoutProcess.process(preparedStmtSession, i, object, forceData, user);
break;
case Process.ENTITY_KILL:
EntityKillProcess.process(preparedStmtBlocks, preparedStmtEntities, i, processId, id, object, user);
EntityKillProcess.process(preparedStmtBlocks, preparedStmtEntities, i, processId,
id, object, user);
break;
case Process.ENTITY_SPAWN:
EntitySpawnProcess.process(statement, object, forceData);
break;
case Process.NATURAL_BLOCK_BREAK:
NaturalBlockBreakProcess.process(statement, preparedStmtBlocks, i, processId, id, user, object, blockType, blockData, (String) data[7]);
NaturalBlockBreakProcess.process(statement, preparedStmtBlocks, i, processId, id,
user, object, blockType, blockData, (String) data[7]);
break;
case Process.MATERIAL_INSERT:
MaterialInsertProcess.process(preparedStmtMaterials, statement, i, object, forceData);
MaterialInsertProcess.process(preparedStmtMaterials, statement, i, object,
forceData);
break;
case Process.ART_INSERT:
ArtInsertProcess.process(preparedStmtArt, statement, i, object, forceData);
@@ -213,37 +263,61 @@ public class Process {
PlayerKillProcess.process(preparedStmtBlocks, i, id, object, user);
break;
case Process.BLOCKDATA_INSERT:
BlockDataInsertProcess.process(preparedStmtBlockdata, statement, i, object, forceData);
BlockDataInsertProcess.process(preparedStmtBlockdata, statement, i, object,
forceData);
break;
}
// If database connection goes missing, remove processed data from consumer and abort
// If database connection goes missing, remove processed data from consumer and
// abort
if (statement.isClosed()) {
for (int index = (i - 1); index >= 0; index--) {
consumerData.remove(index);
}
currentConsumerSize = 0;
Consumer.consumer_id.put(processId, new Integer[] { 0, 0 });
Consumer.isPaused = false;
return;
}
// If interrupt requested, commit data, sleep, and resume processing
if (Consumer.interrupt) {
commit(statement, preparedStmtSigns, preparedStmtBlocks, preparedStmtSkulls, preparedStmtContainers, preparedStmtItems, preparedStmtWorlds, preparedStmtChat, preparedStmtCommand, preparedStmtSession, preparedStmtEntities, preparedStmtMaterials, preparedStmtArt, preparedStmtEntity, preparedStmtBlockdata);
commit(statement, preparedStmtSigns, preparedStmtBlocks, preparedStmtSkulls,
preparedStmtContainers, preparedStmtItems, preparedStmtWorlds, preparedStmtChat,
preparedStmtCommand, preparedStmtSession, preparedStmtEntities,
preparedStmtMaterials, preparedStmtArt, preparedStmtEntity,
preparedStmtBlockdata);
Thread.sleep(500);
Database.beginTransaction(statement);
Database.beginTransaction(statement, Config.getGlobal().MYSQL);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
currentConsumerSize--;
}
// commit data to database
commit(statement, preparedStmtSigns, preparedStmtBlocks, preparedStmtSkulls, preparedStmtContainers, preparedStmtItems, preparedStmtWorlds, preparedStmtChat, preparedStmtCommand, preparedStmtSession, preparedStmtEntities, preparedStmtMaterials, preparedStmtArt, preparedStmtEntity, preparedStmtBlockdata);
commit(statement, preparedStmtSigns, preparedStmtBlocks, preparedStmtSkulls, preparedStmtContainers,
preparedStmtItems, preparedStmtWorlds, preparedStmtChat, preparedStmtCommand, preparedStmtSession,
preparedStmtEntities, preparedStmtMaterials, preparedStmtArt, preparedStmtEntity,
preparedStmtBlockdata);
// close connections/statements
preparedStmtSigns.close();
@@ -266,17 +340,30 @@ public class Process {
users.clear();
consumerObject.clear();
consumerData.clear();
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
Consumer.consumer_id.put(processId, new Integer[] { 0, 0 });
Consumer.isPaused = false;
}
private static void commit(Statement statement, PreparedStatement preparedStmtSigns, PreparedStatement preparedStmtBlocks, PreparedStatement preparedStmtSkulls, PreparedStatement preparedStmtContainers, PreparedStatement preparedStmtItems, PreparedStatement preparedStmtWorlds, PreparedStatement preparedStmtChat, PreparedStatement preparedStmtCommand, PreparedStatement preparedStmtSession, PreparedStatement preparedStmtEntities, PreparedStatement preparedStmtMaterials, PreparedStatement preparedStmtArt, PreparedStatement preparedStmtEntity, PreparedStatement preparedStmtBlockdata) {
private static void commit(Statement statement, PreparedStatement preparedStmtSigns,
PreparedStatement preparedStmtBlocks, PreparedStatement preparedStmtSkulls,
PreparedStatement preparedStmtContainers, PreparedStatement preparedStmtItems,
PreparedStatement preparedStmtWorlds, PreparedStatement preparedStmtChat,
PreparedStatement preparedStmtCommand, PreparedStatement preparedStmtSession,
PreparedStatement preparedStmtEntities, PreparedStatement preparedStmtMaterials,
PreparedStatement preparedStmtArt, PreparedStatement preparedStmtEntity,
PreparedStatement preparedStmtBlockdata)
{
try {
preparedStmtSigns.executeBatch();
preparedStmtBlocks.executeBatch();
preparedStmtSkulls.executeBatch();
@@ -291,10 +378,14 @@ public class Process {
preparedStmtArt.executeBatch();
preparedStmtEntity.executeBatch();
preparedStmtBlockdata.executeBatch();
Database.commitTransaction(statement);
}
catch (Exception e) {
Database.commitTransaction(statement, Config.getGlobal().MYSQL);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -3,7 +3,6 @@ package net.coreprotect.consumer.process;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.Database;
import net.coreprotect.utility.Util;
@@ -11,17 +10,28 @@ import net.coreprotect.utility.Util;
class RollbackUpdateProcess {
static void process(Statement statement, int processId, int id, int action, int table) {
Map<Integer, List<Object[]>> updateLists = Consumer.consumerObjectArrayList.get(processId);
if (updateLists.get(id) != null) {
List<Object[]> list = updateLists.get(id);
for (Object[] listRow : list) {
long rowid = (Long) listRow[0];
int rolledBack = (Integer) listRow[9];
if (Util.rolledBack(rolledBack, (table == 2 || table == 3 || table == 4)) == action) { // 1 = restore, 0 = rollback
if (Util.rolledBack(rolledBack, (table == 2 || table == 3 || table == 4)) == action) { // 1 = restore, 0
// = rollback
Database.performUpdate(statement, rowid, rolledBack, table);
}
}
updateLists.remove(id);
}
}
}
@@ -2,23 +2,33 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.util.Map;
import org.bukkit.Location;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.logger.SignTextLogger;
import org.bukkit.Location;
class SignTextProcess {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, int forceData, String user, Object object, int action, int color) {
static void process(PreparedStatement preparedStmt, int batchCount, int processId, int id, int forceData,
String user, Object object, int action, int color)
{
if (object instanceof Location) {
Location location = (Location) object;
Map<Integer, Object[]> signs = Consumer.consumerSigns.get(processId);
if (signs.get(id) != null) {
Object[] SIGN_DATA = signs.get(id);
SignTextLogger.log(preparedStmt, batchCount, user, location, action, color, (Integer) SIGN_DATA[0], (String) SIGN_DATA[1], (String) SIGN_DATA[2], (String) SIGN_DATA[3], (String) SIGN_DATA[4], forceData);
SignTextLogger.log(preparedStmt, batchCount, user, location, action, color, (Integer) SIGN_DATA[0],
(Integer) SIGN_DATA[1], (Boolean) SIGN_DATA[2], (Boolean) SIGN_DATA[3], (String) SIGN_DATA[4],
(String) SIGN_DATA[5], (String) SIGN_DATA[6], (String) SIGN_DATA[7], (String) SIGN_DATA[8],
(String) SIGN_DATA[9], (String) SIGN_DATA[10], (String) SIGN_DATA[11], forceData);
signs.remove(id);
}
}
}
}
@@ -2,22 +2,21 @@ package net.coreprotect.consumer.process;
import java.sql.Statement;
import java.util.Locale;
import org.bukkit.block.BlockState;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.SignStatement;
import net.coreprotect.utility.Util;
import org.bukkit.block.BlockState;
class SignUpdateProcess {
static void process(Statement statement, Object object, String user, int action, int time) {
/*
* We're switching blocks around quickly.
* This block could already be removed again by the time the server tries to modify it.
* Ignore any errors.
* We're switching blocks around quickly. This block could already be removed
* again by the time the server tries to modify it. Ignore any errors.
*/
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
int x = block.getX();
int y = block.getY();
@@ -26,13 +25,26 @@ class SignUpdateProcess {
int userid = ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT));
String query = "";
if (action == 0) {
query = "SELECT color, data, line_1, line_2, line_3, line_4 FROM " + ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x + "' AND z='" + z + "' AND y='" + y + "' AND time < '" + time + "' ORDER BY rowid DESC LIMIT 0, 1";
}
else {
query = "SELECT color, data, line_1, line_2, line_3, line_4 FROM " + ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x + "' AND z='" + z + "' AND y='" + y + "' AND time >= '" + time + "' ORDER BY rowid ASC LIMIT 0, 1";
query = "SELECT color, color_secondary, data, waxed, face, line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8 FROM "
+ ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x
+ "' AND z='" + z + "' AND y='" + y + "' AND time < '" + time
+ "' ORDER BY rowid DESC LIMIT 0, 1";
} else {
query = "SELECT color, color_secondary, data, waxed, face, line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8 FROM "
+ ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x
+ "' AND z='" + z + "' AND y='" + y + "' AND time >= '" + time
+ "' ORDER BY rowid ASC LIMIT 0, 1";
}
SignStatement.getData(statement, block, query);
Util.updateBlock(block);
}
}
}
@@ -1,26 +1,43 @@
package net.coreprotect.consumer.process;
import java.sql.Statement;
import org.bukkit.block.BlockState;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.Database;
import net.coreprotect.database.statement.SkullStatement;
import net.coreprotect.utility.Util;
import net.coreprotect.config.ConfigHandler;
import org.bukkit.block.BlockState;
class SkullUpdateProcess {
static void process(Statement statement, Object object, int rowId) {
/*
* We're switching blocks around quickly.
* This block could already be removed again by the time the server tries to modify it.
* Ignore any errors.
* We're switching blocks around quickly. This block could already be removed
* again by the time the server tries to modify it. Ignore any errors.
*/
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
String query = "SELECT owner FROM " + ConfigHandler.prefix + "skull WHERE rowid='" + rowId + "' LIMIT 0, 1";
SkullStatement.getData(statement, block, query);
StringBuilder query = new StringBuilder("SELECT owner");
if (Database.hasSkullSkinColumn()) {
query.append(", skin");
}
if (Database.hasSkullMetadataColumn()) {
query.append(", metadata");
}
query.append(" FROM ").append(ConfigHandler.prefix).append("skull WHERE rowid='").append(rowId)
.append("' LIMIT 0, 1");
SkullStatement.getData(statement, block, query.toString());
Util.updateBlock(block);
}
}
}
@@ -4,39 +4,65 @@ import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import org.bukkit.block.BlockState;
import net.coreprotect.consumer.Consumer;
import net.coreprotect.database.Lookup;
import net.coreprotect.database.logger.BlockBreakLogger;
import net.coreprotect.database.logger.BlockPlaceLogger;
import net.coreprotect.utility.Util;
import org.bukkit.block.BlockState;
class StructureGrowthProcess {
static void process(Statement statement, PreparedStatement preparedStmt, int batchCount, int processId, int id, String user, Object object, int replaceBlockCount) {
static void process(Statement statement, PreparedStatement preparedStmt, int batchCount, int processId, int id,
String user, Object object, int replaceBlockCount)
{
if (object instanceof BlockState) {
BlockState block = (BlockState) object;
Map<Integer, List<BlockState>> blockLists = Consumer.consumerBlockList.get(processId);
if (blockLists.get(id) != null) {
List<BlockState> blockStates = blockLists.get(id);
String resultData = Lookup.whoPlaced(statement, block);
if (resultData.length() > 0) {
user = resultData;
String resultData = Lookup.whoPlacedCache(block);
if (resultData.isEmpty()) {
resultData = Lookup.whoPlaced(statement, block);
}
if (resultData.length() > 0) {
user = resultData;
}
int count = 0;
for (BlockState blockState : blockStates) {
if (count < replaceBlockCount) {
BlockBreakLogger.log(preparedStmt, batchCount, user, blockState.getLocation(), Util.getBlockId(blockState.getType()), 0, null, blockState.getBlockData().getAsString(), null);
}
else {
BlockPlaceLogger.log(preparedStmt, batchCount, user, blockState, 0, 0, null, -1, false, null, null, null);
BlockBreakLogger.log(preparedStmt, batchCount, user, blockState.getLocation(),
Util.getBlockId(blockState.getType()), 0, null, blockState.getBlockData().getAsString(),
null);
} else {
BlockPlaceLogger.log(preparedStmt, batchCount, user, blockState, 0, 0, null, -1, false, null,
null, null);
}
count++;
}
blockLists.remove(id);
}
}
}
}
@@ -2,7 +2,6 @@ package net.coreprotect.consumer.process;
import java.sql.PreparedStatement;
import java.sql.Statement;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.MaterialStatement;
import net.coreprotect.database.statement.WorldStatement;
@@ -12,25 +11,38 @@ import net.coreprotect.utility.Chat;
class WorldInsertProcess {
static void process(PreparedStatement preparedStmt, int batchCount, Statement statement, Object world, int worldId) {
static void process(PreparedStatement preparedStmt, int batchCount, Statement statement, Object world,
int worldId)
{
if (world instanceof String) {
String query = "SELECT id FROM " + ConfigHandler.prefix + "world WHERE id = '" + worldId + "' LIMIT 0, 1";
boolean hasMaterial = MaterialStatement.hasMaterial(statement, query);
if (!hasMaterial) {
WorldStatement.insert(preparedStmt, batchCount, worldId, (String) world);
// validate ID maps to ensure mapping wasn't reloaded from database prior to this insertion completing
// validate ID maps to ensure mapping wasn't reloaded from database prior to
// this insertion completing
ConfigHandler.worlds.put((String) world, worldId);
ConfigHandler.worldsReversed.put(worldId, (String) world);
if (worldId > ConfigHandler.worldId) {
ConfigHandler.worldId = worldId;
}
}
else {
} else {
Chat.console(Phrase.build(Phrase.CACHE_ERROR, "world"));
Chat.console(Phrase.build(Phrase.CACHE_RELOAD, Selector.SECOND));
ConfigHandler.loadWorlds(statement);
}
}
}
}
@@ -5,8 +5,17 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Queue;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.database.rollback.Rollback;
import net.coreprotect.database.rollback.RollbackComplete;
import net.coreprotect.language.Phrase;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.thread.Scheduler;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Util;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -18,40 +27,48 @@ import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import net.coreprotect.CoreProtect;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.consumer.Queue;
import net.coreprotect.consumer.process.Process;
import net.coreprotect.language.Phrase;
import net.coreprotect.model.BlockGroup;
import net.coreprotect.utility.Chat;
import net.coreprotect.utility.Util;
public class ContainerRollback extends Rollback {
public class ContainerRollback extends Queue {
public static void performContainerRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids,
List<String> checkUsers, String timeString, List<Object> restrictList, Map<Object, Boolean> excludeList,
List<String> excludeUserList, List<Integer> actionList, final Location location, Integer[] radius,
long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose,
final int rollbackType)
{
public static void performContainerRollbackRestore(Statement statement, CommandSender user, List<String> checkUuids, List<String> checkUsers, String timeString, List<Object> restrictList, Map<Object, Boolean> excludeList, List<String> excludeUserList, List<Integer> actionList, final Location location, Integer[] radius, long startTime, long endTime, boolean restrictWorld, boolean lookup, boolean verbose, final int rollbackType) {
try {
long timeStart = System.currentTimeMillis();
final List<Object[]> lookupList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers, restrictList, excludeList, excludeUserList, actionList, location, radius, null, startTime, endTime, -1, -1, restrictWorld, lookup);
final List<Object[]> lookupList = Lookup.performLookupRaw(statement, user, checkUuids, checkUsers,
restrictList, excludeList, excludeUserList, actionList, location, radius, null, startTime, endTime,
-1, -1, restrictWorld, lookup);
if (rollbackType == 1) {
Collections.reverse(lookupList);
}
String userString = "#server";
if (user != null) {
userString = user.getName();
}
Queue.queueRollbackUpdate(userString, location, lookupList, Process.CONTAINER_ROLLBACK_UPDATE, rollbackType); // Perform update transaction in consumer
Queue.queueRollbackUpdate(userString, location, lookupList, Process.CONTAINER_ROLLBACK_UPDATE,
rollbackType); // Perform update transaction in consumer
final String finalUserString = userString;
ConfigHandler.rollbackHash.put(userString, new int[] { 0, 0, 0, 0 });
ConfigHandler.rollbackHash.put(userString, new int[] { 0, 0, 0, 0, 0 });
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), new Runnable() {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), new Runnable() {
@Override
public void run() {
try {
int[] rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
int itemCount = rollbackHashData[0];
// int blockCount = rollbackHashData[1];
@@ -59,34 +76,52 @@ public class ContainerRollback extends Queue {
Block block = location.getBlock();
if (!block.getWorld().isChunkLoaded(block.getChunk())) {
block.getWorld().getChunkAt(block.getLocation());
}
Object container = null;
Material type = block.getType();
List<ItemFrame> matchingFrames = new ArrayList<>();
if (BlockGroup.CONTAINERS.contains(type)) {
container = Util.getContainerInventory(block.getState(), false);
}
else {
} else {
for (Entity entity : block.getChunk().getEntities()) {
if (entity.getLocation().getBlockX() == location.getBlockX() && entity.getLocation().getBlockY() == location.getBlockY() && entity.getLocation().getBlockZ() == location.getBlockZ()) {
if (entity.getLocation().getBlockX() == location.getBlockX()
&& entity.getLocation().getBlockY() == location.getBlockY()
&& entity.getLocation().getBlockZ() == location.getBlockZ())
{
if (entity instanceof ArmorStand) {
type = Material.ARMOR_STAND;
container = Util.getEntityEquipment((LivingEntity) entity);
}
else if (entity instanceof ItemFrame) {
} else if (entity instanceof ItemFrame) {
type = Material.ITEM_FRAME;
container = entity;
matchingFrames.add((ItemFrame) entity);
}
}
}
}
int modifyCount = 0;
if (container != null) {
for (Object[] lookupRow : lookupList) {
// int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
// int rowId = lookupRow[0];
// int rowTime = (Integer)lookupRow[1];
@@ -103,16 +138,23 @@ public class ContainerRollback extends Queue {
byte[] rowMetadata = (byte[]) lookupRow[12];
Material rowType = Util.getType(rowTypeRaw);
if ((rollbackType == 0 && rowRolledBack == 0) || (rollbackType == 1 && rowRolledBack == 1)) {
if ((rollbackType == 0 && rowRolledBack == 0)
|| (rollbackType == 1 && rowRolledBack == 1))
{
modifyCount = modifyCount + rowAmount;
int action = 0;
if (rollbackType == 0 && rowAction == 0) {
action = 1;
}
if (rollbackType == 1 && rowAction == 1) {
action = 1;
}
ItemStack itemstack = new ItemStack(rowType, rowAmount);
@@ -122,45 +164,67 @@ public class ContainerRollback extends Queue {
itemstack = (ItemStack) populatedStack[2];
if (type == Material.ITEM_FRAME && faceData.length() > 0) {
BlockFace blockFace = BlockFace.valueOf(faceData);
ItemFrame itemFrame = (ItemFrame) container;
if (blockFace != itemFrame.getFacing()) {
for (ItemFrame frame : matchingFrames) {
if (blockFace == frame.getFacing()) {
container = frame;
break;
}
}
}
}
Rollback.modifyContainerItems(type, container, slot, itemstack, action);
}
}
}
matchingFrames.clear();
ConfigHandler.rollbackHash.put(finalUserString, new int[] { itemCount, modifyCount, entityCount, 1 });
}
catch (Exception e) {
ConfigHandler.rollbackHash.put(finalUserString,
new int[]
{ itemCount, modifyCount, entityCount, 1, 1 });
} catch (Exception e) {
e.printStackTrace();
}
}
}, 0);
}, location, 0);
int[] rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
int next = rollbackHashData[3];
int sleepTime = 0;
while (next == 0) {
sleepTime = sleepTime + 5;
Thread.sleep(5);
rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
next = rollbackHashData[3];
if (sleepTime > 300000) {
Chat.console(Phrase.build(Phrase.ROLLBACK_ABORTED));
break;
}
}
rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
@@ -169,19 +233,29 @@ public class ContainerRollback extends Queue {
double totalSeconds = (timeFinish - timeStart) / 1000.0;
if (user != null) {
int file = -1;
if (blockCount > 0) {
file = 1;
}
int itemCount = 0;
int entityCount = 0;
Rollback.finishRollbackRestore(user, location, checkUsers, restrictList, excludeList, excludeUserList, actionList, timeString, file, totalSeconds, itemCount, blockCount, entityCount, rollbackType, radius, verbose, restrictWorld, 0);
RollbackComplete.output(user, location, checkUsers, restrictList, excludeList, excludeUserList,
actionList, timeString, file, totalSeconds, itemCount, blockCount, entityCount, rollbackType,
radius, verbose, restrictWorld, 0);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -3,52 +3,80 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.List;
import java.util.Locale;
import org.bukkit.Location;
import org.bukkit.Material;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.BlockStatement;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.event.CoreProtectPreLogEvent;
import net.coreprotect.thread.CacheHandler;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
public class BlockBreakLogger {
private BlockBreakLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int type, int data, List<Object> meta, String blockData, String overrideData) {
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int type,
int data, List<Object> meta, String blockData, String overrideData)
{
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null || location == null) {
return;
}
Material checkType = Util.getType(type);
if (checkType == null) {
return;
} else if (checkType.equals(Material.AIR) || checkType.equals(Material.CAVE_AIR)) {
return;
}
else if (checkType.equals(Material.AIR) || checkType.equals(Material.CAVE_AIR)) {
if (ConfigHandler.blacklist.get(checkType.getKey().toString()) != null) {
return;
}
if (!user.startsWith("#")) {
CacheHandler.spreadCache.remove(location);
String cacheId = location.getBlockX() + "." + location.getBlockY() + "." + location.getBlockZ() + "."
+ Util.getWorldId(location.getWorld().getName());
CacheHandler.spreadCache.remove(cacheId);
}
if (checkType == Material.LECTERN) {
blockData = blockData.replaceFirst("has_book=true", "has_book=false");
}
else if (checkType == Material.PAINTING || BukkitAdapter.ADAPTER.isItemFrame(checkType)) {
} else if (checkType == Material.PAINTING || BukkitAdapter.ADAPTER.isItemFrame(checkType)) {
blockData = overrideData;
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
int wid = Util.getWorldId(location.getWorld().getName());
@@ -56,12 +84,25 @@ public class BlockBreakLogger {
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
CacheHandler.breakCache.put("" + x + "." + y + "." + z + "." + wid + "", new Object[] { time, event.getUser(), type });
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, type, data, meta, blockData, 0, 0);
}
catch (Exception e) {
CacheHandler.breakCache.put("" + x + "." + y + "." + z + "." + wid + "",
new Object[]
{ time, event.getUser(), type });
if (event.isCancelled()) {
return;
}
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, type, data, meta, blockData, 0,
0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -3,55 +3,94 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.List;
import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.BlockStatement;
import net.coreprotect.database.statement.UserStatement;
import net.coreprotect.event.CoreProtectPreLogEvent;
import net.coreprotect.thread.CacheHandler;
import net.coreprotect.utility.Util;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
public class BlockPlaceLogger {
private BlockPlaceLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, BlockState block, int replacedType, int replacedData, Material forceType, int forceData, boolean force, List<Object> meta, String blockData, String replaceBlockData) {
public static void log(PreparedStatement preparedStmt, int batchCount, String user, BlockState block,
int replacedType, int replacedData, Material forceType, int forceData, boolean force, List<Object> meta,
String blockData, String replaceBlockData)
{
try {
if (user == null || ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {
return;
}
Material type = block.getType();
if (blockData == null && (forceType == null || (!forceType.equals(Material.WATER)) && (!forceType.equals(Material.LAVA)))) {
if (blockData == null
&& (forceType == null || (!forceType.equals(Material.WATER)) && (!forceType.equals(Material.LAVA))))
{
blockData = block.getBlockData().getAsString();
if (blockData.equals("minecraft:air")) {
blockData = null;
}
}
int data = 0;
if (forceType != null && force) {
type = forceType;
if (BukkitAdapter.ADAPTER.isItemFrame(type) || type.equals(Material.SPAWNER) || type.equals(Material.PAINTING) || type.equals(Material.SKELETON_SKULL) || type.equals(Material.SKELETON_WALL_SKULL) || type.equals(Material.WITHER_SKELETON_SKULL) || type.equals(Material.WITHER_SKELETON_WALL_SKULL) || type.equals(Material.ZOMBIE_HEAD) || type.equals(Material.ZOMBIE_WALL_HEAD) || type.equals(Material.PLAYER_HEAD) || type.equals(Material.PLAYER_WALL_HEAD) || type.equals(Material.CREEPER_HEAD) || type.equals(Material.CREEPER_WALL_HEAD) || type.equals(Material.DRAGON_HEAD) || type.equals(Material.DRAGON_WALL_HEAD) || type.equals(Material.ARMOR_STAND) || type.equals(Material.END_CRYSTAL)) {
if (BukkitAdapter.ADAPTER.isItemFrame(type) || type.equals(Material.SPAWNER)
|| type.equals(Material.PAINTING) || type.equals(Material.SKELETON_SKULL)
|| type.equals(Material.SKELETON_WALL_SKULL) || type.equals(Material.WITHER_SKELETON_SKULL)
|| type.equals(Material.WITHER_SKELETON_WALL_SKULL) || type.equals(Material.ZOMBIE_HEAD)
|| type.equals(Material.ZOMBIE_WALL_HEAD) || type.equals(Material.PLAYER_HEAD)
|| type.equals(Material.PLAYER_WALL_HEAD) || type.equals(Material.CREEPER_HEAD)
|| type.equals(Material.CREEPER_WALL_HEAD) || type.equals(Material.DRAGON_HEAD)
|| type.equals(Material.DRAGON_WALL_HEAD) || type.equals(Material.ARMOR_STAND)
|| type.equals(Material.END_CRYSTAL))
{
data = forceData; // mob spawner, skull
}
else if (user.startsWith("#")) {
} else if (user.startsWith("#")) {
data = forceData;
}
}
else if (forceType != null && !type.equals(forceType)) {
} else if (forceType != null && !type.equals(forceType)) {
type = forceType;
data = forceData;
}
if (type.equals(Material.AIR) || type.equals(Material.CAVE_AIR)) {
return;
}
if (ConfigHandler.blacklist.get(type.getKey().toString()) != null) {
return;
}
int x = block.getX();
@@ -59,47 +98,79 @@ public class BlockPlaceLogger {
int z = block.getZ();
long chunkKey = (x >> 4) & 0xffffffffL | ((z >> 4) & 0xffffffffL) << 32;
if (ConfigHandler.populatedChunks.get(chunkKey) != null) {
boolean isWater = user.equals("#water");
boolean isLava = user.equals("#lava");
boolean isVine = user.equals("#vine");
if (isWater || isLava || isVine) {
int timeDelay = isWater ? 60 : 240;
long timeSincePopulation = ((System.currentTimeMillis() / 1000L) - ConfigHandler.populatedChunks.getOrDefault(chunkKey, 0L));
long timeSincePopulation = ((System.currentTimeMillis() / 1000L)
- ConfigHandler.populatedChunks.getOrDefault(chunkKey, 0L));
if (timeSincePopulation <= timeDelay) {
return;
}
if (timeSincePopulation > 240) {
ConfigHandler.populatedChunks.remove(chunkKey);
}
}
else if (type == Material.WATER || type == Material.LAVA) {
} else if (type == Material.WATER || type == Material.LAVA) {
ConfigHandler.populatedChunks.remove(chunkKey);
}
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
if (Config.getGlobal().API_ENABLED && !Bukkit.isPrimaryThread()) {
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
}
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
int wid = Util.getWorldId(block.getWorld().getName());
int time = (int) (System.currentTimeMillis() / 1000L);
if (event.getUser().length() > 0) {
CacheHandler.lookupCache.put("" + x + "." + y + "." + z + "." + wid + "", new Object[] { time, event.getUser(), type });
CacheHandler.lookupCache.put("" + x + "." + y + "." + z + "." + wid + "",
new Object[]
{ time, event.getUser(), type });
}
if (event.isCancelled()) {
return;
}
int internalType = Util.getBlockId(type.name(), true);
if (replacedType > 0 && Util.getType(replacedType) != Material.AIR
&& Util.getType(replacedType) != Material.CAVE_AIR)
{
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, replacedType, replacedData,
null, replaceBlockData, 0, 0);
if (replacedType > 0 && Util.getType(replacedType) != Material.AIR && Util.getType(replacedType) != Material.CAVE_AIR) {
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, replacedType, replacedData, null, replaceBlockData, 0, 0);
}
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, internalType, data, meta, blockData, 1, 0);
}
catch (Exception e) {
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, internalType, data, meta,
blockData, 1, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -2,34 +2,44 @@ package net.coreprotect.database.logger;
import java.sql.PreparedStatement;
import java.util.Locale;
import org.bukkit.Location;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.ChatStatement;
import net.coreprotect.utility.Util;
import org.bukkit.Location;
public class ChatLogger {
private ChatLogger() {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, long time, Location location, String user, String message) {
public static void log(PreparedStatement preparedStmt, int batchCount, long time, Location location, String user,
String message)
{
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {
return;
}
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
int wid = Util.getWorldId(location.getWorld().getName());
int userId = ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT));
ChatStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, message);
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
Loaded 100 of 240 files, more files were not shown because too many files have changed in this diff. Show more