Compare commits

..
638 Commits
Author SHA1 Message Date
NotAlexNoyle 36117803fe Exclude CODEOWNERS from language statistics 2026-10-29 16:18:50 -04:00
NotAlexNoyle cb4fead942 Add CODEOWNERS (one staff approval) 2026-10-29 16:18:50 -04:00
NotAlexNoyle 60375ab964 Update Maintenance MOTD 2026-05-21 13:45:14 -04:00
NotAlexNoyle 3a94423501 Update Maintenance MOTD 2026-05-21 11:43:06 -04:00
NotAlexNoyle 4b62c83410 Update Maintenance MOTD 2026-05-21 11:05:02 -04:00
NotAlexNoyle 2ccfae5d87 Fix config display on legacy clients 2026-05-20 11:04:16 -04:00
NotAlexNoyle 7f444d0f1c Update MOTD 2026-05-20 10:45:55 -04:00
NotAlexNoyle 46b3a3f14e Update MOTD 2026-05-20 10:37:48 -04:00
NotAlexNoyle 9ddac66d62 Fix runtime error 2026-05-20 10:29:49 -04:00
NotAlexNoyle dd7fa6f08a Fix dots in maintenance strings 2026-05-20 10:13:18 -04:00
NotAlexNoyle c2b4ceef1c Use live TrueOG Network config file 2026-05-20 09:24:57 -04:00
NotAlexNoyle b11136bed0 Merge pull request #1 from true-og/codex/update-plugin-dependency-to-advancedserverlist-og
Prefer AdvancedServerList-OG for Paper integration
2026-03-16 04:18:28 -04:00
NotAlexNoyle 7664d40696 Prefer AdvancedServerList-OG for paper integration 2026-03-16 04:18:17 -04:00
NotAlexNoyle dcbc8f7407 Drop bungee 2026-03-12 12:29:43 -04:00
NotAlexNoyle 752e9aeb19 Update API version 2026-03-12 12:22:14 -04:00
NotAlexNoyle 7fc3f0cbc9 Update gradle to 8.14.3 2025-08-30 10:26:21 -04:00
NotAlexNoyle c3014e8092 Always build with java 17 2025-05-29 21:38:30 -04:00
Nassim Jahnke 7f5a5d8d54 Enable Gradle configuration cache 2024-12-29 13:10:50 +01:00
Nassim Jahnke 27ff56f673 [ci skip] Update Gradle wrapper 2024-12-21 19:27:06 +01:00
Nassim Jahnke db49edaa88 [ci skip] Update Gradle wrapper 2024-11-17 17:51:22 +01:00
Nassim Jahnke b4e331fba3 4.3.0 Release 2024-09-17 10:51:56 +02:00
Maintenancer 563c184c0b New Crowdin updates (#138) 2024-09-15 11:49:45 +02:00
Maintenancer 6dd9ae0ec3 New Crowdin updates (#133) 2024-09-13 17:39:34 +02:00
Nassim Jahnke ac50b28659 Accept time durations in timer commands
Closes #134
2024-09-13 17:36:13 +02:00
Nassim Jahnke 65bf209705 Put ping, player count, and player list hover messages into sections 2024-09-13 16:20:02 +02:00
Nassim Jahnke 6d57f9664e Fix dummy sample player profiles on 1.21 Paper 2024-09-13 15:00:50 +02:00
Nassim Jahnke 1408dee12e Add timer-specific player count and player sample messages
Closes #131
2024-09-13 14:50:17 +02:00
Nassim Jahnke 97f6cb5d68 Don't send broadcasts to the console twice
Fixes #129
2024-09-13 14:15:28 +02:00
Nassim Jahnke 4cd541e158 Remove all leftover legacy chat usage 2024-09-13 13:23:18 +02:00
Nassim Jahnke 9a9793bb90 Clear sample players in Velocity ping listener 2024-09-13 12:47:05 +02:00
Nassim Jahnke 4005416de1 Upgrade Gradle wrapper 2024-09-13 12:45:42 +02:00
Maintenancer 12c9972efd New Crowdin updates (#124)
* New translations language-en.yml (Vietnamese)

* New translations language-en.yml (French)

* New translations language-en.yml (Russian)

* New translations language-en.yml (Hungarian)

* New translations language-en.yml (Spanish)

* New translations language-en.yml (German)
2024-08-29 13:37:28 +02:00
Nassim Jahnke 41acd5db94 Update actions 2024-08-27 22:01:30 +02:00
Nassim Jahnke 337e5739c6 Default to empty list if fallback field is missing/null 2024-08-27 21:51:09 +02:00
Nassim Jahnke 3ad5cff521 Don't log color codes, more message cleanups 2024-08-27 12:06:21 +02:00
Nassim Jahnke 2457cdff71 Rename Paper module, replace dump and update message sending with adventure components 2024-08-26 22:56:07 +02:00
Nassim Jahnke 7a9e8676d9 Fix maintenance dump command 2024-08-26 22:18:39 +02:00
Nassim Jahnke 5f52fa53f4 Update dependencies 2024-08-26 22:12:21 +02:00
Nassim Jahnke 1b1708aa69 Update shadow 2024-08-08 10:05:44 +02:00
Nassim Jahnke fdc6cd9bdd Update Hangar latest release endpoint 2024-07-31 18:14:01 +02:00
Maintenancer 1fb7c0ea42 New Crowdin updates (#121)
* New translations language-en.yml (Portuguese)

* New translations language-en.yml (Spanish)

* New translations language-en.yml (Italian)

* New translations language-en.yml (English)

* Update source file language-en.yml

* New translations language-en.yml (Vietnamese)
2024-06-13 16:33:37 +02:00
Nassim Jahnke 8d75af5b46 Bump version to 4.2.2-SNAPSHOT 2024-06-13 16:32:30 +02:00
Nassim Jahnke 4d0ad57695 Update Gradle wrapper 2024-06-01 17:10:15 +02:00
Nassim Jahnke 4c8ab9ce32 4.2.1 Release 2024-05-17 15:39:28 +02:00
Maintenancer 34bc884a11 New Crowdin updates (#120)
* New translations language-en.yml (Chinese Simplified)

* New translations language-en.yml (Russian)
2024-05-17 15:25:26 +02:00
Maintenancer 0ebde0b8db New Crowdin updates (#119) 2024-04-30 00:10:43 +02:00
Nassim Jahnke 82301fd9f9 Add paperweight-mappings-namespace attribute 2024-04-28 03:53:56 +02:00
EpicPlayerA10 b0d87a94a8 Offline player fetching improvements (#117) 2024-03-24 18:40:20 +01:00
Alec Jensen a380d8bf35 Show proxied maintenance status in ping for forced hosts (#118) 2024-03-24 10:57:56 +01:00
Nassim Jahnke ae8fb9a8db Update Gradle wrapper 2024-03-24 10:30:34 +01:00
Maintenancer 724fcd8395 New Crowdin updates (#114)
* New translations language-en.yml (Russian)

* New translations language-en.yml (Chinese Simplified)
2024-03-02 20:35:26 +01:00
Maintenancer cfbcf0975c New Crowdin updates (#113) 2024-02-04 17:25:28 +01:00
Maintenancer 32baaf620f New translations language-en.yml (French) by Kertie2_ (#112) 2024-01-14 17:45:55 +01:00
Maintenancer 06e3405bcc New Crowdin updates (#110)
* New translations language-en.yml (Italian)

* New translations language-en.yml (Hungarian)

* New translations language-en.yml (Chinese Simplified)

* New translations language-en.yml (Spanish)

* New translations language-en.yml (Turkish)

* New translations language-en.yml (German)

* New translations language-en.yml (Russian)
2024-01-14 17:39:41 +01:00
Nassim Jahnke d2520eed6c Update copyright headers 2024-01-01 21:45:25 +01:00
Nassim Jahnke 24bd5b2618 Don't keep converting player count and count hover messages 2024-01-01 21:44:08 +01:00
Nassim Jahnke f6b6a45fa8 Bump version to 4.2.1-SNAPSHOT 2023-12-31 16:26:22 +01:00
Nassim Jahnke b37bfe6334 Update Gradle wrapper 2023-12-13 22:47:27 +01:00
Nassim Jahnke 1f8574fe26 Update changelog title 2023-09-17 19:43:53 +10:00
Nassim Jahnke 7ee3b8a5fe 4.2.0 Release 2023-09-17 18:31:33 +10:00
Maintenancer cfb7e9e15b New Crowdin updates (#109) 2023-09-17 18:19:30 +10:00
Nassim Jahnke 5d595869ee Add server specific timer command messages 2023-09-17 13:25:38 +10:00
Nassim Jahnke e154b62ef7 Update Blossom 2023-09-17 12:50:37 +10:00
Nassim Jahnke 3d49982e56 Update maven repo for SLP and readd hook 2023-09-11 13:35:19 +10:00
Nassim Jahnke a1bc66a717 Don't publish adventure modules 2023-09-10 15:14:57 +10:00
Nassim Jahnke c42f0ab912 Configure (manual) publishing 2023-09-10 14:47:48 +10:00
Nassim Jahnke 22dd4ce266 Remove SLP dependency for now
The repository is not available and thus breaks building...
2023-09-10 14:11:41 +10:00
Nassim Jahnke 2e66e1b926 Update Gradle wrapper 2023-09-10 13:44:08 +10:00
Maintenancer ac28c94435 New translations language-en.yml (Japanese) (#108) 2023-09-08 11:05:24 +10:00
4acc809dd8 New Crowdin updates (#105)
* New translations language-en.yml (Portuguese)

* New translations language-en.yml (Danish)

* New translations language-en.yml (Korean)

Co-authored-by: JaeWoong Suh <90325840+SuhJae@users.noreply.github.com>
Co-authored-by: Jan CHristensen <skrivtiljan@gmail.com>
2023-08-08 17:04:49 +10:00
Maintenancer 0ff5cd232f Hungarian translation file (thanks to Kende) 2023-06-26 11:46:40 +02:00
Nassim Jahnke d49db3dfbe Add config options for commands on single server maintenance enable/disable 2023-06-15 13:08:28 +02:00
Nassim Jahnke b36adb54fa Update gradle wrapper 2023-06-15 12:30:01 +02:00
Maintenancer 91276ab5f6 New Crowdin updates (#99) 2023-06-15 11:41:00 +02:00
Nassim Jahnke 3dd1d7506a Update dependencies 2023-06-15 11:39:38 +02:00
Nassim Jahnke 00abe8588b Send user-agent to Hangar API 2023-06-15 11:36:28 +02:00
Nassim Jahnke 9fba024e16 Bump version to 4.2.0-SNAPSHOT 2023-06-15 11:34:24 +02:00
Nassim Jahnke fe7a640e3d 4.1.0 Release 2023-04-17 09:57:04 +02:00
Nassim Jahnke 72c9689b6d Update version checker endpoint to Hangar 2023-04-17 09:57:04 +02:00
Nassim Jahnke cfd0dd1be7 Update Gradle wrapper 2023-04-15 11:17:25 +02:00
Maintenancer cfdedfad15 New translations language-en.yml (Japanese) (#98)
Thanks to yu-solt
2023-04-15 11:15:24 +02:00
Nassim Jahnke 32258bc1ef Update Folia class check 2023-03-30 08:45:52 +02:00
Nassim Jahnke c2f297a125 Add preliminary Folia support 2023-03-10 12:53:44 +01:00
Nassim Jahnke 036c225c2c Add enable-playercounthovermessage option, don't disable playercount messages when disabling pingmessages 2023-03-08 15:01:12 +01:00
Nassim Jahnke bc10c6b94c Update Gradle wrapper and shadow 2023-03-08 15:00:25 +01:00
Maintenancer 211dd1e4f2 New Crowdin updates (#95)
* New translations language-en.yml (Spanish)

* New translations language-en.yml (Polish)

* New translations language-en.yml (Russian)
2023-03-08 14:54:39 +01:00
Nassim Jahnke de500d9cd3 Small cleanup 2023-02-25 11:44:13 +01:00
Nassim Jahnke 99d77b2f55 Fix variable replacement with gradients 2023-02-25 10:42:24 +01:00
Nassim Jahnke 2ddafded74 Update Gradle wrapper, dependencies 2023-02-25 10:41:10 +01:00
Nassim Jahnke 876b66392f Update workflow 2023-02-22 16:36:59 +01:00
Maintenancer e59a27d09d New Crowdin updates (#94) 2023-02-07 13:33:40 +01:00
Nassim Jahnke 0c4e9564bd New Crowdin updates (#93) 2023-02-07 13:24:49 +01:00
Nassim Jahnke 9c7f60180b Update README 2023-02-07 13:06:58 +01:00
Nassim Jahnke bbaa53f428 New Crowdin updates (#91) 2023-02-07 12:39:00 +01:00
Nassim Jahnke 9f910d3027 Update Crowdin configuration file 2023-02-07 12:01:13 +01:00
Nassim Jahnke 2c3a324ec9 Remove platform specific aliases 2023-02-07 09:24:48 +01:00
Nassim Jahnke 9ab902b9ce Update download url 2023-01-28 12:06:20 +01:00
Nassim Jahnke 4c5a19fd60 Add Ukrainian translation file (thanks to Mrlucke) 2023-01-01 13:52:19 +01:00
Nassim Jahnke 342cfa4b03 Fix Velocity startup
Closes #87
2022-12-19 17:26:35 +01:00
Nassim Jahnke 6cf9314aaa Thank you gradle, very cool 2022-12-09 11:20:06 +01:00
Nassim Jahnke 967fe77753 Update Gradle wrapper 2022-12-08 10:36:29 +01:00
Nassim Jahnke 6d6ebee2cc Relocate bstats 2022-10-01 13:43:12 +02:00
Nassim Jahnke 0e7bbfd0e2 Fix the message for cancelling proxied server timers not replacing the server argument 2022-10-01 13:41:28 +02:00
Nassim Jahnke 3410f36c10 Update deps, add bstats to Velocity and Sponge modules 2022-09-25 12:18:55 +02:00
Super fe2bfda1b9 Create language-se.yml (#84) 2022-08-30 15:46:49 +02:00
Nassim Jahnke e106aacc47 Add turkish translation file 2022-08-05 09:48:36 +02:00
Nassim Jahnke e7aee8c99f Fix disabling enable-pingmessages not being respected on Paper servers 2022-04-27 16:40:01 +02:00
Nassim Jahnke c84265c1dd Bump version to 4.0.2-SNAPSHOT 2022-04-27 16:39:48 +02:00
original-codematrix 78b08ca164 Switch from assert to Assertions class from JUnit (#77) 2022-04-27 16:06:16 +02:00
Nassim Jahnke 54151515f4 4.0.1 Release 2022-04-16 18:40:34 +02:00
Nassim Jahnke fd1c252594 Update dependencies, actually fix tests 2022-04-15 21:51:29 +02:00
Nassim Jahnke 702349c762 Fix tests 2022-04-15 20:08:13 +02:00
Nassim Jahnke 1f6fb837de Fix config header saving 2022-03-23 09:27:43 +01:00
Nassim Jahnke 0284b80e44 Update workflow 2022-03-23 09:26:53 +01:00
Nassim Jahnke 6f99fe4ce8 Bump version to 4.0.1-SNAPSHOT 2022-03-23 09:20:09 +01:00
Nassim Jahnke 1ac29de1bf Fix Sponge metadata replacement 2022-03-17 10:50:56 +01:00
Nassim Jahnke 2223094461 4.0.0 Release 2022-03-17 10:07:29 +01:00
Nassim Jahnke 6279ae2477 Update adventure, update changelog, fix publishing 2022-03-15 10:44:21 +01:00
Nassim Jahnke 5f90270cc8 Update gradle wrapper to 7.4.1 2022-03-09 18:52:43 +01:00
Nassim Jahnke 885c7249a6 Update language files 2022-03-08 21:47:20 +01:00
Nassim Jahnke ffb8fd5767 Minor cleanup 2022-03-08 19:39:36 +01:00
Nassim Jahnke c3717bc8b1 Update Gradle wrapper to 7.4, adventure to 4.10.0 2022-03-05 12:14:01 +01:00
Nassim Jahnke 665c3816cd Merge remote-tracking branch 'origin/dev' into adventure-support
# Conflicts:
#	maintenance-core/src/main/resources/language-de.yml
2022-02-21 09:21:31 +01:00
Ceddix a586190e1f fixed spelling issue that caused a message not to work (#75) 2022-02-19 09:32:24 +01:00
Nassim Jahnke 820d5138a9 Update default config values 2022-01-19 18:59:21 +01:00
Nassim Jahnke 39f240c1cb Cleanup a bit of language file updating 2022-01-16 19:16:45 +01:00
Nassim Jahnke a8092d430a Fix multiline playercount hover 2022-01-16 16:49:07 +01:00
Nassim Jahnke 8173a69496 Configurable singleServerMaintenanceListEntry, remove LuckPerm context for now 2022-01-16 15:50:29 +01:00
Nassim Jahnke 317afe064a Update language files, update config header 2022-01-16 15:01:04 +01:00
Nassim Jahnke 7d3e6002f1 Update copyright header 2022-01-09 22:31:16 +01:00
Nassim Jahnke 22a75203cf Update Sponge module to API v8 2022-01-09 22:27:56 +01:00
Nassim Jahnke b63ba56f50 Fixup dependencies 2022-01-01 14:58:27 +01:00
Nassim Jahnke e0a20eff46 Improve language updating, add <prefix> placeholder 2021-12-31 16:43:40 +01:00
Nassim Jahnke 77d42f3367 Update workflow 2021-12-28 18:14:43 +01:00
Nassim Jahnke 09f3ad0384 Major version bump
Convert project to Gradle
Change API class names and split module into two
Add adventure component support
2021-12-28 18:03:34 +01:00
Nassim Jahnke 0c2f0cdb96 WIP LuckPerms contexts 2021-12-28 09:40:29 +01:00
Nassim Jahnke 13706a86e5 Update dependencies 2021-12-27 12:12:24 +01:00
Slasherss d121772f3c Add polish translations (#73) 2021-12-22 09:45:42 +01:00
Nassim Jahnke 8b5234b2ad Update language-es.yml (thanks to Jaximo) 2021-12-07 08:59:31 +01:00
Aurélien d659fd173e Remove extra point (#70) 2021-08-19 22:18:25 +02:00
Aurélien 8e44e611d0 Update language-fr.yml (#69) 2021-08-19 22:13:55 +02:00
kennytv 36c2c6183e Update language-pt.yml (thanks to JoaoPinto) 2021-08-18 17:37:25 +02:00
kennytv 06229ab9ae Bump version to 3.0.8-SNAPSHOT, fix missing scheduletimer keys 2021-08-18 12:54:18 +02:00
Nassim Jahnke 9df156703d 3.0.7 Release 2021-08-17 12:58:42 +02:00
kennytv 7ab28b7126 Prepare for 3.0.7 Release 2021-08-17 12:57:36 +02:00
kennytv f4fe7a4aa4 Update copyright header, readme, and license format 2021-08-12 10:43:10 +02:00
kennytv ea6f43f4e0 Remove debug command from help list 2021-08-08 12:54:57 +02:00
kennytv 07304e0ad4 Update workflow and dependencies 2021-08-07 12:37:18 +02:00
kennytv 11bf0287f3 Add helpDump to language files 2021-07-23 10:26:44 +02:00
KennyTV 1bda7aae24 Fix Velocity update message, update depend to 3.0.0-SNAPSHOT 2021-05-27 22:25:58 +02:00
KennyTV a919227b04 Remove that 2021-05-23 14:23:33 +02:00
KennyTV 796f46dd44 Shade mysql connector in Velocity module
Fixes #61
2021-05-22 19:24:38 +02:00
KennyTV 3ebd6e627a Update ProtocolLib Maven repo 2021-05-10 08:48:02 +02:00
KennyTV 53612fe24a Do offline web lookup in whitelist add on proxies 2021-05-08 09:49:23 +02:00
KennyTV cbcbba5678 Update changelog, update sponge repo url 2021-03-06 18:25:01 +01:00
KennyTV 962f7834c6 Have an extra broadcast key for schedule starts
Closes #58
2021-03-06 16:44:58 +01:00
KennyTV f724014efd Add config options to dispatch commands on maintenance toggle 2021-03-06 16:02:09 +01:00
KennyTV 84f39ca478 Fix inverted if condition 2021-02-18 09:15:33 +01:00
KennyTV d06760e83f Add "enable-pingmessages" config option
Closes #57
2021-02-18 09:14:48 +01:00
Aurélien 4e27c5b044 Update language-fr.yml (#56) 2021-02-17 10:48:35 +01:00
KennyTV 8480e1b28b Bump version 3.0.7-SNAPSHOT 2021-02-17 10:47:56 +01:00
KennyTV f56afcf9a7 Update changelog 2021-02-17 10:30:28 +01:00
Nassim de6c56e1ba 3.0.6 Release 2021-02-17 10:25:23 +01:00
KennyTV b37050b317 Prepare for 3.0.6 Release 2021-02-17 10:24:56 +01:00
KennyTV 081a34c51b Actually fire the MaintenanceReloadedEvent 2021-02-07 11:40:41 +01:00
KennyTV ff2ccf0478 Update copyright header 2021-02-07 11:32:00 +01:00
KennyTV 34c6811295 Add "maintenance schedule" command 2021-02-07 11:30:20 +01:00
KennyTV 4b50b67abf Add primitive debug mode (only implemented on Bungee) 2020-12-31 12:59:31 +01:00
KennyTV eee4be4ca0 Hotfix dumps
I will use paste.gg in the future, this is only to make it work at all again
2020-12-31 12:28:24 +01:00
KennyTV f6d5e99a09 Also replace online and max variable in the hover message 2020-11-20 22:38:10 +01:00
KennyTV 29c55e53af Properly register main command with permissions (instead of checking for them in the actual command) 2020-10-26 16:55:37 +01:00
KennyTV ac38cf143b Update Velocity API usage 2020-10-26 16:47:07 +01:00
KennyTV 1bd22f73e5 Update language-es.yml (thanks to Vixo_Ulises) 2020-10-26 16:38:38 +01:00
KennyTV a256a10170 Rename GH build artifact 2020-10-01 09:40:29 +02:00
Nassim 2e6f1b718a Make artifacts work 😎 2020-08-25 14:55:20 +02:00
KennyTV a30b833bfb Upload artifacts 2020-08-25 14:52:15 +02:00
Nassim 4701803045 Create maven.yml 2020-08-25 14:14:56 +02:00
KennyTV 76385f3968 Fix NPE in null pings 2020-08-22 09:48:21 +02:00
KennyTV 9283cb25e7 Update Velocity API usage to 1.1.0-SNAPSHOT 🎉 2020-08-21 20:26:39 +02:00
KennyTV 97dbe14127 Add whitelist add arg to manually add offline uuid+name 2020-08-19 09:44:57 +02:00
KennyTV da41f7cfc8 Fix linebreaks on Bungee in playercount hovermessage 2020-07-30 12:04:05 +02:00
KennyTV 69e94ab3e1 Add MaintenanceReloadedEvent, also fire changed event for unregistered proxy servers 2020-07-29 14:17:49 +02:00
dependabot-preview[bot] 4458533372 Bump junit-jupiter-engine from 5.6.1 to 5.6.2
Bumps [junit-jupiter-engine](https://github.com/junit-team/junit5) from 5.6.1 to 5.6.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.6.1...r5.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-27 18:39:05 +02:00
KennyTV ad9251e332 Link to dev branch for Travis builds 2020-07-26 12:15:18 +02:00
KennyTV ffeebfa4aa Add 'mt' command alias, add some braces 2020-07-26 11:08:25 +02:00
KennyTV bc04bf866a Formatting fix in changelog 2020-07-14 12:10:34 +02:00
KennyTV 3a2af01ad2 Missing singleserver kick messages should not throw warnings 2020-06-25 11:28:36 +02:00
KennyTV 27d884ff31 Implement new methods for dummyprofile 2020-06-25 09:12:24 +02:00
KennyTV c69b05501e Add translators to the individual language files 2020-06-21 09:26:59 +02:00
Aurélien 6119cb77a8 Fixes for French translation (#42) 2020-06-21 09:19:16 +02:00
KennyTV 01b0ca9817 Rename method to get server name of player, cleanup config in test 2020-06-18 15:43:39 +02:00
KennyTV 7e188cadaf Version increase to 3.0.6-SNAPSHOT 2020-06-18 15:26:39 +02:00
KennyTV f12d16d686 Sneak a mysql fix in 2020-06-17 14:09:02 +02:00
KennyTV 441f53077b Update API jar to 3.0.5 2020-06-17 11:26:32 +02:00
Nassim cb2b33b9e2 3.0.5 Release 2020-06-17 10:48:13 +02:00
KennyTV f50497b49a Prepare for 3.0.5 release 2020-06-17 10:47:20 +02:00
KennyTV 9fa699d22d Config test additions 2020-06-17 09:31:49 +02:00
KennyTV d94034dc6e Config set cleanup 2020-06-16 17:49:45 +02:00
KennyTV 9b2f44dfaf Use precondition in api getter util 2020-06-16 16:39:23 +02:00
KennyTV a4f0d85cf7 Wrong nullable annotation 2020-06-16 16:20:18 +02:00
KennyTV 4c21049e59 Minor code cleanup to version checking 2020-06-16 16:19:20 +02:00
KennyTV 921aea4623 Update changelog, bump Guava provided version
Not that it matters, but want to get rid of the security alert
2020-06-16 09:51:25 +02:00
KennyTV 465ab57125 Remove config updating from 2.x
See https://github.com/KennyTV/Maintenance/wiki/Updates#updating-from-2x on how to do that manually - virtually noone should be using such old versions anymore
2020-06-10 12:51:25 +02:00
KennyTV 83be201d0f Automatically move files to new dir on updating 2020-06-09 19:25:21 +02:00
KennyTV 251dad766b Update README 2020-06-01 13:21:21 +02:00
KennyTV 880d839b52 Use higher proxy ping listener priority 2020-05-18 22:12:22 +02:00
KennyTV 197f986088 Replace newline variable in language file
Note on why this even exists: Yaml will force save all strings containing line breaks in this rather chunky format:
  key: |-
    First line text
     Second line text.
     ...

This also happens to string lists, making those practically unreadable, as well as confusing for most users in general.
Because of this, I replace %NEWLINE% manually, to spare users from these ugly breaks.
2020-05-15 13:38:41 +02:00
KennyTV 3925baef3c Add option to set multiple fallback servers 2020-05-12 20:52:47 +02:00
KennyTV 143b1f5d80 Add secret language option for server specific kick messages
Closes #38
2020-05-12 20:27:59 +02:00
KennyTV 0461bf4ffc Implement deep get in config 2020-05-12 19:32:42 +02:00
KennyTV 5e0809c448 Remove platform suffix from plugin identifier 2020-04-22 10:59:27 +02:00
KennyTV b4c3fbeb19 Don't hide playercount if custom playercount is disabled 2020-04-21 12:00:23 +02:00
KennyTV 44cedde712 Respect custom playercount setting in Spigot ping 2020-04-21 08:36:28 +02:00
KennyTV ba31683d48 Fix use-ssl option inversion 2020-04-13 09:29:22 +02:00
KennyTV 9780dcdb76 Update copyright headers 2020-04-10 23:42:06 +02:00
KennyTV c3746996a1 Update Russian language file 2020-04-09 08:59:11 +02:00
KennyTV 58f986f0f7 Add placeholder link to readme 2020-04-06 22:34:04 +02:00
KennyTV 0551558b8f Add Italian language file 2020-04-03 12:27:00 +02:00
KennyTV 3808edafca Fix config loading with multiline strings, add small tests
Fixes #37
2020-03-30 12:48:48 +02:00
KennyTV b85c85f4fd Throw around some nullable annotations 2020-03-30 11:02:35 +02:00
KennyTV 3956879fb8 Add Chinese language file 2020-03-17 15:02:47 +01:00
KennyTV 4c8536faeb Version increase to 3.0.5-SNAPSHOT 2020-03-17 11:57:12 +01:00
Nassim ef019df6fa 3.0.4 Release 2020-03-17 11:01:41 +01:00
KennyTV 415833c9b0 Prepare for 3.0.4 release 2020-03-17 11:00:55 +01:00
KennyTV e844df3f26 Rearrange new language entries 2020-03-16 15:49:09 +01:00
KennyTV 2678ab40aa Fix join notifications with waiting servers enabled 2020-03-16 15:48:27 +01:00
KennyTV 360725d4c5 Add waiting-server option for global proxy maintenance
Includes some other, minor fixes
Some proxy modules cleanup
2020-03-16 15:17:09 +01:00
KennyTV 2288d193fd Update missing pt messages (by JoaoPinto) 2020-03-16 11:16:46 +01:00
Max Kade 16f8f15111 Fix single server timer accepting number as seconds and not minutes (#35) 2020-03-11 14:35:56 +01:00
KennyTV 8bec54970b Fix singleserver timers broadcasting globally 2020-02-14 21:40:08 +01:00
KennyTV 607b510bd1 Update bStats metrics 2020-02-12 17:20:37 +01:00
KennyTV 71d174a90c Add option to disable sql ssl 2020-02-09 12:47:28 +01:00
KennyTV 45fb0d1ead Minor beauty changes 2020-01-29 15:11:01 +01:00
KennyTV f7cfb5d813 Forgot the return 2019-11-21 09:46:51 +01:00
KennyTV 24598168bf Add Russian language file (thanks to En_0t_S) 2019-11-21 09:44:23 +01:00
KennyTV 7a5f4e317a Don't throw errors when failing the language update check because of custom langs 2019-11-21 09:41:42 +01:00
KennyTV bb8e6d391f Version increase to 3.0.4-SNAPSHOT 2019-11-21 09:27:32 +01:00
KennyTV 14ce1934f1 Forgot to update the date in the changelog 2019-09-17 09:05:53 +02:00
Nassim a6f362523b 3.0.3 Release 2019-09-17 09:02:27 +02:00
KennyTV 6cbe823c23 Version increase to 3.0.3 2019-09-17 08:29:23 +02:00
KennyTV 5c3a7c3fce Update changelog, fix small oversight in the Bungee serverconnect 2019-09-13 10:30:53 +02:00
KennyTV 74399c49dc Fix playercountmessage on Paper servers with Via 2019-09-09 08:35:53 +02:00
KennyTV 8dd6cd6a1f Remove some old code 2019-08-24 18:55:30 +02:00
KennyTV 25fe2617dc Replace some streams with loops.. because why not
Not really that much of an improvement, but gotta strike those micro optimizations 🤷
2019-08-18 10:18:58 +02:00
KennyTV 6d4ea72e58 Revert "Fix potential config deserialization error"
This reverts commit ac19bac1
2019-08-13 22:33:31 +02:00
KennyTV 29ab1f35f2 Fix potential config deserialization error 2019-08-13 22:21:30 +02:00
KennyTV adfb2a7c86 Minor pom changes 2019-08-13 22:21:11 +02:00
KennyTV 3f434737f8 Fix some redundant config comment checks 2019-07-26 13:20:27 +02:00
KennyTV 097c8b7ce3 Update bStats metrics 2019-07-26 12:29:34 +02:00
KennyTV bfa229edbd Minor config optimizations and cleanup 2019-07-22 09:28:53 +02:00
KennyTV de15485d64 Language autoupdater, fix updating with broken texts 2019-07-21 15:49:10 +02:00
KennyTV b4c81b9359 Add warning with PS 2019-07-20 09:58:00 +02:00
KennyTV ee61f49e63 Add warning with PS 2019-07-20 09:49:00 +02:00
KennyTV 4595c6b00c Switch to ProtocolLib/Spigot ping listener if PS is installed 2019-07-20 09:46:28 +02:00
KennyTV 39b9b0e5a2 Add help page header to language file 2019-06-28 21:43:27 +02:00
Nassim 5c34d4fdee Remove a space in language-es.yml 2019-06-27 10:34:36 +02:00
KennyTV de4a1222e8 Add bypass permission for specific proxied servers 2019-06-27 10:05:57 +02:00
KennyTV 62d1ef6a61 Update changelog 2019-06-09 09:53:04 +02:00
KennyTV c7cf0c073c Update Spanish language (thanks to Vixo_Ulises) 2019-06-09 09:51:04 +02:00
KennyTV 6439684c70 Update French language (thanks to Zendrique) 2019-05-31 21:26:58 +02:00
KennyTV eb7bbb0dad Language changes 2019-05-31 16:26:16 +02:00
KennyTV 4b909dc85a Update travis.yml 2019-05-31 15:45:35 +02:00
KennyTV 66f1eef91f Update travis.yml 2019-05-31 15:38:06 +02:00
KennyTV 7beccd980b I'm a dumbo 2019-05-31 15:31:10 +02:00
KennyTV 13cd8c0348 Add help messages to language files 2019-05-31 15:30:03 +02:00
KennyTV 4408508625 Fix double messages in some server connections 2019-05-24 09:14:51 +02:00
KennyTV 65a3772b3a Kick connecting players before the connection succeeded, fix double join-notification (Bungee) 2019-05-23 22:18:05 +02:00
KennyTV 786dbef1c1 Update config version 2019-05-20 15:28:06 +02:00
KennyTV c7f1b6af2e Add option to not kick online players 2019-05-18 17:23:56 +02:00
KennyTV c81b7b71cc Version increase to 3.0.3-SNAPSHOT 2019-05-18 17:16:37 +02:00
KennyTV 159a95e75b 3.0.2 Release 2019-05-17 09:35:34 +02:00
KennyTV 385846605a 👀 2019-05-17 09:35:14 +02:00
KennyTV 789b16518c Update changelog 2019-05-17 09:31:17 +02:00
KennyTV 2af10d0bca Version increase to 3.0.2 2019-05-17 09:25:57 +02:00
KennyTV 5998db8df3 Finish timerspecific pingmessages 2019-05-17 09:21:35 +02:00
KennyTV 78133f3f00 Update changelog, resort some config entries 2019-05-14 13:48:28 +02:00
KennyTV 10364ef2c9 Timerspecific pingmessages 2019-05-14 09:07:23 +02:00
KennyTV 210e738bec ‍Make setmotd command also set timerspecific messages 2019-05-13 22:53:04 +02:00
KennyTV 67dfb659ce 🤦‍ 2019-05-13 15:30:40 +02:00
KennyTV 1d60f62bcc Make motd command display timerspecific ones 2019-05-13 15:30:00 +02:00
KennyTV fbb0f5c6a2 WIP: Timerspecific pingmessages 2019-05-13 11:02:13 +02:00
KennyTV 6c6d5b870e Make dumps prettier 2019-05-09 22:30:18 +02:00
KennyTV 60ae8a8361 Fix Sponge 8.0.0 compatibility 2019-05-09 21:53:30 +02:00
KennyTV 1d206d4dc7 Update to latest Velocity text api 2019-05-07 09:09:58 +02:00
KennyTV 4bb70ad57a Update README.md 2019-04-27 15:34:07 +02:00
KennyTV 2748d23cbf Fix Velocity autoupdater 2019-04-17 15:38:51 +02:00
KennyTV 282bc50d3e Version increase to 3.0.2-SNAPSHOT 2019-04-17 15:38:33 +02:00
KennyTV 40b6d23dd3 Update api, changelog and readme for latest release 2019-04-17 15:24:51 +02:00
KennyTV d236d26657 Merge pull request #29 from KennyTV/dev
3.0.1 Release
2019-04-17 14:38:55 +02:00
KennyTV ac3b360c42 Version increase to 3.0.1 2019-04-17 14:36:56 +02:00
KennyTV 5eb572dfad Remove interface check 2019-04-17 14:36:47 +02:00
KennyTV f76db64995 Set group id to eu.kennytv.maintenance 2019-04-15 10:54:16 +02:00
KennyTV 37c0e2a024 Fix another potential error on startup 2019-04-14 13:07:01 +02:00
KennyTV 06fa14bae4 Database sync fixes, adjustments to endtimer saving 2019-04-05 14:05:01 +02:00
KennyTV 1550a6c533 Update README 2019-04-05 14:04:45 +02:00
KennyTV 4229be161e Add config updater + endtimer saving after restart 2019-04-03 14:22:06 +02:00
KennyTV 7e7eb62e0a Fix error printing in some cases, close hikari source on disable(/reload) 2019-04-03 11:15:30 +02:00
KennyTV a7896ab1f9 Hackily fix slf4j relocation and shorten jar sizes 2019-03-19 22:35:13 +01:00
KennyTV 3db3f55472 Revert "Only compile SnakeYaml in universal and Velocity file"
This reverts commit b8c0e3a7
2019-03-19 18:07:18 +01:00
KennyTV 817c829bee Only compile SnakeYaml in universal and Velocity file 2019-03-19 18:04:05 +01:00
KennyTV 1f5b008520 Make ServerInfoPacketListener extend PacketAdapter instead of creating anonymous class 2019-03-19 17:04:08 +01:00
KennyTV db1a0ec601 Don't register listener twice 2019-03-13 17:17:31 +01:00
KennyTV 414995a8cd Add Ore url to plugin info 2019-03-13 10:21:29 +01:00
KennyTV a9169367f6 Readd update checking on Sponge, still disallow execution of update 2019-03-13 10:04:16 +01:00
KennyTV ea8bde1fe1 Typo 👀 2019-03-11 13:24:33 +01:00
KennyTV 12512c96a9 Fix Paper pinglistener and remove old code 2019-03-11 13:22:15 +01:00
KennyTV 6ac5614982 Rename dump variable 2019-03-11 13:00:43 +01:00
KennyTV 694e01ce99 Use PaperServerListPingEvent if applicable 2019-03-11 12:48:10 +01:00
KennyTV 77e23811ed Fix exception on ping that does not come from status packet 2019-03-10 19:08:08 +01:00
KennyTV 94fc06283c nooooo 2019-03-08 21:29:28 +01:00
KennyTV d9ed72b472 Try to please the beautiful people over at Ore (Sponge), attempt no 2 2019-03-08 21:28:35 +01:00
KennyTV f8e88fb4bf Try to please the beautiful people over at Ore (Sponge) 2019-03-08 21:18:21 +01:00
KennyTV e0aa2d392b Make endtimer display format adjustable 2019-03-05 16:55:56 +01:00
KennyTV 1282c93fe4 Remove bStats from Sponge module
(Their beautiful repo is down and I don't really need it on Sponge anyways 🤔)
2019-02-21 17:22:29 +01:00
KennyTV bd4a143a0a Minor maintenance event changes 2019-02-21 16:43:13 +01:00
KennyTV f32efaa68e Some language changes 2019-02-21 15:35:52 +01:00
KennyTV ce82285772 Make createFile method public 2019-02-19 17:30:58 +01:00
KennyTV 1d398287eb Add api method to get a list of maintenance servers 2019-02-19 13:25:13 +01:00
KennyTV ed1f227608 Custom maintenance events 2019-02-19 13:08:38 +01:00
KennyTV 81fb399932 Some language changes 2019-02-19 11:28:24 +01:00
KennyTV db0758e949 Version increase to 3.0.1-SNAPSHOT 2019-02-19 00:16:24 +01:00
KennyTV 3dabc3bc9c Sneak Spanish language in 👀 2019-02-17 10:16:36 +01:00
KennyTV 9f5c2c18c4 3.0 Release 2019-02-17 09:22:12 +01:00
KennyTV 2f4ba89b17 Version increase to 3.0 2019-02-17 09:21:51 +01:00
KennyTV fb93a3dc08 Update README 2019-02-15 11:16:14 +01:00
KennyTV 50dca0cc52 Some last refactoring/fixes 2019-02-14 10:25:52 +01:00
KennyTV c3dbc9d8dd Fix velocity update/dump messages 2019-02-12 19:12:27 +01:00
KennyTV faaf125e13 Merge remote-tracking branch 'origin/v3' into v3 2019-02-12 13:30:12 +01:00
KennyTV ce7e1a5708 Minor refactoring and message changes 2019-02-12 13:30:01 +01:00
KennyTV 3ea42cc786 Merge pull request #25 from PSandro/patch
Patch
2019-02-12 10:06:47 +01:00
Sandro Pischinger eb712ecf83 fix typo "seperator" 2019-02-11 22:32:29 +01:00
Sandro Pischinger 03f33b524c fix typo 'Intervalls' 2019-02-11 21:09:54 +01:00
KennyTV 207b2a10de Some message changes 2019-02-11 15:01:11 +01:00
KennyTV 24ac8deb08 SLP actually has a repo 👀 2019-02-11 10:35:36 +01:00
KennyTV a4583a31ac Fix 2019-02-11 08:50:04 +01:00
KennyTV 71556f841f Rename status perm 2019-02-10 11:55:35 +01:00
KennyTV 6a8c2dc99c Let maintenance servers be removed, even if they don't exist on the proxy 2019-02-10 11:17:07 +01:00
KennyTV b95a83eba2 whoops 2019-02-09 16:12:02 +01:00
KennyTV 66d92c1bba Rename some perms 2019-02-09 15:37:21 +01:00
KennyTV 514a63b80a Use maintenance.dump perm for dumpcommand 2019-02-09 15:21:37 +01:00
KennyTV 283297a51f Update changelog 2019-02-09 15:02:53 +01:00
KennyTV bd411b5d01 Update README 2019-02-09 12:41:45 +01:00
KennyTV bcc8d6e0d8 Fix update messages in Sponge and Velocity 2019-02-08 17:24:52 +01:00
KennyTV f63f1ba95d Update README 2019-02-08 15:09:40 +01:00
KennyTV 558c98a8cd Add beautiful changelog file 2019-02-08 15:03:22 +01:00
KennyTV f011540686 whoops 2019-02-08 11:48:54 +01:00
KennyTV e9c7a13548 Some fixes and changes to subcommand system 2019-02-08 11:46:24 +01:00
KennyTV 789c31445b Make subcommand system to finally have that 💩 readable again
* Though it adds 100kb lolz
2019-02-07 19:02:45 +01:00
KennyTV b4f6fa191f Add option to disable update checks 2019-02-07 13:30:11 +01:00
KennyTV a413c588bf Maybe hopefully get rid of the sl4j problem garbage? 2019-02-07 12:48:43 +01:00
KennyTV 1e58a75b25 Final fixes! (hopefully 👀) 2019-02-07 12:12:06 +01:00
KennyTV 309d127ec5 Config comment change 2019-02-07 11:50:25 +01:00
KennyTV a22a2e5fd6 Move fields from SpigotServers file to config (+ automigration) 2019-02-07 11:43:28 +01:00
KennyTV 0876dac2d2 Fixes! 2019-02-07 11:15:18 +01:00
KennyTV 2df8bfad1d slf4j sad 2019-02-07 10:45:16 +01:00
KennyTV 9d6be94f18 Fixes to fallback handling 2019-02-07 10:37:55 +01:00
KennyTV bf35fd05fc Fix error when connecting to fallbackserver 2019-02-07 10:33:34 +01:00
KennyTV 61339381d2 Fix typo 2019-02-07 10:25:37 +01:00
KennyTV 63f81fa37b Do version check on startup async 2019-02-06 13:55:24 +01:00
KennyTV c22f430f13 Rename MaintenanceModePlugin to MaintenancePlugin 2019-02-04 17:09:04 +01:00
KennyTV 4353fc9f0b Minor change 2019-02-04 15:39:46 +01:00
KennyTV ca95932107 Always check for maintenance.admin perm as well 2019-02-04 15:22:36 +01:00
KennyTV 8c493c596c Add some aliases 2019-02-04 10:04:55 +01:00
KennyTV 8445f021f6 Fix typo 2019-02-03 17:48:37 +01:00
KennyTV b363f7ed37 Fixes, dump changes 2019-02-03 15:06:55 +01:00
KennyTV 389b00e89e Actually, noone likes hastebin 2019-02-03 14:24:44 +01:00
KennyTV a9f17f4861 One might say dumping a database's password isn't nice 🤔 2019-02-03 14:03:43 +01:00
KennyTV 6dc0500cdb Changes to config + small help fix 2019-02-03 13:29:51 +01:00
KennyTV de8370eb4b Auto config migration + fixes 2019-02-02 20:10:49 +01:00
KennyTV 5bcfd7a2a1 Beautiful new config system (💛 PSandro) 2019-02-02 15:18:22 +01:00
KennyTV b9f2203c7c Do update checks async 2019-02-01 13:23:25 +01:00
KennyTV ac5854ec0a Dump command response changes 2019-02-01 11:40:27 +01:00
KennyTV da6987cb53 Fixes + dump command 2019-02-01 11:21:38 +01:00
KennyTV 0022be942a Update issue template 2019-02-01 10:26:20 +01:00
KennyTV 94bc061c72 Merge pull request #24 from KennyTV/issue-template
Update issue templates
2019-02-01 10:24:41 +01:00
KennyTV 84aa4d7c69 Update issue templates 2019-02-01 10:24:05 +01:00
KennyTV 32c0550e5f Delete old issue template 2019-02-01 10:23:09 +01:00
KennyTV 17c6548dd2 Merge pull request #23 from PSandro/patch-1
fix typo
2019-02-01 10:20:03 +01:00
Sandro 2d2eef848a fix typo 2019-01-31 21:59:43 +01:00
KennyTV c6d86dd427 Minor change 2019-01-31 20:27:55 +01:00
KennyTV ecd8e3aa8a Whoops 2019-01-31 10:43:53 +01:00
KennyTV 7a6f1e981f Minor refactoring 2019-01-31 10:42:37 +01:00
KennyTV 85050fe395 Minor refactoring 2019-01-31 10:36:55 +01:00
KennyTV 24db266358 Load maintenance-icon from plugin folder, not server directory
Some minor refactoring
2019-01-30 15:12:51 +01:00
KennyTV 3563ff0f2d Fix database value loading 2019-01-30 14:23:46 +01:00
KennyTV a18e7cfc20 Velocity should be done (theoretically 🤔) 2019-01-29 10:33:42 +01:00
KennyTV f91b8a9982 Fixes to Velocity and Sponge 2019-01-28 22:13:47 +01:00
KennyTV c6c2fc0ffc Update README 2019-01-28 20:30:20 +01:00
KennyTV 01cc4a629d Merge remote-tracking branch 'origin/v3' into v3 2019-01-28 20:24:59 +01:00
KennyTV b5cb619399 Update API jar 2019-01-28 20:24:41 +01:00
KennyTV dd55cb3def Merge pull request #22 from PSandro/fix-script
Fix script
2019-01-28 18:15:17 +01:00
KennyTV 3516d143b8 Update README 2019-01-28 18:11:01 +01:00
Sandro 73c1790e79 run install script with skip-input arg on travis 2019-01-28 18:03:36 +01:00
Sandro 401879cdfe add skip-input arg 2019-01-28 18:03:36 +01:00
KennyTV f610a5e2e9 Update README 2019-01-28 17:59:28 +01:00
KennyTV 6fd0cd0803 Update README 2019-01-28 17:52:42 +01:00
KennyTV 188007d6e1 travis integration 2019-01-28 16:27:41 +01:00
KennyTV 9019b75248 Travis very sad :(( 2019-01-28 16:18:31 +01:00
KennyTV 71976a9216 Travis sad :( 2019-01-28 16:15:24 +01:00
KennyTV f03d420e31 Test Travis integration 2019-01-28 16:12:32 +01:00
KennyTV 41a49d1071 Some refactoring 2019-01-28 15:35:42 +01:00
KennyTV 331298a22c Add Maintenance-API.jar to ignored 2019-01-28 14:29:36 +01:00
KennyTV db7d9cc979 Actually get offline Sponge user 2019-01-26 20:59:40 +01:00
KennyTV b8a8388573 Listen to global reload event 2019-01-26 13:29:26 +01:00
KennyTV 62f6e9ba7c Merge branch 'master' of https://github.com/KennyTV/Maintenance into v3 2019-01-26 12:45:38 +01:00
KennyTV e24887ba45 Fix colors in messages in Sponge 2019-01-26 12:37:54 +01:00
KennyTV 7d70e27472 Merge branch dev into master 2019-01-26 11:16:12 +01:00
KennyTV 3d57a979f5 Velocity startup fix 2019-01-25 15:39:08 +01:00
KennyTV 3eb02d6964 Final touches to Sponge 2019-01-25 15:16:52 +01:00
KennyTV 3c5bde4a07 Properly do the uuid remove thingy 2019-01-25 13:44:56 +01:00
KennyTV c93fd06898 Command to remove whitelisted players via their uuid... except on Bungee ;( 2019-01-25 13:15:00 +01:00
KennyTV 2ae384daa5 Velocity command 2019-01-25 12:35:54 +01:00
KennyTV f2e6c9669c Start velocity
Some refactoring and minor improvements
2019-01-24 21:05:42 +01:00
KennyTV 7267e3e6a0 Use proper id when getting api instance 2019-01-23 17:10:29 +01:00
KennyTV ac7fdf5bc3 Single jars now work on their own as well
Minor cleanup
2019-01-23 16:18:59 +01:00
KennyTV 94837b3259 Create CONTRIBUTING.md
Create CONTRIBUTING.md
2019-01-23 10:50:41 +01:00
KennyTV 1244be40e1 Create CONTRIBUTING.md 2019-01-22 22:46:57 +01:00
KennyTV 284d56853c That was a space 2019-01-22 22:32:21 +01:00
KennyTV 5368b1778a Remove licence notice 2019-01-22 22:31:43 +01:00
KennyTV 597dbfeb64 It works! 2019-01-22 18:07:58 +01:00
KennyTV dc6e26ca7c Add copyright notice for funzees 2019-01-22 13:52:14 +01:00
KennyTV 9aad734635 Use YamlConfig (of Bungee) in every module
Fix tabcompletion on Bungee
Even if set to 0, make database calls 'only' every 500 milliseconds

Note that the configuration stuff might completely change again
2019-01-22 13:48:06 +01:00
KennyTV de4c520045 Small message change + merge dev 2019-01-21 14:54:46 +01:00
KennyTV 377f754b88 Merge branch 'dev' of https://github.com/KennyTV/Maintenance into 3.0 2019-01-21 14:51:17 +01:00
KennyTV 934fedf39a Fix NPE 2019-01-21 14:46:31 +01:00
KennyTV be133208a2 Don't create a random UUIDs on each ping (to test) 2019-01-21 14:36:24 +01:00
KennyTV b2c47c9c91 Tabcompletion 2019-01-18 15:19:26 +01:00
KennyTV b31c630c1b Add a small but nice warning 2019-01-17 12:04:55 +01:00
KennyTV 0797335934 Remove slp reference from main class 2019-01-15 16:17:55 +01:00
KennyTV 6d075c2a9a nevermind still dumb i guess i think maybe 2019-01-14 18:23:11 +01:00
KennyTV ef6109c206 Scheduler fix 2019-01-14 15:25:51 +01:00
KennyTV 05bba94e17 Some minor additions/changes 2019-01-14 15:11:54 +01:00
KennyTV e7d667d481 ... because I'm an idiot, obviously 2019-01-14 14:48:47 +01:00
KennyTV e1fc49f955 Small message fix 2019-01-14 14:36:35 +01:00
KennyTV 0d7a01a81b Javadoc 2019-01-14 14:32:07 +01:00
KennyTV 15f8e49ed9 Refactoring and more Sponge stuff 2019-01-14 14:27:26 +01:00
KennyTV 32c6ef23cd Refactoring 2019-01-13 20:05:48 +01:00
KennyTV 0eeb1ecd70 Some ground work for the Sponge part 2019-01-13 15:47:11 +01:00
KennyTV 6c55a22921 Version increase to 3.0-SNAPSHOT 2019-01-13 12:14:07 +01:00
KennyTV 0b3b212a67 Merge remote-tracking branch 'origin/master' into dev 2019-01-13 12:12:53 +01:00
KennyTV 68e729b823 Write plugin name without variable 2019-01-11 15:17:49 +01:00
KennyTV ccc557dc8c Set build name again 2019-01-11 15:14:45 +01:00
KennyTV f260377dcd Improve updater methods 2019-01-11 15:08:11 +01:00
KennyTV ea2ca734a1 Update README 2019-01-11 15:04:32 +01:00
KennyTV 44be0bec3b Merge pull request #17 from PSandro/maven-clean-clean
More maven cleanup
2019-01-09 21:29:14 +01:00
Sandro 4e12762b8f change parent.version to project.parent.version 2019-01-09 21:18:04 +01:00
Sandro 68bd84549d rename directories to fit maven module name 2019-01-09 21:17:15 +01:00
Sandro e57ee84836 remove custom module names 2019-01-09 21:15:48 +01:00
Sandro 7085a6b190 add script -> install ServerListPlus to local repository 2019-01-09 21:15:21 +01:00
KennyTV 9cc5564e23 Some minor refactoring 2019-01-07 20:28:12 +01:00
KennyTV 30f0cae65a Minor change 2019-01-04 11:04:05 +01:00
KennyTV 360e980900 Minor improvement 2018-12-29 21:41:06 +01:00
KennyTV a4bf41bffd Update README 2018-12-28 19:49:07 +01:00
KennyTV f340f5b51b Fix a typo 2018-12-26 12:16:38 +01:00
KennyTV aadf1daf6e Improve isNumeric method 2018-12-21 18:07:30 +01:00
KennyTV 75f27cbd6a Some javadoc changes 2018-12-21 15:00:14 +01:00
KennyTV 8517624bd9 Pom clean up 2018-12-21 14:43:53 +01:00
KennyTV cc0a7205d5 Set api version in plugin.yml 2018-12-19 10:28:51 +01:00
KennyTV 8633b7e2de Version increase to 2.5.3-SNAPSHOT 2018-12-19 10:21:38 +01:00
KennyTV 747757fa5e Language fix 2018-12-17 18:26:07 +01:00
KennyTV d8aac30c3a 2.5.2 Release 2018-12-17 10:10:56 +01:00
KennyTV e8e9419758 Version increase to 2.5.2 2018-12-16 18:16:28 +01:00
KennyTV a3e4fb4198 Small fix, whoopsie? 2018-12-16 18:14:32 +01:00
KennyTV 068ca78259 Added last Portuguese messages 2018-12-16 18:06:23 +01:00
KennyTV bbef35d793 Add Portuguese translations 2018-12-12 10:41:23 +01:00
KennyTV 056a6f91a4 Kick non permitted players when detecting server change from MySQL 2018-12-10 19:33:55 +01:00
KennyTV 84daea05b2 Fix maintenance value with MySQL enabled not loading until the first ping 2018-12-10 19:20:06 +01:00
KennyTV c63a32f44b Make experimental MySQL stuff not so experimental anymore 2018-12-09 10:49:06 +01:00
KennyTV 196abfc5ce Fix maintenance icon for 1.13+ servers 2018-12-08 18:39:40 +01:00
KennyTV ffce4f26f2 Experimental single server database stuff 2018-12-06 17:38:57 +01:00
KennyTV 9c9cd79a20 pom 2018-12-06 11:58:20 +01:00
KennyTV 5790b920b3 pom 2018-12-06 11:57:34 +01:00
KennyTV ad38a56657 Experimental single server database stuff 2018-12-06 11:47:43 +01:00
KennyTV dc03eef9c6 Change config header 2018-12-06 10:37:59 +01:00
KennyTV 266019b6ea Remove some more unnecessary reloads 2018-12-06 10:32:08 +01:00
KennyTV 4c7deca61b Properly fix the last thingy 2018-12-06 10:22:02 +01:00
KennyTV 997366d5e2 Fix 2018-12-05 07:03:26 +01:00
KennyTV 1ed9ad4c9f Don't reload files when toggling maintenance
Update bStats, optimize it a bit... and fix it forgetting some config values, I guess 🤔
2018-12-03 16:58:05 +01:00
KennyTV ccee1db149 Add debug mode 2018-11-25 16:47:58 +01:00
KennyTV 175c608c11 Minor message change 2018-11-25 16:35:09 +01:00
KennyTV ea9a40a297 More french translations, thanks to Spigot user Zendrique 2018-11-23 19:58:17 +01:00
KennyTV 2f1266cdd0 Some tweaks to messages 2018-11-23 18:39:59 +01:00
KennyTV e8672ddaa2 Partially include french translations!
Thanks to Spigot user Zendrique
Still relies on 2.4 format, so some messages are missing and unsorted
2018-11-23 13:34:07 +01:00
KennyTV 8cd71508f8 Version increase to 2.5.2-SNAPSHOT 2018-11-20 15:56:35 +01:00
KennyTV f9fafdd642 Hotfix 2.5.1 2018-11-17 16:57:11 +01:00
KennyTV 1c21dcaddd File loading fix 2018-11-17 16:55:17 +01:00
KennyTV 8174154394 2.5 Release 2018-11-17 11:46:04 +01:00
KennyTV ac1213336c 2.5 API 2018-11-17 11:44:28 +01:00
KennyTV c7d7c4557b Version increase to 2.5 2018-11-17 11:43:43 +01:00
KennyTV ef7aa73031 Some final fixes and changes 2018-11-17 11:41:51 +01:00
KennyTV 1a60a76fd5 Check for other kick reasons 2018-11-16 22:23:58 +01:00
KennyTV c421b96e3b Message changes 2018-11-16 22:08:35 +01:00
KennyTV 1362bfcecb API change 2018-11-10 22:08:29 +01:00
KennyTV fcde435d90 Make the help message a little fancier 2018-11-10 17:38:41 +01:00
KennyTV 2570fc90e7 Some more fixes 2018-11-10 16:50:10 +01:00
KennyTV a6eed677ce Maintenance status command + some more minor changes 2018-11-10 15:08:32 +01:00
KennyTV 3d8378bcd7 Some fixes and changes 2018-11-09 23:20:34 +01:00
KennyTV e1ae515d23 Command 2018-11-09 21:14:32 +01:00
KennyTV eed4f0e1dd pom changes 2018-11-07 21:36:29 +01:00
KennyTV 34d8e055de Timer commands for single server maintenance 2018-11-07 21:32:08 +01:00
KennyTV bc91301c11 API changes 2018-11-07 21:31:49 +01:00
KennyTV e60994eb92 Timers for single server maintenance
Todo: Implementation in command
2018-11-07 20:02:59 +01:00
KennyTV cf61a8a6e1 Some improvements to messages and message handling 2018-11-06 11:01:04 +01:00
KennyTV c7e981fc25 Improve version check handling 2018-11-05 23:02:46 +01:00
KennyTV 76d0f88dbd Improve version check handling 2018-11-05 22:58:12 +01:00
KennyTV d789fcaf61 Further single server maintenance stuff 2018-11-05 21:24:56 +01:00
KennyTV 8b1450a334 Dont save and get Spigot maintenance servers from sql for now 2018-11-04 14:43:47 +01:00
KennyTV beb782b50a Some message changes 2018-10-19 14:21:21 +02:00
KennyTV b20d72860e Some single server maintenance stuff I did during a course at university ¯\_(ツ)_/¯ 2018-10-19 12:08:37 +02:00
KennyTV 82a5c04477 WIP: Add possibility to set single servers to maintenance 2018-10-12 23:17:46 +02:00
KennyTV cfe6396267 Restructured language files 2018-10-02 12:15:08 +02:00
KennyTV 0ae9c0ec13 WIP: Add possibility to set single servers to maintenance 2018-10-02 11:56:30 +02:00
KennyTV 8787f7277a Remove more or less deprecated Guava usages 2018-09-30 11:29:48 +02:00
KennyTV 105a7ddd56 Add multiple language support 2018-09-28 13:22:55 +02:00
KennyTV 436ae975c8 Version increase to 2.5-SNAPSHOT
Increase from 2.4.1-SNAPSHOT as bigger feature updates are planned
2018-09-28 12:42:06 +02:00
KennyTV 12c82f03c5 Add language-de 2018-09-28 12:00:40 +02:00
KennyTV 514fd6da1f Make SenderInfo an interface instead of an abstract class 2018-09-27 10:14:29 +02:00
KennyTV c10dc68a1c Fix starttimer command not working
Remove slf4j shade for now
2018-09-27 09:57:56 +02:00
KennyTV 076c8970b6 Shade slf4j to fix compatibility with plugins using older Hikari dependencies 2018-09-26 11:11:56 +02:00
KennyTV 23ef2c7879 Version increase to 2.4.1-SNAPSHOT
Update ProtocolLib dependency to newest release
2018-09-22 19:20:55 +02:00
KennyTV 654c5feed2 2.4 Release 2018-09-17 10:21:17 +02:00
KennyTV d426d03eb2 2.4 Release API 2018-09-17 10:17:44 +02:00
KennyTV ded6b69ebf Prepare for 2.4 Release 2018-09-17 10:16:23 +02:00
KennyTV 393c25ce77 Some final fixes and changes
Move kickmessage back to config
2018-09-16 22:36:12 +02:00
KennyTV 5a7bfc2921 Update dependencies 2018-09-13 10:43:09 +02:00
KennyTV 9fa317a662 Fix raw color saving in config when upgrading from a version lower than 2.3 2018-09-08 12:29:10 +02:00
KennyTV 3fa20a2c69 Spigot Runnable fix 2018-09-08 12:13:47 +02:00
KennyTV f1f48fcfdb Fix Bungee config not updating 2018-09-08 12:00:21 +02:00
KennyTV 64a25bc980 Add timer variable for the pingmessage
Have broadcasts for timers be set for seconds instead of just minutes + better formatting
Some language fixes
2018-09-07 22:52:20 +02:00
KennyTV c66be61fd2 WIP: Add timer variable for the pingmessage
WIP: Have broadcasts for timers be set for seconds instead of just minutes + better formatting
2018-08-29 00:42:00 +02:00
KennyTV b067ec1d36 Language fixes and changes 2018-08-26 17:56:31 +02:00
KennyTV cea6207662 Switch messages to language file + small fixes 2018-08-26 12:34:28 +02:00
KennyTV b4da98a9a6 Change javadoc message to read the new config field 2018-08-26 11:50:08 +02:00
KennyTV 7467ae9f5f Switch some more messages to language file 2018-08-26 11:49:13 +02:00
KennyTV 1d9313a2c1 Switch some messages to language file 2018-08-25 12:37:23 +02:00
KennyTV 7c58dbd96e Prepare new language file 2018-08-25 12:19:01 +02:00
KennyTV aaaa05ea02 Change helpmessage 2018-08-25 11:41:33 +02:00
KennyTV 76d8076172 Don't enable/disable maintenance mode if it's already in the goal's state 2018-08-25 11:39:49 +02:00
KennyTV 690a89d925 Add possibility to show the default playercount 2018-08-22 20:11:24 +02:00
KennyTV 2cfd53cb89 Relocate HikariCP dependency 2018-08-22 19:08:20 +02:00
KennyTV f1ca524783 Don't spam update notifications on every single join
Also, minor cleanup #3
2018-08-21 21:05:48 +02:00
KennyTV e9f1b723fd Minor cleanup #2 2018-08-21 21:01:12 +02:00
KennyTV 288ab56403 Minor cleanup 2018-08-21 20:58:59 +02:00
KennyTV bc6d1a00db Add variables to show normal playercount 2018-08-21 20:53:15 +02:00
KennyTV 7b7c0bbda6 Whoops 2018-08-17 12:37:49 +02:00
KennyTV ba90b8ad6f Version increase to 2.4-SNAPSHOT 2018-08-17 12:36:08 +02:00
KennyTV a08c0a86a3 2.3.1 Release
Hotfix before the release
2018-08-17 12:30:01 +02:00
KennyTV 57ad385cee Quick hotfix for the 2.3.1 Release
When enabling maintenance on one proxy with MySQL enabled, the other ones will now also kick all non permitted players and switch their ServerListPlus state
2018-08-17 11:29:28 +02:00
KennyTV 9c31d929a2 Minor changes 2018-08-16 19:05:44 +02:00
KennyTV 97f317b396 2.3.1 Release 2018-08-16 17:56:28 +02:00
KennyTV 55da028e56 2.3.1 Release 2018-08-16 17:54:57 +02:00
KennyTV 9fb8bc38b2 Fix 2018-08-15 11:54:35 +02:00
KennyTV ccc686cc10 Only check the mysql delay if it's at least a second 2018-08-15 11:11:25 +02:00
KennyTV 06e53921c0 Fix permission checks for help page 2018-08-11 11:10:25 +02:00
KennyTV 79abdc3841 Fix updated config being overwritten again 2018-08-08 11:56:32 +02:00
KennyTV f8e7bf9d7b Change some javadocs 2018-08-07 23:31:02 +02:00
KennyTV ae9811a198 Return empty string for pingmessages if config list is empty 2018-08-07 23:04:09 +02:00
KennyTV faf4f490bf Remove unnecessary (second) result closing 2018-08-07 22:58:06 +02:00
KennyTV 8d9e595082 Remove unused method 2018-08-07 22:49:22 +02:00
KennyTV 8544c0b95b Replace deprecated ProtocolLib packet 2018-08-07 14:55:19 +02:00
KennyTV bf5dfb3c1a Some pom changes 2018-08-07 13:51:59 +02:00
KennyTV 749787b9ff Only show the commands you have the permission to execute in the helppage 2018-08-06 21:12:36 +02:00
KennyTV 630ef694db Fix config updating unnecessary value in Spigot version 2018-07-27 12:34:09 +02:00
KennyTV 793d763e25 Minor improvement 2018-07-27 12:28:07 +02:00
KennyTV cafe25101a Minor improvement 2018-07-27 11:50:19 +02:00
KennyTV 4e99bef678 Move license and whitelistedplayers file to core module 2018-07-25 00:29:06 +02:00
KennyTV d29c41e805 Fix MySQL millisecondsToCheck variable 2018-07-24 22:29:03 +02:00
KennyTV bbd8b131e8 Only make a request to the database at least x seconds after the last one 2018-07-23 11:52:30 +02:00
KennyTV f3d5c4b66b Add warning and backup string if config value is null 2018-07-23 11:10:16 +02:00
KennyTV ef60dad626 Add warning and backup string if config value is null 2018-07-23 11:09:08 +02:00
KennyTV 98537ac168 Updated BungeeCord dependency to 1.13-SNAPSHOT 2018-07-21 11:02:55 +02:00
KennyTV 91d3e9756a Version increase to 2.3.1-SNAPSHOT 2018-07-18 15:50:35 +02:00
KennyTV 98e62a0576 2.3 Release 2018-07-17 11:45:43 +02:00
KennyTV 3a6860109b Version increase for the 2.3 Release 2018-07-17 11:41:03 +02:00
KennyTV 6180a5123c Minor cleanup 2018-07-16 21:52:27 +02:00
KennyTV 476b753baa The whitelist command now also shows the UUID of the player 2018-07-16 20:25:05 +02:00
KennyTV 32b9ab48c3 Changed help message order 2018-07-16 18:04:14 +02:00
KennyTV 7788ca6e5e Fixed wrong command descriptions 2018-07-16 13:22:46 +02:00
KennyTV 988213c981 Uncommented new help messages 2018-07-16 13:07:59 +02:00
KennyTV a0c8dbdc22 Added missing motd command permission 2018-07-14 22:27:20 +02:00
KennyTV 65e0202312 Added motdlist command 2018-07-09 16:33:51 +02:00
KennyTV 1a47dd7c17 Reworked setmotd command 2018-07-09 15:49:54 +02:00
KennyTV 2117147d76 Removed setmotd command 2018-07-08 11:29:20 +02:00
KennyTV 7cfd8d4412 Config fix 2018-07-08 11:25:47 +02:00
KennyTV 3bd96e02ad Version increase to 2.3-SNAPSHOT 2018-07-08 11:20:18 +02:00
KennyTV d6a572b27c Added multiple pingmessages + minor improvements 2018-07-08 10:54:51 +02:00
KennyTV 90f241b7fd Minor code change 2018-06-18 11:17:47 +02:00
KennyTV f45b75f07a Minor improvement 2018-06-18 11:17:06 +02:00
KennyTV 3d771d4b20 Fixed a problem with the setmotd command 2018-06-17 20:57:50 +02:00
KennyTV 11ff1c6774 Fixed a typo 2018-06-17 20:27:01 +02:00
KennyTV abdbec1134 Removed unused method 2018-06-17 19:58:21 +02:00
KennyTV e1b4be58ab Small logic change 2018-06-17 18:51:35 +02:00
KennyTV 9c80954773 Added permission per subcommand 2018-06-17 18:40:47 +02:00
KennyTV 17a911d50b Message change 2018-06-17 18:29:58 +02:00
KennyTV df62ebdad4 Version increase to 2.2.3-SNAPSHOT 2018-06-17 18:06:59 +02:00
KennyTV 5014abc21c Removed Spigot dependency from Core module 2018-06-17 14:36:18 +02:00
KennyTV 01f856c3aa 2.2.2 Release 2018-06-17 11:24:35 +02:00
KennyTV 57a8aafbf4 2.2.2 Release 2018-06-17 11:22:43 +02:00
KennyTV 53ef1def47 2.2.2 Release 2018-06-17 11:21:10 +02:00
KennyTV 5288bd2aec Maintenance icon fix and reload command message change 2018-06-14 12:35:10 +02:00
KennyTV 1ea04e84b3 Made the loading of the maintenance icon more structured 2018-06-14 12:10:33 +02:00
KennyTV 74bff29a05 Api fix 2018-06-10 10:44:42 +02:00
KennyTV d73a84a764 Removed old config comment 2018-06-09 11:26:58 +02:00
KennyTV 7048e775ef Version increase to 2.2.2-SNAPSHOT
Some minor pom changes
2018-06-09 10:14:21 +02:00
KennyTV 482ba146dc Merge remote-tracking branch 'origin/master' 2018-04-23 11:39:04 +02:00
KennyTV f02582705f Some javadoc and comment changes 2018-04-23 11:38:51 +02:00
KennyTV ea132630c6 2.2.1 release 2018-04-17 04:46:22 +02:00
KennyTV 058342222a Project/pom changes 2018-04-16 20:54:21 +02:00
KennyTV 032d94a7c5 Updated API 2018-04-16 19:50:50 +02:00
KennyTV 182da9da14 Comment line change 2018-04-16 16:35:13 +02:00
KennyTV 59cc67b73d MySQL change 2018-04-16 15:31:50 +02:00
KennyTV 21b74a06f4 MySQL fix 2018-04-16 14:39:40 +02:00
KennyTV 5a03398bec More cleanup 2018-04-16 14:18:19 +02:00
KennyTV fcd2757868 Fixed doc typo 2018-04-15 15:07:19 +02:00
KennyTV fdaa62c569 Various stuff 2018-04-15 13:53:42 +02:00
KennyTV f092a1ecc7 Setmotd fixes 2018-04-15 13:38:21 +02:00
KennyTV 40a9b0d0ee Setmotd fixes 2018-04-15 13:37:07 +02:00
KennyTV cf504c036b Added setmotd command 2018-04-15 13:17:58 +02:00
KennyTV 016f533a29 Create ISSUE_TEMPLATE.md 2018-04-14 19:09:34 +02:00
KennyTV d7ebcdbd77 Added import 2018-04-14 18:46:24 +02:00
KennyTV 710d152bb3 MySQL improvements 2018-04-14 12:25:57 +02:00
KennyTV 016ce19b3c Fixes 2018-04-14 12:06:29 +02:00
KennyTV c7dd702849 Small ServerListPlus integration and command fix 2018-04-14 12:00:46 +02:00
KennyTV 99ada94f32 Fixes 2018-04-13 23:28:15 +02:00
KennyTV 108d20098f Code cleanup 2018-04-13 22:56:41 +02:00
KennyTV e960471ee3 Automatically create sql table if non existing 2018-04-13 20:12:32 +02:00
KennyTV 68a9f3ebfc Moved resources 2018-04-13 19:26:45 +02:00
KennyTV 6cd3088da4 Added license and bumped version to 2.2.1-SNAPSHOT 2018-04-13 19:24:16 +02:00
KennyTV 069f40f2ca Updated README 2018-04-05 23:50:36 +02:00
KennyTV 246aaf4b26 Removed first commit errors 2018-04-05 23:45:39 +02:00
KennyTV ff73fb0e08 Code commit 2018-04-05 23:43:25 +02:00
KennyTV c7fe3e2c0e Update README.md 2018-03-17 11:43:36 +01:00
KennyTV 4578cd9695 Update README.md 2018-03-17 10:30:46 +01:00
KennyTV 595f9a0e69 Update README.md 2018-03-06 21:53:08 +01:00
KennyTV ee7662f96b Update README.md 2018-03-06 21:52:14 +01:00
KennyTV 93eeba64c0 Add files via upload 2018-03-06 21:39:49 +01:00
KennyTV 975ae49594 Create README.md 2018-03-06 21:39:02 +01:00
KennyTV 58562fdb53 Init 2018-02-16 18:39:21 +01:00
164 changed files with 2275 additions and 2163 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
+37 -1
View File
@@ -1,6 +1,42 @@
# Maintenance Changelog
This file contains update logs for this project. The top may contain a `Unreleased` section, gathering update logs for a future update during development.
---
## 4.3.0 - September 17th 2024
### Changed
* Added alternative player count and player list hover message for when endtimers are running, similar to the existing ping messages setting. They are disabled by default and can be found in their `player-count-message` and `player-list-hover-message` config sections
* All timer commands now accept durations like `2h30m`, `1h30m5s`, or `90s`. The default behavior without units will still be in minutes
* The language defaults will *not* automatically update the command help messages
* Slightly reorganized the configuration file (it will be automatically migrated on startup, but new sections will be slapped at the bottom of the file)
* The `fallback` field now also accepts null values next to an empty array for disabling the feature
* Updated language files from [Crowdin](https://crowdin.com/translate/maintenance)
### Fixed
* Fixed the `/maintenance dump` command
* Fixed the original player sample not being cleared in Velocity
* Velocity: Fixed the console getting broadcasts twice
* Velocity: Don't log legacy color codes to the console
* Paper: Fixed the player count messages on Paper 1.21
---
## 4.2.1 - May 17th 2024
### Changed
* The proxied maintenance status is now also shown for forced hosts (thanks to alec-jensen)
* Offline player fetching improvements (thanks to EpicPlayerA10)
* Added the setting `fallback-to-offline-uuid` to use offline player uuids in maintenance whitelist commands (defaults to false)
* Maintenance now skips the plugin remapping process on 1.20.5+ Paper servers
* Small optimizations
* Updated language files from [Crowdin](https://crowdin.com/translate/maintenance)
* Massive thank you to all the contributors! These include: vortix22, xdalul, CodeZhangBorui, jesusskye, Doc94,
Texider_, marvin2k0, leonard.bausenwein, pro.timeo.kerjean, meviper, troev5, Murka124, jhqwqmc, Pryzinho,
raysetratyboy, Kolja07, and rikunightcore
---
## 4.2.0 - September 17th 2023
### Changed
* Velocity/Bungee: Added `commands-on-single-maintenance-enable` and `commands-on-single-maintenance-disable` config options to define commands to be executed after maintenance has been toggled on a proxied server
* Commands inside the `all` list will be executed for any proxied server, but you can also define commands for specific servers by adding arrays with the server names as keys
* You can use the placeholder `%SERVER%` in commands to be replaced with the server name
* Start-, end-, and schedule timers for proxied servers now also include the server in the feedback message
* Updated language files from [Crowdin](https://crowdin.com/translate/maintenance) (including new language files for Danish, Japanese, Korean, and Hungarian)
---
## 4.1.0 - April 17th 2023
### Changed
@@ -83,7 +119,7 @@ This file contains update logs for this project. The top may contain a `Unreleas
* Bungee/Velocity: Added language fields to choose custom kickmessages for individual proxied servers
* See [**HERE**](https://github.com/KennyTV/Maintenance/wiki/Configuration#language-file) for an example setting
* Added Chinese language file (thanks to Spigot user yeban)
* Added Italian language file (thanks to @TheViperShow)
* Added Italian language file
* Updated Russian language file (thanks to Spigot user En_0t_S)
* Removed automated config migration from 2.x->3.0
* See [**HERE**](https://github.com/KennyTV/Maintenance/wiki/Updates#updating-from-2x) on how to do that manually - virtually noone should be using such old versions anymore
+1 -1
View File
@@ -8,7 +8,7 @@ about: Report a bug to have it fixed
**How does the problem occur/what are the steps to reproduce it?**
## Error
**Is there an error? Save it via https://pastebin.com/ and link paste the link.**
**Is there an error? Save it via https://mclo.gs/ and link paste the link.**
## Server information
**Type '/maintenance dump' and paste the given link here**
+6 -6
View File
@@ -7,20 +7,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew build
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Maintenance Files
path: build/libs
+1
View File
@@ -2,6 +2,7 @@
build/
.gradle
bin/
run/
tmp/
*.tmp
*.bak
+1 -1
View File
@@ -4,7 +4,7 @@
[![Crowdin](https://badges.crowdin.net/maintenance/localized.svg)](https://crowdin.com/project/maintenance)
[![Discord](https://img.shields.io/discord/489135856284729384.svg?label=Discord&logo=discord&logoColor=fff)](https://discord.gg/vGCUzHq)
Maintenance is the most customizable free maintenance plugin for your Minecraft server you can find. It runs on Spigot, BungeeCord, Sponge, as well as Velocity.
Maintenance is the most customizable free maintenance plugin for your Minecraft server you can find. It runs on Paper (also Spigot, but with limited functionality), BungeeCord, Sponge, as well as Velocity.
Its features include:
* A custom motd as well as server icon, that will be shown during maintenance
+1 -1
View File
@@ -1,5 +1,5 @@
plugins {
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}
// Shade and relocate adventure in an extra module, so that common/the rest can directly depend on a
@@ -1,5 +1,5 @@
plugins {
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}
tasks {
@@ -1,5 +1,5 @@
plugins {
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}
tasks {
View File
Whitespace-only changes.
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -8,5 +8,5 @@ repositories {
dependencies {
// version must be manually kept in sync with the one in root project settings.gradle.kts
implementation("com.github.johnrengelman", "shadow", "8.1.1")
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.9")
}
+3 -6
View File
@@ -30,14 +30,11 @@ private fun Project.configurePublication(configurer: MavenPublication.() -> Unit
}
fun Project.latestCommitHash(): String {
val byteOut = ByteArrayOutputStream()
exec {
return providers.exec {
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
standardOutput = byteOut
}
return byteOut.toString(Charsets.UTF_8.name()).trim()
}.standardOutput.asBytes.get().toString(Charsets.UTF_8).trim()
}
fun JavaPluginExtension.javaTarget(version: Int) {
toolchain.languageVersion.set(JavaLanguageVersion.of(version))
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
@@ -1,13 +1,16 @@
plugins {
`java-library`
`maven-publish`
signing
}
tasks {
// Variable replacements
processResources {
val ver = project.version.toString()
val desc = project.description
filesMatching(listOf("plugin.yml", "bungee.yml", "META-INF/sponge_plugins.json")) {
expand("version" to project.version, "description" to project.description)
expand("version" to ver, "description" to desc)
}
}
javadoc {
@@ -28,10 +31,43 @@ java {
withSourcesJar()
}
signing {
useGpgCmd()
sign(publishing.publications)
}
publishing {
publications.create<MavenPublication>("mavenJava") {
groupId = rootProject.group as String
artifactId = project.name
version = rootProject.version as String
pom {
name.set("Maintenance")
description.set("Paper plugin to enable maintenance mode on your Minecraft server.")
url.set("https://github.com/kennytv/Maintenance")
licenses {
license {
name.set("GNU GPLv3")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
}
}
developers {
developer {
id.set("kennytv")
name.set("Nassim Jahnke")
}
}
}
}
}
if (!name.startsWith("adventure")) {
repositories.maven {
name = "OSSRH"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}
@@ -4,7 +4,7 @@ import org.gradle.kotlin.dsl.named
plugins {
id("maintenance.base-conventions")
id("com.github.johnrengelman.shadow")
id("com.gradleup.shadow")
}
tasks {
+6 -7
View File
@@ -2,6 +2,7 @@ import org.gradle.api.plugins.JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME
plugins {
base
id("eclipse")
id("maintenance.build-logic")
}
@@ -12,11 +13,10 @@ allprojects {
}
val platforms = setOf(
projects.maintenanceSpigot,
projects.maintenanceBungee,
projects.maintenancePaper,
projects.maintenanceSponge,
projects.maintenanceVelocity
).map { it.dependencyProject }
).map { it.path }
val special = setOf(
projects.maintenance,
@@ -25,11 +25,10 @@ val special = setOf(
projects.adventure,
projects.adventure.adventureApi,
projects.adventure.adventurePlatformBukkit,
projects.adventure.adventurePlatformBungee,
).map { it.dependencyProject }
).map { it.path }
subprojects {
when (this) {
when (path) {
in platforms -> plugins.apply("maintenance.platform-conventions")
in special -> plugins.apply("maintenance.base-conventions")
else -> plugins.apply("maintenance.standard-conventions")
@@ -39,4 +38,4 @@ subprojects {
TEST_IMPLEMENTATION_CONFIGURATION_NAME(rootProject.libs.bundles.junit)
TEST_IMPLEMENTATION_CONFIGURATION_NAME(rootProject.libs.snakeyaml)
}
}
}
-8
View File
@@ -1,8 +0,0 @@
dependencies {
implementation(projects.maintenanceCoreProxy)
implementation(projects.adventure.adventurePlatformBungee) {
targetConfiguration = "shadow"
}
implementation(libs.bstatsBungee)
compileOnly(libs.bungee)
}
@@ -1,47 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee;
import eu.kennytv.maintenance.api.Maintenance;
import eu.kennytv.maintenance.core.MaintenanceBase;
import net.md_5.bungee.api.plugin.Plugin;
import java.io.File;
public final class MaintenanceBungeeBase extends Plugin implements MaintenanceBase {
private MaintenanceBungeePlugin maintenance;
@Override
public void onEnable() {
maintenance = new MaintenanceBungeePlugin(this);
}
@Override
public void onDisable() {
maintenance.disable();
}
@Override
public Maintenance getApi() {
return maintenance;
}
File getPluginFile() {
return getFile();
}
}
@@ -1,299 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.bungee.command.MaintenanceBungeeCommand;
import eu.kennytv.maintenance.bungee.command.MaintenanceBungeeCommandBase;
import eu.kennytv.maintenance.bungee.listener.ProxyPingListener;
import eu.kennytv.maintenance.bungee.listener.ServerConnectListener;
import eu.kennytv.maintenance.bungee.util.BungeeSenderInfo;
import eu.kennytv.maintenance.bungee.util.BungeeServer;
import eu.kennytv.maintenance.bungee.util.BungeeTask;
import eu.kennytv.maintenance.bungee.util.ComponentUtil;
import eu.kennytv.maintenance.core.dump.PluginDump;
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
import eu.kennytv.maintenance.core.proxy.hook.LuckPermsProxyHook;
import eu.kennytv.maintenance.core.proxy.util.ProfileLookup;
import eu.kennytv.maintenance.core.proxy.util.ProxyOfflineSenderInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.core.util.ServerType;
import eu.kennytv.maintenance.core.util.Task;
import eu.kennytv.maintenance.lib.kyori.adventure.platform.bungeecord.BungeeAudiences;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.Favicon;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;
import org.bstats.bungeecord.Metrics;
import org.jetbrains.annotations.Nullable;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.logging.Logger;
import java.util.stream.Collectors;
public final class MaintenanceBungeePlugin extends MaintenanceProxyPlugin {
private final MaintenanceBungeeBase plugin;
private final BungeeAudiences audiences;
private Favicon favicon;
MaintenanceBungeePlugin(final MaintenanceBungeeBase plugin) {
super(plugin.getDescription().getVersion(), ServerType.BUNGEE);
this.plugin = plugin;
this.audiences = BungeeAudiences.create(plugin);
settingsProxy = new SettingsProxy(this);
settings = settingsProxy;
sendEnableMessage();
final PluginManager pm = getProxy().getPluginManager();
pm.registerListener(plugin, new ProxyPingListener(this, settingsProxy));
pm.registerListener(plugin, new ServerConnectListener(this, settingsProxy));
commandManager = new MaintenanceBungeeCommand(this, settingsProxy);
pm.registerCommand(plugin, new MaintenanceBungeeCommandBase(commandManager));
continueLastEndtimer();
new Metrics(plugin, 742);
final Plugin serverListPlus = pm.getPlugin("ServerListPlus");
if (serverListPlus != null) {
serverListPlusHook = new ServerListPlusHook(serverListPlus);
if (settings.isEnablePingMessages()) {
serverListPlusHook.setEnabled(!settingsProxy.isMaintenance());
}
plugin.getLogger().info("Enabled ServerListPlus integration!");
}
if (false && pm.getPlugin("LuckPerms") != null) {
LuckPermsProxyHook.<ProxiedPlayer>register(this, player -> {
final net.md_5.bungee.api.connection.Server server = player.getServer();
return server != null ? server.getInfo().getName() : null;
});
getLogger().info("Registered LuckPerms context");
}
}
@Override
public void sendUpdateNotification(final SenderInfo sender) {
final TextComponent tc1 = new TextComponent(TextComponent.fromLegacyText(getPrefix()));
final TextComponent tc2 = new TextComponent(TextComponent.fromLegacyText("§cDownload it at: §6" + HANGAR_URL));
final TextComponent click = new TextComponent(TextComponent.fromLegacyText(" §7§l§o(CLICK ME)"));
click.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, HANGAR_URL));
click.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(new ComponentBuilder("§aDownload the latest version").create())));
tc1.addExtra(tc2);
tc1.addExtra(click);
((BungeeSenderInfo) sender).sendMessage(tc1);
}
public boolean isMaintenance(final ServerInfo serverInfo) {
return settingsProxy.isMaintenance(serverInfo.getName());
}
@Override
protected void kickPlayersFromProxy() {
for (final ProxiedPlayer player : getProxy().getPlayers()) {
if (!hasPermission(player, "bypass") && !settingsProxy.isWhitelisted(player.getUniqueId())) {
player.disconnect(ComponentUtil.toBadComponents(settingsProxy.getKickMessage()));
}
}
}
@Override
protected void kickPlayers(final Server server, final Server fallback) {
// Kick players from a proxied server
final ServerInfo fallbackServer = fallback != null ? ((BungeeServer) fallback).getServer() : null;
final boolean checkForFallback = fallbackServer != null && !isMaintenance(fallback);
for (final ProxiedPlayer player : ((BungeeServer) server).getServer().getPlayers()) {
if (!hasPermission(player, "bypass") && !settingsProxy.isWhitelisted(player.getUniqueId())) {
if (checkForFallback && fallbackServer.canAccess(player)) {
audiences.player(player).sendMessage(settingsProxy.getMessage("singleMaintenanceActivated", "%SERVER%", server.getName()));
player.connect(fallbackServer);
} else {
player.disconnect(ComponentUtil.toBadComponents(settingsProxy.getFullServerKickMessage(server.getName())));
}
} else {
audiences.player(player).sendMessage(settingsProxy.getMessage("singleMaintenanceActivated", "%SERVER%", server.getName()));
}
}
}
@Override
protected void kickPlayersTo(final Server server) {
// Kick all players to a single waiting server
final ServerInfo serverInfo = ((BungeeServer) server).getServer();
// Notifications done in global method
for (final ProxiedPlayer player : getProxy().getPlayers()) {
if (hasPermission(player, "bypass") || settingsProxy.isWhitelisted(player.getUniqueId())) continue;
if (player.getServer() != null && player.getServer().getInfo().getName().equals(serverInfo.getName()))
continue;
if (serverInfo.canAccess(player) && !isMaintenance(serverInfo)) {
audiences.player(player).sendMessage(settingsProxy.getMessage("sentToWaitingServer", "%SERVER%", server.getName()));
player.connect(serverInfo);
} else {
player.disconnect(ComponentUtil.toBadComponents(settingsProxy.getKickMessage()));
}
}
}
@Override
public Task startMaintenanceRunnable(final Runnable runnable) {
return new BungeeTask(getProxy().getScheduler().schedule(plugin, runnable, 0, 1, TimeUnit.SECONDS).getId());
}
@Override
public void getOfflinePlayer(final String name, final Consumer<@Nullable SenderInfo> consumer) {
final ProxiedPlayer player = getProxy().getPlayer(name);
if (player != null) {
consumer.accept(new BungeeSenderInfo(player));
return;
}
getProxy().getScheduler().runAsync(plugin, () -> {
try {
final ProfileLookup profile = doUUIDLookup(name);
consumer.accept(new ProxyOfflineSenderInfo(profile.getUuid(), profile.getName()));
} catch (final IOException e) {
e.printStackTrace();
consumer.accept(null);
}
});
}
@Override
public void getOfflinePlayer(final UUID uuid, final Consumer<@Nullable SenderInfo> consumer) {
final ProxiedPlayer player = getProxy().getPlayer(uuid);
consumer.accept(player != null ? new BungeeSenderInfo(player) : null);
}
@Override
@Nullable
public Server getServer(final String server) {
final ServerInfo serverInfo = getProxy().getServerInfo(server);
return serverInfo != null ? new BungeeServer(serverInfo) : null;
}
@Override
public Set<String> getServers() {
return getProxy().getServers().keySet();
}
@Override
@Nullable
public String getServerNameOf(final SenderInfo sender) {
final ProxiedPlayer player = getProxy().getPlayer(sender.getUuid());
if (player == null || player.getServer() == null) return null;
return player.getServer().getInfo().getName();
}
@Override
public void async(final Runnable runnable) {
getProxy().getScheduler().runAsync(plugin, runnable);
}
@Override
protected void executeConsoleCommand(final String command) {
getProxy().getPluginManager().dispatchCommand(getProxy().getConsole(), command);
}
@Override
public void broadcast(final Component component) {
audiences.all().sendMessage(component);
}
@Override
public File getDataFolder() {
return plugin.getDataFolder();
}
@Override
public File getPluginFile() {
return plugin.getPluginFile();
}
@Override
protected int getOnlinePlayers() {
return getProxy().getOnlineCount();
}
@Override
protected int getMaxPlayers() {
return getProxy().getConfig().getPlayerLimit();
}
@Override
public InputStream getResource(final String name) {
return plugin.getResourceAsStream(name);
}
@Override
public Logger getLogger() {
return plugin.getLogger();
}
@Override
public String getServerVersion() {
return getProxy().getVersion();
}
@Override
public List<PluginDump> getPlugins() {
return getProxy().getPluginManager().getPlugins().stream().map(plugin ->
new PluginDump(plugin.getDescription().getName(), plugin.getDescription().getVersion(), Arrays.asList(plugin.getDescription().getAuthor()))).collect(Collectors.toList());
}
@Override
protected void loadIcon(final File file) throws IOException {
favicon = Favicon.create(ImageIO.read(file));
}
public boolean hasPermission(final CommandSender sender, final String permission) {
return sender.hasPermission("maintenance." + permission) || sender.hasPermission("maintenance.admin");
}
public ProxyServer getProxy() {
return plugin.getProxy();
}
public Favicon getFavicon() {
return favicon;
}
public BungeeAudiences audiences() {
return audiences;
}
}
@@ -1,82 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.command;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.bungee.util.BungeeSenderInfo;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
import eu.kennytv.maintenance.core.proxy.command.MaintenanceProxyCommand;
import eu.kennytv.maintenance.core.util.SenderInfo;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public final class MaintenanceBungeeCommand extends MaintenanceProxyCommand {
private final MaintenanceBungeePlugin plugin;
public MaintenanceBungeeCommand(final MaintenanceBungeePlugin plugin, final SettingsProxy settings) {
super(plugin, settings);
this.plugin = plugin;
registerCommands();
}
@Override
protected void sendUpdateMessage(final SenderInfo sender) {
final TextComponent tc = new TextComponent("§6× §8[§aUpdate§8]");
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/maintenance forceupdate"));
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§aClick here to update the plugin")));
tc.addExtra(" §8< §7Or use the command §c/maintenance forceupdate");
((BungeeSenderInfo) sender).sendMessage(tc);
}
@Override
public List<String> getServersCompletion(final String s) {
final List<String> list = new ArrayList<>();
for (final Map.Entry<String, ServerInfo> entry : plugin.getProxy().getServers().entrySet()) {
final String serverName = entry.getValue().getName();
if (entry.getKey().toLowerCase().startsWith(s) && !plugin.getSettingsProxy().getMaintenanceServers().contains(serverName)) {
list.add(serverName);
}
}
return list;
}
@Override
public void sendDumpMessage(final SenderInfo sender, final String url) {
final BungeeSenderInfo bungeeSender = ((BungeeSenderInfo) sender);
final TextComponent clickText = new TextComponent(plugin.getPrefix() + "§7Click here to copy the link");
clickText.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, url));
clickText.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§aClick here to copy the link")));
bungeeSender.sendMessage(clickText);
}
@Override
public List<String> getPlayersCompletion() {
final List<String> list = new ArrayList<>();
for (final ProxiedPlayer p : plugin.getProxy().getPlayers()) {
list.add(p.getName());
}
return list;
}
}
@@ -1,48 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.command;
import eu.kennytv.maintenance.bungee.util.BungeeSenderInfo;
import eu.kennytv.maintenance.core.command.MaintenanceCommand;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.TabExecutor;
public final class MaintenanceBungeeCommandBase extends Command implements TabExecutor {
private final MaintenanceCommand command;
public MaintenanceBungeeCommandBase(final MaintenanceCommand command) {
super("maintenance", "maintenance.command", "mt");
this.command = command;
}
@Override
public boolean hasPermission(final CommandSender sender) {
return sender.hasPermission("maintenance.admin") || sender.hasPermission("maintenance.command");
}
@Override
public void execute(final CommandSender sender, final String[] args) {
command.execute(new BungeeSenderInfo(sender), args);
}
@Override
public Iterable<String> onTabComplete(final CommandSender sender, final String[] args) {
return command.getSuggestions(new BungeeSenderInfo(sender), args);
}
}
@@ -1,71 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.listener;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.bungee.util.ComponentUtil;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
public final class ProxyPingListener implements Listener {
private final MaintenanceBungeePlugin plugin;
private final SettingsProxy settings;
public ProxyPingListener(final MaintenanceBungeePlugin plugin, final SettingsProxy settings) {
this.plugin = plugin;
this.settings = settings;
}
@EventHandler(priority = 80)
public void proxyPing(final ProxyPingEvent event) {
if (!settings.isMaintenance()) {
return;
}
final ServerPing ping = event.getResponse();
if (settings.hasCustomPlayerCountMessage()) {
ping.setVersion(new ServerPing.Protocol(settings.getPlayerCountMessage(), 1));
}
if (settings.isEnablePingMessages()) {
ping.setDescriptionComponent(ComponentUtil.toBadComponents(settings.getRandomPingMessage()));
}
if (settings.hasCustomPlayerCountHoverMessage()) {
ServerPing.Players players = ping.getPlayers();
if (players == null) {
players = new ServerPing.Players(0, 0, null);
ping.setPlayers(players);
}
final String[] lines = settings.getPlayerCountHoverLines();
final ServerPing.PlayerInfo[] samplePlayers = new ServerPing.PlayerInfo[lines.length];
for (int i = 0; i < lines.length; i++) {
samplePlayers[i] = new ServerPing.PlayerInfo(lines[i], "");
}
players.setSample(samplePlayers);
}
if (settings.hasCustomIcon() && plugin.getFavicon() != null) {
ping.setFavicon(plugin.getFavicon());
}
}
}
@@ -1,119 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.listener;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.bungee.util.BungeeSenderInfo;
import eu.kennytv.maintenance.bungee.util.BungeeServer;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
import eu.kennytv.maintenance.core.proxy.listener.ProxyJoinListenerBase;
import eu.kennytv.maintenance.core.proxy.util.ServerConnectResult;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority;
public final class ServerConnectListener extends ProxyJoinListenerBase implements Listener {
private final MaintenanceBungeePlugin plugin;
public ServerConnectListener(final MaintenanceBungeePlugin plugin, final SettingsProxy settings) {
super(plugin, settings);
this.plugin = plugin;
}
@EventHandler
public void initialServerConnect(final ServerConnectEvent event) {
// Global maintenance check
if (event.isCancelled() || event.getReason() != ServerConnectEvent.Reason.JOIN_PROXY) return;
final BungeeSenderInfo player = new BungeeSenderInfo(event.getPlayer());
if (plugin.isDebug()) {
plugin.getLogger().info("Join permission check for " + event.getPlayer().getName()
+ " - Permission: " + player.hasMaintenancePermission("bypass") + ", whitelist: " + settings.isWhitelisted(player.getUuid()));
}
if (shouldKick(player)) {
final Server waitingServer = shouldConnectToWaitingServer(player);
if (waitingServer != null) {
event.setTarget(((BungeeServer) waitingServer).getServer());
player.send(settings.getMessage("sentToWaitingServer"));
if (plugin.isDebug()) {
plugin.getLogger().info("Join to waiting server for " + event.getPlayer().getName());
}
return;
}
event.setCancelled(true);
player.disconnect(settings.getKickMessage());
if (settings.isJoinNotifications()) {
broadcastJoinNotification(player.getName());
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void serverConnect(final ServerConnectEvent event) {
// Server specific maintenance check
if (event.isCancelled()) return;
final ProxiedPlayer proxiedPlayer = event.getPlayer();
final boolean normalServerConnect = event.getReason() != ServerConnectEvent.Reason.JOIN_PROXY && event.getReason() != ServerConnectEvent.Reason.KICK_REDIRECT
&& event.getReason() != ServerConnectEvent.Reason.LOBBY_FALLBACK && event.getReason() != ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT;
final BungeeSenderInfo player = new BungeeSenderInfo(proxiedPlayer);
final ServerConnectResult connectResult = serverConnect(player, new BungeeServer(event.getTarget()), normalServerConnect);
if (plugin.isDebug()) {
plugin.getLogger().info("Connectresult for " + player.getName() + " to " + event.getTarget().getName() + ": " + connectResult);
}
if (connectResult.isCancelled()) {
event.setCancelled(true);
// Player has no server to connect to
if (proxiedPlayer.getServer() == null) {
player.disconnect(settings.getKickMessage());
}
} else if (connectResult.getTarget() != null) {
event.setTarget(((BungeeServer) connectResult.getTarget()).getServer());
}
}
@Override
protected void broadcastJoinNotification(final String name) {
sendJoinMessage(ProxyServer.getInstance().getPlayers(), name);
}
@Override
protected void broadcastJoinNotification(final String name, final Server server) {
sendJoinMessage(((BungeeServer) server).getServer().getPlayers(), name);
}
private void sendJoinMessage(final Iterable<ProxiedPlayer> players, final String name) {
final Component component = settings.getMessage("joinNotification", "%PLAYER%", name);
for (final ProxiedPlayer player : players) {
if (plugin.hasPermission(player, "joinnotification")) {
plugin.audiences().player(player).sendMessage(component);
}
}
}
}
@@ -1,85 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.util;
import eu.kennytv.maintenance.api.MaintenanceProvider;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.core.proxy.util.ProxySenderInfo;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.UUID;
public final class BungeeSenderInfo implements ProxySenderInfo {
private final CommandSender sender;
public BungeeSenderInfo(final CommandSender sender) {
this.sender = sender;
}
@Override
public UUID getUuid() {
return sender instanceof ProxiedPlayer ? ((ProxiedPlayer) sender).getUniqueId() : null;
}
@Override
public String getName() {
return sender.getName();
}
@Override
public boolean hasPermission(final String permission) {
return sender.hasPermission(permission);
}
@Override
@Deprecated
public void sendMessage(final String message) {
sender.sendMessage(message);
}
@Override
public void send(final Component component) {
((MaintenanceBungeePlugin) MaintenanceProvider.get()).audiences().sender(sender).sendMessage(component);
}
@Override
public boolean isPlayer() {
return sender instanceof ProxiedPlayer;
}
public void sendMessage(final TextComponent textComponent) {
sender.sendMessage(textComponent);
}
@Override
public boolean canAccess(final Server server) {
return ((BungeeServer) server).getServer().canAccess(sender);
}
@Override
public void disconnect(final Component component) {
if (sender instanceof Connection) {
((Connection) sender).disconnect(ComponentUtil.toBadComponent(component));
}
}
}
@@ -1,59 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.util;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public final class BungeeServer implements Server {
private final ServerInfo server;
public BungeeServer(final ServerInfo server) {
this.server = server;
}
@Override
public String getName() {
return server.getName();
}
@Override
public boolean hasPlayers() {
return !server.getPlayers().isEmpty();
}
@Override
public void broadcast(final Component component) {
final BaseComponent[] components = ComponentUtil.toBadComponent(component);
for (final ProxiedPlayer player : server.getPlayers()) {
player.sendMessage(components);
}
}
@Override
public boolean isRegisteredServer() {
return true;
}
public ServerInfo getServer() {
return server;
}
}
@@ -1,34 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.util;
import eu.kennytv.maintenance.core.util.Task;
import net.md_5.bungee.api.ProxyServer;
public final class BungeeTask implements Task {
private final int id;
public BungeeTask(final int id) {
this.id = id;
}
@Override
public void cancel() {
ProxyServer.getInstance().getScheduler().cancel(id);
}
}
@@ -1,35 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.bungee.util;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import eu.kennytv.maintenance.lib.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer;
public final class ComponentUtil {
public static BaseComponent[] toBadComponent(final Component component) {
return ComponentSerializer.parse(GsonComponentSerializer.gson().serialize(component));
}
public static BaseComponent toBadComponents(final Component component) {
return new TextComponent(ComponentSerializer.parse(GsonComponentSerializer.gson().serialize(component)));
}
}
-7
View File
@@ -1,7 +0,0 @@
name: Maintenance
version: ${version}
main: eu.kennytv.maintenance.bungee.MaintenanceBungeeBase
author: kennytv
description: ${description}
softDepends: [ServerListPlus, LuckPerms]
website: https://hangar.papermc.io/kennytv/Maintenance
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,16 +28,17 @@ import eu.kennytv.maintenance.core.proxy.runnable.SingleMaintenanceRunnable;
import eu.kennytv.maintenance.core.proxy.runnable.SingleMaintenanceScheduleRunnable;
import eu.kennytv.maintenance.core.proxy.util.ProfileLookup;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
import eu.kennytv.maintenance.core.util.RateLimitedException;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.core.util.ServerType;
import eu.kennytv.maintenance.core.util.Task;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -45,7 +46,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.jetbrains.annotations.Blocking;
import org.jetbrains.annotations.Nullable;
/**
* @author kennytv
@@ -83,11 +85,23 @@ public abstract class MaintenanceProxyPlugin extends MaintenancePlugin implement
@Override
public boolean setMaintenanceToServer(final Server server, final boolean maintenance) {
if (maintenance) {
if (!settingsProxy.addMaintenanceServer(server.getName())) return false;
} else {
if (!settingsProxy.removeMaintenanceServer(server.getName())) return false;
if (!settingsProxy.addMaintenanceServer(server.getName())) {
return false;
}
} else if (!settingsProxy.removeMaintenanceServer(server.getName())) {
return false;
}
serverActions(server, maintenance);
for (final String command : (maintenance ? settingsProxy.getCommandsOnMaintenanceEnable(server) : settingsProxy.getCommandsOnMaintenanceDisable(server))) {
try {
executeConsoleCommand(command.replace("%SERVER%", server.getName()));
} catch (final Exception e) {
getLogger().severe("Error while executing extra maintenance " + (maintenance ? "enable" : "disable") + " command: " + command);
e.printStackTrace();
}
}
return true;
}
@@ -131,15 +145,15 @@ public abstract class MaintenanceProxyPlugin extends MaintenancePlugin implement
}
}
public MaintenanceRunnableBase startSingleMaintenanceRunnable(final Server server, final long duration, final TimeUnit unit, final boolean enable) {
final MaintenanceRunnableBase runnable = new SingleMaintenanceRunnable(this, settingsProxy, (int) unit.toSeconds(duration), enable, server);
public MaintenanceRunnableBase startSingleMaintenanceRunnable(final Server server, final Duration duration, final boolean enable) {
final MaintenanceRunnableBase runnable = new SingleMaintenanceRunnable(this, settingsProxy, (int) duration.getSeconds(), enable, server);
serverTasks.put(server.getName(), runnable.getTask());
return runnable;
}
public MaintenanceRunnableBase scheduleSingleMaintenanceRunnable(final Server server, final long duration, final long maintenanceDuration, final TimeUnit unit) {
public MaintenanceRunnableBase scheduleSingleMaintenanceRunnable(final Server server, final Duration enableIn, final Duration maintenanceDuration) {
final MaintenanceRunnableBase runnable = new SingleMaintenanceScheduleRunnable(this, settingsProxy,
(int) unit.toSeconds(duration), (int) unit.toSeconds(maintenanceDuration), server);
(int) enableIn.getSeconds(), (int) maintenanceDuration.getSeconds(), server);
serverTasks.put(server.getName(), runnable.getTask());
return runnable;
}
@@ -175,9 +189,66 @@ public abstract class MaintenanceProxyPlugin extends MaintenancePlugin implement
kickPlayersFromProxy();
}
@Blocking
@Nullable
protected ProfileLookup doUUIDLookup(final String name) throws IOException {
ProfileLookup profileLookup;
try {
profileLookup = doUUIDLookupMojangAPI(name);
} catch (RateLimitedException e) {
// Use fallback API if rate limit is reached
profileLookup = doUUIDLookupAshconAPI(name);
}
if (settingsProxy.isFallbackToOfflineUUID() && profileLookup == null) {
// Use offline uuid
return new ProfileLookup(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8)), name);
}
return profileLookup;
}
/**
* Official Mojang API
*/
@Nullable
private ProfileLookup doUUIDLookupMojangAPI(final String name) throws IOException {
final URL url = new URL("https://api.mojang.com/users/profiles/minecraft/" + name);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int status = connection.getResponseCode();
if (status == 429) {
throw new RateLimitedException();
}
if (status == 404) {
// Return null if profile not found
return null;
}
try (final InputStream in = connection.getInputStream()) {
final String output = CharStreams.toString(new InputStreamReader(in));
final JsonObject json = GSON.fromJson(output, JsonObject.class);
final UUID uuid = fromStringUUIDWithoutDashes(json.getAsJsonPrimitive("id").getAsString());
final String username = json.getAsJsonPrimitive("name").getAsString();
return new ProfileLookup(uuid, username);
}
}
/**
* Fallback API (Ashcon API)
*/
@Nullable
private ProfileLookup doUUIDLookupAshconAPI(final String name) throws IOException {
final URL url = new URL("https://api.ashcon.app/mojang/v2/user/" + name);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if (connection.getResponseCode() == 403) {
// Return null if profile not found
return null;
}
try (final InputStream in = connection.getInputStream()) {
final String output = CharStreams.toString(new InputStreamReader(in));
final JsonObject json = GSON.fromJson(output, JsonObject.class);
@@ -188,6 +259,14 @@ public abstract class MaintenanceProxyPlugin extends MaintenancePlugin implement
}
}
private UUID fromStringUUIDWithoutDashes(String undashedUUID) {
return UUID.fromString(
undashedUUID.substring(0, 8) + "-" + undashedUUID.substring(8, 12) + "-" +
undashedUUID.substring(12, 16) + "-" + undashedUUID.substring(16, 20) + "-" +
undashedUUID.substring(20, 32)
);
}
public SettingsProxy getSettingsProxy() {
return settingsProxy;
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,8 +27,11 @@ import org.jetbrains.annotations.Nullable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
public final class SettingsProxy extends Settings {
@@ -36,7 +39,10 @@ public final class SettingsProxy extends Settings {
private Set<String> maintenanceServers;
private List<String> fallbackServers;
private String waitingServer;
private boolean fallbackToOfflineUUID;
private Map<String, List<String>> commandsOnMaintenanceEnable;
private Map<String, List<String>> commandsOnMaintenanceDisable;
private String mySQLTable;
private String serverTable;
private String maintenanceQuery;
@@ -92,12 +98,25 @@ public final class SettingsProxy extends Settings {
}
final Object fallback = config.getObject("fallback");
fallbackServers = fallback instanceof String ? Collections.singletonList((String) fallback) : config.getStringList("fallback");
fallbackServers = fallback instanceof String ? Collections.singletonList((String) fallback) : config.getStringList("fallback", Collections.emptyList());
waitingServer = config.getString("waiting-server", "");
if (waitingServer.isEmpty() || waitingServer.equalsIgnoreCase("none")) {
waitingServer = null;
}
fallbackToOfflineUUID = config.getBoolean("fallback-to-offline-uuid", false);
commandsOnMaintenanceEnable = new HashMap<>();
final ConfigSection enableCommandsSection = config.getSection("commands-on-single-maintenance-enable");
for (final String key : enableCommandsSection.getKeys()) {
commandsOnMaintenanceEnable.put(key.toLowerCase(Locale.ROOT), enableCommandsSection.getStringList(key));
}
commandsOnMaintenanceDisable = new HashMap<>();
final ConfigSection disableCommandsSection = config.getSection("commands-on-single-maintenance-disable");
for (final String key : disableCommandsSection.getKeys()) {
commandsOnMaintenanceDisable.put(key.toLowerCase(Locale.ROOT), disableCommandsSection.getStringList(key));
}
if (hasMySQL()) {
maintenance = loadMaintenance();
@@ -262,6 +281,28 @@ public final class SettingsProxy extends Settings {
return waitingServer;
}
public boolean isFallbackToOfflineUUID() {
return fallbackToOfflineUUID;
}
public List<String> getCommandsOnMaintenanceEnable(final Server server) {
final List<String> enableCommands = commandsOnMaintenanceEnable.getOrDefault("all", new ArrayList<>());
final List<String> serverEnableCommands = commandsOnMaintenanceEnable.get(server.getName().toLowerCase(Locale.ROOT));
if (serverEnableCommands != null) {
enableCommands.addAll(serverEnableCommands);
}
return enableCommands;
}
public List<String> getCommandsOnMaintenanceDisable(final Server server) {
final List<String> disableCommands = commandsOnMaintenanceDisable.getOrDefault("all", new ArrayList<>());
final List<String> serverDisableCommands = commandsOnMaintenanceDisable.get(server.getName().toLowerCase(Locale.ROOT));
if (serverDisableCommands != null) {
disableCommands.addAll(serverDisableCommands);
}
return disableCommands;
}
@Nullable
MySQL getMySQL() {
return mySQL;
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,10 +22,9 @@ import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.command.ProxyCommandInfo;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
public final class SingleEndtimerCommand extends ProxyCommandInfo {
@@ -42,7 +41,9 @@ public final class SingleEndtimerCommand extends ProxyCommandInfo {
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 2) {
if (checkPermission(sender, "timer")) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[1])) {
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -51,11 +52,13 @@ public final class SingleEndtimerCommand extends ProxyCommandInfo {
return;
}
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), TimeUnit.MINUTES, false);
plugin.startMaintenanceRunnable(duration, false);
sender.send(getMessage("endtimerStarted", "%TIME%", plugin.getRunnable().getTime()));
} else if (args.length == 3) {
if (checkPermission(sender, "singleserver.timer")) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[2], false)) {
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -67,8 +70,12 @@ public final class SingleEndtimerCommand extends ProxyCommandInfo {
return;
}
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), TimeUnit.MINUTES, false);
sender.send(getMessage("endtimerStarted", "%TIME%", runnable.getTime()));
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, duration, false);
sender.send(getMessage(
"singleEndtimerStarted",
"%TIME%", runnable.getTime(),
"%SERVER%", server.getName()
));
} else {
sender.send(getHelpMessage());
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,10 +22,9 @@ import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.command.ProxyCommandInfo;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
public final class SingleScheduleTimerCommand extends ProxyCommandInfo {
@@ -42,8 +41,10 @@ public final class SingleScheduleTimerCommand extends ProxyCommandInfo {
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 3) {
if (checkPermission(sender, "timer")) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[1])
|| plugin.getCommandManager().checkTimerArgs(sender, args[2], false)) {
final Duration enableIn = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
if (enableIn == null || duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -52,12 +53,18 @@ public final class SingleScheduleTimerCommand extends ProxyCommandInfo {
return;
}
plugin.scheduleMaintenanceRunnable(Integer.parseInt(args[1]), Integer.parseInt(args[2]), TimeUnit.MINUTES);
sender.send(getMessage("starttimerStarted", "%TIME%", plugin.getRunnable().getTime()));
plugin.scheduleMaintenanceRunnable(duration, enableIn);
sender.send(getMessage(
"scheduletimerStarted",
"%TIME%", plugin.getRunnable().getTime(),
"%DURATION%", plugin.getFormattedTime((int) duration.getSeconds())
));
} else if (args.length == 4) {
if (checkPermission(sender, "singleserver.timer")) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[2], false)
|| plugin.getCommandManager().checkTimerArgs(sender, args[3], false)) {
final Duration enableIn = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[3], false);
if (enableIn == null || duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -69,8 +76,13 @@ public final class SingleScheduleTimerCommand extends ProxyCommandInfo {
return;
}
final MaintenanceRunnableBase runnable = plugin.scheduleSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), Integer.parseInt(args[3]), TimeUnit.MINUTES);
sender.send(getMessage("starttimerStarted", "%TIME%", runnable.getTime()));
final MaintenanceRunnableBase runnable = plugin.scheduleSingleMaintenanceRunnable(server, enableIn, duration);
sender.send(getMessage(
"singleScheduletimerStarted",
"%TIME%", runnable.getTime(),
"%DURATION%", plugin.getFormattedTime((int) duration.getSeconds()),
"%SERVER%", server.getName()
));
} else {
sender.send(getHelpMessage());
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,10 +22,9 @@ import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.command.ProxyCommandInfo;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
public final class SingleStarttimerCommand extends ProxyCommandInfo {
@@ -42,7 +41,9 @@ public final class SingleStarttimerCommand extends ProxyCommandInfo {
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 2) {
if (checkPermission(sender, "timer")) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[1])) {
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -51,11 +52,13 @@ public final class SingleStarttimerCommand extends ProxyCommandInfo {
return;
}
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), TimeUnit.MINUTES, true);
plugin.startMaintenanceRunnable(duration, true);
sender.send(getMessage("starttimerStarted", "%TIME%", plugin.getRunnable().getTime()));
} else if (args.length == 3) {
if (checkPermission(sender, "singleserver.timer")) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[2], false)) {
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -67,8 +70,12 @@ public final class SingleStarttimerCommand extends ProxyCommandInfo {
return;
}
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), TimeUnit.MINUTES, true);
sender.send(getMessage("starttimerStarted", "%TIME%", runnable.getTime()));
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, duration, true);
sender.send(getMessage(
"singleStarttimerStarted",
"%TIME%", runnable.getTime(),
"%SERVER%", server.getName()
));
} else {
sender.send(getHelpMessage());
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,27 +22,26 @@ import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
public final class SingleMaintenanceScheduleRunnable extends SingleMaintenanceRunnable {
private final int maintenanceDuration;
private final int maintenanceDurationSeconds;
public SingleMaintenanceScheduleRunnable(final MaintenancePlugin plugin, final Settings settings, final int seconds, final int maintenanceDuration, final Server server) {
super(plugin, settings, seconds, true, server);
this.maintenanceDuration = maintenanceDuration;
this.maintenanceDurationSeconds = maintenanceDuration;
}
@Override
protected void finish() {
super.finish();
((MaintenanceProxyPlugin) plugin).startSingleMaintenanceRunnable(server, maintenanceDuration, TimeUnit.SECONDS, false);
((MaintenanceProxyPlugin) plugin).startSingleMaintenanceRunnable(server, Duration.ofSeconds(maintenanceDurationSeconds), false);
}
@Override
protected Component getStartMessage() {
return settings.getMessage("singleScheduletimerBroadcast",
"%SERVER%", server.getName(),
"%TIME%", getTime(), "%DURATION%", plugin.getFormattedTime(maintenanceDuration));
"%TIME%", getTime(), "%DURATION%", plugin.getFormattedTime(maintenanceDurationSeconds));
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -55,11 +55,6 @@ public final class ProxyOfflineSenderInfo implements ProxySenderInfo {
return false;
}
@Override
@Deprecated
public void sendMessage(final String message) {
}
@Override
public void send(final Component component) {
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+10 -3
View File
@@ -1,10 +1,17 @@
plugins {
id("net.kyori.blossom")
id("org.jetbrains.gradle.plugin.idea-ext")
}
blossom {
replaceToken("\$VERSION", project.version)
replaceToken("\$IMPL_VERSION", "git-Maintenance-${project.version}:${rootProject.latestCommitHash()}")
sourceSets {
main {
blossom {
javaSources {
property("version", project.version.toString())
property("impl_version", "git-Maintenance-${project.version}:${rootProject.latestCommitHash()}")
}
}
}
}
dependencies {
@@ -0,0 +1,37 @@
/*
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
* Copyright (C) 2016-2023 ViaVersion and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package eu.kennytv.maintenance.core.util;
public final class MaintenanceVersion {
public static final String VERSION = "{{ version }}";
private static final String IMPLEMENTATION_VERSION = "{{ impl_version }}";
public static String getVersion() {
return VERSION;
}
public static String getImplementationVersion() {
return IMPLEMENTATION_VERSION;
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@ import eu.kennytv.maintenance.core.util.ServerType;
import eu.kennytv.maintenance.core.util.Task;
import eu.kennytv.maintenance.core.util.Version;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import eu.kennytv.maintenance.lib.kyori.adventure.text.format.NamedTextColor;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
@@ -52,25 +53,28 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import org.jetbrains.annotations.Nullable;
public abstract class MaintenancePlugin implements Maintenance {
public static final Gson GSON = new GsonBuilder().create();
public static final String HANGAR_URL = "https://hangar.papermc.io/kennytv/Maintenance";
protected final eu.kennytv.maintenance.core.event.EventManager eventManager;
private static final Pattern INT_PATTERN = Pattern.compile("[0-9]+");
protected final EventManager eventManager;
protected final Version version;
protected Settings settings;
protected ServerListPlusHook serverListPlusHook;
protected MaintenanceRunnable runnable;
protected MaintenanceCommand commandManager;
private final String prefix;
private final Component prefix;
private final ServerType serverType;
private Version newestVersion;
private boolean debug;
@@ -78,7 +82,12 @@ public abstract class MaintenancePlugin implements Maintenance {
protected MaintenancePlugin(final String version, final ServerType serverType) {
this.version = new Version(version);
this.serverType = serverType;
this.prefix = "§8[§eMaintenance" + serverType + "§8] ";
this.prefix = Component.text()
.append(Component.text().content("[").color(NamedTextColor.DARK_GRAY))
.append(Component.text().content("Maintenance").color(NamedTextColor.YELLOW))
.append(Component.text().content("]").color(NamedTextColor.DARK_GRAY))
.append(Component.text(" "))
.build();
this.eventManager = new eu.kennytv.maintenance.core.event.EventManager();
MaintenanceProvider.setMaintenance(this);
}
@@ -97,8 +106,7 @@ public abstract class MaintenancePlugin implements Maintenance {
try {
executeConsoleCommand(command);
} catch (final Exception e) {
getLogger().severe("Error while executing extra maintenance " + (maintenance ? "enable" : "disable") + " command: " + command);
e.printStackTrace();
getLogger().log(Level.SEVERE, "Error while executing extra maintenance " + (maintenance ? "enable" : "disable") + " command: " + command, e);
}
}
}
@@ -166,16 +174,16 @@ public abstract class MaintenancePlugin implements Maintenance {
builder.append(time).append(' ').append(settings.language.getString(time == 1 ? timeUnit : timeUnit + "s"));
}
public void startMaintenanceRunnable(final long duration, final TimeUnit unit, final boolean enable) {
runnable = new MaintenanceRunnable(this, settings, (int) unit.toSeconds(duration), enable);
public void startMaintenanceRunnable(final Duration duration, final boolean enable) {
runnable = new MaintenanceRunnable(this, settings, (int) duration.getSeconds(), enable);
// Save the endtimer to be able to continue it after a server stop
if (settings.isSaveEndtimerOnStop() && !runnable.shouldEnable()) {
settings.setSavedEndtimer(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(runnable.getSecondsLeft()));
}
}
public void scheduleMaintenanceRunnable(final long duration, final int maintenanceDuration, final TimeUnit unit) {
runnable = new MaintenanceScheduleRunnable(this, settings, (int) unit.toSeconds(duration), (int) unit.toSeconds(maintenanceDuration));
public void scheduleMaintenanceRunnable(final Duration enableIn, final Duration maintenanceDuration) {
runnable = new MaintenanceScheduleRunnable(this, settings, (int) enableIn.getSeconds(), (int) maintenanceDuration.getSeconds());
}
public boolean updateAvailable() {
@@ -201,7 +209,7 @@ public abstract class MaintenancePlugin implements Maintenance {
setMaintenance(false);
settings.setSavedEndtimer(0);
} else {
startMaintenanceRunnable(settings.getSavedEndtimer() - current, TimeUnit.MILLISECONDS, false);
startMaintenanceRunnable(Duration.ofMillis(settings.getSavedEndtimer() - current), false);
getLogger().info("The timer has been continued - maintenance will be disabled in: " + getTimerMessage());
}
}
@@ -217,13 +225,12 @@ public abstract class MaintenancePlugin implements Maintenance {
final int compare = version.compareTo(newestVersion);
if (compare < 0) {
//TODO mmmmmmmm legacy chat
getLogger().info("§cNewest version available: §aVersion " + newestVersion + "§c, you're on §a" + version);
getLogger().warning("Newest version available: Version " + newestVersion + ", you're on " + version);
} else if (compare > 0) {
if (version.getTag().equalsIgnoreCase("snapshot")) {
getLogger().info("§cYou're running a development version, please report bugs on the Discord server (https://discord.gg/vGCUzHq) or the GitHub issue tracker (https://github.com/kennytv/Maintenance/issues)");
getLogger().info("You're running a development version, please report bugs on the Discord server (https://discord.gg/vGCUzHq) or the GitHub issue tracker (https://github.com/kennytv/Maintenance/issues)");
} else {
getLogger().info("§cYou're running a version, that doesn't exist! §cN§ai§dc§ee§5!");
getLogger().info("You're running a version, that doesn't exist!");
}
}
});
@@ -266,7 +273,8 @@ public abstract class MaintenancePlugin implements Maintenance {
}
private void checkNewestVersion() throws Exception {
final HttpURLConnection connection = (HttpURLConnection) new URL("https://hangar.papermc.io/api/v1/projects/kennytv/Maintenance/latestrelease").openConnection();
final URLConnection connection = new URL("https://hangar.papermc.io/api/v1/projects/Maintenance/latestrelease").openConnection();
connection.setRequestProperty("User-Agent", "Maintenance/" + getVersion());
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
final String newVersionString = reader.readLine();
final Version newVersion = new Version(newVersionString);
@@ -279,7 +287,7 @@ public abstract class MaintenancePlugin implements Maintenance {
public String pasteDump() {
final MaintenanceDump dump = new MaintenanceDump(this, settings);
try {
final HttpURLConnection connection = (HttpURLConnection) new URL("https://hastebin.com/documents").openConnection();
final HttpURLConnection connection = (HttpURLConnection) new URL("https://api.pastes.dev/post").openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("User-Agent", "Maintenance/" + getVersion());
@@ -290,7 +298,7 @@ public abstract class MaintenancePlugin implements Maintenance {
}
if (connection.getResponseCode() == 503) {
getLogger().warning("Could not paste dump, hastebin.com down?");
getLogger().warning("Could not paste dump, pastes.dev down?");
return null;
}
@@ -305,8 +313,7 @@ public abstract class MaintenancePlugin implements Maintenance {
return jsonOutput.get("key").getAsString();
}
} catch (final IOException e) {
getLogger().log(Level.WARNING, "Could not paste dump :(");
e.printStackTrace();
getLogger().log(Level.WARNING, "Could not paste dump :(", e);
return null;
}
}
@@ -354,7 +361,7 @@ public abstract class MaintenancePlugin implements Maintenance {
}
public boolean isNumeric(final String string) {
return string.matches("[0-9]+");
return INT_PATTERN.matcher(string).matches();
}
@Override
@@ -405,7 +412,7 @@ public abstract class MaintenancePlugin implements Maintenance {
return newestVersion;
}
public String getPrefix() {
public Component prefix() {
return prefix;
}
@@ -435,8 +442,6 @@ public abstract class MaintenancePlugin implements Maintenance {
public abstract void broadcast(Component component);
public abstract void sendUpdateNotification(SenderInfo sender);
public abstract Task startMaintenanceRunnable(Runnable runnable);
/**
@@ -445,9 +450,9 @@ public abstract class MaintenancePlugin implements Maintenance {
*
* @param name name of the player
*/
public abstract void getOfflinePlayer(String name, Consumer<@Nullable SenderInfo> consumer);
public abstract CompletableFuture<@Nullable SenderInfo> getOfflinePlayer(String name);
public abstract void getOfflinePlayer(UUID uuid, Consumer<@Nullable SenderInfo> consumer);
public abstract CompletableFuture<@Nullable SenderInfo> getOfflinePlayer(UUID uuid);
public abstract File getDataFolder();
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,20 +30,21 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import org.jetbrains.annotations.Nullable;
public class Settings implements eu.kennytv.maintenance.api.Settings {
public static final String NEW_LINE_REPLACEMENT = "<br>";
private static final int CONFIG_VERSION = 6;
private static final int LANGUAGE_VERSION = 1;
private static final int CONFIG_VERSION = 9;
private static final int LANGUAGE_VERSION = 2;
private static final Random RANDOM = new Random();
protected final MaintenancePlugin plugin;
private final Map<UUID, String> whitelistedPlayers = new HashMap<>();
@@ -54,8 +55,10 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
private List<String> timerSpecificPingMessages;
private List<String> commandsOnMaintenanceEnable;
private List<String> commandsOnMaintenanceDisable;
private String playerCountMessage;
private List<String> playerCountHoverLines;
private String legacyParsedPlayerCountMessage;
private String legacyParsedTimerPlayerCountMessage;
private List<String> legacyParsedPlayerCountHoverLines;
private List<String> legacyParsedTimerPlayerCountHoverLines;
private String prefixString;
private String languageName;
private boolean enablePingMessages;
@@ -112,8 +115,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
try {
updateLanguageFile();
} catch (final IOException e) {
plugin.getLogger().severe("Couldn't update language file");
e.printStackTrace();
plugin.getLogger().log(Level.SEVERE, "Couldn't update language file", e);
}
prefixString = language.getString("prefix");
@@ -125,7 +127,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
try {
config.save();
} catch (final IOException e) {
e.printStackTrace();
plugin.getLogger().log(Level.SEVERE, "Couldn't save the config file!", e);
}
}
@@ -149,7 +151,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
try {
whitelist.save();
} catch (final IOException e) {
e.printStackTrace();
plugin.getLogger().log(Level.SEVERE, "Couldn't save the whitelisted players file!", e);
}
}
@@ -174,26 +176,49 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
private void loadSettings() {
updateConfig();
enablePingMessages = config.getBoolean("enable-pingmessages", true);
pingMessages = loadPingMessages("pingmessages");
if (config.getBoolean("enable-timerspecific-messages")) {
timerSpecificPingMessages = loadPingMessages("timerspecific-pingmessages");
final ConfigSection pingMessageSection = config.getSection("ping-message");
enablePingMessages = pingMessageSection.getBoolean("enabled", true);
// Can't store this pre-parsed as components because gradients will break replacements
pingMessages = loadPingMessages(pingMessageSection.getStringList("messages"));
if (pingMessageSection.getBoolean("enable-timer-specific-messages")) {
timerSpecificPingMessages = loadPingMessages(pingMessageSection.getStringList("timer-messages"));
} else {
timerSpecificPingMessages = null;
}
maintenance = config.getBoolean("maintenance-enabled");
commandsOnMaintenanceEnable = config.getStringList("commands-on-maintenance-enable");
commandsOnMaintenanceDisable = config.getStringList("commands-on-maintenance-disable");
customPlayerCountMessage = config.getBoolean("enable-playercountmessage");
customPlayerCountHoverMessage = config.getBoolean("enable-playercounthovermessage");
customMaintenanceIcon = config.getBoolean("custom-maintenance-icon");
joinNotifications = config.getBoolean("send-join-notification");
broadcastIntervals = new HashSet<>(config.getIntList("timer-broadcast-for-seconds"));
// Player count and player list hover messages are only accepted and rendered as legacy chat
if (plugin.getServerType() != ServerType.SPONGE) {
playerCountMessage = getConfigMessage("playercountmessage");
final ConfigSection playerCountMessageSection = config.getSection("player-count-message");
customPlayerCountMessage = playerCountMessageSection.getBoolean("enabled");
legacyParsedPlayerCountMessage = toLegacy(parse(getConfigMessage(playerCountMessageSection, "message")));
if (playerCountMessageSection.getBoolean("enable-timer-specific-message")) {
legacyParsedTimerPlayerCountMessage = toLegacy(parse(getConfigMessage(playerCountMessageSection, "timer-message")));
} else {
legacyParsedTimerPlayerCountMessage = null;
}
}
playerCountHoverLines = new ArrayList<>();
final String playerHoverMessage = config.getString("playercounthovermessage");
Collections.addAll(playerCountHoverLines, playerHoverMessage.split("<br>"));
final ConfigSection listHoverMessageSection = config.getSection("player-list-hover-message");
customPlayerCountHoverMessage = listHoverMessageSection.getBoolean("enabled");
legacyParsedPlayerCountHoverLines = new ArrayList<>();
for (final String line : listHoverMessageSection.getString("message").split("<br>")) {
legacyParsedPlayerCountHoverLines.add(toLegacy(parse(line)));
}
if (listHoverMessageSection.getBoolean("enable-timer-specific-message")) {
legacyParsedTimerPlayerCountHoverLines = new ArrayList<>();
for (final String line : listHoverMessageSection.getString("timer-message").split("<br>")) {
legacyParsedTimerPlayerCountHoverLines.add(toLegacy(parse(line)));
}
} else {
legacyParsedTimerPlayerCountHoverLines = null;
}
languageName = config.getString("language").toLowerCase();
kickOnlinePlayers = config.getBoolean("kick-online-players", true);
@@ -211,9 +236,9 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
whitelistedPlayers.clear();
for (final Map.Entry<String, Object> entry : whitelist.getValues().entrySet()) {
try {
whitelistedPlayers.put(UUID.fromString(entry.getKey()), (String) entry.getValue());
} catch (final Exception e) {
plugin.getLogger().warning("invalid WhitelistedPlayers entry: " + entry.getKey());
whitelistedPlayers.put(UUID.fromString(entry.getKey()), String.valueOf(entry.getValue()));
} catch (final IllegalArgumentException e) {
plugin.getLogger().warning("Invalid WhitelistedPlayers entry: " + entry.getKey());
}
}
@@ -224,7 +249,9 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
// All plugin identifiers were changed to 'Maintenance' ('maintenance' for Sponge and Velocity) in 3.0.5
String oldDirName = "Maintenance" + plugin.getServerType();
if (plugin.getServerType() == ServerType.SPONGE || plugin.getServerType() == ServerType.VELOCITY) {
oldDirName = oldDirName.toLowerCase();
oldDirName = oldDirName.toLowerCase(Locale.ROOT);
} else if (plugin.getServerType() == ServerType.SPIGOT) {
oldDirName = "MaintenanceSpigot";
}
final File oldDir = new File(plugin.getDataFolder().getParentFile(), oldDirName);
@@ -236,8 +263,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
Files.move(oldDir.toPath(), plugin.getDataFolder().toPath());
plugin.getLogger().info("Moved old " + oldDirName + " to new " + plugin.getDataFolder().getName() + " directory!");
} catch (final IOException e) {
plugin.getLogger().severe("Error while copying " + oldDirName + " to new " + plugin.getDataFolder().getName() + " directory!");
e.printStackTrace();
plugin.getLogger().log(Level.SEVERE, "Error while copying " + oldDirName + " to new " + plugin.getDataFolder().getName() + " directory!", e);
}
}
@@ -247,11 +273,23 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
plugin.getLogger().info("Updating config to the latest version...");
if (version < 6) {
// Legacy text to MiniMessage
legacyToMinimessage(config.getStringList("pingmessages"));
legacyToMinimessage(config.getStringList("timerspecific-pingmessages"));
config.getStringList("pingmessages").replaceAll(this::legacyToMinimessage);
config.getStringList("timerspecific-pingmessages").replaceAll(this::legacyToMinimessage);
config.set("playercounthovermessage", legacyToMinimessage(config.getString("playercounthovermessage")));
config.set("playercountmessage", legacyToMinimessage(config.getString("playercountmessage")));
}
if (version < 9) {
config.move("enable-pingmessages", "ping-message.enabled");
config.move("pingmessages", "ping-message.messages");
config.move("enable-timerspecific-messages", "ping-message.enable-timer-specific-messages");
config.move("timerspecific-pingmessages", "ping-message.timer-messages");
config.move("enable-playercountmessage", "player-count-message.enabled");
config.move("playercountmessage", "player-count-message.message");
config.move("enable-playercounthovermessage", "player-list-hover-message.enabled");
config.move("playercounthovermessage", "player-list-hover-message.message");
}
createFile("config-new.yml", "config.yml");
final File file = new File(plugin.getDataFolder(), "config-new.yml");
@@ -262,7 +300,8 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
e.printStackTrace();
}
config.addMissingFields(tempConfig.getValues(), tempConfig.getComments());
config.addMissingFields(tempConfig);
config.replaceComments(tempConfig);
config.set("config-version", CONFIG_VERSION);
file.delete();
@@ -305,7 +344,8 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
file.delete();
}
language.addMissingFields(tempConfig.getValues(), tempConfig.getComments());
language.addMissingFields(tempConfig);
language.replaceComments(tempConfig);
tempConfig.clear();
language.set("language-version", LANGUAGE_VERSION);
@@ -321,12 +361,8 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return serialized.replaceAll("</[a-z_]+>", "");
}
private void legacyToMinimessage(final List<String> list) {
list.replaceAll(this::legacyToMinimessage);
}
public String getConfigMessage(final String path) {
final String s = config.getString(path);
private String getConfigMessage(final ConfigSection section, final String path) {
final String s = section.getString(path);
if (s == null) {
plugin.getLogger().warning("The config file is missing the following string: " + path);
return path;
@@ -334,6 +370,10 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return replaceNewlineVar(s);
}
public String getConfigMessage(final String path) {
return getConfigMessage(config, path);
}
public String getLanguageString(final String path, final String... replacements) {
String s = language.getString(path);
if (s == null) {
@@ -361,6 +401,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return parse(getLanguageString(path, replacements));
}
// TODO Cache platform components if there are no replacements
public Component getRandomPingMessage() {
if (plugin.isTaskRunning() && !plugin.getRunnable().shouldEnable()
&& hasTimerSpecificPingMessages() && !timerSpecificPingMessages.isEmpty()) {
@@ -374,8 +415,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return parse(plugin.replacePingVariables(component));
}
private List<String> loadPingMessages(final String path) {
final List<String> list = config.getStringList(path);
private List<String> loadPingMessages(final List<String> list) {
final List<String> components = new ArrayList<>(list.size());
for (final String s : list) {
components.add(replaceNewlineVar(s));
@@ -482,7 +522,10 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
}
public void setSavedEndtimer(final long millis) {
if (savedEndtimer == millis) return;
if (savedEndtimer == millis) {
return;
}
this.savedEndtimer = millis;
config.getSection("continue-endtimer-after-restart").set("end", millis);
saveConfig();
@@ -504,8 +547,7 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return commandsOnMaintenanceDisable;
}
@Nullable
public List<String> getTimerSpecificPingMessages() {
public @Nullable List<String> getTimerSpecificPingMessages() {
return timerSpecificPingMessages;
}
@@ -513,19 +555,22 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return broadcastIntervals;
}
// Yikeseroo
public String getPlayerCountMessage() {
return LegacyComponentSerializer.legacySection().serialize(parse(plugin.replacePingVariables(playerCountMessage)));
public String getLegacyParsedPlayerCountMessage() {
final String message = timerDependent(legacyParsedPlayerCountMessage, legacyParsedTimerPlayerCountMessage);
return plugin.replacePingVariables(message);
}
// Yikeseroo x2
public String[] getPlayerCountHoverLines() {
final String[] lines = new String[playerCountHoverLines.size()];
for (int i = 0; i < playerCountHoverLines.size(); i++) {
final String component = plugin.replacePingVariables(playerCountHoverLines.get(i));
lines[i] = LegacyComponentSerializer.legacySection().serialize(parse(component));
public String[] getLegacyParsedPlayerCountHoverLines() {
final List<String> lines = timerDependent(legacyParsedPlayerCountHoverLines, legacyParsedTimerPlayerCountHoverLines);
final String[] parsedLines = new String[lines.size()];
for (int i = 0; i < lines.size(); i++) {
parsedLines[i] = plugin.replacePingVariables(lines.get(i));
}
return lines;
return parsedLines;
}
private <T> T timerDependent(final T normal, final @Nullable T timerSpecific) {
return timerSpecific != null && plugin.isTaskRunning() && !plugin.getRunnable().shouldEnable() ? timerSpecific : normal;
}
public Component getKickMessage() {
@@ -548,6 +593,10 @@ public class Settings implements eu.kennytv.maintenance.api.Settings {
return MiniMessage.miniMessage().deserialize(s);
}
protected String toLegacy(final Component component) {
return LegacyComponentSerializer.legacySection().serialize(component);
}
/*
* Note on why this even exists: Yaml will force save all strings containing line breaks '\n' in this rather chunky format:
* key: |-
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,13 +36,19 @@ import eu.kennytv.maintenance.core.command.subcommand.WhitelistAddCommand;
import eu.kennytv.maintenance.core.command.subcommand.WhitelistCommand;
import eu.kennytv.maintenance.core.command.subcommand.WhitelistRemoveCommand;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.time.Duration;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.jetbrains.annotations.Nullable;
public abstract class MaintenanceCommand {
private static final long MAX_TASK_DURATION_SECONDS = TimeUnit.DAYS.toSeconds(28);
protected final MaintenancePlugin plugin;
protected final Settings settings;
private final Map<String, CommandInfo> commandExecutors = new LinkedHashMap<>();
@@ -123,29 +129,41 @@ public abstract class MaintenanceCommand {
return info != null && info.hasPermission(sender) ? info.getTabCompletion(sender, args) : Collections.emptyList();
}
public boolean checkTimerArgs(final SenderInfo sender, final String time, final boolean taskCheck) {
if (!plugin.isNumeric(time)) return true;
if (taskCheck) {
if (plugin.isTaskRunning()) {
sender.send(settings.getMessage("timerAlreadyRunning"));
return true;
public @Nullable Duration parseDurationAndCheckTask(final SenderInfo sender, final String time, final boolean taskCheck) {
final Duration duration;
if (plugin.isNumeric(time)) {
// Assume minutes by default as per old command behavior
duration = Duration.ofMinutes(Integer.parseInt(time));
} else {
try {
// Only accept hours, minutes, and seconds
duration = Duration.parse("PT" + time.toUpperCase(Locale.ROOT));
} catch (final DateTimeParseException e) {
return null;
}
}
final int minutes = Integer.parseInt(time);
if (minutes > 40320) {
if (taskCheck) {
if (plugin.isTaskRunning()) {
sender.send(settings.getMessage("timerAlreadyRunning"));
return null;
}
}
final long seconds = duration.getSeconds();
if (seconds > MAX_TASK_DURATION_SECONDS) {
sender.send(settings.getMessage("timerTooLong"));
return true;
return null;
}
if (minutes < 1) {
sender.sendMessage("§8§o[kennytv whispers to you] §7§oThink about running a timer for a negative amount of minutes. Doesn't work §lthat §7§owell.");
return true;
if (seconds < 1) {
sender.sendRich("<i><dark_gray>[kennytv whispers to you] <gray>Think about running a timer for a negative amount of minutes. Doesn't work <b>that</b> <gray>well.");
return null;
}
return false;
return duration;
}
public boolean checkTimerArgs(final SenderInfo sender, final String time) {
return checkTimerArgs(sender, time, true);
public @Nullable Duration parseDurationAndCheckTask(final SenderInfo sender, final String time) {
return parseDurationAndCheckTask(sender, time, true);
}
protected void addToggleAndTimerCommands() {
@@ -157,19 +175,6 @@ public abstract class MaintenanceCommand {
add(new AbortTimerCommand(plugin), "aborttimer", "abort");
}
public void checkForUpdate(final SenderInfo sender) {
if (plugin.updateAvailable()) {
sender.sendMessage(plugin.getPrefix() + "§cNewest version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
sender.sendMessage(plugin.getPrefix() + "§c§lWARNING: §cYou will have to restart the server to prevent further issues and to complete the update! If you can't do that, don't update!");
sendUpdateMessage(sender);
} else
sender.sendMessage(plugin.getPrefix() + "§aYou already have the latest version of the plugin!");
}
protected void sendUpdateMessage(final SenderInfo sender) {
sender.sendMessage(plugin.getPrefix() + "§eUse §c§l/maintenance forceupdate §eto update!");
}
public List<String> getServersCompletion(final String s) {
return null;
}
@@ -182,8 +187,6 @@ public abstract class MaintenanceCommand {
return null;
}
public abstract void sendDumpMessage(final SenderInfo sender, final String url);
public List<CommandInfo> getCommands() {
return commands;
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +32,6 @@ public final class DebugCommand extends CommandInfo {
if (checkArgs(sender, args, 1)) return;
plugin.setDebug(!plugin.isDebug());
sender.sendMessage("Debug mode is now " + (plugin.isDebug() ? "enabled" : "disabled"));
sender.sendPrefixedRich("<gray>Debug mode is now " + (plugin.isDebug() ? "<green>enabled" : "<red>disabled"));
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,11 @@ package eu.kennytv.maintenance.core.command.subcommand;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import eu.kennytv.maintenance.lib.kyori.adventure.text.TextComponent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.event.ClickEvent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.event.HoverEvent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.format.NamedTextColor;
import java.util.concurrent.TimeUnit;
public final class DumpCommand extends CommandInfo {
@@ -34,25 +38,29 @@ public final class DumpCommand extends CommandInfo {
public void execute(final SenderInfo sender, final String[] args) {
if (checkArgs(sender, args, 1)) return;
if (System.currentTimeMillis() - lastDump < TimeUnit.MINUTES.toMillis(5)) {
sender.sendMessage(plugin.getPrefix() + "§cYou can only create a dump every 5 minutes!");
sender.sendPrefixedRich("<red>You can only create a dump every 5 minutes!");
return;
}
lastDump = System.currentTimeMillis();
sender.sendMessage(plugin.getPrefix() + "§7The dump is being created, this might take a moment.");
sender.sendPrefixedRich("<gray>The dump is being created, this might take a moment.");
plugin.async(() -> {
final String key = plugin.pasteDump();
if (key == null) {
if (sender.isPlayer()) {
sender.sendMessage(plugin.getPrefix() + "§cCould not paste dump (see the console for details)");
sender.sendPrefixedRich("<red>Could not paste dump (see the console for details)");
}
return;
}
final String url = "https://hastebin.com/" + key;
sender.sendMessage(plugin.getPrefix() + "§c" + url);
final String url = "https://pastes.dev/" + key;
sender.sendPrefixedRich("<red><click:open_url:'" + url + "'>" + url + "</click>");
if (sender.isPlayer()) {
plugin.getCommandManager().sendDumpMessage(sender, url);
final TextComponent text = Component.text().content("Click here to copy the link").color(NamedTextColor.GRAY)
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, url))
.hoverEvent(HoverEvent.showText(Component.text("Click here to copy the link to your clipboard").color(NamedTextColor.GREEN)))
.build();
sender.send(plugin.prefix().append(text));
}
});
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
public final class EndtimerCommand extends CommandInfo {
@@ -32,7 +32,9 @@ public final class EndtimerCommand extends CommandInfo {
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (checkArgs(sender, args, 2)) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[1])) {
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -41,7 +43,7 @@ public final class EndtimerCommand extends CommandInfo {
return;
}
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), TimeUnit.MINUTES, false);
plugin.startMaintenanceRunnable(duration, false);
sender.send(getMessage("endtimerStarted", "%TIME%", plugin.getRunnable().getTime()));
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@ import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import java.util.ArrayList;
import java.util.List;
@@ -86,7 +85,7 @@ public final class HelpCommand extends CommandInfo {
if (page * COMMANDS_PER_PAGE < commands.size()) {
sender.send(getMessage("helpNextPage", "%PAGE%", Integer.toString(page + 1)));
} else {
sender.sendMessage("§8× §eVersion " + plugin.getVersion() + " §7by §bkennytv");
sender.sendRich("<dark_gray>× <yellow>Version: " + plugin.getVersion() + " <gray>by <aqua>kennytv");
}
sender.send(header);
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ package eu.kennytv.maintenance.core.command.subcommand;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.config.ConfigSection;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.ArrayList;
@@ -51,7 +52,8 @@ public final class RemoveMotdCommand extends CommandInfo {
}
final Settings settings = getSettings();
final List<String> pingMessages = settings.getConfig().getStringList(timerPingMessages ? "timerspecific-pingmessages" : "pingmessages");
final ConfigSection section = settings.getConfig().getSection("ping-message");
final List<String> pingMessages = section.getStringList(timerPingMessages ? "timer-messages" : "messages");
if (pingMessages.size() < 2) {
sender.send(getMessage("removeMotdError"));
return;
@@ -68,7 +70,7 @@ public final class RemoveMotdCommand extends CommandInfo {
final List<String> pingComponents = timerPingMessages ? settings.getTimerSpecificPingMessages() : settings.getPingMessages();
pingComponents.remove(index - 1);
pingMessages.remove(index - 1);
settings.getConfig().set(timerPingMessages ? "timerspecific-pingmessages" : "pingmessages", pingMessages);
section.set(timerPingMessages ? "timer-messages" : "messages", pingMessages);
settings.saveConfig();
sender.send(getMessage("removedMotd", "%INDEX%", args[1]));
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +20,7 @@ package eu.kennytv.maintenance.core.command.subcommand;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
public final class ScheduleTimerCommand extends CommandInfo {
@@ -32,8 +31,10 @@ public final class ScheduleTimerCommand extends CommandInfo {
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (checkArgs(sender, args, 3)) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[1])
|| plugin.getCommandManager().checkTimerArgs(sender, args[2], false)) {
final Duration enableIn = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
final Duration maintenanceDuration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
if (enableIn == null || maintenanceDuration == null) {
sender.send(getHelpMessage());
return;
}
@@ -42,7 +43,11 @@ public final class ScheduleTimerCommand extends CommandInfo {
return;
}
plugin.scheduleMaintenanceRunnable(Integer.parseInt(args[1]), Integer.parseInt(args[2]), TimeUnit.MINUTES);
sender.send(getMessage("starttimerStarted", "%TIME%", plugin.getRunnable().getTime()));
plugin.scheduleMaintenanceRunnable(enableIn, maintenanceDuration);
sender.send(getMessage(
"scheduletimerStarted",
"%TIME%", plugin.getRunnable().getTime(),
"%DURATION%", plugin.getFormattedTime((int) maintenanceDuration.getSeconds())
));
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ package eu.kennytv.maintenance.core.command.subcommand;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.config.ConfigSection;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.ArrayList;
import java.util.Arrays;
@@ -54,7 +55,8 @@ public final class SetMotdCommand extends CommandInfo {
final Settings settings = getSettings();
final List<String> pingComponents = timerPingMessages ? settings.getTimerSpecificPingMessages() : settings.getPingMessages();
final List<String> pingMessages = settings.getConfig().getStringList(timerPingMessages ? "timerspecific-pingmessages" : "pingmessages");
final ConfigSection section = settings.getConfig().getSection("ping-message");
final List<String> pingMessages = section.getStringList(timerPingMessages ? "timer-messages" : "messages");
final int index = Integer.parseInt(args[1]);
if (index == 0 || index > pingMessages.size() + 1) {
sender.send(getMessage("setMotdIndexError",
@@ -95,7 +97,7 @@ public final class SetMotdCommand extends CommandInfo {
pingComponents.set(index - 1, componentString);
}
settings.getConfig().set(timerPingMessages ? "timerspecific-pingmessages" : "pingmessages", pingMessages);
section.set(timerPingMessages ? "timer-messages" : "messages", pingMessages);
settings.saveConfig();
sender.send(settings.getMessage(
"setMotd",
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@ import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
public final class StarttimerCommand extends CommandInfo {
@@ -32,7 +32,9 @@ public final class StarttimerCommand extends CommandInfo {
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (checkArgs(sender, args, 2)) return;
if (plugin.getCommandManager().checkTimerArgs(sender, args[1])) {
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
@@ -41,7 +43,7 @@ public final class StarttimerCommand extends CommandInfo {
return;
}
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), TimeUnit.MINUTES, true);
plugin.startMaintenanceRunnable(duration, true);
sender.send(getMessage("starttimerStarted", "%TIME%", plugin.getRunnable().getTime()));
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +20,11 @@ package eu.kennytv.maintenance.core.command.subcommand;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import eu.kennytv.maintenance.lib.kyori.adventure.text.event.ClickEvent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.event.HoverEvent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.format.NamedTextColor;
import eu.kennytv.maintenance.lib.kyori.adventure.text.minimessage.MiniMessage;
public final class UpdateCommand extends CommandInfo {
@@ -31,12 +36,12 @@ public final class UpdateCommand extends CommandInfo {
public void execute(final SenderInfo sender, final String[] args) {
if (checkArgs(sender, args, 1)) return;
if (args[0].equalsIgnoreCase("update")) {
plugin.async(() -> plugin.getCommandManager().checkForUpdate(sender));
plugin.async(() -> checkForUpdate(sender));
return;
}
if (!plugin.updateAvailable()) {
sender.sendMessage(plugin.getPrefix() + "§aYou already have the latest version of the plugin!");
sender.sendPrefixedRich("<green>You already have the latest version of the plugin!");
return;
}
@@ -47,9 +52,25 @@ public final class UpdateCommand extends CommandInfo {
} else {
sender.send(getMessage("updateFailed"));
}
} catch (Exception e) {
} catch (final Exception e) {
sender.send(getMessage("updateFailed"));
e.printStackTrace();
}
}
private void checkForUpdate(final SenderInfo sender) {
if (!plugin.updateAvailable()) {
sender.sendPrefixedRich("<green>You already have the latest version of the plugin!");
return;
}
sender.sendPrefixedRich("<red>Newest version available: <green>Version " + plugin.getNewestVersion() + "<red>, you're on <green>" + plugin.getVersion());
sender.sendPrefixedRich("<b><red>WARNING: <red>You will have to restart the server to prevent further issues and to complete the update! If you can't do that, don't update!");
sender.send(Component.text().append(MiniMessage.miniMessage().deserialize("<gold>× <dark_gray>[<green>Update<dark_gray>]"))
.clickEvent(ClickEvent.runCommand("/maintenance forceupdate"))
.hoverEvent(HoverEvent.showText(Component.text().content("Click here to update the plugin").color(NamedTextColor.GREEN)))
.append(Component.text().content(", or manually run ").color(NamedTextColor.GRAY))
.append(Component.text().content("/maintenance forceupdate").color(NamedTextColor.RED)).build());
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@ import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
public final class WhitelistAddCommand extends CommandInfo {
@@ -64,7 +65,13 @@ public final class WhitelistAddCommand extends CommandInfo {
}
private void addPlayerToWhitelist(final SenderInfo sender, final String name) {
plugin.getOfflinePlayer(name, selected -> {
plugin.getOfflinePlayer(name).whenComplete((selected, ex) -> {
if (ex != null) {
plugin.getLogger().log(Level.SEVERE, "Error while fetching offline player", ex);
sender.send(getMessage("offlinePlayerFetchError"));
return;
}
if (selected == null) {
sender.send(getMessage("playerNotOnline"));
return;
@@ -75,7 +82,13 @@ public final class WhitelistAddCommand extends CommandInfo {
}
private void addPlayerToWhitelist(final SenderInfo sender, final UUID uuid) {
plugin.getOfflinePlayer(uuid, selected -> {
plugin.getOfflinePlayer(uuid).whenComplete((selected, ex) -> {
if (ex != null) {
plugin.getLogger().log(Level.SEVERE, "Error while fetching offline player", ex);
sender.send(getMessage("offlinePlayerFetchError"));
return;
}
if (selected == null) {
sender.send(getMessage("playerNotFoundUuid"));
return;
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,8 +50,9 @@ public final class WhitelistRemoveCommand extends CommandInfo {
if (args.length != 2) return Collections.emptyList();
final List<String> list = new ArrayList<>();
String matchNameLowerCase = args[1].toLowerCase();
for (final String name : getSettings().getWhitelistedPlayers().values()) {
if (name.toLowerCase().startsWith(args[1])) {
if (name.toLowerCase().startsWith(matchNameLowerCase)) {
list.add(name);
}
}
@@ -59,7 +60,7 @@ public final class WhitelistRemoveCommand extends CommandInfo {
}
private void removePlayerFromWhitelist(final SenderInfo sender, final String name) {
plugin.getOfflinePlayer(name, selected -> {
plugin.getOfflinePlayer(name).whenComplete((selected, ex) -> {
if (selected == null) {
if (getSettings().removeWhitelistedPlayer(name)) {
sender.send(getMessage("whitelistRemoved", "%PLAYER%", name));
@@ -74,7 +75,7 @@ public final class WhitelistRemoveCommand extends CommandInfo {
}
private void removePlayerFromWhitelist(final SenderInfo sender, final UUID uuid) {
plugin.getOfflinePlayer(uuid, selected -> {
plugin.getOfflinePlayer(uuid).whenComplete((selected, ex) -> {
if (selected == null) {
removePlayerFromWhitelist(sender, uuid, uuid.toString());
} else {
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,10 +18,6 @@
package eu.kennytv.maintenance.core.config;
import com.google.common.collect.Sets;
import org.jetbrains.annotations.Nullable;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -31,6 +27,9 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
/**
* Further modified version of the <a href="https://github.com/PSandro/SimpleConfig">SimpleConfig</a>SimpleConfig project of PSandro.
@@ -110,30 +109,8 @@ public final class Config extends ConfigSection {
Files.write(file.toPath(), bytes);
}
public boolean addMissingFields(final Map<String, Object> fields, final Map<String, String[]> comments) {
// Note: Only scans for the first two levels
boolean changed = false;
for (final Map.Entry<String, Object> entry : fields.entrySet()) {
final Object o = values.get(entry.getKey());
if (o != null) {
final Object o2 = entry.getValue();
if (!(o instanceof Map) || !(o2 instanceof Map)) continue;
final Map<String, Object> deepMap = (Map<String, Object>) o2;
for (final Map.Entry<String, Object> deepEntry : ((Map<String, Object>) o2).entrySet()) {
if (deepMap.containsKey(deepEntry.getKey())) continue;
deepMap.put(deepEntry.getKey(), deepEntry.getValue());
changed = true;
}
continue;
}
values.put(entry.getKey(), entry.getValue());
changed = true;
}
this.comments = new HashMap<>(comments);
return changed;
public void replaceComments(final Config fromConfig) {
this.comments = new HashMap<>(fromConfig.comments);
}
private static Yaml createYaml() {
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,12 +17,12 @@
*/
package eu.kennytv.maintenance.core.config;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jetbrains.annotations.Nullable;
/**
* Further modified version of the <a href="https://github.com/PSandro/SimpleConfig">SimpleConfig</a>SimpleConfig project of PSandro.
@@ -63,15 +63,15 @@ public class ConfigSection {
@Nullable
public Object getObject(final String key, final Object def) {
int i1 = -1;
int i2;
int nextSeparatorIndex = -1;
int sectionStartIndex;
ConfigSection section = this;
while ((i1 = key.indexOf('.', i2 = i1 + 1)) != -1) {
section = section.getSection(key.substring(i2, i1));
while ((nextSeparatorIndex = key.indexOf('.', sectionStartIndex = nextSeparatorIndex + 1)) != -1) {
section = section.getSection(key.substring(sectionStartIndex, nextSeparatorIndex));
if (section == null) return def;
}
final String subKey = key.substring(i2);
final String subKey = key.substring(sectionStartIndex);
if (section == this) {
final Object result = values.get(subKey);
return result != null ? result : def;
@@ -97,17 +97,41 @@ public class ConfigSection {
return new ConfigSection(getRoot(), getFullKeyInPath(key), (Map<String, Object>) o);
}
public ConfigSection getOrCreateSection(final String key) {
final Object o = getObject(key);
if (!(o instanceof Map)) {
set(key, new LinkedHashMap<>());
return getSection(key);
}
return new ConfigSection(getRoot(), getFullKeyInPath(key), (Map<String, Object>) o);
}
public boolean contains(final String key) {
return getObject(key) != null;
}
public void set(final String key, @Nullable final Object value) {
//TODO go deep if necessary
int nextSeparatorIndex = -1;
int sectionStartIndex;
ConfigSection section = this;
while ((nextSeparatorIndex = key.indexOf('.', sectionStartIndex = nextSeparatorIndex + 1)) != -1) {
section = section.getOrCreateSection(key.substring(sectionStartIndex, nextSeparatorIndex));
}
final String sectionKey = key.substring(sectionStartIndex);
if (value == null) {
values.remove(key);
section.values.remove(sectionKey);
getRoot().getComments().remove(getFullKeyInPath(key));
} else {
values.put(key, value);
section.values.put(sectionKey, value);
}
}
public void move(final String key, final String toKey) {
final Object o = getObject(key);
if (o != null) {
remove(key);
set(toKey, o);
}
}
@@ -192,6 +216,28 @@ public class ConfigSection {
return list != null ? list : def;
}
public boolean addMissingFields(final ConfigSection fromSection) {
boolean changed = false;
for (final Map.Entry<String, Object> entry : fromSection.values.entrySet()) {
final String key = entry.getKey();
final Object value = this.values.get(key);
if (value != null) {
// Go deeper for sections
final Object newValue = entry.getValue();
if (!(value instanceof Map) || !(newValue instanceof Map)) {
continue;
}
changed |= this.getSection(key).addMissingFields(fromSection.getSection(key));
} else {
// Value is missing
this.values.put(key, entry.getValue());
changed = true;
}
}
return changed;
}
/**
* @return root config
*/
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -146,6 +146,11 @@ public final class ConfigSerializer {
multiLineValue = false;
}
// YAML list items are values, not keys - skip without touching key/indent state
if (line.length() > indent && line.charAt(indent) == '-') {
continue;
}
// Check if this is a level lower
if (indents <= currentIndents) {
final String[] array = key.split(PATH_SEPARATOR_QUOTED);
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +21,12 @@ import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import eu.kennytv.maintenance.lib.kyori.adventure.text.TextComponent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.event.ClickEvent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.event.HoverEvent;
import eu.kennytv.maintenance.lib.kyori.adventure.text.format.NamedTextColor;
import eu.kennytv.maintenance.lib.kyori.adventure.text.format.TextDecoration;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@@ -65,8 +71,15 @@ public abstract class JoinListenerBase {
}
notifiedPlayers.add(sender.getUuid());
sender.sendMessage(plugin.getPrefix() + "§cThere is a newer version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
plugin.sendUpdateNotification(sender);
sender.sendPrefixedRich("<red>There is a newer version available: <green>Version " + plugin.getNewestVersion() + "<red>, you're on <green>" + plugin.getVersion());
final TextComponent text = Component.text().content("Download it at: ").color(NamedTextColor.RED)
.append(Component.text().content(MaintenancePlugin.HANGAR_URL).color(NamedTextColor.GOLD))
.append(Component.text().content(" (CLICK ME)").color(NamedTextColor.GRAY).decorate(TextDecoration.BOLD))
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, MaintenancePlugin.HANGAR_URL))
.hoverEvent(HoverEvent.showText(Component.text("Download the latest version").color(NamedTextColor.GREEN)))
.build();
sender.send(plugin.prefix().append(text));
});
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +20,7 @@ package eu.kennytv.maintenance.core.runnable;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
public final class MaintenanceScheduleRunnable extends MaintenanceRunnable {
private final int maintenanceDuration;
@@ -36,7 +35,7 @@ public final class MaintenanceScheduleRunnable extends MaintenanceRunnable {
super.finish();
// Start the timer to disable maintenance again
plugin.startMaintenanceRunnable(maintenanceDuration, TimeUnit.SECONDS, false);
plugin.startMaintenanceRunnable(Duration.ofSeconds(maintenanceDuration), false);
}
@Override
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,11 +45,6 @@ public final class DummySenderInfo implements SenderInfo {
return false;
}
@Override
@Deprecated
public void sendMessage(final String message) {
}
@Override
public void send(final Component component) {
}
@@ -1,23 +0,0 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.kennytv.maintenance.core.util;
public final class MaintenanceVersion {
public static final String VERSION = "$VERSION";
}
@@ -0,0 +1,9 @@
package eu.kennytv.maintenance.core.util;
import java.io.IOException;
/**
* Exception thrown when an API rate limit is reached.
*/
public class RateLimitedException extends IOException {
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
*/
package eu.kennytv.maintenance.core.util;
import eu.kennytv.maintenance.api.MaintenanceProvider;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
import eu.kennytv.maintenance.lib.kyori.adventure.text.minimessage.MiniMessage;
import java.util.UUID;
@@ -33,14 +35,16 @@ public interface SenderInfo {
return permission == null || hasPermission("maintenance.admin") || hasPermission("maintenance." + permission);
}
@Deprecated
void sendMessage(String message);
void send(Component component);
default void sendRich(final String message) {
send(MiniMessage.miniMessage().deserialize(message));
}
default void sendPrefixedRich(final String message) {
final MaintenancePlugin maintenance = (MaintenancePlugin) MaintenanceProvider.get();
send(maintenance.prefix().append(MiniMessage.miniMessage().deserialize(message)));
}
boolean isPlayer();
}
@@ -1,6 +1,6 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* Copyright (C) 2018-2022 kennytv (https://github.com/kennytv)
* Copyright (C) 2018-2024 kennytv (https://github.com/kennytv)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff. Show more