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
218 changed files with 12600 additions and 4459 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
+330
View File
@@ -0,0 +1,330 @@
# 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
* Added config option `enable-playercounthovermessage` to be able to toggle the player count hover message
* Removed platform specific command aliases (e.g. `maintenancevelocity`)
* Translations
* Moved translation editing to [Crowdin](https://crowdin.com/translate/maintenance)
* Added Turkish translation file (thanks to Proomp)
* Added Swedish translation file (thanks to Sup33r)
* Added Ukrainian translation file (thanks to Mrlucke)
* Added Japanese translation file (thanks to yu-solt)
* Added bStats metrics to Velocity and Sponge modules
### Fixed
* Fixed disabling the `enable-pingmessages` setting not working on Paper servers
* Fixed variable replacement in messages with gradients
* Fixed the message for cancelling proxied server timers not replacing the server argument
* Setting `enable-pingmessages` to `false` no longer disables custom player and player hover messages
---
## 4.0.1 - April 17th 2022
### Fixed
* Fixed the config header sometimes breaking the config on upgrading/saving
---
## 4.0.0 - March 17th 2022
### Changed
* Added support for hex colors in messages and replaced the component parsing with adventure-minimessage
* This means that section symbols (`§`) are no longer the intended/supported format
* You can use the following page to edit and preview formatted text: https://webui.adventure.kyori.net/
* You can find full documentation on the format (including normal colors and formatting, rgb, click/hover events, and more) here: https://docs.adventure.kyori.net/minimessage/format
* Your config and language file will be updated to the new format automatically, you won't have to change anything manually!
* Note that the player count and player count hover messages do not support rgb colors
* Updated Sponge module to SpongeAPI v8 (Minecraft 1.15+)
* Changed `%NEWLINE%` replacement to `<br>`
* Changed `enable-timerspecific-messages` to default to `true` in newly generated config files
* Added `prefix` entry in language file to use the placeholder `<prefix>` instead of copy-pasting the actual prefix every time
* Added `singleServerMaintenanceListEntry` language string
* Added Polish translations (thanks to Slasherss1)
* Updated French translations (thanks to Aurelien30000)
* Updated Spanish translations (thanks to Jaximo)
* If you were using the MaintenanceAddon, you need to update it to [version 1.2.0](https://github.com/kennytv/MaintenanceAddon/releases/tag/1.2.0)
### Fixed
* Fixed missing language key warning for the scheduletimer command
* Fixed typo in `singleServerMaintenanceListEmpty` default language string
* Fixed typo in language key `whitelistEmpty` in the German language file (by Ceddix)
---
## 3.0.7 - August 17th 2021
### Changed
* Bungee/Velocity: `/maintenance add <name>` now works for offline players as well
* Added config options `commands-on-maintenance-enable` and `commands-on-maintenance-disable` to define commands to be executed after maintenance has been toggled
* Added config option `enable-pingmessages` to can change whether a custom maintenance motd should be displayed during maintenance
* Added language fields `scheduletimerBroadcast` and `singleScheduletimerBroadcast` with the variables `%SERVER%`, `%TIME%`, and `%DURATION%` instead of using the normal starttimer broadcasts
### Fixed
* Fixed SQL loading issues on some platforms
* Fixed missing language key warning for the debug command
* Velocity: Fixed the update message
---
## 3.0.6 - February 17th 2021
### Changed
* Updated the Velocity version to be compatible with Velocity 1.1.0 (use Maintenance 3.0.5 if you use an older version of Velocity)
* Added `maintenance schedule <minutes> <duration> command`
* This starts a timer for maintenance to be enabled, after which another timer will be started to disable it again (in contrast to `starttimer` and `endtimer`, which each only do one of)
* On proxies, you can use `maintenance schedule [server] <minutes> <duration> command` to schedule maintenance on a proxied server
* Added command alias `mt` for the Maintenance command
* Added secret argument to the whitelist add command: You can use `maintenance add <uuid> <name>` to add offline entries per command
* The maintenance's base command is now properly registered with a permission on each platform, so that it is excluded from tabcomplection to unauthorized players
* Some improvements to the French language file (thanks to @Aurelien30000)
* API addition: Added MaintenanceReloadedEvent
* If you are using the MaintenancePlaceholderAddon, you need to [update it to 1.1.0](https://github.com/KennyTV/MaintenanceAddon/releases)
### Fixed
* Fixed not setting custom singleserver kickmessages throwing warnings
* Bungee: Fixed linebreaks in the playercount hovermessage for 1.16+ clients
---
## 3.0.5 - June 17th 2020
### Changed
* The plugin identifiers are now `Maintenance` instead of the previous `MaintenanceSpigot` and `MaintenanceBungee`,
and `maintenance` instead of `maintenancesponge` and `maintenancevelocity`
* The plugin directory will automatically be renamed accordingly when starting the server
* If you are using the MaintenancePlaceholderAddon, you need to [update it to 1.0.3](https://github.com/KennyTV/MaintenanceAddon/releases)
* Bungee/Velocity: The `fallback` field can now also be set as a list to define multiple fallback servers
* 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
* 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
### Fixed
* Fixed the `use-ssl` option being inverted
* Fixed disabling the playercount-message still hiding online/max players
* Fixed config parsing with multi line strings
* Bungee: Fixed compatibility with other motd changing plugins using the 'HIGHEST' ping listener priority
---
## 3.0.4 - March 17th 2020
### Changed
* Bungee/Velocity: Added config option `waiting-server` to send players to a waiting server when global maintenance is enabled (instead of kicking them)
* Bungee/Velocity: Added config option `use-ssl` in the `mysql` section to disable SSL connections
* Added Russian language file (thanks to Spigot user En_0t_S)
* Updated missing translations in Portuguese language file (thanks to Spigot user JoaoPinto)
* Updated bStats metrics
### Fixed
* Fixed singleserver timers using input as seconds instead of minutes (by mxs42)
* Fixed singleserver timers broadcasting globally
* Fixed language updating with an unknown/self-translated language file
* Fixed Velocity server autocompletion in the maintenance command
---
## 3.0.3 - September 17th 2019
### Changed
* Bungee/Velocity: Added `maintenance.singleserver.bypass.<server>` permission to give individual bypasses for proxied servers (`maintenance.bypass` will still bypass everything as the super-perm)
* Added the messages of the help command into the language files
* Added config option `kick-online-players` to disable the kicks when maintenance is enabled (new connections will still be blocked)... not sure why you'd want that, but you can :p
* The language file will now be automatically updated as well, so no need to delete and recreate it anymore, yay!
* Updated missing and new translations in French language file (thanks to Spigot user Zendrique)
* Updated missing and new translations in Spanish language file (thanks to Spigot user Vixo_Ulises)
### Fixed
* Bungee/Velocity: Fixed the join-notifications being sent twice if both global and server maintenance are enabled, as well as when just a server has maintenance in some cases
* Bungee: Fixed players being kicked *after* the initial connection and thus triggering a join and leave message before being kicked
* Bungee: Fixed the kickmessage not being displayed in some cases
* Paper: Fixed the playercount message not being displayed on Paper servers with ViaVersion
* Paper: Fixed the motd not being changed at all on Paper servers with ProtocolSupport (-> ProtocolLib listener used, since ProtocolSupport does not fire Paper's ping event)
* Fixed the config autoupdater when the config contained strings broken over multiple lines
---
## 3.0.2 - May 17th 2019
### Changed
* Added config option `timerspecific-pingmessages` to have specific pingmessages shown when endtimers are run
* You can also set them ingame by using `/maintenance setmotd timer <index> ...` instead of `/maintenance setmotd <index> ...`, along with `/maintenance removemotd timer <index>` and `/maintenance motd timer`
* Made dumps a little prettier
* Support Sponge 8.0.0-SNAPSHOT
* Support latest text/Velocity (now only supports Velocity builds from May 7th upwards)
---
## 3.0.1 - April 17th 2019
### Changed
* Created an addon to have PlaceholderAPI placeholders on Spigot when running the Maintenance plugin on Bungee (see [**here**](https://github.com/KennyTV/Maintenance/wiki/MaintenanceAddon))
* Spigot version: If running on Paper 1.12.2 or higher, ProtocolLib will not be needed anymore
* The universal jar now only includes Bungee and Spigot (whereas before Sponge and Velocity as well) and has been further minimized in size
* To use the plugin on the other platforms, use the `MaintenanceSponge.jar` or `MaintenanceVelocity.jar` respectively
* Added config option `continue-endtimer-after-restart` to have endtimers continued, even if the server restarts during its runtime
* Added custom eventsystem to the API
* Removed bStats metrics from Sponge module
### Fixed
* Actually fixed compatibility to other plugins using the same MySQL library (such as LuckPerms) in the Bungee version
* Fixed an issue with executing the maintenance change with MySQL enabled on connected proxies
* Fixed an occasional error on pings of non clients in the Spigot version
* Fixed 1.13 clients on sub 1.13 servers not showing the playercountmessage in the Spigot version
* Minor fixes/changes to Spanish and Portuguese language files
---
## 3.0 - February 17th 2019
### Changed
* This plugin now also supports the platforms Sponge and Velocity!
* Added tabcompletion for maintenance commands on all platforms
* This plugin now uses a custom config system, which means comments won't vanish after saving them and the different configs have been unified
* You can now also add and remove (offline) players to/from the maintenance whitelist by using their uuid (i.e. `/maintenance add <uuid>`)
* The %TIMER% variable can now also be used in the playercount-, playercounthover- and kickmessages
* To make life easier for people running on Bungee without an extra permission plugin: the `maintenance.admin` permission gives access to all subcommands
* Made bug reports a little easier with the new `/maintenance dump` command
* Added a config option to disable update checks (not recommended)
* Moved `kickmessage` field from config to language file and added its default translations
* Changed permissions nodes for the Bungee part (`from: to`):
* `maintenance.toggleserver`: `maintenance.singleserver.toggle`
* `maintenance.servertimer`: `maintenance.singleserver.timer`
* `maintenance.status`: `maintenance.singleserver.status`
* The command `/maintenance timer abort` has been renamed to `/maintenance aborttimer`
* Added additional aliases: `/maintenance end` for `/maintenance endtimer`, `start` for `starttimer`, `abort` for `aborttimer`
* On false command syntax usage, the reply will be the specific help message for that command, not the entire help window as it was before
* Improved update checks and updater
* Many many other runtime improvements and some major internal refactoring
### Fixed
* Fixed a startup issue with other plugins using the same MySQL library on Bungee (for example some versions of LuckPerms)
* Fixed an error on Bungee when single servers are set to maintenance with no fallbackserver set
* Fixed a rare problem with adding and removing players to/from the maintenance whitelist
* Fixed an issue with starting server timers while also running a global maintenance timer
* Fixed the `/maintenance status` not appearing in the help overview
---
## 2.5.2 - December 17th 2018
### Changed
* Added French `fr` (thanks to Zendrique) and Portuguese `pt` (thanks to JoaoPinto) translations!
* Improvements to MySQL stuff on the Bungee part
* If enabled, single servers (on the Bungee part) that are under maintenance are now saved into the given database as well!
### Fixed
* Fixed the maintenance value only loading on the first server ping, not on startup
* Fixed an error while setting maintenance to single servers, when the executor is something other than a player
* Fixed the maintenance-icon not loading on 1.13+ Spigot servers with ProtocolLib
* Some other general improvements and a small message fix
---
## 2.5.1 - November 17th 2018
### Fixed
* Fixed an occasional file loading error on startup
---
## 2.5 - November 17th 2018
### Changed
* Added the possibility on BungeeCord to also enable maintenance on Spigot servers managed by the proxy
* `/maintenance <on/off> <servername>` will now set maintenance to a proxied Spigot server
* `/maintenance <starttimer/endtimer> <server> <minutes>` works analog to the normal timer commands
* `/maintenance status` shows proxied servers that have maintenance enabled
* new permissions are `maintenance.toggleserver`, `maintenance.servertimer` and `maintenance.status`
* Added a multiple-language-support system! It's currently not that big tho, with the only language added being de/German
* If you like this plugin, know French or Spanish (or any other language that isn't yet supported by the plugin) and want to contribute a bit to it, translations of the default language.yml are greatly appreciated!
* Note: There will be a new 'language-en.yml' file created, so if you changed any messages before, you have to do it again in the new file
* Made the help message a little fancier
* Some API changes
### Fixed
* Fixed a bug with starttimers not being able to start properly
---
## 2.4 - September 17th 2018
### Changed
* Edit nearly every message to your hearts content with the now introduced language.yml file!
* Added `/maintenance removemotd <index>` command to remove a motd via an ingame command (if you have multiple ones)
* You can now include the `%TIMER%` variable into your maintenance motd - **If using the maintenance endtimer**, it will display the time left until maintenance will be disabled!
* Simply shows `-` if maintenance is on without any timer
* A nice integration could be `&cExpected to come back in: &6%TIMER%`
* You can now choose to show the normal playercount during maintenance instead of a custom message by changing the `enable-playercountmessage` value in the config
* You can also include the playercount in a custom playercountmessage by using the 2 variables `%ONLINE%` and `%MAX%`
* If there's a new update available, the update notification will no longer be sent on every single login, but rather just on the first one after startup
* Removing players from the maintenance whitelist now accepts uncapitalized names
---
## 2.3.1 - August 17th 2018
### Changed
* When a string in the config is missing, the plugin doesn't cancel the current process and throws an error anymore, but rather gives a soft warning in the console and returns a backup string
* If MySQL is enabled, the plugin will only make a database request at least x seconds after the last request, whereas you can define the value in the config under `mysql.update-interval`
* Example: If a first player pings the server after startup, the value will be updated -> No update in the next x seconds even if a player pings -> After elapsed, as soon as the next player pings the server again
* Especially helpful as well as recommended for servers with many players
* Another improvement for MySQL support: After enabling maintenance on one proxy, the other connected ones will then also kick all non permitted players and switch their ServerListPlus state!
* The `/maintenance` helppage now only shows the commands the player actually has permission to execute
---
## 2.3 - July 17th 2018
### Changed
* Added the possibility to have multiple pingmessages, of which one will be randomly chosen on each ping when maintenance is enabled (you can also just keep it at one)!
* Added permissions per subcommand
* `maintenance.command` required to use any of the commands
* `maintenance.toggle` to use /maintenance <on/off>
* `maintenance.reload` to use /maintenance reload
* `maintenance.update` to use /maintenance <update/forceupdate>
* `maintenance.timer` to use /maintenance <starttimer/endtimer> <minutes>
* `maintenance.whitelist.add` to use /maintenance add <player>
* `maintenance.whitelist.remove` to use /maintenance remove <player>
* `maintenance.whitelist.list` to use /maintenance whitelist
* `maintenance.setmotd` to use /maintenance setmotd <index> <1/2> <message>
* `maintenance.motd` to use /maintenance motd
* Added `/maintenance motd` command to list all set maintenance pingmessages
* `/maintenance whitelist` now also shows the UUID connected to each name
### Fixed
* Reworked/fixed the `/maintenance setmotd` command
* Some typo and description fixes
---
## 2.2.2 - June 17th 2018
### Changed
* Changed the loading of the maintenance icon to be more predictable: It will load directly on startup and can now be reloaded by using the `/maintenance reload` command as well
* Changed the reload message to read the proper reload changes
* Removed an obsolete config comment
* You can now hook into the plugin with the integrated API
---
## 2.2.1 - April 17th 2018
### Changed
* Added `/maintenance setmotd <1/2> <message>` command to edit the maintenance mode motd via a command
* The Bungee version of the plugin will now automatically create a MySQL table if it is enabled, so you won't have to manually create one anymore
### Fixed
* Fixed the ServerListPlus motd only changing on using the command, but not on the server startup
* Fixed an error with canceling the start-/endtimer in the Bungee version
* Fixed an error with removing players from the whitelist in the Spigot version
---
## 2.2 - March 17th 2018
### Changed
* Great update for the Spigot version of the plugin as well as performance improvements and bugfixes in both versions
* If you have ProtocolLib installed, you can set a custom server icon while maintenance is enabled, also the playercount-message and the playercount-hover-message are now available (as it has already been in the Bungee version)!
* In the BungeeCord version of the plugin, the `/maintenance remove <player>` command now also works for offline players
* Removed the plugin's prefix from some messages
* General performance improvements
### Fixed
* The Spigot version should be much more compatible with other motd-changing plugins, such as SexyMotd
* Fixed some other issues with the ProtocolLib integration
* Minor textfix for the updatemessage in the Spigot version
---
## 2.1 - February 17th 2018
### Changed
* Massive code cleanup for both the Bungee and Spigot version of the plugin
* Minor performance improvements
### Fixed
* Fixed start- and endtimers not being cancelled properly
* Fixed an error for the update command in the Spigot version
* Fixed an error regarding the ServerListPlus integration in the Spigot version
---
## 2.0 - February 15th 2018
### Changed
* You can now put the plugin not only inside your Bungee plugins folder, but also your Spigot/Bukkit one! Both will have the same feautures, but simply on their own platform. However, the Spigot version doesn't have MySQL support (as you would normally use BungeeCord for connecting multiple Spigot/Bukkit servers) and you can't use playercount-message, besides this, it has all its main features.
* On BungeeCord you can make your own custom messages for the playercount
* On Spigot you will see `N/0` (N being the actual count). If you also have ProtocolLib on your server, `0/0` will be displayed.
* As many of you asked me: Maintenance now supports the plugin ServerListPlus
* Performance improvements
### Fixed
* Fixed some permission and message bugs
* Fixed problems with adding and removing players from the maintenance whitelist
* Fixed update checks
+5
View File
@@ -0,0 +1,5 @@
# Contribution
As I'm just a random guy making this plugin as a fun side-project, it will never be "perfect".
Any improvement is welcome, as long as it fits with the general style of code, that should become apparent when looking at some of the other classes. :)
Generally, the used formatting is the default formatting of IntelliJ (Ctrl+Alt+L).
+14
View File
@@ -0,0 +1,14 @@
---
name: Bug report
about: Report a bug to have it fixed
---
## Bug reproducibility
**How does the problem occur/what are the steps to reproduce it?**
## Error
**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**
+26
View File
@@ -0,0 +1,26 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew build
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: Maintenance Files
path: build/libs
+7 -3
View File
@@ -1,6 +1,8 @@
.metadata
dependencies/
build/
.gradle
bin/
run/
tmp/
*.tmp
*.bak
@@ -14,7 +16,6 @@ local.properties
.externalToolBuilders/
*.launch
*.pydevproject
*.jar
.cproject
.classpath
.factorypath
@@ -91,4 +92,7 @@ $RECYCLE.BIN/
*.msi
*.msm
*.msp
*.lnk
*.lnk
!MaintenanceAPI.jar
**/src/test/resources/
!core/src/test/resources/dirty-config.yml
-13
View File
@@ -1,13 +0,0 @@
## Issue
Include here how the problem occured and how it's reproduceable.
If present, also paste the entire error message from the console, preferably via a https://hastebin.com/ link.
## Necessary server information
**Running on**: <BungeeCord/Bukkit>
**Maintenance version**: <>
## Other information
**Other motd changing plugins**: <>
**ProtocolLib version**: <>
+5 -5
View File
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
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/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
Binary file not shown.
-29
View File
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maintenance-base</artifactId>
<groupId>eu.kennytv</groupId>
<version>2.5</version>
</parent>
<artifactId>maintenance-api</artifactId>
<name>Maintenance-API</name>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.13-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -1,40 +0,0 @@
package eu.kennytv.maintenance.api;
/**
* @author KennyTV
* @since 2.1
*/
public interface IMaintenance {
/**
* Enables/disables maintenance mode.
* If enabled, all non-permitted players will be kicked.
* <p>
* If using the BungeeCord version and MySQL is enabled,
* it will also be written into the database.
* </p>
*
* @param maintenance true to enable, false to disable maintenance mode
*/
void setMaintenance(boolean maintenance);
/**
* @return true if maintenance is currently enabled
*/
boolean isMaintenance();
/**
* @return true if a start- or endtimer task is currently running
*/
boolean isTaskRunning();
/**
* @return version of the plugin
*/
String getVersion();
/**
* @return {@link ISettings} for options regarding configuration files
*/
ISettings getSettings();
}
@@ -1,15 +0,0 @@
package eu.kennytv.maintenance.api;
/**
* @author KennyTV
* @since 2.2.2
*/
public interface IMaintenanceBase {
/**
* Returns API instance of IMaintenance.
*
* @return {@link IMaintenance} instance
*/
IMaintenance getApi();
}
@@ -1,68 +0,0 @@
package eu.kennytv.maintenance.api;
import java.util.Map;
import java.util.UUID;
/**
* @author KennyTV
* @since 2.1
*/
public interface ISettings {
/**
* Note that the value might need a few seconds to update, if you're on BungeeCord with MySQL enabled
*
* @return true if maintenance is currently enabled
*/
boolean isMaintenance();
/**
* @return true if "send-join-notification" is set to true in the config
*/
boolean isJoinNotifications();
/**
* @return true if "custom-maintenance-icon" is set to true in the config
*/
boolean hasCustomIcon();
/**
* @return map of uuids of whitelisted players with their given names
*/
Map<UUID, String> getWhitelistedPlayers();
/**
* Removes a player from the maintenance whitelist.
*
* @param uuid uuid of the player to remove
* @return true if removing the player was successful
*/
boolean removeWhitelistedPlayer(UUID uuid);
/**
* Removes a player from the maintenance whitelist.
*
* @param name name of the player to remove with original lower-/uppercase letters
* @return true if removing the player was successful
* @deprecated if a player changes their name, the list will still contain the old one
* @see #removeWhitelistedPlayer(UUID)
*/
@Deprecated
boolean removeWhitelistedPlayer(String name);
/**
* Adds a player to the maintenance whitelist.
*
* @param uuid uuid of the player to add
* @param name of the player to add
* @return true if adding the player was successful
*/
boolean addWhitelistedPlayer(UUID uuid, String name);
/**
* Reloads the maintenance-icon.png image from the server folder.
*
* @return true if loading the image was successful
*/
boolean reloadMaintenanceIcon();
}
@@ -1,30 +0,0 @@
package eu.kennytv.maintenance.api.bungee;
import eu.kennytv.maintenance.api.IMaintenance;
import net.md_5.bungee.api.config.ServerInfo;
/**
* @author KennyTV
* @since 2.5
*/
public interface IMaintenanceBungee extends IMaintenance {
/**
* Enables/disables maintenance mode on a proxied server.
* If enabled, all non-permitted players will be kicked.
* If MySQL is enabled, it will also be written into the database.
*
* @param maintenance true to enable, false to disable maintenance mode
*/
boolean setMaintenanceToServer(ServerInfo server, boolean maintenance);
/**
* @return true if maintenance is currently enabled on the proxied server
*/
boolean isMaintenance(ServerInfo server);
/**
* @return true if a start- or endtimer task is currently running regarding the proxied server
*/
boolean isServerTaskRunning(ServerInfo server);
}
@@ -1,29 +0,0 @@
package eu.kennytv.maintenance.api.bungee;
import eu.kennytv.maintenance.api.IMaintenanceBase;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
/**
* Utility class to get the {@link IMaintenanceBungee} instance for the BungeeCord version of the plugin.
* <p>
* Only access this class if you're running the plugin on a BungeeCord server!
* </p>
*
* @author KennyTV
* @since 2.5
*/
public final class MaintenanceBungeeAPI {
/**
* Returns API instance of IMaintenance.
*
* @return {@link IMaintenanceBungee} instance
*/
public static IMaintenanceBungee getAPI() {
final Plugin maintenance = ProxyServer.getInstance().getPluginManager().getPlugin("MaintenanceBungee");
if (maintenance == null)
ProxyServer.getInstance().getLogger().warning("Could not get instance of MaintenanceBungee!");
return (IMaintenanceBungee) ((IMaintenanceBase) maintenance).getApi();
}
}
@@ -1,30 +0,0 @@
package eu.kennytv.maintenance.api.spigot;
import eu.kennytv.maintenance.api.IMaintenance;
import eu.kennytv.maintenance.api.IMaintenanceBase;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
/**
* Utility class to get the {@link IMaintenance} instance for the Spigot version of the plugin.
* <p>
* Only access this class if you're running the plugin on a Spigot server!
* </p>
*
* @author KennyTV
* @since 2.5
*/
public final class MaintenanceSpigotAPI {
/**
* Returns API instance of IMaintenance.
*
* @return {@link IMaintenance} instance
*/
public static IMaintenance getAPI() {
final Plugin maintenance = Bukkit.getPluginManager().getPlugin("MaintenanceSpigot");
if (maintenance == null)
Bukkit.getLogger().warning("Could not get instance of MaintenanceSpigot!");
return ((IMaintenanceBase) maintenance).getApi();
}
}
-48
View File
@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maintenance-base</artifactId>
<groupId>eu.kennytv</groupId>
<version>2.5</version>
</parent>
<artifactId>maintenance-bungee</artifactId>
<name>MaintenanceBungee</name>
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>eu.kennytv</groupId>
<artifactId>maintenance-core</artifactId>
<version>${parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.13-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.minecrell</groupId>
<artifactId>ServerListPlus</artifactId>
<version>3.4.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
@@ -1,25 +0,0 @@
package eu.kennytv.maintenance.bungee;
import eu.kennytv.maintenance.api.IMaintenance;
import eu.kennytv.maintenance.api.IMaintenanceBase;
import net.md_5.bungee.api.plugin.Plugin;
import java.io.File;
public final class MaintenanceBungeeBase extends Plugin implements IMaintenanceBase {
private IMaintenance maintenance;
@Override
public void onEnable() {
maintenance = new MaintenanceBungeePlugin(this);
}
@Override
public IMaintenance getApi() {
return maintenance;
}
File getPluginFile() {
return getFile();
}
}
@@ -1,197 +0,0 @@
package eu.kennytv.maintenance.bungee;
import eu.kennytv.maintenance.api.IMaintenance;
import eu.kennytv.maintenance.api.ISettings;
import eu.kennytv.maintenance.api.bungee.IMaintenanceBungee;
import eu.kennytv.maintenance.api.bungee.MaintenanceBungeeAPI;
import eu.kennytv.maintenance.bungee.command.MaintenanceBungeeCommand;
import eu.kennytv.maintenance.bungee.command.MaintenanceBungeeCommandBase;
import eu.kennytv.maintenance.bungee.listener.PostLoginListener;
import eu.kennytv.maintenance.bungee.listener.ServerConnectListener;
import eu.kennytv.maintenance.bungee.metrics.MetricsLite;
import eu.kennytv.maintenance.bungee.runnable.SingleMaintenanceRunnable;
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
import eu.kennytv.maintenance.core.util.ServerType;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;
import net.minecrell.serverlistplus.core.plugin.ServerListPlusPlugin;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
/**
* @author KennyTV
* @since 1.0
*/
public final class MaintenanceBungeePlugin extends MaintenanceModePlugin implements IMaintenanceBungee {
private final MaintenanceBungeeBase plugin;
private final SettingsBungee settings;
private final Map<String, Integer> serverTaskIds = new HashMap<>();
MaintenanceBungeePlugin(final MaintenanceBungeeBase plugin) {
super("§8[§eMaintenanceBungee§8] ", plugin.getDescription().getVersion(), ServerType.BUNGEE);
this.plugin = plugin;
plugin.getLogger().info("Plugin by KennyTV");
plugin.getLogger().info(getUpdateMessage());
settings = new SettingsBungee(this, plugin);
final PluginManager pm = getProxy().getPluginManager();
pm.registerListener(plugin, new PostLoginListener(this, settings));
pm.registerListener(plugin, new ServerConnectListener(this, settings));
final MaintenanceBungeeCommand maintenanceCommand = new MaintenanceBungeeCommand(this, settings);
pm.registerCommand(plugin, new MaintenanceBungeeCommandBase(maintenanceCommand));
new MetricsLite(plugin);
// ServerListPlus integration
final Plugin serverListPlus = pm.getPlugin("ServerListPlus");
if (serverListPlus != null) {
serverListPlusHook = new ServerListPlusHook(((ServerListPlusPlugin) serverListPlus).getCore());
serverListPlusHook.setEnabled(!settings.isMaintenance());
plugin.getLogger().info("Enabled ServerListPlus integration!");
}
}
@Override
public void setMaintenance(final boolean maintenance) {
if (settings.getMySQL() != null) {
settings.setMaintenanceToSQL(maintenance);
} else {
settings.setMaintenance(maintenance);
settings.setToConfig("enable-maintenance-mode", maintenance);
settings.saveConfig();
settings.reloadConfigs();
}
serverActions(maintenance);
if (isTaskRunning())
cancelTask();
}
void serverActions(final boolean maintenance) {
if (serverListPlusHook != null)
serverListPlusHook.setEnabled(!maintenance);
if (maintenance) {
getProxy().getPlayers().stream()
.filter(p -> !p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId()))
.forEach(p -> p.disconnect(settings.getKickMessage().replace("%NEWLINE%", "\n")));
getProxy().broadcast(settings.getMessage("maintenanceActivated"));
} else
getProxy().broadcast(settings.getMessage("maintenanceDeactivated"));
}
@Override
public boolean isMaintenance(final ServerInfo server) {
return settings.getMaintenanceServers().contains(server.getName());
}
@Override
public boolean setMaintenanceToServer(final ServerInfo server, final boolean maintenance) {
if (maintenance) {
if (!settings.getMaintenanceServers().add(server.getName())) return false;
final ServerInfo fallback = getProxy().getServerInfo(settings.getFallbackServer());
if (fallback == null)
plugin.getLogger().warning("The fallback server set in the SpigotServers.yml could not be found! Instead kicking players from that server off the network!");
else if (fallback.equals(server))
plugin.getLogger().warning("Maintenance has been enabled on the fallback server! If a player joins on a proxied server, they will be kicked completely instead of being sent to the fallback server!");
server.getPlayers().forEach(p -> {
if (!p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId())) {
if (fallback != null && fallback.canAccess(p)) {
p.sendMessage(settings.getMessage("singleMaintenanceActivated").replace("%SERVER%", server.getName()));
p.connect(fallback);
} else
p.disconnect(settings.getMessage("singleMaintenanceKickComplete").replace("%NEWLINE%", "\n").replace("%SERVER%", server.getName()));
} else {
p.sendMessage(settings.getMessage("singleMaintenanceActivated").replace("%SERVER%", server.getName()));
}
});
} else {
if (!settings.getMaintenanceServers().remove(server.getName())) return false;
server.getPlayers().forEach(p -> p.sendMessage(settings.getMessage("singleMaintenanceDeactivated").replace("%SERVER%", server.getName())));
}
/*if (mySQL != null) {
mySQL.executeUpdate(serversQuery, "spigotServers-with-maintenance", maintenanceServers, maintenanceServers);
} else {
spigotServers.set("maintenance-on", maintenanceServers);
saveSpigotServers();
}*/
cancelSingleTask(server);
settings.saveServersToConfig();
return true;
}
@Override
public boolean isServerTaskRunning(final ServerInfo server) {
return serverTaskIds.containsKey(server.getName());
}
@Override
protected int startMaintenanceRunnable(final Runnable runnable) {
return getProxy().getScheduler().schedule(plugin, runnable, 0, 1, TimeUnit.SECONDS).getId();
}
public MaintenanceRunnableBase startSingleMaintenanceRunnable(final ServerInfo server, final int minutes, final boolean enable) {
final MaintenanceRunnableBase runnable = new SingleMaintenanceRunnable(this, (Settings) getSettings(), minutes, enable, server);
serverTaskIds.put(server.getName(), getProxy().getScheduler().schedule(plugin, runnable, 0, 1, TimeUnit.SECONDS).getId());
return runnable;
}
@Override
public void async(final Runnable runnable) {
getProxy().getScheduler().runAsync(plugin, runnable);
}
@Override
public void cancelTask() {
getProxy().getScheduler().cancel(taskId);
runnable = null;
taskId = 0;
}
public void cancelSingleTask(final ServerInfo server) {
final Integer task = serverTaskIds.remove(server.getName());
if (task != null)
getProxy().getScheduler().cancel(task);
}
@Override
public ISettings getSettings() {
return settings;
}
@Override
public File getPluginFile() {
return plugin.getPluginFile();
}
@Override
public void broadcast(final String message) {
getProxy().broadcast(message);
}
@Deprecated
public static IMaintenance getAPI() {
return MaintenanceBungeeAPI.getAPI();
}
public ProxyServer getProxy() {
return plugin.getProxy();
}
public Logger getLogger() {
return plugin.getLogger();
}
}
@@ -1,292 +0,0 @@
package eu.kennytv.maintenance.bungee;
import eu.kennytv.maintenance.bungee.listener.ProxyPingListener;
import eu.kennytv.maintenance.bungee.mysql.MySQL;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.listener.IPingListener;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.plugin.PluginManager;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.YamlConfiguration;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.sql.SQLException;
import java.util.*;
public final class SettingsBungee extends Settings {
private final String updateQuery;
private final String maintenanceQuery;
//private final String serversQuery;
private final MySQL mySQL;
private final MaintenanceBungeePlugin maintenancePlugin;
private final MaintenanceBungeeBase plugin;
private final IPingListener pingListener;
private Set<String> maintenanceServers;
private Configuration config;
private Configuration language;
private Configuration whitelist;
private Configuration spigotServers;
private String fallbackServer;
private long millisecondsToCheck;
private long lastMySQLCheck;
SettingsBungee(final MaintenanceBungeePlugin maintenancePlugin, final MaintenanceBungeeBase plugin) {
super(maintenancePlugin);
this.maintenancePlugin = maintenancePlugin;
this.plugin = plugin;
final PluginManager pm = plugin.getProxy().getPluginManager();
final ProxyPingListener listener = new ProxyPingListener(plugin, this);
pm.registerListener(plugin, listener);
pingListener = listener;
if (!plugin.getDataFolder().exists())
plugin.getDataFolder().mkdirs();
createFile("bungee-config.yml");
createFile("WhitelistedPlayers.yml");
createFile("SpigotServers.yml");
reloadConfigs();
final Configuration mySQLSection = config.getSection("mysql");
if (mySQLSection.getBoolean("use-mysql", false)) {
plugin.getLogger().info("Trying to open database connection...");
mySQL = new MySQL(mySQLSection.getString("host"),
mySQLSection.getInt("port"),
mySQLSection.getString("username"),
mySQLSection.getString("password"),
mySQLSection.getString("database"));
// Varchar as the value regarding the possibility of saving stuff like the motd as well in future updates
final String mySQLTable = mySQLSection.getString("table");
mySQL.executeUpdate("CREATE TABLE IF NOT EXISTS " + mySQLTable + " (setting VARCHAR(16) PRIMARY KEY, value VARCHAR(255))");
updateQuery = "INSERT INTO " + mySQLTable + " (setting, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = ?";
maintenanceQuery = "SELECT * FROM " + mySQLTable + " WHERE setting = ?";
//serversQuery = "INSERT INTO " + serversTable + " (setting, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = ?";
plugin.getLogger().info("Done!");
} else {
mySQL = null;
updateQuery = null;
maintenanceQuery = null;
//serversQuery = null;
}
}
private void createFile(final String name) {
final File file = new File(plugin.getDataFolder(), name);
if (!file.exists()) {
try (final InputStream in = plugin.getResourceAsStream(name)) {
Files.copy(in, file.toPath());
} catch (final IOException e) {
throw new RuntimeException("Unable to create " + name + " file for MaintenanceBungee", e);
}
}
}
@Override
public boolean updateExtraConfig() {
// 2.3.1 mysql.update-interval
if (!configContains("mysql.update-interval")) {
setToConfig("mysql.update-interval", 15);
return true;
}
return false;
}
@Override
public void reloadConfigs() {
try {
config = YamlConfiguration.getProvider(YamlConfiguration.class)
.load(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "bungee-config.yml")), StandardCharsets.UTF_8));
whitelist = YamlConfiguration.getProvider(YamlConfiguration.class).load(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
spigotServers = YamlConfiguration.getProvider(YamlConfiguration.class).load(new File(plugin.getDataFolder(), "spigotServers.yml"));
} catch (final IOException e) {
throw new RuntimeException("Unable to load Maintenance files!", e);
}
loadSettings();
createAndLoadLanguageFile();
}
private void createAndLoadLanguageFile() {
final File file = new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml");
if (!file.exists()) {
try (final InputStream in = plugin.getResourceAsStream("language-" + getLanguage() + ".yml")) {
Files.copy(in, file.toPath());
} catch (final IOException | NullPointerException e) {
plugin.getLogger().warning("Unable to provide language " + getLanguage());
if (!languageName.equals("en")) {
plugin.getLogger().warning("Falling back to default language: en");
languageName = "en";
createAndLoadLanguageFile();
return;
}
}
}
try {
language = YamlConfiguration.getProvider(YamlConfiguration.class)
.load(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml")), StandardCharsets.UTF_8));
} catch (final IOException e) {
throw new RuntimeException("Unable to load Maintenance language file!", e);
}
}
@Override
public void saveConfig() {
final File file = new File(plugin.getDataFolder(), "bungee-config.yml");
try {
YamlConfiguration.getProvider(YamlConfiguration.class).save(config, new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));
} catch (final IOException e) {
throw new RuntimeException("Unable to save bungee-config.yml!", e);
}
}
@Override
public void saveWhitelistedPlayers() {
saveFile(whitelist, "WhitelistedPlayers.yml");
}
public void saveSpigotServers() {
saveFile(spigotServers, "SpigotServers.yml");
}
private void saveFile(final Configuration config, final String name) {
final File file = new File(plugin.getDataFolder(), name);
try {
YamlConfiguration.getProvider(YamlConfiguration.class).save(config, file);
} catch (final IOException e) {
throw new RuntimeException("Unable to save " + name + "!", e);
}
}
@Override
public void loadExtraSettings() {
whitelistedPlayers.clear();
whitelist.getKeys().forEach(key -> whitelistedPlayers.put(UUID.fromString(key), whitelist.getString(key)));
fallbackServer = spigotServers.getString("fallback", "hub");
if (mySQL != null) {
final long configValue = config.getInt("mysql.update-interval");
millisecondsToCheck = configValue > 0 ? configValue * 1000 : -1;
lastMySQLCheck = 0;
}/* else {
final List<String> list = spigotServers.getStringList("maintenance-on");
maintenanceServers = list == null ? new HashSet<>() : new HashSet<>(list);
}*/
final List<String> list = spigotServers.getStringList("maintenance-on");
maintenanceServers = list == null ? new HashSet<>() : new HashSet<>(list);
}
@Override
public void setWhitelist(final String uuid, final String s) {
whitelist.set(uuid, s);
}
@Override
public String getConfigString(final String path) {
final String s = config.getString(path);
if (s == null) {
plugin.getLogger().warning("The config is missing the following string: " + path);
return "null";
}
return s;
}
@Override
public String getMessage(final String path) {
final String s = language.getString(path);
if (s == null) {
plugin.getLogger().warning("The language file is missing the following string: " + path);
return "null";
}
return ChatColor.translateAlternateColorCodes('&', s);
}
@Override
public boolean getConfigBoolean(final String path) {
return config.getBoolean(path);
}
@Override
public List<Integer> getConfigIntList(final String path) {
return config.getIntList(path);
}
@Override
public List<String> getConfigList(final String path) {
return config.getStringList(path);
}
@Override
public void setToConfig(final String path, final Object var) {
config.set(path, var);
}
@Override
public boolean configContains(final String path) {
return config.contains(path);
}
@Override
public String getColoredString(final String message) {
return ChatColor.translateAlternateColorCodes('&', message);
}
@Override
public boolean isMaintenance() {
if (mySQL != null && (millisecondsToCheck == -1 || System.currentTimeMillis() - lastMySQLCheck > millisecondsToCheck)) {
mySQL.executeQuery(maintenanceQuery, rs -> {
try {
if (rs.next()) {
final boolean databaseValue = Boolean.parseBoolean(rs.getString("value"));
if (databaseValue != maintenance)
maintenancePlugin.serverActions(maintenance);
maintenance = databaseValue;
}
} catch (final SQLException e) {
e.printStackTrace();
}
}, "maintenance");
if (millisecondsToCheck != -1)
lastMySQLCheck = System.currentTimeMillis();
}
return maintenance;
}
@Override
public boolean reloadMaintenanceIcon() {
return pingListener.loadIcon();
}
public void setMaintenanceToSQL(final boolean maintenance) {
plugin.getProxy().getScheduler().runAsync(plugin, () -> {
final String s = String.valueOf(maintenance);
mySQL.executeUpdate(updateQuery, "maintenance", s, s);
if (millisecondsToCheck != -1)
lastMySQLCheck = System.currentTimeMillis();
});
this.maintenance = maintenance;
}
public MySQL getMySQL() {
return mySQL;
}
public Set<String> getMaintenanceServers() {
return maintenanceServers;
}
public void saveServersToConfig() {
spigotServers.set("maintenance-on", new ArrayList<>(maintenanceServers));
saveSpigotServers();
}
public String getFallbackServer() {
return fallbackServer;
}
}
@@ -1,161 +0,0 @@
package eu.kennytv.maintenance.bungee.command;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.bungee.SettingsBungee;
import eu.kennytv.maintenance.bungee.util.ProxiedSenderInfo;
import eu.kennytv.maintenance.core.command.MaintenanceCommand;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
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;
public final class MaintenanceBungeeCommand extends MaintenanceCommand {
private final MaintenanceBungeePlugin plugin;
private final SettingsBungee settingsBungee;
public MaintenanceBungeeCommand(final MaintenanceBungeePlugin plugin, final SettingsBungee settings) {
super(plugin, settings, "MaintenanceBungee");
this.plugin = plugin;
settingsBungee = settings;
}
@Override
protected void addPlayerToWhitelist(final SenderInfo sender, final String name) {
final ProxiedPlayer selected = plugin.getProxy().getPlayer(name);
if (selected == null) {
sender.sendMessage(settings.getMessage("playerNotOnline"));
return;
}
if (settings.addWhitelistedPlayer(selected.getUniqueId(), selected.getName()))
sender.sendMessage(settings.getMessage("whitelistAdded").replace("%PLAYER%", selected.getName()));
else
sender.sendMessage(settings.getMessage("whitelistAlreadyAdded").replace("%PLAYER%", selected.getName()));
}
@Override
protected void removePlayerFromWhitelist(final SenderInfo sender, final String name) {
final ProxiedPlayer selected = plugin.getProxy().getPlayer(name);
if (selected == null) {
if (settings.removeWhitelistedPlayer(name))
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", name));
else
sender.sendMessage(settings.getMessage("whitelistNotFound"));
return;
}
if (settings.removeWhitelistedPlayer(selected.getUniqueId()))
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", selected.getName()));
else
sender.sendMessage(settings.getMessage("whitelistNotFound"));
}
@Override
protected 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 proxy to prevent further issues and to complete the update!" +
" If you can't do that, don't update!");
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");
((ProxiedSenderInfo) sender).sendMessage(tc);
} else
sender.sendMessage(plugin.getPrefix() + "§aYou already have the latest version of the plugin!");
}
@Override
protected void handleToggleServerCommand(final SenderInfo sender, final String args[]) {
final ServerInfo server = plugin.getProxy().getServerInfo(args[1]);
if (server == null) {
sender.sendMessage(settings.getMessage("serverNotFound"));
return;
}
final boolean maintenance = args[0].equalsIgnoreCase("on");
if (maintenance == settingsBungee.getMaintenanceServers().contains(server.getName())) {
sender.sendMessage(settings.getMessage(maintenance ? "alreadyEnabled" : "alreadyDisabled"));
return;
}
if (!plugin.setMaintenanceToServer(server, maintenance))
sender.sendMessage(settings.getMessage(maintenance ? "singleServerAlreadyEnabled" : "singleServerAlreadyDisabled"));
else if (!plugin.getProxy().getPlayer(sender.getUuid()).getServer().getInfo().equals(server))
sender.sendMessage(settings.getMessage(maintenance ? "singleMaintenanceActivated" : "singleMaintenanceDeactivated").replace("%SERVER%", server.getName()));
}
@Override
protected void handleTimerServerCommands(final SenderInfo sender, final String args[]) {
if (args[0].equalsIgnoreCase("endtimer")) {
if (checkPermission(sender, "servertimer")) return;
if (checkTimerArgs(sender, args[2], "singleEndtimerUsage")) return;
final ServerInfo server = checkSingleTimerArgs(sender, args);
if (server == null) return;
if (!plugin.isMaintenance(server)) {
sender.sendMessage(settings.getMessage("singleServerAlreadyDisabled").replace("%SERVER%", server.getName()));
return;
}
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), false);
sender.sendMessage(settings.getMessage("endtimerStarted").replace("%TIME%", runnable.getTime()));
} else if (args[0].equalsIgnoreCase("starttimer")) {
if (checkPermission(sender, "servertimer")) return;
if (checkTimerArgs(sender, args[2], "singleStarttimerUsage")) return;
final ServerInfo server = checkSingleTimerArgs(sender, args);
if (server == null) return;
if (plugin.isMaintenance(server)) {
sender.sendMessage(settings.getMessage("singleServerAlreadyEnabled").replace("%SERVER%", server.getName()));
return;
}
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), true);
sender.sendMessage(settings.getMessage("starttimerStarted").replace("%TIME%", runnable.getTime()));
} else if (args[0].equalsIgnoreCase("timer")) {
if (args[1].equalsIgnoreCase("abort") || args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("cancel")) {
if (checkPermission(sender, "servertimer")) return;
final ServerInfo server = plugin.getProxy().getServerInfo(args[2]);
if (server == null) {
sender.sendMessage(settings.getMessage("serverNotFound"));
return;
}
if (!plugin.isServerTaskRunning(server)) {
sender.sendMessage(settings.getMessage("timerNotRunning"));
return;
}
plugin.cancelSingleTask(server);
sender.sendMessage(settings.getMessage("timerCancelled"));
} else
sendUsage(sender);
}
}
@Override
protected void showMaintenanceStatus(final SenderInfo sender) {
if (settingsBungee.getMaintenanceServers().isEmpty()) {
sender.sendMessage(settings.getMessage("singleServerMaintenanceListEmpty"));
} else {
sender.sendMessage(settings.getMessage("singleServerMaintenanceList"));
settingsBungee.getMaintenanceServers().forEach(server -> sender.sendMessage("§8- §b" + server));
}
}
private ServerInfo checkSingleTimerArgs(final SenderInfo sender, final String[] args) {
final ServerInfo server = plugin.getProxy().getServerInfo(args[1]);
if (server == null) {
sender.sendMessage(settings.getMessage("serverNotFound"));
return null;
}
if (plugin.isServerTaskRunning(server)) {
sender.sendMessage(settings.getMessage("timerAlreadyRunning"));
return null;
}
return server;
}
}
@@ -1,19 +0,0 @@
package eu.kennytv.maintenance.bungee.command;
import eu.kennytv.maintenance.bungee.util.ProxiedSenderInfo;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Command;
public final class MaintenanceBungeeCommandBase extends Command {
private final MaintenanceBungeeCommand command;
public MaintenanceBungeeCommandBase(final MaintenanceBungeeCommand command) {
super("maintenance", "", "maintenancebungee");
this.command = command;
}
@Override
public void execute(final CommandSender sender, final String[] args) {
command.execute(new ProxiedSenderInfo(sender), args);
}
}
@@ -1,64 +0,0 @@
package eu.kennytv.maintenance.bungee.listener;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.bungee.SettingsBungee;
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.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public final class PostLoginListener implements Listener {
private final MaintenanceBungeePlugin plugin;
private final SettingsBungee settings;
private final Set<UUID> notifiedPlayers = new HashSet<>();
public PostLoginListener(final MaintenanceBungeePlugin plugin, final SettingsBungee settings) {
this.plugin = plugin;
this.settings = settings;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void postLogin(final PostLoginEvent event) {
final ProxiedPlayer p = event.getPlayer();
if (p.getUniqueId().toString().equals("a8179ff3-c201-4a75-bdaa-9d14aca6f83f"))
p.sendMessage("§6MaintenanceBungee §aVersion " + plugin.getVersion());
else if (settings.isMaintenance()) {
if (!p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId())) {
p.disconnect(settings.getKickMessage().replace("%NEWLINE%", "\n"));
if (settings.isJoinNotifications())
plugin.getProxy().getPlayers().stream().filter(player -> player.hasPermission("maintenance.joinnotification"))
.forEach(player -> player.sendMessage(settings.getMessage("joinNotification").replace("%PLAYER%", p.getName())));
return;
}
}
if (!p.hasPermission("maintenance.admin") || notifiedPlayers.contains(p.getUniqueId())) return;
plugin.async(() -> {
if (plugin.updateAvailable()) {
p.sendMessage(plugin.getPrefix() + "§cThere is a newer version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
notifiedPlayers.add(p.getUniqueId());
final TextComponent tc1 = new TextComponent(TextComponent.fromLegacyText(plugin.getPrefix() + " "));
final TextComponent tc2 = new TextComponent(TextComponent.fromLegacyText("§cDownload it at: §6https://www.spigotmc.org/resources/maintenancemode.40699/"));
final TextComponent click = new TextComponent(TextComponent.fromLegacyText(" §7§l§o(CLICK ME)"));
click.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/resources/maintenancemode.40699/"));
click.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aDownload the latest version").create()));
tc1.addExtra(tc2);
tc1.addExtra(click);
p.sendMessage(tc1);
}
});
}
}
@@ -1,60 +0,0 @@
package eu.kennytv.maintenance.bungee.listener;
import eu.kennytv.maintenance.bungee.MaintenanceBungeeBase;
import eu.kennytv.maintenance.bungee.SettingsBungee;
import eu.kennytv.maintenance.core.listener.IPingListener;
import net.md_5.bungee.api.Favicon;
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;
import net.md_5.bungee.event.EventPriority;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
public final class ProxyPingListener implements Listener, IPingListener {
private final MaintenanceBungeeBase plugin;
private final SettingsBungee settings;
private Favicon favicon;
public ProxyPingListener(final MaintenanceBungeeBase plugin, final SettingsBungee settings) {
this.plugin = plugin;
this.settings = settings;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void proxyPing(final ProxyPingEvent event) {
if (!settings.isMaintenance()) return;
final ServerPing ping = event.getResponse();
if (settings.hasCustomPlayerCountMessage()) {
ping.getVersion().setProtocol(1);
ping.getVersion().setName(settings.getPlayerCountMessage()
.replace("%ONLINE%", Integer.toString(ping.getPlayers().getOnline()))
.replace("%MAX%", Integer.toString(ping.getPlayers().getMax())));
}
ping.setDescription(settings.getRandomPingMessage());
ping.getPlayers().setOnline(0);
ping.getPlayers().setMax(0);
ping.getPlayers().setSample(new ServerPing.PlayerInfo[]{
new ServerPing.PlayerInfo(settings.getPlayerCountHoverMessage().replace("%NEWLINE%", "\n"), "")
});
if (settings.hasCustomIcon() && favicon != null)
ping.setFavicon(favicon);
}
@Override
public boolean loadIcon() {
try {
favicon = Favicon.create(ImageIO.read(new File("maintenance-icon.png")));
} catch (final IOException | IllegalArgumentException e) {
plugin.getLogger().warning("§4Could not load 'maintenance-icon.png' - did you create one in your Bungee folder (not the plugins folder)?");
return false;
}
return true;
}
}
@@ -1,53 +0,0 @@
package eu.kennytv.maintenance.bungee.listener;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.bungee.SettingsBungee;
import net.md_5.bungee.api.config.ServerInfo;
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 implements Listener {
private final MaintenanceBungeePlugin plugin;
private final SettingsBungee settings;
private boolean warned;
public ServerConnectListener(final MaintenanceBungeePlugin plugin, final SettingsBungee settings) {
this.plugin = plugin;
this.settings = settings;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void serverConnect(final ServerConnectEvent event) {
final ProxiedPlayer p = event.getPlayer();
final ServerInfo target = event.getTarget();
if (!settings.getMaintenanceServers().contains(target.getName())) return;
if (p.hasPermission("maintenance.bypass") || settings.getWhitelistedPlayers().containsKey(p.getUniqueId()))
return;
event.setCancelled(true);
if (settings.isJoinNotifications()) {
target.getPlayers().stream().filter(player -> player.hasPermission("maintenance.joinnotification"))
.forEach(player -> player.sendMessage(settings.getMessage("joinNotification").replace("%PLAYER%", p.getName())));
}
// Normal serverconnect
if (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) {
p.sendMessage(settings.getMessage("singleMaintenanceKick").replace("%SERVER%", target.getName()));
return;
}
// If it's the initial proxy join or a kick from another server, go back to fallback server
final ServerInfo fallback = plugin.getProxy().getServerInfo(settings.getFallbackServer());
if (fallback == null || !fallback.canAccess(p) || plugin.isMaintenance(fallback)) {
p.disconnect(settings.getMessage("singleMaintenanceKickComplete").replace("%NEWLINE%", "\n").replace("%SERVER%", target.getName()));
if (!warned) {
plugin.getLogger().warning("Could not send player to the fallback server set in the SpigotServers.yml! Instead kicking player off the network!");
warned = true;
}
} else
p.connect(fallback);
}
}
@@ -1,275 +0,0 @@
package eu.kennytv.maintenance.bungee.metrics;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.scheduler.TaskScheduler;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
public final class MetricsLite {
static {
final String defaultPackage = new String(new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's'});
final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
if (MetricsLite.class.getPackage().getName().equals(defaultPackage) || MetricsLite.class.getPackage().getName().equals(examplePackage)) {
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
}
}
public static final int B_STATS_VERSION = 1;
private static final String URL = "https://bStats.org/submitData/bungeecord";
private final Plugin plugin;
private boolean enabled;
private String serverUUID;
private boolean logFailedRequests;
private static final List<Object> knownMetricsInstances = new ArrayList<>();
public MetricsLite(final Plugin plugin) {
this.plugin = plugin;
try {
loadConfig();
} catch (final IOException e) {
plugin.getLogger().log(Level.WARNING, "Failed to load bStats config!", e);
return;
}
if (!enabled) {
return;
}
final Class<?> usedMetricsClass = getFirstBStatsClass();
if (usedMetricsClass == null) {
return;
}
if (usedMetricsClass == getClass()) {
linkMetrics(this);
startSubmitting();
} else {
try {
usedMetricsClass.getMethod("linkMetrics", Object.class).invoke(null, this);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Failed to link to first metrics class " + usedMetricsClass.getName() + "!", e);
}
}
}
}
public static void linkMetrics(final Object metrics) {
knownMetricsInstances.add(metrics);
}
public JsonObject getPluginData() {
final JsonObject data = new JsonObject();
final String pluginName = plugin.getDescription().getName();
final String pluginVersion = plugin.getDescription().getVersion();
data.addProperty("pluginName", pluginName);
data.addProperty("pluginVersion", pluginVersion);
final JsonArray customCharts = new JsonArray();
data.add("customCharts", customCharts);
return data;
}
private void startSubmitting() {
final Timer timer = new Timer(true);
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
final TaskScheduler scheduler = plugin.getProxy().getScheduler();
scheduler.schedule(plugin, () -> submitData(), 0L, TimeUnit.SECONDS);
}
}, 1000 * 60 * 2, 1000 * 60 * 30);
}
private JsonObject getServerData() {
int playerAmount = plugin.getProxy().getOnlineCount();
playerAmount = playerAmount > 500 ? 500 : playerAmount;
final int onlineMode = plugin.getProxy().getConfig().isOnlineMode() ? 1 : 0;
final String bungeecordVersion = plugin.getProxy().getVersion();
final int managedServers = plugin.getProxy().getServers().size();
final String javaVersion = System.getProperty("java.version");
final String osName = System.getProperty("os.name");
final String osArch = System.getProperty("os.arch");
final String osVersion = System.getProperty("os.version");
final int coreCount = Runtime.getRuntime().availableProcessors();
final JsonObject data = new JsonObject();
data.addProperty("serverUUID", serverUUID);
data.addProperty("playerAmount", playerAmount);
data.addProperty("managedServers", managedServers);
data.addProperty("onlineMode", onlineMode);
data.addProperty("bungeecordVersion", bungeecordVersion);
data.addProperty("javaVersion", javaVersion);
data.addProperty("osName", osName);
data.addProperty("osArch", osArch);
data.addProperty("osVersion", osVersion);
data.addProperty("coreCount", coreCount);
return data;
}
private void submitData() {
final JsonObject data = getServerData();
final JsonArray pluginData = new JsonArray();
for (final Object metrics : knownMetricsInstances) {
try {
final Object plugin = metrics.getClass().getMethod("getPluginData").invoke(metrics);
if (plugin instanceof JsonObject) {
pluginData.add((JsonObject) plugin);
}
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
}
}
data.add("plugins", pluginData);
new Thread(() -> {
try {
sendData(data);
} catch (Exception e) {
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats!", e);
}
}
}).start();
}
private void loadConfig() throws IOException {
final Path configPath = plugin.getDataFolder().toPath().getParent().resolve("bStats");
configPath.toFile().mkdirs();
final File configFile = new File(configPath.toFile(), "config.yml");
if (!configFile.exists()) {
writeFile(configFile,
"#bStats collects some data for plugin authors like how many servers are using their plugins.",
"#To honor their work, you should not disable it.",
"#This has nearly no effect on the server performance!",
"#Check out https://bStats.org/ to learn more :)",
"enabled: true",
"serverUuid: \"" + UUID.randomUUID() + "\"",
"logFailedRequests: false");
}
final Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
enabled = configuration.getBoolean("enabled", true);
serverUUID = configuration.getString("serverUuid");
logFailedRequests = configuration.getBoolean("logFailedRequests", false);
}
private Class<?> getFirstBStatsClass() {
final Path configPath = plugin.getDataFolder().toPath().getParent().resolve("bStats");
configPath.toFile().mkdirs();
final File tempFile = new File(configPath.toFile(), "temp.txt");
try {
final String className = readFile(tempFile);
if (className != null) {
try {
return Class.forName(className);
} catch (final ClassNotFoundException ignored) {
}
}
writeFile(tempFile, getClass().getName());
return getClass();
} catch (final IOException e) {
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Failed to get first bStats class!", e);
}
return null;
}
}
private String readFile(final File file) throws IOException {
if (!file.exists()) {
return null;
}
try (
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
) {
return bufferedReader.readLine();
}
}
private void writeFile(final File file, final String... lines) throws IOException {
if (!file.exists()) {
file.createNewFile();
}
try (
FileWriter fileWriter = new FileWriter(file);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)
) {
for (final String line : lines) {
bufferedWriter.write(line);
bufferedWriter.newLine();
}
}
}
private static void sendData(final JsonObject data) throws Exception {
if (data == null) {
throw new IllegalArgumentException("Data cannot be null");
}
final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
final byte[] compressedData = compress(data.toString());
connection.setRequestMethod("POST");
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.addRequestProperty("Content-Encoding", "gzip");
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
connection.setDoOutput(true);
final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.write(compressedData);
outputStream.flush();
outputStream.close();
connection.getInputStream().close();
}
private static byte[] compress(final String str) throws IOException {
if (str == null) {
return null;
}
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
gzip.write(str.getBytes(StandardCharsets.UTF_8));
gzip.close();
return outputStream.toByteArray();
}
}
@@ -1,68 +0,0 @@
package eu.kennytv.maintenance.bungee.mysql;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.function.Consumer;
public final class MySQL {
private final HikariDataSource hikariDataSource;
// Excuse me and everything to do with the MySQL stuff, I have little to no idea of how to use databases
public MySQL(final String hostname, final int port, final String username, final String password, final String database) {
final HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setMaximumPoolSize(10);
hikariConfig.addDataSourceProperty("serverName", hostname);
hikariConfig.addDataSourceProperty("user", username);
hikariConfig.addDataSourceProperty("password", password);
hikariConfig.addDataSourceProperty("url", "jdbc:mysql://" + hostname + ":" + port + "/" + database);
hikariConfig.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database);
hikariConfig.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
hikariDataSource = new HikariDataSource(hikariConfig);
}
public void executeUpdate(final String query, final Consumer<Integer> callback, final Object... objects) {
try (final Connection connection = hikariDataSource.getConnection()) {
try (final PreparedStatement preparedStatement = connection.prepareStatement(query)) {
int current = 1;
for (final Object object : objects) {
preparedStatement.setObject(current, object);
current++;
}
callback.accept(preparedStatement.executeUpdate());
}
} catch (final SQLException e) {
System.out.println("Error while executing update method: " + query);
e.printStackTrace();
}
}
public void executeQuery(final String query, final Consumer<ResultSet> callback, final Object... objects) {
try (final Connection connection = hikariDataSource.getConnection()) {
try (final PreparedStatement preparedStatement = connection.prepareStatement(query)) {
int current = 1;
for (final Object object : objects) {
preparedStatement.setObject(current, object);
current++;
}
final ResultSet resultSet = preparedStatement.executeQuery();
callback.accept(resultSet);
resultSet.close();
}
} catch (final SQLException e) {
System.out.println("Error while executing query method: " + query);
e.printStackTrace();
}
}
public void executeUpdate(final String query, final Object... objects) {
executeUpdate(query, res -> {
}, objects);
}
}
@@ -1,33 +0,0 @@
package eu.kennytv.maintenance.bungee.runnable;
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
import net.md_5.bungee.api.config.ServerInfo;
public final class SingleMaintenanceRunnable extends MaintenanceRunnableBase {
private final ServerInfo server;
public SingleMaintenanceRunnable(final MaintenanceModePlugin plugin, final Settings settings, final int minutes,
final boolean enable, final ServerInfo server) {
super(plugin, settings, minutes, enable);
this.server = server;
}
@Override
protected void finish() {
final MaintenanceBungeePlugin plugin = (MaintenanceBungeePlugin) this.plugin;
plugin.setMaintenanceToServer(server, enable);
}
@Override
protected String startMessageKey() {
return settings.getMessage("singleStarttimerBroadcast").replace("%TIME%", getTime()).replace("%SERVER%", server.getName());
}
@Override
protected String endMessageKey() {
return settings.getMessage("singleEndtimerBroadcast").replace("%TIME%", getTime()).replace("%SERVER%", server.getName());
}
}
@@ -1,40 +0,0 @@
package eu.kennytv.maintenance.bungee.util;
import eu.kennytv.maintenance.core.util.SenderInfo;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.UUID;
public final class ProxiedSenderInfo implements SenderInfo {
private final CommandSender sender;
public ProxiedSenderInfo(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
public void sendMessage(final String message) {
sender.sendMessage(message);
}
public void sendMessage(final TextComponent textComponent) {
sender.sendMessage(textComponent);
}
}
@@ -1,6 +0,0 @@
# Enables maintenance on certain Spigot servers managed by your Bungee instance(s)
# If it's enabled on a server with players on it, they will be forwarded to the fallback server (or kicked completely if not set correctly)
maintenance-on:
#- SpigotServer1
#- AnotherServer
fallback: hub
@@ -1,53 +0,0 @@
# MaintenanceBungee Plugin by KennyTV
# Enables maintenance-mode.
enable-maintenance-mode: false
# The message shown in the multiplayer server list motd.
# If you put in multiple entries, one of them will be chosen randomly on every ping.
pingmessages:
- "&cMaintenance mode!%NEWLINE%&6We will be back soon!"
#- "Another entry"
# If set to true, the message below will be shown at the top right corner of the server in the serverlist,
# where the playercount would normally be displayed.
# If set to false, the normal playercount will be shown.
# Alternatively you can use '%ONLINE%' and '%MAX% if you want to include the playercount in a custom message (e.g. '&cMaintenance &7%ONLINE%&8/&7%MAX%').
enable-playercountmessage: true
playercountmessage: "&4Maintenance"
# Is shown when you move your mouse above the text at the top right corner of the server in the serverlist,
# where the playercount would normally be displayed.
playercounthovermessage: "&cCurrently under%NEWLINE%&cmaintenance"
# Is shown when a player tries to join while maintenance is enabled and they don't have the permission to bypass it.
kickmessage: "&cThe server is currently under maintenance!%NEWLINE%Try again later!"
# If using the timer command: In what intervalls before enabling/disabling maintenance there will be a broadcast.
timer-broadcast-for-seconds: [1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1]
# If set to true, players with the maintenance.joinnotification permission will receive a message,
# that a player tried to join the server while maintenance is enabled.
send-join-notification: false
# If set to true, the server icon will be changed to maintenance-icon.png in the Bungee main/base-folder.
custom-maintenance-icon: false
# Changes the language of command feedback/messages.
# Currently available are: en (English), de (German)
language: en
# Only enable MySQL if you really know what you are doing.
mysql:
use-mysql: false
host: host
port: 3306
database: database
username: username
password: password
# A new table with this name will be created on first startup when 'use-mysql' is set to true.
table: maintenance_settings
# Requests to the database will only be made at least x seconds after the last request,
# so there won't be a request on every single ping on a server with many players.
# Set this to 0 to make a database request on every single ping.
update-interval: 15
@@ -1,6 +0,0 @@
name: ${project.name}
version: ${project.version}
main: eu.kennytv.maintenance.bungee.MaintenanceBungeeBase
author: KennyTV
softDepends: [ServerListPlus]
website: https://www.spigotmc.org/resources/maintenancemode.40699/
-29
View File
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maintenance-base</artifactId>
<groupId>eu.kennytv</groupId>
<version>2.5</version>
</parent>
<artifactId>maintenance-core</artifactId>
<name>Maintenance-Core</name>
<dependencies>
<dependency>
<groupId>net.minecrell</groupId>
<artifactId>ServerListPlus</artifactId>
<version>3.4.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>eu.kennytv</groupId>
<artifactId>maintenance-api</artifactId>
<version>${parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
@@ -1,158 +0,0 @@
package eu.kennytv.maintenance.core;
import eu.kennytv.maintenance.api.IMaintenance;
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnable;
import eu.kennytv.maintenance.core.util.ServerType;
import eu.kennytv.maintenance.core.util.Version;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public abstract class MaintenanceModePlugin implements IMaintenance {
protected final Version version;
protected ServerListPlusHook serverListPlusHook;
protected MaintenanceRunnable runnable;
protected int taskId;
private final String prefix;
private final ServerType serverType;
private Version newestVersion;
protected MaintenanceModePlugin(final String prefix, final String version, final ServerType serverType) {
this.prefix = prefix;
this.version = new Version(version);
this.serverType = serverType;
checkNewestVersion();
}
@Override
public boolean isMaintenance() {
return getSettings().isMaintenance();
}
@Override
public String getVersion() {
return version.toString();
}
@Override
public boolean isTaskRunning() {
return taskId != 0 && runnable != null;
}
public void startMaintenanceRunnable(final int minutes, final boolean enable) {
runnable = new MaintenanceRunnable(this, (Settings) getSettings(), minutes, enable);
taskId = startMaintenanceRunnable(runnable);
}
public Version getNewestVersion() {
return newestVersion;
}
protected abstract int startMaintenanceRunnable(Runnable runnable);
public abstract void async(Runnable runnable);
public abstract void cancelTask();
public abstract File getPluginFile();
public abstract void broadcast(String message);
public MaintenanceRunnable getRunnable() {
return runnable;
}
public String getPrefix() {
return prefix;
}
public ServerType getServerType() {
return serverType;
}
public String formatedTimer() {
if (!isTaskRunning()) return "-";
final int preHours = runnable.getSecondsLeft() / 60;
final int minutes = preHours % 60;
final int seconds = runnable.getSecondsLeft() % 60;
return String.format("%02d:%02d:%02d", preHours / 60, minutes, seconds);
}
public void checkNewestVersion() {
try {
final HttpURLConnection c = (HttpURLConnection) new URL("https://api.spigotmc.org/legacy/update.php?resource=40699").openConnection();
final String newVersionString = new BufferedReader(new InputStreamReader(c.getInputStream())).readLine();
final Version newVersion = new Version(newVersionString);
final boolean available = !newVersion.equals(version);
if (available)
newestVersion = newVersion;
} catch (final Exception ignored) {
}
}
public boolean updateAvailable() {
checkNewestVersion();
return version.compareTo(newestVersion) == -1;
}
public String getUpdateMessage() {
if (version.compareTo(newestVersion) == -1) {
return "§cNewest version available: §aVersion " + newestVersion + "§c, you're on §a" + version;
} else if (version.compareTo(newestVersion) != 0) {
if (version.getTag().equalsIgnoreCase("snapshot")) {
return "§cYou're running a development version, please report bugs on the Discord server (https://kennytv.eu/discord) or the GitHub tracker (https://kennytv.eu/maintenance/issues)";
} else {
return "§cYou're running a version, that doesn't exist! §cN§ai§dc§ee§5!";
}
}
return "You have the latest version of the plugin installed.";
}
public boolean installUpdate() {
try {
URL url = null;
try {
url = new URL("https://github.com/KennyTV/Maintenance/releases/download/" + newestVersion + "/Maintenance.jar");
} catch (final MalformedURLException e) {
e.printStackTrace();
}
final URLConnection conn = url.openConnection();
final InputStream is = new BufferedInputStream(conn.getInputStream());
final OutputStream os = new BufferedOutputStream(new FileOutputStream("plugins/Maintenance.tmp"));
final byte[] chunk = new byte[1024];
int chunkSize;
while ((chunkSize = is.read(chunk)) != -1) {
os.write(chunk, 0, chunkSize);
}
os.close();
final File newfile = new File("plugins/Maintenance.tmp");
final long newlength = newfile.length();
if (newlength <= 10000) {
newfile.delete();
return false;
} else {
final FileInputStream is2 = new FileInputStream(new File("plugins/Maintenance.tmp"));
final OutputStream os2 = new BufferedOutputStream(new FileOutputStream(getPluginFile()));
final byte[] chunk2 = new byte[1024];
int chunkSize2;
while ((chunkSize2 = is2.read(chunk2)) != -1)
os2.write(chunk2, 0, chunkSize2);
is2.close();
os2.close();
final File tmp = new File("plugins/Maintenance.tmp");
tmp.delete();
return true;
}
} catch (final IOException e) {
e.printStackTrace();
return false;
}
}
}
@@ -1,196 +0,0 @@
package eu.kennytv.maintenance.core;
import eu.kennytv.maintenance.api.ISettings;
import java.util.*;
public abstract class Settings implements ISettings {
private static final Random RANDOM = new Random();
protected final Map<UUID, String> whitelistedPlayers = new HashMap<>();
private final MaintenanceModePlugin plugin;
protected boolean maintenance;
private Set<Integer> broadcastIntervalls;
private List<String> pingMessages;
private String playerCountMessage;
private String playerCountHoverMessage;
private String kickMessage;
protected String languageName;
private boolean customPlayerCountMessage;
private boolean customMaintenanceIcon;
private boolean joinNotifications;
protected Settings(final MaintenanceModePlugin plugin) {
this.plugin = plugin;
}
protected void loadSettings() {
updateConfig();
pingMessages = getConfigList("pingmessages");
maintenance = getConfigBoolean("enable-maintenance-mode");
customPlayerCountMessage = getConfigBoolean("enable-playercountmessage");
customMaintenanceIcon = getConfigBoolean("custom-maintenance-icon");
joinNotifications = getConfigBoolean("send-join-notification");
broadcastIntervalls = new HashSet<>(getConfigIntList("timer-broadcast-for-seconds"));
playerCountMessage = getColoredString(getConfigString("playercountmessage"));
playerCountHoverMessage = getColoredString(getConfigString("playercounthovermessage"));
kickMessage = getColoredString(getConfigString("kickmessage"));
languageName = getConfigString("language").toLowerCase();
if (customMaintenanceIcon)
reloadMaintenanceIcon();
loadExtraSettings();
}
private void updateConfig() {
boolean fileChanged = false;
// 2.3 pingmessage -> pingmessages
if (configContains("pingmessage")) {
final List<String> list = new ArrayList<>();
list.add(getConfigString("pingmessage"));
setToConfig("pingmessages", list);
setToConfig("pingmessage", null);
fileChanged = true;
}
// 2.4 enable-playercountmessage
if (!configContains("enable-playercountmessage")) {
setToConfig("enable-playercountmessage", true);
fileChanged = true;
}
// 2.4. timer-broadcasts-for-minutes -> timer-broadcast-for-seconds
if (configContains("timer-broadcasts-for-minutes") || !configContains("timer-broadcast-for-seconds")) {
setToConfig("timer-broadcast-for-seconds", Arrays.asList(1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1));
setToConfig("timer-broadcasts-for-minutes", null);
fileChanged = true;
}
// 2.5 language
if (!configContains("language")) {
setToConfig("language", "en");
}
if (updateExtraConfig() || fileChanged) {
saveConfig();
reloadConfigs();
}
}
public boolean updateExtraConfig() {
return false;
}
public abstract void saveWhitelistedPlayers();
public abstract String getConfigString(String path);
public abstract String getMessage(String path);
public abstract boolean getConfigBoolean(String path);
public abstract List<Integer> getConfigIntList(String path);
public abstract List<String> getConfigList(String path);
public abstract void loadExtraSettings();
public abstract void setWhitelist(String uuid, String s);
public abstract void saveConfig();
public abstract void reloadConfigs();
public abstract void setToConfig(String path, Object var);
public abstract boolean configContains(String path);
public abstract String getColoredString(String s);
public List<String> getPingMessages() {
return pingMessages;
}
public Set<Integer> getBroadcastIntervalls() {
return broadcastIntervalls;
}
public String getPlayerCountMessage() {
return playerCountMessage;
}
public String getPlayerCountHoverMessage() {
return playerCountHoverMessage;
}
public String getKickMessage() {
return kickMessage;
}
public String getLanguage() {
return languageName;
}
public void setMaintenance(final boolean maintenance) {
this.maintenance = maintenance;
}
public String getRandomPingMessage() {
if (pingMessages.isEmpty()) return "";
final String s = pingMessages.size() > 1 ? pingMessages.get(RANDOM.nextInt(pingMessages.size())) : pingMessages.get(0);
return getColoredString(s.replace("%NEWLINE%", "\n").replace("%TIMER%", plugin.formatedTimer()));
}
public boolean hasCustomPlayerCountMessage() {
return customPlayerCountMessage;
}
@Override
public boolean isMaintenance() {
return maintenance;
}
@Override
public boolean isJoinNotifications() {
return joinNotifications;
}
@Override
public boolean hasCustomIcon() {
return customMaintenanceIcon;
}
@Override
public Map<UUID, String> getWhitelistedPlayers() {
return whitelistedPlayers;
}
@Override
public boolean removeWhitelistedPlayer(final UUID uuid) {
if (!whitelistedPlayers.containsKey(uuid)) return false;
whitelistedPlayers.remove(uuid);
setWhitelist(uuid.toString(), null);
saveWhitelistedPlayers();
return true;
}
@Deprecated
@Override
public boolean removeWhitelistedPlayer(final String name) {
final Map.Entry<UUID, String> entry = whitelistedPlayers.entrySet().stream().filter(e -> e.getValue().equalsIgnoreCase(name)).findAny().orElse(null);
if (entry == null) return false;
final UUID uuid = entry.getKey();
whitelistedPlayers.remove(uuid);
setWhitelist(uuid.toString(), null);
saveWhitelistedPlayers();
return true;
}
@Override
public boolean addWhitelistedPlayer(final UUID uuid, final String name) {
final boolean contains = !whitelistedPlayers.containsKey(uuid);
whitelistedPlayers.put(uuid, name);
setWhitelist(uuid.toString(), name);
saveWhitelistedPlayers();
return contains;
}
}
@@ -1,21 +0,0 @@
package eu.kennytv.maintenance.core.command;
import eu.kennytv.maintenance.core.util.SenderInfo;
final class CommandInfo {
private final String[] messages;
private final String permission;
CommandInfo(final String permission, final String... messages) {
this.messages = messages;
this.permission = permission;
}
public boolean hasPermission(final SenderInfo sender) {
return sender.hasPermission("maintenance." + permission);
}
public String[] getMessages() {
return messages;
}
}
@@ -1,317 +0,0 @@
package eu.kennytv.maintenance.core.command;
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.core.util.ServerType;
import java.util.*;
public abstract class MaintenanceCommand {
protected final MaintenanceModePlugin plugin;
protected final Settings settings;
private final List<CommandInfo> commandInfos;
private final String name;
protected MaintenanceCommand(final MaintenanceModePlugin plugin, final Settings settings, final String name) {
this.plugin = plugin;
this.settings = settings;
this.name = name;
this.commandInfos = new ArrayList<>();
addCommandInfo("reload", "§6/maintenance reload §7(Reloads the config file, whitelist file and the server-icon)");
addCommandInfo("toggle", "§6/maintenance on §7(Enables maintenance mode)", "§6/maintenance off §7(Disables maintenance mode)");
if (plugin.getServerType() == ServerType.BUNGEE) {
addCommandInfo("toggleserver", "§6/maintenance on <server> §7(Enables maintenance mode on a specific proxied server)",
"§6/maintenance off <server> §7(Disables maintenance mode on a specific proxied server)");
}
addCommandInfo("timer", "§6/maintenance starttimer <minutes> §7(After the given time in minutes, maintenance mode will be enabled)",
"§6/maintenance endtimer <minutes> §7(After the given time in minutes, maintenance mode will be disabled)",
"§6/maintenance timer abort §7(If running, the current timer will be aborted)");
if (plugin.getServerType() == ServerType.BUNGEE) {
addCommandInfo("servertimer", "§6/maintenance starttimer <server> <minutes> §7(After the given time in minutes, maintenance mode will be enabled on the given server)",
"§6/maintenance endtimer <server> <minutes> §7(After the given time in minutes, maintenance mode will be disabled on the given server)",
"§6/maintenance timer abort <server> §7(If running, the timer running for that server will be aborted)");
}
addCommandInfo("whitelist.list", "§6/maintenance whitelist §7(Shows all whitelisted players for the maintenance mode)");
addCommandInfo("whitelist.add", "§6/maintenance add <player> §7(Adds the player to the maintenance whitelist, so they can join the server even though maintenance is enabled)");
addCommandInfo("whitelist.remove", "§6/maintenance remove <player> §7(Removes the player from the maintenance whitelist)");
addCommandInfo("setmotd", "§6/maintenance setmotd <index> <1/2> <message> §7(Sets a motd for maintenance mode)", "§6/maintenance removemotd <index> §7(Removes a maintenance motd)");
addCommandInfo("motd", "§6/maintenance motd §7(Lists the currently set maintenance motds)");
addCommandInfo("update", "§6/maintenance update §7(Remotely downloads the newest version of the plugin onto your server)");
}
private void addCommandInfo(final String permission, final String... messages) {
commandInfos.add(new CommandInfo(permission, messages));
}
public void execute(final SenderInfo sender, final String[] args) {
if (checkPermission(sender, "command")) return;
if (args.length == 1) {
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off")) {
if (checkPermission(sender, "toggle")) return;
final boolean maintenance = args[0].equalsIgnoreCase("on");
if (maintenance == plugin.isMaintenance()) {
sender.sendMessage(settings.getMessage(maintenance ? "alreadyEnabled" : "alreadyDisabled"));
return;
}
plugin.setMaintenance(maintenance);
} else if (args[0].equalsIgnoreCase("reload")) {
if (checkPermission(sender, "reload")) return;
settings.reloadConfigs();
sender.sendMessage(settings.getMessage("reload"));
} else if (args[0].equalsIgnoreCase("update")) {
if (checkPermission(sender, "update")) return;
checkForUpdate(sender);
} else if (args[0].equals("forceupdate")) {
if (checkPermission(sender, "update")) return;
sender.sendMessage(settings.getMessage("updateDownloading"));
if (plugin.installUpdate())
sender.sendMessage(settings.getMessage("updateFinished"));
else
sender.sendMessage(settings.getMessage("updateFailed"));
} else if (args[0].equalsIgnoreCase("whitelist")) {
if (checkPermission(sender, "whitelist.list")) return;
final Map<UUID, String> players = settings.getWhitelistedPlayers();
if (players.isEmpty()) {
sender.sendMessage(settings.getMessage("whitelistEmtpy"));
} else if (players.size() == 1 && players.containsKey(UUID.fromString("a8179ff3-c201-4a75-bdaa-9d14aca6f83f"))) {
sender.sendMessage(settings.getMessage("whitelistEmptyDefault"));
} else {
sender.sendMessage(settings.getMessage("whitelistedPlayers"));
final String format = settings.getMessage("whitelistedPlayersFormat");
players.forEach((key, value) -> sender.sendMessage(format.replace("%NAME%", value).replace("%UUID%", key.toString())));
sender.sendMessage("");
}
} else if (args[0].equalsIgnoreCase("motd")) {
if (checkPermission(sender, "motd")) return;
sender.sendMessage(settings.getMessage("motdList"));
for (int i = 0; i < settings.getPingMessages().size(); i++) {
sender.sendMessage("§b" + (i + 1) + "§8§m---------");
for (final String motd : settings.getColoredString(settings.getPingMessages().get(i)).split("%NEWLINE%")) {
sender.sendMessage(motd);
}
}
sender.sendMessage("§8§m----------");
} else if (args[0].equalsIgnoreCase("status") && plugin.getServerType() == ServerType.BUNGEE) {
if (checkPermission(sender, "status")) return;
showMaintenanceStatus(sender);
} else
sendUsage(sender);
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("help")) {
if (!isNumeric(args[1])) {
sender.sendMessage(settings.getMessage("helpUsage"));
return;
}
sendUsage(sender, Integer.parseInt(args[1]));
} else if ((args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off")) && plugin.getServerType() == ServerType.BUNGEE) {
if (checkPermission(sender, "toggleserver")) return;
handleToggleServerCommand(sender, args);
} else if (args[0].equalsIgnoreCase("endtimer")) {
if (checkPermission(sender, "timer")) return;
if (checkTimerArgs(sender, args[1], "endtimerUsage")) return;
if (!plugin.isMaintenance()) {
sender.sendMessage(settings.getMessage("alreadyDisabled"));
return;
}
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), false);
sender.sendMessage(settings.getMessage("endtimerStarted").replace("%TIME%", plugin.getRunnable().getTime()));
} else if (args[0].equalsIgnoreCase("starttimer")) {
if (checkPermission(sender, "timer")) return;
if (checkTimerArgs(sender, args[1], "starttimerUsage")) return;
if (plugin.isMaintenance()) {
sender.sendMessage(settings.getMessage("alreadyEnabled"));
return;
}
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), true);
sender.sendMessage(settings.getMessage("starttimerStarted").replace("%TIME%", plugin.getRunnable().getTime()));
} else if (args[0].equalsIgnoreCase("timer")) {
if (args[1].equalsIgnoreCase("abort") || args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("cancel")) {
if (checkPermission(sender, "timer")) return;
if (!plugin.isTaskRunning()) {
sender.sendMessage(settings.getMessage("timerNotRunning"));
return;
}
plugin.cancelTask();
sender.sendMessage(settings.getMessage("timerCancelled"));
} else
sendUsage(sender);
} else if (args[0].equalsIgnoreCase("add")) {
if (checkPermission(sender, "whitelist.add")) return;
addPlayerToWhitelist(sender, args[1]);
} else if (args[0].equalsIgnoreCase("remove")) {
if (checkPermission(sender, "whitelist.remove")) return;
removePlayerFromWhitelist(sender, args[1]);
} else if (args[0].equalsIgnoreCase("removemotd")) {
if (checkPermission(sender, "setmotd")) return;
if (!isNumeric(args[1])) {
sender.sendMessage(settings.getMessage("removeMotdUsage"));
return;
}
if (settings.getPingMessages().size() < 2) {
sender.sendMessage(settings.getMessage("removeMotdError"));
return;
}
final int index = Integer.parseInt(args[1]);
if (index > settings.getPingMessages().size()) {
sender.sendMessage(settings.getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(settings.getPingMessages().size()))
.replace("%NEWAMOUNT%", Integer.toString(settings.getPingMessages().size())));
return;
}
settings.getPingMessages().remove(index - 1);
settings.setToConfig("pingmessages", settings.getPingMessages());
settings.saveConfig();
settings.reloadConfigs();
sender.sendMessage(settings.getMessage("removedMotd").replace("%INDEX%", args[1]));
} else
sendUsage(sender);
} else if (args.length == 3 && plugin.getServerType() == ServerType.BUNGEE) {
handleTimerServerCommands(sender, args);
} else if (args.length > 3 && args[0].equalsIgnoreCase("setmotd")) {
if (checkPermission(sender, "setmotd")) return;
if (!isNumeric(args[1])) {
sender.sendMessage(settings.getMessage("setMotdUsage"));
return;
}
final int index = Integer.parseInt(args[1]);
if (index < 1 || index > settings.getPingMessages().size() + 1) {
sender.sendMessage(settings.getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(settings.getPingMessages().size()))
.replace("%NEWAMOUNT%", Integer.toString(settings.getPingMessages().size() + 1)));
return;
}
if (!isNumeric(args[2])) {
sender.sendMessage(settings.getMessage("setMotdLineError"));
return;
}
final int line = Integer.parseInt(args[2]);
if (line != 1 && line != 2) {
sender.sendMessage(settings.getMessage("setMotdLineError"));
return;
}
final String message = String.join(" ", Arrays.copyOfRange(args, 3, args.length));
final String oldMessage = index > settings.getPingMessages().size() ? "" : settings.getPingMessages().get(index - 1);
final String newMessage;
if (line == 1)
newMessage = oldMessage.contains("%NEWLINE%") ?
message + "%NEWLINE%" + oldMessage.split("%NEWLINE%", 2)[1] : message;
else
newMessage = oldMessage.contains("%NEWLINE%") ?
oldMessage.split("%NEWLINE%", 2)[0] + "%NEWLINE%" + message : oldMessage + "%NEWLINE%" + message;
if (index > settings.getPingMessages().size())
settings.getPingMessages().add(newMessage);
else
settings.getPingMessages().set(index - 1, newMessage);
settings.setToConfig("pingmessages", settings.getPingMessages());
settings.saveConfig();
settings.reloadConfigs();
sender.sendMessage(settings.getMessage("setMotd").replace("%LINE%", args[2]).replace("%INDEX%", args[1])
.replace("%MOTD%", "§f" + settings.getColoredString(message)));
} else
sendUsage(sender);
}
protected void sendUsage(final SenderInfo sender) {
sendUsage(sender, 1);
}
private static final int COMMANDS_PER_PAGE = 8;
protected void sendUsage(final SenderInfo sender, final int page) {
final List<String> commands = new ArrayList<>();
commandInfos.stream().filter(cmd -> cmd.hasPermission(sender)).forEach(cmd -> {
for (String message : cmd.getMessages()) {
commands.add(message);
}
});
if ((page - 1) * COMMANDS_PER_PAGE > commands.size()) {
sender.sendMessage(plugin.getPrefix() + "§cThere is no page with that number!");
return;
}
final List<String> filteredCommands;
if (page * COMMANDS_PER_PAGE >= commands.size())
filteredCommands = commands.subList((page - 1) * COMMANDS_PER_PAGE, commands.size());
else
filteredCommands = commands.subList((page - 1) * COMMANDS_PER_PAGE, page * COMMANDS_PER_PAGE);
sender.sendMessage("");
sender.sendMessage("§8========[ §e" + name + " §8| §eVersion: §e" + plugin.getVersion() + " §8]========");
filteredCommands.forEach(sender::sendMessage);
if (page * 10 < commands.size())
sender.sendMessage("§7Use §b/maintenance help " + (page + 1) + " §7to get to the next help window.");
else
sender.sendMessage("§8× §7Created by §bKennyTV");
sender.sendMessage("§8========[ §e" + name + " §8| §e" + page + "/" + ((commands.size() + getDivide(commands.size())) / COMMANDS_PER_PAGE) + " §8]========");
sender.sendMessage("");
}
private int getDivide(final int size) {
final int commandSize = size % COMMANDS_PER_PAGE;
return commandSize > 0 ? COMMANDS_PER_PAGE - commandSize : 0;
}
protected boolean checkTimerArgs(final SenderInfo sender, final String time, final String usageKey) {
if (!isNumeric(time)) {
sender.sendMessage(settings.getMessage(usageKey));
return true;
}
if (plugin.isTaskRunning()) {
sender.sendMessage(settings.getMessage("timerAlreadyRunning"));
return true;
}
final int minutes = Integer.parseInt(time);
if (minutes > 40320) {
sender.sendMessage(settings.getMessage("timerTooLong"));
return true;
}
if (minutes < 1) {
sender.sendMessage("§8§o[KennyTV whispers to you] §c§oThink about running a timer for a negative amount of minutes. Doesn't work §lthat §c§owell.");
return true;
}
return false;
}
protected boolean checkPermission(final SenderInfo sender, final String permission) {
if (!sender.hasPermission("maintenance." + permission)) {
sender.sendMessage(settings.getMessage("noPermission"));
return true;
}
return false;
}
protected boolean isNumeric(final String string) {
try {
Integer.parseInt(string);
} catch (final NumberFormatException nfe) {
return false;
}
return true;
}
protected abstract void addPlayerToWhitelist(SenderInfo sender, String name);
protected abstract void removePlayerFromWhitelist(SenderInfo sender, String name);
protected abstract void checkForUpdate(SenderInfo sender);
protected void showMaintenanceStatus(SenderInfo sender) {
}
protected void handleToggleServerCommand(SenderInfo sender, String args[]) {
}
protected void handleTimerServerCommands(SenderInfo sender, String args[]) {
}
}
@@ -1,15 +0,0 @@
package eu.kennytv.maintenance.core.hook;
import net.minecrell.serverlistplus.core.ServerListPlusCore;
public final class ServerListPlusHook {
private final ServerListPlusCore serverListPlusCore;
public ServerListPlusHook(final ServerListPlusCore serverListPlusCore) {
this.serverListPlusCore = serverListPlusCore;
}
public void setEnabled(final boolean enable) {
serverListPlusCore.getProfiles().setEnabled(enable);
}
}
@@ -1,6 +0,0 @@
package eu.kennytv.maintenance.core.listener;
public interface IPingListener {
boolean loadIcon();
}
@@ -1,26 +0,0 @@
package eu.kennytv.maintenance.core.runnable;
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
import eu.kennytv.maintenance.core.Settings;
public final class MaintenanceRunnable extends MaintenanceRunnableBase {
public MaintenanceRunnable(final MaintenanceModePlugin plugin, final Settings settings, final int minutes, final boolean enable) {
super(plugin, settings, minutes, enable);
}
@Override
protected void finish() {
plugin.setMaintenance(enable);
}
@Override
protected String startMessageKey() {
return settings.getMessage("starttimerBroadcast").replace("%TIME%", getTime());
}
@Override
protected String endMessageKey() {
return settings.getMessage("endtimerBroadcast").replace("%TIME%", getTime());
}
}
@@ -1,61 +0,0 @@
package eu.kennytv.maintenance.core.runnable;
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
import eu.kennytv.maintenance.core.Settings;
public abstract class MaintenanceRunnableBase implements Runnable {
protected final MaintenanceModePlugin plugin;
protected final Settings settings;
protected final boolean enable;
protected int seconds;
protected MaintenanceRunnableBase(final MaintenanceModePlugin plugin, final Settings settings, final int minutes, final boolean enable) {
this.plugin = plugin;
this.settings = settings;
this.seconds = minutes * 60;
this.enable = enable;
}
@Override
public void run() {
if (seconds == 0) {
finish();
} else if (settings.getBroadcastIntervalls().contains(seconds)) {
if (enable)
plugin.broadcast(startMessageKey());
else
plugin.broadcast(endMessageKey());
}
seconds--;
}
protected abstract void finish();
protected abstract String startMessageKey();
protected abstract String endMessageKey();
public String getTime() {
final int preHours = this.seconds / 60;
final int minutes = preHours % 60;
final int seconds = this.seconds % 60;
final StringBuilder buider = new StringBuilder();
append(buider, "hour", preHours / 60);
append(buider, "minute", minutes);
append(buider, "second", seconds);
return buider.toString();
}
private void append(final StringBuilder builder, final String timeUnit, final int time) {
if (time == 0) return;
if (builder.length() != 0)
builder.append(" ");
builder.append(time).append(" ").append(settings.getMessage(time == 1 ? timeUnit : timeUnit + "s"));
}
public int getSecondsLeft() {
return seconds;
}
}
@@ -1,14 +0,0 @@
package eu.kennytv.maintenance.core.util;
import java.util.UUID;
public interface SenderInfo {
UUID getUuid();
String getName();
boolean hasPermission(String permission);
void sendMessage(String message);
}
@@ -1,7 +0,0 @@
package eu.kennytv.maintenance.core.util;
public enum ServerType {
BUNGEE,
SPIGOT
}
@@ -1,76 +0,0 @@
package eu.kennytv.maintenance.core.util;
public final class Version implements Comparable<Version> {
private final int[] parts = new int[3];
private final String version;
private final String tag;
public Version(final String version) {
if (version == null || version.isEmpty()) {
this.version = "";
tag = "";
System.out.println("Unknown Maintenance version detected!");
return;
}
final String[] split = version.split("-", 2)[0].split("\\.");
for (int i = 0; i < split.length; i++) {
if (!isNumeric(split[i])) {
this.version = "";
tag = "";
System.out.println("Unknown Maintenance version detected!");
return;
}
parts[i] = Integer.parseInt(split[i]);
}
this.version = version;
tag = version.contains("-") ? version.split("-", 2)[1] : "";
}
/**
* Compare two versions
*
* @param version version to compare to
* @return 0 if they are the same, 1 if this version (not the one to compare to) is newer, -1 if older
*/
@Override
public int compareTo(final Version version) {
if (version == null || version.toString() == null) return 0;
final int max = Math.max(this.parts.length, version.parts.length);
for (int i = 0; i < max; i += 1) {
final int partA = i < this.parts.length ? this.parts[i] : 0;
final int partB = i < version.parts.length ? version.parts[i] : 0;
if (partA < partB) return -1;
if (partA > partB) return 1;
}
if (this.tag.isEmpty() && !version.tag.isEmpty())
return 1;
if (!this.tag.isEmpty() && version.tag.isEmpty())
return -1;
return 0;
}
public String getTag() {
return tag;
}
@Override
public String toString() {
return version;
}
@Override
public boolean equals(final Object o) {
return o instanceof Version && o == this || version.equals(o.toString());
}
private boolean isNumeric(final String string) {
try {
Integer.parseInt(string);
} catch (final NumberFormatException nfe) {
return false;
}
return true;
}
}
@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -1 +0,0 @@
a8179ff3-c201-4a75-bdaa-9d14aca6f83f: KennyTV
@@ -1,64 +0,0 @@
# Maintenance Plugin by KennyTV
# Wörter zwischen dem '%'-Zeichen nur entfernen, wenn Du wirklich weißt, warum Du sie entfernen willst
noPermission: "&cDu hast nicht die erforderliche Berechtigung für diesen Befehl."
maintenanceActivated: "&8[&eMaintenance&8] &6Der Wartungsmodus ist nun aktiviert."
maintenanceDeactivated: "&8[&eMaintenance&8] &6Der Wartungsmodus ist nun deaktiviert."
alreadyEnabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits aktiviert!"
alreadyDisabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits deaktiviert!"
helpUsage: "&8[&eMaintenance&8] &c/maintenance help <Seite>"
endtimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus wird deaktiviert in: &6%TIME%&7."
endtimerStarted: "&8[&eMaintenance&8] &aGestarteter Timer: &7Der Wartungsmodus wird deaktiviert in: &6%TIME%&7."
endtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <Minuten>"
starttimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus wird aktiviert in: &6%TIME%&7."
starttimerStarted: "&8[&eMaintenance&8] &aGestarteter Timer: &7Der Wartungsmodus wird aktiviert in: &6%TIME%&7"
starttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <Minuten>"
timerAlreadyRunning: "&8[&eMaintenance&8] &cMomentan läuft bereits ein Timer!"
timerNotRunning: "&8[&eMaintenance&8] &cMomentan läuft kein Timer."
timerCancelled: "&8[&eMaintenance&8] &cDer laufende Timer wurde beendet."
timerTooLong: "&8[&eMaintenance&8] &cDie angegebene Nummer muss kleiner als 40320 sein (= 28 Tage)!"
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &chat versucht den Server beizutreten."
motdList: "&8[&eMaintenance&8] &7Liste der Maintenance MOTDs:"
reload: "&8[&eMaintenance&8] &aConfig, WhitelistedPlayers, Language Datei und Maintenance Icon wurden neugeladen."
removedMotd: "&8[&eMaintenance&8] &aDie %INDEX%. Maintenance MOTD wurde entfernt."
removeMotdError: "&8[&eMaintenance&8] &cDu hast nur eine Maintenance MOTD, daher kannst du auch keine entfernen!"
removeMotdUsage: "&8[&eMaintenance&8] &c/maintenance removemotd <Index>"
serverNotFound: "&8[&eMaintenance&8] &cEs wurde kein Server mit diesem Namen gefunden!"
setMotd: "&8[&eMaintenance&8] &aDie %LINE%. Zeile der %INDEX%. Maintenance MOTD wurde geändert zu: %MOTD%"
setMotdUsage: "&8[&eMaintenance&8] &c/maintenance setmotd <Index> <1/2> <Text>"
setMotdIndexError: "&8[&eMaintenance&8] §cMomentan gibt es %MOTDS% MOTDs, du musst also eine Zahl zwischen 1 and %NEWAMOUNT% wählen."
setMotdLineError: "&8[&eMaintenance&8] &cDas zweite Argument muss die Zeilennummer sein (1 oder 2)!"
updateDownloading: "&8[&eMaintenance&8] &c&lUpdate wird heruntergeladen..."
updateFailed: "&8[&eMaintenance&8] &4&lUpdate fehlgeschlagen!"
updateFinished: "&8[&eMaintenance&8] &a&lDas Update war erfolgreich! Um Probleme mit Timern zu vermeiden und das Update zu vervollständigen, musst du den Server neustarten!"
whitelistedPlayers: "&8[&eMaintenance&8] &6Spieler in der Maintenance Whitelist:"
whitelistedPlayersFormat: "&8- &e%NAME% &8(&7%UUID%&8)"
whitelistAdded: "&8[&eMaintenance&8] &b%PLAYER% &awurde zur Maintenance Whitelist hinzugefügt!"
whitelistAlreadyAdded: "&8[&eMaintenance&8] &b%PLAYER% &cist bereits in der Maintenance Whitelist!"
whitelistRemoved: "&8[&eMaintenance&8] &b%PLAYER% &awurde von der Maintenance Whitelist entfernt!"
whitelistNotFound: "&8[&eMaintenance&8] &cDieser Spieler ist nicht in der Maintenance Whitelist!"
whitelistEmtpy: "&8[&eMaintenance&8] &cDie Maintenance Whitelist ist leer! Nutze '/maintenance add <Spieler>', um jemanden hinzuzufügen!"
whitelistEmptyDefault: "&8[&eMaintenance&8] &cNutze '/maintenance add <player>', um jemanden hinzuzufügen. Ansonsten kannst auch die UUID des Spielers in die WhitelistedPlayers.yml einsetzen, wie es im dortigen Beispiel schon drinsteht!"
playerNotFound: "&8[&eMaintenance&8] &cBisher hat kein Spieler mit diesem Namen jemals auf diesem Server gespielt."
playerNotOnline: "&8[&eMaintenance&8] &cEs ist momentan kein Spieler mit diesem Namen online."
second: "Sekunde"
seconds: "Sekunden"
minute: "Minute"
minutes: "Minuten"
hour: "Stunde"
hours: "Stunden"
# Nachrichten für den Bungee Teil des Plugins, einfach ignorieren, falls das Plugin auf Spigot verwendet wird
singleEndtimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus auf Server %SERVER% wird deaktiviert in: &6%TIME%&7."
singleEndtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <Server> <Minuten>"
singleStarttimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus auf Server %SERVER% wird aktiviert in: &6%TIME%&7."
singleStarttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <Server> <Minuten>"
singleMaintenanceKick: "&8[&eMaintenance&8] &cDer Server %SERVER% befindet sich momentan im Wartungsmodus! Probier es später nochmal!"
singleMaintenanceKickComplete: "&cDer Server %SERVER% befindet sich in Wartung!%NEWLINE%&cDu kannst versuchen zu rejoinen, um andere Server zu betreten!"
singleMaintenanceActivated: "&8[&eMaintenance&8] &6Der Wartungsmodus wurde auf &e%SERVER% &6aktiviert."
singleMaintenanceDeactivated: "&8[&eMaintenance&8] &6Der Wartungsmodus wurde auf &e%SERVER% &6deaktiviert."
singleServerAlreadyEnabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits an auf &e%SERVER%&c!"
singleServerAlreadyDisabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits aus auf &e%SERVER%&c!"
singleServerMaintenanceList: "&8[&eMaintenance&8] &7Unterserverserver, die im Wartungsmodus sind:"
singleServerMaintenanceListEmpty: "&8[&eMaintenance&8] &7Es befindet sich momentan kein Unterserver im Wartungsmodus."
@@ -1,64 +0,0 @@
# Maintenance Plugin by KennyTV
# Don't remove words inbetween the '%' if you don't exactly know why you're doing it
noPermission: "&cYou do not have the permission to execute that command."
maintenanceActivated: "&8[&eMaintenance&8] &6Maintenance mode is now activated."
maintenanceDeactivated: "&8[&eMaintenance&8] &6Maintenance mode is now deactivated."
alreadyEnabled: "&8[&eMaintenance&8] &cMaintenance is already enabled!"
alreadyDisabled: "&8[&eMaintenance&8] &cMaintenance is already disabled!"
helpUsage: "&8[&eMaintenance&8] &c/maintenance help <page>"
endtimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode will be disabled in &6%TIME%&7."
endtimerStarted: "&8[&eMaintenance&8] &aStarted timer: &7Maintenance mode will be deactivated in &6%TIME%&7."
endtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <minutes>"
starttimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode will be enabled in &6%TIME%&7."
starttimerStarted: "&8[&eMaintenance&8] &aStarted timer: &7Maintenance mode will be activated in &6%TIME%&7."
starttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <minutes>"
timerAlreadyRunning: "&8[&eMaintenance&8] &cThere's already a timer scheduled!"
timerNotRunning: "&8[&eMaintenance&8] &cThere's currently no running timer."
timerCancelled: "&8[&eMaintenance&8] &cThe current timer has been disabled."
timerTooLong: "&8[&eMaintenance&8] &cThe number has to be less than 40320 (28 days)!"
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &ctried to join the server."
motdList: "&8[&eMaintenance&8] &7List of your maintenance motds:"
reload: "&8[&eMaintenance&8] &aReloaded config, whitelistedplayers, language file and the maintenance icon."
removedMotd: "&8[&eMaintenance&8] &aRemoved motd number %INDEX%."
removeMotdError: "&8[&eMaintenance&8] &cYou only have one motd, so you can't remove any!"
removeMotdUsage: "&8[&eMaintenance&8] &c/maintenance removemotd <index>"
serverNotFound: "&8[&eMaintenance&8] &cNo server with this name is registered on the proxy!"
setMotd: "&8[&eMaintenance&8] &aSet line %LINE% of the %INDEX%. maintenance motd to %MOTD%"
setMotdUsage: "&8[&eMaintenance&8] &c/maintenance setmotd <index> <1/2> <message>"
setMotdIndexError: "&8[&eMaintenance&8] §cYou currently have %MOTDS% motds, so you have to pick a number between 1 and %NEWAMOUNT%."
setMotdLineError: "&8[&eMaintenance&8] &cThe second argument has to be the line number (1 or 2)!"
updateDownloading: "&8[&eMaintenance&8] &c&lDownloading update..."
updateFailed: "&8[&eMaintenance&8] &4&lUpdate failed!"
updateFinished: "&8[&eMaintenance&8] &a&lThe update was successful! To prevent issues with tasks and to complete the update, you have to restart the server!"
whitelistedPlayers: "&8[&eMaintenance&8] &6Whitelisted players for maintenance:"
whitelistedPlayersFormat: "&8- &e%NAME% &8(&7%UUID%&8)"
whitelistAdded: "&8[&eMaintenance&8] &aAdded &b%PLAYER% &ato the maintenance whitelist!"
whitelistAlreadyAdded: "&8[&eMaintenance&8] &b%PLAYER% &calready is in the maintenance whitelist!"
whitelistRemoved: "&8[&eMaintenance&8] &aRemoved &b%PLAYER% &afrom the maintenance whitelist!"
whitelistNotFound: "&8[&eMaintenance&8] &cThis player is not in the maintenance whitelist!"
whitelistEmtpy: "&8[&eMaintenance&8] &cThe maintenance whitelist is empty! Use '/maintenance add <player>' to add someone!"
whitelistEmptyDefault: "&8[&eMaintenance&8] &cUse '/maintenance add <player>' to add someone. Alternatively, you can add the uuid of a player to the WhitelistedPlayers.yml as seen in the example in the file!"
playerNotFound: "&8[&eMaintenance&8] &cNo player with this name has played on this server before."
playerNotOnline: "&8[&eMaintenance&8] &cThere's no player online with that name."
second: "second"
seconds: "seconds"
minute: "minute"
minutes: "minutes"
hour: "hour"
hours: "hours"
# Some messages for the Bungee part, just ignore them if you use the plugin on Spigot
singleEndtimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode on server %SERVER% will be disabled in &6%TIME%&7."
singleEndtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <server> <minutes>"
singleStarttimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode on server %SERVER% will be enabled in &6%TIME%&7."
singleStarttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <server> <minutes>"
singleMaintenanceKick: "&8[&eMaintenance&8] &cThe server %SERVER% is currently under maintenance! Try again later!"
singleMaintenanceKickComplete: "&cThe server %SERVER% is under maintenance!%NEWLINE%&cYou may try to rejoin to go onto another server!"
singleMaintenanceActivated: "&8[&eMaintenance&8] &6Maintenance mode is now activated on server &e%SERVER%&6."
singleMaintenanceDeactivated: "&8[&eMaintenance&8] &6Maintenance mode is now deactivated on server &e%SERVER%&6."
singleServerAlreadyEnabled: "&8[&eMaintenance&8] &cMaintenance is already enabled on server &e%SERVER%&c!"
singleServerAlreadyDisabled: "&8[&eMaintenance&8] &cMaintenance is already disabled on server &e%SERVER%&c!"
singleServerMaintenanceList: "&8[&eMaintenance&8] &7Proxied servers, that have maintenance enabled:"
singleServerMaintenanceListEmpty: "&8[&eMaintenance&8] &7There are no proxied servers that are under maintenance."
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maintenance-base</artifactId>
<groupId>eu.kennytv</groupId>
<version>2.5</version>
</parent>
<artifactId>maintenance-parent</artifactId>
<name>Maintenance</name>
<dependencies>
<dependency>
<groupId>eu.kennytv</groupId>
<artifactId>maintenance-core</artifactId>
<version>${parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.kennytv</groupId>
<artifactId>maintenance-bungee</artifactId>
<version>${parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.kennytv</groupId>
<artifactId>maintenance-spigot</artifactId>
<version>${parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
-52
View File
@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maintenance-base</artifactId>
<groupId>eu.kennytv</groupId>
<version>2.5</version>
</parent>
<artifactId>maintenance-spigot</artifactId>
<name>MaintenanceSpigot</name>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>dmulloy2-repo</id>
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>eu.kennytv</groupId>
<artifactId>maintenance-core</artifactId>
<version>${parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.minecrell</groupId>
<artifactId>ServerListPlus</artifactId>
<version>3.4.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib-API</artifactId>
<version>4.4.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -1,25 +0,0 @@
package eu.kennytv.maintenance.spigot;
import eu.kennytv.maintenance.api.IMaintenance;
import eu.kennytv.maintenance.api.IMaintenanceBase;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
public final class MaintenanceSpigotBase extends JavaPlugin implements IMaintenanceBase {
private IMaintenance maintenance;
@Override
public void onEnable() {
maintenance = new MaintenanceSpigotPlugin(this);
}
File getPluginFile() {
return getFile();
}
@Override
public IMaintenance getApi() {
return maintenance;
}
}
@@ -1,113 +0,0 @@
package eu.kennytv.maintenance.spigot;
import eu.kennytv.maintenance.api.IMaintenance;
import eu.kennytv.maintenance.api.ISettings;
import eu.kennytv.maintenance.api.spigot.MaintenanceSpigotAPI;
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
import eu.kennytv.maintenance.core.util.ServerType;
import eu.kennytv.maintenance.spigot.command.MaintenanceSpigotCommand;
import eu.kennytv.maintenance.spigot.listener.PlayerLoginListener;
import eu.kennytv.maintenance.spigot.metrics.MetricsLite;
import net.minecrell.serverlistplus.core.plugin.ServerListPlusPlugin;
import org.bukkit.Server;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import java.io.File;
/**
* @author KennyTV
* @since 2.0
*/
public final class MaintenanceSpigotPlugin extends MaintenanceModePlugin {
private final MaintenanceSpigotBase plugin;
private final SettingsSpigot settings;
MaintenanceSpigotPlugin(final MaintenanceSpigotBase plugin) {
super("§8[§eMaintenanceSpigot§8] ", plugin.getDescription().getVersion(), ServerType.SPIGOT);
this.plugin = plugin;
settings = new SettingsSpigot(this, plugin);
plugin.getLogger().info("Plugin by KennyTV");
plugin.getLogger().info(getUpdateMessage());
plugin.getCommand("maintenancespigot").setExecutor(new MaintenanceSpigotCommand(this, settings));
final PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new PlayerLoginListener(this, settings), plugin);
new MetricsLite(plugin);
// ServerListPlus integration
final Plugin serverListPlus = pm.getPlugin("ServerListPlus");
if (serverListPlus != null) {
serverListPlusHook = new ServerListPlusHook(((ServerListPlusPlugin) serverListPlus).getCore());
serverListPlusHook.setEnabled(!settings.isMaintenance());
plugin.getLogger().info("Enabled ServerListPlus integration!");
}
}
@Override
public void setMaintenance(final boolean maintenance) {
settings.setMaintenance(maintenance);
settings.setToConfig("enable-maintenance-mode", maintenance);
settings.saveConfig();
settings.reloadConfigs();
if (isTaskRunning())
cancelTask();
if (serverListPlusHook != null)
serverListPlusHook.setEnabled(!maintenance);
if (maintenance) {
getServer().getOnlinePlayers().stream()
.filter(p -> !p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId()))
.forEach(p -> p.kickPlayer(settings.getKickMessage().replace("%NEWLINE%", "\n")));
getServer().broadcastMessage(settings.getMessage("maintenanceActivated"));
} else
getServer().broadcastMessage(settings.getMessage("maintenanceDeactivated"));
}
@Override
public int startMaintenanceRunnable(final Runnable runnable) {
return getServer().getScheduler().scheduleSyncRepeatingTask(plugin, runnable, 0, 20);
}
@Override
public void async(final Runnable runnable) {
getServer().getScheduler().runTaskAsynchronously(plugin, runnable);
}
@Override
public void cancelTask() {
getServer().getScheduler().cancelTask(taskId);
runnable = null;
taskId = 0;
}
@Override
public ISettings getSettings() {
return settings;
}
@Override
public File getPluginFile() {
return plugin.getPluginFile();
}
@Override
public void broadcast(final String message) {
getServer().broadcastMessage(message);
}
@Deprecated
public static IMaintenance getAPI() {
return MaintenanceSpigotAPI.getAPI();
}
public Server getServer() {
return plugin.getServer();
}
}
@@ -1,184 +0,0 @@
package eu.kennytv.maintenance.spigot;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.listener.IPingListener;
import eu.kennytv.maintenance.spigot.listener.PacketListener;
import eu.kennytv.maintenance.spigot.listener.ServerListPingListener;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.PluginManager;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;
import java.util.UUID;
public final class SettingsSpigot extends Settings {
private final MaintenanceSpigotBase plugin;
private final IPingListener pingListener;
private FileConfiguration config;
private FileConfiguration language;
private FileConfiguration whitelist;
SettingsSpigot(final MaintenanceSpigotPlugin pl, final MaintenanceSpigotBase plugin) {
super(pl);
this.plugin = plugin;
final PluginManager pm = plugin.getServer().getPluginManager();
if (pm.getPlugin("ProtocolLib") != null) {
pingListener = new PacketListener(plugin, this);
} else {
final ServerListPingListener listener = new ServerListPingListener(plugin, this);
pm.registerEvents(listener, plugin);
pingListener = listener;
}
if (!plugin.getDataFolder().exists())
plugin.getDataFolder().mkdirs();
createFile("spigot-config.yml");
createFile("WhitelistedPlayers.yml");
reloadConfigs();
}
private void createFile(final String name) {
final File file = new File(plugin.getDataFolder(), name);
if (!file.exists()) {
try (final InputStream in = plugin.getResource(name)) {
Files.copy(in, file.toPath());
} catch (final IOException e) {
throw new RuntimeException("Unable to create " + name + " file for Maintenance!", e);
}
}
}
private void createAndLoadLanguageFile() {
final File file = new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml");
if (!file.exists()) {
try (final InputStream in = plugin.getResource("language-" + getLanguage() + ".yml")) {
Files.copy(in, file.toPath());
} catch (final IOException e) {
plugin.getLogger().warning("Unable to provide language " + getLanguage());
if (!languageName.equals("en")) {
plugin.getLogger().warning("Falling back to default language: en");
languageName = "en";
createAndLoadLanguageFile();
return;
}
}
}
try {
language = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml")), StandardCharsets.UTF_8));
} catch (final IOException e) {
throw new RuntimeException("Unable to load Maintenance language file!", e);
}
}
@Override
public boolean updateExtraConfig() {
// Remove MySQL part from default config
/*if (configContains("mysql")) {
setToConfig("mysql", null);
return true;
}*/
return false;
}
@Override
public void saveConfig() {
try {
config.save(new File(plugin.getDataFolder(), "spigot-config.yml"));
} catch (final IOException e) {
e.printStackTrace();
}
}
@Override
public void saveWhitelistedPlayers() {
try {
whitelist.save(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
} catch (final IOException e) {
e.printStackTrace();
}
}
@Override
public void reloadConfigs() {
try {
config = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "spigot-config.yml")), StandardCharsets.UTF_8));
whitelist = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
} catch (final IOException e) {
throw new RuntimeException("Unable to load Maintenance files!", e);
}
loadSettings();
createAndLoadLanguageFile();
}
@Override
public void loadExtraSettings() {
whitelistedPlayers.clear();
whitelist.getKeys(false).forEach(key -> whitelistedPlayers.put(UUID.fromString(key), whitelist.getString(key)));
}
@Override
public void setWhitelist(final String uuid, final String s) {
whitelist.set(uuid, s);
}
@Override
public String getConfigString(final String path) {
final String s = config.getString(path);
if (s == null) {
plugin.getLogger().warning("The config is missing the following string: " + path);
return "null";
}
return s;
}
@Override
public String getMessage(final String path) {
final String s = language.getString(path);
if (s == null) {
plugin.getLogger().warning("The language file is missing the following string: " + path);
return "null";
}
return ChatColor.translateAlternateColorCodes('&', s);
}
@Override
public boolean getConfigBoolean(final String path) {
return config.getBoolean(path);
}
@Override
public List<Integer> getConfigIntList(final String path) {
return config.getIntegerList(path);
}
@Override
public List<String> getConfigList(final String path) {
return config.getStringList(path);
}
@Override
public void setToConfig(final String path, final Object var) {
config.set(path, var);
}
@Override
public boolean configContains(final String path) {
return config.contains(path);
}
@Override
public String getColoredString(final String message) {
return ChatColor.translateAlternateColorCodes('&', message);
}
@Override
public boolean reloadMaintenanceIcon() {
return pingListener.loadIcon();
}
}
@@ -1,83 +0,0 @@
package eu.kennytv.maintenance.spigot.command;
import eu.kennytv.maintenance.core.command.MaintenanceCommand;
import eu.kennytv.maintenance.core.util.SenderInfo;
import eu.kennytv.maintenance.spigot.MaintenanceSpigotPlugin;
import eu.kennytv.maintenance.spigot.SettingsSpigot;
import eu.kennytv.maintenance.spigot.util.BukkitSenderInfo;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public final class MaintenanceSpigotCommand extends MaintenanceCommand implements CommandExecutor {
public MaintenanceSpigotCommand(final MaintenanceSpigotPlugin plugin, final SettingsSpigot settings) {
super(plugin, settings, "MaintenanceSpigot");
}
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String s, final String[] args) {
execute(new BukkitSenderInfo(sender), args);
return true;
}
@Override
protected void addPlayerToWhitelist(final SenderInfo sender, final String name) {
final Player selected = Bukkit.getPlayer(name);
if (selected != null) {
if (settings.addWhitelistedPlayer(selected.getUniqueId(), selected.getName()))
sender.sendMessage(settings.getMessage("whitelistAdded").replace("%PLAYER%", selected.getName()));
else
sender.sendMessage(settings.getMessage("whitelistAlreadyAdded").replace("%PLAYER%", selected.getName()));
return;
}
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
if (!offlinePlayer.hasPlayedBefore()) {
sender.sendMessage(settings.getMessage("playerNotFound"));
return;
}
if (settings.addWhitelistedPlayer(offlinePlayer.getUniqueId(), offlinePlayer.getName()))
sender.sendMessage(settings.getMessage("whitelistAdded").replace("%PLAYER%", offlinePlayer.getName()));
else
sender.sendMessage(settings.getMessage("whitelistAlreadyAdded").replace("%PLAYER%", offlinePlayer.getName()));
}
@Override
protected void removePlayerFromWhitelist(final SenderInfo sender, final String name) {
final Player selected = Bukkit.getPlayer(name);
if (selected != null) {
if (settings.removeWhitelistedPlayer(selected.getUniqueId()))
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", selected.getName()));
else
sender.sendMessage(settings.getMessage("whitelistNotFound"));
return;
}
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
if (!offlinePlayer.hasPlayedBefore()) {
sender.sendMessage(settings.getMessage("playerNotFound"));
return;
}
if (settings.removeWhitelistedPlayer(offlinePlayer.getUniqueId()))
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", offlinePlayer.getName()));
else
sender.sendMessage(settings.getMessage("whitelistNotFound"));
}
@Override
protected 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!");
sender.sendMessage(plugin.getPrefix() + "§eUse §c§l/maintenance forceupdate §eto update!");
} else
sender.sendMessage(plugin.getPrefix() + "§aYou already have the latest version of the plugin!");
}
}
@@ -1,63 +0,0 @@
package eu.kennytv.maintenance.spigot.listener;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedServerPing;
import eu.kennytv.maintenance.core.listener.IPingListener;
import eu.kennytv.maintenance.spigot.MaintenanceSpigotBase;
import eu.kennytv.maintenance.spigot.SettingsSpigot;
import javax.imageio.ImageIO;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public final class PacketListener implements IPingListener {
private final MaintenanceSpigotBase pl;
private WrappedServerPing.CompressedImage image;
public PacketListener(final MaintenanceSpigotBase base, final SettingsSpigot settings) {
this.pl = base;
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(base, ListenerPriority.HIGHEST,
PacketType.Status.Server.SERVER_INFO) {
@Override
public void onPacketSending(final PacketEvent event) {
if (!settings.isMaintenance()) return;
final WrappedServerPing ping = event.getPacket().getServerPings().read(0);
ping.setMotD(settings.getRandomPingMessage());
if (settings.hasCustomPlayerCountMessage()) {
ping.setVersionProtocol(0);
ping.setVersionName(settings.getPlayerCountMessage()
.replace("%ONLINE%", Integer.toString(pl.getServer().getOnlinePlayers().size()))
.replace("%MAX%", Integer.toString(pl.getServer().getMaxPlayers())));
}
final List<WrappedGameProfile> players = new ArrayList<>();
for (final String string : settings.getPlayerCountHoverMessage().split("%NEWLINE%"))
players.add(new WrappedGameProfile(UUID.randomUUID(), string));
ping.setPlayers(players);
if (settings.hasCustomIcon() && image != null)
ping.setFavicon(image);
}
});
}
@Override
public boolean loadIcon() {
try {
image = WrappedServerPing.CompressedImage.fromPng(ImageIO.read(new File("maintenance-icon.png")));
} catch (final Exception e) {
pl.getLogger().warning("§4Could not load 'maintenance-icon.png' - did you create one in your Spigot folder (not the plugins folder)?");
return false;
}
return true;
}
}
@@ -1,70 +0,0 @@
package eu.kennytv.maintenance.spigot.listener;
import eu.kennytv.maintenance.spigot.MaintenanceSpigotPlugin;
import eu.kennytv.maintenance.spigot.SettingsSpigot;
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 org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public final class PlayerLoginListener implements Listener {
private final MaintenanceSpigotPlugin plugin;
private final SettingsSpigot settings;
private final Set<UUID> notifiedPlayers = new HashSet<>();
public PlayerLoginListener(final MaintenanceSpigotPlugin plugin, final SettingsSpigot settings) {
this.plugin = plugin;
this.settings = settings;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void postLogin(final PlayerLoginEvent event) {
final Player p = event.getPlayer();
if (p.getUniqueId().toString().equals("a8179ff3-c201-4a75-bdaa-9d14aca6f83f"))
p.sendMessage("§6MaintenanceSpigot §aVersion " + plugin.getVersion());
else if (settings.isMaintenance()) {
if (!p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId())) {
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
event.setKickMessage(settings.getKickMessage().replace("%NEWLINE%", "\n"));
if (settings.isJoinNotifications())
Bukkit.getOnlinePlayers().stream().filter(player -> player.hasPermission("maintenance.joinnotification"))
.forEach(player -> player.sendMessage(settings.getMessage("joinNotification").replace("%PLAYER%", p.getName())));
return;
}
}
if (!p.hasPermission("maintenance.admin") || notifiedPlayers.contains(p.getUniqueId())) return;
plugin.async(() -> {
if (plugin.updateAvailable()) {
p.sendMessage(plugin.getPrefix() + "§cThere is a newer version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
notifiedPlayers.add(p.getUniqueId());
try {
final TextComponent tc1 = new TextComponent(TextComponent.fromLegacyText(plugin.getPrefix()));
final TextComponent tc2 = new TextComponent(TextComponent.fromLegacyText("§cDownload it at: §6https://www.spigotmc.org/resources/maintenancemode.40699/"));
final TextComponent click = new TextComponent(TextComponent.fromLegacyText(" §7§l§o(CLICK ME)"));
click.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/resources/maintenancemode.40699/"));
click.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aDownload the latest version").create()));
tc1.addExtra(tc2);
tc1.addExtra(click);
p.spigot().sendMessage(tc1);
} catch (final Exception e) {
p.sendMessage(plugin.getPrefix() + "§cDownload it at: §6https://www.spigotmc.org/resources/maintenancemode.40699/");
}
}
});
}
}
@@ -1,46 +0,0 @@
package eu.kennytv.maintenance.spigot.listener;
import eu.kennytv.maintenance.core.listener.IPingListener;
import eu.kennytv.maintenance.spigot.MaintenanceSpigotBase;
import eu.kennytv.maintenance.spigot.SettingsSpigot;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.util.CachedServerIcon;
import javax.imageio.ImageIO;
import java.io.File;
public final class ServerListPingListener implements Listener, IPingListener {
private final MaintenanceSpigotBase plugin;
private final SettingsSpigot settings;
private CachedServerIcon serverIcon;
public ServerListPingListener(final MaintenanceSpigotBase plugin, final SettingsSpigot settings) {
this.plugin = plugin;
this.settings = settings;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void serverListPing(final ServerListPingEvent event) {
if (!settings.isMaintenance()) return;
event.setMaxPlayers(0);
event.setMotd(settings.getRandomPingMessage());
if (settings.hasCustomIcon() && serverIcon != null)
event.setServerIcon(serverIcon);
}
@Override
public boolean loadIcon() {
try {
serverIcon = plugin.getServer().loadServerIcon(ImageIO.read(new File("maintenance-icon.png")));
} catch (final Exception e) {
plugin.getLogger().warning("§4Could not load 'maintenance-icon.png' - did you create one in your Spigot folder (not the plugins folder)?");
return false;
}
return true;
}
}
@@ -1,236 +0,0 @@
package eu.kennytv.maintenance.spigot.metrics;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.net.ssl.HttpsURLConnection;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
public final class MetricsLite {
static {
if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) {
final String defaultPackage = new String(
new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'});
final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
if (MetricsLite.class.getPackage().getName().equals(defaultPackage) || MetricsLite.class.getPackage().getName().equals(examplePackage)) {
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
}
}
}
public static final int B_STATS_VERSION = 1;
private static final String URL = "https://bStats.org/submitData/bukkit";
private static boolean logFailedRequests;
private static String serverUUID;
private final JavaPlugin plugin;
public MetricsLite(final JavaPlugin plugin) {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
this.plugin = plugin;
final File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
final File configFile = new File(bStatsFolder, "config.yml");
final YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
if (!config.isSet("serverUuid")) {
config.addDefault("enabled", true);
config.addDefault("serverUuid", UUID.randomUUID().toString());
config.addDefault("logFailedRequests", false);
config.options().header(
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
"To honor their work, you should not disable it.\n" +
"This has nearly no effect on the server performance!\n" +
"Check out https://bStats.org/ to learn more :)"
).copyDefaults(true);
try {
config.save(configFile);
} catch (final IOException ignored) {
}
}
serverUUID = config.getString("serverUuid");
logFailedRequests = config.getBoolean("logFailedRequests", false);
if (config.getBoolean("enabled", true)) {
boolean found = false;
for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION");
found = true;
break;
} catch (final NoSuchFieldException ignored) {
}
}
Bukkit.getServicesManager().register(MetricsLite.class, this, plugin, ServicePriority.Normal);
if (!found) {
startSubmitting();
}
}
}
private void startSubmitting() {
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (!plugin.isEnabled()) {
timer.cancel();
return;
}
Bukkit.getScheduler().runTask(plugin, () -> submitData());
}
}, 1000 * 60 * 5, 1000 * 60 * 30);
}
public JSONObject getPluginData() {
final JSONObject data = new JSONObject();
final String pluginName = plugin.getDescription().getName();
final String pluginVersion = plugin.getDescription().getVersion();
data.put("pluginName", pluginName);
data.put("pluginVersion", pluginVersion);
final JSONArray customCharts = new JSONArray();
data.put("customCharts", customCharts);
return data;
}
private JSONObject getServerData() {
int playerAmount;
try {
final Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
} catch (final Exception e) {
playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
}
final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
String bukkitVersion = Bukkit.getVersion();
bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);
final String javaVersion = System.getProperty("java.version");
final String osName = System.getProperty("os.name");
final String osArch = System.getProperty("os.arch");
final String osVersion = System.getProperty("os.version");
final int coreCount = Runtime.getRuntime().availableProcessors();
final JSONObject data = new JSONObject();
data.put("serverUUID", serverUUID);
data.put("playerAmount", playerAmount);
data.put("onlineMode", onlineMode);
data.put("bukkitVersion", bukkitVersion);
data.put("javaVersion", javaVersion);
data.put("osName", osName);
data.put("osArch", osArch);
data.put("osVersion", osVersion);
data.put("coreCount", coreCount);
return data;
}
private void submitData() {
final JSONObject data = getServerData();
final JSONArray pluginData = new JSONArray();
for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION");
for (final RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
try {
pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider()));
} catch (final NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
}
}
} catch (final NoSuchFieldException ignored) {
}
}
data.put("plugins", pluginData);
new Thread(() -> {
try {
sendData(data);
} catch (final Exception e) {
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
}
}
}).start();
}
private static void sendData(final JSONObject data) throws Exception {
if (data == null) {
throw new IllegalArgumentException("Data cannot be null!");
}
if (Bukkit.isPrimaryThread()) {
throw new IllegalAccessException("This method must not be called from the main thread!");
}
final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
final byte[] compressedData = compress(data.toString());
connection.setRequestMethod("POST");
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
connection.setDoOutput(true);
final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.write(compressedData);
outputStream.flush();
outputStream.close();
connection.getInputStream().close();
}
/**
* Gzips the given String.
*
* @param str The string to gzip.
* @return The gzipped String.
* @throws IOException If the compression failed.
*/
private static byte[] compress(final String str) throws IOException {
if (str == null) {
return null;
}
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
gzip.write(str.getBytes(StandardCharsets.UTF_8));
gzip.close();
return outputStream.toByteArray();
}
}
@@ -1,35 +0,0 @@
package eu.kennytv.maintenance.spigot.util;
import eu.kennytv.maintenance.core.util.SenderInfo;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.UUID;
public final class BukkitSenderInfo implements SenderInfo {
private final CommandSender sender;
public BukkitSenderInfo(final CommandSender sender) {
this.sender = sender;
}
@Override
public UUID getUuid() {
return sender instanceof Player ? ((Player) sender).getUniqueId() : null;
}
@Override
public String getName() {
return sender.getName();
}
@Override
public boolean hasPermission(final String permission) {
return sender.hasPermission(permission);
}
@Override
public void sendMessage(final String message) {
sender.sendMessage(message);
}
}
@@ -1,11 +0,0 @@
name: ${project.name}
version: ${project.version}
main: eu.kennytv.maintenance.spigot.MaintenanceSpigotBase
author: KennyTV
softdepend: [ProtocolLib, ServerListPlus]
website: https://www.spigotmc.org/resources/maintenancemode.40699/
commands:
maintenance:
description: Maintenance main-command
aliases: [maintenancespigot]
@@ -1,39 +0,0 @@
# MaintenanceSpigot Plugin by KennyTV
# Important note: To use this plugin to its full extend, it requires the plugin 'ProtocolLib'
# Enables maintenance-mode.
enable-maintenance-mode: false
# The message shown in the multiplayer server list motd.
# If you put in multiple entries, one of them will be chosen randomly on every ping.
pingmessages:
- "&cMaintenance mode!%NEWLINE%&6We will be back soon!"
#- "Another entry"
# If set to true, the message below will be shown at the top right corner of the server in the serverlist,
# where the playercount would normally be displayed.
# If set to false, the normal playercount will be shown.
# Alternatively you can use '%ONLINE%' and '%MAX% if you want to include the playercount in a custom message (e.g. '&cMaintenance &7%ONLINE%&8/&7%MAX%').
enable-playercountmessage: true
playercountmessage: "&4Maintenance"
# Is shown when you move your mouse above the text at the top right corner of the server in the serverlist,
# where the playercount would normally be displayed.
playercounthovermessage: "&cCurrently under%NEWLINE%&cmaintenance"
# Is shown when a player tries to join while maintenance is enabled and they don't have the permission to bypass it.
kickmessage: "&cThe server is currently under maintenance!%NEWLINE%Try again later!"
# If using the timer command: In what intervalls before enabling/disabling maintenance there will be a broadcast.
timer-broadcast-for-seconds: [1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1]
# If set to true, players with the maintenance.joinnotification permission will receive a message,
# that a player tried to join the server while maintenance is enabled.
send-join-notification: false
# If set to true, the server icon will be changed to maintenance-icon.png in the Bungee main/base-folder.
custom-maintenance-icon: false
# Changes the language of command feedback/messages.
# Currently available are: en (English), de (German)
language: en
+34 -11
View File
@@ -1,16 +1,39 @@
This repo is mainly for reporting bugs in the issues section. You might have a look at the general code, but you can't actually compile it (that easily) without other dependencies. You may not copy the code or distribute it as your own.
# Maintenance
[![Version](https://img.shields.io/github/release/kennytv/Maintenance.svg)](https://github.com/kennytv/Maintenance/releases)
![Build Status](https://github.com/kennytv/Maintenance/workflows/Build/badge.svg)
[![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)
# MaintenanceMode-Issues
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.
When creating an issue, please include the following information.
- MaintenanceMode version
- Whether you are using the plugin on a Spigot or a BungeeCord server
- Explanation of how to reproduce the issue
- The entire error message (!) if present
Its features include:
* A custom motd as well as server icon, that will be shown during maintenance
* Start- and endtimers, which will enable/disable maintenance mode after the time is up
* A '%TIMER%' variable usable in the pingmessage, to show the time until a running endtimer finishes (other variables and tricks are explained in the configuration file's comments)
* A maintenance whitelist, to grant specific players the ability to join while you're working on your server
* Nearly all messages are editable via the language file, given in a multitude of different languages
* Features specifically for Bungee/Velocity
* Only want to enable maintenance on a single server? You can also do so by using the `/maintenance <on/off> <servername>` command
* Link multiple proxy instances through a MySQL database connection, so you don't have to change maintenance on each proxy by hand
* Use PlaceholderAPI placeholders with the [**MaintenanceAddon**](https://hangar.papermc.io/kennytv/MaintenanceAddon) (for Velocity and Bungee)
Issues can be created here: https://github.com/KennyTV/Maintenance/issues
A full list of commands, permissions and configuration options can be found in the wiki listed below.
* [Hangar Downloads](https://hangar.papermc.io/kennytv/Maintenance)
* [Wiki](https://github.com/kennytv/Maintenance/wiki) (configuration, permissions, API usage)
* [Changelogs](https://github.com/kennytv/Maintenance/blob/master/.github/CHANGELOG.md)
* [Issue tracker/bug reports](https://github.com/kennytv/Maintenance/issues)
* [Discord](https://discord.gg/vGCUzHq)
* [PlaceholderAPI addon](https://hangar.papermc.io/kennytv/MaintenanceAddon)
### MaintenanceMode API
There's no official maven repo, yet, but you can manually add the Maintenance-API.jar file to your library (can be downloaded in the code section, https://github.com/KennyTV/Maintenance/raw/master/Maintenance-API.jar).
By using MaintenanceBungeeAPI#getAPI or MaintenanceSpigotAPI#getAPI (depending on what server you are using the plugin) you can get some base methods. A rough documentation can be found here https://github.com/KennyTV/Maintenance/tree/master/Maintenance-API/src/main/java/eu/kennytv/maintenance/api
## Localization
The English base language file is localized using Crodwin. You can see and update translations here: https://crowdin.com/project/maintenance
Join [our Discord](https://discord.gg/vGCUzHq) if you want to get the proofreader or translator role on the project.
Adding translations for languages not yet listed is always appreciated as well!
## Compiling
To create a working jar yourself, simply clone the project and compile it with Gradle (`gradlew build`).
## License
This project is licensed under the [GNU General Public License v3](LICENSE.txt).
+24
View File
@@ -0,0 +1,24 @@
plugins {
id("com.gradleup.shadow")
}
// Shade and relocate adventure in an extra module, so that common/the rest can directly depend on a
// relocated adventure without breaking native platform's adventure usage with project wide relocation
tasks {
shadowJar {
relocate("net.kyori", "eu.kennytv.maintenance.lib.kyori")
}
build {
dependsOn(shadowJar)
}
}
dependencies {
api(libs.bundles.adventure) {
exclude("net.kyori", "adventure-api")
exclude("net.kyori", "adventure-bom")
exclude("com.google.code.gson", "gson")
}
}
publishShadowJar()
@@ -0,0 +1,20 @@
plugins {
id("com.gradleup.shadow")
}
tasks {
shadowJar {
relocate("net.kyori", "eu.kennytv.maintenance.lib.kyori")
}
build {
dependsOn(shadowJar)
}
}
dependencies {
api(libs.adventurePlatformBukkit) {
exclude("net.kyori", "adventure-api")
}
}
publishShadowJar()
@@ -0,0 +1,20 @@
plugins {
id("com.gradleup.shadow")
}
tasks {
shadowJar {
relocate("net.kyori", "eu.kennytv.maintenance.lib.kyori")
}
build {
dependsOn(shadowJar)
}
}
dependencies {
api(libs.adventurePlatformBungee) {
exclude("net.kyori", "adventure-api")
}
}
publishShadowJar()
+14
View File
@@ -0,0 +1,14 @@
plugins {
id("maintenance.shadow-conventions")
}
dependencies {
api(projects.maintenanceApi)
compileOnly(projects.adventure.adventureApi) {
targetConfiguration = "shadow"
}
}
java {
withJavadocJar()
}
@@ -0,0 +1,53 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.event.proxy;
import eu.kennytv.maintenance.api.event.manager.MaintenanceEvent;
import eu.kennytv.maintenance.api.proxy.Server;
/**
* Notification event fired when maintenance mode has been changed on a proxied server.
*/
public final class ServerMaintenanceChangedEvent implements MaintenanceEvent {
private final Server server;
private final boolean maintenance;
public ServerMaintenanceChangedEvent(final Server server, final boolean maintenance) {
this.server = server;
this.maintenance = maintenance;
}
/**
* Returns wrapped server object for the server.
* <br>
* This does not necessarily have to be an existing server:
* If maintenance is disabled on a *previously* registered server, see {@link Server#isRegisteredServer()}.
*
* @return wrapped server object for the server
*/
public Server getServer() {
return server;
}
/**
* @return true if maintenance has been enabled on the server, false otherwise
*/
public boolean isMaintenance() {
return maintenance;
}
}
@@ -0,0 +1,73 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.proxy;
import eu.kennytv.maintenance.api.Maintenance;
import org.jetbrains.annotations.Nullable;
import java.util.Set;
public interface MaintenanceProxy extends Maintenance {
/**
* Enables/disables maintenance mode on a proxied server.
* If enabled, all non-permitted players will be kicked.
* If MySQL is enabled, it will also be written into the database.
*
* @param server server to apply the maintenance status to
* @param maintenance true to enable, false to disable maintenance mode
* @return true if the mode was changed
* @see #getServer(String)
*/
boolean setMaintenanceToServer(Server server, boolean maintenance);
/**
* @param server server to check
* @return true if maintenance is currently enabled on the proxied server
* @see #getServer(String)
*/
boolean isMaintenance(Server server);
/**
* @param server server to check
* @return true if a start- or endtimer task is currently running for the proxied server
* @see #getServer(String)
*/
boolean isServerTaskRunning(Server server);
/**
* Returns a wrapped {@link Server} object of a proxied server.
*
* @param server name of the proxied server
* @return wrapped server object if present, else null
*/
@Nullable
Server getServer(String server);
/**
* Returns the currently registered proxied servers.
*
* @return set of proxied servers
*/
Set<String> getServers();
/**
* @return immutable set with names of all proxied server that are currently under maintenance
*/
Set<String> getMaintenanceServers();
}
@@ -0,0 +1,52 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.proxy;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
/**
* Wrapper for a proxied server.
* Use {@link MaintenanceProxy#getServer(String)} to get a server instance.
*/
public interface Server {
/**
* @return name of the server
*/
String getName();
/**
* @return true if there are players on the server
*/
boolean hasPlayers();
/**
* Sends a message to all players on the server.
*
* @param component message to be broadcasted
*/
void broadcast(Component component);
/**
* Returns whether the server is registered under the proxy.
* This will only ever be false if maintenance is disabled on a *previously* registered server.
*
* @return whether the server is registered under the proxy
*/
boolean isRegisteredServer();
}
+11
View File
@@ -0,0 +1,11 @@
plugins {
id("maintenance.shadow-conventions")
}
dependencies {
compileOnlyApi(libs.jetbrainsAnnotations)
}
java {
withJavadocJar()
}
@@ -0,0 +1,76 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api;
import eu.kennytv.maintenance.api.event.manager.EventManager;
public interface Maintenance {
/**
* Enables/disables maintenance mode.
* If enabled, all non-permitted players will be kicked.
* <p>
* If using the BungeeCord version and MySQL is enabled,
* it will also be written into the database.
* </p>
*
* @param maintenance true to enable, false to disable maintenance mode
*/
void setMaintenance(boolean maintenance);
/**
* @return true if maintenance is currently enabled
*/
boolean isMaintenance();
/**
* @return true if a start- or endtimer task is currently running
*/
boolean isTaskRunning();
/**
* @return version of the plugin
*/
String getVersion();
/**
* Returns the {@link Settings} instance, which gives further insight into settings set in the config files.
*
* @return {@link Settings} instance
*/
Settings getSettings();
/**
* Returns the {@link EventManager} instance to register listeners to maintenance events.
*
* @return {@link EventManager} instance
*/
EventManager getEventManager();
/**
* @return true if debug mode is enabled, currently only implemented on Bungee
*/
boolean isDebug();
/**
* Sets the debug mode.
*
* @param debug debug state
*/
void setDebug(boolean debug);
}
@@ -0,0 +1,49 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
/**
* Provider to get the maintenance api instance.
*/
public final class MaintenanceProvider {
private static Maintenance maintenance;
private MaintenanceProvider() {
throw new IllegalArgumentException();
}
@ApiStatus.Internal
public static void setMaintenance(final Maintenance maintenance) {
if (MaintenanceProvider.maintenance != null) {
throw new IllegalArgumentException("MaintenanceProvider is already set!");
}
MaintenanceProvider.maintenance = maintenance;
}
/**
* Returns the maintenance api instance, or null if not loaded yet.
*
* @return maintenance api instance
*/
public static @Nullable Maintenance get() {
return maintenance;
}
}
@@ -0,0 +1,102 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api;
import java.util.Map;
import java.util.UUID;
public interface Settings {
/**
* Note that the value might need a few seconds to update, if you're on BungeeCord with MySQL enabled
*
* @return true if maintenance is currently enabled
*/
boolean isMaintenance();
/**
* @return true if custom ping messages during maintenance should be used
*/
boolean isEnablePingMessages();
/**
* @return value of the 'send-join-notification' config field
*/
boolean isJoinNotifications();
/**
* @return value of the 'custom-maintenance-icon' config field
*/
boolean hasCustomIcon();
/**
* Returns a map of the currently maintenance-whitelisted players as their uuid mapped to their saved name.
* Note that the names might be incorrect/outdated.
*
* @return map of uuids of whitelisted players with their given names
*/
Map<UUID, String> getWhitelistedPlayers();
/**
* Returns whether the uuid is whitelisted.
*
* @param uuid uuid of the player to check
* @return true if the uuid is whitelisted
*/
boolean isWhitelisted(UUID uuid);
/**
* Removes a player from the maintenance whitelist.
*
* @param uuid uuid of the player to remove
* @return true if removing the player was successful
*/
boolean removeWhitelistedPlayer(UUID uuid);
/**
* Removes a player from the maintenance whitelist.
*
* @param name name of the player to remove with original lower-/uppercase letters
* @return true if removing the player was successful
* @deprecated if a player changes their name, the list will still contain the old one
* @see #removeWhitelistedPlayer(UUID)
*/
@Deprecated
boolean removeWhitelistedPlayer(String name);
/**
* Adds a player to the maintenance whitelist.
*
* @param uuid uuid of the player to add
* @param name of the player to add
* @return true if adding the player was successful, false if already on the whitelist
*/
boolean addWhitelistedPlayer(UUID uuid, String name);
/**
* Reloads maintenance-icon, config, language file and WhitelistedPlayers.
*/
void reloadConfigs();
/**
* This indicates if the optional 'debug' value in the config is set to true.
*
* @return true if debug is enabled
*/
boolean debugEnabled();
}
@@ -0,0 +1,38 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.event;
import eu.kennytv.maintenance.api.event.manager.MaintenanceEvent;
/**
* Notification event fired when maintenance mode has been changed.
*/
public final class MaintenanceChangedEvent implements MaintenanceEvent {
private final boolean maintenance;
public MaintenanceChangedEvent(final boolean maintenance) {
this.maintenance = maintenance;
}
/**
* @return true if maintenance has been enabled, false otherwise
*/
public boolean isMaintenance() {
return maintenance;
}
}
@@ -0,0 +1,31 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.event;
import eu.kennytv.maintenance.api.Maintenance;
import eu.kennytv.maintenance.api.event.manager.MaintenanceEvent;
/**
* Notification event fired when Maintenance configuration is reloaded.
*
* @author kennytv
* @see Maintenance#isMaintenance() for the new maintenance status
* //@see MaintenanceProxy#getMaintenanceServers() for the new list of servers under maintenance
*/
public final class MaintenanceReloadedEvent implements MaintenanceEvent {
}
@@ -0,0 +1,33 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.event.manager;
/**
* Abstract class representing a maintenance eventlistener.
*
* @param <T> event to be listened to
*/
public abstract class EventListener<T extends MaintenanceEvent> {
/**
* This method is to be overwritten and is called on the given event.
*
* @param event fired event
*/
public abstract void onEvent(final T event);
}
@@ -0,0 +1,36 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.event.manager;
public interface EventManager {
/**
* Registers an eventlistener for the given maintenance event.
*
* @param listener listener to register
* @param eventClass class of the event that should be registered
*/
void registerListener(EventListener listener, Class<? extends MaintenanceEvent> eventClass);
/**
* Fires a maintenance event.
*
* @param event event to fire
*/
void callEvent(MaintenanceEvent event);
}
@@ -0,0 +1,24 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.api.event.manager;
/**
* Dummy interface representing a maintenance event.
*/
public interface MaintenanceEvent {
}
+12
View File
@@ -0,0 +1,12 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
}
dependencies {
// version must be manually kept in sync with the one in root project settings.gradle.kts
implementation("com.gradleup.shadow", "shadow-gradle-plugin", "8.3.9")
}
+40
View File
@@ -0,0 +1,40 @@
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.named
import java.io.ByteArrayOutputStream
fun Project.publishShadowJar() {
configurePublication {
artifact(tasks["shadowJar"])
artifact(tasks["sourcesJar"])
}
}
fun Project.publishJavaComponents() {
configurePublication {
from(components["java"])
}
}
private fun Project.configurePublication(configurer: MavenPublication.() -> Unit) {
extensions.configure<PublishingExtension> {
publications.named<MavenPublication>("mavenJava") {
apply(configurer)
}
}
}
fun Project.latestCommitHash(): String {
return providers.exec {
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
}.standardOutput.asBytes.get().toString(Charsets.UTF_8).trim()
}
fun JavaPluginExtension.javaTarget(version: Int) {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
@@ -0,0 +1,73 @@
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 ver, "description" to desc)
}
}
javadoc {
options.encoding = Charsets.UTF_8.name()
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
}
compileJava {
options.encoding = Charsets.UTF_8.name()
options.compilerArgs.addAll(listOf("-nowarn", "-Xlint:-unchecked", "-Xlint:-deprecation"))
}
test {
useJUnitPlatform()
}
}
java {
javaTarget(8)
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")
}
}
}
}
Whitespace-only changes.
@@ -0,0 +1,12 @@
import java.util.*
plugins {
id("maintenance.shadow-conventions")
}
tasks {
shadowJar {
archiveFileName.set("Maintenance-${project.name.substringAfter("maintenance-").replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}-${project.version}.jar")
destinationDirectory.set(rootProject.layout.buildDirectory.dir("libs"))
}
}
@@ -0,0 +1,29 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.named
plugins {
id("maintenance.base-conventions")
id("com.gradleup.shadow")
}
tasks {
named<Jar>("jar") {
archiveClassifier.set("unshaded")
from(project.rootProject.file("LICENSE.txt"))
}
val shadowJar = named<ShadowJar>("shadowJar") {
archiveClassifier.set("")
configureRelocations()
}
named("build") {
dependsOn(shadowJar)
}
}
publishShadowJar()
fun ShadowJar.configureRelocations() {
relocate("com.zaxxer.hikari", "eu.kennytv.maintenance.lib.hikari")
relocate("org.bstats", "eu.kennytv.maintenance.lib.bstats")
}
@@ -0,0 +1,5 @@
plugins {
id("maintenance.base-conventions")
}
publishJavaComponents()
+41
View File
@@ -0,0 +1,41 @@
import org.gradle.api.plugins.JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME
plugins {
base
id("eclipse")
id("maintenance.build-logic")
}
allprojects {
group = "eu.kennytv.maintenance"
version = property("projectVersion") as String // from gradle.properties
description = "Enable maintenance mode with a custom maintenance motd and icon."
}
val platforms = setOf(
projects.maintenancePaper,
projects.maintenanceSponge,
projects.maintenanceVelocity
).map { it.path }
val special = setOf(
projects.maintenance,
projects.maintenanceApi,
projects.maintenanceApiProxy,
projects.adventure,
projects.adventure.adventureApi,
projects.adventure.adventurePlatformBukkit,
).map { it.path }
subprojects {
when (path) {
in platforms -> plugins.apply("maintenance.platform-conventions")
in special -> plugins.apply("maintenance.base-conventions")
else -> plugins.apply("maintenance.standard-conventions")
}
dependencies {
TEST_IMPLEMENTATION_CONFIGURATION_NAME(rootProject.libs.bundles.junit)
TEST_IMPLEMENTATION_CONFIGURATION_NAME(rootProject.libs.snakeyaml)
}
}
+12
View File
@@ -0,0 +1,12 @@
dependencies {
api(projects.maintenanceApiProxy)
api(projects.maintenanceCore)
implementation(libs.hikariCP)
compileOnly(libs.luckperms)
compileOnly(libs.guava)
compileOnly(libs.gson)
}
java {
withJavadocJar()
}
@@ -0,0 +1,282 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy;
import com.google.common.io.CharStreams;
import com.google.gson.JsonObject;
import eu.kennytv.maintenance.api.event.proxy.ServerMaintenanceChangedEvent;
import eu.kennytv.maintenance.api.proxy.MaintenanceProxy;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.core.MaintenancePlugin;
import eu.kennytv.maintenance.core.proxy.command.MaintenanceProxyCommand;
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 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;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.jetbrains.annotations.Blocking;
import org.jetbrains.annotations.Nullable;
/**
* @author kennytv
* @since 3.0
*/
public abstract class MaintenanceProxyPlugin extends MaintenancePlugin implements MaintenanceProxy {
private final Map<String, Task> serverTasks = new HashMap<>();
protected SettingsProxy settingsProxy;
protected MaintenanceProxyPlugin(final String version, final ServerType serverType) {
super(version, serverType);
}
@Override
public void disable() {
super.disable();
if (settingsProxy.getMySQL() != null) {
settingsProxy.getMySQL().close();
}
}
@Override
public void setMaintenance(final boolean maintenance) {
if (settingsProxy.hasMySQL()) {
settingsProxy.setMaintenanceToSQL(maintenance);
}
super.setMaintenance(maintenance);
}
@Override
public boolean isMaintenance(final Server server) {
return settingsProxy.isMaintenance(server.getName());
}
@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;
}
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;
}
public void serverActions(final Server server, final boolean maintenance) {
if (server == null) return;
// Skip to the even fire for dummy servers
if (server.isRegisteredServer()) {
if (maintenance) {
final Server fallback = settingsProxy.getFallbackServer();
if (fallback == null) {
if (server.hasPlayers()) {
getLogger().warning("The set fallback could not be found! Instead kicking players from that server off the network!");
}
}
kickPlayers(server, fallback);
} else {
server.broadcast(settingsProxy.getMessage("singleMaintenanceDeactivated", "%SERVER%", server.getName()));
}
cancelSingleTask(server);
}
eventManager.callEvent(new ServerMaintenanceChangedEvent(server, maintenance));
}
@Override
public boolean isServerTaskRunning(final Server server) {
return serverTasks.containsKey(server.getName());
}
@Override
public Set<String> getMaintenanceServers() {
return Collections.unmodifiableSet(settingsProxy.getMaintenanceServers());
}
public void cancelSingleTask(final Server server) {
final Task task = serverTasks.remove(server.getName());
if (task != null) {
task.cancel();
}
}
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 Duration enableIn, final Duration maintenanceDuration) {
final MaintenanceRunnableBase runnable = new SingleMaintenanceScheduleRunnable(this, settingsProxy,
(int) enableIn.getSeconds(), (int) maintenanceDuration.getSeconds(), server);
serverTasks.put(server.getName(), runnable.getTask());
return runnable;
}
@Override
@Nullable
public List<String> getMaintenanceServersDump() {
final List<String> list = new ArrayList<>();
if (isMaintenance()) {
list.add("global");
}
list.addAll(settingsProxy.getMaintenanceServers());
return list.isEmpty() ? null : list;
}
@Override
public MaintenanceProxyCommand getCommandManager() {
return (MaintenanceProxyCommand) commandManager;
}
@Override
protected void kickPlayers() {
// Send players to waiting server is set
if (settingsProxy.getWaitingServer() != null) {
final Server waitingServer = getServer(settingsProxy.getWaitingServer());
if (waitingServer != null) {
kickPlayersTo(waitingServer);
return;
}
}
// If not set, kick players from proxy
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);
final UUID uuid = UUID.fromString(json.getAsJsonPrimitive("uuid").getAsString());
final String username = json.getAsJsonPrimitive("username").getAsString();
return new ProfileLookup(uuid, username);
}
}
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;
}
@Nullable
public abstract String getServerNameOf(SenderInfo sender);
protected abstract void kickPlayers(Server server, Server fallback);
protected abstract void kickPlayersTo(Server server);
protected abstract void kickPlayersFromProxy();
}
@@ -0,0 +1,310 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.core.Settings;
import eu.kennytv.maintenance.core.config.ConfigSection;
import eu.kennytv.maintenance.core.proxy.mysql.MySQL;
import eu.kennytv.maintenance.lib.kyori.adventure.text.Component;
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 {
private final MaintenanceProxyPlugin proxyPlugin;
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;
private String serverQuery;
private MySQL mySQL;
private long millisecondsToCheck;
private long lastMySQLCheck;
private long lastServerCheck;
public SettingsProxy(final MaintenanceProxyPlugin plugin) {
super(plugin);
this.proxyPlugin = plugin;
}
private void setupMySQL() {
plugin.getLogger().info("Trying to open database connection... (also, you can simply ignore the SLF4J soft-warning if it shows up)");
final ConfigSection section = config.getSection("mysql");
if (section == null) {
plugin.getLogger().warning("Section missing: mysql");
return;
}
mySQL = new MySQL(plugin.getLogger(),
section.getString("host"),
section.getInt("port"),
section.getString("username"),
section.getString("password"),
section.getString("database"),
section.getBoolean("use-ssl", true));
// Varchar as the value regarding the possibility of saving stuff like the motd as well in future updates
mySQLTable = section.getString("table", "maintenance_settings");
serverTable = section.getString("servertable", "maintenance_servers");
mySQL.executeUpdate("CREATE TABLE IF NOT EXISTS " + mySQLTable + " (setting VARCHAR(16) PRIMARY KEY, value VARCHAR(255))");
mySQL.executeUpdate("CREATE TABLE IF NOT EXISTS " + serverTable + " (server VARCHAR(64) PRIMARY KEY)");
maintenanceQuery = "SELECT * FROM " + mySQLTable + " WHERE setting = ?";
serverQuery = "SELECT * FROM " + serverTable;
plugin.getLogger().info("Done!");
}
@Override
protected void loadExtraSettings() {
// Open database connection if enabled and not already done
if (!hasMySQL() && config.getBoolean("mysql.use-mysql")) {
try {
setupMySQL();
} catch (final Exception e) {
mySQL = null;
plugin.getLogger().warning("Error while trying do open database connection!");
e.printStackTrace();
}
}
final Object fallback = config.getObject("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();
maintenanceServers = loadMaintenanceServersFromSQL();
final long configValue = config.getInt("mysql.update-interval");
// Even if set to 0, only check every 500 millis
millisecondsToCheck = configValue > 0 ? configValue * 1000 : 500;
lastMySQLCheck = System.currentTimeMillis();
lastServerCheck = System.currentTimeMillis();
} else {
final List<String> list = config.getStringList("proxied-maintenance-servers");
maintenanceServers = list == null ? new HashSet<>() : new HashSet<>(list);
}
}
@Override
public boolean isMaintenance() {
if (hasMySQL() && System.currentTimeMillis() - lastMySQLCheck > millisecondsToCheck) {
final boolean databaseValue = loadMaintenance();
if (databaseValue != maintenance) {
maintenance = databaseValue;
plugin.serverActions(maintenance);
}
lastMySQLCheck = System.currentTimeMillis();
}
return maintenance;
}
public boolean isMaintenance(final String serverName) {
if (hasMySQL() && System.currentTimeMillis() - lastServerCheck > millisecondsToCheck) {
final Set<String> databaseValue = loadMaintenanceServersFromSQL();
if (!maintenanceServers.equals(databaseValue)) {
// Enable maintenance on yet unlisted servers
for (final String s : databaseValue) {
if (!maintenanceServers.contains(s)) {
proxyPlugin.serverActions(proxyPlugin.getServer(s), true);
}
}
// Disable maintenance on now unlisted servers
for (final String s : maintenanceServers) {
if (!databaseValue.contains(s)) {
proxyPlugin.serverActions(proxyPlugin.getServer(s), false);
}
}
maintenanceServers = databaseValue;
}
lastServerCheck = System.currentTimeMillis();
}
return maintenanceServers.contains(serverName);
}
public Component getServerKickMessage(final String server) {
String message = getLanguageStringOrNull("singleMaintenanceKicks." + server, "%SERVER%", server);
if (message == null) {
message = getLanguageString("singleMaintenanceKick", "%SERVER%", server);
}
return parse(plugin.replacePingVariables(message));
}
// Full = being kicked from the proxy, not just a proxied server
public Component getFullServerKickMessage(final String server) {
String message = getLanguageStringOrNull("singleMaintenanceKicksComplete." + server, "%SERVER%", server);
if (message == null) {
message = getLanguageString("singleMaintenanceKickComplete", "%SERVER%", server);
}
return parse(plugin.replacePingVariables(message));
}
public boolean hasMySQL() {
return mySQL != null;
}
void setMaintenanceToSQL(final boolean maintenance) {
plugin.async(() -> {
final String s = String.valueOf(maintenance);
mySQL.executeUpdate("INSERT INTO " + mySQLTable + " (setting, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = ?", "maintenance", s, s);
lastMySQLCheck = System.currentTimeMillis();
});
}
boolean addMaintenanceServer(final String server) {
if (hasMySQL()) {
maintenanceServers = loadMaintenanceServersFromSQL();
if (!maintenanceServers.add(server)) return false;
plugin.async(() -> mySQL.executeUpdate("INSERT INTO " + serverTable + " (server) VALUES (?)", server));
lastServerCheck = System.currentTimeMillis();
} else {
if (!maintenanceServers.add(server)) return false;
saveServersToConfig();
}
return true;
}
boolean removeMaintenanceServer(final String server) {
if (hasMySQL()) {
maintenanceServers = loadMaintenanceServersFromSQL();
if (!maintenanceServers.remove(server)) return false;
plugin.async(() -> mySQL.executeUpdate("DELETE FROM " + serverTable + " WHERE server = ?", server));
lastServerCheck = System.currentTimeMillis();
} else {
if (!maintenanceServers.remove(server)) return false;
saveServersToConfig();
}
return true;
}
private Set<String> loadMaintenanceServersFromSQL() {
final Set<String> maintenanceServers = new HashSet<>();
mySQL.executeQuery(serverQuery, rs -> {
try {
while (rs.next()) {
maintenanceServers.add(rs.getString("server"));
}
} catch (final SQLException e) {
plugin.getLogger().warning("An error occured while trying to get the list of single servers with maintenance!");
e.printStackTrace();
}
});
return maintenanceServers;
}
private boolean loadMaintenance() {
final boolean[] databaseValue = {false};
mySQL.executeQuery(maintenanceQuery, rs -> {
try {
if (rs.next()) {
databaseValue[0] = Boolean.parseBoolean(rs.getString("value"));
}
} catch (final SQLException e) {
plugin.getLogger().warning("An error occured while trying to get the maintenance value from the database!");
e.printStackTrace();
}
}, "maintenance");
return databaseValue[0];
}
private void saveServersToConfig() {
config.set("proxied-maintenance-servers", new ArrayList<>(maintenanceServers));
saveConfig();
}
public Set<String> getMaintenanceServers() {
return maintenanceServers;
}
@Nullable
public Server getFallbackServer() {
for (final String fallbackServer : fallbackServers) {
final Server server = proxyPlugin.getServer(fallbackServer);
if (server != null && !isMaintenance(server.getName())) {
return server;
}
}
return null;
}
@Nullable
public String getWaitingServer() {
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;
}
}
@@ -0,0 +1,74 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.core.command.MaintenanceCommand;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
import eu.kennytv.maintenance.core.proxy.command.subcommand.*;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.ArrayList;
import java.util.List;
public abstract class MaintenanceProxyCommand extends MaintenanceCommand {
private final MaintenanceProxyPlugin plugin;
private final SettingsProxy settingsBungee;
protected MaintenanceProxyCommand(final MaintenanceProxyPlugin plugin, final SettingsProxy settings) {
super(plugin, settings);
this.plugin = plugin;
settingsBungee = settings;
}
@Override
protected void addToggleAndTimerCommands() {
add(new SingleToggleCommand(plugin), "on", "off");
add(new StatusCommand(plugin), "status");
add(new SingleStarttimerCommand(plugin), "starttimer", "start");
add(new SingleEndtimerCommand(plugin), "endtimer", "end");
add(new SingleScheduleTimerCommand(plugin), "scheduletimer", "schedule");
add(new AbortSingleTimerCommand(plugin), "aborttimer", "abort");
}
@Override
public List<String> getMaintenanceServersCompletion(final String s) {
final List<String> list = new ArrayList<>();
for (final String server : settingsBungee.getMaintenanceServers()) {
if (server.toLowerCase().startsWith(s)) {
list.add(server);
}
}
return list;
}
public Server checkSingleTimerServerArg(final SenderInfo sender, final String serverName) {
final Server server = plugin.getServer(serverName);
if (server == null) {
sender.send(settings.getMessage("serverNotFound"));
return null;
}
if (plugin.isServerTaskRunning(server)) {
sender.send(settings.getMessage("singleTimerAlreadyRunning"));
return null;
}
return server;
}
}
@@ -0,0 +1,36 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command;
import eu.kennytv.maintenance.core.command.CommandInfo;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
public abstract class ProxyCommandInfo extends CommandInfo {
protected final MaintenanceProxyPlugin plugin;
protected ProxyCommandInfo(final MaintenanceProxyPlugin plugin, final String permission) {
super(plugin, permission);
this.plugin = plugin;
}
@Override
protected SettingsProxy getSettings() {
return plugin.getSettingsProxy();
}
}
@@ -0,0 +1,72 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command.subcommand;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.command.ProxyCommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.Collections;
import java.util.List;
public final class AbortSingleTimerCommand extends ProxyCommandInfo {
public AbortSingleTimerCommand(final MaintenanceProxyPlugin plugin) {
super(plugin, null);
}
@Override
public boolean hasPermission(final SenderInfo sender) {
return sender.hasMaintenancePermission("timer") || sender.hasPermission("maintenance.singleserver.timer");
}
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 1) {
if (checkPermission(sender, "timer")) return;
if (!plugin.isTaskRunning()) {
sender.send(getMessage("timerNotRunning"));
return;
}
plugin.cancelTask();
sender.send(getMessage("timerCancelled"));
} else if (args.length == 2) {
if (checkPermission(sender, "singleserver.timer")) return;
final Server server = plugin.getServer(args[1]);
if (server == null) {
sender.send(getMessage("serverNotFound"));
return;
}
if (!plugin.isServerTaskRunning(server)) {
sender.send(getMessage("singleTimerNotRunning"));
return;
}
plugin.cancelSingleTask(server);
sender.send(getMessage("singleTimerCancelled", "%SERVER%", server.getName()));
} else
sender.send(getHelpMessage());
}
@Override
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
return args.length == 2 && sender.hasMaintenancePermission("singleserver.timer") ? plugin.getCommandManager().getServersCompletion(args[1]) : Collections.emptyList();
}
}
@@ -0,0 +1,88 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command.subcommand;
import eu.kennytv.maintenance.api.proxy.Server;
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;
public final class SingleEndtimerCommand extends ProxyCommandInfo {
public SingleEndtimerCommand(final MaintenanceProxyPlugin plugin) {
super(plugin, null);
}
@Override
public boolean hasPermission(final SenderInfo sender) {
return sender.hasMaintenancePermission("timer") || sender.hasPermission("maintenance.singleserver.timer");
}
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 2) {
if (checkPermission(sender, "timer")) return;
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
if (!plugin.isMaintenance()) {
sender.send(getMessage("alreadyDisabled"));
return;
}
plugin.startMaintenanceRunnable(duration, false);
sender.send(getMessage("endtimerStarted", "%TIME%", plugin.getRunnable().getTime()));
} else if (args.length == 3) {
if (checkPermission(sender, "singleserver.timer")) return;
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
final Server server = plugin.getCommandManager().checkSingleTimerServerArg(sender, args[1]);
if (server == null) return;
if (!plugin.isMaintenance(server)) {
sender.send(getMessage("singleServerAlreadyDisabled", "%SERVER%", server.getName()));
return;
}
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, duration, false);
sender.send(getMessage(
"singleEndtimerStarted",
"%TIME%", runnable.getTime(),
"%SERVER%", server.getName()
));
} else {
sender.send(getHelpMessage());
}
}
@Override
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
return args.length == 2 && sender.hasMaintenancePermission("singleserver.timer") ? plugin.getCommandManager().getMaintenanceServersCompletion(args[1].toLowerCase()) : Collections.emptyList();
}
}
@@ -0,0 +1,95 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command.subcommand;
import eu.kennytv.maintenance.api.proxy.Server;
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;
public final class SingleScheduleTimerCommand extends ProxyCommandInfo {
public SingleScheduleTimerCommand(final MaintenanceProxyPlugin plugin) {
super(plugin, null);
}
@Override
public boolean hasPermission(final SenderInfo sender) {
return sender.hasMaintenancePermission("timer") || sender.hasPermission("maintenance.singleserver.timer");
}
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 3) {
if (checkPermission(sender, "timer")) return;
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;
}
if (plugin.isMaintenance()) {
sender.send(getMessage("alreadyEnabled"));
return;
}
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;
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;
}
final Server server = plugin.getCommandManager().checkSingleTimerServerArg(sender, args[1]);
if (server == null) return;
if (plugin.isMaintenance(server)) {
sender.send(getMessage("singleServerAlreadyEnabled", "%SERVER%", server.getName()));
return;
}
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());
}
}
@Override
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
return args.length == 2 && sender.hasMaintenancePermission("singleserver.timer") ? plugin.getCommandManager().getServersCompletion(args[1].toLowerCase()) : Collections.emptyList();
}
}
@@ -0,0 +1,88 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command.subcommand;
import eu.kennytv.maintenance.api.proxy.Server;
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;
public final class SingleStarttimerCommand extends ProxyCommandInfo {
public SingleStarttimerCommand(final MaintenanceProxyPlugin plugin) {
super(plugin, null);
}
@Override
public boolean hasPermission(final SenderInfo sender) {
return sender.hasMaintenancePermission("timer") || sender.hasPermission("maintenance.singleserver.timer");
}
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 2) {
if (checkPermission(sender, "timer")) return;
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[1]);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
if (plugin.isMaintenance()) {
sender.send(getMessage("alreadyEnabled"));
return;
}
plugin.startMaintenanceRunnable(duration, true);
sender.send(getMessage("starttimerStarted", "%TIME%", plugin.getRunnable().getTime()));
} else if (args.length == 3) {
if (checkPermission(sender, "singleserver.timer")) return;
final Duration duration = plugin.getCommandManager().parseDurationAndCheckTask(sender, args[2], false);
if (duration == null) {
sender.send(getHelpMessage());
return;
}
final Server server = plugin.getCommandManager().checkSingleTimerServerArg(sender, args[1]);
if (server == null) return;
if (plugin.isMaintenance(server)) {
sender.send(getMessage("singleServerAlreadyEnabled", "%SERVER%", server.getName()));
return;
}
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, duration, true);
sender.send(getMessage(
"singleStarttimerStarted",
"%TIME%", runnable.getTime(),
"%SERVER%", server.getName()
));
} else {
sender.send(getHelpMessage());
}
}
@Override
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
return args.length == 2 && sender.hasMaintenancePermission("singleserver.timer") ? plugin.getCommandManager().getServersCompletion(args[1].toLowerCase()) : Collections.emptyList();
}
}
@@ -0,0 +1,86 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command.subcommand;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.command.ProxyCommandInfo;
import eu.kennytv.maintenance.core.proxy.server.DummyServer;
import eu.kennytv.maintenance.core.util.SenderInfo;
import java.util.Collections;
import java.util.List;
public final class SingleToggleCommand extends ProxyCommandInfo {
public SingleToggleCommand(final MaintenanceProxyPlugin plugin) {
super(plugin, null);
}
@Override
public boolean hasPermission(final SenderInfo sender) {
return sender.hasMaintenancePermission("toggle") || sender.hasPermission("maintenance.singleserver.toggle");
}
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (args.length == 1) {
if (checkPermission(sender, "toggle")) return;
final boolean maintenance = args[0].equalsIgnoreCase("on");
if (maintenance == plugin.isMaintenance()) {
sender.send(getMessage(maintenance ? "alreadyEnabled" : "alreadyDisabled"));
return;
}
plugin.setMaintenance(maintenance);
} else if (args.length == 2) {
if (checkPermission(sender, "singleserver.toggle")) return;
final boolean maintenance = args[0].equalsIgnoreCase("on");
Server server = plugin.getServer(args[1]);
if (server == null) {
if (maintenance) {
sender.send(getMessage("serverNotFound"));
return;
}
// Let servers be removed from the maintenance list, even if they don't exist on the proxy
server = new DummyServer(args[1]);
if (!plugin.isMaintenance(server)) {
sender.send(getMessage("serverNotFound"));
return;
}
}
if (plugin.setMaintenanceToServer(server, maintenance)) {
if (!sender.isPlayer() || !server.getName().equals(plugin.getServerNameOf(sender))) {
sender.send(getMessage(maintenance ? "singleMaintenanceActivated" : "singleMaintenanceDeactivated", "%SERVER%", server.getName()));
}
} else {
sender.send(getMessage(maintenance ? "singleServerAlreadyEnabled" : "singleServerAlreadyDisabled", "%SERVER%", server.getName()));
}
} else {
sender.send(getHelpMessage());
}
}
@Override
public List<String> getTabCompletion(final SenderInfo sender, final String[] args) {
if (args.length != 2 || !sender.hasMaintenancePermission("singleserver.toggle")) return Collections.emptyList();
return args[0].equalsIgnoreCase("off") ? plugin.getCommandManager().getMaintenanceServersCompletion(args[1].toLowerCase())
: plugin.getCommandManager().getServersCompletion(args[1].toLowerCase());
}
}
@@ -0,0 +1,42 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.command.subcommand;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.command.ProxyCommandInfo;
import eu.kennytv.maintenance.core.util.SenderInfo;
public final class StatusCommand extends ProxyCommandInfo {
public StatusCommand(final MaintenanceProxyPlugin plugin) {
super(plugin, "singleserver.status");
}
@Override
public void execute(final SenderInfo sender, final String[] args) {
if (getSettings().getMaintenanceServers().isEmpty()) {
sender.send(getMessage("singleServerMaintenanceListEmpty"));
return;
}
sender.send(getMessage("singleServerMaintenanceList"));
for (final String server : getSettings().getMaintenanceServers()) {
sender.send(getMessage("singleServerMaintenanceListEntry", "%SERVER%", server));
}
}
}
@@ -0,0 +1,78 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.hook;
import eu.kennytv.maintenance.core.hook.LuckPermsHook;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import net.luckperms.api.LuckPermsProvider;
import net.luckperms.api.context.ContextCalculator;
import net.luckperms.api.context.ContextConsumer;
import net.luckperms.api.context.ContextSet;
import net.luckperms.api.context.ImmutableContextSet;
import org.jetbrains.annotations.NotNull;
import java.util.function.Function;
public final class LuckPermsProxyHook {
public static <T> void register(final MaintenanceProxyPlugin plugin, final Function<T, String> function) {
LuckPermsProvider.get().getContextManager().registerCalculator(new MaintenanceProxyCalculator<>(plugin, function));
}
public static final class MaintenanceProxyCalculator<T> implements ContextCalculator<T> {
private static final String MAINTENANCE_ON_KEY = "is-maintenance-on-";
private static final String ON_MAINTENANCE_SERVER_KEY = "on-maintenance-server";
private final MaintenanceProxyPlugin maintenance;
private final Function<T, String> playerServerFunction;
private MaintenanceProxyCalculator(final MaintenanceProxyPlugin plugin, final Function<T, String> playerServerFunction) {
this.maintenance = plugin;
this.playerServerFunction = playerServerFunction;
}
@Override
public void calculate(@NotNull final T target, @NotNull final ContextConsumer consumer) {
consumer.accept(LuckPermsHook.MaintenanceCalculator.MAINTENANCE_KEY, Boolean.toString(maintenance.isMaintenance()));
/*for (final String serverName : maintenance.getServers()) {
final Server server = maintenance.getServer(serverName);
if (server != null) {
consumer.accept(MAINTENANCE_ON_KEY + server, Boolean.toString(maintenance.isMaintenance(server)));
}
}*/
final String server = playerServerFunction.apply(target);
if (server != null) {
final String value = Boolean.toString(maintenance.getSettingsProxy().isMaintenance(server));
consumer.accept(MAINTENANCE_ON_KEY + server, value);
consumer.accept(ON_MAINTENANCE_SERVER_KEY, value);
}
}
@Override
public ContextSet estimatePotentialContexts() {
final ImmutableContextSet.Builder builder = ImmutableContextSet.builder();
for (final String serverName : maintenance.getServers()) {
final String key = MAINTENANCE_ON_KEY + serverName;
builder.add(key, "true").add(key, "false");
}
return builder.add(ON_MAINTENANCE_SERVER_KEY, "true").add(ON_MAINTENANCE_SERVER_KEY, "false")
.add(LuckPermsHook.MaintenanceCalculator.MAINTENANCE_KEY, "true")
.add(LuckPermsHook.MaintenanceCalculator.MAINTENANCE_KEY, "false").build();
}
}
}
@@ -0,0 +1,121 @@
/*
* This file is part of Maintenance - https://github.com/kennytv/Maintenance
* 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
* 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.proxy.listener;
import eu.kennytv.maintenance.api.proxy.Server;
import eu.kennytv.maintenance.core.listener.JoinListenerBase;
import eu.kennytv.maintenance.core.proxy.MaintenanceProxyPlugin;
import eu.kennytv.maintenance.core.proxy.SettingsProxy;
import eu.kennytv.maintenance.core.proxy.util.ProxySenderInfo;
import eu.kennytv.maintenance.core.proxy.util.ServerConnectResult;
import eu.kennytv.maintenance.core.util.SenderInfo;
import org.jetbrains.annotations.Nullable;
public abstract class ProxyJoinListenerBase extends JoinListenerBase {
private static final ServerConnectResult ALLOWED = new ServerConnectResult(false);
private static final ServerConnectResult DENIED = new ServerConnectResult(true);
protected final MaintenanceProxyPlugin plugin;
protected final SettingsProxy settings;
private boolean warned;
protected ProxyJoinListenerBase(final MaintenanceProxyPlugin plugin, final SettingsProxy settings) {
super(plugin, settings);
this.plugin = plugin;
this.settings = settings;
}
/**
* @param sender joined player
* @param target target server
* @param normalServerConnect true if normal server connect, false if initial proxy join or kick
* @return connect result with data for further handling
*/
protected ServerConnectResult serverConnect(final ProxySenderInfo sender, final Server target, final boolean normalServerConnect) {
// Check waiting server for global maintenance
if (settings.isMaintenance()) {
if (sender.hasMaintenancePermission("bypass") || settings.isWhitelisted(sender.getUuid())) return ALLOWED;
final Server waitingServer = shouldConnectToWaitingServer(sender);
// Should never be null, but just in case
if (waitingServer == null) return DENIED;
// Player is connecting to the waiting server
if (target.getName().equals(waitingServer.getName())) return ALLOWED;
// Player already is on the waiting server
final String currentServer = plugin.getServerNameOf(sender);
if (waitingServer.getName().equals(currentServer)) {
sender.send(settings.getMessage("forceWaitingServer"));
return DENIED;
}
sender.send(settings.getMessage("sentToWaitingServer"));
return new ServerConnectResult(waitingServer);
}
// Single server maintenance
if (!settings.isMaintenance(target.getName())) return ALLOWED;
if (sender.hasMaintenancePermission("bypass") || settings.isWhitelisted(sender.getUuid())
|| sender.hasMaintenancePermission("singleserver.bypass." + target.getName().toLowerCase())) {
return ALLOWED;
}
if (settings.isJoinNotifications()) {
broadcastJoinNotification(sender.getName(), target);
}
if (normalServerConnect) {
sender.send(settings.getServerKickMessage(target.getName()));
return DENIED;
}
// If it's the initial proxy join or a kick from another server, go back to fallback server
final Server fallback = settings.getFallbackServer();
if (fallback == null || !sender.canAccess(fallback)) {
// Nothing to redirect to, player has to be kicked from the proxy
sender.disconnect(settings.getFullServerKickMessage(target.getName()));
if (!warned) {
plugin.getLogger().warning("Could not send player to the set fallback server; instead kicking player off the network!");
warned = true;
}
return DENIED;
} else {
return new ServerConnectResult(fallback);
}
}
/**
* To be called after {@link #shouldKick(SenderInfo, boolean)} to get the waiting server if present.
* Does not do any permission checks, they should be done separately!
*
* @param sender sender
* @return waiting server, null if player should be kicked
*/
@Nullable
protected Server shouldConnectToWaitingServer(final ProxySenderInfo sender) {
if (settings.getWaitingServer() == null) return null;
final Server waitingServer = plugin.getServer(settings.getWaitingServer());
if (waitingServer == null) return null;
if (!sender.canAccess(waitingServer) || settings.isMaintenance(waitingServer.getName())) return null;
return waitingServer;
}
protected abstract void broadcastJoinNotification(String name, Server server);
}
Loaded 100 of 218 files, more files were not shown because too many files have changed in this diff. Show more