Compare commits

...

97 Commits

Author SHA1 Message Date
HaHaWTH 6ef4f0f3e3 Version b43 2024-03-09 23:41:03 +08:00
DGun Otto bb9c46b147 Revert MySQL dependency update 2024-02-27 13:34:18 +08:00
HaHaWTH 131d2429f9 Merge remote-tracking branch 'origin/master' 2024-02-26 01:30:28 +08:00
HaHaWTH d305fe6679 Commands 2024-02-26 01:30:10 +08:00
DGun Otto 35c801ae63 Merge pull request #109 from HaHaWTH/patch
Patch
2024-02-23 10:18:27 +08:00
DGun Otto b5a46d94de Merge branch 'master' into patch 2024-02-23 00:38:03 +08:00
DGun Otto 5a5992b353 Merge branch 'AuthMe:master' into patch 2024-02-23 00:35:05 +08:00
dependabot[bot] f56a23f4b7 Bump maven-install-plugin from 3.0.1 to 3.1.0 (#2643)
Bumps [maven-install-plugin](https://github.com/apache/maven-install-plugin) from 3.0.1 to 3.1.0.
- [Release notes](https://github.com/apache/maven-install-plugin/releases)
- [Commits](https://github.com/apache/maven-install-plugin/compare/maven-install-plugin-3.0.1...maven-install-plugin-3.1.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-install-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:44:00 +01:00
dependabot[bot] a57382f269 Bump maven-enforcer-plugin from 3.1.0 to 3.2.1 (#2681)
Bumps [maven-enforcer-plugin](https://github.com/apache/maven-enforcer) from 3.1.0 to 3.2.1.
- [Release notes](https://github.com/apache/maven-enforcer/releases)
- [Commits](https://github.com/apache/maven-enforcer/compare/enforcer-3.1.0...enforcer-3.2.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-enforcer-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:43:48 +01:00
dependabot[bot] 9380efdd3d Bump bcrypt from 0.9.0 to 0.10.2 (#2729)
Bumps [bcrypt](https://github.com/patrickfav/bcrypt) from 0.9.0 to 0.10.2.
- [Release notes](https://github.com/patrickfav/bcrypt/releases)
- [Changelog](https://github.com/patrickfav/bcrypt/blob/main/CHANGELOG)
- [Commits](https://github.com/patrickfav/bcrypt/compare/v0.9.0...v0.10.2)

---
updated-dependencies:
- dependency-name: at.favre.lib:bcrypt
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:43:17 +01:00
dependabot[bot] ad64370bf1 Bump net.essentialsx:EssentialsX from 2.20.0 to 2.20.1 (#2737)
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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:43:07 +01:00
dependabot[bot] 54bae76d27 Bump org.jacoco:jacoco-maven-plugin from 0.8.8 to 0.8.11 (#2756)
Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.8 to 0.8.11.
- [Release notes](https://github.com/jacoco/jacoco/releases)
- [Commits](https://github.com/jacoco/jacoco/compare/v0.8.8...v0.8.11)

---
updated-dependencies:
- dependency-name: org.jacoco:jacoco-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:42:54 +01:00
dependabot[bot] 93f1385c7a Bump com.mysql:mysql-connector-j from 8.0.33 to 8.2.0 (#2761)
Bumps [com.mysql:mysql-connector-j](https://github.com/mysql/mysql-connector-j) from 8.0.33 to 8.2.0.
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.x/CHANGES)
- [Commits](https://github.com/mysql/mysql-connector-j/compare/8.0.33...8.2.0)

---
updated-dependencies:
- dependency-name: com.mysql:mysql-connector-j
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:42:40 +01:00
dependabot[bot] d5dbc7e5c7 Bump org.checkerframework:checker-qual from 3.26.0 to 3.40.0 (#2764)
Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 3.26.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.26.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:42:17 +01:00
dependabot[bot] 72bbb4ebaa Bump org.mariadb.jdbc:mariadb-java-client from 3.1.4 to 3.3.0 (#2765)
Bumps [org.mariadb.jdbc:mariadb-java-client](https://github.com/mariadb-corporation/mariadb-connector-j) from 3.1.4 to 3.3.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.3.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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:41:57 +01:00
dependabot[bot] caf0d3f8ed Bump org.xerial:sqlite-jdbc from 3.42.0.0 to 3.44.0.0 (#2766)
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.42.0.0 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.42.0.0...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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-22 11:40:56 +01:00
DGun Otto 95726cc7f9 Update PostgreSQL to silence CVE-2024-1597 warning (#2778) 2024-02-22 11:36:18 +01:00
DGun Otto ca7a070e4c [ci skip] Update README 2024-02-22 02:03:48 +08:00
DGun Otto ab1d952070 [ci skip] Remove mcbbs link 2024-02-22 02:00:18 +08:00
DGun Otto 1ce64bbcdf Update PostgreSQL to resolve CVE-2024-1597 2024-02-21 13:24:55 +08:00
DGun Otto 1c38384ac7 Update PostgreSQL to resolve CVE-2024-1597
Bump org.postgresql:postgresql from 42.6.0 to 42.7.2
2024-02-21 13:22:50 +08:00
DGun Otto 90ff68eacd Merge pull request #107 from HaHaWTH/dependabot/maven/org.mariadb.jdbc-mariadb-java-client-3.3.3
Bump org.mariadb.jdbc:mariadb-java-client from 3.1.4 to 3.3.3
2024-02-21 13:14:39 +08:00
DGun Otto f7569f3eb1 Merge pull request #105 from HaHaWTH/dependabot/maven/org.apache.maven.plugins-maven-shade-plugin-3.5.2
Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.1 to 3.5.2
2024-02-21 13:14:03 +08:00
dependabot[bot] 77c289dc13 Bump org.mariadb.jdbc:mariadb-java-client from 3.1.4 to 3.3.3
Bumps [org.mariadb.jdbc:mariadb-java-client](https://github.com/mariadb-corporation/mariadb-connector-j) from 3.1.4 to 3.3.3.
- [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.3.3)

---
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>
2024-02-21 04:33:40 +00:00
dependabot[bot] cca78be983 Bump org.postgresql:postgresql from 42.6.0 to 42.7.2
Bumps [org.postgresql:postgresql](https://github.com/pgjdbc/pgjdbc) from 42.6.0 to 42.7.2.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pgjdbc/pgjdbc/compare/REL42.6.0...REL42.7.2)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 04:33:10 +00:00
dependabot[bot] c15575cb54 Bump org.apache.maven.plugins:maven-shade-plugin from 3.5.1 to 3.5.2
Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.5.1 to 3.5.2.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.5.1...maven-shade-plugin-3.5.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-shade-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 04:32:53 +00:00
DGun Otto 81dd695999 Remove mirror repo 2024-02-20 21:04:50 +08:00
DGun Otto 3065b98456 ignore slf4j update 2024-02-14 16:24:00 +08:00
HaHaWTH e3c460e614 B42 release 2024-02-03 20:07:32 +08:00
HaHaWTH a1cb16dd3d Javadoc 2024-02-03 19:24:25 +08:00
HaHaWTH e9810c69f4 May fix 2024-02-03 19:07:48 +08:00
HaHaWTH 2b0bee198e May fix 2024-02-03 19:03:15 +08:00
HaHaWTH c31e009860 Ignore failed check 2024-02-01 17:11:50 +08:00
HaHaWTH 2b94776e71 Merge remote-tracking branch 'origin/master' 2024-01-31 21:14:05 +08:00
HaHaWTH fe2b877052 准丞相率三十万大军,择日启程,北伐曹魏! 2024-01-31 21:13:43 +08:00
DGun Otto efad796eb0 Merge pull request #98 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.45.1.0
Bump org.xerial:sqlite-jdbc from 3.45.0.0 to 3.45.1.0
2024-01-31 13:47:02 +08:00
dependabot[bot] fe17b93bde Bump org.xerial:sqlite-jdbc from 3.45.0.0 to 3.45.1.0
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.45.0.0 to 3.45.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.45.0.0...3.45.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>
2024-01-31 05:00:09 +00:00
DGun Otto af9aa5c1cb [ci skip] Update README.md 2024-01-31 02:24:12 +08:00
HaHaWTH 5e39bd0bd3 B41 release 2024-01-30 23:01:31 +08:00
HaHaWTH ac5dfcde26 Update version command 2024-01-30 22:57:50 +08:00
HaHaWTH 8aef3ceb06 Patch H2 and Update H2 to 2.2.224 2024-01-30 13:42:10 +08:00
HaHaWTH 5155ab6302 Merge remote-tracking branch 'origin/master' 2024-01-30 01:23:59 +08:00
HaHaWTH cd5a008637 Add SQLiteToH2 converter 2024-01-30 01:21:15 +08:00
DGun Otto 58fe9a7394 [ci skip] Update README.md 2024-01-30 00:16:36 +08:00
HaHaWTH 910ebdd5bf Patch for H2 2024-01-30 00:14:44 +08:00
HaHaWTH 5f89964f49 Fix fakePlayers of Leaves NPE error 2024-01-29 22:52:54 +08:00
HaHaWTH 4f0bc6d12f relocations 2024-01-29 22:37:22 +08:00
HaHaWTH 9346285c08 H2 database support 2024-01-29 22:28:30 +08:00
HaHaWTH 19a4ec3176 H2 database support 2024-01-29 21:35:51 +08:00
HaHaWTH 46f64d8048 H2 database support 2024-01-29 21:34:40 +08:00
HaHaWTH e04608e499 Cleanup 2024-01-29 19:53:52 +08:00
HaHaWTH c402e2ec5a Optimize shulker fix 2024-01-29 19:46:00 +08:00
HaHaWTH 4437be8863 LoginLocFix now can be reloaded 2024-01-29 19:42:25 +08:00
DGun Otto b54c1f8d34 Update README.md 2024-01-21 19:53:18 +08:00
DGun Otto a9402846b5 Update README.md 2024-01-21 19:50:01 +08:00
DGun Otto c37e4b2374 Merge pull request #97 from HaHaWTH/dependabot/maven/org.xerial-sqlite-jdbc-3.45.0.0
Bump org.xerial:sqlite-jdbc from 3.44.1.0 to 3.45.0.0
2024-01-19 23:16:07 +08:00
dependabot[bot] acad03fbbf Bump org.xerial:sqlite-jdbc from 3.44.1.0 to 3.45.0.0
Bumps [org.xerial:sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) from 3.44.1.0 to 3.45.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.44.1.0...3.45.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>
2024-01-19 04:16:34 +00:00
HaHaWTH 8061645346 Revert changes 2024-01-14 13:56:30 +08:00
HaHaWTH b97840a320 Folia Support 2024-01-14 12:56:20 +08:00
HaHaWTH a5ba77a3d2 Folia Support 2024-01-14 12:53:42 +08:00
HaHaWTH ea383dd0f1 Folia Support 2024-01-14 11:43:25 +08:00
HaHaWTH 885db23fc6 Folia Support(dev) 2024-01-14 11:03:12 +08:00
HaHaWTH 68ab92dd7a Merge remote-tracking branch 'origin/master' 2024-01-10 23:28:32 +08:00
HaHaWTH d9495ff839 B40 release 2024-01-10 23:28:08 +08:00
DGun Otto 0e01d8145f [ci skip] Update README.md 2024-01-08 21:55:31 +08:00
HaHaWTH ed9e379500 Merge remote-tracking branch 'origin/master' 2024-01-07 22:07:36 +08:00
HaHaWTH a9cb2d2490 Fix 2024-01-07 22:06:47 +08:00
DGun Otto 900937c033 Update updateChecker 2024-01-03 23:37:54 +08:00
DGun Otto 9585fc1bdb [ci skip] Update README.md 2024-01-02 21:17:55 +08:00
HaHaWTH d8d3e8544c Remove useless bannerColor 2023-12-31 21:25:42 +08:00
HaHaWTH a50e5fa802 Remove useless bannerColor 2023-12-31 17:40:43 +08:00
HaHaWTH c9363ca6e8 false 2023-12-31 17:34:57 +08:00
HaHaWTH 222bd879d1 Add warn 2023-12-31 17:34:42 +08:00
HaHaWTH 01f4a8f205 Revert config value to false 2023-12-31 17:20:43 +08:00
HaHaWTH be976b6738 Add AdvancedShulkerFix and optimize LoginLocationFix 2023-12-31 17:19:30 +08:00
HaHaWTH c89a818696 improve getMinHeight() 2023-12-31 14:10:28 +08:00
HaHaWTH 1c63eca0f7 improve getMinHeight() 2023-12-31 14:07:44 +08:00
HaHaWTH 69989fb99e B39 release 2023-12-30 14:06:36 +08:00
HaHaWTH 8cf794e303 Remove debug 2023-12-30 13:51:47 +08:00
HaHaWTH de9e74d616 Fix compatibility with Minecraft 1.16.x and lower 2023-12-30 13:13:58 +08:00
HaHaWTH e147a25076 Fix compatibility with Minecraft 1.16.x and lower 2023-12-30 11:08:27 +08:00
HaHaWTH b25d874122 Thread-safety 2023-12-30 09:20:16 +08:00
DGun Otto b322032757 Merge pull request #86 from HaHaWTH/dependabot/maven/org.apache.commons-commons-email-1.6.0
Bump org.apache.commons:commons-email from 1.6-SNAPSHOT to 1.6.0
2023-12-26 23:25:13 +08:00
DGun Otto d505601d33 Merge pull request #87 from HaHaWTH/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.12.1
Bump org.apache.maven.plugins:maven-compiler-plugin from 3.12.0 to 3.12.1
2023-12-26 00:20:23 +08:00
dependabot[bot] 8580d57a12 Bump org.apache.maven.plugins:maven-compiler-plugin
Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.12.0 to 3.12.1.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.12.0...maven-compiler-plugin-3.12.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 04:21:45 +00:00
dependabot[bot] b051f4feef Bump org.apache.commons:commons-email from 1.6-SNAPSHOT to 1.6.0
Bumps org.apache.commons:commons-email from 1.6-SNAPSHOT to 1.6.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-email
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 04:21:10 +00:00
HaHaWTH 96c886b93d Merge remote-tracking branch 'origin/master' 2023-12-20 21:00:52 +08:00
HaHaWTH f1d6df9a17 Fix LoginLocationFixListener 2023-12-20 21:00:31 +08:00
DGun Otto 6681075031 Merge pull request #84 from HaHaWTH/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.12.0
Bump org.apache.maven.plugins:maven-compiler-plugin from 3.11.0 to 3.12.0
2023-12-19 13:16:58 +08:00
dependabot[bot] 1aae25f510 Bump org.apache.maven.plugins:maven-compiler-plugin
Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.11.0 to 3.12.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.11.0...maven-compiler-plugin-3.12.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 04:46:16 +00:00
HaHaWTH 8a5dfc8e6a B38 release 2023-12-18 16:39:41 +08:00
HaHaWTH 9daf44d512 Fixed #81 2023-12-15 21:36:32 +08:00
HaHaWTH 2485514111 Cleanup 2023-12-15 21:30:32 +08:00
HaHaWTH 528b61c5d9 Revert default config 2023-12-15 21:28:52 +08:00
HaHaWTH 829f7180da Dev revert 2023-12-14 00:08:35 +08:00
HaHaWTH 18203574d0 Dev update 2023-12-13 23:47:31 +08:00
HaHaWTH b2678d3165 Bump to B37 and fixes #76 2023-12-13 21:36:17 +08:00
33 changed files with 759 additions and 622 deletions
+2
View File
@@ -12,3 +12,5 @@ updates:
- dependency-name: com.zaxxer:HikariCP - dependency-name: com.zaxxer:HikariCP
- dependency-name: "org.mockito:mockito-core" # Mockito 5 requires Java 11 - dependency-name: "org.mockito:mockito-core" # Mockito 5 requires Java 11
versions: ">= 5" versions: ">= 5"
- dependency-name: "org.slf4j:slf4j-simple"
versions: ">= 1.7.36"
+18 -2
View File
@@ -1,10 +1,11 @@
# 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"> <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/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"/> <img src="https://img.shields.io/github/repo-size/HaHaWTH/AuthMeReReloaded.svg" alt="GitHub repo size"/>
<img src="https://www.codefactor.io/repository/github/hahawth/authmerereloaded/badge" alt="CodeFactor" />
</p> </p>
**Detailed Changes:** **Detailed Changes:**
@@ -24,10 +25,25 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
13. Offhand Menu compatibility(Thats amazing) 13. Offhand Menu compatibility(Thats amazing)
14. Automatically fix portal stuck issue 14. Automatically fix portal stuck issue
15. Automatically login for Bedrock players(configurable) 15. Automatically login for Bedrock players(configurable)
16. More...... 16. Fix shulker box crash bug on legacy versions(MC 1.13-)
17. **H2 database support**
18. **100% compatibility with original authme and extensions**
19. More......
**Download links:** **Download links:**
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest) [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) [Actions(Dev builds, use at your own risk!)](https://github.com/HaHaWTH/AuthMeReReloaded/actions/workflows/maven.yml)
If you are using FRP(内网穿透) for your server, this plugin may help [HAProxy-Detector](https://github.com/HaHaWTH/HAProxy-Detector)
**Pull Requests and suggestions are welcome!** **Pull Requests and suggestions are welcome!**
<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="
https://api.star-history.com/svg?repos=HaHaWTH/AuthMeReReloaded&type=Date&theme=dark
"
/>
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=HaHaWTH/AuthMeReReloaded&type=Date" />
</picture>
+1 -1
View File
@@ -9,7 +9,7 @@ the generated config.yml file.
```yml ```yml
DataSource: DataSource:
# What type of database do you want to use? # What type of database do you want to use?
# Valid values: SQLITE, MARIADB, MYSQL, POSTGRESQL # Valid values: H2, SQLITE, MARIADB, MYSQL, POSTGRESQL
backend: SQLITE backend: SQLITE
# Enable the database caching system, should be disabled on bungeecord environments # Enable the database caching system, should be disabled on bungeecord environments
# or when a website integration is being used. # or when a website integration is being used.
+47 -15
View File
@@ -164,7 +164,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version> <version>3.2.1</version>
<executions> <executions>
<execution> <execution>
<id>enforce-environment</id> <id>enforce-environment</id>
@@ -206,7 +206,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version> <version>3.12.1</version>
<configuration> <configuration>
<source>${java.source}</source> <source>${java.source}</source>
<target>${java.target}</target> <target>${java.target}</target>
@@ -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.8</version> <version>0.8.11</version>
<executions> <executions>
<execution> <execution>
<id>pre-unit-test</id> <id>pre-unit-test</id>
@@ -294,7 +294,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version> <version>3.5.2</version>
<executions> <executions>
<execution> <execution>
<id>shaded-jar</id> <id>shaded-jar</id>
@@ -346,6 +346,10 @@
<pattern>com.google.gson</pattern> <pattern>com.google.gson</pattern>
<shadedPattern>fr.xephi.authme.libs.com.google.gson</shadedPattern> <shadedPattern>fr.xephi.authme.libs.com.google.gson</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>org.h2</pattern>
<shadedPattern>fr.xephi.authme.libs.org.h2</shadedPattern>
</relocation>
</relocations> </relocations>
</configuration> </configuration>
</execution> </execution>
@@ -440,6 +444,14 @@
<pattern>com.google.protobuf</pattern> <pattern>com.google.protobuf</pattern>
<shadedPattern>fr.xephi.authme.libs.com.google.protobuf</shadedPattern> <shadedPattern>fr.xephi.authme.libs.com.google.protobuf</shadedPattern>
</relocation> </relocation>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>fr.xephi.authme.libs.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.validator</pattern>
<shadedPattern>fr.xephi.authme.libs.org.apache.commons.validator</shadedPattern>
</relocation>
</relocations> </relocations>
<filters> <filters>
@@ -472,7 +484,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>3.0.1</version> <version>3.1.0</version>
</plugin> </plugin>
<!-- Deploy the jars as artifacts into the remote repository --> <!-- Deploy the jars as artifacts into the remote repository -->
<plugin> <plugin>
@@ -507,6 +519,15 @@
</build> </build>
<repositories> <repositories>
<repository>
<id>opencollab-snapshot-main</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
<repository>
<id>opencollab-maven-snapshots</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
</repository>
<!-- Apache snapshots repo --> <!-- Apache snapshots repo -->
<repository> <repository>
<id>apache-snapshots</id> <id>apache-snapshots</id>
@@ -625,10 +646,6 @@
<enabled>false</enabled> <enabled>false</enabled>
</snapshots> </snapshots>
</repository> </repository>
<repository>
<id>opencollab-snapshot-main</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
@@ -639,6 +656,7 @@
<version>2.2.2-SNAPSHOT</version> <version>2.2.2-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Jalu Injector --> <!-- Jalu Injector -->
<dependency> <dependency>
<groupId>ch.jalu</groupId> <groupId>ch.jalu</groupId>
@@ -682,7 +700,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId> <artifactId>commons-email</artifactId>
<version>1.6-SNAPSHOT</version> <version>1.6.0</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -733,7 +751,7 @@
<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.3.3</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -865,6 +883,20 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- dependencies used by HAProxy feature -->
<!-- <dependency>-->
<!-- <groupId>io.netty</groupId>-->
<!-- <artifactId>netty-codec-haproxy</artifactId>-->
<!-- <version>4.1.104.Final</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>commons-validator</groupId>-->
<!-- <artifactId>commons-validator</artifactId>-->
<!-- <version>1.8.0</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<!-- zPermissions plugin --> <!-- zPermissions plugin -->
<dependency> <dependency>
<groupId>org.tyrannyofheaven.bukkit</groupId> <groupId>org.tyrannyofheaven.bukkit</groupId>
@@ -1036,7 +1068,7 @@
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.6.0</version> <version>42.7.2</version>
<optional>true</optional> <optional>true</optional>
<exclusions> <exclusions>
<exclusion> <exclusion>
@@ -1087,14 +1119,14 @@
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId> <artifactId>sqlite-jdbc</artifactId>
<version>3.44.1.0</version> <version>3.45.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.1.214</version> <version>2.2.224</version>
<scope>test</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
+20 -16
View File
@@ -11,6 +11,7 @@ import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
import fr.xephi.authme.initialization.OnStartupTasks; import fr.xephi.authme.initialization.OnStartupTasks;
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.AdvancedShulkerFixListener;
import fr.xephi.authme.listener.BedrockAutoLoginListener; 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.DoubleLoginFixListener;
@@ -73,8 +74,8 @@ 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";
public static final String pluginBuild = "b"; private static final String pluginBuild = "b";
private static String pluginBuildNumber = "36"; private static String pluginBuildNumber = "43";
// Private instances // Private instances
private EmailService emailService; private EmailService emailService;
private CommandHandler commandHandler; private CommandHandler commandHandler;
@@ -85,12 +86,22 @@ public class AuthMe extends JavaPlugin {
private Injector injector; private Injector injector;
private BackupService backupService; private BackupService backupService;
public static ConsoleLogger logger; public static ConsoleLogger logger;
/** /**
* Constructor. * Constructor.
*/ */
public AuthMe() { public AuthMe() {
} }
/**
* Get the plugin's build
*
* @return The plugin's build
*/
public static String getPluginBuild() {
return pluginBuild;
}
/** /**
* Get the plugin's name. * Get the plugin's name.
@@ -179,15 +190,6 @@ public class AuthMe extends JavaPlugin {
// Set up Metrics // Set up Metrics
OnStartupTasks.sendMetrics(this, settings); OnStartupTasks.sendMetrics(this, settings);
if (settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) { if (settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
String loadColorConfig = settings.getProperty(SecuritySettings.STARTUP_BANNER_COLOR);
if (loadColorConfig.startsWith("§") && !loadColorConfig.endsWith("§") && (loadColorConfig.length() % 2 == 0)) {
logger.info("\n" + loadColorConfig + " ___ __ __ __ ___ \n" +
loadColorConfig + " / | __ __/ /_/ /_ / |/ /__ \n" +
loadColorConfig + " / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
loadColorConfig + " / ___ / /_/ / /_/ / / / / / / __/\n" +
loadColorConfig + "/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
loadColorConfig + " ");
} else {
logger.info("\n" + " ___ __ __ __ ___ \n" + logger.info("\n" + " ___ __ __ __ ___ \n" +
" / | __ __/ /_/ /_ / |/ /__ \n" + " / | __ __/ /_/ /_ / |/ /__ \n" +
" / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" + " / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
@@ -195,7 +197,6 @@ public class AuthMe extends JavaPlugin {
"/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" + "/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
" "); " ");
} }
}
// Successful message // Successful message
//detect server brand with classloader //detect server brand with classloader
checkServerType(); checkServerType();
@@ -349,6 +350,11 @@ public class AuthMe extends JavaPlugin {
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) { if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this); pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this);
} }
if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX) && !isClassLoaded("org.bukkit.event.player.PlayerCommandSendEvent")) {
pluginManager.registerEvents(injector.getSingleton(AdvancedShulkerFixListener.class), this);
} else if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX) && isClassLoaded("org.bukkit.event.player.PlayerCommandSendEvent")) {
logger.warning("You are running an 1.13+ minecraft server, advancedShulkerFix won't enable.");
}
} }
/** /**
@@ -416,13 +422,11 @@ public class AuthMe extends JavaPlugin {
if (isUpdateAvailable(latestVersion)) { if (isUpdateAvailable(latestVersion)) {
String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber; String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber;
getLogger().log(Level.WARNING, message); getLogger().log(Level.WARNING, message);
getLogger().log(Level.WARNING, "Download from here: github.com/HaHaWTH/AuthMeReReloaded/releases/latest"); getLogger().log(Level.WARNING, "Download from here: https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
} else { } else {
getLogger().log(Level.INFO, "You are running the latest version."); getLogger().log(Level.INFO, "You are running the latest version.");
} }
} catch (IOException e) { } catch (IOException ignored) {
String formattedException = ExceptionUtils.formatException(e);
getLogger().log(Level.WARNING, "Error occurred while checking updates from GitHub. Reason: " + formattedException);
} }
}); });
} }
@@ -84,14 +84,14 @@ public final class CommandUtils {
* @return formatted command syntax incl. arguments * @return formatted command syntax incl. arguments
*/ */
public static String buildSyntax(CommandDescription command, List<String> correctLabels) { public static String buildSyntax(CommandDescription command, List<String> correctLabels) {
String commandSyntax = ChatColor.WHITE + "/" + correctLabels.get(0) + ChatColor.YELLOW; StringBuilder commandSyntax = new StringBuilder(ChatColor.WHITE + "/" + correctLabels.get(0) + ChatColor.YELLOW);
for (int i = 1; i < correctLabels.size(); ++i) { for (int i = 1; i < correctLabels.size(); ++i) {
commandSyntax += " " + correctLabels.get(i); commandSyntax.append(" ").append(correctLabels.get(i));
} }
for (CommandArgumentDescription argument : command.getArguments()) { for (CommandArgumentDescription argument : command.getArguments()) {
commandSyntax += " " + formatArgument(argument); commandSyntax.append(" ").append(formatArgument(argument));
} }
return commandSyntax; return commandSyntax.toString();
} }
/** /**
@@ -11,6 +11,7 @@ import fr.xephi.authme.datasource.converter.LoginSecurityConverter;
import fr.xephi.authme.datasource.converter.MySqlToSqlite; import fr.xephi.authme.datasource.converter.MySqlToSqlite;
import fr.xephi.authme.datasource.converter.RakamakConverter; import fr.xephi.authme.datasource.converter.RakamakConverter;
import fr.xephi.authme.datasource.converter.RoyalAuthConverter; import fr.xephi.authme.datasource.converter.RoyalAuthConverter;
import fr.xephi.authme.datasource.converter.SqliteToH2;
import fr.xephi.authme.datasource.converter.SqliteToSql; import fr.xephi.authme.datasource.converter.SqliteToSql;
import fr.xephi.authme.datasource.converter.VAuthConverter; import fr.xephi.authme.datasource.converter.VAuthConverter;
import fr.xephi.authme.datasource.converter.XAuthConverter; import fr.xephi.authme.datasource.converter.XAuthConverter;
@@ -89,6 +90,7 @@ public class ConverterCommand implements ExecutableCommand {
.put("vauth", VAuthConverter.class) .put("vauth", VAuthConverter.class)
.put("sqlitetosql", SqliteToSql.class) .put("sqlitetosql", SqliteToSql.class)
.put("mysqltosqlite", MySqlToSqlite.class) .put("mysqltosqlite", MySqlToSqlite.class)
.put("sqlitetoh2", SqliteToH2.class)
.put("loginsecurity", LoginSecurityConverter.class) .put("loginsecurity", LoginSecurityConverter.class)
.build(); .build();
} }
@@ -1,13 +1,12 @@
package fr.xephi.authme.command.executable.authme; package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.command.PlayerCommand; import fr.xephi.authme.command.PlayerCommand;
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.SecuritySettings; import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.TeleportUtils; import fr.xephi.authme.util.TeleportUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import fr.xephi.authme.AuthMe;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.List; import java.util.List;
@@ -3,6 +3,8 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.command.ExecutableCommand;
import fr.xephi.authme.service.BukkitService; import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -17,6 +19,8 @@ public class VersionCommand implements ExecutableCommand {
@Inject @Inject
private BukkitService bukkitService; private BukkitService bukkitService;
@Inject
private Settings settings;
@Override @Override
public void executeCommand(CommandSender sender, List<String> arguments) { public void executeCommand(CommandSender sender, List<String> arguments) {
@@ -24,6 +28,7 @@ public class VersionCommand implements ExecutableCommand {
sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName() + " ABOUT ]=========="); sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName() + " ABOUT ]==========");
sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName()
+ " v" + AuthMe.getPluginVersion() + ChatColor.GRAY + " (build: " + AuthMe.getPluginBuildNumber() + ")"); + " v" + AuthMe.getPluginVersion() + ChatColor.GRAY + " (build: " + AuthMe.getPluginBuildNumber() + ")");
sender.sendMessage(ChatColor.GOLD + "Database Implementation: " + ChatColor.WHITE + settings.getProperty(DatabaseSettings.BACKEND).toString());
sender.sendMessage(ChatColor.GOLD + "Authors:"); sender.sendMessage(ChatColor.GOLD + "Authors:");
Collection<Player> onlinePlayers = bukkitService.getOnlinePlayers(); Collection<Player> onlinePlayers = bukkitService.getOnlinePlayers();
printDeveloper(sender, "Gabriele C.", "sgdc3", "Project manager, Contributor", onlinePlayers); printDeveloper(sender, "Gabriele C.", "sgdc3", "Project manager, Contributor", onlinePlayers);
@@ -4,7 +4,7 @@ package fr.xephi.authme.datasource;
* DataSource type. * DataSource type.
*/ */
public enum DataSourceType { public enum DataSourceType {
// H2, H2,
MYSQL, MYSQL,
+419 -405
View File
@@ -1,408 +1,422 @@
//package fr.xephi.authme.datasource; package fr.xephi.authme.datasource;
//
//import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
//import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
//import fr.xephi.authme.data.auth.PlayerAuth; import fr.xephi.authme.data.auth.PlayerAuth;
//import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler; import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler;
//import fr.xephi.authme.output.ConsoleLoggerFactory; import fr.xephi.authme.output.ConsoleLoggerFactory;
//import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
//import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.DatabaseSettings;
//
//import java.io.File; import java.io.File;
//import java.sql.Connection; import java.sql.Connection;
//import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
//import java.sql.DriverManager; import java.sql.DriverManager;
//import java.sql.PreparedStatement; import java.sql.PreparedStatement;
//import java.sql.ResultSet; import java.sql.ResultSet;
//import java.sql.SQLException; import java.sql.SQLException;
//import java.sql.Statement; import java.sql.Statement;
//import java.util.ArrayList; import java.util.ArrayList;
//import java.util.Collection; import java.util.Collection;
//import java.util.HashSet; import java.util.HashSet;
//import java.util.List; import java.util.List;
//import java.util.Locale; import java.util.Locale;
//import java.util.Set; import java.util.Set;
//
//import static fr.xephi.authme.datasource.SqlDataSourceUtils.getNullableLong; import static fr.xephi.authme.datasource.SqlDataSourceUtils.getNullableLong;
//import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException; import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException;
//
///** /**
// * H2 data source. * H2 data source.
// */ */
//@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore @SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
//public class H2 extends AbstractSqlDataSource { public class H2 extends AbstractSqlDataSource {
//
// private final ConsoleLogger logger = ConsoleLoggerFactory.get(H2.class); private final ConsoleLogger logger = ConsoleLoggerFactory.get(H2.class);
// private final Settings settings; private final Settings settings;
// private final File dataFolder; private final File dataFolder;
// private final String database; private final String database;
// private final String tableName; private final String tableName;
// private final Columns col; private final Columns col;
// private Connection con; private Connection con;
//
// /** /**
// * Constructor for H2. * Constructor for H2.
// * *
// * @param settings The settings instance * @param settings The settings instance
// * @param dataFolder The data folder * @param dataFolder The data folder
// * @throws SQLException when initialization of a SQL datasource failed * @throws SQLException when initialization of a SQL datasource failed
// */ */
// public H2(Settings settings, File dataFolder) throws SQLException { public H2(Settings settings, File dataFolder) throws SQLException {
// this.settings = settings; this.settings = settings;
// this.dataFolder = dataFolder; this.dataFolder = dataFolder;
// this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
// this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
// this.col = new Columns(settings); this.col = new Columns(settings);
//
// try { try {
// this.connect(); this.connect();
// this.setup(); this.setup();
// } catch (Exception ex) { } catch (Exception ex) {
// logger.logException("Error during H2 initialization:", ex); logger.logException("Error during H2 initialization:", ex);
// throw ex; throw ex;
// } }
// } }
//
// @VisibleForTesting @VisibleForTesting
// H2(Settings settings, File dataFolder, Connection connection) { H2(Settings settings, File dataFolder, Connection connection) {
// this.settings = settings; this.settings = settings;
// this.dataFolder = dataFolder; this.dataFolder = dataFolder;
// this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
// this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
// this.col = new Columns(settings); this.col = new Columns(settings);
// this.con = connection; this.con = connection;
// this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings); this.columnsHandler = AuthMeColumnsHandler.createForH2(con, settings);
// } }
//
// /** /**
// * Initializes the connection to the H2 database. * Initializes the connection to the H2 database.
// * *
// * @throws SQLException when an SQL error occurs while connecting * @throws SQLException when an SQL error occurs while connecting
// */ */
// protected void connect() throws SQLException { protected void connect() throws SQLException {
// try { try {
// Class.forName("org.h2.Driver"); Class.forName("org.h2.Driver");
// } catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// throw new IllegalStateException("Failed to load H2 JDBC class", e); throw new IllegalStateException("Failed to load H2 JDBC class", e);
// } }
//
// logger.debug("H2 driver loaded"); logger.debug("H2 driver loaded");
// this.con = DriverManager.getConnection(this.getJdbcUrl(this.dataFolder.getAbsolutePath(), "", this.database)); this.con = DriverManager.getConnection(this.getJdbcUrl(this.dataFolder.getAbsolutePath(), "", this.database));
// this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings); this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings);
// } }
//
// /** /**
// * Creates the table if necessary, or adds any missing columns to the table. * Creates the table if necessary, or adds any missing columns to the table.
// * *
// * @throws SQLException when an SQL error occurs while initializing the database * @throws SQLException when an SQL error occurs while initializing the database
// */ */
// @VisibleForTesting @VisibleForTesting
// @SuppressWarnings("checkstyle:CyclomaticComplexity") @SuppressWarnings("checkstyle:CyclomaticComplexity")
// protected void setup() throws SQLException { protected void setup() throws SQLException {
// try (Statement st = con.createStatement()) { try (Statement st = con.createStatement()) {
// // Note: cannot add unique fields later on in SQLite, so we add it on initialization // Note: cannot add unique fields later on in SQLite, so we add it on initialization
// st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " (" st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " ("
// + col.ID + " INTEGER AUTO_INCREMENT, " + col.ID + " INTEGER AUTO_INCREMENT, "
// + col.NAME + " VARCHAR(255) NOT NULL UNIQUE, " + col.NAME + " VARCHAR(255) NOT NULL UNIQUE, "
// + "CONSTRAINT table_const_prim PRIMARY KEY (" + col.ID + "));"); + "CONSTRAINT table_const_prim PRIMARY KEY (" + col.ID + "));");
//
// DatabaseMetaData md = con.getMetaData(); DatabaseMetaData md = con.getMetaData();
//
// if (isColumnMissing(md, col.REAL_NAME)) { if (isColumnMissing(md, col.REAL_NAME)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS "
// + col.REAL_NAME + " VARCHAR(255) NOT NULL DEFAULT 'Player';"); + col.REAL_NAME + " VARCHAR(255) NOT NULL DEFAULT 'Player';");
// } }
//
// if (isColumnMissing(md, col.PASSWORD)) { if (isColumnMissing(md, col.PASSWORD)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.PASSWORD + " VARCHAR(255) NOT NULL DEFAULT '';"); + " ADD COLUMN IF NOT EXISTS " + col.PASSWORD + " VARCHAR(255) NOT NULL DEFAULT '';");
// } }
//
// if (!col.SALT.isEmpty() && isColumnMissing(md, col.SALT)) { if (!col.SALT.isEmpty() && isColumnMissing(md, col.SALT)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.SALT + " VARCHAR(255);"); st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS " + col.SALT + " VARCHAR(255);");
// } }
//
// if (isColumnMissing(md, col.LAST_IP)) { if (isColumnMissing(md, col.LAST_IP)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.LAST_IP + " VARCHAR(40);"); + " ADD COLUMN IF NOT EXISTS " + col.LAST_IP + " VARCHAR(40);");
// } }
//
// if (isColumnMissing(md, col.LAST_LOGIN)) { if (isColumnMissing(md, col.LAST_LOGIN)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.LAST_LOGIN + " TIMESTAMP;"); + " ADD COLUMN IF NOT EXISTS " + col.LAST_LOGIN + " BIGINT;");
// } }
//
// if (isColumnMissing(md, col.REGISTRATION_IP)) { if (isColumnMissing(md, col.REGISTRATION_IP)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.REGISTRATION_IP + " VARCHAR(40);"); + " ADD COLUMN IF NOT EXISTS " + col.REGISTRATION_IP + " VARCHAR(40);");
// } }
//
// if (isColumnMissing(md, col.REGISTRATION_DATE)) { if (isColumnMissing(md, col.REGISTRATION_DATE)) {
// addRegistrationDateColumn(st); addRegistrationDateColumn(st);
// } }
//
// if (isColumnMissing(md, col.LASTLOC_X)) { if (isColumnMissing(md, col.LASTLOC_X)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_X st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS " + col.LASTLOC_X
// + " DOUBLE NOT NULL DEFAULT '0.0';"); + " DOUBLE NOT NULL DEFAULT '0.0';");
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_Y st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS " + col.LASTLOC_Y
// + " DOUBLE NOT NULL DEFAULT '0.0';"); + " DOUBLE NOT NULL DEFAULT '0.0';");
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_Z st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS " + col.LASTLOC_Z
// + " DOUBLE NOT NULL DEFAULT '0.0';"); + " DOUBLE NOT NULL DEFAULT '0.0';");
// } }
//
// if (isColumnMissing(md, col.LASTLOC_WORLD)) { if (isColumnMissing(md, col.LASTLOC_WORLD)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.LASTLOC_WORLD + " VARCHAR(255) NOT NULL DEFAULT 'world';"); + " ADD COLUMN IF NOT EXISTS " + col.LASTLOC_WORLD + " VARCHAR(255) NOT NULL DEFAULT 'world';");
// } }
//
// if (isColumnMissing(md, col.LASTLOC_YAW)) { if (isColumnMissing(md, col.LASTLOC_YAW)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS "
// + col.LASTLOC_YAW + " FLOAT;"); + col.LASTLOC_YAW + " FLOAT;");
// } }
//
// if (isColumnMissing(md, col.LASTLOC_PITCH)) { if (isColumnMissing(md, col.LASTLOC_PITCH)) {
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN IF NOT EXISTS "
// + col.LASTLOC_PITCH + " FLOAT;"); + col.LASTLOC_PITCH + " FLOAT;");
// } }
//
// if (isColumnMissing(md, col.EMAIL)) { if (isColumnMissing(md, col.EMAIL)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.EMAIL + " VARCHAR(255);"); + " ADD COLUMN IF NOT EXISTS " + col.EMAIL + " VARCHAR_IGNORECASE(255);");
// } }
//
// if (isColumnMissing(md, col.IS_LOGGED)) { if (isColumnMissing(md, col.IS_LOGGED)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.IS_LOGGED + " INT NOT NULL DEFAULT '0';"); + " ADD COLUMN IF NOT EXISTS " + col.IS_LOGGED + " INT NOT NULL DEFAULT '0';");
// } }
//
// if (isColumnMissing(md, col.HAS_SESSION)) { if (isColumnMissing(md, col.HAS_SESSION)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.HAS_SESSION + " INT NOT NULL DEFAULT '0';"); + " ADD COLUMN IF NOT EXISTS " + col.HAS_SESSION + " INT NOT NULL DEFAULT '0';");
// } }
//
// if (isColumnMissing(md, col.TOTP_KEY)) { if (isColumnMissing(md, col.TOTP_KEY)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.TOTP_KEY + " VARCHAR(32);"); + " ADD COLUMN IF NOT EXISTS " + col.TOTP_KEY + " VARCHAR(32);");
// } }
//
// if (!col.PLAYER_UUID.isEmpty() && isColumnMissing(md, col.PLAYER_UUID)) { if (!col.PLAYER_UUID.isEmpty() && isColumnMissing(md, col.PLAYER_UUID)) {
// st.executeUpdate("ALTER TABLE " + tableName st.executeUpdate("ALTER TABLE " + tableName
// + " ADD COLUMN " + col.PLAYER_UUID + " VARCHAR(36)"); + " ADD COLUMN IF NOT EXISTS " + col.PLAYER_UUID + " VARCHAR(36)");
// } }
// } }
// logger.info("H2 Setup finished"); logger.info("H2 Setup finished");
// } }
//
// /**
// private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException { * Checks if a column is missing in the specified table.
// try (ResultSet rs = metaData.getColumns(null, null, tableName, columnName)) { * @param columnName the name of the column to look for
* @return true if the column is missing, false if it exists
* @throws SQLException if an error occurs while executing SQL or accessing the result set
* @deprecated Not work in H2, it always returns true
*/
@Deprecated
private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException {
String query = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = ? AND COLUMN_NAME = ?";
// try (PreparedStatement preparedStatement = con.prepareStatement(query)) {
// preparedStatement.setString(1, tableName);
// preparedStatement.setString(2, columnName.toUpperCase());
// try (ResultSet rs = preparedStatement.executeQuery()) {
// return !rs.next(); // return !rs.next();
// } // }
// } // }
// return true;
// @Override }
// public void reload() {
// close(con);
// try { @Override
// this.connect(); public void reload() {
// this.setup(); close(con);
// } catch (SQLException ex) { try {
// logger.logException("Error while reloading H2:", ex); 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)) { @Override
// pst.setString(1, user); public PlayerAuth getAuth(String user) {
// try (ResultSet rs = pst.executeQuery()) { String sql = "SELECT * FROM " + tableName + " WHERE LOWER(" + col.NAME + ")=LOWER(?);";
// if (rs.next()) { try (PreparedStatement pst = con.prepareStatement(sql)) {
// return buildAuthFromResultSet(rs); pst.setString(1, user);
// } try (ResultSet rs = pst.executeQuery()) {
// } if (rs.next()) {
// } catch (SQLException ex) { return buildAuthFromResultSet(rs);
// logSqlException(ex); }
// } }
// return null; } catch (SQLException ex) {
// } logSqlException(ex);
// }
// @Override return null;
// public Set<String> getRecordsToPurge(long until) { }
// Set<String> list = new HashSet<>();
// String select = "SELECT " + col.NAME + " FROM " + tableName + " WHERE MAX(" @Override
// + " COALESCE(" + col.LAST_LOGIN + ", 0)," public Set<String> getRecordsToPurge(long until) {
// + " COALESCE(" + col.REGISTRATION_DATE + ", 0)" Set<String> list = new HashSet<>();
// + ") < ?;"; String select = "SELECT " + col.NAME + " FROM " + tableName + " WHERE MAX("
// try (PreparedStatement selectPst = con.prepareStatement(select)) { + " COALESCE(" + col.LAST_LOGIN + ", 0),"
// selectPst.setLong(1, until); + " COALESCE(" + col.REGISTRATION_DATE + ", 0)"
// try (ResultSet rs = selectPst.executeQuery()) { + ") < ?;";
// while (rs.next()) { try (PreparedStatement selectPst = con.prepareStatement(select)) {
// list.add(rs.getString(col.NAME)); selectPst.setLong(1, until);
// } try (ResultSet rs = selectPst.executeQuery()) {
// } while (rs.next()) {
// } catch (SQLException ex) { list.add(rs.getString(col.NAME));
// logSqlException(ex); }
// } }
// } catch (SQLException ex) {
// return list; logSqlException(ex);
// } }
//
// @Override return list;
// public void purgeRecords(Collection<String> toPurge) { }
// String delete = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
// try (PreparedStatement deletePst = con.prepareStatement(delete)) { @Override
// for (String name : toPurge) { public void purgeRecords(Collection<String> toPurge) {
// deletePst.setString(1, name.toLowerCase(Locale.ROOT)); String delete = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
// deletePst.executeUpdate(); try (PreparedStatement deletePst = con.prepareStatement(delete)) {
// } for (String name : toPurge) {
// } catch (SQLException ex) { deletePst.setString(1, name.toLowerCase(Locale.ROOT));
// logSqlException(ex); 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)) { @Override
// pst.setString(1, user.toLowerCase(Locale.ROOT)); public boolean removeAuth(String user) {
// pst.executeUpdate(); String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
// return true; try (PreparedStatement pst = con.prepareStatement(sql)) {
// } catch (SQLException ex) { pst.setString(1, user.toLowerCase(Locale.ROOT));
// logSqlException(ex); pst.executeUpdate();
// } return true;
// return false; } catch (SQLException ex) {
// } logSqlException(ex);
// }
// @Override return false;
// public void closeConnection() { }
// try {
// if (con != null && !con.isClosed()) { @Override
// con.close(); public void closeConnection() {
// } try {
// } catch (SQLException ex) { if (con != null && !con.isClosed()) {
// logSqlException(ex); con.close();
// } }
// } } catch (SQLException ex) {
// logSqlException(ex);
// @Override }
// public DataSourceType getType() { }
// return DataSourceType.H2;
// } @Override
// public DataSourceType getType() {
// @Override return DataSourceType.H2;
// public List<PlayerAuth> getAllAuths() { }
// List<PlayerAuth> auths = new ArrayList<>();
// String sql = "SELECT * FROM " + tableName + ";"; @Override
// try (PreparedStatement pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery()) { public List<PlayerAuth> getAllAuths() {
// while (rs.next()) { List<PlayerAuth> auths = new ArrayList<>();
// PlayerAuth auth = buildAuthFromResultSet(rs); String sql = "SELECT * FROM " + tableName + ";";
// auths.add(auth); try (PreparedStatement pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery()) {
// } while (rs.next()) {
// } catch (SQLException ex) { PlayerAuth auth = buildAuthFromResultSet(rs);
// logSqlException(ex); auths.add(auth);
// } }
// return auths; } catch (SQLException ex) {
// } logSqlException(ex);
// }
// @Override return auths;
// public List<String> getLoggedPlayersWithEmptyMail() { }
// List<String> players = new ArrayList<>();
// String sql = "SELECT " + col.REAL_NAME + " FROM " + tableName + " WHERE " + col.IS_LOGGED + " = 1" @Override
// + " AND (" + col.EMAIL + " = 'your@email.com' OR " + col.EMAIL + " IS NULL);"; public List<String> getLoggedPlayersWithEmptyMail() {
// try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) { List<String> players = new ArrayList<>();
// while (rs.next()) { String sql = "SELECT " + col.REAL_NAME + " FROM " + tableName + " WHERE " + col.IS_LOGGED + " = 1"
// players.add(rs.getString(1)); + " AND (" + col.EMAIL + " = 'your@email.com' OR " + col.EMAIL + " IS NULL);";
// } try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) {
// } catch (SQLException ex) { while (rs.next()) {
// logSqlException(ex); players.add(rs.getString(1));
// } }
// return players; } catch (SQLException ex) {
// } logSqlException(ex);
// }
// @Override return players;
// public List<PlayerAuth> getRecentlyLoggedInPlayers() { }
// List<PlayerAuth> players = new ArrayList<>();
// String sql = "SELECT * FROM " + tableName + " ORDER BY " + col.LAST_LOGIN + " DESC LIMIT 10;"; @Override
// try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) { public List<PlayerAuth> getRecentlyLoggedInPlayers() {
// while (rs.next()) { List<PlayerAuth> players = new ArrayList<>();
// players.add(buildAuthFromResultSet(rs)); String sql = "SELECT * FROM " + tableName + " ORDER BY " + col.LAST_LOGIN + " DESC LIMIT 10;";
// } try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) {
// } catch (SQLException e) { while (rs.next()) {
// logSqlException(e); players.add(buildAuthFromResultSet(rs));
// } }
// return players; } 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)) { @Override
// pst.setString(1, totpKey); public boolean setTotpKey(String user, String totpKey) {
// pst.setString(2, user.toLowerCase(Locale.ROOT)); String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
// pst.executeUpdate(); try (PreparedStatement pst = con.prepareStatement(sql)) {
// return true; pst.setString(1, totpKey);
// } catch (SQLException e) { pst.setString(2, user.toLowerCase(Locale.ROOT));
// logSqlException(e); pst.executeUpdate();
// } return true;
// return false; } catch (SQLException e) {
// } logSqlException(e);
// }
// private PlayerAuth buildAuthFromResultSet(ResultSet row) throws SQLException { return false;
// String salt = !col.SALT.isEmpty() ? row.getString(col.SALT) : null; }
//
// return PlayerAuth.builder() private PlayerAuth buildAuthFromResultSet(ResultSet row) throws SQLException {
// .name(row.getString(col.NAME)) String salt = !col.SALT.isEmpty() ? row.getString(col.SALT) : null;
// .email(row.getString(col.EMAIL))
// .realName(row.getString(col.REAL_NAME)) return PlayerAuth.builder()
// .password(row.getString(col.PASSWORD), salt) .name(row.getString(col.NAME))
// .totpKey(row.getString(col.TOTP_KEY)) .email(row.getString(col.EMAIL))
// .lastLogin(getNullableLong(row, col.LAST_LOGIN)) .realName(row.getString(col.REAL_NAME))
// .lastIp(row.getString(col.LAST_IP)) .password(row.getString(col.PASSWORD), salt)
// .registrationDate(row.getLong(col.REGISTRATION_DATE)) .totpKey(row.getString(col.TOTP_KEY))
// .registrationIp(row.getString(col.REGISTRATION_IP)) .lastLogin(getNullableLong(row, col.LAST_LOGIN))
// .locX(row.getDouble(col.LASTLOC_X)) .lastIp(row.getString(col.LAST_IP))
// .locY(row.getDouble(col.LASTLOC_Y)) .registrationDate(row.getLong(col.REGISTRATION_DATE))
// .locZ(row.getDouble(col.LASTLOC_Z)) .registrationIp(row.getString(col.REGISTRATION_IP))
// .locWorld(row.getString(col.LASTLOC_WORLD)) .locX(row.getDouble(col.LASTLOC_X))
// .locYaw(row.getFloat(col.LASTLOC_YAW)) .locY(row.getDouble(col.LASTLOC_Y))
// .locPitch(row.getFloat(col.LASTLOC_PITCH)) .locZ(row.getDouble(col.LASTLOC_Z))
// .build(); .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. /**
// * * Creates the column for registration date and sets all entries to the current timestamp.
// * @param st Statement object to the database * We do so in order to avoid issues with purging, where entries with 0 / NULL might get
// */ * purged immediately on startup otherwise.
// private void addRegistrationDateColumn(Statement st) throws SQLException { *
// st.executeUpdate("ALTER TABLE " + tableName * @param st Statement object to the database
// + " ADD COLUMN " + col.REGISTRATION_DATE + " TIMESTAMP NOT NULL DEFAULT '0';"); */
// private void addRegistrationDateColumn(Statement st) throws SQLException {
// // Use the timestamp from Java to avoid timezone issues in case JVM and database are out of sync int affect = st.executeUpdate("ALTER TABLE " + tableName
// long currentTimestamp = System.currentTimeMillis(); + " ADD COLUMN IF NOT EXISTS " + col.REGISTRATION_DATE + " BIGINT NOT NULL DEFAULT '0';");
// int updatedRows = st.executeUpdate(String.format("UPDATE %s SET %s = %d;", if (affect > 0) {
// tableName, col.REGISTRATION_DATE, currentTimestamp)); long currentTimestamp = System.currentTimeMillis();
// logger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, " int updatedRows = st.executeUpdate(String.format("UPDATE %s SET %s = %d;",
// + currentTimestamp + ", to all " + updatedRows + " rows"); 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";
// } @Override
// String getJdbcUrl(String dataPath, String ignored, String database) {
// private static void close(Connection con) { return "jdbc:h2:" + dataPath + File.separator + database;
// if (con != null) { }
// try {
// con.close(); private static void close(Connection con) {
// } catch (SQLException ex) { if (con != null) {
// logSqlException(ex); try {
// } con.close();
// } } catch (SQLException ex) {
// } logSqlException(ex);
//} }
// }
}
}
@@ -51,6 +51,26 @@ public final class AuthMeColumnsHandler {
return new AuthMeColumnsHandler(sqlColHandler); return new AuthMeColumnsHandler(sqlColHandler);
} }
/**
* Creates a column handler for H2.
*
* @param connection the connection to the database
* @param settings plugin settings
* @return created column handler
*/
public static AuthMeColumnsHandler createForH2(Connection connection, Settings settings) {
ColumnContext columnContext = new ColumnContext(settings, false);
String tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
String nameColumn = settings.getProperty(DatabaseSettings.MYSQL_COL_NAME);
SqlColumnsHandler<ColumnContext, String> sqlColHandler = new SqlColumnsHandler<>(
forSingleConnection(connection, tableName, nameColumn, columnContext)
.setPredicateSqlGenerator(new PredicateSqlGenerator<>(columnContext, false))
);
return new AuthMeColumnsHandler(sqlColHandler);
}
/** /**
* Creates a column handler for MySQL. * Creates a column handler for MySQL.
* *
@@ -0,0 +1,33 @@
package fr.xephi.authme.datasource.converter;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.datasource.SQLite;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.settings.Settings;
import javax.inject.Inject;
import java.io.File;
import java.sql.SQLException;
/**
* Converts SQLite to H2
*
*/
public class SqliteToH2 extends AbstractDataSourceConverter<SQLite>{
private final Settings settings;
private final File dataFolder;
@Inject
SqliteToH2(Settings settings, DataSource dataSource, @DataFolder File dataFolder) {
super(dataSource, DataSourceType.H2);
this.settings = settings;
this.dataFolder = dataFolder;
}
@Override
protected SQLite getSource() throws SQLException {
return new SQLite(settings, dataFolder);
}
}
@@ -5,6 +5,7 @@ import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.datasource.CacheDataSource; import fr.xephi.authme.datasource.CacheDataSource;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.DataSourceType; import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.datasource.H2;
import fr.xephi.authme.datasource.MariaDB; import fr.xephi.authme.datasource.MariaDB;
import fr.xephi.authme.datasource.MySQL; import fr.xephi.authme.datasource.MySQL;
import fr.xephi.authme.datasource.PostgreSqlDataSource; import fr.xephi.authme.datasource.PostgreSqlDataSource;
@@ -76,9 +77,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: case H2:
// dataSource = new H2(settings, dataFolder); dataSource = new H2(settings, dataFolder);
// break; break;
default: default:
throw new UnsupportedOperationException("Unknown data source type '" + dataSourceType + "'"); throw new UnsupportedOperationException("Unknown data source type '" + dataSourceType + "'");
} }
@@ -0,0 +1,20 @@
package fr.xephi.authme.listener;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
//This fix is only for Minecraft 1.13-
public class AdvancedShulkerFixListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onDispenserActivate(BlockDispenseEvent event) {
Block block = event.getBlock();
if (block.getY() <= 0 || block.getY() >= block.getWorld().getMaxHeight() - 1) {
event.setCancelled(true);
}
}
}
@@ -32,10 +32,10 @@ import org.bukkit.inventory.meta.ItemMeta;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.File; import java.io.File;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
@@ -70,12 +70,15 @@ public class GuiCaptchaHandler implements Listener {
private int timesLeft = 3; private int timesLeft = 3;
//Use ConcurrentHashMap to store player and their close reason //Use ConcurrentHashMap to store player and their close reason
/* We used many async tasks so there is concurrent**/ /* We used many async tasks so there is concurrent**/
public static HashMap<Player, String> closeReasonMap = new HashMap<>(); public static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
//define randomStringSet //define randomStringSet
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+"; String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
String randomString = ""; String randomString = "";
Random randomItemSet = new Random(); Random randomItemSet = new Random();
Random howManyRandom = new Random(); Random howManyRandom = new Random();
private Material captchaMaterial = getRandomMaterial();
private boolean isPacketListenersActive = false; private boolean isPacketListenersActive = false;
public GuiCaptchaHandler() { public GuiCaptchaHandler() {
@@ -106,11 +109,11 @@ public class GuiCaptchaHandler implements Listener {
if (event.getWhoClicked() instanceof Player) { if (event.getWhoClicked() instanceof Player) {
Player player = (Player) event.getWhoClicked(); Player player = (Player) event.getWhoClicked();
ItemStack currentItem = event.getCurrentItem(); ItemStack currentItem = event.getCurrentItem();
if (!authmeApi.isRegistered(player.getName()) && !closeReasonMap.containsKey(player)) { if (!authmeApi.isRegistered(player.getName())) {
if (isBedrockPlayer(player.getUniqueId())) { if (isBedrockPlayer(player.getUniqueId())) {
return; return;
} }
if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)) { if (currentItem != null && currentItem.getType().equals(captchaMaterial)) {
event.setCancelled(true); event.setCancelled(true);
if (!closeReasonMap.containsKey(player)) { if (!closeReasonMap.containsKey(player)) {
closeReasonMap.put(player, "verified"); closeReasonMap.put(player, "verified");
@@ -162,13 +165,12 @@ public class GuiCaptchaHandler implements Listener {
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK); messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
return; return;
} }
bukkitService.runTaskAsynchronously(() -> {
bukkitService.runTask(() -> { bukkitService.runTask(() -> {
randomString = sb.toString(); randomString = sb.toString();
Random random_blockpos = new Random(); Random random_blockpos = new Random();
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26)); AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26));
Inventory menu = Bukkit.createInventory(playerunreg, 27, messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_WINDOW_NAME, randomString)); Inventory menu = Bukkit.createInventory(playerunreg, 27, messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_WINDOW_NAME, randomString));
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK); ItemStack item = new ItemStack(captchaMaterial);
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
try { try {
if (meta != null) { if (meta != null) {
@@ -233,17 +235,14 @@ public class GuiCaptchaHandler implements Listener {
timeOut = settings.getProperty(RestrictionSettings.TIMEOUT); timeOut = settings.getProperty(RestrictionSettings.TIMEOUT);
} }
long finalTimeOut = timeOut; long finalTimeOut = timeOut;
bukkitService.runTask(() -> {
bukkitService.runTaskLater(() -> { bukkitService.runTaskLater(() -> {
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) { if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT)); playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT));
timesLeft = 3; // Reset the attempt counter timesLeft = 3; // Reset the attempt counter
} }
}, finalTimeOut * 20L); }, finalTimeOut * 20L);
});
} }
}); });
});
} }
} }
@@ -316,6 +315,12 @@ public class GuiCaptchaHandler implements Listener {
closeReasonMap.remove(player); closeReasonMap.remove(player);
} }
} }
private Material getRandomMaterial() {
Material[] allMaterials = Material.values();
Random random = new Random();
return allMaterials[random.nextInt(allMaterials.length)];
}
} }
@@ -18,6 +18,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import javax.inject.Inject; import javax.inject.Inject;
import java.lang.reflect.Method;
public class LoginLocationFixListener implements Listener { public class LoginLocationFixListener implements Listener {
@@ -33,9 +34,8 @@ public class LoginLocationFixListener implements Listener {
} }
private static Material materialPortal = Material.matchMaterial("PORTAL"); 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 static boolean isAvailable; // false: unchecked/method not available true: method is available
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}; BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
static { static {
@@ -45,13 +45,29 @@ public class LoginLocationFixListener implements Listener {
materialPortal = Material.matchMaterial("NETHER_PORTAL"); materialPortal = Material.matchMaterial("NETHER_PORTAL");
} }
} }
try {
Method getMinHeightMethod = World.class.getMethod("getMinHeight");
isAvailable = true;
} catch (NoSuchMethodException e) {
isAvailable = false;
} }
}
private int getMinHeight(World world) {
//This keeps compatibility of 1.16.x and lower
if (isAvailable) {
return world.getMinHeight();
} else {
return 0;
}
}
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5); Location JoinLocation = player.getLocation();
if (isFixPortalStuck) { if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) { if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) {
return; return;
} }
@@ -59,7 +75,7 @@ public class LoginLocationFixListener implements Listener {
boolean solved = false; boolean solved = false;
for (BlockFace face : faces) { for (BlockFace face : faces) {
if (JoinBlock.getRelative(face).getType().equals(Material.AIR) && JoinBlock.getRelative(face).getRelative(BlockFace.UP).getType().equals(Material.AIR)) { if (JoinBlock.getRelative(face).getType().equals(Material.AIR) && JoinBlock.getRelative(face).getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
if (isSmartAsyncTeleport) { if (settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player, JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5)); TeleportUtils.teleport(player, JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
} else { } else {
player.teleport(JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5)); player.teleport(JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
@@ -73,11 +89,12 @@ public class LoginLocationFixListener implements Listener {
JoinBlock.breakNaturally(); JoinBlock.breakNaturally();
} }
messages.send(player, MessageKey.LOCATION_FIX_PORTAL); messages.send(player, MessageKey.LOCATION_FIX_PORTAL);
} else if (isFixGroundStuck) { }
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND)) {
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType(); Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
World world = player.getWorld(); World world = player.getWorld();
int MaxHeight = world.getMaxHeight(); int MaxHeight = world.getMaxHeight();
int MinHeight = world.getMinHeight(); int MinHeight = getMinHeight(world);
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) { if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
return; return;
} }
@@ -90,7 +107,7 @@ public class LoginLocationFixListener implements Listener {
if (JoinBlock.getRelative(BlockFace.DOWN).getType().equals(Material.LAVA)) { if (JoinBlock.getRelative(BlockFace.DOWN).getType().equals(Material.LAVA)) {
JoinBlock.getRelative(BlockFace.DOWN).setType(Material.DIRT); JoinBlock.getRelative(BlockFace.DOWN).setType(Material.DIRT);
} }
if (isSmartAsyncTeleport) { if (settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 0.1, 0.5)); TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 0.1, 0.5));
} else { } else {
player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5)); player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5));
@@ -99,7 +116,7 @@ public class LoginLocationFixListener implements Listener {
break; break;
} }
if (i == MaxHeight) { if (i == MaxHeight) {
if (isSmartAsyncTeleport) { if (settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 1.1, 0.5)); TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 1.1, 0.5));
} else { } else {
player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5)); player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5));
@@ -108,5 +125,6 @@ public class LoginLocationFixListener implements Listener {
} }
} }
} }
} }
} }
@@ -1,6 +1,5 @@
package fr.xephi.authme.listener; package fr.xephi.authme.listener;
import fr.xephi.authme.AuthMe;
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;
@@ -22,7 +21,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
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.settings.properties.SecuritySettings;
import fr.xephi.authme.util.TeleportUtils; import fr.xephi.authme.util.TeleportUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
@@ -32,7 +30,6 @@ 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.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;
@@ -54,17 +51,15 @@ 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.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import static org.bukkit.Bukkit.getServer;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Locale; import java.util.Locale;
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;
import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT; import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT;
import static org.bukkit.Bukkit.getServer;
/** /**
* Listener class for player events. * Listener class for player events.
@@ -29,12 +29,8 @@ public class PlayerListenerHigherThan18 implements Listener {
@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") && settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
return;
}
event.setCancelled(true); event.setCancelled(true);
if (settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
Bukkit.dispatchCommand(event.getPlayer(), "help"); Bukkit.dispatchCommand(event.getPlayer(), "help");
} }
} }
@@ -34,7 +34,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -94,6 +94,9 @@ public class BackupService {
case SQLITE: case SQLITE:
String dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); String dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
return performFileBackup(dbName + ".db"); return performFileBackup(dbName + ".db");
case H2:
String h2dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
return performFileBackup(h2dbName + ".mv.db");
default: default:
logger.warning("Unknown data source type '" + dataSourceType + "' for backup"); logger.warning("Unknown data source type '" + dataSourceType + "' for backup");
} }
@@ -1,9 +1,6 @@
package fr.xephi.authme.service; package fr.xephi.authme.service;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
import com.maxmind.db.GeoIp2Provider; import com.maxmind.db.GeoIp2Provider;
import com.maxmind.db.Reader; import com.maxmind.db.Reader;
import com.maxmind.db.Reader.FileMode; import com.maxmind.db.Reader.FileMode;
@@ -13,32 +10,16 @@ import com.maxmind.db.model.CountryResponse;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.initialization.DataFolder; import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.ConsoleLoggerFactory; import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.ProtectionSettings;
import fr.xephi.authme.util.FileUtils;
import fr.xephi.authme.util.InternetProtocolUtils; import fr.xephi.authme.util.InternetProtocolUtils;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.FileTime;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Base64;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.zip.GZIPInputStream;
public class GeoIpService { public class GeoIpService {
@@ -22,19 +22,16 @@ import fr.xephi.authme.util.Utils;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.io.DataInputStream;
import java.net.HttpURLConnection;
import java.net.ProtocolException;
import java.net.URL;
import java.util.Arrays;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.DataInputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URL;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeoutException;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static fr.xephi.authme.util.StringUtils.isInsideString; import static fr.xephi.authme.util.StringUtils.isInsideString;
@@ -10,7 +10,7 @@ import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class DatabaseSettings implements SettingsHolder { public final class DatabaseSettings implements SettingsHolder {
@Comment({"What type of database do you want to use?", @Comment({"What type of database do you want to use?",
"Valid values: SQLITE, MARIADB, MYSQL, POSTGRESQL"}) "Valid values: H2, SQLITE, MARIADB, MYSQL, POSTGRESQL"})
public static final Property<DataSourceType> BACKEND = public static final Property<DataSourceType> BACKEND =
newProperty(DataSourceType.class, "DataSource.backend", DataSourceType.SQLITE); newProperty(DataSourceType.class, "DataSource.backend", DataSourceType.SQLITE);
@@ -14,7 +14,7 @@ public final class PluginSettings implements SettingsHolder {
"If you are using TrMenu, don't enable this because TrMenu already implemented this." "If you are using TrMenu, don't enable this because TrMenu already implemented this."
}) })
public static final Property<Boolean> MENU_UNREGISTER_COMPATIBILITY = public static final Property<Boolean> MENU_UNREGISTER_COMPATIBILITY =
newProperty("3rdPartyFeature.compatibility.menuPlugins", true); newProperty("3rdPartyFeature.compatibility.menuPlugins", false);
@Comment({ @Comment({
"Do you want to enable the session feature?", "Do you want to enable the session feature?",
@@ -39,7 +39,7 @@ public final class PluginSettings implements SettingsHolder {
"https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md" "https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md"
}) })
public static final Property<String> MESSAGES_LANGUAGE = public static final Property<String> MESSAGES_LANGUAGE =
newProperty("settings.messagesLanguage", "zhcn"); newProperty("settings.messagesLanguage", "en");
@Comment({ @Comment({
"Enables switching a player to defined permission groups before they log in.", "Enables switching a player to defined permission groups before they log in.",
@@ -14,11 +14,11 @@ public final class ProtectionSettings implements SettingsHolder {
@Comment("Enable some servers protection (country based login, antibot)") @Comment("Enable some servers protection (country based login, antibot)")
public static final Property<Boolean> ENABLE_PROTECTION = public static final Property<Boolean> ENABLE_PROTECTION =
newProperty("Protection.enableProtection", true); newProperty("Protection.enableProtection", false);
@Comment("Apply the protection also to registered usernames") @Comment("Apply the protection also to registered usernames")
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED = public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
newProperty("Protection.enableProtectionRegistered", true); newProperty("Protection.enableProtectionRegistered", false);
@Comment({ @Comment({
"Countries allowed to join the server and register. For country codes, see", "Countries allowed to join the server and register. For country codes, see",
@@ -26,7 +26,7 @@ public final class ProtectionSettings implements SettingsHolder {
"Use \"LOCALHOST\" for local addresses.", "Use \"LOCALHOST\" for local addresses.",
"PLEASE USE QUOTES!"}) "PLEASE USE QUOTES!"})
public static final Property<List<String>> COUNTRIES_WHITELIST = public static final Property<List<String>> COUNTRIES_WHITELIST =
newListProperty("Protection.countries", "CN", "LOCALHOST"); newListProperty("Protection.countries", "LOCALHOST");
@Comment({ @Comment({
"Countries not allowed to join the server and register", "Countries not allowed to join the server and register",
@@ -4,8 +4,6 @@ import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder; import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property; import ch.jalu.configme.properties.Property;
import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@@ -28,52 +28,52 @@ public final class SecuritySettings implements SettingsHolder {
@Comment({"Should we let Bedrock players login automatically?", @Comment({"Should we let Bedrock players login automatically?",
"(Requires hookFloodgate to be true & floodgate loaded)"}) "(Requires hookFloodgate to be true & floodgate loaded)"})
public static final Property<Boolean> FORCE_LOGIN_BEDROCK = newProperty("3rdPartyFeature.features.bedrockAutoLogin", false); 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({"(MC1.13- only)",
"Should we fix the shulker crash bug with advanced method?"})
public static final Property<Boolean> ADVANCED_SHULKER_FIX =
newProperty("3rdPartyFeature.fixes.advancedShulkerFix", false);
@Comment({"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)") @Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.features.captcha.guiCaptcha", false); 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?", @Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
"(less than or equals 0 is disabled)"}) "(less than or equals 0 is disabled)"})
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.features.captcha.timeOut", 0); public static final Property<Integer> GUI_CAPTCHA_TIMEOUT =
newProperty("3rdPartyFeature.features.captcha.timeOut", 0);
@Comment({"Should we ignore floodgate players when sending GUI captcha?", @Comment({"Should we ignore floodgate players when sending GUI captcha?",
"(Requires floodgate and hookFloodgate: true)"}) "(Requires floodgate and hookFloodgate: true)"})
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.features.captcha.ignoreBedrock", false); 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?") @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); 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)") @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"); 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?") @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); 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?") @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); 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({"Using which API to get hash data?",
//"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");
//@Comment("Should we use the local cache sometimes instead of requesting API?")
//public static final Property<Boolean> USE_LOCAL_CACHE = newProperty("Plugin.hashing.useLocalCache",false);
//@Comment("DON'T TOUCH!!!")
//public static final Property<String> SHA_CHECK_CACHE = newProperty("Plugin.hashing.hashCached","");
@Comment("Copy AuthMe log output in a separate file as well?") @Comment("Copy AuthMe log output in a separate file as well?")
public static final Property<Boolean> USE_LOGGING = public static final Property<Boolean> USE_LOGGING =
@@ -100,10 +100,6 @@ public final class SecuritySettings implements SettingsHolder {
public static final Property<Boolean> SHOW_STARTUP_BANNER = public static final Property<Boolean> SHOW_STARTUP_BANNER =
newProperty("Plugin.banners.showBanners", true); 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);
@@ -28,7 +28,7 @@ public final class PlayerUtils {
* @return True if the player is an NPC, false otherwise * @return True if the player is an NPC, false otherwise
*/ */
public static boolean isNpc(Player player) { public static boolean isNpc(Player player) {
return player.hasMetadata("NPC"); return player.hasMetadata("NPC") || player.getAddress() == null;
} }
} }
Binary file not shown.
@@ -11,6 +11,7 @@ registration:
command_usage: '&c正确用法:“/reg <密码> <重复密码>”' command_usage: '&c正确用法:“/reg <密码> <重复密码>”'
reg_only: '&c只允许注册过的玩家进服!' reg_only: '&c只允许注册过的玩家进服!'
success: '&a*** 已成功注册 ***' success: '&a*** 已成功注册 ***'
kicked_admin_registered: '&a*** 管理员刚刚注册了您; 请重新登录 ***'
# Password errors on registration # Password errors on registration
password: password:
+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-b36 version: 5.6.0-FORK-b43
api-version: 1.13 api-version: 1.13
softdepend: softdepend:
- Vault - Vault