Compare commits

...

231 Commits

Author SHA1 Message Date
HaHaWTH 6ffdc4d2b6 Update floodgate repo 2023-12-02 18:50:26 +08:00
HaHaWTH 44f9c75f41 Update floodgate repo 2023-12-02 18:48:25 +08:00
HaHaWTH e0cc4e0790 Optimise GeoIP & Bump floodgate to 2.2.2-SNAPSHOT 2023-12-02 18:45:22 +08:00
HaHaWTH 1d9e1cb033 CHANGES: Migrate config path 2023-12-01 23:00:38 +08:00
HaHaWTH e413760b32 rename method 2023-12-01 22:45:38 +08:00
HaHaWTH 72f0055c58 Move string generate to playerLogin 2023-12-01 22:39:52 +08:00
HaHaWTH 4260b9d1ec Remove extra check 2023-12-01 00:57:28 +08:00
HaHaWTH 4eee83ca6f Fix #57 2023-12-01 00:52:44 +08:00
HaHaWTH 5cbbe5fc61 Merge remote-tracking branch 'origin/master' 2023-12-01 00:07:00 +08:00
HaHaWTH a542a35eba Add FormUtils for advanced bedrock experience 2023-12-01 00:01:29 +08:00
DGun Otto 00e34c21e1 [ci skip] Update README.md 2023-11-29 00:03:02 +08:00
HaHaWTH cf718a4cbd LoginLocationFix patch 2023-11-28 00:14:37 +08:00
HaHaWTH 5b037221a7 Merge remote-tracking branch 'origin/master' 2023-11-27 22:58:10 +08:00
HaHaWTH bee35c4ebf patch for BedrockAutoLogin 2023-11-27 22:57:54 +08:00
DGun Otto 3c364edbe1 Merge pull request #56 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.44.1.0
Bump org.xerial:sqlite-jdbc from 3.44.0.0 to 3.44.1.0
2023-11-27 22:24:45 +08:00
HaHaWTH 98fee693a4 private final 2023-11-27 22:17:04 +08:00
HaHaWTH 2734c3e58e update 2023-11-27 22:14:55 +08:00
HaHaWTH 6d7c928197 update 2023-11-27 15:56:24 +08:00
dependabot[bot] 0635e67e93 Bump org.xerial:sqlite-jdbc from 3.44.0.0 to 3.44.1.0
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.44.0.0 to 3.44.1.0.
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.44.0.0...3.44.1.0)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 04:14:35 +00:00
HaHaWTH b4df964d79 Merge remote-tracking branch 'origin/master' 2023-11-27 02:26:34 +08:00
HaHaWTH 36e8f7691a patch 2023-11-27 02:25:59 +08:00
DGun Otto 94803c4ff1 [ci skip] Update README.md 2023-11-27 02:17:10 +08:00
HaHaWTH 4886e3464f Compatibility patch 2023-11-27 01:23:29 +08:00
HaHaWTH 352ab899d4 Compatibility patch 2023-11-27 01:18:50 +08:00
HaHaWTH 23306d1f5c prepare for b34 2023-11-25 19:15:19 +08:00
HaHaWTH fc546ac87a GUI Captcha fix 2023-11-25 19:13:02 +08:00
HaHaWTH 764b2788ae update 2023-11-25 18:55:06 +08:00
HaHaWTH d1fc832d2d update 2023-11-25 18:27:38 +08:00
HaHaWTH c170c70639 No need to remove 2023-11-25 00:30:54 +08:00
HaHaWTH 8db8d0f6da No need to remove 2023-11-24 21:28:16 +08:00
HaHaWTH 6b5e0b82ba Code improvement 2023-11-23 22:19:23 +08:00
HaHaWTH 265ea66894 Use Hashmap 2023-11-22 23:20:54 +08:00
HaHaWTH b1b4bb0a79 Remove folialib dependency 2023-11-19 20:26:49 +08:00
HaHaWTH fa7ce8bfb4 Add folialib dependency 2023-11-19 17:20:07 +08:00
HaHaWTH 78369644c7 Update html 2023-11-19 13:27:19 +08:00
HaHaWTH 22b8b6bf64 Cleanup 2023-11-19 12:04:46 +08:00
HaHaWTH fcec8e41a2 Patch 2023-11-19 11:36:42 +08:00
HaHaWTH ee24cabbed Fix config typo 2023-11-19 11:02:21 +08:00
HaHaWTH eed1c5aedc Add country whitelist for GUI captcha 2023-11-19 10:58:47 +08:00
HaHaWTH 1f88b3bc12 Revert changes about H2 2023-11-18 20:52:25 +08:00
HaHaWTH 5cd8791fee Merge remote-tracking branch 'origin/master' 2023-11-18 20:21:53 +08:00
HaHaWTH 787e04488b Loadable H2 2023-11-18 20:20:23 +08:00
DGun Otto 2accd9592c [ci skip] Update workflow 2023-11-18 19:57:41 +08:00
DGun Otto 66bfbbbdb1 Update workflow 2023-11-18 19:54:02 +08:00
HaHaWTH cb195fd1ca Try to implement H2 2023-11-18 19:52:55 +08:00
HaHaWTH a1ef28095f Use private instead of public static 2023-11-17 10:48:20 +08:00
HaHaWTH 77b40cc1e8 Use private instead of public static 2023-11-17 10:45:28 +08:00
HaHaWTH 4c52484fd7 Revert changes 2023-11-17 01:14:17 +08:00
HaHaWTH 5b72708167 Add a method to check if the player is in GUI verification 2023-11-16 22:37:41 +08:00
HaHaWTH b69e931c44 Update workflow 2023-11-16 01:48:57 +08:00
HaHaWTH 213b1c2702 Update workflow 2023-11-16 01:48:01 +08:00
HaHaWTH 0fef595229 [ci skip] Update README.md 2023-11-16 01:44:06 +08:00
HaHaWTH 791d1f1872 [ci skip] Update README.md 2023-11-16 01:42:55 +08:00
HaHaWTH ef92c776af [ci skip] Update README.md 2023-11-16 01:41:50 +08:00
HaHaWTH 66cf0143f6 fix config typo 2023-11-16 01:22:47 +08:00
HaHaWTH 3ff3b0d294 Merge remote-tracking branch 'origin/master' 2023-11-16 01:19:14 +08:00
HaHaWTH b9ecb58760 TrMenu compatibility (Thanks to @Dreeam) 2023-11-16 01:18:57 +08:00
DGun Otto a8e55b4ae3 Merge pull request #53 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.44.0.0
Bump org.xerial:sqlite-jdbc from 3.43.2.2 to 3.44.0.0
2023-11-14 23:57:28 +08:00
HaHaWTH 657e51f2cc Bump version number to b33 2023-11-14 02:01:27 +08:00
dependabot[bot] ff16f91311 Bump org.xerial:sqlite-jdbc from 3.43.2.2 to 3.44.0.0
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.43.2.2 to 3.44.0.0.
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.43.2.2...3.44.0.0)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-13 04:52:36 +00:00
HaHaWTH d05d4971b5 Merge remote-tracking branch 'origin/master' 2023-11-12 19:35:56 +08:00
HaHaWTH 5f58e92666 Update event 2023-11-12 19:35:34 +08:00
DGun Otto a31c2f45b1 Update README.md 2023-11-12 14:57:34 +08:00
DGun Otto 06d9e71ae8 [ci skip] Update README.md 2023-11-12 14:56:13 +08:00
HaHaWTH 441e020192 Localized DoubleLoginFix 2023-11-12 14:19:01 +08:00
HaHaWTH f153867d85 Merge remote-tracking branch 'origin/master' 2023-11-12 14:12:39 +08:00
HaHaWTH eed5ce1b7b Localized LoginLocationFix 2023-11-12 14:12:11 +08:00
DGun Otto 00b4bcb6a3 [ci skip] Update README 2023-11-12 13:24:35 +08:00
HaHaWTH e69ba501da Localized BedrockAutoLogin 2023-11-12 11:31:47 +08:00
HaHaWTH f2ccbf72a8 Another method 2023-11-12 00:54:52 +08:00
HaHaWTH c29aec210b Prepare for B32 2023-11-11 22:13:44 +08:00
HaHaWTH 78b5102692 Prepare for B32 2023-11-11 21:41:08 +08:00
HaHaWTH 9fd671db85 Use bukkitService 2023-11-11 21:18:42 +08:00
HaHaWTH beb99418d4 switch to warning 2023-11-11 21:16:17 +08:00
HaHaWTH 0f70de9a5a patch 2023-11-11 21:04:35 +08:00
HaHaWTH 08ad55c742 typo 2023-11-11 21:03:36 +08:00
HaHaWTH a70c1e0102 Migration 2023-11-11 20:49:53 +08:00
HaHaWTH efec997128 Add tips 2023-11-11 20:47:32 +08:00
HaHaWTH 413c2a39d7 Add tips 2023-11-11 20:45:27 +08:00
HaHaWTH 5a9b9ce619 Unified code style 2023-11-11 20:32:01 +08:00
HaHaWTH ee58da2b39 SQL support for Java8 2023-11-11 14:43:59 +08:00
DGun Otto 7475cd8ea4 Update maven.yml 2023-11-11 12:59:21 +08:00
HaHaWTH 8b8f6c0e2e fix 2023-11-11 12:57:09 +08:00
HaHaWTH 69b170b754 11&8 2023-11-11 12:55:42 +08:00
HaHaWTH 702b6aae32 Code Cleanup 2023-11-11 12:20:40 +08:00
HaHaWTH 010874586a Localized GUI Captcha 2023-11-11 11:12:48 +08:00
HaHaWTH fcc34c28aa Migrate to @Inject 2023-11-11 10:00:27 +08:00
HaHaWTH ecbc11cf0b Useless 2023-11-10 22:28:46 +08:00
HaHaWTH bfd3a8f439 Merge remote-tracking branch 'origin/master' 2023-11-10 22:18:02 +08:00
HaHaWTH f8dd410d96 Improved code style 2023-11-10 22:17:35 +08:00
DGun Otto 2459aec4b6 Merge pull request #46 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.43.2.2
Bump org.xerial:sqlite-jdbc from 3.43.2.1 to 3.43.2.2
2023-11-10 00:49:53 +08:00
DGun Otto d623337a15 Merge pull request #47 from HaHaWTH/dependabot/maven/org.checkerframework-checker-qual-3.40.0
Bump org.checkerframework:checker-qual from 3.39.0 to 3.40.0
2023-11-10 00:49:28 +08:00
HaHaWTH 73c3cea778 Optimises 2023-11-05 12:17:21 +08:00
HaHaWTH 11a4cff10a Revert changes 2023-11-04 18:42:55 +08:00
HaHaWTH 628d5adcb5 MapUtils 2023-11-04 18:31:36 +08:00
HaHaWTH 8681cd0733 MapCaptchaHandler 2023-11-04 18:29:44 +08:00
HaHaWTH bb2fdbfb40 why r there so many runTask 2023-11-04 18:04:28 +08:00
HaHaWTH 4dedc30d94 Format 2023-11-04 18:01:39 +08:00
dependabot[bot] fa995eea53 Bump org.checkerframework:checker-qual from 3.39.0 to 3.40.0
Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 3.39.0 to 3.40.0.
- [Release notes](https://github.com/typetools/checker-framework/releases)
- [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/typetools/checker-framework/compare/checker-framework-3.39.0...checker-framework-3.40.0)

---
updated-dependencies:
- dependency-name: org.checkerframework:checker-qual
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-02 05:04:26 +00:00
dependabot[bot] e819be918b Bump org.xerial:sqlite-jdbc from 3.43.2.1 to 3.43.2.2
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.43.2.1 to 3.43.2.2.
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.43.2.1...3.43.2.2)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-31 04:16:08 +00:00
HaHaWTH 1e3e625c1a Update: fake player compatibility(UNTESTED) 2023-10-28 20:32:38 +08:00
HaHaWTH b747a4bdff Update: untested 2023-10-28 20:21:10 +08:00
HaHaWTH 03443104be Prepare for PacketPlayerListener 2023-10-27 20:54:13 +08:00
HaHaWTH 819e55e235 Prepare for PacketPlayerListener 2023-10-25 01:07:44 +08:00
HaHaWTH 80b06f3bc7 Now prepare for B31 2023-10-25 01:05:36 +08:00
HaHaWTH d90e87896c [ci skip] 2023-10-22 19:07:31 +08:00
HaHaWTH 72073b80f0 debug & update 2023-10-22 14:13:28 +08:00
HaHaWTH 19866bc4a4 Add thanks 2023-10-22 10:18:24 +08:00
HaHaWTH cf4037614a Patch 2023-10-22 10:15:04 +08:00
HaHaWTH 5c22601c52 Add Bedrock player auto login feature 2023-10-22 10:13:08 +08:00
HaHaWTH 1bb3bb1fa7 Prepare for B30 2023-10-21 19:50:35 +08:00
HaHaWTH 11959ca794 Rename material to materialPortal 2023-10-21 19:46:46 +08:00
HaHaWTH 9ba9af6369 Logic improvement 2023-10-21 19:29:30 +08:00
HaHaWTH 584f2074fd Bump Spigot API to 1.20.2 2023-10-21 18:59:07 +08:00
HaHaWTH 2971a0a202 Revert ProtocolPacketListener update 2023-10-21 18:21:44 +08:00
HaHaWTH 3cc8128faa ProtocolPacketListener update 2023-10-21 18:16:24 +08:00
HaHaWTH 1ef7ed4b3f Random string for click verify 2023-10-21 18:12:33 +08:00
HaHaWTH 59eabe38c6 Code readability update 2023-10-21 18:01:01 +08:00
HaHaWTH 1c090a5a65 Update TeleportUtils 2023-10-21 00:11:56 +08:00
HaHaWTH 82fade61d5 B29 update 2023-10-20 21:52:54 +08:00
HaHaWTH fc5009bf0d Use TeleportUtils 2023-10-20 21:40:16 +08:00
HaHaWTH 9fe91fe22c Use TeleportUtils 2023-10-20 21:30:36 +08:00
HaHaWTH 37d327bcb6 Merge remote-tracking branch 'origin/master' 2023-10-19 23:41:04 +08:00
HaHaWTH 217b411095 GUICaptcha is now beta 2023-10-19 23:40:50 +08:00
DGun Otto 9239f3a90d [ci skip] Update README.md 2023-10-19 22:17:01 +08:00
HaHaWTH ae9d9ea159 Merge remote-tracking branch 'origin/master' 2023-10-19 22:10:13 +08:00
HaHaWTH 12cfd243f6 Prepare for B29 2023-10-19 22:09:56 +08:00
DGun Otto 059c00c2ad Update sqlite-jdbc
Bump org.xerial:sqlite-jdbc from 3.40.1.0 to 3.43.2.1
2023-10-19 22:07:34 +08:00
HaHaWTH 3dab24c142 Delete useless options & make code more readable 2023-10-19 22:03:23 +08:00
dependabot[bot] 4de55f9cf6 Bump org.xerial:sqlite-jdbc from 3.40.1.0 to 3.43.2.1
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.40.1.0 to 3.43.2.1.
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.40.1.0...3.43.2.1)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 04:18:04 +00:00
HaHaWTH 07d9bbbf7c LoginLocationFixListener logic improvement 2023-10-18 22:11:16 +08:00
HaHaWTH c182510a46 Small clean up 2023-10-18 01:44:28 +08:00
HaHaWTH aec1277ab3 Update build 2023-10-17 00:50:10 +08:00
HaHaWTH 32b694cbb0 Infinity bug fix 2023-10-15 15:11:08 +08:00
HaHaWTH 932368f2d6 Massive bug fixes 2023-10-15 14:57:37 +08:00
HaHaWTH 7a33fc8928 Bug fix 2023-10-15 14:01:40 +08:00
HaHaWTH d048db44ba Fix 2023-10-15 12:36:31 +08:00
HaHaWTH 76b92bacd9 Prepare for B28 2023-10-15 10:25:26 +08:00
HaHaWTH dadae42992 Improve GUI captcha performance 2023-10-15 10:12:08 +08:00
HaHaWTH 1e9058a5cb Clean up 2023-10-15 09:08:48 +08:00
HaHaWTH b307911896 Small tweaks 2023-10-15 09:06:12 +08:00
HaHaWTH 11a1547242 Rewrite the update checker 2023-10-14 21:52:05 +08:00
HaHaWTH 17ee5dc97b Prepare for B27 2023-10-14 20:37:23 +08:00
HaHaWTH ac89630f5d Improve version compatibility 2023-10-14 19:24:12 +08:00
HaHaWTH 94028484cf Revert changes 2023-10-14 19:15:49 +08:00
HaHaWTH 1b1fd77470 Merge remote-tracking branch 'origin/master' 2023-10-14 19:09:54 +08:00
HaHaWTH 7a7b148a7d Logic Improvement 2023-10-14 19:09:35 +08:00
DGun Otto e6cee92ef1 [ci skip] Update README.md 2023-10-13 20:32:23 +08:00
HaHaWTH 31123081c7 Improve check logic 2023-10-13 20:21:53 +08:00
HaHaWTH b5b435d398 Improve check logic 2023-10-13 20:13:02 +08:00
HaHaWTH 395f8f825f Fix config typo 2023-10-13 20:05:05 +08:00
HaHaWTH c71bd9f3a8 Fix LoginLocationFixListener throws error on legacy versions 2023-10-13 19:48:35 +08:00
HaHaWTH 3e971c3dfd Fix LoginLocationFixListener throws error on legacy versions 2023-10-13 19:38:46 +08:00
HaHaWTH 3f372d9228 Small patches 2023-10-13 18:58:35 +08:00
HaHaWTH d385093403 Revert mokito-core to 5.2.0 2023-10-13 18:49:03 +08:00
HaHaWTH f978b285ae Prepare for B26 2023-10-13 18:46:26 +08:00
HaHaWTH 1eeaa442db Merge remote-tracking branch 'origin/master' 2023-10-13 18:43:21 +08:00
HaHaWTH 14cc0abdc5 Add LoginLocationFixListener feature 2023-10-13 18:43:05 +08:00
DGun Otto d5ce692933 Merge pull request #39 from HaHaWTH/dependabot/maven/org.mockito-mockito-core-5.6.0
Bump org.mockito:mockito-core from 5.2.0 to 5.6.0
2023-10-10 00:28:21 +08:00
dependabot[bot] 56a7b90c99 Bump org.mockito:mockito-core from 5.2.0 to 5.6.0
Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.2.0 to 5.6.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v5.2.0...v5.6.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-09 04:21:20 +00:00
DGun Otto 9352e7f32e Merge pull request #38 from HaHaWTH/dependabot/maven/org.checkerframework-checker-qual-3.39.0
Bump org.checkerframework:checker-qual from 3.32.0 to 3.39.0
2023-10-03 13:58:26 +08:00
dependabot[bot] 0fc2f61a42 Bump org.checkerframework:checker-qual from 3.32.0 to 3.39.0
Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 3.32.0 to 3.39.0.
- [Release notes](https://github.com/typetools/checker-framework/releases)
- [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/typetools/checker-framework/compare/checker-framework-3.32.0...checker-framework-3.39.0)

---
updated-dependencies:
- dependency-name: org.checkerframework:checker-qual
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 05:11:37 +00:00
HaHaWTH 25249125b1 Code format 2023-10-02 08:25:20 +08:00
HaHaWTH 9d6d325fa6 English 2023-10-02 08:21:25 +08:00
HaHaWTH 0d408ede47 Update gitignore 2023-10-02 00:03:14 +08:00
HaHaWTH 36bc761c19 Fix NPE 2023-10-01 22:55:52 +08:00
HaHaWTH 9c3f0b0142 Fixed Issue #35 2023-10-01 20:52:59 +08:00
HaHaWTH e6be595c16 Prepare for B25 update 2023-10-01 19:58:26 +08:00
HaHaWTH dd4739a822 Merge remote-tracking branch 'origin/master' 2023-10-01 19:56:51 +08:00
HaHaWTH 39254506bf Prevent duplicate register listeners(will improve performance) 2023-10-01 19:56:32 +08:00
DGun Otto 227d93d756 Merge pull request #37 from xiaoxing365/master
添加一个依赖库支持
2023-10-01 12:20:22 +08:00
DGun Otto d223f316d6 [ci skip]Update README.md 2023-09-30 23:56:54 +08:00
xiaoxing365 b6ec553dcb Merge branch 'HaHaWTH:master' into master 2023-09-30 23:35:32 +08:00
BuildTools cc6a9c38bd Add a dependence repository,that's jitpack. 2023-09-30 23:32:17 +08:00
HaHaWTH 04ad3adbd1 Add 1.8 compatibility & Bump to B24 2023-09-30 15:22:34 +08:00
HaHaWTH ef3804bf4e Add extra logic to prevent deleting normal player data 2023-09-30 14:14:56 +08:00
HaHaWTH b5d3408773 Merge remote-tracking branch 'origin/master' 2023-09-30 12:37:59 +08:00
HaHaWTH 470f5ff28f Add 2023-09-30 12:36:48 +08:00
DGun Otto 888ee7235b [ci skip] Update README.md 2023-09-30 12:12:49 +08:00
DGun Otto c97eda6672 Update README.md 2023-09-30 11:44:58 +08:00
DGun Otto 81478f203c [ci skip] Update README.md 2023-09-30 10:37:48 +08:00
DGun Otto ec51635d44 [ci skip] Update README.md 2023-09-30 10:36:05 +08:00
DGun Otto aae15fba60 [ci skip] Update README.md 2023-09-30 10:35:43 +08:00
DGun Otto 57fad7e113 [ci skip] Update README.md 2023-09-30 10:33:15 +08:00
HaHaWTH 1c25908a04 Bump to Alpha 4 2023-09-30 10:12:43 +08:00
HaHaWTH 84a8137955 Bug Fix 2023-09-30 10:10:25 +08:00
HaHaWTH 038d4c1850 logic improvement 2023-09-30 09:55:26 +08:00
理塘丁真 0ffe2c2fc9 Deleted useless code 2023-09-30 09:04:55 +08:00
HaHaWTH 401933038d It works! 2023-09-30 09:02:47 +08:00
HaHaWTH 5cf88f308a Patch 2023-09-29 21:06:54 +08:00
HaHaWTH 29df796c48 Code Format 2023-09-29 17:36:06 +08:00
HaHaWTH 79af85667e Actually fix purge 2023-09-29 17:18:10 +08:00
HaHaWTH 57237f6dfa Fixes 2023-09-29 16:33:12 +08:00
HaHaWTH fc86e3ef78 Fix typo 2023-09-29 16:22:42 +08:00
HaHaWTH 846b7f67e5 Fix typo 2023-09-29 16:18:55 +08:00
HaHaWTH ffe3f5d24a Fix typo 2023-09-29 16:17:00 +08:00
HaHaWTH 2db1a15c72 Fix config path 2023-09-29 16:14:51 +08:00
HaHaWTH 95342ae054 Add features to delete bot join data 2023-09-29 16:13:48 +08:00
HaHaWTH 6800356f10 Small tweaks 2023-09-29 15:29:44 +08:00
HaHaWTH 95b5d88197 Fix typo 2023-09-29 15:26:10 +08:00
HaHaWTH 9f6f55d8e8 Fix config description 2023-09-29 15:24:26 +08:00
HaHaWTH d1ebcfeef0 Fix 2023-09-29 15:22:16 +08:00
HaHaWTH 5305bf0bfd Fix 2023-09-29 15:09:32 +08:00
HaHaWTH 78c5ab5d8a Add banner color switch option & advanced banners 2023-09-29 15:02:18 +08:00
HaHaWTH 836c568fef Update GeoLite2-Country database 2023-09-29 12:12:41 +08:00
HaHaWTH 7cbd1ebae7 Fix config path 2023-09-29 11:39:57 +08:00
HaHaWTH a35a277b32 Add useless banners & Code cleanup 2023-09-29 11:34:53 +08:00
HaHaWTH 971f0f7683 Update README 2023-09-23 18:58:08 +08:00
HaHaWTH d2718c1934 Bump ProtocolLib to 5.1.0 & EssentialsX to 2.20.1 2023-09-23 18:47:12 +08:00
HaHaWTH 0cdd2b20d6 Code Improvement 2023-09-23 18:42:23 +08:00
HaHaWTH 66b2bf8436 Code Improvement 2023-09-23 18:40:18 +08:00
HaHaWTH cf01767ad3 Revert changes 2023-09-23 18:29:17 +08:00
HaHaWTH fdefdb88cc Implement translation (2) 2023-09-23 18:17:12 +08:00
HaHaWTH 4bcc992b7f Implement translation (1) 2023-09-23 18:12:52 +08:00
HaHaWTH 35aba2207b TODO 2023-09-21 22:07:27 +08:00
HaHaWTH ce2ee9e0fb Fix config typo 2023-09-21 21:49:35 +08:00
HaHaWTH 9093ad2d9f Prepare for b23 2023-09-20 02:32:53 +08:00
HaHaWTH 08ed6504f2 Cleanup 2023-09-20 02:29:24 +08:00
HaHaWTH 9f70748b55 Useless code cleanup 2023-09-20 02:26:48 +08:00
HaHaWTH 3f6a7ce48f Sync repo files to b22 2023-09-20 02:15:22 +08:00
HaHaWTH ed320196fe Remove all files 2023-09-20 02:10:19 +08:00
DGun Otto 62f27f8231 Merge pull request #25 from HaHaWTH/dependabot/maven/org.slf4j-slf4j-simple-2.0.9
Bump org.slf4j:slf4j-simple from 2.0.7 to 2.0.9
2023-09-16 22:51:34 +08:00
dependabot[bot] c3485903c5 Bump org.slf4j:slf4j-simple from 2.0.7 to 2.0.9
Bumps org.slf4j:slf4j-simple from 2.0.7 to 2.0.9.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-simple
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 04:14:09 +00:00
dependabot[bot] 5f3089b61b Merge pull request #21 from HaHaWTH/dependabot/maven/org.mariadb.jdbc-mariadb-java-client-3.2.0 2023-09-03 10:11:12 +00:00
dependabot[bot] e8f42ab669 Merge pull request #20 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.42.0.1 2023-08-28 12:25:51 +00:00
dependabot[bot] e3ff584bf4 Bump org.mariadb.jdbc:mariadb-java-client from 3.1.4 to 3.2.0
Bumps [org.mariadb.jdbc:mariadb-java-client](https://github.com/mariadb-corporation/mariadb-connector-j) from 3.1.4 to 3.2.0.
- [Release notes](https://github.com/mariadb-corporation/mariadb-connector-j/releases)
- [Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mariadb-corporation/mariadb-connector-j/compare/3.1.4...3.2.0)

---
updated-dependencies:
- dependency-name: org.mariadb.jdbc:mariadb-java-client
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-28 04:23:57 +00:00
dependabot[bot] a9116a2f28 Bump org.xerial:sqlite-jdbc from 3.42.0.0 to 3.42.0.1
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.42.0.0 to 3.42.0.1.
- [Release notes](https://github.com/xerial/sqlite-jdbc/releases)
- [Changelog](https://github.com/xerial/sqlite-jdbc/blob/master/CHANGELOG)
- [Commits](https://github.com/xerial/sqlite-jdbc/compare/3.42.0.0...3.42.0.1)

---
updated-dependencies:
- dependency-name: org.xerial:sqlite-jdbc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-28 04:23:39 +00:00
DGun Otto ddd8c44396 Merge pull request #17 from HaHaWTH/dependabot/maven/net.essentialsx-EssentialsX-2.20.1
Bump net.essentialsx:EssentialsX from 2.20.0 to 2.20.1
2023-08-07 21:09:11 +08:00
dependabot[bot] 6edcfa993e Bump net.essentialsx:EssentialsX from 2.20.0 to 2.20.1
Bumps [net.essentialsx:EssentialsX](https://github.com/EssentialsX/Essentials) from 2.20.0 to 2.20.1.
- [Release notes](https://github.com/EssentialsX/Essentials/releases)
- [Commits](https://github.com/EssentialsX/Essentials/compare/2.20.0...2.20.1)

---
updated-dependencies:
- dependency-name: net.essentialsx:EssentialsX
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 04:56:34 +00:00
dependabot[bot] e63764e2cf Merge pull request #16 from HaHaWTH/dependabot/maven/org.checkerframework-checker-qual-3.37.0 2023-08-03 17:42:49 +00:00
dependabot[bot] 63540088c9 Bump org.checkerframework:checker-qual from 3.36.0 to 3.37.0
Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 3.36.0 to 3.37.0.
- [Release notes](https://github.com/typetools/checker-framework/releases)
- [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/typetools/checker-framework/compare/checker-framework-3.36.0...checker-framework-3.37.0)

---
updated-dependencies:
- dependency-name: org.checkerframework:checker-qual
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-02 04:45:13 +00:00
42 changed files with 1506 additions and 493 deletions
-34
View File
@@ -1,34 +0,0 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
+7 -3
View File
@@ -10,7 +10,7 @@ jobs:
Build: Build:
strategy: strategy:
matrix: matrix:
jdkversion: [11] jdkversion: [ 11 ]
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -19,6 +19,10 @@ jobs:
distribution: 'temurin' distribution: 'temurin'
java-version: ${{ matrix.jdkversion }} java-version: ${{ matrix.jdkversion }}
cache: 'maven' cache: 'maven'
- name: 使用Maven构建 - name: Build
run: mvn -V -B clean package --file pom.xml run: mvn -V -B clean package --file pom.xml
- name: Upload Artifacts
uses: actions/upload-artifact@v3.1.2
with:
name: Download
path: ./target/AuthMe-5.6.0-FORK-Spigot-Universal.jar
+3 -2
View File
@@ -21,10 +21,11 @@ hs_err_pid*
# Ignore IDEA directory # Ignore IDEA directory
.idea/* .idea/*
.idea/
# Include the project's code style settings file # Include the project's code style settings file
!.idea/codeStyleSettings.xml
/target/class/
# File-based project format: # File-based project format:
*.ipr *.ipr
*.iws *.iws
+3
View File
@@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml
+31 -2
View File
@@ -1,4 +1,33 @@
# AuthMeReReloaded # AuthMeReReloaded
**"A fork of the best authentication plugin for the Bukkit modding API!"** **"A fork of the best authentication plugin for the Bukkit modding API!"**
MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471495)
![Graph](https://bstats.org/signatures/bukkit/AuthMeReloaded-Fork.svg) ![Graph](https://bstats.org/signatures/bukkit/AuthMeReloaded-Fork.svg)
<p align="center">
<img src="https://img.shields.io/github/languages/code-size/HaHaWTH/AuthMeReReloaded.svg" alt="Code size"/>
<img src="https://img.shields.io/github/repo-size/HaHaWTH/AuthMeReReloaded.svg" alt="GitHub repo size"/>
</p>
**Detailed Changes:**
1. Improved mail sending logic & support more emails
2. Shutdown mail sending(When server is closed, email you)
3. Legacy bug fixes
4. Anti Ghost Player(Doubled login bug)
5. Use the best performance method by server brand
6. Bedrock Compatibility(Floodgate needed)(based on UUID)
7. Update checker
8. Integrated GUI Captcha feature(Bedrock compatibility & ProtocolLib needed)(70% Asynchronous)
9. Improved listeners
10. Player login logic improvement to reduce lag
11. Automatically purge bot data
12. Folia
compatibility [Here](https://github.com/HaHaWTH/AuthMeReReloaded/releases/download/b20/AuthMe-5.6.0-FORK-Folia.jar)
13. Offhand Menu compatibility(Thats amazing)
14. Automatically fix portal stuck issue
15. Automatically login for Bedrock players(configurable)
16. More......
**Download links:**
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
[Actions(Dev builds, use at your own risk!)](https://github.com/HaHaWTH/AuthMeReReloaded/actions/workflows/maven.yml)
**Pull Requests and suggestions are welcome!**
+62 -19
View File
@@ -67,11 +67,11 @@
<maven.minimumVersion>3.6.3</maven.minimumVersion> <maven.minimumVersion>3.6.3</maven.minimumVersion>
<!-- Dependencies versions --> <!-- Dependencies versions -->
<spigot.version>1.19.2-R0.1-SNAPSHOT</spigot.version> <spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version>
<!-- Versioning properties --> <!-- Versioning properties -->
<project.outputName>AuthMe</project.outputName> <project.outputName>AuthMe</project.outputName>
<project.buildNumber>CUSTOM</project.buildNumber> <project.buildNumber>28</project.buildNumber>
<project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode> <project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode>
<project.finalNameBase>${project.outputName}-${project.version}</project.finalNameBase> <project.finalNameBase>${project.outputName}-${project.version}</project.finalNameBase>
@@ -217,7 +217,7 @@
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version> <version>0.8.8</version>
<executions> <executions>
<execution> <execution>
<id>pre-unit-test</id> <id>pre-unit-test</id>
@@ -531,6 +531,30 @@
</snapshots> </snapshots>
</repository> </repository>
<!-- Aliyun maven central repo -->
<repository>
<id>aliyun-repo</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- Tencent cloud maven central repo -->
<repository>
<id>tencent-repo</id>
<url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- CodeMC Repo (Contains many required libraries) --> <!-- CodeMC Repo (Contains many required libraries) -->
<repository> <repository>
<id>codemc-repo</id> <id>codemc-repo</id>
@@ -598,6 +622,13 @@
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> </repository>
<!-- FoliaLib -->
<repository>
<id>devmart-other</id>
<url>https://nexuslite.gcnt.net/repos/other/</url>
</repository>
<repository> <repository>
<id>opencollab-snapshot</id> <id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url> <url>https://repo.opencollab.dev/maven-snapshots/</url>
@@ -608,6 +639,20 @@
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> </repository>
<repository>
<id>jitpack</id>
<url>https://jitpack.io/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>opencollab-snapshot-main</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
@@ -615,8 +660,8 @@
<dependency> <dependency>
<groupId>org.geysermc.floodgate</groupId> <groupId>org.geysermc.floodgate</groupId>
<artifactId>api</artifactId> <artifactId>api</artifactId>
<version>2.2.0-SNAPSHOT</version> <version>2.2.2-SNAPSHOT</version>
<scope>compile</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Jalu Injector --> <!-- Jalu Injector -->
<dependency> <dependency>
@@ -677,7 +722,7 @@
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId> <artifactId>HikariCP</artifactId>
<version>5.0.1</version> <!-- Latest java 8 release --> <version>4.0.3</version> <!-- Latest java 8 release -->
<optional>true</optional> <optional>true</optional>
<exclusions> <exclusions>
<exclusion> <exclusion>
@@ -690,7 +735,7 @@
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-simple</artifactId>
<version>2.0.7</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 --> <version>1.7.36</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 -->
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -706,13 +751,13 @@
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId> <artifactId>mysql-connector-j</artifactId>
<version>8.1.0</version> <version>8.0.33</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mariadb.jdbc</groupId> <groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId> <artifactId>mariadb-java-client</artifactId>
<version>3.1.4</version> <version>3.1.2</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -774,13 +819,11 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Bukkit Libraries -->
<!-- ConfigMe --> <!-- ConfigMe -->
<dependency> <dependency>
<groupId>ch.jalu</groupId> <groupId>ch.jalu</groupId>
<artifactId>configme</artifactId> <artifactId>configme</artifactId>
<version>1.3.0</version> <version>1.3.1</version>
<optional>true</optional> <optional>true</optional>
<exclusions> <exclusions>
<exclusion> <exclusion>
@@ -802,7 +845,7 @@
<dependency> <dependency>
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>5.0.0</version> <version>5.1.0</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@@ -945,7 +988,7 @@
<dependency> <dependency>
<groupId>net.essentialsx</groupId> <groupId>net.essentialsx</groupId>
<artifactId>EssentialsX</artifactId> <artifactId>EssentialsX</artifactId>
<version>2.20.0</version> <version>2.20.1</version>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@@ -1017,7 +1060,7 @@
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.6.0</version> <version>42.5.4</version>
<optional>true</optional> <optional>true</optional>
<exclusions> <exclusions>
<exclusion> <exclusion>
@@ -1047,7 +1090,7 @@
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<scope>test</scope> <scope>test</scope>
<version>5.4.0</version> <version>5.2.0</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<artifactId>hamcrest-core</artifactId> <artifactId>hamcrest-core</artifactId>
@@ -1060,7 +1103,7 @@
<dependency> <dependency>
<groupId>org.checkerframework</groupId> <groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId> <artifactId>checker-qual</artifactId>
<version>3.36.0</version> <version>3.40.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@@ -1068,13 +1111,13 @@
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId> <artifactId>sqlite-jdbc</artifactId>
<version>3.42.0.0</version> <version>3.44.1.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>2.2.220</version> <version>2.1.214</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
+134 -154
View File
@@ -2,37 +2,26 @@ package fr.xephi.authme;
import ch.jalu.injector.Injector; import ch.jalu.injector.Injector;
import ch.jalu.injector.InjectorBuilder; import ch.jalu.injector.InjectorBuilder;
import com.google.gson.annotations.Since;
import fr.xephi.authme.api.v3.AuthMeApi; import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.command.CommandArgumentDescription;
import fr.xephi.authme.command.CommandHandler; import fr.xephi.authme.command.CommandHandler;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.initialization.DataFolder; import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.initialization.DataSourceProvider; import fr.xephi.authme.initialization.DataSourceProvider;
import fr.xephi.authme.initialization.OnShutdownPlayerSaver; import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
import fr.xephi.authme.initialization.OnStartupTasks; import fr.xephi.authme.initialization.OnStartupTasks;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import fr.xephi.authme.initialization.SettingsProvider; import fr.xephi.authme.initialization.SettingsProvider;
import fr.xephi.authme.initialization.TaskCloser; import fr.xephi.authme.initialization.TaskCloser;
import fr.xephi.authme.listener.BedrockAutoLoginListener;
import fr.xephi.authme.listener.BlockListener; import fr.xephi.authme.listener.BlockListener;
import fr.xephi.authme.listener.DoubleLoginFixListener;
import fr.xephi.authme.listener.EntityListener; import fr.xephi.authme.listener.EntityListener;
import fr.xephi.authme.listener.GuiCaptchaHandler;
import fr.xephi.authme.listener.LoginLocationFixListener;
import fr.xephi.authme.listener.PlayerListener; import fr.xephi.authme.listener.PlayerListener;
import fr.xephi.authme.listener.PlayerListener111; import fr.xephi.authme.listener.PlayerListener111;
import fr.xephi.authme.listener.PlayerListener19; import fr.xephi.authme.listener.PlayerListener19;
import fr.xephi.authme.listener.PlayerListener19Spigot; import fr.xephi.authme.listener.PlayerListener19Spigot;
import fr.xephi.authme.listener.PlayerQuitListener; import fr.xephi.authme.listener.PlayerListenerHigherThan18;
import fr.xephi.authme.listener.RegisterListener;
import fr.xephi.authme.listener.ServerListener; import fr.xephi.authme.listener.ServerListener;
import fr.xephi.authme.mail.EmailService; import fr.xephi.authme.mail.EmailService;
import fr.xephi.authme.output.ConsoleLoggerFactory; import fr.xephi.authme.output.ConsoleLoggerFactory;
@@ -45,40 +34,32 @@ import fr.xephi.authme.service.yaml.YamlParseException;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.SettingsWarner; import fr.xephi.authme.settings.SettingsWarner;
import fr.xephi.authme.settings.properties.EmailSettings; import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.task.CleanupTask; import fr.xephi.authme.task.CleanupTask;
import fr.xephi.authme.task.purge.PurgeService; import fr.xephi.authme.task.purge.PurgeService;
import fr.xephi.authme.util.ExceptionUtils; import fr.xephi.authme.util.ExceptionUtils;
import fr.xephi.authme.util.TeleportUtils;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import fr.xephi.authme.listener.PlayerQuitListener;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Scanner; import java.util.Scanner;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE; import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
import static fr.xephi.authme.util.Utils.isClassLoaded; import static fr.xephi.authme.util.Utils.isClassLoaded;
import static org.bukkit.Bukkit.getServer;
import static org.bukkit.Bukkit.isHardcore;
/** /**
* The AuthMe main class. * The AuthMe main class.
@@ -93,26 +74,24 @@ public class AuthMe extends JavaPlugin {
// Version and build number values // Version and build number values
private static String pluginVersion = "5.6.0-Fork"; private static String pluginVersion = "5.6.0-Fork";
private static final String pluginBuild = "b"; private static final String pluginBuild = "b";
private static String pluginBuildNumber = "17"; private static String pluginBuildNumber = "34";
protected final Boolean SHAEnabled = false;
// Private instances // Private instances
private EmailService emailService; private EmailService emailService;
private CommandHandler commandHandler; private CommandHandler commandHandler;
@Inject @Inject
private Settings settings; public static Settings settings;
private DataSource database; private DataSource database;
private BukkitService bukkitService; private BukkitService bukkitService;
private Injector injector; private Injector injector;
private BackupService backupService; private BackupService backupService;
private ConsoleLogger logger; public static ConsoleLogger logger;
/** /**
* Constructor. * Constructor.
*/ */
public AuthMe() { public AuthMe() {
} }
public static Boolean SATEnabled = false;
public static Boolean GUIEnabled = false;
/** /**
* Get the plugin's name. * Get the plugin's name.
* *
@@ -141,33 +120,34 @@ public class AuthMe extends JavaPlugin {
} }
/** /**
* Method called when the server enables the plugin. * Method called when the server enables the plugin.
*/ */
@Override @Override
public void onEnable() { public void onEnable() {
AuthMe.GUIEnabled = false;
AuthMe.SATEnabled = false;
// Load the plugin version data from the plugin description file // Load the plugin version data from the plugin description file
loadPluginInfo(getDescription().getVersion()); loadPluginInfo(getDescription().getVersion());
// Set the Logger instance and log file path // Set the Logger instance and log file path
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME)); ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
logger = ConsoleLoggerFactory.get(AuthMe.class); logger = ConsoleLoggerFactory.get(AuthMe.class);
logger.info("您正在加载的是由第三方Fork并修复众多错误的 AuthMeReReloaded!"); logger.info("You are running an unofficial fork version of AuthMe!");
// Check server version // Check server version
if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent") if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")
|| !isClassLoaded("org.bukkit.event.player.PlayerInteractAtEntityEvent")) { || !isClassLoaded("org.bukkit.event.player.PlayerInteractAtEntityEvent")) {
logger.warning("你正在运行不受支持的服务器版本 (" + getServerNameVersionSafe() + "). " logger.warning("You are running an unsupported server version (" + getServerNameVersionSafe() + "). "
+ "AuthMe 仅支持Spigot 1.9及之后的版本!"); + "AuthMe requires Spigot 1.8.X or later!");
stopOrUnload(); stopOrUnload();
return; return;
} }
// Prevent running AuthMeBridge due to major exploit issues // Prevent running AuthMeBridge due to major exploit issues
if (getServer().getPluginManager().isPluginEnabled("AuthMeBridge")) { if (getServer().getPluginManager().isPluginEnabled("AuthMeBridge")) {
logger.warning("检测到 AuthMeBridge被加载, 对AuthMeBridge的支持已经停止 " logger.warning("Detected AuthMeBridge, support for it has been dropped as it was "
+ "且可能会造成严重漏洞! 已中止加载!"); + "causing exploit issues, please use AuthMeBungee instead! Aborting!");
stopOrUnload(); stopOrUnload();
return; return;
} }
@@ -178,11 +158,11 @@ public class AuthMe extends JavaPlugin {
} catch (Throwable th) { } catch (Throwable th) {
YamlParseException yamlParseException = ExceptionUtils.findThrowableInCause(YamlParseException.class, th); YamlParseException yamlParseException = ExceptionUtils.findThrowableInCause(YamlParseException.class, th);
if (yamlParseException == null) { if (yamlParseException == null) {
logger.logException("已中止AuthMeReReloaded的初始化,原因:", th); logger.logException("Aborting initialization of AuthMe:", th);
th.printStackTrace(); th.printStackTrace();
} else { } else {
logger.logException("文件 '" + yamlParseException.getFile() + "' 包含YAML语法错误. " logger.logException("File '" + yamlParseException.getFile() + "' contains invalid YAML. "
+ "请尝试在 https://yamllint.com 中运行文件内容", yamlParseException); + "Please run its contents through http://yamllint.com", yamlParseException);
} }
stopOrUnload(); stopOrUnload();
return; return;
@@ -196,42 +176,44 @@ public class AuthMe extends JavaPlugin {
cleanupTask.runTaskTimerAsynchronously(this, CLEANUP_INTERVAL, CLEANUP_INTERVAL); cleanupTask.runTaskTimerAsynchronously(this, CLEANUP_INTERVAL, CLEANUP_INTERVAL);
// Do a backup on start // Do a backup on start
backupService.doBackup(BackupService.BackupCause.START); backupService.doBackup(BackupService.BackupCause.START);
// Set up Metrics // Set up Metrics
OnStartupTasks.sendMetrics(this, settings); OnStartupTasks.sendMetrics(this, settings);
if(settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
String loadColorConfig = settings.getProperty(SecuritySettings.STARTUP_BANNER_COLOR);
if (loadColorConfig.startsWith("§")) {
logger.info("\n" + loadColorConfig + " ___ __ __ __ ___ \n" +
loadColorConfig + " / | __ __/ /_/ /_ / |/ /__ \n" +
loadColorConfig + " / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
loadColorConfig + " / ___ / /_/ / /_/ / / / / / / __/\n" +
loadColorConfig + "/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
loadColorConfig + " ");
}else {
logger.info("\n"+" ___ __ __ __ ___ \n" +
" / | __ __/ /_/ /_ / |/ /__ \n" +
" / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
" / ___ / /_/ / /_/ / / / / / / __/\n" +
"/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
" ");
}
}
// Successful message // Successful message
logger.info("AuthMeReReloaded 已成功启动!"); //detect server brand with classloader
checkServerType();
logger.info("AuthMeReReloaded is enabled successfully!");
// Purge on start if enabled // Purge on start if enabled
PurgeService purgeService = injector.getSingleton(PurgeService.class); PurgeService purgeService = injector.getSingleton(PurgeService.class);
purgeService.runAutoPurge(); purgeService.runAutoPurge();
// 注册玩家退出事件监听 // 注册玩家加入事件监听
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS) || settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)/* || settings.getProperty(SecuritySettings.GUI_CAPTCHA)*/) { // register3rdPartyListeners();
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) { logger.info("GitHub: https://github.com/HaHaWTH/AuthMeReReloaded/");
getServer().getPluginManager().registerEvents(new PlayerQuitListener((Plugin) this), this);
}
if (settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
logger.info("(RC2)SmartAsyncTeleport功能已注册");
AuthMe.SATEnabled = true;
}
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
getServer().getPluginManager().registerEvents(new RegisterListener((Plugin) this), this);
logger.info("(RC2)GUI验证码功能已注册");
AuthMe.GUIEnabled = true;
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && !getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
logger.warning("ProtocolLib未加载,GUI验证码功能无法使用");
}
logger.info("以上功能尚在测试中,如有问题请反馈,如需关闭请前往config.yml修改");
logger.info("反馈地址: github.com/HaHaWTH/AuthMeReReloaded/issues");
}
if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) { if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) {
checkForUpdates(); checkForUpdates();
} }
if (SHAEnabled){
//shaChecker();
} }
}
public File pluginfile = getFile();
//Migrated
/** /**
* Load the version and build number of the plugin from the description file. * Load the version and build number of the plugin from the description file.
* *
@@ -326,10 +308,17 @@ public class AuthMe extends JavaPlugin {
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this); pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this); pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
// Try to register 1.9 player listeners
if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) { // Try to register 1.8+ player listeners
if (isClassLoaded("org.bukkit.event.entity.EntityPickupItemEvent") && isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
pluginManager.registerEvents(injector.getSingleton(PlayerListenerHigherThan18.class), this);
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this); pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
} }
// Try to register 1.9 player listeners(Moved to else-if)
// if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
// pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
// }
// Try to register 1.9 spigot player listeners // Try to register 1.9 spigot player listeners
if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) { if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) {
@@ -340,6 +329,26 @@ public class AuthMe extends JavaPlugin {
if (isClassLoaded("org.bukkit.event.entity.EntityAirChangeEvent")) { if (isClassLoaded("org.bukkit.event.entity.EntityAirChangeEvent")) {
pluginManager.registerEvents(injector.getSingleton(PlayerListener111.class), this); pluginManager.registerEvents(injector.getSingleton(PlayerListener111.class), this);
} }
//Register 3rd party listeners
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
pluginManager.registerEvents(injector.getSingleton(GuiCaptchaHandler.class), this);
logger.info("(Beta)GUICaptcha is enabled successfully!");
logger.info("These features are still in early development, if you encountered any problem, please report.");
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
}
if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
pluginManager.registerEvents(injector.getSingleton(BedrockAutoLoginListener.class), this);
} else if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && (!settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) || getServer().getPluginManager().getPlugin("floodgate") == null)) {
logger.warning("Failed to enable BedrockAutoLogin, ensure hookFloodgate: true and floodgate is loaded.");
}
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
pluginManager.registerEvents(injector.getSingleton(LoginLocationFixListener.class), this);
}
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this);
}
} }
/** /**
@@ -365,7 +374,7 @@ public class AuthMe extends JavaPlugin {
onShutdownPlayerSaver.saveAllPlayers(); onShutdownPlayerSaver.saveAllPlayers();
} }
if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){ if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy''MM''dd'' HH:mm:ss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'.'MM'.'dd'.' HH:mm:ss");
Date date = new Date(System.currentTimeMillis()); Date date = new Date(System.currentTimeMillis());
emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date)); emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date));
} }
@@ -380,18 +389,19 @@ public class AuthMe extends JavaPlugin {
// Disabled correctly // Disabled correctly
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info; Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " 已卸载!"); infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
ConsoleLogger.closeFileWriter(); ConsoleLogger.closeFileWriter();
} }
private static final String owner = "HaHaWTH";
private static final String owner_gitee = "Shixuehan114514";
private static final String repo = "AuthMeReReloaded";
private void checkForUpdates() {
logger.info("正在检查更新...");
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
try {
// Get the latest version number from GitHub
private static final String owner = "HaHaWTH";
// private static final String owner_gitee = "Shixuehan114514";
private static final String repo = "AuthMeReReloaded";
private void checkForUpdates() {
logger.info("Checking for updates...");
bukkitService.runTaskAsynchronously(() -> {
try {
// 从南通集线器获取最新版本号
URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest"); URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest");
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(10000); // 设置连接超时为10秒 conn.setConnectTimeout(10000); // 设置连接超时为10秒
@@ -400,85 +410,55 @@ public class AuthMe extends JavaPlugin {
String response = scanner.useDelimiter("\\Z").next(); String response = scanner.useDelimiter("\\Z").next();
scanner.close(); scanner.close();
// Parse JSON response and extract version number // 处理JSON响应
String latestVersion = response.substring(response.indexOf("tag_name") + 11); String latestVersion = response.substring(response.indexOf("tag_name") + 11);
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\"")); latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
if ((pluginBuild + pluginBuildNumber).equals(latestVersion)) { if (isUpdateAvailable(latestVersion)) {
getLogger().log(Level.INFO,"当前为最新版本"); String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber;
getLogger().log(Level.WARNING, message);
getLogger().log(Level.WARNING, "Download from here: github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
} else {
getLogger().log(Level.INFO, "You are running the latest version.");
} }
if (!(pluginBuild + pluginBuildNumber).equals(latestVersion)) { } catch (IOException e) {
// Display update message to users String formattedException = ExceptionUtils.formatException(e);
String message = "有新版本可用! 最新版本:" + latestVersion + " 当前版本:" + pluginBuild + pluginBuildNumber; getLogger().log(Level.WARNING, "Error occurred while checking updates from GitHub. Reason: " + formattedException);
getLogger().log(Level.INFO, message);
getLogger().log(Level.INFO,"下载地址:github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
}
}catch (IOException e) {
getLogger().log(Level.WARNING,"从GitHub检查更新时出现错误,原因: " + e.getMessage());
} }
}); });
} }
private static final String SHA_URL = "https://raw.githubusercontent.com/"+ owner +"/"+ repo + "/master/"+pluginBuild +pluginBuildNumber+ ".sha"; private boolean isUpdateAvailable(String latestVersion) {
private static final String ALGORITHM = "SHA-256"; // Extract the first character and the remaining digits from the version string
private static final String PROXY_URL = "https://ghproxy.com/"; char latestChar = latestVersion.charAt(0);
private static final String SHA_URL_GITEE = "https://gitee.com/"+ owner_gitee +"/"+ repo + "/raw/master/"+pluginBuild+pluginBuildNumber+ ".sha"; int latestNumber = Integer.parseInt(latestVersion.substring(1));
// public void shaChecker() { char currentChar = pluginBuild.charAt(0);
// // 请求SHA文件 int currentNumber = Integer.parseInt(pluginBuildNumber);
//
// String actualSha; // Compare the characters first
// try { if (latestChar > currentChar) {
// URL url; return true;
// if(settings.getProperty(SecuritySettings.SHA_CHECK_METHOD).equals("github")) { } else if (latestChar < currentChar) {
// url = new URL(SHA_URL); return false;
// logger.info("正在检查文件完整性...(GitHub)"); } else {
// } else if(settings.getProperty(SecuritySettings.SHA_CHECK_METHOD).equals("ghproxy")) { // If the characters are the same, compare the numbers
// url = new URL(PROXY_URL + SHA_URL); return latestNumber > currentNumber;
// logger.info("正在检查文件完整性...(GhProxy)"); }
// } else if (settings.getProperty(SecuritySettings.SHA_CHECK_METHOD).equals("gitee")) { }
// url = new URL(SHA_URL_GITEE);
// logger.info("正在检查文件完整性...(Gitee)");
// }else { private void checkServerType() {
// logger.warning("未知的SHA检查方法,将从GitHub获取SHA文件"); if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
// url = new URL(SHA_URL); logger.info("AuthMeReReloaded is running on Paper");
// } } else if (isClassLoaded("catserver.server.CatServerConfig")) {
// logger.info("AuthMeReReloaded is running on CatServer");
// } else if (isClassLoaded("org.spigotmc.SpigotConfig")) {
// HttpURLConnection conn = (HttpURLConnection) url.openConnection(); logger.info("AuthMeReReloaded is running on Spigot");
// conn.setConnectTimeout(10000); } else if (isClassLoaded("org.bukkit.craftbukkit.CraftServer")) {
// conn.setReadTimeout(9000); logger.info("AuthMeReReloaded is running on Bukkit");
// conn.setRequestMethod("GET"); } else {
// InputStream stream = conn.getInputStream(); logger.info("AuthMeReReloaded is running on Unknown*");
// ByteArrayOutputStream result = new ByteArrayOutputStream(); }
// byte[] buffer = new byte[1024]; }
// int length;
// while ((length = stream.read(buffer)) != -1) {
// result.write(buffer, 0, length);
// }
// String expectedSha = result.toString().trim();
// // 计算插件文件的SHA值
// MessageDigest md = MessageDigest.getInstance(ALGORITHM);
// byte[] fileBytes = Files.readAllBytes(pluginfile.toPath());
// byte[] hashBytes = md.digest(fileBytes);
// StringBuilder sb = new StringBuilder();
// for (byte b : hashBytes) {
// sb.append(String.format("%02x", b));
// }
// actualSha = sb.toString();
//
// // 比较SHA值并加载插件
// if (expectedSha.equals(actualSha)) {
// logger.info("SHA联网安全校验完毕");
// } else {
// // SHA值不匹配,插件可能被篡改
// logger.warning("SHA值不匹配,插件被篡改");
// stopOrUnload();
// }
// }catch (NoSuchAlgorithmException | IOException e){
// logger.warning("SHA校验失败,请尝试切换校验API");
// logger.warning("您当前请求的API为:" + settings.getProperty(SecuritySettings.SHA_CHECK_METHOD));
// stopOrUnload();
// }
// }
/** /**
@@ -106,7 +106,7 @@ public final class ConsoleLogger {
*/ */
public void warning(String message) { public void warning(String message) {
logger.warning(message); logger.warning(message);
writeLog("[警告] " + message); writeLog("[WARN] " + message);
} }
/** /**
@@ -128,7 +128,7 @@ public final class ConsoleLogger {
*/ */
public void info(String message) { public void info(String message) {
logger.info(message); logger.info(message);
writeLog("[信息] " + message); writeLog("[INFO] " + message);
} }
/** /**
@@ -142,7 +142,7 @@ public final class ConsoleLogger {
public void fine(String message) { public void fine(String message) {
if (logLevel.includes(LogLevel.FINE)) { if (logLevel.includes(LogLevel.FINE)) {
logger.info(message); logger.info(message);
writeLog("[信息:调试] " + message); writeLog("[INFO:FINE] " + message);
} }
} }
@@ -215,7 +215,7 @@ public final class ConsoleLogger {
} }
private void logAndWriteWithDebugPrefix(String message) { private void logAndWriteWithDebugPrefix(String message) {
String debugMessage = "[信息:调试] " + message; String debugMessage = "[INFO:DEBUG] " + message;
logger.info(debugMessage); logger.info(debugMessage);
writeLog(debugMessage); writeLog(debugMessage);
} }
@@ -17,9 +17,9 @@ public abstract class PlayerCommand implements ExecutableCommand {
} else { } else {
String alternative = getAlternativeCommand(); String alternative = getAlternativeCommand();
if (alternative != null) { if (alternative != null) {
sender.sendMessage("此命令仅限玩家使用!请使用 " + alternative + " ."); sender.sendMessage("Player only! Please use " + alternative + " instead.");
} else { } else {
sender.sendMessage("此命令只能被玩家执行."); sender.sendMessage("This command is only for players.");
} }
} }
} }
@@ -25,7 +25,7 @@ public class FirstSpawnCommand extends PlayerCommand {
player.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn"); player.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn");
} else { } else {
//String name= player.getName(); //String name= player.getName();
if(AuthMe.SATEnabled) { if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player, spawnLoader.getFirstSpawn()); TeleportUtils.teleport(player, spawnLoader.getFirstSpawn());
} else { } else {
player.teleport(spawnLoader.getFirstSpawn()); player.teleport(spawnLoader.getFirstSpawn());
@@ -4,6 +4,7 @@ package fr.xephi.authme.datasource;
* DataSource type. * DataSource type.
*/ */
public enum DataSourceType { public enum DataSourceType {
// H2,
MYSQL, MYSQL,
@@ -0,0 +1,408 @@
//package fr.xephi.authme.datasource;
//
//import com.google.common.annotations.VisibleForTesting;
//import fr.xephi.authme.ConsoleLogger;
//import fr.xephi.authme.data.auth.PlayerAuth;
//import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler;
//import fr.xephi.authme.output.ConsoleLoggerFactory;
//import fr.xephi.authme.settings.Settings;
//import fr.xephi.authme.settings.properties.DatabaseSettings;
//
//import java.io.File;
//import java.sql.Connection;
//import java.sql.DatabaseMetaData;
//import java.sql.DriverManager;
//import java.sql.PreparedStatement;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.sql.Statement;
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.HashSet;
//import java.util.List;
//import java.util.Locale;
//import java.util.Set;
//
//import static fr.xephi.authme.datasource.SqlDataSourceUtils.getNullableLong;
//import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException;
//
///**
// * H2 data source.
// */
//@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
//public class H2 extends AbstractSqlDataSource {
//
// private final ConsoleLogger logger = ConsoleLoggerFactory.get(H2.class);
// private final Settings settings;
// private final File dataFolder;
// private final String database;
// private final String tableName;
// private final Columns col;
// private Connection con;
//
// /**
// * Constructor for H2.
// *
// * @param settings The settings instance
// * @param dataFolder The data folder
// * @throws SQLException when initialization of a SQL datasource failed
// */
// public H2(Settings settings, File dataFolder) throws SQLException {
// this.settings = settings;
// this.dataFolder = dataFolder;
// this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
// this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
// this.col = new Columns(settings);
//
// try {
// this.connect();
// this.setup();
// } catch (Exception ex) {
// logger.logException("Error during H2 initialization:", ex);
// throw ex;
// }
// }
//
// @VisibleForTesting
// H2(Settings settings, File dataFolder, Connection connection) {
// this.settings = settings;
// this.dataFolder = dataFolder;
// this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
// this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
// this.col = new Columns(settings);
// this.con = connection;
// this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings);
// }
//
// /**
// * Initializes the connection to the H2 database.
// *
// * @throws SQLException when an SQL error occurs while connecting
// */
// protected void connect() throws SQLException {
// try {
// Class.forName("org.h2.Driver");
// } catch (ClassNotFoundException e) {
// throw new IllegalStateException("Failed to load H2 JDBC class", e);
// }
//
// logger.debug("H2 driver loaded");
// this.con = DriverManager.getConnection(this.getJdbcUrl(this.dataFolder.getAbsolutePath(), "", this.database));
// this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings);
// }
//
// /**
// * Creates the table if necessary, or adds any missing columns to the table.
// *
// * @throws SQLException when an SQL error occurs while initializing the database
// */
// @VisibleForTesting
// @SuppressWarnings("checkstyle:CyclomaticComplexity")
// protected void setup() throws SQLException {
// try (Statement st = con.createStatement()) {
// // Note: cannot add unique fields later on in SQLite, so we add it on initialization
// st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " ("
// + col.ID + " INTEGER AUTO_INCREMENT, "
// + col.NAME + " VARCHAR(255) NOT NULL UNIQUE, "
// + "CONSTRAINT table_const_prim PRIMARY KEY (" + col.ID + "));");
//
// DatabaseMetaData md = con.getMetaData();
//
// if (isColumnMissing(md, col.REAL_NAME)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
// + col.REAL_NAME + " VARCHAR(255) NOT NULL DEFAULT 'Player';");
// }
//
// if (isColumnMissing(md, col.PASSWORD)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.PASSWORD + " VARCHAR(255) NOT NULL DEFAULT '';");
// }
//
// if (!col.SALT.isEmpty() && isColumnMissing(md, col.SALT)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.SALT + " VARCHAR(255);");
// }
//
// if (isColumnMissing(md, col.LAST_IP)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.LAST_IP + " VARCHAR(40);");
// }
//
// if (isColumnMissing(md, col.LAST_LOGIN)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.LAST_LOGIN + " TIMESTAMP;");
// }
//
// if (isColumnMissing(md, col.REGISTRATION_IP)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.REGISTRATION_IP + " VARCHAR(40);");
// }
//
// if (isColumnMissing(md, col.REGISTRATION_DATE)) {
// addRegistrationDateColumn(st);
// }
//
// if (isColumnMissing(md, col.LASTLOC_X)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_X
// + " DOUBLE NOT NULL DEFAULT '0.0';");
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_Y
// + " DOUBLE NOT NULL DEFAULT '0.0';");
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_Z
// + " DOUBLE NOT NULL DEFAULT '0.0';");
// }
//
// if (isColumnMissing(md, col.LASTLOC_WORLD)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.LASTLOC_WORLD + " VARCHAR(255) NOT NULL DEFAULT 'world';");
// }
//
// if (isColumnMissing(md, col.LASTLOC_YAW)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
// + col.LASTLOC_YAW + " FLOAT;");
// }
//
// if (isColumnMissing(md, col.LASTLOC_PITCH)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
// + col.LASTLOC_PITCH + " FLOAT;");
// }
//
// if (isColumnMissing(md, col.EMAIL)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.EMAIL + " VARCHAR(255);");
// }
//
// if (isColumnMissing(md, col.IS_LOGGED)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.IS_LOGGED + " INT NOT NULL DEFAULT '0';");
// }
//
// if (isColumnMissing(md, col.HAS_SESSION)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.HAS_SESSION + " INT NOT NULL DEFAULT '0';");
// }
//
// if (isColumnMissing(md, col.TOTP_KEY)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.TOTP_KEY + " VARCHAR(32);");
// }
//
// if (!col.PLAYER_UUID.isEmpty() && isColumnMissing(md, col.PLAYER_UUID)) {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.PLAYER_UUID + " VARCHAR(36)");
// }
// }
// logger.info("H2 Setup finished");
// }
//
//
// private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException {
// try (ResultSet rs = metaData.getColumns(null, null, tableName, columnName)) {
// return !rs.next();
// }
// }
//
// @Override
// public void reload() {
// close(con);
// try {
// this.connect();
// this.setup();
// } catch (SQLException ex) {
// logger.logException("Error while reloading H2:", ex);
// }
// }
//
// @Override
// public PlayerAuth getAuth(String user) {
// String sql = "SELECT * FROM " + tableName + " WHERE LOWER(" + col.NAME + ")=LOWER(?);";
// try (PreparedStatement pst = con.prepareStatement(sql)) {
// pst.setString(1, user);
// try (ResultSet rs = pst.executeQuery()) {
// if (rs.next()) {
// return buildAuthFromResultSet(rs);
// }
// }
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// return null;
// }
//
// @Override
// public Set<String> getRecordsToPurge(long until) {
// Set<String> list = new HashSet<>();
// String select = "SELECT " + col.NAME + " FROM " + tableName + " WHERE MAX("
// + " COALESCE(" + col.LAST_LOGIN + ", 0),"
// + " COALESCE(" + col.REGISTRATION_DATE + ", 0)"
// + ") < ?;";
// try (PreparedStatement selectPst = con.prepareStatement(select)) {
// selectPst.setLong(1, until);
// try (ResultSet rs = selectPst.executeQuery()) {
// while (rs.next()) {
// list.add(rs.getString(col.NAME));
// }
// }
// } catch (SQLException ex) {
// logSqlException(ex);
// }
//
// return list;
// }
//
// @Override
// public void purgeRecords(Collection<String> toPurge) {
// String delete = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
// try (PreparedStatement deletePst = con.prepareStatement(delete)) {
// for (String name : toPurge) {
// deletePst.setString(1, name.toLowerCase(Locale.ROOT));
// deletePst.executeUpdate();
// }
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// }
//
// @Override
// public boolean removeAuth(String user) {
// String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
// try (PreparedStatement pst = con.prepareStatement(sql)) {
// pst.setString(1, user.toLowerCase(Locale.ROOT));
// pst.executeUpdate();
// return true;
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// return false;
// }
//
// @Override
// public void closeConnection() {
// try {
// if (con != null && !con.isClosed()) {
// con.close();
// }
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// }
//
// @Override
// public DataSourceType getType() {
// return DataSourceType.H2;
// }
//
// @Override
// public List<PlayerAuth> getAllAuths() {
// List<PlayerAuth> auths = new ArrayList<>();
// String sql = "SELECT * FROM " + tableName + ";";
// try (PreparedStatement pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery()) {
// while (rs.next()) {
// PlayerAuth auth = buildAuthFromResultSet(rs);
// auths.add(auth);
// }
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// return auths;
// }
//
// @Override
// public List<String> getLoggedPlayersWithEmptyMail() {
// List<String> players = new ArrayList<>();
// String sql = "SELECT " + col.REAL_NAME + " FROM " + tableName + " WHERE " + col.IS_LOGGED + " = 1"
// + " AND (" + col.EMAIL + " = 'your@email.com' OR " + col.EMAIL + " IS NULL);";
// try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) {
// while (rs.next()) {
// players.add(rs.getString(1));
// }
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// return players;
// }
//
// @Override
// public List<PlayerAuth> getRecentlyLoggedInPlayers() {
// List<PlayerAuth> players = new ArrayList<>();
// String sql = "SELECT * FROM " + tableName + " ORDER BY " + col.LAST_LOGIN + " DESC LIMIT 10;";
// try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) {
// while (rs.next()) {
// players.add(buildAuthFromResultSet(rs));
// }
// } catch (SQLException e) {
// logSqlException(e);
// }
// return players;
// }
//
//
// @Override
// public boolean setTotpKey(String user, String totpKey) {
// String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
// try (PreparedStatement pst = con.prepareStatement(sql)) {
// pst.setString(1, totpKey);
// pst.setString(2, user.toLowerCase(Locale.ROOT));
// pst.executeUpdate();
// return true;
// } catch (SQLException e) {
// logSqlException(e);
// }
// return false;
// }
//
// private PlayerAuth buildAuthFromResultSet(ResultSet row) throws SQLException {
// String salt = !col.SALT.isEmpty() ? row.getString(col.SALT) : null;
//
// return PlayerAuth.builder()
// .name(row.getString(col.NAME))
// .email(row.getString(col.EMAIL))
// .realName(row.getString(col.REAL_NAME))
// .password(row.getString(col.PASSWORD), salt)
// .totpKey(row.getString(col.TOTP_KEY))
// .lastLogin(getNullableLong(row, col.LAST_LOGIN))
// .lastIp(row.getString(col.LAST_IP))
// .registrationDate(row.getLong(col.REGISTRATION_DATE))
// .registrationIp(row.getString(col.REGISTRATION_IP))
// .locX(row.getDouble(col.LASTLOC_X))
// .locY(row.getDouble(col.LASTLOC_Y))
// .locZ(row.getDouble(col.LASTLOC_Z))
// .locWorld(row.getString(col.LASTLOC_WORLD))
// .locYaw(row.getFloat(col.LASTLOC_YAW))
// .locPitch(row.getFloat(col.LASTLOC_PITCH))
// .build();
// }
//
// /**
// * Creates the column for registration date and sets all entries to the current timestamp.
// * We do so in order to avoid issues with purging, where entries with 0 / NULL might get
// * purged immediately on startup otherwise.
// *
// * @param st Statement object to the database
// */
// private void addRegistrationDateColumn(Statement st) throws SQLException {
// st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.REGISTRATION_DATE + " TIMESTAMP NOT NULL DEFAULT '0';");
//
// // Use the timestamp from Java to avoid timezone issues in case JVM and database are out of sync
// long currentTimestamp = System.currentTimeMillis();
// int updatedRows = st.executeUpdate(String.format("UPDATE %s SET %s = %d;",
// tableName, col.REGISTRATION_DATE, currentTimestamp));
// logger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, "
// + currentTimestamp + ", to all " + updatedRows + " rows");
// }
//
// @Override
// String getJdbcUrl(String dataPath, String ignored, String database) {
// return "jdbc:h2:" + dataPath + File.separator + database + ".db";
// }
//
// private static void close(Connection con) {
// if (con != null) {
// try {
// con.close();
// } catch (SQLException ex) {
// logSqlException(ex);
// }
// }
// }
//}
//
@@ -76,6 +76,9 @@ public class DataSourceProvider implements Provider<DataSource> {
case SQLITE: case SQLITE:
dataSource = new SQLite(settings, dataFolder); dataSource = new SQLite(settings, dataFolder);
break; break;
// case H2:
// dataSource = new H2(settings, dataFolder);
// break;
default: default:
throw new UnsupportedOperationException("Unknown data source type '" + dataSourceType + "'"); throw new UnsupportedOperationException("Unknown data source type '" + dataSourceType + "'");
} }
@@ -0,0 +1,62 @@
package fr.xephi.authme.listener;
/* Inspired by DongShaoNB/BedrockPlayerSupport **/
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.events.RestoreSessionEvent;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
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.PlayerJoinEvent;
import javax.inject.Inject;
import java.util.UUID;
import static org.bukkit.Bukkit.getServer;
public class BedrockAutoLoginListener implements Listener {
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
@Inject
private BukkitService bukkitService;
@Inject
private AuthMe plugin;
@Inject
private Messages messages;
@Inject
private Settings settings;
public BedrockAutoLoginListener() {
}
private boolean isBedrockPlayer(UUID uuid) {
return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
String name = event.getPlayer().getName();
UUID uuid = event.getPlayer().getUniqueId();
if (isBedrockPlayer(uuid) && !authmeApi.isAuthenticated(player) && authmeApi.isRegistered(name)) {
authmeApi.forceLogin(player);
messages.send(player, MessageKey.BEDROCK_AUTO_LOGGED_IN);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerAuthMeSessionRestore(RestoreSessionEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if (isBedrockPlayer(uuid)) {
event.setCancelled(true);
}
}
}
@@ -0,0 +1,35 @@
package fr.xephi.authme.listener;
//Prevent Ghost Players
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.CommonService;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import javax.inject.Inject;
import java.util.Collection;
import java.util.HashSet;
public class DoubleLoginFixListener implements Listener {
@Inject
private CommonService service;
public DoubleLoginFixListener() {
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Collection<? extends Player> PlayerList = Bukkit.getServer().getOnlinePlayers();
HashSet<String> PlayerSet = new HashSet<String>();
for (Player ep : PlayerList) {
if (PlayerSet.contains(ep.getName().toLowerCase())) {
ep.kickPlayer(service.retrieveSingleMessage(ep.getPlayer(), MessageKey.DOUBLE_LOGIN_FIX));
break;
}
PlayerSet.add(ep.getName().toLowerCase());
}
}
}
@@ -0,0 +1,316 @@
package fr.xephi.authme.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 fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import javax.inject.Inject;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import static fr.xephi.authme.util.PlayerUtils.getPlayerIp;
import static fr.xephi.authme.util.PlayerUtils.isNpc;
import static org.bukkit.Bukkit.getLogger;
import static org.bukkit.Bukkit.getServer;
public class GuiCaptchaHandler implements Listener {
//define AuthMeApi
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
@Inject
private BukkitService bukkitService;
@Inject
private AuthMe plugin;
@Inject
private Messages messages;
@Inject
private CommonService service;
@Inject
private Settings settings;
private PacketAdapter chatPacketListener;
private PacketAdapter windowPacketListener;
//define timesLeft
private int timesLeft = 3;
//Use ConcurrentHashMap to store player and their close reason
/* We used many async tasks so there is concurrent**/
public static HashMap<Player, String> closeReasonMap = new HashMap<>();
//define randomStringSet
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
String randomString = "";
Random randomItemSet = new Random();
Random howManyRandom = new Random();
private boolean isPacketListenersActive = false;
public GuiCaptchaHandler() {
}
private StringBuilder sb;
private final List<String> whiteList = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST);
private boolean isBedrockPlayer(UUID uuid) {
return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
}
private void initializePacketListeners() {
if (!isPacketListenersActive) {
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
isPacketListenersActive = true;
}
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getWhoClicked() instanceof Player) {
Player player = (Player) event.getWhoClicked();
ItemStack currentItem = event.getCurrentItem();
if (!authmeApi.isRegistered(player.getName()) && !closeReasonMap.containsKey(player)) {
if (isBedrockPlayer(player.getUniqueId())) {
return;
}
if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)) {
event.setCancelled(true);
if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified");
}
player.closeInventory();
messages.send(player, MessageKey.GUI_CAPTCHA_VERIFIED);
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerLogin(PlayerLoginEvent event) {
Player player = event.getPlayer();
bukkitService.runTaskAsynchronously(() -> {
sb = new StringBuilder();
int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
for (int i = 0; i < howLongIsRandomString; i++) {
//生成随机索引号
int index = randomItemSet.nextInt(randomSet.length());
// 从字符串中获取由索引 index 指定的字符
char randomChar = randomSet.charAt(index);
// 将字符追加到字符串生成器
sb.append(randomChar);
}
if (!whiteList.isEmpty()) {
String ip = getPlayerIp(player);
if (whiteList.contains(authmeApi.getCountryCode(ip)) && ip != null) {
if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified:whitelist");
}
}
}
});
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent event) {
randomString = "";
Player playerunreg = event.getPlayer();
String name = playerunreg.getName();
if (!authmeApi.isRegistered(name) && !isNpc(playerunreg) && !closeReasonMap.containsKey(playerunreg)) {
if (isBedrockPlayer(playerunreg.getUniqueId())) {
if (!closeReasonMap.containsKey(playerunreg)) {
closeReasonMap.put(playerunreg, "verified:bedrock");
}
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
return;
}
bukkitService.runTaskAsynchronously(() -> {
bukkitService.runTask(() -> {
randomString = sb.toString();
Random random_blockpos = new Random();
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26));
Inventory menu = Bukkit.createInventory(playerunreg, 27, messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_WINDOW_NAME, randomString));
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
ItemMeta meta = item.getItemMeta();
try {
if (meta != null) {
meta.setDisplayName(messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_CLICKABLE_NAME, randomString));
item.setItemMeta(meta);
}
} catch (NullPointerException e) {
getLogger().log(Level.WARNING, "Unexpected error occurred while setting item meta.");
}
windowPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
@Override
public void onPacketReceiving(PacketEvent event) {
Player packetPlayer = event.getPlayer();
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
if (timesLeft <= 0) {
bukkitService.runTask(() -> {
packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
});
timesLeft = 3;
} else {
--timesLeft;
if (timesLeft <= 0) {
bukkitService.runTask(() -> {
packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
});
timesLeft = 3;
return;
}
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_RETRY_MESSAGE, String.valueOf(timesLeft));
event.setCancelled(true);
random_num.set(random_blockpos.nextInt(26));
bukkitService.runTask(() -> {
menu.clear();
menu.setItem(random_num.get(), item);
packetPlayer.openInventory(menu);
});
}
}
}
};
chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
@Override
public void onPacketReceiving(PacketEvent event) {
Player packetPlayer = event.getPlayer();
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_DENIED_MESSAGE);
event.setCancelled(true);
}
}
};
initializePacketListeners();
//Open captcha inventory
menu.setItem(random_num.get(), item);
playerunreg.openInventory(menu);
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > 0) {
long timeOut = settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT);
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > settings.getProperty(RestrictionSettings.TIMEOUT)) {
bukkitService.runTask(() -> {
getLogger().warning("AuthMe detected that your GUI captcha timeout seconds(" + settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) + ") is bigger than the Login timeout seconds(" +
settings.getProperty(RestrictionSettings.TIMEOUT) + "). To prevent issues, we will let the GUI captcha follow the Login timeout seconds, please check and modify your config.");
});
timeOut = settings.getProperty(RestrictionSettings.TIMEOUT);
}
long finalTimeOut = timeOut;
bukkitService.runTask(() -> {
bukkitService.runTaskLater(() -> {
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT));
timesLeft = 3; // Reset the attempt counter
}
}, finalTimeOut * 20L);
});
}
});
});
}
}
//This prevents players from unregistering by Admins
@EventHandler
public void onPlayerAuthMeLogin(LoginEvent event) {
Player player = event.getPlayer();
if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified:loggedIn");
}
}
private void deletePlayerData(UUID playerUUID) {
// 获取服务器的存储文件夹路径
File serverFolder = Bukkit.getServer().getWorldContainer();
String worldFolderName = settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
// 构建playerdata文件夹路径
File playerDataFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "playerdata");
// 构建玩家数据文件路径
File playerDataFile = new File(playerDataFolder, File.separator + playerUUID + ".dat");
// 删除玩家数据文件
if (playerDataFile.exists()) {
playerDataFile.delete();
}
}
private void deletePlayerStats(UUID playerUUID) {
// 获取服务器的存储文件夹路径
File serverFolder = Bukkit.getServer().getWorldContainer();
String worldFolderName = settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
// 构建stats文件夹路径
File statsFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "stats");
// 构建玩家统计数据文件路径
File statsFile = new File(statsFolder, File.separator + playerUUID + ".json");
// 删除玩家统计数据文件
if (statsFile.exists()) {
statsFile.delete();
}
}
private void deleteAuthMePlayerData(UUID playerUUID) {
File pluginFolder = plugin.getDataFolder();
File path = new File(pluginFolder, File.separator + "playerdata" + File.separator + playerUUID);
File dataFile = new File(path, File.separator + "data.json");
if (dataFile.exists()) {
dataFile.delete();
path.delete();
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
String name = player.getName();
UUID playerUUID = event.getPlayer().getUniqueId();
if (!authmeApi.isRegistered(name)) {
if (settings.getProperty(SecuritySettings.DELETE_UNVERIFIED_PLAYER_DATA) && !closeReasonMap.containsKey(player)) {
bukkitService.runTaskLater(() -> {
if (!player.isOnline()) {
deletePlayerData(playerUUID);
deletePlayerStats(playerUUID);
deleteAuthMePlayerData(playerUUID);
}
}, 100L);
return;
}
closeReasonMap.remove(player);
}
}
}
@@ -10,19 +10,12 @@ import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.PlayerUtils; import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityEvent; import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Objects;
/** /**
* Service class for the AuthMe listeners to determine whether an event should be canceled. * Service class for the AuthMe listeners to determine whether an event should be canceled.
@@ -93,7 +86,7 @@ class ListenerService implements SettingsDependent {
} }
public boolean shouldCancelInvEvent(Player player) { public boolean shouldCancelInvEvent(Player player) {
try { try {
return !AuthMe.GUIEnabled || authmeApi.isRegistered(player.getName()) || RegisterListener.closeReasonMap.containsKey(player)/* || !player.getOpenInventory().getTitle().equals("请验证你是真人")*/; return !AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA) || authmeApi.isRegistered(player.getName()) || GuiCaptchaHandler.closeReasonMap.containsKey(player)/* || !player.getOpenInventory().getTitle().equals("请验证你是真人")*/;
} catch (Exception e) { } catch (Exception e) {
return true; return true;
} }
@@ -0,0 +1,112 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.TeleportUtils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import javax.inject.Inject;
public class LoginLocationFixListener implements Listener {
@Inject
private AuthMe plugin;
@Inject
private Messages messages;
@Inject
private Settings settings;
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
public LoginLocationFixListener() {
}
private static Material materialPortal = Material.matchMaterial("PORTAL");
private final boolean isSmartAsyncTeleport = AuthMe.settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT);
private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL);
private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND);
BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
static {
if (materialPortal == null) {
materialPortal = Material.matchMaterial("PORTAL_BLOCK");
if (materialPortal == null) {
materialPortal = Material.matchMaterial("NETHER_PORTAL");
}
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
if (isFixPortalStuck) {
if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) {
return;
}
Block JoinBlock = JoinLocation.getBlock();
boolean solved = false;
for (BlockFace face : faces) {
if (JoinBlock.getRelative(face).getType().equals(Material.AIR) && JoinBlock.getRelative(face).getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
if (isSmartAsyncTeleport) {
TeleportUtils.teleport(player, JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
} else {
player.teleport(JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
}
solved = true;
break;
}
}
if (!solved) {
JoinBlock.getRelative(BlockFace.UP).breakNaturally();
JoinBlock.breakNaturally();
}
messages.send(player, MessageKey.LOCATION_FIX_PORTAL);
} else if (isFixGroundStuck) {
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
World world = player.getWorld();
int MaxHeight = world.getMaxHeight();
int MinHeight = world.getMinHeight();
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
return;
}
for (int i = MinHeight; i <= MaxHeight; i++) {
JoinLocation.setY(i);
Block JoinBlock = JoinLocation.getBlock();
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
&& JoinBlock.getType().equals(Material.AIR)
&& JoinBlock.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
if (JoinBlock.getRelative(BlockFace.DOWN).getType().equals(Material.LAVA)) {
JoinBlock.getRelative(BlockFace.DOWN).setType(Material.DIRT);
}
if (isSmartAsyncTeleport) {
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 0.1, 0.5));
} else {
player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5));
}
messages.send(player, MessageKey.LOCATION_FIX_UNDERGROUND);
break;
}
if (i == MaxHeight) {
if (isSmartAsyncTeleport) {
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 1.1, 0.5));
} else {
player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5));
}
messages.send(player, MessageKey.LOCATION_FIX_UNDERGROUND_CANT_FIX);
}
}
}
}
}
@@ -1,12 +1,6 @@
package fr.xephi.authme.listener; package fr.xephi.authme.listener;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.listener.RegisterListener;
import com.comphenix.protocol.events.PacketEvent;
import fr.xephi.authme.api.v3.AuthMeApi; import fr.xephi.authme.api.v3.AuthMeApi;
import fr.xephi.authme.data.QuickCommandsProtectionManager; import fr.xephi.authme.data.QuickCommandsProtectionManager;
import fr.xephi.authme.data.auth.PlayerAuth; import fr.xephi.authme.data.auth.PlayerAuth;
@@ -31,7 +25,6 @@ import fr.xephi.authme.util.TeleportUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@@ -39,7 +32,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityPickupItemEvent; //import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
@@ -61,16 +54,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerShearEntityEvent; import org.bukkit.event.player.PlayerShearEntityEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent; //import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import static org.bukkit.Bukkit.getServer;
import org.bukkit.plugin.Plugin;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOWED_MOVEMENT_RADIUS; import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOWED_MOVEMENT_RADIUS;
@@ -134,8 +124,10 @@ public class PlayerListener implements Listener{
if (validationService.isUnrestricted(name)) { if (validationService.isUnrestricted(name)) {
return; return;
} }
if (settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())){ if (settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER)) {
return; if (getServer().getPluginManager().getPlugin("floodgate") != null) {
if (org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())) return;
}
} }
// Non-blocking checks // Non-blocking checks
try { try {
@@ -387,13 +379,13 @@ public class PlayerListener implements Listener{
Location spawn = spawnLoader.getSpawnLocation(player); Location spawn = spawnLoader.getSpawnLocation(player);
if (spawn != null && spawn.getWorld() != null) { if (spawn != null && spawn.getWorld() != null) {
if (!player.getWorld().equals(spawn.getWorld())) { if (!player.getWorld().equals(spawn.getWorld())) {
if(AuthMe.SATEnabled) { if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player,spawn); TeleportUtils.teleport(player,spawn);
} else { } else {
player.teleport(spawn); player.teleport(spawn);
} }
} else if (spawn.distance(player.getLocation()) > settings.getProperty(ALLOWED_MOVEMENT_RADIUS)) { } else if (spawn.distance(player.getLocation()) > settings.getProperty(ALLOWED_MOVEMENT_RADIUS)) {
if(AuthMe.SATEnabled) { if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player,spawn); TeleportUtils.teleport(player,spawn);
} else { } else {
player.teleport(spawn); player.teleport(spawn);
@@ -488,12 +480,12 @@ public class PlayerListener implements Listener{
* Inventory interactions * Inventory interactions
*/ */
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) // @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerPickupItem(EntityPickupItemEvent event) { // public void onPlayerPickupItem(EntityPickupItemEvent event) {
if (listenerService.shouldCancelEvent(event)) { // if (listenerService.shouldCancelEvent(event)) {
event.setCancelled(true); // event.setCancelled(true);
} // }
} // }
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerDropItem(PlayerDropItemEvent event) { public void onPlayerDropItem(PlayerDropItemEvent event) {
@@ -548,12 +540,12 @@ public class PlayerListener implements Listener{
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler(priority = EventPriority.LOWEST) // @EventHandler(priority = EventPriority.LOWEST)
public void onSwitchHand(PlayerSwapHandItemsEvent event) { // public void onSwitchHand(PlayerSwapHandItemsEvent event) {
Player player = event.getPlayer(); // Player player = event.getPlayer();
if (!player.isSneaking() || !player.hasPermission("keybindings.use")) // if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
return; // return;
event.setCancelled(true); // event.setCancelled(true);
Bukkit.dispatchCommand(event.getPlayer(), "help"); // Bukkit.dispatchCommand(event.getPlayer(), "help");
} // }
} }
@@ -0,0 +1,41 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.PluginSettings;
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.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import javax.inject.Inject;
public class PlayerListenerHigherThan18 implements Listener {
@Inject
private ListenerService listenerService;
@Inject
private Settings settings;
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerPickupItem(EntityPickupItemEvent event) {
if (listenerService.shouldCancelEvent(event)) {
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
Player player = event.getPlayer();
if ((!player.isSneaking() || !player.hasPermission("keybindings.use")) &&
settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
return;
}
event.setCancelled(true);
if (settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
Bukkit.dispatchCommand(event.getPlayer(), "help");
}
}
}
@@ -1,31 +0,0 @@
package fr.xephi.authme.listener;
//Prevent Ghost Players
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import java.util.Objects;
public class PlayerQuitListener implements Listener {
private final Plugin plugin;
public PlayerQuitListener(Plugin plugin) {
this.plugin = plugin;
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
String LastAddr = Objects.requireNonNull(player.getAddress()).getAddress().getHostAddress();
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
@Override
public void run() {
if (player.isOnline()) {
player.kickPlayer("You have been disconnected.");
}
}
}, 20L); // 20 ticks = 1 second
}
}
@@ -1,133 +0,0 @@
package fr.xephi.authme.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.events.PacketListener;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.api.v3.AuthMeApi;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.Plugin;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.UUID;
import java.util.logging.Level;
import static org.bukkit.Bukkit.getLogger;
public class RegisterListener implements Listener {
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
private final Plugin plugin;
public static boolean enabled=true;
// 创建一个储存玩家关闭箱子GUI的原因的HashMap
public static HashMap<Player, String> closeReasonMap = new HashMap<>();
// Add a timer to kick the player if they don't verify in time
public RegisterListener(Plugin plugin) {
this.plugin = plugin;
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getWhoClicked() instanceof Player) {
Player player = (Player) event.getWhoClicked();
ItemStack item = event.getCurrentItem();
// 获取点击事件的容器
Inventory inventory = event.getInventory();
if (event.getView().getTitle().equals("请验证你是真人")&&!authmeApi.isRegistered(player.getName())) {
if (Objects.requireNonNull(event.getCurrentItem()).getType().equals(Material.REDSTONE_BLOCK)) {
event.setCancelled(true);
closeReasonMap.put(player, "verified");
player.closeInventory();
player.sendMessage("§a验证完成");
//force to string
// ProtocolLibrary.getProtocolManager().removePacketListeners(this.plugin);
}
}
}
}
@EventHandler(ignoreCancelled = true,priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent event) {
Random random_blockpos = new Random();
int random_num = random_blockpos.nextInt(26);
Inventory menu = Bukkit.createInventory(null, 27, "请验证你是真人");
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.setDisplayName("§a我是真人");
}
item.setItemMeta(meta);
menu.setItem(random_num, item);
Player playerunreg = event.getPlayer();
String name = playerunreg.getName();
if (!authmeApi.isRegistered(name)) {
// getLogger().log(Level.INFO, "TESTTEST");
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
playerunreg.openInventory(menu);
}, 1L);
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg)) {
playerunreg.sendMessage("§c请先完成验证!");
event.setCancelled(true);
Bukkit.getScheduler().runTask(plugin, () -> {
playerunreg.openInventory(menu);
//playerunreg.kickPlayer("§c请先完成人机验证!");
});
}
}
});
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg)) {
playerunreg.sendMessage("§c请先完成验证!");
event.setCancelled(true);
}
}
});
// chatListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
// @Override
// public void onPacketReceiving(PacketEvent event) {
// if (event.getPlayer() == player) {
// event.setCancelled(true);
//
// }
// }
// };
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event){
Player player = event.getPlayer();
String name = player.getName();
if (!authmeApi.isRegistered(name)){closeReasonMap.remove(player);}
}
}
@@ -4,14 +4,84 @@ package fr.xephi.authme.message;
* Keys for translatable messages managed by {@link Messages}. * Keys for translatable messages managed by {@link Messages}.
*/ */
public enum MessageKey { public enum MessageKey {
/**
* You have been disconnected due to doubled login.
*/
DOUBLE_LOGIN_FIX("double_login_fix.fix_message"),
/** In order to use this command you must be authenticated! */ /**
* You are stuck in portal during Login.
*/
LOCATION_FIX_PORTAL("login_location_fix.fix_portal"),
/**
* You are stuck underground during Login.
*/
LOCATION_FIX_UNDERGROUND("login_location_fix.fix_underground"),
/**
* You are stuck underground during Login, but we cant fix it.
*/
LOCATION_FIX_UNDERGROUND_CANT_FIX("login_location_fix.cannot_fix_underground"),
/**
* Bedrock auto login success!
*/
BEDROCK_AUTO_LOGGED_IN("bedrock_auto_login.success"),
/**
* %random Verification
*/
GUI_CAPTCHA_WINDOW_NAME("gui_captcha.captcha_window_name", "%random"),
/**
* %random I am human
*/
GUI_CAPTCHA_CLICKABLE_NAME("gui_captcha.captcha_clickable_name", "%random"),
/**
* Verification failed, you have %times retries left
*/
GUI_CAPTCHA_RETRY_MESSAGE("gui_captcha.message_on_retry", "%times"),
/**
* Bedrock verification success!
*/
GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK("gui_captcha.bedrock_auto_verify_success"),
/**
* Please be verified before chatting!
*/
GUI_CAPTCHA_DENIED_MESSAGE("gui_captcha.denied_message_sending"),
/**
* Verification timed out!
*/
GUI_CAPTCHA_KICK_TIMEOUT("gui_captcha.kick_on_timeout"),
/**
* Please complete the verification!
*/
GUI_CAPTCHA_KICK_FAILED("gui_captcha.kick_on_failed"),
/**
* Verification success!
*/
GUI_CAPTCHA_VERIFIED("gui_captcha.success"),
/**
* In order to use this command you must be authenticated!
*/
DENIED_COMMAND("error.denied_command"), DENIED_COMMAND("error.denied_command"),
/** A player with the same IP is already in game! */ /**
* A player with the same IP is already in game!
*/
SAME_IP_ONLINE("on_join_validation.same_ip_online"), SAME_IP_ONLINE("on_join_validation.same_ip_online"),
/** In order to chat you must be authenticated! */ /**
* In order to chat you must be authenticated!
*/
DENIED_CHAT("error.denied_chat"), DENIED_CHAT("error.denied_chat"),
/** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */ /** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */
@@ -149,6 +149,10 @@ public class MessageUpdater {
.put("verification", "Verification code") .put("verification", "Verification code")
.put("time", "Time units") .put("time", "Time units")
.put("two_factor", "Two-factor authentication") .put("two_factor", "Two-factor authentication")
.put("gui_captcha", "3rd party features: GUI Captcha")
.put("bedrock_auto_login", "3rd party features: Bedrock Auto Login")
.put("login_location_fix", "3rd party features: Login Location Fix")
.put("double_login_fix", "3rd party features: Double Login Fix")
.build(); .build();
Set<String> addedKeys = new HashSet<>(); Set<String> addedKeys = new HashSet<>();
@@ -308,7 +308,7 @@ public class Whirlpool extends UnsaltedMethod {
if (bufferRem + sourceBits < 8) { if (bufferRem + sourceBits < 8) {
// all remaining data fits on buffer[bufferPos], and there still // all remaining data fits on buffer[bufferPos], and there still
// remains some space. // remains some space.
bufferBits += sourceBits; bufferBits += (int) sourceBits;
} else { } else {
// buffer[bufferPos] is full: // buffer[bufferPos] is full:
bufferPos++; bufferPos++;
@@ -73,7 +73,7 @@ public class AntiBotService implements SettingsDependent {
// Delay the schedule on first start // Delay the schedule on first start
if (startup) { if (startup) {
int delay = settings.getProperty(ProtectionSettings.ANTIBOT_DELAY); int delay = settings.getProperty(ProtectionSettings.ANTIBOT_DELAY);
bukkitService.scheduleSyncDelayedTask(enableTask, delay * TICKS_PER_SECOND); bukkitService.scheduleSyncDelayedTask(enableTask, (long) delay * TICKS_PER_SECOND);
startup = false; startup = false;
} else { } else {
enableTask.run(); enableTask.run();
@@ -91,7 +91,7 @@ public class AntiBotService implements SettingsDependent {
disableTask.cancel(); disableTask.cancel();
} }
// Schedule auto-disable // Schedule auto-disable
disableTask = bukkitService.runTaskLater(this::stopProtection, duration * TICKS_PER_MINUTE); disableTask = bukkitService.runTaskLater(this::stopProtection, (long) duration * TICKS_PER_MINUTE);
antiBotStatus = AntiBotStatus.ACTIVE; antiBotStatus = AntiBotStatus.ACTIVE;
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> { bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
// Inform admins // Inform admins
@@ -14,6 +14,8 @@ import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.SpawnLoader; import fr.xephi.authme.settings.SpawnLoader;
import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.TeleportUtils;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -140,7 +142,7 @@ public class TeleportationService implements Reloadable {
logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName()); logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName());
teleportToSpawn(player, true); teleportToSpawn(player, true);
} else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) { } else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) { if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
Location location = buildLocationFromAuth(player, auth); Location location = buildLocationFromAuth(player, auth);
logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName()); logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
teleportBackFromSpawn(player, location); teleportBackFromSpawn(player, location);
@@ -184,7 +186,9 @@ public class TeleportationService implements Reloadable {
private void performTeleportation(final Player player, final AbstractTeleportEvent event) { private void performTeleportation(final Player player, final AbstractTeleportEvent event) {
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> { bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
bukkitService.callEvent(event); bukkitService.callEvent(event);
if (player.isOnline() && isEventValid(event)) { if (player.isOnline() && isEventValid(event) && settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player, event.getTo());
} else if (player.isOnline() && isEventValid(event)) {
player.teleport(event.getTo()); player.teleport(event.getTo());
} }
}); });
@@ -8,6 +8,13 @@ import fr.xephi.authme.output.LogLevel;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty; import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class PluginSettings implements SettingsHolder { public final class PluginSettings implements SettingsHolder {
@Comment({
"Should we execute /help command when unregistered players press Shift+F?",
"This keeps compatibility with some menu plugins",
"If you are using TrMenu, don't enable this because TrMenu already implemented this."
})
public static final Property<Boolean> MENU_UNREGISTER_COMPATIBILITY =
newProperty("3rdPartyFeature.compatibility.menuPlugins", true);
@Comment({ @Comment({
"Do you want to enable the session feature?", "Do you want to enable the session feature?",
@@ -175,7 +175,7 @@ public final class RestrictionSettings implements SettingsHolder {
@Comment("Regex syntax for allowed chars in email.") @Comment("Regex syntax for allowed chars in email.")
public static final Property<String> ALLOWED_EMAIL_REGEX = public static final Property<String> ALLOWED_EMAIL_REGEX =
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9]{4,15}@(qq|outlook|163|gmail|icloud).com$"); newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9_]{4,15}@(qq|outlook|163|gmail|icloud)\\.com$");
@Comment("Force survival gamemode when player joins?") @Comment("Force survival gamemode when player joins?")
@@ -2,12 +2,14 @@ package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment; import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder; import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.BooleanProperty;
import ch.jalu.configme.properties.Property; import ch.jalu.configme.properties.Property;
import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.settings.EnumSetProperty; import fr.xephi.authme.settings.EnumSetProperty;
import java.util.List;
import java.util.Set; import java.util.Set;
import fr.xephi.authme.listener.PlayerQuitListener;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty; import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty; import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
@@ -17,21 +19,52 @@ public final class SecuritySettings implements SettingsHolder {
"Take care with this, if you set this to false,", "Take care with this, if you set this to false,",
"AuthMe will automatically disable and the server won't be protected!"}) "AuthMe will automatically disable and the server won't be protected!"})
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM = public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
newProperty("Security.SQLProblem.stopServer", true); newProperty("Security.SQLProblem.stopServer", false);
@Comment({"Should send GUI captcha by country code whitelist?",
"If the country of the player is in this list, the captcha won't be sent."})
public static final Property<List<String>> GUI_CAPTCHA_COUNTRY_WHITELIST =
newListProperty("3rdPartyFeature.features.captcha.whiteList");
@Comment({"Should we let Bedrock players login automatically?",
"(Requires hookFloodgate to be true & floodgate loaded)"})
public static final Property<Boolean> FORCE_LOGIN_BEDROCK = newProperty("3rdPartyFeature.features.bedrockAutoLogin", false);
@Comment("Enable the new feature to prevent ghost players?") @Comment("Enable the new feature to prevent ghost players?")
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false); public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
@Comment({"(BETA Feature)Choose the best teleport method by server brand?", @Comment({"Choose the best teleport method by server brand?",
"(Enable this if you are using Paper)"}) "(Enable this if you are using Paper)"})
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport",false); public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport", false);
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.features.captcha.guiCaptcha", false);
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
"(less than or equals 0 is disabled)"})
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.features.captcha.timeOut", 0);
@Comment({"Should we ignore floodgate players when sending GUI captcha?",
"(Requires floodgate and hookFloodgate: true)"})
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.features.captcha.ignoreBedrock", false);
@Comment("Should we delete player data and stats when they didn't finish the captcha?")
public static final Property<Boolean> DELETE_UNVERIFIED_PLAYER_DATA = newProperty("3rdPartyFeature.features.captcha.purgePlayerData", false);
@Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)")
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.features.captcha.purgeWorldFolderName", "world");
@Comment("Should we fix the location when players logged in the portal?")
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
@Comment("Should we fix the location when players logged underground?")
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_UNDERGROUND = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixGroundStuck", false);
// @Comment({"Should we kick the players when they failed captcha too many times?",
// "(Minimum value is 1)(Default: 3)"})
// public static final Property<Integer> GUI_CAPTCHA_MAX_TRY = newProperty("3rdPartyFeature.captcha.maxTryTimes",3);
@Comment("(BETA Feature)Send a GUI captcha to unregistered players?")
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.captcha.guiCaptcha",false);
// @Comment({"Kick the players when they didn't finish the gui captcha in time? " ,
// "(0 is disabled)"})
// public static final Property<Integer> CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.captcha.timeout",0);
//@Comment({"Using which API to get hash data?", //@Comment({"Using which API to get hash data?",
//"Available options: github, gitee, ghproxy (if your server is in China, please use gitee or ghproxy.)"}) //"Available options: github, gitee, ghproxy (if your server is in China, please use gitee or ghproxy.)"})
//public static final Property<String> SHA_CHECK_METHOD = newProperty("Plugin.hashing.hashApi","github"); //public static final Property<String> SHA_CHECK_METHOD = newProperty("Plugin.hashing.hashApi","github");
@@ -63,6 +96,14 @@ public final class SecuritySettings implements SettingsHolder {
public static final Property<Boolean> CHECK_FOR_UPDATES = public static final Property<Boolean> CHECK_FOR_UPDATES =
newProperty("Plugin.updates.checkForUpdates", true); newProperty("Plugin.updates.checkForUpdates", true);
@Comment("Should we show the AuthMe banner on startup?")
public static final Property<Boolean> SHOW_STARTUP_BANNER =
newProperty("Plugin.banners.showBanners", true);
@Comment("Change the banner colors here (Default: §r)")
public static final Property<String> STARTUP_BANNER_COLOR =
newProperty("Plugin.banners.bannerColor", "§r");
@Comment("Max allowed tries before a captcha is required") @Comment("Max allowed tries before a captcha is required")
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA = public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
newProperty("Security.captcha.maxLoginTry", 8); newProperty("Security.captcha.maxLoginTry", 8);
@@ -0,0 +1,26 @@
package fr.xephi.authme.util;
import fr.xephi.authme.api.v3.AuthMeApi;
import org.bukkit.entity.Player;
import org.geysermc.cumulus.form.CustomForm;
import org.geysermc.floodgate.api.FloodgateApi;
import java.util.UUID;
public class FormUtils {
private static final FloodgateApi floodgateApi = FloodgateApi.getInstance();
private static final AuthMeApi authMeApi = AuthMeApi.getInstance();
public static void openRegisterForm(Player player, String title, String text, String textBar) {
String name = player.getName();
UUID uuid = player.getUniqueId();
CustomForm.Builder regForm = CustomForm.builder()
.title(title)
.input(text, textBar)
.validResultHandler(((customForm1, customFormResponse) -> {
authMeApi.registerPlayer(name, customFormResponse.asInput(0));
}));
floodgateApi.sendForm(uuid, regForm);
}
}
@@ -1,31 +1,10 @@
package fr.xephi.authme.util; package fr.xephi.authme.util;
import fr.xephi.authme.ConsoleLogger;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import javax.inject.Inject;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
//
//public class TeleportUtils {
// public static void teleport(Player player, Location location) {
// try {
// Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig");
// // Paper API is loaded, use teleportAsync
// Method teleportAsyncMethod = player.getClass().getMethod("teleportAsync", Location.class);
// teleportAsyncMethod.setAccessible(true);
// teleportAsyncMethod.invoke(player, location);
// } catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
// // Paper API is not loaded, use normal teleport
// player.teleport(location);
// }
// }
//}
public class TeleportUtils { public class TeleportUtils {
private static Method teleportAsyncMethod; private static Method teleportAsyncMethod;
@@ -33,6 +12,7 @@ public class TeleportUtils {
try {//Detect Paper class try {//Detect Paper class
Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig"); Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig");
teleportAsyncMethod = Player.class.getMethod("teleportAsync", Location.class); teleportAsyncMethod = Player.class.getMethod("teleportAsync", Location.class);
teleportAsyncMethod.setAccessible(true);
// if detected,use teleportAsync() // if detected,use teleportAsync()
} catch (ClassNotFoundException | NoSuchMethodException e) { } catch (ClassNotFoundException | NoSuchMethodException e) {
teleportAsyncMethod = null; teleportAsyncMethod = null;
@@ -43,7 +23,6 @@ public class TeleportUtils {
public static void teleport(Player player, Location location) { public static void teleport(Player player, Location location) {
if (teleportAsyncMethod != null) { if (teleportAsyncMethod != null) {
try { try {
teleportAsyncMethod.setAccessible(true);
teleportAsyncMethod.invoke(player, location); teleportAsyncMethod.invoke(player, location);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
player.teleport(location); player.teleport(location);
Binary file not shown.
+2 -1
View File
@@ -103,7 +103,8 @@
<tr> <tr>
<td> <td>
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p> <p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
<a href="1919810.com" target="_blank" style="text-decoration: none; font-size: 16px">homomc.cc</a> <a href="1919810.com" target="_blank"
style="text-decoration: none; font-size: 16px">wdsj.io</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -155,3 +155,28 @@ time:
hours: 'hours' hours: 'hours'
day: 'day' day: 'day'
days: 'days' days: 'days'
# 3rd party features: GUI Captcha
gui_captcha:
success: '&aVerification success!'
bedrock_auto_verify_success: '&aBedrock verification success!'
captcha_window_name: '%random Verification'
captcha_clickable_name: '%random I am human'
message_on_retry: '&cVerification failed, you have %times retries left'
denied_message_sending: '&cPlease be verified before chatting!'
kick_on_failed: '&cPlease complete the verification!'
kick_on_timeout: '&cVerification timed out!'
# 3rd party features: Bedrock Auto Login
bedrock_auto_login:
success: '&aBedrock auto login success!'
# 3rd party features: Login Location Fix
login_location_fix:
fix_portal: '&aYou are stuck in portal during Login.'
fix_underground: '&aYou are stuck underground during Login.'
cannot_fix_underground: '&aYou are stuck underground during Login, but we cant fix it.'
# 3rd party features: Double Login Fix
double_login_fix:
fix_message: '&cYou have been disconnected due to doubled login.'
@@ -164,3 +164,30 @@ two_factor:
not_enabled_error: '&c双重验证未在您的账号上启用,请使用“/totp add”来启用' not_enabled_error: '&c双重验证未在您的账号上启用,请使用“/totp add”来启用'
removed_success: '&c双重验证已从您的账号上禁用' removed_success: '&c双重验证已从您的账号上禁用'
invalid_code: '&c无效的验证码' invalid_code: '&c无效的验证码'
# 3rd party features: GUI Captcha
gui_captcha:
success: '&a*** 验证完成 ***'
bedrock_auto_verify_success: '&a*** 基岩版自动验证完成 ***'
captcha_window_name: '&k%random&r&n请验证你是真人'
captcha_clickable_name: '&k%random&r&n我是真人'
message_on_retry: '&c验证失败,你还有 %times 次机会'
denied_message_sending: '&c请先完成验证再聊天!'
kick_on_failed: '&c请先完成验证!'
kick_on_timeout: '&c验证超时'
# 3rd party features: Bedrock Auto Login
bedrock_auto_login:
success: "&a基岩版自动登录完成"
# 3rd party features: Login Location Fix
login_location_fix:
fix_portal: '&a你在登录时卡在了地狱门, 现已修正'
fix_underground: '&a你被埋住了, 坐标已修正, 下次下线之前请小心!'
cannot_fix_underground: '&a你被埋住了, 坐标无法修正, 只好送你去了最高点, 自求多福吧少年~'
# 3rd party features: Double Login Fix
double_login_fix:
fix_message: '&a已修复幽灵玩家, 请重新进入'
+2 -1
View File
@@ -109,7 +109,8 @@
<tr> <tr>
<td> <td>
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p> <p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
<a href="1919810.com" target="_blank" style="text-decoration: none; font-size: 16px">homomc.cc</a> <a href="1919810.com" target="_blank"
style="text-decoration: none; font-size: 16px">wdsj.io</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
+1 -1
View File
@@ -3,7 +3,7 @@ authors: [${pluginDescription.authors}]
website: http://github.com/HaHaWTH/AuthMeReReloaded/ website: http://github.com/HaHaWTH/AuthMeReReloaded/
description: A fork of AuthMeReloaded that contains bug fixes description: A fork of AuthMeReloaded that contains bug fixes
main: ${pluginDescription.main} main: ${pluginDescription.main}
version: 5.6.0-FORK-b17 version: 5.6.0-FORK-b34
api-version: 1.13 api-version: 1.13
softdepend: softdepend:
- Vault - Vault
+2 -1
View File
@@ -102,7 +102,8 @@
<tr> <tr>
<td> <td>
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p> <p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
<a href="191980.com" target="_blank" style="text-decoration: none; font-size: 16px">homomc.cc</a> <a href="1919810.com" target="_blank"
style="text-decoration: none; font-size: 16px">wdsj.io</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
+2 -1
View File
@@ -100,7 +100,8 @@
<tr> <tr>
<td> <td>
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p> <p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
<a href="1919810.com" target="_blank" style="text-decoration: none; font-size: 16px">homomc.cc</a> <a href="1919810.com" target="_blank"
style="text-decoration: none; font-size: 16px">wdsj.io</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -102,7 +102,8 @@
<tr> <tr>
<td> <td>
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p> <p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
<a href="1919810.com" target="_blank" style="text-decoration: none; font-size: 16px">homomc.cc</a> <a href="1919810.com" target="_blank"
style="text-decoration: none; font-size: 16px">wdsj.io</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>