Compare commits
257 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ffdc4d2b6 | |||
| 44f9c75f41 | |||
| e0cc4e0790 | |||
| 1d9e1cb033 | |||
| e413760b32 | |||
| 72f0055c58 | |||
| 4260b9d1ec | |||
| 4eee83ca6f | |||
| 5cbbe5fc61 | |||
| a542a35eba | |||
| 00e34c21e1 | |||
| cf718a4cbd | |||
| 5b037221a7 | |||
| bee35c4ebf | |||
| 3c364edbe1 | |||
| 98fee693a4 | |||
| 2734c3e58e | |||
| 6d7c928197 | |||
| 0635e67e93 | |||
| b4df964d79 | |||
| 36e8f7691a | |||
| 94803c4ff1 | |||
| 4886e3464f | |||
| 352ab899d4 | |||
| 23306d1f5c | |||
| fc546ac87a | |||
| 764b2788ae | |||
| d1fc832d2d | |||
| c170c70639 | |||
| 8db8d0f6da | |||
| 6b5e0b82ba | |||
| 265ea66894 | |||
| b1b4bb0a79 | |||
| fa7ce8bfb4 | |||
| 78369644c7 | |||
| 22b8b6bf64 | |||
| fcec8e41a2 | |||
| ee24cabbed | |||
| eed1c5aedc | |||
| 1f88b3bc12 | |||
| 5cd8791fee | |||
| 787e04488b | |||
| 2accd9592c | |||
| 66bfbbbdb1 | |||
| cb195fd1ca | |||
| a1ef28095f | |||
| 77b40cc1e8 | |||
| 4c52484fd7 | |||
| 5b72708167 | |||
| b69e931c44 | |||
| 213b1c2702 | |||
| 0fef595229 | |||
| 791d1f1872 | |||
| ef92c776af | |||
| 66cf0143f6 | |||
| 3ff3b0d294 | |||
| b9ecb58760 | |||
| a8e55b4ae3 | |||
| 657e51f2cc | |||
| ff16f91311 | |||
| d05d4971b5 | |||
| 5f58e92666 | |||
| a31c2f45b1 | |||
| 06d9e71ae8 | |||
| 441e020192 | |||
| f153867d85 | |||
| eed5ce1b7b | |||
| 00b4bcb6a3 | |||
| e69ba501da | |||
| f2ccbf72a8 | |||
| c29aec210b | |||
| 78b5102692 | |||
| 9fd671db85 | |||
| beb99418d4 | |||
| 0f70de9a5a | |||
| 08ad55c742 | |||
| a70c1e0102 | |||
| efec997128 | |||
| 413c2a39d7 | |||
| 5a9b9ce619 | |||
| ee58da2b39 | |||
| 7475cd8ea4 | |||
| 8b8f6c0e2e | |||
| 69b170b754 | |||
| 702b6aae32 | |||
| 010874586a | |||
| fcc34c28aa | |||
| ecbc11cf0b | |||
| bfd3a8f439 | |||
| f8dd410d96 | |||
| 2459aec4b6 | |||
| d623337a15 | |||
| 73c3cea778 | |||
| 11a4cff10a | |||
| 628d5adcb5 | |||
| 8681cd0733 | |||
| bb2fdbfb40 | |||
| 4dedc30d94 | |||
| fa995eea53 | |||
| e819be918b | |||
| 1e3e625c1a | |||
| b747a4bdff | |||
| 03443104be | |||
| 819e55e235 | |||
| 80b06f3bc7 | |||
| d90e87896c | |||
| 72073b80f0 | |||
| 19866bc4a4 | |||
| cf4037614a | |||
| 5c22601c52 | |||
| 1bb3bb1fa7 | |||
| 11959ca794 | |||
| 9ba9af6369 | |||
| 584f2074fd | |||
| 2971a0a202 | |||
| 3cc8128faa | |||
| 1ef7ed4b3f | |||
| 59eabe38c6 | |||
| 1c090a5a65 | |||
| 82fade61d5 | |||
| fc5009bf0d | |||
| 9fe91fe22c | |||
| 37d327bcb6 | |||
| 217b411095 | |||
| 9239f3a90d | |||
| ae9d9ea159 | |||
| 12cfd243f6 | |||
| 059c00c2ad | |||
| 3dab24c142 | |||
| 4de55f9cf6 | |||
| 07d9bbbf7c | |||
| c182510a46 | |||
| aec1277ab3 | |||
| 32b694cbb0 | |||
| 932368f2d6 | |||
| 7a33fc8928 | |||
| d048db44ba | |||
| 76b92bacd9 | |||
| dadae42992 | |||
| 1e9058a5cb | |||
| b307911896 | |||
| 11a1547242 | |||
| 17ee5dc97b | |||
| ac89630f5d | |||
| 94028484cf | |||
| 1b1fd77470 | |||
| 7a7b148a7d | |||
| e6cee92ef1 | |||
| 31123081c7 | |||
| b5b435d398 | |||
| 395f8f825f | |||
| c71bd9f3a8 | |||
| 3e971c3dfd | |||
| 3f372d9228 | |||
| d385093403 | |||
| f978b285ae | |||
| 1eeaa442db | |||
| 14cc0abdc5 | |||
| d5ce692933 | |||
| 56a7b90c99 | |||
| 9352e7f32e | |||
| 0fc2f61a42 | |||
| 25249125b1 | |||
| 9d6d325fa6 | |||
| 0d408ede47 | |||
| 36bc761c19 | |||
| 9c3f0b0142 | |||
| e6be595c16 | |||
| dd4739a822 | |||
| 39254506bf | |||
| 227d93d756 | |||
| d223f316d6 | |||
| b6ec553dcb | |||
| cc6a9c38bd | |||
| 04ad3adbd1 | |||
| ef3804bf4e | |||
| b5d3408773 | |||
| 470f5ff28f | |||
| 888ee7235b | |||
| c97eda6672 | |||
| 81478f203c | |||
| ec51635d44 | |||
| aae15fba60 | |||
| 57fad7e113 | |||
| 1c25908a04 | |||
| 84a8137955 | |||
| 038d4c1850 | |||
| 0ffe2c2fc9 | |||
| 401933038d | |||
| 5cf88f308a | |||
| 29df796c48 | |||
| 79af85667e | |||
| 57237f6dfa | |||
| fc86e3ef78 | |||
| 846b7f67e5 | |||
| ffe3f5d24a | |||
| 2db1a15c72 | |||
| 95342ae054 | |||
| 6800356f10 | |||
| 95b5d88197 | |||
| 9f6f55d8e8 | |||
| d1ebcfeef0 | |||
| 5305bf0bfd | |||
| 78c5ab5d8a | |||
| 836c568fef | |||
| 7cbd1ebae7 | |||
| a35a277b32 | |||
| 971f0f7683 | |||
| d2718c1934 | |||
| 0cdd2b20d6 | |||
| 66b2bf8436 | |||
| cf01767ad3 | |||
| fdefdb88cc | |||
| 4bcc992b7f | |||
| 35aba2207b | |||
| ce2ee9e0fb | |||
| 9093ad2d9f | |||
| 08ed6504f2 | |||
| 9f70748b55 | |||
| 3f6a7ce48f | |||
| ed320196fe | |||
| 62f27f8231 | |||
| c3485903c5 | |||
| 5f3089b61b | |||
| e8f42ab669 | |||
| e3ff584bf4 | |||
| a9116a2f28 | |||
| ddd8c44396 | |||
| 6edcfa993e | |||
| e63764e2cf | |||
| 63540088c9 | |||
| 8e760e504e | |||
| bf3553df68 | |||
| 44e4937d16 | |||
| 280bb2bdcc | |||
| c0da109dea | |||
| b455d0a200 | |||
| 2f9d11e1d5 | |||
| ab85429b4c | |||
| 145dbd46f0 | |||
| 8e451b0642 | |||
| b12070a517 | |||
| 3950b3034c | |||
| 47ae657c80 | |||
| 87ef1ab8ed | |||
| a6bd4f59cb | |||
| ac610ad552 | |||
| d9204afdc9 | |||
| 69abbc308a | |||
| 06f2b0c49e | |||
| 47b0e6e744 | |||
| 4533f52016 | |||
| ae36036874 | |||
| 6f19a5442f | |||
| 3019e33945 | |||
| 7e49e26735 | |||
| b014da245d |
@@ -1,34 +0,0 @@
|
||||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
||||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
|
||||
|
||||
name: Maven Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'temurin'
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
- name: Publish to GitHub Packages Apache Maven
|
||||
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
+14
-10
@@ -10,15 +10,19 @@ jobs:
|
||||
Build:
|
||||
strategy:
|
||||
matrix:
|
||||
jdkversion: [11]
|
||||
jdkversion: [ 11 ]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: ${{ matrix.jdkversion }}
|
||||
cache: 'maven'
|
||||
- name: 使用Maven构建
|
||||
run: mvn -V -B clean package --file pom.xml
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: ${{ matrix.jdkversion }}
|
||||
cache: 'maven'
|
||||
- name: Build
|
||||
run: mvn -V -B clean package --file pom.xml
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3.1.2
|
||||
with:
|
||||
name: Download
|
||||
path: ./target/AuthMe-5.6.0-FORK-Spigot-Universal.jar
|
||||
|
||||
+3
-2
@@ -21,10 +21,11 @@ hs_err_pid*
|
||||
|
||||
# Ignore IDEA directory
|
||||
.idea/*
|
||||
.idea/
|
||||
|
||||
|
||||
# Include the project's code style settings file
|
||||
!.idea/codeStyleSettings.xml
|
||||
/target/class/
|
||||
|
||||
# File-based project format:
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
@@ -1,21 +1,33 @@
|
||||
# AuthMeReReloaded
|
||||
**"A Fork of Authme that contains many bug fixes!"**
|
||||
**请前往Releases下载最新版本**(**Download the latest version from Releases**)
|
||||
**"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)
|
||||

|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/github/languages/code-size/HaHaWTH/AuthMeReReloaded.svg" alt="Code size"/>
|
||||
<img src="https://img.shields.io/github/repo-size/HaHaWTH/AuthMeReReloaded.svg" alt="GitHub repo size"/>
|
||||
</p>
|
||||
|
||||
**Detailed Changes:**
|
||||
1. Improved mail sending logic & support more emails
|
||||
2. Shutdown mail sending(When server is closed, email you)
|
||||
3. Legacy bug fixes
|
||||
4. Anti Ghost Player(Doubled login bug)
|
||||
5. Use the best performance method by server brand
|
||||
6. Bedrock Compatibility(Floodgate needed)(based on UUID)
|
||||
7. Update checker
|
||||
8. Integrated GUI Captcha feature(Bedrock compatibility & ProtocolLib needed)(70% Asynchronous)
|
||||
9. Improved listeners
|
||||
10. Player login logic improvement to reduce lag
|
||||
11. Automatically purge bot data
|
||||
12. Folia
|
||||
compatibility [Here](https://github.com/HaHaWTH/AuthMeReReloaded/releases/download/b20/AuthMe-5.6.0-FORK-Folia.jar)
|
||||
13. Offhand Menu compatibility(Thats amazing)
|
||||
14. Automatically fix portal stuck issue
|
||||
15. Automatically login for Bedrock players(configurable)
|
||||
16. More......
|
||||
|
||||
**Download links:**
|
||||
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
|
||||
[Actions(Dev builds, use at your own risk!)](https://github.com/HaHaWTH/AuthMeReReloaded/actions/workflows/maven.yml)
|
||||
|
||||
|
||||
Changes to the original AuthMe(相较于原版AuthMe的变化):
|
||||
1.Memory improvement
|
||||
2.Fixed GeoIP database
|
||||
3.Hook floodgate
|
||||
4.Choose the best performance method by server brand
|
||||
5.Anti ghost player
|
||||
6.GUI captcha for unregistered players
|
||||
7.Block unsafe passwords by querying API
|
||||
8.Self hash check to prevent jar virus infection(abandoned)
|
||||
9.Updater
|
||||
|
||||
|
||||
**Known Folia issue**
|
||||
1.If the teleport distance too far away,the player may be frozen
|
||||
**Pull Requests and suggestions are welcome!**
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
<groupId>fr.xephi</groupId>
|
||||
<artifactId>authme</artifactId>
|
||||
<version>5.6.0-SNAPSHOT</version>
|
||||
<version>5.6.0-FORK</version>
|
||||
|
||||
<name>AuthMeReloaded</name>
|
||||
<description>The first authentication plugin for the Bukkit API!</description>
|
||||
<name>AuthMeReReloaded</name>
|
||||
<description>Fork of the first authentication plugin for the Bukkit API!</description>
|
||||
<inceptionYear>2013</inceptionYear>
|
||||
<url>https://github.com/AuthMe/AuthMeReloaded</url>
|
||||
|
||||
@@ -67,11 +67,11 @@
|
||||
<maven.minimumVersion>3.6.3</maven.minimumVersion>
|
||||
|
||||
<!-- Dependencies versions -->
|
||||
<spigot.version>1.19.2-R0.1-SNAPSHOT</spigot.version>
|
||||
<spigot.version>1.20.2-R0.1-SNAPSHOT</spigot.version>
|
||||
|
||||
<!-- Versioning properties -->
|
||||
<project.outputName>AuthMe</project.outputName>
|
||||
<project.buildNumber>CUSTOM</project.buildNumber>
|
||||
<project.buildNumber>28</project.buildNumber>
|
||||
<project.versionCode>${project.version}-b${project.buildNumber}</project.versionCode>
|
||||
<project.finalNameBase>${project.outputName}-${project.version}</project.finalNameBase>
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<finalName>${project.finalNameBase}-legacy</finalName>
|
||||
<finalName>${project.finalNameBase}-Spigot-Universal</finalName>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.google.common</pattern>
|
||||
@@ -531,6 +531,30 @@
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- Aliyun maven central repo -->
|
||||
<repository>
|
||||
<id>aliyun-repo</id>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- Tencent cloud maven central repo -->
|
||||
<repository>
|
||||
<id>tencent-repo</id>
|
||||
<url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- CodeMC Repo (Contains many required libraries) -->
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
@@ -598,6 +622,13 @@
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- FoliaLib -->
|
||||
<repository>
|
||||
<id>devmart-other</id>
|
||||
<url>https://nexuslite.gcnt.net/repos/other/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>opencollab-snapshot</id>
|
||||
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||
@@ -608,6 +639,20 @@
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack</id>
|
||||
<url>https://jitpack.io/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>opencollab-snapshot-main</id>
|
||||
<url>https://repo.opencollab.dev/main/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -615,7 +660,7 @@
|
||||
<dependency>
|
||||
<groupId>org.geysermc.floodgate</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<version>2.2.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Jalu Injector -->
|
||||
@@ -677,7 +722,7 @@
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>5.0.1</version> <!-- Latest java 8 release -->
|
||||
<version>4.0.3</version> <!-- Latest java 8 release -->
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -690,7 +735,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.5</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 -->
|
||||
<version>1.7.36</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 -->
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -706,7 +751,7 @@
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.0.32</version>
|
||||
<version>8.0.33</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -757,7 +802,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.0.1-jre</version>
|
||||
<version>31.1-jre</version>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -770,17 +815,15 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.9</version>
|
||||
<version>2.10.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Bukkit Libraries -->
|
||||
|
||||
<!-- ConfigMe -->
|
||||
<dependency>
|
||||
<groupId>ch.jalu</groupId>
|
||||
<artifactId>configme</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<version>1.3.1</version>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -790,11 +833,11 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- bStats metrics -->
|
||||
<!-- bStats metrics -->
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.0.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -802,7 +845,7 @@
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>5.1.0</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -945,7 +988,7 @@
|
||||
<dependency>
|
||||
<groupId>net.essentialsx</groupId>
|
||||
<artifactId>EssentialsX</artifactId>
|
||||
<version>2.19.7</version>
|
||||
<version>2.20.1</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -1060,7 +1103,7 @@
|
||||
<dependency>
|
||||
<groupId>org.checkerframework</groupId>
|
||||
<artifactId>checker-qual</artifactId>
|
||||
<version>3.32.0</version>
|
||||
<version>3.40.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -1068,7 +1111,7 @@
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.39.3.0</version>
|
||||
<version>3.44.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -11,12 +11,17 @@ import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
|
||||
import fr.xephi.authme.initialization.OnStartupTasks;
|
||||
import fr.xephi.authme.initialization.SettingsProvider;
|
||||
import fr.xephi.authme.initialization.TaskCloser;
|
||||
import fr.xephi.authme.listener.BedrockAutoLoginListener;
|
||||
import fr.xephi.authme.listener.BlockListener;
|
||||
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
||||
import fr.xephi.authme.listener.EntityListener;
|
||||
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
||||
import fr.xephi.authme.listener.LoginLocationFixListener;
|
||||
import fr.xephi.authme.listener.PlayerListener;
|
||||
import fr.xephi.authme.listener.PlayerListener111;
|
||||
import fr.xephi.authme.listener.PlayerListener19;
|
||||
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
||||
import fr.xephi.authme.listener.PlayerListenerHigherThan18;
|
||||
import fr.xephi.authme.listener.ServerListener;
|
||||
import fr.xephi.authme.mail.EmailService;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
@@ -29,6 +34,7 @@ import fr.xephi.authme.service.yaml.YamlParseException;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SettingsWarner;
|
||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.task.CleanupTask;
|
||||
import fr.xephi.authme.task.purge.PurgeService;
|
||||
@@ -41,11 +47,16 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
||||
import static fr.xephi.authme.util.Utils.isClassLoaded;
|
||||
@@ -61,25 +72,26 @@ public class AuthMe extends JavaPlugin {
|
||||
private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE;
|
||||
|
||||
// Version and build number values
|
||||
private static String pluginVersion = "5.6.0";
|
||||
private static String pluginBuildNumber = "Custom";
|
||||
|
||||
private static String pluginVersion = "5.6.0-Fork";
|
||||
private static final String pluginBuild = "b";
|
||||
private static String pluginBuildNumber = "34";
|
||||
// Private instances
|
||||
private EmailService emailService;
|
||||
private CommandHandler commandHandler;
|
||||
private Settings settings;
|
||||
@Inject
|
||||
public static Settings settings;
|
||||
private DataSource database;
|
||||
private BukkitService bukkitService;
|
||||
private Injector injector;
|
||||
private BackupService backupService;
|
||||
private ConsoleLogger logger;
|
||||
|
||||
public static ConsoleLogger logger;
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public AuthMe() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the plugin's name.
|
||||
*
|
||||
@@ -107,6 +119,8 @@ public class AuthMe extends JavaPlugin {
|
||||
return pluginBuildNumber;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Method called when the server enables the plugin.
|
||||
*/
|
||||
@@ -118,6 +132,8 @@ public class AuthMe extends JavaPlugin {
|
||||
// Set the Logger instance and log file path
|
||||
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
||||
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
||||
logger.info("You are running an unofficial fork version of AuthMe!");
|
||||
|
||||
|
||||
// Check server version
|
||||
if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")
|
||||
@@ -146,7 +162,7 @@ public class AuthMe extends JavaPlugin {
|
||||
th.printStackTrace();
|
||||
} else {
|
||||
logger.logException("File '" + yamlParseException.getFile() + "' contains invalid YAML. "
|
||||
+ "Please run its contents through https://yamllint.com", yamlParseException);
|
||||
+ "Please run its contents through http://yamllint.com", yamlParseException);
|
||||
}
|
||||
stopOrUnload();
|
||||
return;
|
||||
@@ -158,26 +174,52 @@ public class AuthMe extends JavaPlugin {
|
||||
// Schedule clean up task
|
||||
CleanupTask cleanupTask = injector.getSingleton(CleanupTask.class);
|
||||
cleanupTask.runTaskTimerAsynchronously(this, CLEANUP_INTERVAL, CLEANUP_INTERVAL);
|
||||
|
||||
// Do a backup on start
|
||||
backupService.doBackup(BackupService.BackupCause.START);
|
||||
|
||||
// Set up Metrics
|
||||
OnStartupTasks.sendMetrics(this, settings);
|
||||
|
||||
if(settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
|
||||
String loadColorConfig = settings.getProperty(SecuritySettings.STARTUP_BANNER_COLOR);
|
||||
if (loadColorConfig.startsWith("§")) {
|
||||
logger.info("\n" + loadColorConfig + " ___ __ __ __ ___ \n" +
|
||||
loadColorConfig + " / | __ __/ /_/ /_ / |/ /__ \n" +
|
||||
loadColorConfig + " / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
|
||||
loadColorConfig + " / ___ / /_/ / /_/ / / / / / / __/\n" +
|
||||
loadColorConfig + "/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
|
||||
loadColorConfig + " ");
|
||||
}else {
|
||||
logger.info("\n"+" ___ __ __ __ ___ \n" +
|
||||
" / | __ __/ /_/ /_ / |/ /__ \n" +
|
||||
" / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
|
||||
" / ___ / /_/ / /_/ / / / / / / __/\n" +
|
||||
"/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
|
||||
" ");
|
||||
}
|
||||
}
|
||||
// Successful message
|
||||
logger.info("AuthMeReloaded successfully enabled!");
|
||||
|
||||
//detect server brand with classloader
|
||||
checkServerType();
|
||||
logger.info("AuthMeReReloaded is enabled successfully!");
|
||||
// Purge on start if enabled
|
||||
PurgeService purgeService = injector.getSingleton(PurgeService.class);
|
||||
purgeService.runAutoPurge();
|
||||
// 注册玩家加入事件监听
|
||||
// register3rdPartyListeners();
|
||||
logger.info("GitHub: https://github.com/HaHaWTH/AuthMeReReloaded/");
|
||||
if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) {
|
||||
checkForUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Migrated
|
||||
|
||||
/**
|
||||
* Load the version and build number of the plugin from the description file.
|
||||
*
|
||||
* @param versionRaw the version as given by the plugin description file
|
||||
*/
|
||||
|
||||
private static void loadPluginInfo(String versionRaw) {
|
||||
int index = versionRaw.lastIndexOf("-");
|
||||
if (index != -1) {
|
||||
@@ -266,10 +308,17 @@ public class AuthMe extends JavaPlugin {
|
||||
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
|
||||
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
|
||||
|
||||
// Try to register 1.9 player listeners
|
||||
if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||
|
||||
// Try to register 1.8+ player listeners
|
||||
if (isClassLoaded("org.bukkit.event.entity.EntityPickupItemEvent") && isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||
pluginManager.registerEvents(injector.getSingleton(PlayerListenerHigherThan18.class), this);
|
||||
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||
}
|
||||
// Try to register 1.9 player listeners(Moved to else-if)
|
||||
// if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||
// pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||
// }
|
||||
|
||||
// Try to register 1.9 spigot player listeners
|
||||
if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) {
|
||||
@@ -280,6 +329,26 @@ public class AuthMe extends JavaPlugin {
|
||||
if (isClassLoaded("org.bukkit.event.entity.EntityAirChangeEvent")) {
|
||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener111.class), this);
|
||||
}
|
||||
|
||||
//Register 3rd party listeners
|
||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||
pluginManager.registerEvents(injector.getSingleton(GuiCaptchaHandler.class), this);
|
||||
logger.info("(Beta)GUICaptcha is enabled successfully!");
|
||||
logger.info("These features are still in early development, if you encountered any problem, please report.");
|
||||
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().getPlugin("ProtocolLib") == null) {
|
||||
logger.warning("ProtocolLib is not loaded, can't enable GUI Captcha.");
|
||||
}
|
||||
if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && getServer().getPluginManager().getPlugin("floodgate") != null) {
|
||||
pluginManager.registerEvents(injector.getSingleton(BedrockAutoLoginListener.class), this);
|
||||
} else if (settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && (!settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) || getServer().getPluginManager().getPlugin("floodgate") == null)) {
|
||||
logger.warning("Failed to enable BedrockAutoLogin, ensure hookFloodgate: true and floodgate is loaded.");
|
||||
}
|
||||
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND) || settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
|
||||
pluginManager.registerEvents(injector.getSingleton(LoginLocationFixListener.class), this);
|
||||
}
|
||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
||||
pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,7 +374,7 @@ public class AuthMe extends JavaPlugin {
|
||||
onShutdownPlayerSaver.saveAllPlayers();
|
||||
}
|
||||
if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'.'MM'.'dd'.' HH:mm:ss");
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date));
|
||||
}
|
||||
@@ -320,10 +389,78 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
// Disabled correctly
|
||||
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
||||
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " disabled!");
|
||||
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
|
||||
ConsoleLogger.closeFileWriter();
|
||||
}
|
||||
|
||||
private static final String owner = "HaHaWTH";
|
||||
// private static final String owner_gitee = "Shixuehan114514";
|
||||
private static final String repo = "AuthMeReReloaded";
|
||||
|
||||
private void checkForUpdates() {
|
||||
logger.info("Checking for updates...");
|
||||
bukkitService.runTaskAsynchronously(() -> {
|
||||
try {
|
||||
// 从南通集线器获取最新版本号
|
||||
URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest");
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(10000); // 设置连接超时为10秒
|
||||
conn.setReadTimeout(10000); // 设置读取超时为10秒
|
||||
Scanner scanner = new Scanner(conn.getInputStream());
|
||||
String response = scanner.useDelimiter("\\Z").next();
|
||||
scanner.close();
|
||||
|
||||
// 处理JSON响应
|
||||
String latestVersion = response.substring(response.indexOf("tag_name") + 11);
|
||||
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
|
||||
if (isUpdateAvailable(latestVersion)) {
|
||||
String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber;
|
||||
getLogger().log(Level.WARNING, message);
|
||||
getLogger().log(Level.WARNING, "Download from here: github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
|
||||
} else {
|
||||
getLogger().log(Level.INFO, "You are running the latest version.");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
String formattedException = ExceptionUtils.formatException(e);
|
||||
getLogger().log(Level.WARNING, "Error occurred while checking updates from GitHub. Reason: " + formattedException);
|
||||
}
|
||||
});
|
||||
}
|
||||
private boolean isUpdateAvailable(String latestVersion) {
|
||||
// Extract the first character and the remaining digits from the version string
|
||||
char latestChar = latestVersion.charAt(0);
|
||||
int latestNumber = Integer.parseInt(latestVersion.substring(1));
|
||||
|
||||
char currentChar = pluginBuild.charAt(0);
|
||||
int currentNumber = Integer.parseInt(pluginBuildNumber);
|
||||
|
||||
// Compare the characters first
|
||||
if (latestChar > currentChar) {
|
||||
return true;
|
||||
} else if (latestChar < currentChar) {
|
||||
return false;
|
||||
} else {
|
||||
// If the characters are the same, compare the numbers
|
||||
return latestNumber > currentNumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkServerType() {
|
||||
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
||||
logger.info("AuthMeReReloaded is running on Paper");
|
||||
} else if (isClassLoaded("catserver.server.CatServerConfig")) {
|
||||
logger.info("AuthMeReReloaded is running on CatServer");
|
||||
} else if (isClassLoaded("org.spigotmc.SpigotConfig")) {
|
||||
logger.info("AuthMeReReloaded is running on Spigot");
|
||||
} else if (isClassLoaded("org.bukkit.craftbukkit.CraftServer")) {
|
||||
logger.info("AuthMeReReloaded is running on Bukkit");
|
||||
} else {
|
||||
logger.info("AuthMeReReloaded is running on Unknown*");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Bukkit commands.
|
||||
*
|
||||
|
||||
@@ -142,7 +142,7 @@ public final class ConsoleLogger {
|
||||
public void fine(String message) {
|
||||
if (logLevel.includes(LogLevel.FINE)) {
|
||||
logger.info(message);
|
||||
writeLog("[FINE] " + message);
|
||||
writeLog("[INFO:FINE] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public final class ConsoleLogger {
|
||||
}
|
||||
|
||||
private void logAndWriteWithDebugPrefix(String message) {
|
||||
String debugMessage = "[DEBUG] " + message;
|
||||
String debugMessage = "[INFO:DEBUG] " + message;
|
||||
logger.info(debugMessage);
|
||||
writeLog(debugMessage);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import fr.xephi.authme.command.executable.authme.TotpViewStatusCommand;
|
||||
import fr.xephi.authme.command.executable.authme.UnregisterAdminCommand;
|
||||
import fr.xephi.authme.command.executable.authme.UpdateHelpMessagesCommand;
|
||||
import fr.xephi.authme.command.executable.authme.VersionCommand;
|
||||
import fr.xephi.authme.command.executable.authme.WhitelistCommand;
|
||||
import fr.xephi.authme.command.executable.authme.debug.DebugCommand;
|
||||
import fr.xephi.authme.command.executable.captcha.CaptchaCommand;
|
||||
import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand;
|
||||
@@ -421,16 +420,6 @@ public class CommandInitializer {
|
||||
.executableCommand(SwitchAntiBotCommand.class)
|
||||
.register();
|
||||
|
||||
CommandDescription.builder()
|
||||
.parent(authmeBase)
|
||||
.labels("whitelist")
|
||||
.description("Switch whitelist mode")
|
||||
.detailedDescription("Switch or toggle the whitelist mode to the specified state.")
|
||||
.withArgument("mode", "ON / OFF", OPTIONAL)
|
||||
.permission(AdminPermission.SWITCH_ANTIBOT)
|
||||
.executableCommand(WhitelistCommand.class)
|
||||
.register();
|
||||
|
||||
// Register the reload command
|
||||
CommandDescription.builder()
|
||||
.parent(authmeBase)
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package fr.xephi.authme.command.executable.authme;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.TeleportUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
@@ -11,16 +15,22 @@ import java.util.List;
|
||||
* Teleports the player to the first spawn.
|
||||
*/
|
||||
public class FirstSpawnCommand extends PlayerCommand {
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
@Inject
|
||||
private SpawnLoader spawnLoader;
|
||||
|
||||
@Override
|
||||
public void runCommand(Player player, List<String> arguments) {
|
||||
if (spawnLoader.getFirstSpawn() == null) {
|
||||
player.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn");
|
||||
} else {
|
||||
player.teleport(spawnLoader.getFirstSpawn());
|
||||
//String name= player.getName();
|
||||
if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||
TeleportUtils.teleport(player, spawnLoader.getFirstSpawn());
|
||||
} else {
|
||||
player.teleport(spawnLoader.getFirstSpawn());
|
||||
}
|
||||
//player.teleport(spawnLoader.getFirstSpawn());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package fr.xephi.authme.command.executable.authme;
|
||||
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.service.WhiteListService;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Display or change the status of the antibot mod.
|
||||
*/
|
||||
public class WhitelistCommand implements ExecutableCommand {
|
||||
|
||||
@Inject
|
||||
private WhiteListService whiteListService;
|
||||
|
||||
|
||||
@Override
|
||||
public void executeCommand(final CommandSender sender, List<String> arguments) {
|
||||
if (arguments.isEmpty()) {
|
||||
sender.sendMessage("[AuthMe] WhiteList: " + whiteListService.getWhiteListStatus().name());
|
||||
return;
|
||||
}
|
||||
|
||||
String newState = arguments.get(0);
|
||||
|
||||
// Enable or disable the mod
|
||||
if ("ON".equalsIgnoreCase(newState)) {
|
||||
whiteListService.overrideWhiteListStatus(true);
|
||||
sender.sendMessage("[AuthMe] WhiteList enabled!");
|
||||
} else if ("OFF".equalsIgnoreCase(newState)) {
|
||||
sender.sendMessage("[AuthMe] WhiteList disabled!");
|
||||
whiteListService.overrideWhiteListStatus(false);
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.GOLD + "Detailed help: " + ChatColor.WHITE + "/authme help whitelist");
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -42,6 +42,12 @@ public class ChangePasswordCommand extends PlayerCommand {
|
||||
commonService.send(player, MessageKey.NOT_LOGGED_IN);
|
||||
return;
|
||||
}
|
||||
// Check if the user has been verified or not
|
||||
if (codeManager.isVerificationRequired(player)) {
|
||||
codeManager.codeExistOrGenerateNew(name);
|
||||
commonService.send(player, MessageKey.VERIFICATION_CODE_REQUIRED);
|
||||
return;
|
||||
}
|
||||
|
||||
String oldPassword = arguments.get(0);
|
||||
String newPassword = arguments.get(1);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class TotpCodeCommand extends PlayerCommand {
|
||||
boolean isCodeValid = totpAuthenticator.checkCode(auth, inputCode);
|
||||
if (isCodeValid) {
|
||||
logger.debug("Successfully checked TOTP code for `{0}`", player.getName());
|
||||
asynchronousLogin.performLogin(player, auth,false);
|
||||
asynchronousLogin.performLogin(player, auth);
|
||||
} else {
|
||||
logger.debug("Input TOTP code was invalid for player `{0}`", player.getName());
|
||||
messages.send(player, MessageKey.TWO_FACTOR_INVALID_CODE);
|
||||
|
||||
@@ -4,6 +4,7 @@ package fr.xephi.authme.datasource;
|
||||
* DataSource type.
|
||||
*/
|
||||
public enum DataSourceType {
|
||||
// H2,
|
||||
|
||||
MYSQL,
|
||||
|
||||
|
||||
@@ -0,0 +1,408 @@
|
||||
//package fr.xephi.authme.datasource;
|
||||
//
|
||||
//import com.google.common.annotations.VisibleForTesting;
|
||||
//import fr.xephi.authme.ConsoleLogger;
|
||||
//import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
//import fr.xephi.authme.datasource.columnshandler.AuthMeColumnsHandler;
|
||||
//import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
//import fr.xephi.authme.settings.Settings;
|
||||
//import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.sql.Connection;
|
||||
//import java.sql.DatabaseMetaData;
|
||||
//import java.sql.DriverManager;
|
||||
//import java.sql.PreparedStatement;
|
||||
//import java.sql.ResultSet;
|
||||
//import java.sql.SQLException;
|
||||
//import java.sql.Statement;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Collection;
|
||||
//import java.util.HashSet;
|
||||
//import java.util.List;
|
||||
//import java.util.Locale;
|
||||
//import java.util.Set;
|
||||
//
|
||||
//import static fr.xephi.authme.datasource.SqlDataSourceUtils.getNullableLong;
|
||||
//import static fr.xephi.authme.datasource.SqlDataSourceUtils.logSqlException;
|
||||
//
|
||||
///**
|
||||
// * H2 data source.
|
||||
// */
|
||||
//@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
|
||||
//public class H2 extends AbstractSqlDataSource {
|
||||
//
|
||||
// private final ConsoleLogger logger = ConsoleLoggerFactory.get(H2.class);
|
||||
// private final Settings settings;
|
||||
// private final File dataFolder;
|
||||
// private final String database;
|
||||
// private final String tableName;
|
||||
// private final Columns col;
|
||||
// private Connection con;
|
||||
//
|
||||
// /**
|
||||
// * Constructor for H2.
|
||||
// *
|
||||
// * @param settings The settings instance
|
||||
// * @param dataFolder The data folder
|
||||
// * @throws SQLException when initialization of a SQL datasource failed
|
||||
// */
|
||||
// public H2(Settings settings, File dataFolder) throws SQLException {
|
||||
// this.settings = settings;
|
||||
// this.dataFolder = dataFolder;
|
||||
// this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
|
||||
// this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
|
||||
// this.col = new Columns(settings);
|
||||
//
|
||||
// try {
|
||||
// this.connect();
|
||||
// this.setup();
|
||||
// } catch (Exception ex) {
|
||||
// logger.logException("Error during H2 initialization:", ex);
|
||||
// throw ex;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @VisibleForTesting
|
||||
// H2(Settings settings, File dataFolder, Connection connection) {
|
||||
// this.settings = settings;
|
||||
// this.dataFolder = dataFolder;
|
||||
// this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
|
||||
// this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
|
||||
// this.col = new Columns(settings);
|
||||
// this.con = connection;
|
||||
// this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Initializes the connection to the H2 database.
|
||||
// *
|
||||
// * @throws SQLException when an SQL error occurs while connecting
|
||||
// */
|
||||
// protected void connect() throws SQLException {
|
||||
// try {
|
||||
// Class.forName("org.h2.Driver");
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// throw new IllegalStateException("Failed to load H2 JDBC class", e);
|
||||
// }
|
||||
//
|
||||
// logger.debug("H2 driver loaded");
|
||||
// this.con = DriverManager.getConnection(this.getJdbcUrl(this.dataFolder.getAbsolutePath(), "", this.database));
|
||||
// this.columnsHandler = AuthMeColumnsHandler.createForSqlite(con, settings);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Creates the table if necessary, or adds any missing columns to the table.
|
||||
// *
|
||||
// * @throws SQLException when an SQL error occurs while initializing the database
|
||||
// */
|
||||
// @VisibleForTesting
|
||||
// @SuppressWarnings("checkstyle:CyclomaticComplexity")
|
||||
// protected void setup() throws SQLException {
|
||||
// try (Statement st = con.createStatement()) {
|
||||
// // Note: cannot add unique fields later on in SQLite, so we add it on initialization
|
||||
// st.executeUpdate("CREATE TABLE IF NOT EXISTS " + tableName + " ("
|
||||
// + col.ID + " INTEGER AUTO_INCREMENT, "
|
||||
// + col.NAME + " VARCHAR(255) NOT NULL UNIQUE, "
|
||||
// + "CONSTRAINT table_const_prim PRIMARY KEY (" + col.ID + "));");
|
||||
//
|
||||
// DatabaseMetaData md = con.getMetaData();
|
||||
//
|
||||
// if (isColumnMissing(md, col.REAL_NAME)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
||||
// + col.REAL_NAME + " VARCHAR(255) NOT NULL DEFAULT 'Player';");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.PASSWORD)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.PASSWORD + " VARCHAR(255) NOT NULL DEFAULT '';");
|
||||
// }
|
||||
//
|
||||
// if (!col.SALT.isEmpty() && isColumnMissing(md, col.SALT)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.SALT + " VARCHAR(255);");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.LAST_IP)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.LAST_IP + " VARCHAR(40);");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.LAST_LOGIN)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.LAST_LOGIN + " TIMESTAMP;");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.REGISTRATION_IP)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.REGISTRATION_IP + " VARCHAR(40);");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.REGISTRATION_DATE)) {
|
||||
// addRegistrationDateColumn(st);
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.LASTLOC_X)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_X
|
||||
// + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_Y
|
||||
// + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN " + col.LASTLOC_Z
|
||||
// + " DOUBLE NOT NULL DEFAULT '0.0';");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.LASTLOC_WORLD)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.LASTLOC_WORLD + " VARCHAR(255) NOT NULL DEFAULT 'world';");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.LASTLOC_YAW)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
||||
// + col.LASTLOC_YAW + " FLOAT;");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.LASTLOC_PITCH)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName + " ADD COLUMN "
|
||||
// + col.LASTLOC_PITCH + " FLOAT;");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.EMAIL)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.EMAIL + " VARCHAR(255);");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.IS_LOGGED)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.IS_LOGGED + " INT NOT NULL DEFAULT '0';");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.HAS_SESSION)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.HAS_SESSION + " INT NOT NULL DEFAULT '0';");
|
||||
// }
|
||||
//
|
||||
// if (isColumnMissing(md, col.TOTP_KEY)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.TOTP_KEY + " VARCHAR(32);");
|
||||
// }
|
||||
//
|
||||
// if (!col.PLAYER_UUID.isEmpty() && isColumnMissing(md, col.PLAYER_UUID)) {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.PLAYER_UUID + " VARCHAR(36)");
|
||||
// }
|
||||
// }
|
||||
// logger.info("H2 Setup finished");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private boolean isColumnMissing(DatabaseMetaData metaData, String columnName) throws SQLException {
|
||||
// try (ResultSet rs = metaData.getColumns(null, null, tableName, columnName)) {
|
||||
// return !rs.next();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void reload() {
|
||||
// close(con);
|
||||
// try {
|
||||
// this.connect();
|
||||
// this.setup();
|
||||
// } catch (SQLException ex) {
|
||||
// logger.logException("Error while reloading H2:", ex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public PlayerAuth getAuth(String user) {
|
||||
// String sql = "SELECT * FROM " + tableName + " WHERE LOWER(" + col.NAME + ")=LOWER(?);";
|
||||
// try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
// pst.setString(1, user);
|
||||
// try (ResultSet rs = pst.executeQuery()) {
|
||||
// if (rs.next()) {
|
||||
// return buildAuthFromResultSet(rs);
|
||||
// }
|
||||
// }
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Set<String> getRecordsToPurge(long until) {
|
||||
// Set<String> list = new HashSet<>();
|
||||
// String select = "SELECT " + col.NAME + " FROM " + tableName + " WHERE MAX("
|
||||
// + " COALESCE(" + col.LAST_LOGIN + ", 0),"
|
||||
// + " COALESCE(" + col.REGISTRATION_DATE + ", 0)"
|
||||
// + ") < ?;";
|
||||
// try (PreparedStatement selectPst = con.prepareStatement(select)) {
|
||||
// selectPst.setLong(1, until);
|
||||
// try (ResultSet rs = selectPst.executeQuery()) {
|
||||
// while (rs.next()) {
|
||||
// list.add(rs.getString(col.NAME));
|
||||
// }
|
||||
// }
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
//
|
||||
// return list;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void purgeRecords(Collection<String> toPurge) {
|
||||
// String delete = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
// try (PreparedStatement deletePst = con.prepareStatement(delete)) {
|
||||
// for (String name : toPurge) {
|
||||
// deletePst.setString(1, name.toLowerCase(Locale.ROOT));
|
||||
// deletePst.executeUpdate();
|
||||
// }
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removeAuth(String user) {
|
||||
// String sql = "DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;";
|
||||
// try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
// pst.setString(1, user.toLowerCase(Locale.ROOT));
|
||||
// pst.executeUpdate();
|
||||
// return true;
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void closeConnection() {
|
||||
// try {
|
||||
// if (con != null && !con.isClosed()) {
|
||||
// con.close();
|
||||
// }
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public DataSourceType getType() {
|
||||
// return DataSourceType.H2;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<PlayerAuth> getAllAuths() {
|
||||
// List<PlayerAuth> auths = new ArrayList<>();
|
||||
// String sql = "SELECT * FROM " + tableName + ";";
|
||||
// try (PreparedStatement pst = con.prepareStatement(sql); ResultSet rs = pst.executeQuery()) {
|
||||
// while (rs.next()) {
|
||||
// PlayerAuth auth = buildAuthFromResultSet(rs);
|
||||
// auths.add(auth);
|
||||
// }
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// return auths;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getLoggedPlayersWithEmptyMail() {
|
||||
// List<String> players = new ArrayList<>();
|
||||
// String sql = "SELECT " + col.REAL_NAME + " FROM " + tableName + " WHERE " + col.IS_LOGGED + " = 1"
|
||||
// + " AND (" + col.EMAIL + " = 'your@email.com' OR " + col.EMAIL + " IS NULL);";
|
||||
// try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) {
|
||||
// while (rs.next()) {
|
||||
// players.add(rs.getString(1));
|
||||
// }
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// return players;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<PlayerAuth> getRecentlyLoggedInPlayers() {
|
||||
// List<PlayerAuth> players = new ArrayList<>();
|
||||
// String sql = "SELECT * FROM " + tableName + " ORDER BY " + col.LAST_LOGIN + " DESC LIMIT 10;";
|
||||
// try (Statement st = con.createStatement(); ResultSet rs = st.executeQuery(sql)) {
|
||||
// while (rs.next()) {
|
||||
// players.add(buildAuthFromResultSet(rs));
|
||||
// }
|
||||
// } catch (SQLException e) {
|
||||
// logSqlException(e);
|
||||
// }
|
||||
// return players;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public boolean setTotpKey(String user, String totpKey) {
|
||||
// String sql = "UPDATE " + tableName + " SET " + col.TOTP_KEY + " = ? WHERE " + col.NAME + " = ?";
|
||||
// try (PreparedStatement pst = con.prepareStatement(sql)) {
|
||||
// pst.setString(1, totpKey);
|
||||
// pst.setString(2, user.toLowerCase(Locale.ROOT));
|
||||
// pst.executeUpdate();
|
||||
// return true;
|
||||
// } catch (SQLException e) {
|
||||
// logSqlException(e);
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// private PlayerAuth buildAuthFromResultSet(ResultSet row) throws SQLException {
|
||||
// String salt = !col.SALT.isEmpty() ? row.getString(col.SALT) : null;
|
||||
//
|
||||
// return PlayerAuth.builder()
|
||||
// .name(row.getString(col.NAME))
|
||||
// .email(row.getString(col.EMAIL))
|
||||
// .realName(row.getString(col.REAL_NAME))
|
||||
// .password(row.getString(col.PASSWORD), salt)
|
||||
// .totpKey(row.getString(col.TOTP_KEY))
|
||||
// .lastLogin(getNullableLong(row, col.LAST_LOGIN))
|
||||
// .lastIp(row.getString(col.LAST_IP))
|
||||
// .registrationDate(row.getLong(col.REGISTRATION_DATE))
|
||||
// .registrationIp(row.getString(col.REGISTRATION_IP))
|
||||
// .locX(row.getDouble(col.LASTLOC_X))
|
||||
// .locY(row.getDouble(col.LASTLOC_Y))
|
||||
// .locZ(row.getDouble(col.LASTLOC_Z))
|
||||
// .locWorld(row.getString(col.LASTLOC_WORLD))
|
||||
// .locYaw(row.getFloat(col.LASTLOC_YAW))
|
||||
// .locPitch(row.getFloat(col.LASTLOC_PITCH))
|
||||
// .build();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Creates the column for registration date and sets all entries to the current timestamp.
|
||||
// * We do so in order to avoid issues with purging, where entries with 0 / NULL might get
|
||||
// * purged immediately on startup otherwise.
|
||||
// *
|
||||
// * @param st Statement object to the database
|
||||
// */
|
||||
// private void addRegistrationDateColumn(Statement st) throws SQLException {
|
||||
// st.executeUpdate("ALTER TABLE " + tableName
|
||||
// + " ADD COLUMN " + col.REGISTRATION_DATE + " TIMESTAMP NOT NULL DEFAULT '0';");
|
||||
//
|
||||
// // Use the timestamp from Java to avoid timezone issues in case JVM and database are out of sync
|
||||
// long currentTimestamp = System.currentTimeMillis();
|
||||
// int updatedRows = st.executeUpdate(String.format("UPDATE %s SET %s = %d;",
|
||||
// tableName, col.REGISTRATION_DATE, currentTimestamp));
|
||||
// logger.info("Created column '" + col.REGISTRATION_DATE + "' and set the current timestamp, "
|
||||
// + currentTimestamp + ", to all " + updatedRows + " rows");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// String getJdbcUrl(String dataPath, String ignored, String database) {
|
||||
// return "jdbc:h2:" + dataPath + File.separator + database + ".db";
|
||||
// }
|
||||
//
|
||||
// private static void close(Connection con) {
|
||||
// if (con != null) {
|
||||
// try {
|
||||
// con.close();
|
||||
// } catch (SQLException ex) {
|
||||
// logSqlException(ex);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@@ -76,6 +76,9 @@ public class DataSourceProvider implements Provider<DataSource> {
|
||||
case SQLITE:
|
||||
dataSource = new SQLite(settings, dataFolder);
|
||||
break;
|
||||
// case H2:
|
||||
// dataSource = new H2(settings, dataFolder);
|
||||
// break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unknown data source type '" + dataSourceType + "'");
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class OnStartupTasks {
|
||||
* @param settings the settings
|
||||
*/
|
||||
public static void sendMetrics(AuthMe plugin, Settings settings) {
|
||||
final Metrics metrics = new Metrics(plugin, 164);
|
||||
final Metrics metrics = new Metrics(plugin, 18479);
|
||||
|
||||
metrics.addCustomChart(new SimplePie("messages_language",
|
||||
() -> settings.getProperty(PluginSettings.MESSAGES_LANGUAGE)));
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package fr.xephi.authme.listener;
|
||||
/* Inspired by DongShaoNB/BedrockPlayerSupport **/
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import fr.xephi.authme.events.RestoreSessionEvent;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class BedrockAutoLoginListener implements Listener {
|
||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
@Inject
|
||||
private AuthMe plugin;
|
||||
@Inject
|
||||
private Messages messages;
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
|
||||
public BedrockAutoLoginListener() {
|
||||
}
|
||||
|
||||
private boolean isBedrockPlayer(UUID uuid) {
|
||||
return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.FORCE_LOGIN_BEDROCK) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String name = event.getPlayer().getName();
|
||||
UUID uuid = event.getPlayer().getUniqueId();
|
||||
if (isBedrockPlayer(uuid) && !authmeApi.isAuthenticated(player) && authmeApi.isRegistered(name)) {
|
||||
authmeApi.forceLogin(player);
|
||||
messages.send(player, MessageKey.BEDROCK_AUTO_LOGGED_IN);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerAuthMeSessionRestore(RestoreSessionEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (isBedrockPlayer(uuid)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package fr.xephi.authme.listener;
|
||||
//Prevent Ghost Players
|
||||
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class DoubleLoginFixListener implements Listener {
|
||||
@Inject
|
||||
private CommonService service;
|
||||
|
||||
public DoubleLoginFixListener() {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Collection<? extends Player> PlayerList = Bukkit.getServer().getOnlinePlayers();
|
||||
HashSet<String> PlayerSet = new HashSet<String>();
|
||||
for (Player ep : PlayerList) {
|
||||
if (PlayerSet.contains(ep.getName().toLowerCase())) {
|
||||
ep.kickPlayer(service.retrieveSingleMessage(ep.getPlayer(), MessageKey.DOUBLE_LOGIN_FIX));
|
||||
break;
|
||||
}
|
||||
PlayerSet.add(ep.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static fr.xephi.authme.util.PlayerUtils.getPlayerIp;
|
||||
import static fr.xephi.authme.util.PlayerUtils.isNpc;
|
||||
import static org.bukkit.Bukkit.getLogger;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class GuiCaptchaHandler implements Listener {
|
||||
//define AuthMeApi
|
||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
@Inject
|
||||
private AuthMe plugin;
|
||||
@Inject
|
||||
private Messages messages;
|
||||
@Inject
|
||||
private CommonService service;
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
|
||||
|
||||
private PacketAdapter chatPacketListener;
|
||||
private PacketAdapter windowPacketListener;
|
||||
|
||||
//define timesLeft
|
||||
private int timesLeft = 3;
|
||||
//Use ConcurrentHashMap to store player and their close reason
|
||||
/* We used many async tasks so there is concurrent**/
|
||||
public static HashMap<Player, String> closeReasonMap = new HashMap<>();
|
||||
//define randomStringSet
|
||||
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
||||
String randomString = "";
|
||||
Random randomItemSet = new Random();
|
||||
Random howManyRandom = new Random();
|
||||
private boolean isPacketListenersActive = false;
|
||||
|
||||
public GuiCaptchaHandler() {
|
||||
}
|
||||
|
||||
private StringBuilder sb;
|
||||
private final List<String> whiteList = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_COUNTRY_WHITELIST);
|
||||
|
||||
private boolean isBedrockPlayer(UUID uuid) {
|
||||
return settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(uuid) && getServer().getPluginManager().getPlugin("floodgate") != null;
|
||||
}
|
||||
|
||||
|
||||
private void initializePacketListeners() {
|
||||
if (!isPacketListenersActive) {
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(windowPacketListener);
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(chatPacketListener);
|
||||
isPacketListenersActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
ItemStack currentItem = event.getCurrentItem();
|
||||
if (!authmeApi.isRegistered(player.getName()) && !closeReasonMap.containsKey(player)) {
|
||||
if (isBedrockPlayer(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)) {
|
||||
event.setCancelled(true);
|
||||
if (!closeReasonMap.containsKey(player)) {
|
||||
closeReasonMap.put(player, "verified");
|
||||
}
|
||||
player.closeInventory();
|
||||
messages.send(player, MessageKey.GUI_CAPTCHA_VERIFIED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
bukkitService.runTaskAsynchronously(() -> {
|
||||
sb = new StringBuilder();
|
||||
int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
||||
for (int i = 0; i < howLongIsRandomString; i++) {
|
||||
//生成随机索引号
|
||||
int index = randomItemSet.nextInt(randomSet.length());
|
||||
|
||||
// 从字符串中获取由索引 index 指定的字符
|
||||
char randomChar = randomSet.charAt(index);
|
||||
|
||||
// 将字符追加到字符串生成器
|
||||
sb.append(randomChar);
|
||||
}
|
||||
if (!whiteList.isEmpty()) {
|
||||
String ip = getPlayerIp(player);
|
||||
if (whiteList.contains(authmeApi.getCountryCode(ip)) && ip != null) {
|
||||
if (!closeReasonMap.containsKey(player)) {
|
||||
closeReasonMap.put(player, "verified:whitelist");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
randomString = "";
|
||||
Player playerunreg = event.getPlayer();
|
||||
String name = playerunreg.getName();
|
||||
if (!authmeApi.isRegistered(name) && !isNpc(playerunreg) && !closeReasonMap.containsKey(playerunreg)) {
|
||||
if (isBedrockPlayer(playerunreg.getUniqueId())) {
|
||||
if (!closeReasonMap.containsKey(playerunreg)) {
|
||||
closeReasonMap.put(playerunreg, "verified:bedrock");
|
||||
}
|
||||
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
|
||||
return;
|
||||
}
|
||||
bukkitService.runTaskAsynchronously(() -> {
|
||||
bukkitService.runTask(() -> {
|
||||
randomString = sb.toString();
|
||||
Random random_blockpos = new Random();
|
||||
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26));
|
||||
Inventory menu = Bukkit.createInventory(playerunreg, 27, messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_WINDOW_NAME, randomString));
|
||||
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
try {
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(messages.retrieveSingle(playerunreg, MessageKey.GUI_CAPTCHA_CLICKABLE_NAME, randomString));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
getLogger().log(Level.WARNING, "Unexpected error occurred while setting item meta.");
|
||||
}
|
||||
windowPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
Player packetPlayer = event.getPlayer();
|
||||
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
|
||||
if (timesLeft <= 0) {
|
||||
bukkitService.runTask(() -> {
|
||||
packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
|
||||
});
|
||||
timesLeft = 3;
|
||||
} else {
|
||||
--timesLeft;
|
||||
if (timesLeft <= 0) {
|
||||
bukkitService.runTask(() -> {
|
||||
packetPlayer.kickPlayer(service.retrieveSingleMessage(packetPlayer, MessageKey.GUI_CAPTCHA_KICK_FAILED));
|
||||
});
|
||||
timesLeft = 3;
|
||||
return;
|
||||
}
|
||||
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_RETRY_MESSAGE, String.valueOf(timesLeft));
|
||||
event.setCancelled(true);
|
||||
random_num.set(random_blockpos.nextInt(26));
|
||||
bukkitService.runTask(() -> {
|
||||
menu.clear();
|
||||
menu.setItem(random_num.get(), item);
|
||||
packetPlayer.openInventory(menu);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
chatPacketListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
Player packetPlayer = event.getPlayer();
|
||||
if (!closeReasonMap.containsKey(packetPlayer) && !authmeApi.isRegistered(packetPlayer.getName())) {
|
||||
messages.send(packetPlayer, MessageKey.GUI_CAPTCHA_DENIED_MESSAGE);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
initializePacketListeners();
|
||||
//Open captcha inventory
|
||||
menu.setItem(random_num.get(), item);
|
||||
playerunreg.openInventory(menu);
|
||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > 0) {
|
||||
long timeOut = settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT);
|
||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > settings.getProperty(RestrictionSettings.TIMEOUT)) {
|
||||
bukkitService.runTask(() -> {
|
||||
getLogger().warning("AuthMe detected that your GUI captcha timeout seconds(" + settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) + ") is bigger than the Login timeout seconds(" +
|
||||
settings.getProperty(RestrictionSettings.TIMEOUT) + "). To prevent issues, we will let the GUI captcha follow the Login timeout seconds, please check and modify your config.");
|
||||
});
|
||||
timeOut = settings.getProperty(RestrictionSettings.TIMEOUT);
|
||||
}
|
||||
long finalTimeOut = timeOut;
|
||||
bukkitService.runTask(() -> {
|
||||
bukkitService.runTaskLater(() -> {
|
||||
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT));
|
||||
timesLeft = 3; // Reset the attempt counter
|
||||
}
|
||||
}, finalTimeOut * 20L);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//This prevents players from unregistering by Admins
|
||||
@EventHandler
|
||||
public void onPlayerAuthMeLogin(LoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!closeReasonMap.containsKey(player)) {
|
||||
closeReasonMap.put(player, "verified:loggedIn");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void deletePlayerData(UUID playerUUID) {
|
||||
// 获取服务器的存储文件夹路径
|
||||
File serverFolder = Bukkit.getServer().getWorldContainer();
|
||||
String worldFolderName = settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
||||
// 构建playerdata文件夹路径
|
||||
File playerDataFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "playerdata");
|
||||
|
||||
// 构建玩家数据文件路径
|
||||
File playerDataFile = new File(playerDataFolder, File.separator + playerUUID + ".dat");
|
||||
|
||||
// 删除玩家数据文件
|
||||
if (playerDataFile.exists()) {
|
||||
playerDataFile.delete();
|
||||
}
|
||||
}
|
||||
private void deletePlayerStats(UUID playerUUID) {
|
||||
// 获取服务器的存储文件夹路径
|
||||
File serverFolder = Bukkit.getServer().getWorldContainer();
|
||||
String worldFolderName = settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
||||
// 构建stats文件夹路径
|
||||
File statsFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "stats");
|
||||
// 构建玩家统计数据文件路径
|
||||
File statsFile = new File(statsFolder, File.separator + playerUUID + ".json");
|
||||
// 删除玩家统计数据文件
|
||||
if (statsFile.exists()) {
|
||||
statsFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteAuthMePlayerData(UUID playerUUID) {
|
||||
File pluginFolder = plugin.getDataFolder();
|
||||
File path = new File(pluginFolder, File.separator + "playerdata" + File.separator + playerUUID);
|
||||
File dataFile = new File(path, File.separator + "data.json");
|
||||
if (dataFile.exists()) {
|
||||
dataFile.delete();
|
||||
path.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName();
|
||||
UUID playerUUID = event.getPlayer().getUniqueId();
|
||||
if (!authmeApi.isRegistered(name)) {
|
||||
if (settings.getProperty(SecuritySettings.DELETE_UNVERIFIED_PLAYER_DATA) && !closeReasonMap.containsKey(player)) {
|
||||
bukkitService.runTaskLater(() -> {
|
||||
if (!player.isOnline()) {
|
||||
deletePlayerData(playerUUID);
|
||||
deletePlayerStats(playerUUID);
|
||||
deleteAuthMePlayerData(playerUUID);
|
||||
}
|
||||
}, 100L);
|
||||
return;
|
||||
}
|
||||
closeReasonMap.remove(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.PlayerUtils;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -18,13 +21,13 @@ import javax.inject.Inject;
|
||||
* Service class for the AuthMe listeners to determine whether an event should be canceled.
|
||||
*/
|
||||
class ListenerService implements SettingsDependent {
|
||||
|
||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||
private final DataSource dataSource;
|
||||
private final PlayerCache playerCache;
|
||||
private final ValidationService validationService;
|
||||
|
||||
private boolean isRegistrationForced;
|
||||
|
||||
|
||||
@Inject
|
||||
ListenerService(Settings settings, DataSource dataSource, PlayerCache playerCache,
|
||||
ValidationService validationService) {
|
||||
@@ -76,9 +79,18 @@ class ListenerService implements SettingsDependent {
|
||||
* @param player the player to verify
|
||||
* @return true if the associated event should be canceled, false otherwise
|
||||
*/
|
||||
|
||||
public boolean shouldCancelEvent(Player player) {
|
||||
|
||||
return player != null && !checkAuth(player.getName()) && !PlayerUtils.isNpc(player);
|
||||
}
|
||||
public boolean shouldCancelInvEvent(Player player) {
|
||||
try {
|
||||
return !AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA) || authmeApi.isRegistered(player.getName()) || GuiCaptchaHandler.closeReasonMap.containsKey(player)/* || !player.getOpenInventory().getTitle().equals("请验证你是真人")*/;
|
||||
} catch (Exception e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(Settings settings) {
|
||||
@@ -93,7 +105,7 @@ class ListenerService implements SettingsDependent {
|
||||
* @return true if the player may play, false otherwise
|
||||
*/
|
||||
private boolean checkAuth(String name) {
|
||||
if (validationService.isUnrestricted(name) || playerCache.isAuthenticated(name)) {
|
||||
if (validationService.isUnrestricted(name) || playerCache.isAuthenticated(name)){
|
||||
return true;
|
||||
}
|
||||
if (!isRegistrationForced && !dataSource.isAuthAvailable(name)) {
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.TeleportUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
public class LoginLocationFixListener implements Listener {
|
||||
@Inject
|
||||
private AuthMe plugin;
|
||||
@Inject
|
||||
private Messages messages;
|
||||
@Inject
|
||||
private Settings settings;
|
||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||
|
||||
public LoginLocationFixListener() {
|
||||
}
|
||||
|
||||
private static Material materialPortal = Material.matchMaterial("PORTAL");
|
||||
private final boolean isSmartAsyncTeleport = AuthMe.settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT);
|
||||
private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL);
|
||||
private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND);
|
||||
BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
|
||||
|
||||
static {
|
||||
if (materialPortal == null) {
|
||||
materialPortal = Material.matchMaterial("PORTAL_BLOCK");
|
||||
if (materialPortal == null) {
|
||||
materialPortal = Material.matchMaterial("NETHER_PORTAL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
|
||||
if (isFixPortalStuck) {
|
||||
if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) {
|
||||
return;
|
||||
}
|
||||
Block JoinBlock = JoinLocation.getBlock();
|
||||
boolean solved = false;
|
||||
for (BlockFace face : faces) {
|
||||
if (JoinBlock.getRelative(face).getType().equals(Material.AIR) && JoinBlock.getRelative(face).getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||
if (isSmartAsyncTeleport) {
|
||||
TeleportUtils.teleport(player, JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
|
||||
} else {
|
||||
player.teleport(JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
|
||||
}
|
||||
solved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!solved) {
|
||||
JoinBlock.getRelative(BlockFace.UP).breakNaturally();
|
||||
JoinBlock.breakNaturally();
|
||||
}
|
||||
messages.send(player, MessageKey.LOCATION_FIX_PORTAL);
|
||||
} else if (isFixGroundStuck) {
|
||||
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
|
||||
World world = player.getWorld();
|
||||
int MaxHeight = world.getMaxHeight();
|
||||
int MinHeight = world.getMinHeight();
|
||||
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
|
||||
return;
|
||||
}
|
||||
for (int i = MinHeight; i <= MaxHeight; i++) {
|
||||
JoinLocation.setY(i);
|
||||
Block JoinBlock = JoinLocation.getBlock();
|
||||
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
|
||||
&& JoinBlock.getType().equals(Material.AIR)
|
||||
&& JoinBlock.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||
if (JoinBlock.getRelative(BlockFace.DOWN).getType().equals(Material.LAVA)) {
|
||||
JoinBlock.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||
}
|
||||
if (isSmartAsyncTeleport) {
|
||||
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 0.1, 0.5));
|
||||
} else {
|
||||
player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5));
|
||||
}
|
||||
messages.send(player, MessageKey.LOCATION_FIX_UNDERGROUND);
|
||||
break;
|
||||
}
|
||||
if (i == MaxHeight) {
|
||||
if (isSmartAsyncTeleport) {
|
||||
TeleportUtils.teleport(player, JoinBlock.getLocation().add(0.5, 1.1, 0.5));
|
||||
} else {
|
||||
player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5));
|
||||
}
|
||||
messages.send(player, MessageKey.LOCATION_FIX_UNDERGROUND_CANT_FIX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,11 @@ import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.permission.AdminPermission;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
import fr.xephi.authme.service.AntiBotService;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.WhiteListService;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
@@ -48,8 +46,6 @@ public class OnJoinVerifier implements Reloadable {
|
||||
@Inject
|
||||
private AntiBotService antiBotService;
|
||||
@Inject
|
||||
private WhiteListService whiteListService;
|
||||
@Inject
|
||||
private ValidationService validationService;
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
@@ -85,18 +81,6 @@ public class OnJoinVerifier implements Reloadable {
|
||||
throw new FailedVerificationException(MessageKey.KICK_ANTIBOT);
|
||||
}
|
||||
}
|
||||
public void checkWhitelist(String name, boolean isAuthAvailable) throws FailedVerificationException {
|
||||
if (isAuthAvailable || permissionsManager.hasPermissionOffline(name, PlayerStatePermission.WHITELIST)) {
|
||||
return;
|
||||
} else {
|
||||
bukkitService.getOnlinePlayers().stream()
|
||||
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
|
||||
.forEach(player -> messages.send(player, MessageKey.WHITELIST_KICK, name));
|
||||
}
|
||||
if (whiteListService.shouldKick()) {
|
||||
throw new FailedVerificationException(MessageKey.KICK_WHITELIST);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether non-registered players should be kicked, and if so, whether the player should be kicked.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import fr.xephi.authme.data.QuickCommandsProtectionManager;
|
||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
@@ -18,6 +20,8 @@ import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.TeleportUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@@ -28,7 +32,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
//import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
@@ -50,9 +54,11 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
//import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
@@ -63,7 +69,11 @@ import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOW_UNAU
|
||||
/**
|
||||
* Listener class for player events.
|
||||
*/
|
||||
public class PlayerListener implements Listener {
|
||||
public class PlayerListener implements Listener{
|
||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
@@ -93,9 +103,12 @@ public class PlayerListener implements Listener {
|
||||
private PermissionsManager permissionsManager;
|
||||
@Inject
|
||||
private QuickCommandsProtectionManager quickCommandsProtectionManager;
|
||||
|
||||
|
||||
// Lowest priority to apply fast protection checks
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onAsyncPlayerPreLoginEventLowest(AsyncPlayerPreLoginEvent event) {
|
||||
|
||||
if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||
return;
|
||||
}
|
||||
@@ -111,9 +124,10 @@ public class PlayerListener implements Listener {
|
||||
if (validationService.isUnrestricted(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.getProperty(RestrictionSettings.HOOK_FLOODGATE_PLAYER) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())){
|
||||
return;
|
||||
if (settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER)) {
|
||||
if (getServer().getPluginManager().getPlugin("floodgate") != null) {
|
||||
if (org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())) return;
|
||||
}
|
||||
}
|
||||
// Non-blocking checks
|
||||
try {
|
||||
@@ -121,8 +135,8 @@ public class PlayerListener implements Listener {
|
||||
} catch (FailedVerificationException e) {
|
||||
event.setKickMessage(messages.retrieveSingle(name, e.getReason(), e.getArgs()));
|
||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -148,7 +162,6 @@ public class PlayerListener implements Listener {
|
||||
final PlayerAuth auth = dataSource.getAuth(name);
|
||||
final boolean isAuthAvailable = auth != null;
|
||||
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
||||
onJoinVerifier.checkWhitelist(name, isAuthAvailable);
|
||||
onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
||||
onJoinVerifier.checkNameCasing(name, auth);
|
||||
final String ip = event.getAddress().getHostAddress();
|
||||
@@ -185,7 +198,7 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||
if (!PlayerListener19Spigot.isPlayerSpawnLocationEventCalled()) {
|
||||
teleportationService.teleportOnJoin(player);
|
||||
}
|
||||
@@ -195,12 +208,15 @@ public class PlayerListener implements Listener {
|
||||
management.performJoin(player);
|
||||
|
||||
teleportationService.teleportNewPlayerToFirstSpawn(player);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH) // HIGH as EssentialsX listens at HIGHEST
|
||||
public void onJoinMessage(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
|
||||
// Note: join message can be null, despite api documentation says not
|
||||
if (settings.getProperty(RegistrationSettings.REMOVE_JOIN_MESSAGE)) {
|
||||
event.setJoinMessage(null);
|
||||
@@ -335,12 +351,12 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
/*
|
||||
* Limit player X and Z movements to 1 block
|
||||
* Limit player X and Z movements
|
||||
* Deny player Y+ movements (allows falling)
|
||||
*/
|
||||
|
||||
if (from.getBlockX() == to.getBlockX()
|
||||
&& from.getBlockZ() == to.getBlockZ()
|
||||
if (from.getX() == to.getX()
|
||||
&& from.getZ() == to.getZ()
|
||||
&& from.getY() - to.getY() >= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -363,9 +379,17 @@ public class PlayerListener implements Listener {
|
||||
Location spawn = spawnLoader.getSpawnLocation(player);
|
||||
if (spawn != null && spawn.getWorld() != null) {
|
||||
if (!player.getWorld().equals(spawn.getWorld())) {
|
||||
player.teleport(spawn);
|
||||
if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||
TeleportUtils.teleport(player,spawn);
|
||||
} else {
|
||||
player.teleport(spawn);
|
||||
}
|
||||
} else if (spawn.distance(player.getLocation()) > settings.getProperty(ALLOWED_MOVEMENT_RADIUS)) {
|
||||
player.teleport(spawn);
|
||||
if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||
TeleportUtils.teleport(player,spawn);
|
||||
} else {
|
||||
player.teleport(spawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,12 +480,12 @@ public class PlayerListener implements Listener {
|
||||
* Inventory interactions
|
||||
*/
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||
if (listenerService.shouldCancelEvent(event)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
// @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
// public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||
// if (listenerService.shouldCancelEvent(event)) {
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// }
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
@@ -489,15 +513,16 @@ public class PlayerListener implements Listener {
|
||||
return false;
|
||||
}
|
||||
Set<String> whitelist = settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES);
|
||||
//append a string for String whitelist
|
||||
return whitelist.contains(ChatColor.stripColor(inventory.getTitle()).toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
||||
final HumanEntity player = event.getPlayer();
|
||||
|
||||
Player ply = (Player) event.getPlayer();
|
||||
if (listenerService.shouldCancelEvent(player)
|
||||
&& !isInventoryWhitelisted(event.getView())) {
|
||||
&& !isInventoryWhitelisted(event.getView()) && listenerService.shouldCancelInvEvent(ply)) {
|
||||
event.setCancelled(true);
|
||||
|
||||
/*
|
||||
@@ -515,12 +540,12 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||
return;
|
||||
event.setCancelled(true);
|
||||
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||
}
|
||||
// @EventHandler(priority = EventPriority.LOWEST)
|
||||
// public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||
// Player player = event.getPlayer();
|
||||
// if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||
// return;
|
||||
// event.setCancelled(true);
|
||||
// Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class PlayerListenerHigherThan18 implements Listener {
|
||||
@Inject
|
||||
private ListenerService listenerService;
|
||||
|
||||
@Inject
|
||||
private Settings settings;
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||
if (listenerService.shouldCancelEvent(event)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if ((!player.isSneaking() || !player.hasPermission("keybindings.use")) &&
|
||||
settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if (settings.getProperty(PluginSettings.MENU_UNREGISTER_COMPATIBILITY)) {
|
||||
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,10 +114,6 @@ class InventoryPacketAdapter extends PacketAdapter {
|
||||
itemListModifier.write(0, Arrays.asList(blankInventory));
|
||||
}
|
||||
|
||||
try {
|
||||
protocolManager.sendServerPacket(player, inventoryPacket, false);
|
||||
} catch (InvocationTargetException invocationExc) {
|
||||
logger.logException("Error during sending blank inventory", invocationExc);
|
||||
}
|
||||
protocolManager.sendServerPacket(player, inventoryPacket, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,21 +4,88 @@ package fr.xephi.authme.message;
|
||||
* Keys for translatable messages managed by {@link Messages}.
|
||||
*/
|
||||
public enum MessageKey {
|
||||
/**
|
||||
* You have been disconnected due to doubled login.
|
||||
*/
|
||||
DOUBLE_LOGIN_FIX("double_login_fix.fix_message"),
|
||||
|
||||
/** In order to use this command you must be authenticated! */
|
||||
/**
|
||||
* You are stuck in portal during Login.
|
||||
*/
|
||||
LOCATION_FIX_PORTAL("login_location_fix.fix_portal"),
|
||||
|
||||
/**
|
||||
* You are stuck underground during Login.
|
||||
*/
|
||||
LOCATION_FIX_UNDERGROUND("login_location_fix.fix_underground"),
|
||||
|
||||
/**
|
||||
* You are stuck underground during Login, but we cant fix it.
|
||||
*/
|
||||
LOCATION_FIX_UNDERGROUND_CANT_FIX("login_location_fix.cannot_fix_underground"),
|
||||
|
||||
/**
|
||||
* Bedrock auto login success!
|
||||
*/
|
||||
BEDROCK_AUTO_LOGGED_IN("bedrock_auto_login.success"),
|
||||
|
||||
/**
|
||||
* %random Verification
|
||||
*/
|
||||
GUI_CAPTCHA_WINDOW_NAME("gui_captcha.captcha_window_name", "%random"),
|
||||
|
||||
/**
|
||||
* %random I am human
|
||||
*/
|
||||
GUI_CAPTCHA_CLICKABLE_NAME("gui_captcha.captcha_clickable_name", "%random"),
|
||||
|
||||
/**
|
||||
* Verification failed, you have %times retries left
|
||||
*/
|
||||
GUI_CAPTCHA_RETRY_MESSAGE("gui_captcha.message_on_retry", "%times"),
|
||||
|
||||
/**
|
||||
* Bedrock verification success!
|
||||
*/
|
||||
GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK("gui_captcha.bedrock_auto_verify_success"),
|
||||
|
||||
/**
|
||||
* Please be verified before chatting!
|
||||
*/
|
||||
GUI_CAPTCHA_DENIED_MESSAGE("gui_captcha.denied_message_sending"),
|
||||
|
||||
/**
|
||||
* Verification timed out!
|
||||
*/
|
||||
GUI_CAPTCHA_KICK_TIMEOUT("gui_captcha.kick_on_timeout"),
|
||||
|
||||
/**
|
||||
* Please complete the verification!
|
||||
*/
|
||||
GUI_CAPTCHA_KICK_FAILED("gui_captcha.kick_on_failed"),
|
||||
|
||||
/**
|
||||
* Verification success!
|
||||
*/
|
||||
GUI_CAPTCHA_VERIFIED("gui_captcha.success"),
|
||||
|
||||
/**
|
||||
* In order to use this command you must be authenticated!
|
||||
*/
|
||||
DENIED_COMMAND("error.denied_command"),
|
||||
|
||||
/** A player with the same IP is already in game! */
|
||||
/**
|
||||
* A player with the same IP is already in game!
|
||||
*/
|
||||
SAME_IP_ONLINE("on_join_validation.same_ip_online"),
|
||||
|
||||
/** In order to chat you must be authenticated! */
|
||||
/**
|
||||
* In order to chat you must be authenticated!
|
||||
*/
|
||||
DENIED_CHAT("error.denied_chat"),
|
||||
|
||||
/** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */
|
||||
KICK_ANTIBOT("antibot.kick_antibot"),
|
||||
KICK_WHITELIST("on_join_validation.kick_whitelist"),
|
||||
WHITELIST_ENABLED_MESSAGE("misc.whitelist_enabled"),
|
||||
WHITELIST_DISABLED_MESSAGE("misc.whitelist_disabled"),
|
||||
|
||||
/** This user isn't registered! */
|
||||
UNKNOWN_USER("error.unregistered_user"),
|
||||
@@ -38,6 +105,9 @@ public enum MessageKey {
|
||||
/** In-game registration is disabled! */
|
||||
REGISTRATION_DISABLED("registration.disabled"),
|
||||
|
||||
/** Logged-in due to Session Reconnection. */
|
||||
SESSION_RECONNECTION("session.valid_session"),
|
||||
|
||||
/** Successful login! */
|
||||
LOGIN_SUCCESS("login.success"),
|
||||
|
||||
@@ -80,6 +150,9 @@ public enum MessageKey {
|
||||
/** The chosen password isn't safe, please choose another one... */
|
||||
PASSWORD_UNSAFE_ERROR("password.unsafe_password"),
|
||||
|
||||
/** Your chosen password is not secure. It was used %pwned_count times already! Please use a stronger password... */
|
||||
PASSWORD_PWNED_ERROR("password.pwned_password", "%pwned_count"),
|
||||
|
||||
/** Your password contains illegal characters. Allowed chars: %valid_chars */
|
||||
PASSWORD_CHARACTERS_ERROR("password.forbidden_characters", "%valid_chars"),
|
||||
|
||||
@@ -199,7 +272,6 @@ public enum MessageKey {
|
||||
|
||||
/** [AntiBotService] AntiBot disabled after %m minutes! */
|
||||
ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"),
|
||||
WHITELIST_KICK("misc.whitelist_kick", "%p"),
|
||||
|
||||
/** The email address is already being used */
|
||||
EMAIL_ALREADY_USED_ERROR("email.already_used"),
|
||||
|
||||
@@ -149,6 +149,10 @@ public class MessageUpdater {
|
||||
.put("verification", "Verification code")
|
||||
.put("time", "Time units")
|
||||
.put("two_factor", "Two-factor authentication")
|
||||
.put("gui_captcha", "3rd party features: GUI Captcha")
|
||||
.put("bedrock_auto_login", "3rd party features: Bedrock Auto Login")
|
||||
.put("login_location_fix", "3rd party features: Login Location Fix")
|
||||
.put("double_login_fix", "3rd party features: Double Login Fix")
|
||||
.build();
|
||||
|
||||
Set<String> addedKeys = new HashSet<>();
|
||||
|
||||
@@ -30,6 +30,7 @@ final class OldMessageKeysMigrater {
|
||||
.put(MessageKey.WRONG_PASSWORD, "wrong_pwd")
|
||||
.put(MessageKey.UNREGISTERED_SUCCESS, "unregistered")
|
||||
.put(MessageKey.REGISTRATION_DISABLED, "reg_disabled")
|
||||
.put(MessageKey.SESSION_RECONNECTION, "valid_session")
|
||||
.put(MessageKey.ACCOUNT_NOT_ACTIVATED, "vb_nonActiv")
|
||||
.put(MessageKey.NAME_ALREADY_REGISTERED, "user_regged")
|
||||
.put(MessageKey.NO_PERMISSION, "no_perm")
|
||||
|
||||
@@ -124,7 +124,6 @@ public enum AdminPermission implements PermissionNode {
|
||||
* Permission to see Antibot messages.
|
||||
*/
|
||||
ANTIBOT_MESSAGES("authme.admin.antibotmessages"),
|
||||
WHITELIST_MESSAGE("authme.admin.whitelistmessage"),
|
||||
|
||||
/**
|
||||
* Permission to use the update messages command.
|
||||
|
||||
@@ -10,7 +10,6 @@ public enum PlayerStatePermission implements PermissionNode {
|
||||
* Permission node to bypass AntiBot protection.
|
||||
*/
|
||||
BYPASS_ANTIBOT("authme.bypassantibot", DefaultPermission.OP_ONLY),
|
||||
WHITELIST("authme.whitelist", DefaultPermission.OP_ONLY),
|
||||
|
||||
/**
|
||||
* Permission node to bypass BungeeCord server teleportation.
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Management {
|
||||
}
|
||||
|
||||
public void forceLogin(Player player) {
|
||||
runTask(() -> asynchronousLogin.forceLogin(player,0));
|
||||
runTask(() -> asynchronousLogin.forceLogin(player));
|
||||
}
|
||||
|
||||
public void forceLogin(Player player, boolean quiet) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.util.InternetProtocolUtils;
|
||||
@@ -129,16 +128,18 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
|
||||
// Session logic
|
||||
if (sessionService.canResumeSession(player)) {
|
||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
||||
// Run commands
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||
() -> commandManager.runCommandsOnSessionLogin(player));
|
||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
|
||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player));
|
||||
return;
|
||||
} else if (proxySessionManager.shouldResumeSession(name)) {
|
||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
||||
// Run commands
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||
() -> commandManager.runCommandsOnSessionLogin(player));
|
||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
|
||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player));
|
||||
logger.info("The user " + player.getName() + " has been automatically logged in, "
|
||||
+ "as present in autologin queue.");
|
||||
return;
|
||||
|
||||
@@ -102,7 +102,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
limboService.getLimboPlayer(player.getName()).setState(LimboPlayerState.TOTP_REQUIRED);
|
||||
// TODO #1141: Check if we should check limbo state before processing password
|
||||
} else {
|
||||
performLogin(player, auth, false);
|
||||
performLogin(player, auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,10 +112,10 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
*
|
||||
* @param player the player to log in
|
||||
*/
|
||||
public void forceLogin(Player player,int quiet) {
|
||||
public void forceLogin(Player player) {
|
||||
PlayerAuth auth = getPlayerAuth(player);
|
||||
if (auth != null) {
|
||||
performLogin(player, auth, quiet == 1);
|
||||
performLogin(player, auth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
public void forceLogin(Player player, boolean quiet) {
|
||||
PlayerAuth auth = getPlayerAuth(player, quiet);
|
||||
if (auth != null) {
|
||||
performLogin(player, auth, false);
|
||||
performLogin(player, auth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
* @param player the player to log in
|
||||
* @param auth the associated PlayerAuth object
|
||||
*/
|
||||
public void performLogin(Player player, PlayerAuth auth, boolean quiet) {
|
||||
public void performLogin(Player player, PlayerAuth auth) {
|
||||
if (player.isOnline()) {
|
||||
boolean isFirstLogin = (auth.getLastLogin() == null);
|
||||
|
||||
@@ -284,7 +284,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
||||
tempbanManager.resetCount(ip, name);
|
||||
player.setNoDamageTicks(0);
|
||||
|
||||
if (!quiet) {service.send(player, MessageKey.LOGIN_SUCCESS);}
|
||||
service.send(player, MessageKey.LOGIN_SUCCESS);
|
||||
|
||||
// Other auths
|
||||
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
|
||||
|
||||
+2
-2
@@ -89,9 +89,9 @@ abstract class AbstractPasswordRegisterExecutor<P extends AbstractPasswordRegist
|
||||
final Player player = params.getPlayer();
|
||||
if (performLoginAfterRegister(params)) {
|
||||
if (commonService.getProperty(PluginSettings.USE_ASYNC_TASKS)) {
|
||||
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player,0));
|
||||
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player));
|
||||
} else {
|
||||
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player,0), SYNC_LOGIN_DELAY);
|
||||
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player), SYNC_LOGIN_DELAY);
|
||||
}
|
||||
}
|
||||
syncProcessManager.processSyncPasswordRegister(player);
|
||||
|
||||
@@ -308,7 +308,7 @@ public class Whirlpool extends UnsaltedMethod {
|
||||
if (bufferRem + sourceBits < 8) {
|
||||
// all remaining data fits on buffer[bufferPos], and there still
|
||||
// remains some space.
|
||||
bufferBits += sourceBits;
|
||||
bufferBits += (int) sourceBits;
|
||||
} else {
|
||||
// buffer[bufferPos] is full:
|
||||
bufferPos++;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
// Delay the schedule on first start
|
||||
if (startup) {
|
||||
int delay = settings.getProperty(ProtectionSettings.ANTIBOT_DELAY);
|
||||
bukkitService.scheduleSyncDelayedTask(enableTask, delay * TICKS_PER_SECOND);
|
||||
bukkitService.scheduleSyncDelayedTask(enableTask, (long) delay * TICKS_PER_SECOND);
|
||||
startup = false;
|
||||
} else {
|
||||
enableTask.run();
|
||||
@@ -91,7 +91,7 @@ public class AntiBotService implements SettingsDependent {
|
||||
disableTask.cancel();
|
||||
}
|
||||
// Schedule auto-disable
|
||||
disableTask = bukkitService.runTaskLater(this::stopProtection, duration * TICKS_PER_MINUTE);
|
||||
disableTask = bukkitService.runTaskLater(this::stopProtection, (long) duration * TICKS_PER_MINUTE);
|
||||
antiBotStatus = AntiBotStatus.ACTIVE;
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
||||
// Inform admins
|
||||
|
||||
@@ -42,18 +42,21 @@ import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class GeoIpService {
|
||||
|
||||
private static final String LICENSE =
|
||||
"[LICENSE] This product includes GeoLite2 data created by MaxMind, available at https://www.maxmind.com";
|
||||
//private static final String LICENSE =
|
||||
//"[LICENSE] This product includes GeoLite2 data created by MaxMind, available at https://www.maxmind.com";
|
||||
|
||||
private static final String DATABASE_NAME = "GeoLite2-Country";
|
||||
private static final String DATABASE_FILE = DATABASE_NAME + ".mmdb";
|
||||
|
||||
|
||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(GeoIpService.class);
|
||||
private final Path dataFile;
|
||||
|
||||
private GeoIp2Provider databaseReader;
|
||||
private volatile boolean downloading;
|
||||
|
||||
@Inject
|
||||
GeoIpService(@DataFolder File dataFolder) {
|
||||
GeoIpService(@DataFolder File dataFolder){
|
||||
this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE);
|
||||
|
||||
// Fires download of recent data or the initialization of the look up service
|
||||
@@ -86,27 +89,63 @@ public class GeoIpService {
|
||||
if (Files.exists(dataFile)) {
|
||||
try {
|
||||
startReading();
|
||||
// don't fire the update task - we are up to date
|
||||
return true;
|
||||
} catch (IOException ioEx) {
|
||||
logger.logException("Failed to load GeoLiteAPI database", ioEx);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// File is outdated or doesn't exist - let's try to download the data file!
|
||||
// use bukkit's cached threads
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private void startReading() throws IOException {
|
||||
databaseReader = new Reader(dataFile.toFile(), FileMode.MEMORY, new CHMCache());
|
||||
logger.info(LICENSE);
|
||||
|
||||
// clear downloading flag, because we now have working reader instance
|
||||
downloading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the archive to the destination file if it's newer than the locally version.
|
||||
*
|
||||
* @param lastModified modification timestamp of the already present file
|
||||
* @param destination save file
|
||||
* @return null if no updates were found, the MD5 hash of the downloaded archive if successful
|
||||
* @throws IOException if failed during downloading and writing to destination file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Downloads the archive to the destination file if it's newer than the locally version.
|
||||
*
|
||||
* @param destination save file
|
||||
* @return null if no updates were found, the MD5 hash of the downloaded archive if successful
|
||||
* @throws IOException if failed during downloading and writing to destination file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Verify if the expected checksum is equal to the checksum of the given file.
|
||||
*
|
||||
* @param function the checksum function like MD5, SHA256 used to generate the checksum from the file
|
||||
* @param file the file we want to calculate the checksum from
|
||||
* @param expectedChecksum the expected checksum
|
||||
* @throws IOException on I/O error reading the file or the checksum verification failed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extract the database from gzipped data. Existing outputFile will be replaced if it already exists.
|
||||
*
|
||||
* @param inputFile gzipped database input file
|
||||
* @param outputFile destination file for the database
|
||||
* @throws IOException on I/O error reading the archive, or writing the output
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the country code of the given IP address.
|
||||
*
|
||||
|
||||
@@ -14,6 +14,8 @@ import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.TeleportUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -140,7 +142,7 @@ public class TeleportationService implements Reloadable {
|
||||
logger.debug("Teleporting `{0}` to spawn because of 'force-spawn after login'", player.getName());
|
||||
teleportToSpawn(player, true);
|
||||
} else if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION) && auth.getQuitLocY() != 0) {
|
||||
if (settings.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
|
||||
Location location = buildLocationFromAuth(player, auth);
|
||||
logger.debug("Teleporting `{0}` after login, based on the player auth", player.getName());
|
||||
teleportBackFromSpawn(player, location);
|
||||
@@ -184,7 +186,9 @@ public class TeleportationService implements Reloadable {
|
||||
private void performTeleportation(final Player player, final AbstractTeleportEvent event) {
|
||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
||||
bukkitService.callEvent(event);
|
||||
if (player.isOnline() && isEventValid(event)) {
|
||||
if (player.isOnline() && isEventValid(event) && settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||
TeleportUtils.teleport(player, event.getTo());
|
||||
} else if (player.isOnline() && isEventValid(event)) {
|
||||
player.teleport(event.getTo());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
import fr.xephi.authme.security.HashUtils;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
||||
@@ -21,6 +22,11 @@ import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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.inject.Inject;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -28,6 +34,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static fr.xephi.authme.util.StringUtils.isInsideString;
|
||||
@@ -84,7 +91,15 @@ public class ValidationService implements Reloadable {
|
||||
return new ValidationResult(MessageKey.INVALID_PASSWORD_LENGTH);
|
||||
} else if (settings.getProperty(SecuritySettings.UNSAFE_PASSWORDS).contains(passLow)) {
|
||||
return new ValidationResult(MessageKey.PASSWORD_UNSAFE_ERROR);
|
||||
} else if (settings.getProperty(SecuritySettings.HAVE_I_BEEN_PWNED_CHECK)) {
|
||||
HaveIBeenPwnedResults results = validatePasswordHaveIBeenPwned(password);
|
||||
if (results != null
|
||||
&& results.isPwned()
|
||||
&& results.getPwnCount() > settings.getProperty(SecuritySettings.HAVE_I_BEEN_PWNED_LIMIT)) {
|
||||
return new ValidationResult(MessageKey.PASSWORD_PWNED_ERROR, String.valueOf(results.getPwnCount()));
|
||||
}
|
||||
}
|
||||
|
||||
return new ValidationResult();
|
||||
}
|
||||
|
||||
@@ -225,6 +240,47 @@ public class ValidationService implements Reloadable {
|
||||
}
|
||||
return restrictions;
|
||||
}
|
||||
/**
|
||||
* Check haveibeenpwned.com for the given password.
|
||||
*
|
||||
* @param password password to check for
|
||||
* @return Results of the check
|
||||
*/
|
||||
public HaveIBeenPwnedResults validatePasswordHaveIBeenPwned(String password) {
|
||||
String hash = HashUtils.sha1(password);
|
||||
|
||||
String hashPrefix = hash.substring(0, 5);
|
||||
|
||||
try {
|
||||
String url = String.format("https://api.pwnedpasswords.com/range/%s", hashPrefix);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setRequestProperty("User-Agent", "AuthMeReloaded");
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setReadTimeout(5000);
|
||||
connection.setDoInput(true);
|
||||
StringBuilder outStr = new StringBuilder();
|
||||
|
||||
try (DataInputStream input = new DataInputStream(connection.getInputStream())) {
|
||||
for (int c = input.read(); c != -1; c = input.read())
|
||||
outStr.append((char) c);
|
||||
}
|
||||
|
||||
String[] hashes = outStr.toString().split("\n");
|
||||
for (String hashSuffix : hashes) {
|
||||
String[] hashSuffixParts = hashSuffix.trim().split(":");
|
||||
if (hashSuffixParts[0].equalsIgnoreCase(hash.substring(5))) {
|
||||
return new HaveIBeenPwnedResults(true, Integer.parseInt(hashSuffixParts[1]));
|
||||
}
|
||||
}
|
||||
return new HaveIBeenPwnedResults(false, 0);
|
||||
} catch (java.io.IOException e) {
|
||||
logger.warning("验证密码时出现错误,这可能是由于网络问题,如果无法解决,请关闭HaveIBeenPwned检查");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static final class ValidationResult {
|
||||
private final MessageKey messageKey;
|
||||
@@ -266,4 +322,22 @@ public class ValidationService implements Reloadable {
|
||||
return args;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class HaveIBeenPwnedResults {
|
||||
private final boolean isPwned;
|
||||
private final int pwnCount;
|
||||
|
||||
public HaveIBeenPwnedResults(boolean isPwned, int pwnCount) {
|
||||
this.isPwned = isPwned;
|
||||
this.pwnCount = pwnCount;
|
||||
}
|
||||
|
||||
public boolean isPwned() {
|
||||
return isPwned;
|
||||
}
|
||||
|
||||
public int getPwnCount() {
|
||||
return pwnCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
package fr.xephi.authme.service;
|
||||
|
||||
import fr.xephi.authme.initialization.SettingsDependent;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.message.Messages;
|
||||
import fr.xephi.authme.permission.AdminPermission;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* The AntiBot Service Management class.
|
||||
*/
|
||||
public class WhiteListService implements SettingsDependent {
|
||||
|
||||
private final PermissionsManager permissionsManager;
|
||||
private final Messages messages;
|
||||
private final BukkitService bukkitService;
|
||||
private WhiteListStatus whiteListStatus;
|
||||
|
||||
@Inject
|
||||
WhiteListService(Settings settings, Messages messages, PermissionsManager permissionsManager,
|
||||
BukkitService bukkitService) {
|
||||
// Instances
|
||||
this.messages = messages;
|
||||
this.permissionsManager = permissionsManager;
|
||||
this.bukkitService = bukkitService;
|
||||
// Initial status
|
||||
whiteListStatus = WhiteListStatus.DISABLED;
|
||||
// Load settings and start if required
|
||||
reload(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload(Settings settings) {
|
||||
}
|
||||
|
||||
private void startProtection() {
|
||||
if (whiteListStatus == WhiteListStatus.ACTIVE) {
|
||||
return;
|
||||
}
|
||||
whiteListStatus = WhiteListStatus.ACTIVE;
|
||||
bukkitService.getOnlinePlayers().stream()
|
||||
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
|
||||
.forEach(player -> messages.send(player, MessageKey.WHITELIST_ENABLED_MESSAGE));
|
||||
|
||||
}
|
||||
|
||||
private void stopProtection() {
|
||||
if (whiteListStatus == WhiteListStatus.DISABLED) {
|
||||
return;
|
||||
}
|
||||
whiteListStatus = WhiteListStatus.DISABLED;
|
||||
bukkitService.getOnlinePlayers().stream()
|
||||
.filter(player -> permissionsManager.hasPermission(player, AdminPermission.WHITELIST_MESSAGE))
|
||||
.forEach(player -> messages.send(player, MessageKey.WHITELIST_DISABLED_MESSAGE));
|
||||
}
|
||||
public WhiteListStatus getWhiteListStatus() {
|
||||
return whiteListStatus;
|
||||
}
|
||||
|
||||
public void overrideWhiteListStatus(boolean started) {
|
||||
if (started) {
|
||||
startProtection();
|
||||
} else {
|
||||
stopProtection();
|
||||
}
|
||||
}
|
||||
public boolean shouldKick() {
|
||||
return whiteListStatus != WhiteListStatus.DISABLED;
|
||||
}
|
||||
|
||||
public enum WhiteListStatus {
|
||||
DISABLED,
|
||||
ACTIVE
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,11 @@ public final class HooksSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> BUNGEECORD =
|
||||
newProperty("Hooks.bungeecord", false);
|
||||
|
||||
@Comment("Allow FloodGatePlayer Join Without checkIsValidName()")
|
||||
public static final Property<Boolean> HOOK_FLOODGATE_PLAYER =
|
||||
newProperty("Hooks.floodgate", false);
|
||||
|
||||
|
||||
@Comment("Send player to this BungeeCord server after register/login")
|
||||
public static final Property<String> BUNGEECORD_SERVER =
|
||||
newProperty("Hooks.sendPlayerTo", "");
|
||||
|
||||
@@ -8,6 +8,13 @@ import fr.xephi.authme.output.LogLevel;
|
||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||
|
||||
public final class PluginSettings implements SettingsHolder {
|
||||
@Comment({
|
||||
"Should we execute /help command when unregistered players press Shift+F?",
|
||||
"This keeps compatibility with some menu plugins",
|
||||
"If you are using TrMenu, don't enable this because TrMenu already implemented this."
|
||||
})
|
||||
public static final Property<Boolean> MENU_UNREGISTER_COMPATIBILITY =
|
||||
newProperty("3rdPartyFeature.compatibility.menuPlugins", true);
|
||||
|
||||
@Comment({
|
||||
"Do you want to enable the session feature?",
|
||||
@@ -20,12 +27,6 @@ public final class PluginSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> SESSIONS_ENABLED =
|
||||
newProperty("settings.sessions.enabled", true);
|
||||
|
||||
@Comment({
|
||||
"Do you want to hide login success message to player?"
|
||||
})
|
||||
public static final Property<Boolean> HIDE_SESSIONS_LOGIN =
|
||||
newProperty("settings.sessions.hidelogin", true);
|
||||
|
||||
@Comment({
|
||||
"After how many minutes should a session expire?",
|
||||
"A player's session ends after the timeout or if his IP has changed"
|
||||
|
||||
@@ -19,9 +19,7 @@ public final class ProtectionSettings implements SettingsHolder {
|
||||
@Comment("Apply the protection also to registered usernames")
|
||||
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
|
||||
newProperty("Protection.enableProtectionRegistered", true);
|
||||
@Comment("Only allow registed usernames join server")
|
||||
public static final Property<Boolean> ENABLE_WHITELIST =
|
||||
newProperty("Protection.enableWhiteList", true);
|
||||
|
||||
@Comment({
|
||||
"Countries allowed to join the server and register. For country codes, see",
|
||||
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
|
||||
|
||||
@@ -18,7 +18,7 @@ public final class RegistrationSettings implements SettingsHolder {
|
||||
"Send every X seconds a message to a player to",
|
||||
"remind him that he has to login/register"})
|
||||
public static final Property<Integer> MESSAGE_INTERVAL =
|
||||
newProperty("settings.registration.messageInterval", 600);
|
||||
newProperty("settings.registration.messageInterval", 5);
|
||||
|
||||
@Comment({
|
||||
"Only registered and logged in players can play.",
|
||||
@@ -33,7 +33,7 @@ public final class RegistrationSettings implements SettingsHolder {
|
||||
"More info at https://github.com/AuthMe/AuthMeReloaded/wiki/Registration"
|
||||
})
|
||||
public static final Property<RegistrationType> REGISTRATION_TYPE =
|
||||
newProperty(RegistrationType.class, "settings.registration.type", RegistrationType.EMAIL);
|
||||
newProperty(RegistrationType.class, "settings.registration.type", RegistrationType.PASSWORD);
|
||||
|
||||
@Comment({
|
||||
"Second argument the /register command should take: ",
|
||||
@@ -44,7 +44,7 @@ public final class RegistrationSettings implements SettingsHolder {
|
||||
})
|
||||
public static final Property<RegisterSecondaryArgument> REGISTER_SECOND_ARGUMENT =
|
||||
newProperty(RegisterSecondaryArgument.class, "settings.registration.secondArg",
|
||||
RegisterSecondaryArgument.NONE);
|
||||
RegisterSecondaryArgument.CONFIRMATION);
|
||||
|
||||
@Comment({
|
||||
"Do we force kick a player after a successful registration?",
|
||||
|
||||
@@ -4,6 +4,8 @@ import ch.jalu.configme.Comment;
|
||||
import ch.jalu.configme.SettingsHolder;
|
||||
import ch.jalu.configme.properties.Property;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -113,21 +115,19 @@ public final class RestrictionSettings implements SettingsHolder {
|
||||
|
||||
@Comment("Can unregistered players walk around?")
|
||||
public static final Property<Boolean> ALLOW_UNAUTHED_MOVEMENT =
|
||||
newProperty("settings.restrictions.allowMovement", true);
|
||||
newProperty("settings.restrictions.allowMovement", false);
|
||||
|
||||
@Comment({
|
||||
"After how many seconds should players who fail to login or register",
|
||||
"be kicked? Set to 0 to disable."})
|
||||
public static final Property<Integer> TIMEOUT =
|
||||
newProperty("settings.restrictions.timeout", 0);
|
||||
newProperty("settings.restrictions.timeout", 120);
|
||||
|
||||
@Comment("Regex pattern of allowed characters in the player name.")
|
||||
public static final Property<String> ALLOWED_NICKNAME_CHARACTERS =
|
||||
newProperty("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*");
|
||||
|
||||
@Comment("Allow FloodGatePlayer Join Without checkIsValidName()")
|
||||
public static final Property<Boolean> HOOK_FLOODGATE_PLAYER =
|
||||
newProperty("settings.restrictions.hookFloodGatePlayer", false);
|
||||
|
||||
@Comment({
|
||||
"How far can unregistered players walk?",
|
||||
"Set to 0 for unlimited radius"
|
||||
@@ -163,7 +163,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
||||
|
||||
@Comment("AuthMe will NEVER teleport players if set to true!")
|
||||
public static final Property<Boolean> NO_TELEPORT =
|
||||
newProperty("settings.restrictions.noTeleport", true);
|
||||
newProperty("settings.restrictions.noTeleport", false);
|
||||
|
||||
@Comment({
|
||||
"Regex syntax for allowed chars in passwords. The default [!-~] allows all visible ASCII",
|
||||
@@ -175,7 +175,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
||||
|
||||
@Comment("Regex syntax for allowed chars in email.")
|
||||
public static final Property<String> ALLOWED_EMAIL_REGEX =
|
||||
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9]{4,15}@(outlook|163|gmail|icloud).com$");
|
||||
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9_]{4,15}@(qq|outlook|163|gmail|icloud)\\.com$");
|
||||
|
||||
|
||||
@Comment("Force survival gamemode when player joins?")
|
||||
@@ -194,6 +194,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
||||
public static final Property<Set<String>> UNRESTRICTED_NAMES =
|
||||
newLowercaseStringSetProperty("settings.unrestrictions.UnrestrictedName");
|
||||
|
||||
|
||||
@Comment({
|
||||
"Below you can list all inventories names that AuthMe will ignore",
|
||||
"for registration or login. Configure it at your own risk!!",
|
||||
@@ -206,7 +207,9 @@ public final class RestrictionSettings implements SettingsHolder {
|
||||
public static final Property<Set<String>> UNRESTRICTED_INVENTORIES =
|
||||
newLowercaseStringSetProperty("settings.unrestrictions.UnrestrictedInventories");
|
||||
|
||||
|
||||
private RestrictionSettings() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,10 @@ import ch.jalu.configme.properties.Property;
|
||||
import fr.xephi.authme.security.HashAlgorithm;
|
||||
import fr.xephi.authme.settings.EnumSetProperty;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
|
||||
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||
|
||||
@@ -17,16 +19,91 @@ public final class SecuritySettings implements SettingsHolder {
|
||||
"Take care with this, if you set this to false,",
|
||||
"AuthMe will automatically disable and the server won't be protected!"})
|
||||
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
||||
newProperty("Security.SQLProblem.stopServer", true);
|
||||
newProperty("Security.SQLProblem.stopServer", false);
|
||||
|
||||
@Comment({"Should send GUI captcha by country code whitelist?",
|
||||
"If the country of the player is in this list, the captcha won't be sent."})
|
||||
public static final Property<List<String>> GUI_CAPTCHA_COUNTRY_WHITELIST =
|
||||
newListProperty("3rdPartyFeature.features.captcha.whiteList");
|
||||
|
||||
@Comment({"Should we let Bedrock players login automatically?",
|
||||
"(Requires hookFloodgate to be true & floodgate loaded)"})
|
||||
public static final Property<Boolean> FORCE_LOGIN_BEDROCK = newProperty("3rdPartyFeature.features.bedrockAutoLogin", false);
|
||||
|
||||
@Comment("Enable the new feature to prevent ghost players?")
|
||||
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
||||
|
||||
@Comment({"Choose the best teleport method by server brand?",
|
||||
"(Enable this if you are using Paper)"})
|
||||
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport", false);
|
||||
|
||||
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
|
||||
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.features.captcha.guiCaptcha", false);
|
||||
|
||||
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
|
||||
"(less than or equals 0 is disabled)"})
|
||||
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.features.captcha.timeOut", 0);
|
||||
|
||||
@Comment({"Should we ignore floodgate players when sending GUI captcha?",
|
||||
"(Requires floodgate and hookFloodgate: true)"})
|
||||
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.features.captcha.ignoreBedrock", false);
|
||||
|
||||
@Comment("Should we delete player data and stats when they didn't finish the captcha?")
|
||||
public static final Property<Boolean> DELETE_UNVERIFIED_PLAYER_DATA = newProperty("3rdPartyFeature.features.captcha.purgePlayerData", false);
|
||||
|
||||
@Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)")
|
||||
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.features.captcha.purgeWorldFolderName", "world");
|
||||
|
||||
@Comment("Should we fix the location when players logged in the portal?")
|
||||
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
||||
|
||||
@Comment("Should we fix the location when players logged underground?")
|
||||
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_UNDERGROUND = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixGroundStuck", false);
|
||||
|
||||
// @Comment({"Should we kick the players when they failed captcha too many times?",
|
||||
// "(Minimum value is 1)(Default: 3)"})
|
||||
// public static final Property<Integer> GUI_CAPTCHA_MAX_TRY = newProperty("3rdPartyFeature.captcha.maxTryTimes",3);
|
||||
|
||||
|
||||
//@Comment({"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?")
|
||||
public static final Property<Boolean> USE_LOGGING =
|
||||
newProperty("Security.console.logConsole", true);
|
||||
|
||||
@Comment({"Query haveibeenpwned.com with a hashed version of the password.",
|
||||
"This is used to check whether it is safe."})
|
||||
public static final Property<Boolean> HAVE_I_BEEN_PWNED_CHECK =
|
||||
newProperty("Security.account.haveIBeenPwned.check", false);
|
||||
|
||||
@Comment({"If the password is used more than this number of times, it is considered unsafe."})
|
||||
public static final Property<Integer> HAVE_I_BEEN_PWNED_LIMIT =
|
||||
newProperty("Security.account.haveIBeenPwned.limit", 0);
|
||||
|
||||
@Comment("Enable captcha when a player uses wrong password too many times")
|
||||
public static final Property<Boolean> ENABLE_LOGIN_FAILURE_CAPTCHA =
|
||||
newProperty("Security.captcha.useCaptcha", false);
|
||||
|
||||
@Comment("Check for updates on enabled from GitHub?")
|
||||
public static final Property<Boolean> CHECK_FOR_UPDATES =
|
||||
newProperty("Plugin.updates.checkForUpdates", true);
|
||||
|
||||
@Comment("Should we show the AuthMe banner on startup?")
|
||||
public static final Property<Boolean> SHOW_STARTUP_BANNER =
|
||||
newProperty("Plugin.banners.showBanners", true);
|
||||
|
||||
@Comment("Change the banner colors here (Default: §r)")
|
||||
public static final Property<String> STARTUP_BANNER_COLOR =
|
||||
newProperty("Plugin.banners.bannerColor", "§r");
|
||||
|
||||
@Comment("Max allowed tries before a captcha is required")
|
||||
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
||||
newProperty("Security.captcha.maxLoginTry", 8);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package fr.xephi.authme.util;
|
||||
|
||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.geysermc.cumulus.form.CustomForm;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class FormUtils {
|
||||
private static final FloodgateApi floodgateApi = FloodgateApi.getInstance();
|
||||
private static final AuthMeApi authMeApi = AuthMeApi.getInstance();
|
||||
|
||||
public static void openRegisterForm(Player player, String title, String text, String textBar) {
|
||||
String name = player.getName();
|
||||
UUID uuid = player.getUniqueId();
|
||||
CustomForm.Builder regForm = CustomForm.builder()
|
||||
.title(title)
|
||||
.input(text, textBar)
|
||||
.validResultHandler(((customForm1, customFormResponse) -> {
|
||||
authMeApi.registerPlayer(name, customFormResponse.asInput(0));
|
||||
}));
|
||||
floodgateApi.sendForm(uuid, regForm);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package fr.xephi.authme.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
public class TeleportUtils {
|
||||
private static Method teleportAsyncMethod;
|
||||
|
||||
static {
|
||||
try {//Detect Paper class
|
||||
Class<?> paperClass = Class.forName("com.destroystokyo.paper.PaperConfig");
|
||||
teleportAsyncMethod = Player.class.getMethod("teleportAsync", Location.class);
|
||||
teleportAsyncMethod.setAccessible(true);
|
||||
// if detected,use teleportAsync()
|
||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||
teleportAsyncMethod = null;
|
||||
//if not, set method to null
|
||||
}
|
||||
}
|
||||
|
||||
public static void teleport(Player player, Location location) {
|
||||
if (teleportAsyncMethod != null) {
|
||||
try {
|
||||
teleportAsyncMethod.invoke(player, location);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
player.teleport(location);
|
||||
}
|
||||
} else {
|
||||
player.teleport(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -41,10 +41,7 @@
|
||||
# executor: CONSOLE
|
||||
# ifNumberOfAccountsAtLeast: 5
|
||||
# Commands to run for players logging in whose 'last login date' was empty
|
||||
onFirstLogin:
|
||||
broadcast:
|
||||
command: 'cmi broadcast &b欢迎 &r%p &7( %ip ) &b光临服务器,请大家多多关照!'
|
||||
executor: CONSOLE
|
||||
onFirstLogin: {}
|
||||
onJoin: {}
|
||||
onLogin: {}
|
||||
# These commands are called whenever a logged in player uses /logout or quits.
|
||||
|
||||
@@ -102,8 +102,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p style="color:#b0adc5;">© 2023 IrisCraft. All rights reserved.</p>
|
||||
<a href="https://www.mcbbs.net/thread-1263385-1-1.html" target="_blank" style="text-decoration: none; font-size: 16px">iriscraft.work</a>
|
||||
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
|
||||
<a href="1919810.com" target="_blank"
|
||||
style="text-decoration: none; font-size: 16px">wdsj.io</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Сесията е продължена.'
|
||||
invalid_session: '&cТвоят IP се е променил и сесията беше прекратена.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -69,7 +69,7 @@ misc:
|
||||
|
||||
# Mensagens de sessão
|
||||
session:
|
||||
|
||||
valid_session: '&2Você deslogou recentemente, então sua sessão foi retomada!'
|
||||
invalid_session: '&fO seu IP foi alterado e sua sessão expirou!'
|
||||
|
||||
# Mensagens de erro ao entrar
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cAutomatické znovupřihlášení.'
|
||||
invalid_session: '&cChyba: Počkej než vyprší tvoje relace.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Erfolgreich eingeloggt!'
|
||||
invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -20,6 +20,7 @@ password:
|
||||
unsafe_password: '&cThe chosen password isn''t safe, please choose another one...'
|
||||
forbidden_characters: '&4Your password contains illegal characters. Allowed chars: %valid_chars'
|
||||
wrong_length: '&cYour password is too short or too long! Please try with another one!'
|
||||
pwned_password: '&cYour chosen password is not secure. It was used %pwned_count times already! Please use a strong password...'
|
||||
|
||||
# Login
|
||||
login:
|
||||
@@ -66,7 +67,7 @@ misc:
|
||||
# Session messages
|
||||
session:
|
||||
invalid_session: '&cYour IP has been changed and your session data has expired!'
|
||||
|
||||
valid_session: '&2Logged-in due to Session Reconnection.'
|
||||
|
||||
# Error messages when joining
|
||||
on_join_validation:
|
||||
@@ -154,3 +155,28 @@ time:
|
||||
hours: 'hours'
|
||||
day: 'day'
|
||||
days: 'days'
|
||||
|
||||
# 3rd party features: GUI Captcha
|
||||
gui_captcha:
|
||||
success: '&aVerification success!'
|
||||
bedrock_auto_verify_success: '&aBedrock verification success!'
|
||||
captcha_window_name: '%random Verification'
|
||||
captcha_clickable_name: '%random I am human'
|
||||
message_on_retry: '&cVerification failed, you have %times retries left'
|
||||
denied_message_sending: '&cPlease be verified before chatting!'
|
||||
kick_on_failed: '&cPlease complete the verification!'
|
||||
kick_on_timeout: '&cVerification timed out!'
|
||||
|
||||
# 3rd party features: Bedrock Auto Login
|
||||
bedrock_auto_login:
|
||||
success: '&aBedrock auto login success!'
|
||||
|
||||
# 3rd party features: Login Location Fix
|
||||
login_location_fix:
|
||||
fix_portal: '&aYou are stuck in portal during Login.'
|
||||
fix_underground: '&aYou are stuck underground during Login.'
|
||||
cannot_fix_underground: '&aYou are stuck underground during Login, but we cant fix it.'
|
||||
|
||||
# 3rd party features: Double Login Fix
|
||||
double_login_fix:
|
||||
fix_message: '&cYou have been disconnected due to doubled login.'
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Ensalutantojn pro Sesio Rekonektas.'
|
||||
invalid_session: '&cVia IP estis ŝanĝita kaj via seanco datumoj finiĝis!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -67,7 +67,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cInicio de sesión'
|
||||
invalid_session: '&fLos datos de sesión no corresponden. Por favor espera a terminar la sesión.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
# Session messages
|
||||
session:
|
||||
invalid_session: '&cSinu IP-aadress muutus, seega sinu sessioon aegus!'
|
||||
|
||||
valid_session: '&2Sisse logitud sessiooni jätkumise tõttu.'
|
||||
|
||||
# Error messages when joining
|
||||
on_join_validation:
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cSesioa mantendu eta beraz ez daukazu saioa hasi beharrik.'
|
||||
invalid_session: '&cZure IP helbidea aldatu da, eta horregatik zure sesioa iraungi da!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cIstunto jatkettu!'
|
||||
invalid_session: '&fIstunto ei täsmää! Ole hyvä ja odota istunnon loppuun'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -69,7 +69,7 @@ misc:
|
||||
|
||||
# Session
|
||||
session:
|
||||
|
||||
valid_session: '&aVous avez été automatiquement connecté !'
|
||||
invalid_session: 'Session expirée suite à un changement d''IP.'
|
||||
|
||||
# Erreurs lors d'une tentative connexion
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cIdentificado mediante a sesión'
|
||||
invalid_session: '&fOs datos de sesión non corresponden, por favor, espere a que remate a sesión'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2A megadott időkereten belül csatlakoztál vissza, így a rendszer automatikusan beléptetett.'
|
||||
invalid_session: '&cAz IP címed megváltozott, ezért a visszacsatlakozási időkereted lejárt.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Otomatis login, karena sesi masih terhubung.'
|
||||
invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -67,7 +67,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Autenticato automaticamente attraverso la precedente sessione!'
|
||||
invalid_session: '&cIl tuo indirizzo IP è cambiato e la tua sessione è stata terminata!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -68,7 +68,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2세션 재 연결로 인해 로그인 되었습니다.'
|
||||
invalid_session: '&cIP가 변경되어 세션이 만료되었습니다!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&aSesijos prisijungimas'
|
||||
invalid_session: '&cSesijos laikai nesutampa, prasome palaukti kol secija baigsis.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Ingelogd wegens sessie-herverbinding.'
|
||||
invalid_session: '&cJouw IP-adres is veranderd en je sessie is verlopen!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&aZalogowano automatycznie z powodu sesji logowania.'
|
||||
invalid_session: '&fSesja logowania zakończona!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cSessão válida'
|
||||
invalid_session: '&fDados de sessão não correspondem. Por favor aguarde o fim da sessão'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
# Session messages
|
||||
session:
|
||||
invalid_session: '&cIP-ul tau a fost schimbat si sesiunea ta a expirat!'
|
||||
|
||||
valid_session: '&2Conectat datorita reconectarii sesiunii.'
|
||||
|
||||
# Error messages when joining
|
||||
on_join_validation:
|
||||
|
||||
@@ -61,7 +61,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Вы автоматически авторизовались!'
|
||||
invalid_session: '&cСессия некорректна. Дождитесь, пока она закончится.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -65,7 +65,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Uspešna povezava.'
|
||||
invalid_session: '&cVas IP je bil spremenjen in vasa seja je potekla!'
|
||||
|
||||
# Error messages when joining
|
||||
@@ -154,3 +154,4 @@ time:
|
||||
hours: 'ure'
|
||||
day: 'dan'
|
||||
days: 'dni'
|
||||
|
||||
@@ -72,7 +72,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&cAutomatické prihlásenie z dôvodu pokračovania relácie.'
|
||||
invalid_session: '&fTvoja IP sa zmenila a tvoje prihlásenie(relácia) vypršalo(/a).'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Ulogovani ste zbog ponovnog povezivanja sesije.'
|
||||
invalid_session: '&cVaš IP je promenjen i vaši podaci o sesiji su istekli!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Oturuma girisiniz otomatikmen yapilmistir.'
|
||||
invalid_session: '&cIP adresin degistirildi ve oturum suren doldu!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Сесію відновлено.'
|
||||
invalid_session: '&cСесію було розірвано внаслідок зміни IP.'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2Phiên đăng nhập đã được kết nối trở lại.'
|
||||
invalid_session: '&cIP của bạn đã bị thay đổi và phiên đăng nhập của bạn đã hết hạn!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
registration:
|
||||
disabled: '&c注册已被禁止'
|
||||
name_taken: '&c此用户已经在此服务器注册过'
|
||||
register_request: '&7请输入“/register <邮箱>”以注册'
|
||||
command_usage: '&c正确用法:“/register <邮箱>”'
|
||||
register_request: '&b请输入“&a/reg <密码> <重复密码>&b”以注册'
|
||||
command_usage: '&c正确用法:“/reg <密码> <重复密码>”'
|
||||
reg_only: '&c只允许注册过的玩家进服!'
|
||||
success: '&a*** 已成功注册 ***'
|
||||
|
||||
@@ -19,13 +19,14 @@ password:
|
||||
unsafe_password: '&c您不能使用安全性过低的密码。 '
|
||||
forbidden_characters: '&4您的密码包含了非法字符.可使用的字符: %valid_chars'
|
||||
wrong_length: '&4您的密码没有达到要求!'
|
||||
pwned_password: '&c你使用的密码并不安全。它已经被使用了 %pwned_count 次! 请使用一个更强大的密码...'
|
||||
|
||||
# Login
|
||||
login:
|
||||
command_usage: '&c正确用法:“/login <密码>”'
|
||||
command_usage: '&c正确用法:“/l <密码>”'
|
||||
wrong_password: '&c*** 密码错误 ***'
|
||||
success: '&a*** 已成功登录 ***'
|
||||
login_request: '&c请输入“/login <密码>”以登录'
|
||||
login_request: '&c请输入“/l <密码>”以登录'
|
||||
timeout_error: '给您登录的时间已经过了'
|
||||
|
||||
# Errors
|
||||
@@ -65,12 +66,10 @@ misc:
|
||||
usage_change_password: '&a正确用法:“/changepassword 旧密码 新密码”'
|
||||
accounts_owned_self: '您拥有 %count 个账户:'
|
||||
accounts_owned_other: '玩家 %name 拥有 %count 个账户:'
|
||||
whitelist_enabled: '&c*** 服务器已暂停注册 ***'
|
||||
whitelist_disabled: '&a*** 服务器已开放注册 ***'
|
||||
whitelist_kick: '&7玩家 &c%p &7请求加入服务器,但是被拒绝了.'
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
valid_session: ''
|
||||
invalid_session: '&c*** 请重新登录 ***'
|
||||
|
||||
# Error messages when joining
|
||||
@@ -90,10 +89,7 @@ on_join_validation:
|
||||
&c如果您并不知情,请更换您的用户名重新加入该服务器.
|
||||
invalid_name_case: '&c您应该使用 %valid 登录服务器,当前名字: %invalid .'
|
||||
quick_command: '&c您发送命令的速度太快了,请重新加入服务器等待一会后再使用命令'
|
||||
kick_whitelist: |-
|
||||
&6[&b&lAccount Security System&6]
|
||||
&c本服务器已经暂停注册,请用下面的联系方式了解详细情况.
|
||||
&cQQ群聊号码: 550984860 &b| &c QQ: 2125368097 &b| &cTelegram: @Stabrinai
|
||||
|
||||
# Email
|
||||
email:
|
||||
add_email_request: ''
|
||||
@@ -158,13 +154,40 @@ time:
|
||||
|
||||
# Two-factor authentication
|
||||
two_factor:
|
||||
code_created: '&7您正在激活双重验证, 请打开 &a%url &7扫描二维码'
|
||||
confirmation_required: '&7请输入“/totp confirm <验证码>”来确认激活双重验证'
|
||||
code_required: '&c请输入“/totp code <验证码>”来提交验证码'
|
||||
already_enabled: '&a双重验证已启用'
|
||||
enable_error_no_code: '&c验证码丢失'
|
||||
enable_success: '&a已成功启用双重验证'
|
||||
enable_error_wrong_code: '&c验证码错误或者已经过期,请重新执行“/totp add”'
|
||||
not_enabled_error: '&c双重验证未在您的账号上启用,请使用“/totp add”来启用'
|
||||
removed_success: '&c双重验证已从您的账号上禁用'
|
||||
invalid_code: '&c无效的验证码'
|
||||
code_created: '&7您正在激活双重验证, 请打开 &a%url &7扫描二维码'
|
||||
confirmation_required: '&7请输入“/totp confirm <验证码>”来确认激活双重验证'
|
||||
code_required: '&c请输入“/totp code <验证码>”来提交验证码'
|
||||
already_enabled: '&a双重验证已启用'
|
||||
enable_error_no_code: '&c验证码丢失'
|
||||
enable_success: '&a已成功启用双重验证'
|
||||
enable_error_wrong_code: '&c验证码错误或者已经过期,请重新执行“/totp add”'
|
||||
not_enabled_error: '&c双重验证未在您的账号上启用,请使用“/totp add”来启用'
|
||||
removed_success: '&c双重验证已从您的账号上禁用'
|
||||
invalid_code: '&c无效的验证码'
|
||||
|
||||
# 3rd party features: GUI Captcha
|
||||
gui_captcha:
|
||||
success: '&a*** 验证完成 ***'
|
||||
bedrock_auto_verify_success: '&a*** 基岩版自动验证完成 ***'
|
||||
captcha_window_name: '&k%random&r&n请验证你是真人'
|
||||
captcha_clickable_name: '&k%random&r&n我是真人'
|
||||
message_on_retry: '&c验证失败,你还有 %times 次机会'
|
||||
denied_message_sending: '&c请先完成验证再聊天!'
|
||||
kick_on_failed: '&c请先完成验证!'
|
||||
kick_on_timeout: '&c验证超时'
|
||||
|
||||
# 3rd party features: Bedrock Auto Login
|
||||
bedrock_auto_login:
|
||||
success: "&a基岩版自动登录完成"
|
||||
|
||||
# 3rd party features: Login Location Fix
|
||||
login_location_fix:
|
||||
fix_portal: '&a你在登录时卡在了地狱门, 现已修正'
|
||||
fix_underground: '&a你被埋住了, 坐标已修正, 下次下线之前请小心!'
|
||||
cannot_fix_underground: '&a你被埋住了, 坐标无法修正, 只好送你去了最高点, 自求多福吧少年~'
|
||||
|
||||
# 3rd party features: Double Login Fix
|
||||
double_login_fix:
|
||||
fix_message: '&a已修复幽灵玩家, 请重新进入'
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&8[&6用戶系統&8] &b嗨 ! 歡迎回來喔~'
|
||||
invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞,請等待登入階段結束。'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -66,7 +66,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&2由於會話重新連接而登錄.'
|
||||
invalid_session: '&c您的IP已更改,並且您的會話數據已過期!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -68,7 +68,7 @@ misc:
|
||||
|
||||
# Session messages
|
||||
session:
|
||||
|
||||
valid_session: '&b【AuthMe】&6您已經成功登入!'
|
||||
invalid_session: '&b【AuthMe】&6Session驗證不相符!'
|
||||
|
||||
# Error messages when joining
|
||||
|
||||
@@ -108,8 +108,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p style="color:#b0adc5;">© 2023 IrisCraft. All rights reserved.</p>
|
||||
<a href="https://www.mcbbs.net/thread-1263385-1-1.html" target="_blank" style="text-decoration: none; font-size: 16px">iriscraft.work</a>
|
||||
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
|
||||
<a href="1919810.com" target="_blank"
|
||||
style="text-decoration: none; font-size: 16px">wdsj.io</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
name: ${pluginDescription.name}
|
||||
authors: [${pluginDescription.authors}]
|
||||
website: ${project.url}
|
||||
description: ${project.description}
|
||||
website: http://github.com/HaHaWTH/AuthMeReReloaded/
|
||||
description: A fork of AuthMeReloaded that contains bug fixes
|
||||
main: ${pluginDescription.main}
|
||||
version: ${pluginDescription.version}
|
||||
version: 5.6.0-FORK-b34
|
||||
api-version: 1.13
|
||||
softdepend:
|
||||
- Vault
|
||||
@@ -28,7 +28,6 @@ commands:
|
||||
usage: /login <password>
|
||||
aliases:
|
||||
- l
|
||||
- log
|
||||
logout:
|
||||
description: Logout command
|
||||
usage: /logout
|
||||
@@ -184,9 +183,6 @@ permissions:
|
||||
authme.bypassantibot:
|
||||
description: Permission node to bypass AntiBot protection.
|
||||
default: op
|
||||
authme.whitelist:
|
||||
description: Permission node to whitelist.
|
||||
default: op
|
||||
authme.bypasscountrycheck:
|
||||
description: Permission to bypass the GeoIp country code check.
|
||||
default: false
|
||||
|
||||
@@ -101,8 +101,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p style="color:#b0adc5;">© 2023 IrisCraft. All rights reserved.</p>
|
||||
<a href="https://www.mcbbs.net/thread-1263385-1-1.html" target="_blank" style="text-decoration: none; font-size: 16px">iriscraft.work</a>
|
||||
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
|
||||
<a href="1919810.com" target="_blank"
|
||||
style="text-decoration: none; font-size: 16px">wdsj.io</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -99,8 +99,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p style="color:#b0adc5;">© 2023 IrisCraft. All rights reserved.</p>
|
||||
<a href="https://www.mcbbs.net/thread-1263385-1-1.html" target="_blank" style="text-decoration: none; font-size: 16px">iriscraft.work</a>
|
||||
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
|
||||
<a href="1919810.com" target="_blank"
|
||||
style="text-decoration: none; font-size: 16px">wdsj.io</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -101,8 +101,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p style="color:#b0adc5;">© 2023 IrisCraft. All rights reserved.</p>
|
||||
<a href="https://www.mcbbs.net/thread-1263385-1-1.html" target="_blank" style="text-decoration: none; font-size: 16px">iriscraft.work</a>
|
||||
<p style="color:#b0adc5;">© 2023 HomoCraft. All rights reserved.</p>
|
||||
<a href="1919810.com" target="_blank"
|
||||
style="text-decoration: none; font-size: 16px">wdsj.io</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user