Compare commits
74 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 912e607144 | |||
| af71f9f5fe | |||
| 53d4206271 | |||
| 110fc7266d | |||
| b1bee0967c | |||
| e9481db633 | |||
| 82f29af1ae | |||
| 7e5d9ed1e8 | |||
| 55152a62c4 | |||
| 1b12d1b7d5 | |||
| 527f7f21c7 | |||
| 0205f585df | |||
| d44792baa5 | |||
| 68ac58686d | |||
| 25caa602fd | |||
| b36590c827 | |||
| af22c47017 | |||
| bf5928e841 | |||
| ebf8d55d60 | |||
| 9bb99ed355 | |||
| eaa30cc5eb | |||
| 4046105e87 | |||
| e782cccf72 | |||
| eaa0fba587 | |||
| cc248c3459 | |||
| ab24793861 | |||
| 25ebbf6f20 | |||
| d3e463165d | |||
| a459e6bad8 | |||
| 6a91130aa8 | |||
| d25949fc3b | |||
| f63f00fade | |||
| 19c18987f6 | |||
| db1650c27f | |||
| f45696f82f | |||
| 1c1879ea01 | |||
| 812762db25 | |||
| a4bf7adb60 | |||
| 11c5237950 | |||
| bc43afe3d0 | |||
| ced3d17537 | |||
| d9b3c59f30 | |||
| 8c286ceceb | |||
| 2ce6b066cc | |||
| 585b69ecd2 | |||
| 17187b05c1 | |||
| 6f193f05ce | |||
| a626265b09 | |||
| bda8613f93 | |||
| 44136bb91f | |||
| 69514738f7 | |||
| 220b31bb99 | |||
| 3b58a0acc9 | |||
| 5efa360cb2 | |||
| 2269c93dee | |||
| bf6233c024 | |||
| 3cc6f535a8 | |||
| 95d9edddeb | |||
| 4a559a7ccf | |||
| baaabb22d4 | |||
| 9e39f4a186 | |||
| c2b7a693b2 | |||
| 0e1e65c7f7 | |||
| d33f838f3a | |||
| 393449e08e | |||
| bdf7816306 | |||
| e109094472 | |||
| ea1af80ea4 | |||
| 674d72c113 | |||
| 912646c041 | |||
| 4ca879b08a | |||
| 2d4b2381ff | |||
| bbfce5bcfd | |||
| cfca8ccd85 |
@@ -0,0 +1,34 @@
|
|||||||
|
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
|
||||||
|
|
||||||
|
name: Maven Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'temurin'
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
|
- name: Publish to GitHub Packages Apache Maven
|
||||||
|
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
@@ -7,11 +7,11 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
Build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
jdkversion: [11]
|
jdkversion: [11]
|
||||||
runs-on: ubuntu-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
@@ -19,5 +19,6 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: ${{ matrix.jdkversion }}
|
java-version: ${{ matrix.jdkversion }}
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
- name: Build with Maven
|
- name: 使用Maven构建
|
||||||
run: mvn -V -B clean package --file pom.xml
|
run: mvn -V -B clean package --file pom.xml
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ hs_err_pid*
|
|||||||
|
|
||||||
# Include the project's code style settings file
|
# Include the project's code style settings file
|
||||||
!.idea/codeStyleSettings.xml
|
!.idea/codeStyleSettings.xml
|
||||||
|
/target/class/
|
||||||
# File-based project format:
|
# File-based project format:
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
|||||||
@@ -1,144 +1,21 @@
|
|||||||
# AuthMeReloaded
|
# AuthMeReReloaded
|
||||||
**"The best authentication plugin for the Bukkit modding API!"**
|
**"A Fork of Authme that contains many bug fixes!"**
|
||||||
|
**请前往Releases下载最新版本**(**Download the latest version from Releases**)
|
||||||
<img src="wallpaper.png?raw=true" alt="AuthMeLogo"/>
|
|
||||||
|
|
||||||
| Type | Badges |
|
|
||||||
|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| **General:** |   |
|
|
||||||
| **Code quality:** | [](https://codeclimate.com/github/AuthMe/AuthMeReloaded) [](https://coveralls.io/github/AuthMe-Team/AuthMeReloaded?branch=master) |
|
|
||||||
| **Jenkins CI:** | [](https://ci.codemc.org/) [](https://ci.codemc.org/job/AuthMe/job/AuthMeReloaded)  |
|
|
||||||
| **Other CIs:** | [](https://www.travis-ci.com/AuthMe/AuthMeReloaded) |
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
Prevent username stealing on your server!<br>
|
|
||||||
Use it to secure your Offline mode server or to increase your Online mode server's protection!
|
|
||||||
|
|
||||||
AuthMeReloaded disallows players who aren't authenticated to do actions like placing blocks, moving,<br>
|
|
||||||
typing commands or using the inventory. It can also kick players with uncommonly long or short player names or kick players from banned countries.
|
|
||||||
|
|
||||||
With the Session Login feature you don't have to execute the authentication command every time you connect to the server!
|
|
||||||
Each command and every feature can be enabled or disabled from our well structured configuration file.
|
|
||||||
|
|
||||||
You can also create your own translation file and, if you want, you can share it with us! :)
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
<ul>
|
|
||||||
<li><strong>E-Mail Recovery System!</strong></li>
|
|
||||||
<li>Username spoofing protection.</li>
|
|
||||||
<li>Countries Whitelist/Blacklist! <a href="https://dev.maxmind.com/geoip/legacy/codes/iso3166/">(country codes)</a></li>
|
|
||||||
<li><strong>Built-in AntiBot System!</strong></li>
|
|
||||||
<li><strong>ForceLogin Feature: Admins can login with all account via console command!</strong></li>
|
|
||||||
<li><strong>Avoid the "Logged in from another location" message!</strong></li>
|
|
||||||
<li>Two-factor (2FA) support!</li>
|
|
||||||
<li>Session Login!</li>
|
|
||||||
<li>Editable translations and messages!</li>
|
|
||||||
<li><strong>MySQL and SQLite Backend support!</strong></li>
|
|
||||||
<li>Supported password encryption algorithms: SHA256, ARGON2, BCRYPT, PBKDF2, <a href="https://github.com/CypherX/xAuth/wiki/Password-Hashing">xAuth</a></li>
|
|
||||||
<li>Supported alternative registration methods:<br>
|
|
||||||
<ul>
|
|
||||||
<li>PHPBB, VBulletin: PHPBB - MD5VB</li>
|
|
||||||
<li>Xenforo: XFBCRYPT</li>
|
|
||||||
<li>MyBB: MYBB</li>
|
|
||||||
<li>IPB3: IPB3</li>
|
|
||||||
<li>IPB4: IPB4</li>
|
|
||||||
<li>PhpFusion: PHPFUSION</li>
|
|
||||||
<li>Joomla: JOOMLA</li>
|
|
||||||
<li>WBB3: WBB3*</li>
|
|
||||||
<li>SHA512: SALTEDSHA512</li>
|
|
||||||
<li>DoubleSaltedMD5: SALTED2MD5</li>
|
|
||||||
<li>WordPress: WORDPRESS</li>
|
|
||||||
<li><a href="https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/hash_algorithms.md">List of all supported hashes</a></li>
|
|
||||||
</ul></li>
|
|
||||||
<li>Custom MySQL tables/columns names (useful with forum databases)</li>
|
|
||||||
<li><strong>Cached database queries!</strong></li>
|
|
||||||
<li><strong>Fully compatible with Citizens2, CombatTag, CombatTagPlus!</strong></li>
|
|
||||||
<li>Compatible with Minecraft mods like <strong>BuildCraft or RedstoneCraft</strong></li>
|
|
||||||
<li>Restricted users (associate a username with an IP)</li>
|
|
||||||
<li>Protect player's inventory until correct authentication (requires ProtocolLib)</li>
|
|
||||||
<li>Saves the quit location of the player</li>
|
|
||||||
<li>Automatic database backup</li>
|
|
||||||
<li>Available languages: <a href="https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md">translations</a></li>
|
|
||||||
<li>Built-in Deprecated FlatFile (auths.db) to SQL (authme.sql) converter!</li>
|
|
||||||
<li><strong>Import your old database from other plugins like Rakamak, xAuth, CrazyLogin, RoyalAuth and vAuth!</strong></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
[How to configure AuthMe](https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/config.md)
|
|
||||||
#### Commands
|
|
||||||
[Command list and usage](https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/commands.md)
|
|
||||||
#### Permissions
|
|
||||||
- authme.player.* - for all user commands
|
|
||||||
- authme.admin.* - for all admin commands
|
|
||||||
- [List of all permission nodes](http://github.com/AuthMe/AuthMeReloaded/blob/master/docs/permission_nodes.md)
|
|
||||||
|
|
||||||
#### How To
|
|
||||||
- [How to use the converter](https://github.com/AuthMe/AuthMeReloaded/wiki/Converters)
|
|
||||||
- [How to import database from xAuth](https://dev.bukkit.org/projects/authme-reloaded/pages/how-to-import-database-from-xauth)
|
|
||||||
- [Website integration](https://github.com/AuthMe/AuthMeReloaded/tree/master/samples/website_integration)
|
|
||||||
- [How to convert from Rakamak](https://dev.bukkit.org/projects/authme-reloaded/pages/how-to-import-database-from-rakamak)
|
|
||||||
- Convert between database types (e.g. SQLite to MySQL): /authme converter
|
|
||||||
|
|
||||||
|
|
||||||
## Links and Contacts
|
|
||||||
|
|
||||||
- **Support:**
|
|
||||||
- [GitHub issue tracker](https://github.com/AuthMe/AuthMeReloaded/issues)
|
|
||||||
- [Discord](https://discord.gg/Vn9eCyE)
|
|
||||||
- [BukkitDev page](https://dev.bukkit.org/projects/authme-reloaded)
|
|
||||||
- [Spigot page](https://www.spigotmc.org/resources/authmereloaded.6269/)
|
|
||||||
|
|
||||||
- **Dev resources:**
|
Changes to the original AuthMe(相较于原版AuthMe的变化):
|
||||||
- <a href="https://ci.codemc.org/job/AuthMe/job/AuthMeReloaded/javadoc/">JavaDocs</a>
|
1.Memory improvement
|
||||||
- <a href="http://repo.codemc.org/repository/maven-public/">Maven Repository</a>
|
2.Fixed GeoIP database
|
||||||
```xml
|
3.Hook floodgate
|
||||||
<repositories>
|
4.Choose the best performance method by server brand
|
||||||
<repository>
|
5.Anti ghost player
|
||||||
<id>codemc-repo</id>
|
6.GUI captcha for unregistered players
|
||||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
7.Block unsafe passwords by querying API
|
||||||
</repository>
|
8.Self hash check to prevent jar virus infection(abandoned)
|
||||||
</repositories>
|
9.Updater
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>fr.xephi</groupId>
|
|
||||||
<artifactId>authme</artifactId>
|
|
||||||
<version>5.6.0-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Statistics:**
|
**Known Folia issue**
|
||||||

|
1.If the teleport distance too far away,the player may be frozen
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
##### Compiling requirements:
|
|
||||||
>- JDK 11 (JDK 17 is recommended)
|
|
||||||
>- Maven
|
|
||||||
>- Git/Github (Optional)
|
|
||||||
|
|
||||||
##### How to compile the project:
|
|
||||||
>- Clone the project with Git/GitHub
|
|
||||||
>- Execute command "mvn clean package"
|
|
||||||
|
|
||||||
##### Running requirements:
|
|
||||||
>- Java 8 (Java 17 is recommended)
|
|
||||||
>- Paper or Spigot (1.8.X and up)<br>
|
|
||||||
(In case you use Thermos, Cauldron or similar, you have to update the SpecialSource library to support Java 8 plugins.
|
|
||||||
HowTo: https://github.com/games647/FastLogin/issues/111#issuecomment-272331347)
|
|
||||||
>- ProtocolLib (optional, required by some features)
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
##### Contributors:
|
|
||||||
Team members: <a href="https://github.com/AuthMe/AuthMeReloaded/wiki/Development-team">developers</a>, <a href="https://github.com/AuthMe/AuthMeReloaded/wiki/Translators">translators</a>
|
|
||||||
|
|
||||||
Credits for the old version of the plugin: d4rkwarriors, fabe1337, Whoami2 and pomo4ka
|
|
||||||
|
|
||||||
Thanks also to: AS1LV3RN1NJA, Hoeze and eprimex
|
|
||||||
|
|
||||||
##### GeoIP License:
|
|
||||||
This product uses data from the GeoLite API created by MaxMind, available at https://www.maxmind.com
|
|
||||||
|
|||||||
@@ -304,13 +304,6 @@ settings:
|
|||||||
forceKickAfterRegister: false
|
forceKickAfterRegister: false
|
||||||
# Does AuthMe need to enforce a /login after a successful registration?
|
# Does AuthMe need to enforce a /login after a successful registration?
|
||||||
forceLoginAfterRegister: false
|
forceLoginAfterRegister: false
|
||||||
# Enable to display the welcome message (welcome.txt) after a login
|
|
||||||
# You can use colors in this welcome.txt + some replaced strings:
|
|
||||||
# {PLAYER}: player name, {ONLINE}: display number of online players,
|
|
||||||
# {MAXPLAYERS}: display server slots, {IP}: player ip, {LOGINS}: number of players logged,
|
|
||||||
# {WORLD}: player current world, {SERVER}: server name
|
|
||||||
# {VERSION}: get current bukkit version, {COUNTRY}: player country
|
|
||||||
useWelcomeMessage: true
|
|
||||||
# Broadcast the welcome message to the server or only to the player?
|
# Broadcast the welcome message to the server or only to the player?
|
||||||
# set true for server or false for player
|
# set true for server or false for player
|
||||||
broadcastWelcomeMessage: false
|
broadcastWelcomeMessage: false
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>The GNU General Public Licence version 3 (GPLv3)</name>
|
<name>The GNU Public Licence version 3 (GPLv3)</name>
|
||||||
<url>https://www.gnu.org/licenses/gpl-3.0.html</url>
|
<url>https://www.gnu.org/licenses/gpl-3.0.html</url>
|
||||||
<distribution>repo</distribution>
|
<distribution>repo</distribution>
|
||||||
</license>
|
</license>
|
||||||
@@ -196,6 +196,11 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.3.0</version>
|
||||||
|
<configuration>
|
||||||
|
<nonFilteredFileExtensions>
|
||||||
|
<nonFilteredFileExtension>mmdb</nonFilteredFileExtension>
|
||||||
|
</nonFilteredFileExtensions>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Compile and include classes -->
|
<!-- Compile and include classes -->
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -593,11 +598,26 @@
|
|||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>opencollab-snapshot</id>
|
||||||
|
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Java Libraries -->
|
<!-- Java Libraries -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.geysermc.floodgate</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<!-- Jalu Injector -->
|
<!-- Jalu Injector -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.jalu</groupId>
|
<groupId>ch.jalu</groupId>
|
||||||
@@ -649,7 +669,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.8.1</version> <!-- Log4J version bundled in 1.12.2 -->
|
<version>2.20.0</version> <!-- Log4J version bundled in 1.12.2 -->
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -657,7 +677,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
<artifactId>HikariCP</artifactId>
|
<artifactId>HikariCP</artifactId>
|
||||||
<version>4.0.3</version> <!-- Latest java 8 release -->
|
<version>5.0.1</version> <!-- Latest java 8 release -->
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -670,7 +690,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-simple</artifactId>
|
||||||
<version>1.7.36</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 -->
|
<version>2.0.5</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 -->
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -686,13 +706,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<version>8.0.31</version>
|
<version>8.0.32</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mariadb.jdbc</groupId>
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
<artifactId>mariadb-java-client</artifactId>
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
<version>3.0.8</version>
|
<version>3.1.2</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -975,7 +995,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>at.favre.lib</groupId>
|
<groupId>at.favre.lib</groupId>
|
||||||
<artifactId>bcrypt</artifactId>
|
<artifactId>bcrypt</artifactId>
|
||||||
<version>0.9.0</version>
|
<version>0.10.2</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -997,7 +1017,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>42.5.0</version>
|
<version>42.5.4</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -1027,7 +1047,7 @@
|
|||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<version>4.8.1</version>
|
<version>5.2.0</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>hamcrest-core</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
@@ -1040,7 +1060,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.checkerframework</groupId>
|
<groupId>org.checkerframework</groupId>
|
||||||
<artifactId>checker-qual</artifactId>
|
<artifactId>checker-qual</artifactId>
|
||||||
<version>3.26.0</version>
|
<version>3.32.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -412,12 +412,6 @@ settings:
|
|||||||
forceRegisterCommands: []
|
forceRegisterCommands: []
|
||||||
# Force these commands after /register as a server console, without any '/', use %p for replace with player name
|
# Force these commands after /register as a server console, without any '/', use %p for replace with player name
|
||||||
forceRegisterCommandsAsConsole: []
|
forceRegisterCommandsAsConsole: []
|
||||||
# Do we need to display the welcome message (welcome.txt) after a register or a login?
|
|
||||||
# You can use colors in this welcome.txt + some replaced strings :
|
|
||||||
# {PLAYER} : player name, {ONLINE} : display number of online players, {MAXPLAYERS} : display server slots,
|
|
||||||
# {IP} : player ip, {LOGINS} : number of players logged, {WORLD} : player current world, {SERVER} : server name
|
|
||||||
# {VERSION} : get current bukkit version, {COUNTRY} : player country
|
|
||||||
useWelcomeMessage: true
|
|
||||||
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
|
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
|
||||||
broadcastWelcomeMessage: false
|
broadcastWelcomeMessage: false
|
||||||
# Do we need to delay the join/leave message to be displayed only when the player is authenticated ?
|
# Do we need to delay the join/leave message to be displayed only when the player is authenticated ?
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package fr.xephi.authme;
|
|||||||
|
|
||||||
import ch.jalu.injector.Injector;
|
import ch.jalu.injector.Injector;
|
||||||
import ch.jalu.injector.InjectorBuilder;
|
import ch.jalu.injector.InjectorBuilder;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
import fr.xephi.authme.command.CommandHandler;
|
import fr.xephi.authme.command.CommandHandler;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
@@ -19,6 +18,7 @@ import fr.xephi.authme.listener.PlayerListener111;
|
|||||||
import fr.xephi.authme.listener.PlayerListener19;
|
import fr.xephi.authme.listener.PlayerListener19;
|
||||||
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
||||||
import fr.xephi.authme.listener.ServerListener;
|
import fr.xephi.authme.listener.ServerListener;
|
||||||
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.crypts.Sha256;
|
import fr.xephi.authme.security.crypts.Sha256;
|
||||||
import fr.xephi.authme.service.BackupService;
|
import fr.xephi.authme.service.BackupService;
|
||||||
@@ -28,6 +28,7 @@ import fr.xephi.authme.service.bungeecord.BungeeReceiver;
|
|||||||
import fr.xephi.authme.service.yaml.YamlParseException;
|
import fr.xephi.authme.service.yaml.YamlParseException;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.SettingsWarner;
|
import fr.xephi.authme.settings.SettingsWarner;
|
||||||
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.task.CleanupTask;
|
import fr.xephi.authme.task.CleanupTask;
|
||||||
import fr.xephi.authme.task.purge.PurgeService;
|
import fr.xephi.authme.task.purge.PurgeService;
|
||||||
@@ -35,13 +36,15 @@ import fr.xephi.authme.util.ExceptionUtils;
|
|||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
||||||
@@ -58,10 +61,11 @@ public class AuthMe extends JavaPlugin {
|
|||||||
private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE;
|
private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE;
|
||||||
|
|
||||||
// Version and build number values
|
// Version and build number values
|
||||||
private static String pluginVersion = "N/D";
|
private static String pluginVersion = "5.6.0";
|
||||||
private static String pluginBuildNumber = "Unknown";
|
private static String pluginBuildNumber = "Custom";
|
||||||
|
|
||||||
// Private instances
|
// Private instances
|
||||||
|
private EmailService emailService;
|
||||||
private CommandHandler commandHandler;
|
private CommandHandler commandHandler;
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
private DataSource database;
|
private DataSource database;
|
||||||
@@ -76,14 +80,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
public AuthMe() {
|
public AuthMe() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Constructor for unit testing.
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
AuthMe(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
|
|
||||||
super(loader, description, dataFolder, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plugin's name.
|
* Get the plugin's name.
|
||||||
*
|
*
|
||||||
@@ -150,7 +146,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
th.printStackTrace();
|
th.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
logger.logException("File '" + yamlParseException.getFile() + "' contains invalid YAML. "
|
logger.logException("File '" + yamlParseException.getFile() + "' contains invalid YAML. "
|
||||||
+ "Please run its contents through http://yamllint.com", yamlParseException);
|
+ "Please run its contents through https://yamllint.com", yamlParseException);
|
||||||
}
|
}
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
@@ -170,7 +166,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
OnStartupTasks.sendMetrics(this, settings);
|
OnStartupTasks.sendMetrics(this, settings);
|
||||||
|
|
||||||
// Successful message
|
// Successful message
|
||||||
logger.info("AuthMe " + getPluginVersion() + " build n." + getPluginBuildNumber() + " successfully enabled!");
|
logger.info("AuthMeReloaded successfully enabled!");
|
||||||
|
|
||||||
// Purge on start if enabled
|
// Purge on start if enabled
|
||||||
PurgeService purgeService = injector.getSingleton(PurgeService.class);
|
PurgeService purgeService = injector.getSingleton(PurgeService.class);
|
||||||
@@ -245,6 +241,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
database = injector.getSingleton(DataSource.class);
|
database = injector.getSingleton(DataSource.class);
|
||||||
bukkitService = injector.getSingleton(BukkitService.class);
|
bukkitService = injector.getSingleton(BukkitService.class);
|
||||||
commandHandler = injector.getSingleton(CommandHandler.class);
|
commandHandler = injector.getSingleton(CommandHandler.class);
|
||||||
|
emailService = injector.getSingleton(EmailService.class);
|
||||||
backupService = injector.getSingleton(BackupService.class);
|
backupService = injector.getSingleton(BackupService.class);
|
||||||
|
|
||||||
// Trigger instantiation (class not used elsewhere)
|
// Trigger instantiation (class not used elsewhere)
|
||||||
@@ -307,6 +304,11 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (onShutdownPlayerSaver != null) {
|
if (onShutdownPlayerSaver != null) {
|
||||||
onShutdownPlayerSaver.saveAllPlayers();
|
onShutdownPlayerSaver.saveAllPlayers();
|
||||||
}
|
}
|
||||||
|
if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
// Do backup on stop if enabled
|
// Do backup on stop if enabled
|
||||||
if (backupService != null) {
|
if (backupService != null) {
|
||||||
@@ -332,8 +334,8 @@ public class AuthMe extends JavaPlugin {
|
|||||||
* @return True if the command was executed, false otherwise.
|
* @return True if the command was executed, false otherwise.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd,
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd,
|
||||||
String commandLabel, String[] args) {
|
@NotNull String commandLabel, String[] args) {
|
||||||
// Make sure the command handler has been initialized
|
// Make sure the command handler has been initialized
|
||||||
if (commandHandler == null) {
|
if (commandHandler == null) {
|
||||||
getLogger().severe("AuthMe command handler is not available");
|
getLogger().severe("AuthMe command handler is not available");
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import fr.xephi.authme.command.executable.authme.TotpViewStatusCommand;
|
|||||||
import fr.xephi.authme.command.executable.authme.UnregisterAdminCommand;
|
import fr.xephi.authme.command.executable.authme.UnregisterAdminCommand;
|
||||||
import fr.xephi.authme.command.executable.authme.UpdateHelpMessagesCommand;
|
import fr.xephi.authme.command.executable.authme.UpdateHelpMessagesCommand;
|
||||||
import fr.xephi.authme.command.executable.authme.VersionCommand;
|
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.authme.debug.DebugCommand;
|
||||||
import fr.xephi.authme.command.executable.captcha.CaptchaCommand;
|
import fr.xephi.authme.command.executable.captcha.CaptchaCommand;
|
||||||
import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand;
|
import fr.xephi.authme.command.executable.changepassword.ChangePasswordCommand;
|
||||||
@@ -420,6 +421,16 @@ public class CommandInitializer {
|
|||||||
.executableCommand(SwitchAntiBotCommand.class)
|
.executableCommand(SwitchAntiBotCommand.class)
|
||||||
.register();
|
.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
|
// Register the reload command
|
||||||
CommandDescription.builder()
|
CommandDescription.builder()
|
||||||
.parent(authmeBase)
|
.parent(authmeBase)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import fr.xephi.authme.datasource.converter.RoyalAuthConverter;
|
|||||||
import fr.xephi.authme.datasource.converter.SqliteToSql;
|
import fr.xephi.authme.datasource.converter.SqliteToSql;
|
||||||
import fr.xephi.authme.datasource.converter.VAuthConverter;
|
import fr.xephi.authme.datasource.converter.VAuthConverter;
|
||||||
import fr.xephi.authme.datasource.converter.XAuthConverter;
|
import fr.xephi.authme.datasource.converter.XAuthConverter;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.command.ExecutableCommand;
|
import fr.xephi.authme.command.ExecutableCommand;
|
||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import fr.xephi.authme.command.ExecutableCommand;
|
|||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.initialization.SettingsDependent;
|
import fr.xephi.authme.initialization.SettingsDependent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.SettingsWarner;
|
import fr.xephi.authme.settings.SettingsWarner;
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,8 +3,8 @@ package fr.xephi.authme.command.executable.authme.debug;
|
|||||||
import ch.jalu.datasourcecolumns.data.DataSourceValue;
|
import ch.jalu.datasourcecolumns.data.DataSourceValue;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.mail.SendMailSsl;
|
import fr.xephi.authme.mail.SendMailSsl;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.permission.DebugSectionPermissions;
|
import fr.xephi.authme.permission.DebugSectionPermissions;
|
||||||
import fr.xephi.authme.permission.PermissionNode;
|
import fr.xephi.authme.permission.PermissionNode;
|
||||||
import fr.xephi.authme.util.StringUtils;
|
import fr.xephi.authme.util.StringUtils;
|
||||||
|
|||||||
-7
@@ -43,13 +43,6 @@ public class ChangePasswordCommand extends PlayerCommand {
|
|||||||
return;
|
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 oldPassword = arguments.get(0);
|
||||||
String newPassword = arguments.get(1);
|
String newPassword = arguments.get(1);
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package fr.xephi.authme.command.executable.email;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.command.PlayerCommand;
|
import fr.xephi.authme.command.PlayerCommand;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.command.PlayerCommand;
|
import fr.xephi.authme.command.PlayerCommand;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.PasswordRecoveryService;
|
import fr.xephi.authme.service.PasswordRecoveryService;
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package fr.xephi.authme.command.executable.register;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.command.PlayerCommand;
|
import fr.xephi.authme.command.PlayerCommand;
|
||||||
import fr.xephi.authme.data.captcha.RegistrationCaptchaManager;
|
import fr.xephi.authme.data.captcha.RegistrationCaptchaManager;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.Management;
|
import fr.xephi.authme.process.Management;
|
||||||
import fr.xephi.authme.process.register.RegisterSecondaryArgument;
|
import fr.xephi.authme.process.register.RegisterSecondaryArgument;
|
||||||
import fr.xephi.authme.process.register.RegistrationType;
|
import fr.xephi.authme.process.register.RegistrationType;
|
||||||
@@ -23,6 +24,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import static fr.xephi.authme.process.register.RegisterSecondaryArgument.CONFIRMATION;
|
import static fr.xephi.authme.process.register.RegisterSecondaryArgument.CONFIRMATION;
|
||||||
import static fr.xephi.authme.process.register.RegisterSecondaryArgument.EMAIL_MANDATORY;
|
import static fr.xephi.authme.process.register.RegisterSecondaryArgument.EMAIL_MANDATORY;
|
||||||
@@ -43,6 +46,9 @@ public class RegisterCommand extends PlayerCommand {
|
|||||||
@Inject
|
@Inject
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DataSource dataSource;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
|
|
||||||
@@ -169,6 +175,20 @@ public class RegisterCommand extends PlayerCommand {
|
|||||||
} else if (isSecondArgValidForEmailRegistration(player, arguments)) {
|
} else if (isSecondArgValidForEmailRegistration(player, arguments)) {
|
||||||
management.performRegister(RegistrationMethod.EMAIL_REGISTRATION,
|
management.performRegister(RegistrationMethod.EMAIL_REGISTRATION,
|
||||||
EmailRegisterParams.of(player, email));
|
EmailRegisterParams.of(player, email));
|
||||||
|
Timer timer = new Timer();
|
||||||
|
timer.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (dataSource.getAuth(player.getName()) != null) {
|
||||||
|
if (dataSource.getAuth(player.getName()).getLastLogin() == null) {
|
||||||
|
management.performUnregisterByAdmin(null, player.getName(), player);
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 600000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import fr.xephi.authme.command.PlayerCommand;
|
|||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.message.Messages;
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.totp.GenerateTotpService;
|
import fr.xephi.authme.security.totp.GenerateTotpService;
|
||||||
import fr.xephi.authme.security.totp.TotpAuthenticator.TotpGenerationResult;
|
import fr.xephi.authme.security.totp.TotpAuthenticator.TotpGenerationResult;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import fr.xephi.authme.command.PlayerCommand;
|
|||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.message.Messages;
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.totp.TotpAuthenticator;
|
import fr.xephi.authme.security.totp.TotpAuthenticator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import fr.xephi.authme.data.limbo.LimboPlayer;
|
|||||||
import fr.xephi.authme.data.limbo.LimboPlayerState;
|
import fr.xephi.authme.data.limbo.LimboPlayerState;
|
||||||
import fr.xephi.authme.data.limbo.LimboService;
|
import fr.xephi.authme.data.limbo.LimboService;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.message.Messages;
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.login.AsynchronousLogin;
|
import fr.xephi.authme.process.login.AsynchronousLogin;
|
||||||
import fr.xephi.authme.security.totp.TotpAuthenticator;
|
import fr.xephi.authme.security.totp.TotpAuthenticator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -70,7 +70,7 @@ public class TotpCodeCommand extends PlayerCommand {
|
|||||||
boolean isCodeValid = totpAuthenticator.checkCode(auth, inputCode);
|
boolean isCodeValid = totpAuthenticator.checkCode(auth, inputCode);
|
||||||
if (isCodeValid) {
|
if (isCodeValid) {
|
||||||
logger.debug("Successfully checked TOTP code for `{0}`", player.getName());
|
logger.debug("Successfully checked TOTP code for `{0}`", player.getName());
|
||||||
asynchronousLogin.performLogin(player, auth);
|
asynchronousLogin.performLogin(player, auth,false);
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Input TOTP code was invalid for player `{0}`", player.getName());
|
logger.debug("Input TOTP code was invalid for player `{0}`", player.getName());
|
||||||
messages.send(player, MessageKey.TWO_FACTOR_INVALID_CODE);
|
messages.send(player, MessageKey.TWO_FACTOR_INVALID_CODE);
|
||||||
|
|||||||
+1
-1
@@ -3,8 +3,8 @@ package fr.xephi.authme.command.executable.verification;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.command.PlayerCommand;
|
import fr.xephi.authme.command.PlayerCommand;
|
||||||
import fr.xephi.authme.data.VerificationCodeManager;
|
import fr.xephi.authme.data.VerificationCodeManager;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import fr.xephi.authme.util.expiring.ExpiringMap;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -132,12 +134,14 @@ public class VerificationCodeManager implements SettingsDependent, HasCleanup {
|
|||||||
*/
|
*/
|
||||||
private void generateCode(String name) {
|
private void generateCode(String name) {
|
||||||
DataSourceValue<String> emailResult = dataSource.getEmail(name);
|
DataSourceValue<String> emailResult = dataSource.getEmail(name);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
||||||
|
Date date = new Date(System.currentTimeMillis());
|
||||||
if (emailResult.rowExists()) {
|
if (emailResult.rowExists()) {
|
||||||
final String email = emailResult.getValue();
|
final String email = emailResult.getValue();
|
||||||
if (!Utils.isEmailEmpty(email)) {
|
if (!Utils.isEmailEmpty(email)) {
|
||||||
String code = RandomStringUtils.generateNum(6); // 6 digits code
|
String code = RandomStringUtils.generateNum(6); // 6 digits code
|
||||||
verificationCodes.put(name.toLowerCase(Locale.ROOT), code);
|
verificationCodes.put(name.toLowerCase(Locale.ROOT), code);
|
||||||
emailService.sendVerificationMail(name, email, code);
|
emailService.sendVerificationMail(name, email, code, dateFormat.format(date));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package fr.xephi.authme.datasource.columnshandler;
|
|||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import static fr.xephi.authme.datasource.columnshandler.AuthMeColumnsFactory.ColumnOptions.DEFAULT_FOR_NULL;
|
import static fr.xephi.authme.datasource.columnshandler.AuthMeColumnsFactory.ColumnOptions.DEFAULT_FOR_NULL;
|
||||||
import static fr.xephi.authme.datasource.columnshandler.AuthMeColumnsFactory.ColumnOptions.OPTIONAL;
|
import static fr.xephi.authme.datasource.columnshandler.AuthMeColumnsFactory.ColumnOptions.OPTIONAL;
|
||||||
import static fr.xephi.authme.datasource.columnshandler.AuthMeColumnsFactory.createDouble;
|
import static fr.xephi.authme.datasource.columnshandler.AuthMeColumnsFactory.createDouble;
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package fr.xephi.authme.initialization;
|
|||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.message.Messages;
|
import fr.xephi.authme.message.Messages;
|
||||||
import fr.xephi.authme.output.ConsoleFilter;
|
import fr.xephi.authme.output.ConsoleFilter;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.output.Log4JFilter;
|
import fr.xephi.authme.output.Log4JFilter;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|||||||
@@ -4,14 +4,16 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.message.Messages;
|
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.PermissionsManager;
|
||||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||||
import fr.xephi.authme.service.AntiBotService;
|
import fr.xephi.authme.service.AntiBotService;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.ValidationService;
|
import fr.xephi.authme.service.ValidationService;
|
||||||
|
import fr.xephi.authme.service.WhiteListService;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
import fr.xephi.authme.settings.properties.ProtectionSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
@@ -46,6 +48,8 @@ public class OnJoinVerifier implements Reloadable {
|
|||||||
@Inject
|
@Inject
|
||||||
private AntiBotService antiBotService;
|
private AntiBotService antiBotService;
|
||||||
@Inject
|
@Inject
|
||||||
|
private WhiteListService whiteListService;
|
||||||
|
@Inject
|
||||||
private ValidationService validationService;
|
private ValidationService validationService;
|
||||||
@Inject
|
@Inject
|
||||||
private BukkitService bukkitService;
|
private BukkitService bukkitService;
|
||||||
@@ -81,6 +85,18 @@ public class OnJoinVerifier implements Reloadable {
|
|||||||
throw new FailedVerificationException(MessageKey.KICK_ANTIBOT);
|
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.
|
* Checks whether non-registered players should be kicked, and if so, whether the player should be kicked.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import fr.xephi.authme.settings.SpawnLoader;
|
|||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
@@ -27,6 +28,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
@@ -45,10 +47,10 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -91,7 +93,6 @@ public class PlayerListener implements Listener {
|
|||||||
private PermissionsManager permissionsManager;
|
private PermissionsManager permissionsManager;
|
||||||
@Inject
|
@Inject
|
||||||
private QuickCommandsProtectionManager quickCommandsProtectionManager;
|
private QuickCommandsProtectionManager quickCommandsProtectionManager;
|
||||||
|
|
||||||
// Lowest priority to apply fast protection checks
|
// Lowest priority to apply fast protection checks
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onAsyncPlayerPreLoginEventLowest(AsyncPlayerPreLoginEvent event) {
|
public void onAsyncPlayerPreLoginEventLowest(AsyncPlayerPreLoginEvent event) {
|
||||||
@@ -111,6 +112,9 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.getProperty(RestrictionSettings.HOOK_FLOODGATE_PLAYER) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())){
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Non-blocking checks
|
// Non-blocking checks
|
||||||
try {
|
try {
|
||||||
onJoinVerifier.checkIsValidName(name);
|
onJoinVerifier.checkIsValidName(name);
|
||||||
@@ -118,6 +122,7 @@ public class PlayerListener implements Listener {
|
|||||||
event.setKickMessage(messages.retrieveSingle(name, e.getReason(), e.getArgs()));
|
event.setKickMessage(messages.retrieveSingle(name, e.getReason(), e.getArgs()));
|
||||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -143,6 +148,7 @@ public class PlayerListener implements Listener {
|
|||||||
final PlayerAuth auth = dataSource.getAuth(name);
|
final PlayerAuth auth = dataSource.getAuth(name);
|
||||||
final boolean isAuthAvailable = auth != null;
|
final boolean isAuthAvailable = auth != null;
|
||||||
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
||||||
|
onJoinVerifier.checkWhitelist(name, isAuthAvailable);
|
||||||
onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
||||||
onJoinVerifier.checkNameCasing(name, auth);
|
onJoinVerifier.checkNameCasing(name, auth);
|
||||||
final String ip = event.getAddress().getHostAddress();
|
final String ip = event.getAddress().getHostAddress();
|
||||||
@@ -451,7 +457,7 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
if (listenerService.shouldCancelEvent(event)) {
|
if (listenerService.shouldCancelEvent(event)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@@ -509,4 +515,12 @@ public class PlayerListener implements Listener {
|
|||||||
event.setCancelled(true);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package fr.xephi.authme.listener;
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.permission.PermissionsManager;
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
import fr.xephi.authme.service.PluginHookService;
|
import fr.xephi.authme.service.PluginHookService;
|
||||||
import fr.xephi.authme.settings.SpawnLoader;
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
|
|||||||
@@ -40,21 +40,7 @@ public class EmailService {
|
|||||||
return sendMailSsl.hasAllInformation();
|
return sendMailSsl.hasAllInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean sendNewPasswordMail(String name, String mailAddress, String newPass,String ip,String time) {
|
||||||
/**
|
|
||||||
* Sends an email to the user with his new password.
|
|
||||||
*
|
|
||||||
* @param name the name of the player
|
|
||||||
* @param mailAddress the player's email
|
|
||||||
* @param newPass the new password
|
|
||||||
* @return true if email could be sent, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean sendPasswordMail(String name, String mailAddress, String newPass) {
|
|
||||||
if (!hasAllInformation()) {
|
|
||||||
logger.warning("Cannot perform email registration: not all email settings are complete");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
HtmlEmail email;
|
HtmlEmail email;
|
||||||
try {
|
try {
|
||||||
email = sendMailSsl.initializeMail(mailAddress);
|
email = sendMailSsl.initializeMail(mailAddress);
|
||||||
@@ -63,8 +49,7 @@ public class EmailService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String mailText = replaceTagsForPasswordMail(settings.getPasswordEmailMessage(), name, newPass);
|
String mailText = replaceTagsForPasswordMail(settings.getNewPasswordEmailMessage(), name, newPass,ip,time);
|
||||||
// Generate an image?
|
|
||||||
File file = null;
|
File file = null;
|
||||||
if (settings.getProperty(EmailSettings.PASSWORD_AS_IMAGE)) {
|
if (settings.getProperty(EmailSettings.PASSWORD_AS_IMAGE)) {
|
||||||
try {
|
try {
|
||||||
@@ -82,16 +67,16 @@ public class EmailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends an email to the user with the temporary verification code.
|
* Sends an email to the user with his new password.
|
||||||
*
|
*
|
||||||
* @param name the name of the player
|
* @param name the name of the player
|
||||||
* @param mailAddress the player's email
|
* @param mailAddress the player's email
|
||||||
* @param code the verification code
|
* @param newPass the new password
|
||||||
* @return true if email could be sent, false otherwise
|
* @return true if email could be sent, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean sendVerificationMail(String name, String mailAddress, String code) {
|
public boolean sendPasswordMail(String name, String mailAddress, String newPass, String time) {
|
||||||
if (!hasAllInformation()) {
|
if (!hasAllInformation()) {
|
||||||
logger.warning("Cannot send verification email: not all email settings are complete");
|
logger.warning("Cannot perform email registration: not all email settings are complete");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,13 +84,51 @@ public class EmailService {
|
|||||||
try {
|
try {
|
||||||
email = sendMailSsl.initializeMail(mailAddress);
|
email = sendMailSsl.initializeMail(mailAddress);
|
||||||
} catch (EmailException e) {
|
} catch (EmailException e) {
|
||||||
logger.logException("Failed to create verification email with the given settings:", e);
|
logger.logException("Failed to create email with the given settings:", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String mailText = replaceTagsForPasswordMail(settings.getPasswordEmailMessage(), name, newPass,time);
|
||||||
|
// Generate an image?
|
||||||
|
File file = null;
|
||||||
|
if (settings.getProperty(EmailSettings.PASSWORD_AS_IMAGE)) {
|
||||||
|
try {
|
||||||
|
file = generatePasswordImage(name, newPass);
|
||||||
|
mailText = embedImageIntoEmailContent(file, email, mailText);
|
||||||
|
} catch (IOException | EmailException e) {
|
||||||
|
logger.logException(
|
||||||
|
"Unable to send new password as image for email " + mailAddress + ":", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean couldSendEmail = sendMailSsl.sendEmail(mailText, email);
|
||||||
|
FileUtils.delete(file);
|
||||||
|
return couldSendEmail;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sends an email to the user with the temporary verification code.
|
||||||
|
*
|
||||||
|
* @param name the name of the player
|
||||||
|
* @param mailAddress the player's email
|
||||||
|
* @param code the verification code
|
||||||
|
*/
|
||||||
|
public void sendVerificationMail(String name, String mailAddress, String code, String time) {
|
||||||
|
if (!hasAllInformation()) {
|
||||||
|
logger.warning("Cannot send verification email: not all email settings are complete");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HtmlEmail email;
|
||||||
|
try {
|
||||||
|
email = sendMailSsl.initializeMail(mailAddress);
|
||||||
|
} catch (EmailException e) {
|
||||||
|
logger.logException("Failed to create verification email with the given settings:", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String mailText = replaceTagsForVerificationEmail(settings.getVerificationEmailMessage(), name, code,
|
String mailText = replaceTagsForVerificationEmail(settings.getVerificationEmailMessage(), name, code,
|
||||||
settings.getProperty(SecuritySettings.VERIFICATION_CODE_EXPIRATION_MINUTES));
|
settings.getProperty(SecuritySettings.VERIFICATION_CODE_EXPIRATION_MINUTES),time);
|
||||||
return sendMailSsl.sendEmail(mailText, email);
|
sendMailSsl.sendEmail(mailText, email);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +139,7 @@ public class EmailService {
|
|||||||
* @param code the recovery code
|
* @param code the recovery code
|
||||||
* @return true if email could be sent, false otherwise
|
* @return true if email could be sent, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean sendRecoveryCode(String name, String email, String code) {
|
public boolean sendRecoveryCode(String name, String email, String code, String time) {
|
||||||
HtmlEmail htmlEmail;
|
HtmlEmail htmlEmail;
|
||||||
try {
|
try {
|
||||||
htmlEmail = sendMailSsl.initializeMail(email);
|
htmlEmail = sendMailSsl.initializeMail(email);
|
||||||
@@ -126,10 +149,23 @@ public class EmailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String message = replaceTagsForRecoveryCodeMail(settings.getRecoveryCodeEmailMessage(),
|
String message = replaceTagsForRecoveryCodeMail(settings.getRecoveryCodeEmailMessage(),
|
||||||
name, code, settings.getProperty(SecuritySettings.RECOVERY_CODE_HOURS_VALID));
|
name, code, settings.getProperty(SecuritySettings.RECOVERY_CODE_HOURS_VALID),time);
|
||||||
return sendMailSsl.sendEmail(message, htmlEmail);
|
return sendMailSsl.sendEmail(message, htmlEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendShutDown(String email, String time) {
|
||||||
|
HtmlEmail htmlEmail;
|
||||||
|
try {
|
||||||
|
htmlEmail = sendMailSsl.initializeMail(email);
|
||||||
|
} catch (EmailException e) {
|
||||||
|
logger.logException("Failed to create email for recovery code:", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String message = replaceTagsForShutDownMail(settings.getShutdownEmailMessage(), time);
|
||||||
|
sendMailSsl.sendEmail(message, htmlEmail);
|
||||||
|
}
|
||||||
|
|
||||||
private File generatePasswordImage(String name, String newPass) throws IOException {
|
private File generatePasswordImage(String name, String newPass) throws IOException {
|
||||||
ImageGenerator gen = new ImageGenerator(newPass);
|
ImageGenerator gen = new ImageGenerator(newPass);
|
||||||
File file = new File(dataFolder, name + "_new_pass.jpg");
|
File file = new File(dataFolder, name + "_new_pass.jpg");
|
||||||
@@ -144,26 +180,44 @@ public class EmailService {
|
|||||||
return content.replace("<image />", "<img src=\"cid:" + tag + "\">");
|
return content.replace("<image />", "<img src=\"cid:" + tag + "\">");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String replaceTagsForPasswordMail(String mailText, String name, String newPass) {
|
private String replaceTagsForPasswordMail(String mailText, String name, String newPass,String ip,String time) {
|
||||||
return mailText
|
return mailText
|
||||||
.replace("<playername />", name)
|
.replace("<playername />", name)
|
||||||
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
.replace("<generatedpass />", newPass);
|
.replace("<generatedpass />", newPass)
|
||||||
|
.replace("<playerip />", ip)
|
||||||
|
.replace("<time />", time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String replaceTagsForVerificationEmail(String mailText, String name, String code, int minutesValid) {
|
private String replaceTagsForPasswordMail(String mailText, String name, String newPass, String time) {
|
||||||
|
return mailText
|
||||||
|
.replace("<playername />", name)
|
||||||
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
|
.replace("<generatedpass />", newPass)
|
||||||
|
.replace("<time />", time);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String replaceTagsForVerificationEmail(String mailText, String name, String code, int minutesValid, String time) {
|
||||||
return mailText
|
return mailText
|
||||||
.replace("<playername />", name)
|
.replace("<playername />", name)
|
||||||
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
.replace("<generatedcode />", code)
|
.replace("<generatedcode />", code)
|
||||||
.replace("<minutesvalid />", String.valueOf(minutesValid));
|
.replace("<minutesvalid />", String.valueOf(minutesValid))
|
||||||
|
.replace("<time />", time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String replaceTagsForRecoveryCodeMail(String mailText, String name, String code, int hoursValid) {
|
private String replaceTagsForRecoveryCodeMail(String mailText, String name, String code, int hoursValid, String time) {
|
||||||
return mailText
|
return mailText
|
||||||
.replace("<playername />", name)
|
.replace("<playername />", name)
|
||||||
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
.replace("<recoverycode />", code)
|
.replace("<recoverycode />", code)
|
||||||
.replace("<hoursvalid />", String.valueOf(hoursValid));
|
.replace("<hoursvalid />", String.valueOf(hoursValid))
|
||||||
|
.replace("<time />", time);
|
||||||
}
|
}
|
||||||
|
private String replaceTagsForShutDownMail(String mailText, String time) {
|
||||||
|
return mailText
|
||||||
|
.replace("<servername />", settings.getProperty(PluginSettings.SERVER_NAME))
|
||||||
|
.replace("<time />", time);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package fr.xephi.authme.mail;
|
package fr.xephi.authme.mail;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.*;
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.GradientPaint;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ public enum MessageKey {
|
|||||||
|
|
||||||
/** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */
|
/** AntiBot protection mode is enabled! You have to wait some minutes before joining the server. */
|
||||||
KICK_ANTIBOT("antibot.kick_antibot"),
|
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! */
|
/** This user isn't registered! */
|
||||||
UNKNOWN_USER("error.unregistered_user"),
|
UNKNOWN_USER("error.unregistered_user"),
|
||||||
@@ -35,9 +38,6 @@ public enum MessageKey {
|
|||||||
/** In-game registration is disabled! */
|
/** In-game registration is disabled! */
|
||||||
REGISTRATION_DISABLED("registration.disabled"),
|
REGISTRATION_DISABLED("registration.disabled"),
|
||||||
|
|
||||||
/** Logged-in due to Session Reconnection. */
|
|
||||||
SESSION_RECONNECTION("session.valid_session"),
|
|
||||||
|
|
||||||
/** Successful login! */
|
/** Successful login! */
|
||||||
LOGIN_SUCCESS("login.success"),
|
LOGIN_SUCCESS("login.success"),
|
||||||
|
|
||||||
@@ -199,6 +199,7 @@ public enum MessageKey {
|
|||||||
|
|
||||||
/** [AntiBotService] AntiBot disabled after %m minutes! */
|
/** [AntiBotService] AntiBot disabled after %m minutes! */
|
||||||
ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"),
|
ANTIBOT_AUTO_DISABLED_MESSAGE("antibot.auto_disabled", "%m"),
|
||||||
|
WHITELIST_KICK("misc.whitelist_kick", "%p"),
|
||||||
|
|
||||||
/** The email address is already being used */
|
/** The email address is already being used */
|
||||||
EMAIL_ALREADY_USED_ERROR("email.already_used"),
|
EMAIL_ALREADY_USED_ERROR("email.already_used"),
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package fr.xephi.authme.message;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.util.expiring.Duration;
|
import fr.xephi.authme.util.expiring.Duration;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package fr.xephi.authme.message;
|
package fr.xephi.authme.message;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.updater.MessageUpdater;
|
import fr.xephi.authme.message.updater.MessageUpdater;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import ch.jalu.configme.resource.PropertyResource;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.util.FileUtils;
|
import fr.xephi.authme.util.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ final class OldMessageKeysMigrater {
|
|||||||
.put(MessageKey.WRONG_PASSWORD, "wrong_pwd")
|
.put(MessageKey.WRONG_PASSWORD, "wrong_pwd")
|
||||||
.put(MessageKey.UNREGISTERED_SUCCESS, "unregistered")
|
.put(MessageKey.UNREGISTERED_SUCCESS, "unregistered")
|
||||||
.put(MessageKey.REGISTRATION_DISABLED, "reg_disabled")
|
.put(MessageKey.REGISTRATION_DISABLED, "reg_disabled")
|
||||||
.put(MessageKey.SESSION_RECONNECTION, "valid_session")
|
|
||||||
.put(MessageKey.ACCOUNT_NOT_ACTIVATED, "vb_nonActiv")
|
.put(MessageKey.ACCOUNT_NOT_ACTIVATED, "vb_nonActiv")
|
||||||
.put(MessageKey.NAME_ALREADY_REGISTERED, "user_regged")
|
.put(MessageKey.NAME_ALREADY_REGISTERED, "user_regged")
|
||||||
.put(MessageKey.NO_PERMISSION, "no_perm")
|
.put(MessageKey.NO_PERMISSION, "no_perm")
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ public enum AdminPermission implements PermissionNode {
|
|||||||
* Permission to see Antibot messages.
|
* Permission to see Antibot messages.
|
||||||
*/
|
*/
|
||||||
ANTIBOT_MESSAGES("authme.admin.antibotmessages"),
|
ANTIBOT_MESSAGES("authme.admin.antibotmessages"),
|
||||||
|
WHITELIST_MESSAGE("authme.admin.whitelistmessage"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission to use the update messages command.
|
* Permission to use the update messages command.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public enum PlayerStatePermission implements PermissionNode {
|
|||||||
* Permission node to bypass AntiBot protection.
|
* Permission node to bypass AntiBot protection.
|
||||||
*/
|
*/
|
||||||
BYPASS_ANTIBOT("authme.bypassantibot", DefaultPermission.OP_ONLY),
|
BYPASS_ANTIBOT("authme.bypassantibot", DefaultPermission.OP_ONLY),
|
||||||
|
WHITELIST("authme.whitelist", DefaultPermission.OP_ONLY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission node to bypass BungeeCord server teleportation.
|
* Permission node to bypass BungeeCord server teleportation.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class Management {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void forceLogin(Player player) {
|
public void forceLogin(Player player) {
|
||||||
runTask(() -> asynchronousLogin.forceLogin(player));
|
runTask(() -> asynchronousLogin.forceLogin(player,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceLogin(Player player, boolean quiet) {
|
public void forceLogin(Player player, boolean quiet) {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
import fr.xephi.authme.process.AsynchronousProcess;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
|||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.EmailChangedEvent;
|
import fr.xephi.authme.events.EmailChangedEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
import fr.xephi.authme.process.AsynchronousProcess;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
|||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.EmailChangedEvent;
|
import fr.xephi.authme.events.EmailChangedEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
import fr.xephi.authme.process.AsynchronousProcess;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import fr.xephi.authme.data.ProxySessionManager;
|
|||||||
import fr.xephi.authme.data.limbo.LimboService;
|
import fr.xephi.authme.data.limbo.LimboService;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.ProtectInventoryEvent;
|
import fr.xephi.authme.events.ProtectInventoryEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
import fr.xephi.authme.process.AsynchronousProcess;
|
||||||
import fr.xephi.authme.process.login.AsynchronousLogin;
|
import fr.xephi.authme.process.login.AsynchronousLogin;
|
||||||
@@ -17,9 +17,9 @@ import fr.xephi.authme.service.SessionService;
|
|||||||
import fr.xephi.authme.service.ValidationService;
|
import fr.xephi.authme.service.ValidationService;
|
||||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||||
import fr.xephi.authme.settings.WelcomeMessageConfiguration;
|
|
||||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
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.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.util.InternetProtocolUtils;
|
import fr.xephi.authme.util.InternetProtocolUtils;
|
||||||
@@ -31,7 +31,6 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_SECOND;
|
import static fr.xephi.authme.service.BukkitService.TICKS_PER_SECOND;
|
||||||
@@ -71,9 +70,6 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private ValidationService validationService;
|
private ValidationService validationService;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WelcomeMessageConfiguration welcomeMessageConfiguration;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SessionService sessionService;
|
private SessionService sessionService;
|
||||||
|
|
||||||
@@ -133,26 +129,21 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
|
|
||||||
// Session logic
|
// Session logic
|
||||||
if (sessionService.canResumeSession(player)) {
|
if (sessionService.canResumeSession(player)) {
|
||||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
|
||||||
// Run commands
|
// Run commands
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||||
() -> commandManager.runCommandsOnSessionLogin(player));
|
() -> commandManager.runCommandsOnSessionLogin(player));
|
||||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player));
|
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
|
||||||
return;
|
return;
|
||||||
} else if (proxySessionManager.shouldResumeSession(name)) {
|
} else if (proxySessionManager.shouldResumeSession(name)) {
|
||||||
service.send(player, MessageKey.SESSION_RECONNECTION);
|
|
||||||
// Run commands
|
// Run commands
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(
|
||||||
() -> commandManager.runCommandsOnSessionLogin(player));
|
() -> commandManager.runCommandsOnSessionLogin(player));
|
||||||
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player));
|
bukkitService.runTaskOptionallyAsync(() -> asynchronousLogin.forceLogin(player,service.getProperty(PluginSettings.HIDE_SESSIONS_LOGIN) ? 1 : 0));
|
||||||
logger.info("The user " + player.getName() + " has been automatically logged in, "
|
logger.info("The user " + player.getName() + " has been automatically logged in, "
|
||||||
+ "as present in autologin queue.");
|
+ "as present in autologin queue.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!service.getProperty(RegistrationSettings.FORCE)) {
|
} else if (!service.getProperty(RegistrationSettings.FORCE)) {
|
||||||
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
|
|
||||||
welcomeMessageConfiguration.sendWelcomeMessage(player);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Skip if registration is optional
|
// Skip if registration is optional
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import fr.xephi.authme.data.limbo.LimboService;
|
|||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||||
import fr.xephi.authme.events.FailedLoginEvent;
|
import fr.xephi.authme.events.FailedLoginEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.permission.AdminPermission;
|
import fr.xephi.authme.permission.AdminPermission;
|
||||||
import fr.xephi.authme.permission.PlayerPermission;
|
import fr.xephi.authme.permission.PlayerPermission;
|
||||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||||
@@ -102,7 +102,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
limboService.getLimboPlayer(player.getName()).setState(LimboPlayerState.TOTP_REQUIRED);
|
limboService.getLimboPlayer(player.getName()).setState(LimboPlayerState.TOTP_REQUIRED);
|
||||||
// TODO #1141: Check if we should check limbo state before processing password
|
// TODO #1141: Check if we should check limbo state before processing password
|
||||||
} else {
|
} else {
|
||||||
performLogin(player, auth);
|
performLogin(player, auth, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,10 +112,10 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
*
|
*
|
||||||
* @param player the player to log in
|
* @param player the player to log in
|
||||||
*/
|
*/
|
||||||
public void forceLogin(Player player) {
|
public void forceLogin(Player player,int quiet) {
|
||||||
PlayerAuth auth = getPlayerAuth(player);
|
PlayerAuth auth = getPlayerAuth(player);
|
||||||
if (auth != null) {
|
if (auth != null) {
|
||||||
performLogin(player, auth);
|
performLogin(player, auth, quiet == 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
public void forceLogin(Player player, boolean quiet) {
|
public void forceLogin(Player player, boolean quiet) {
|
||||||
PlayerAuth auth = getPlayerAuth(player, quiet);
|
PlayerAuth auth = getPlayerAuth(player, quiet);
|
||||||
if (auth != null) {
|
if (auth != null) {
|
||||||
performLogin(player, auth);
|
performLogin(player, auth, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
* @param player the player to log in
|
* @param player the player to log in
|
||||||
* @param auth the associated PlayerAuth object
|
* @param auth the associated PlayerAuth object
|
||||||
*/
|
*/
|
||||||
public void performLogin(Player player, PlayerAuth auth) {
|
public void performLogin(Player player, PlayerAuth auth, boolean quiet) {
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
boolean isFirstLogin = (auth.getLastLogin() == null);
|
boolean isFirstLogin = (auth.getLastLogin() == null);
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
tempbanManager.resetCount(ip, name);
|
tempbanManager.resetCount(ip, name);
|
||||||
player.setNoDamageTicks(0);
|
player.setNoDamageTicks(0);
|
||||||
|
|
||||||
service.send(player, MessageKey.LOGIN_SUCCESS);
|
if (!quiet) {service.send(player, MessageKey.LOGIN_SUCCESS);}
|
||||||
|
|
||||||
// Other auths
|
// Other auths
|
||||||
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
|
List<String> auths = dataSource.getAllAuthsByIp(auth.getLastIp());
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import fr.xephi.authme.service.CommonService;
|
|||||||
import fr.xephi.authme.service.JoinMessageService;
|
import fr.xephi.authme.service.JoinMessageService;
|
||||||
import fr.xephi.authme.service.TeleportationService;
|
import fr.xephi.authme.service.TeleportationService;
|
||||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||||
import fr.xephi.authme.settings.WelcomeMessageConfiguration;
|
|
||||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -49,9 +48,6 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private WelcomeMessageConfiguration welcomeMessageConfiguration;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private JoinMessageService joinMessageService;
|
private JoinMessageService joinMessageService;
|
||||||
|
|
||||||
@@ -102,9 +98,6 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
|||||||
// The Login event now fires (as intended) after everything is processed
|
// The Login event now fires (as intended) after everything is processed
|
||||||
bukkitService.callEvent(new LoginEvent(player));
|
bukkitService.callEvent(new LoginEvent(player));
|
||||||
|
|
||||||
// Login is done, display welcome message
|
|
||||||
welcomeMessageConfiguration.sendWelcomeMessage(player);
|
|
||||||
|
|
||||||
// Login is now finished; we can force all commands
|
// Login is now finished; we can force all commands
|
||||||
if (isFirstLogin) {
|
if (isFirstLogin) {
|
||||||
commandManager.runCommandsOnFirstLogin(player, authsWithSameIp);
|
commandManager.runCommandsOnFirstLogin(player, authsWithSameIp);
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package fr.xephi.authme.process.logout;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.data.limbo.LimboService;
|
import fr.xephi.authme.data.limbo.LimboService;
|
||||||
import fr.xephi.authme.events.LogoutEvent;
|
import fr.xephi.authme.events.LogoutEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package fr.xephi.authme.process.register;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.data.limbo.LimboService;
|
import fr.xephi.authme.data.limbo.LimboService;
|
||||||
import fr.xephi.authme.events.RegisterEvent;
|
import fr.xephi.authme.events.RegisterEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package fr.xephi.authme.process.register;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.data.limbo.LimboService;
|
import fr.xephi.authme.data.limbo.LimboService;
|
||||||
import fr.xephi.authme.events.RegisterEvent;
|
import fr.xephi.authme.events.RegisterEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
|
|||||||
+2
-2
@@ -89,9 +89,9 @@ abstract class AbstractPasswordRegisterExecutor<P extends AbstractPasswordRegist
|
|||||||
final Player player = params.getPlayer();
|
final Player player = params.getPlayer();
|
||||||
if (performLoginAfterRegister(params)) {
|
if (performLoginAfterRegister(params)) {
|
||||||
if (commonService.getProperty(PluginSettings.USE_ASYNC_TASKS)) {
|
if (commonService.getProperty(PluginSettings.USE_ASYNC_TASKS)) {
|
||||||
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player));
|
bukkitService.runTaskAsynchronously(() -> asynchronousLogin.forceLogin(player,0));
|
||||||
} else {
|
} else {
|
||||||
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player), SYNC_LOGIN_DELAY);
|
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player,0), SYNC_LOGIN_DELAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
syncProcessManager.processSyncPasswordRegister(player);
|
syncProcessManager.processSyncPasswordRegister(player);
|
||||||
|
|||||||
@@ -9,10 +9,13 @@ import fr.xephi.authme.security.PasswordSecurity;
|
|||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.RandomStringUtils;
|
import fr.xephi.authme.util.RandomStringUtils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import static fr.xephi.authme.permission.PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS;
|
import static fr.xephi.authme.permission.PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS;
|
||||||
import static fr.xephi.authme.process.register.executors.PlayerAuthBuilderHelper.createPlayerAuth;
|
import static fr.xephi.authme.process.register.executors.PlayerAuthBuilderHelper.createPlayerAuth;
|
||||||
@@ -64,8 +67,10 @@ class EmailRegisterExecutor implements RegistrationExecutor<EmailRegisterParams>
|
|||||||
@Override
|
@Override
|
||||||
public void executePostPersistAction(EmailRegisterParams params) {
|
public void executePostPersistAction(EmailRegisterParams params) {
|
||||||
Player player = params.getPlayer();
|
Player player = params.getPlayer();
|
||||||
boolean couldSendMail = emailService.sendPasswordMail(
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
||||||
player.getName(), params.getEmail(), params.getPassword());
|
Date date = new Date(System.currentTimeMillis());
|
||||||
|
boolean couldSendMail = emailService.sendNewPasswordMail(
|
||||||
|
player.getName(), params.getEmail(), params.getPassword(), PlayerUtils.getPlayerIp(player), dateFormat.format(date));
|
||||||
if (couldSendMail) {
|
if (couldSendMail) {
|
||||||
syncProcessManager.processSyncEmailRegister(player);
|
syncProcessManager.processSyncEmailRegister(player);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ import fr.xephi.authme.data.limbo.LimboService;
|
|||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.UnregisterByAdminEvent;
|
import fr.xephi.authme.events.UnregisterByAdminEvent;
|
||||||
import fr.xephi.authme.events.UnregisterByPlayerEvent;
|
import fr.xephi.authme.events.UnregisterByPlayerEvent;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
import fr.xephi.authme.process.AsynchronousProcess;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.service.BukkitService;
|
import fr.xephi.authme.service.BukkitService;
|
||||||
import fr.xephi.authme.service.CommonService;
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.TeleportationService;
|
import fr.xephi.authme.service.TeleportationService;
|
||||||
|
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
||||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||||
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
import fr.xephi.authme.settings.commandconfig.CommandManager;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.service.bungeecord.BungeeSender;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import fr.xephi.authme.settings.properties.PluginSettings;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static fr.xephi.authme.util.Utils.MILLIS_PER_MINUTE;
|
import static fr.xephi.authme.util.Utils.MILLIS_PER_MINUTE;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package fr.xephi.authme.service;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSourceType;
|
import fr.xephi.authme.datasource.DataSourceType;
|
||||||
import fr.xephi.authme.initialization.DataFolder;
|
import fr.xephi.authme.initialization.DataFolder;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.properties.BackupSettings;
|
import fr.xephi.authme.settings.properties.BackupSettings;
|
||||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||||
|
|||||||
@@ -47,37 +47,21 @@ public class GeoIpService {
|
|||||||
|
|
||||||
private static final String DATABASE_NAME = "GeoLite2-Country";
|
private static final String DATABASE_NAME = "GeoLite2-Country";
|
||||||
private static final String DATABASE_FILE = DATABASE_NAME + ".mmdb";
|
private static final String DATABASE_FILE = DATABASE_NAME + ".mmdb";
|
||||||
private static final String DATABASE_TMP_FILE = DATABASE_NAME + ".mmdb.tmp";
|
|
||||||
|
|
||||||
private static final String ARCHIVE_FILE = DATABASE_NAME + ".mmdb.gz";
|
|
||||||
|
|
||||||
private static final String ARCHIVE_URL =
|
|
||||||
"https://updates.maxmind.com/geoip/databases/" + DATABASE_NAME + "/update";
|
|
||||||
|
|
||||||
private static final int UPDATE_INTERVAL_DAYS = 30;
|
|
||||||
|
|
||||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(GeoIpService.class);
|
private final ConsoleLogger logger = ConsoleLoggerFactory.get(GeoIpService.class);
|
||||||
private final Path dataFile;
|
private final Path dataFile;
|
||||||
private final BukkitService bukkitService;
|
|
||||||
private final Settings settings;
|
|
||||||
|
|
||||||
private GeoIp2Provider databaseReader;
|
private GeoIp2Provider databaseReader;
|
||||||
private volatile boolean downloading;
|
private volatile boolean downloading;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
GeoIpService(@DataFolder File dataFolder, BukkitService bukkitService, Settings settings) {
|
GeoIpService(@DataFolder File dataFolder) {
|
||||||
this.bukkitService = bukkitService;
|
|
||||||
this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE);
|
this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE);
|
||||||
this.settings = settings;
|
|
||||||
|
|
||||||
// Fires download of recent data or the initialization of the look up service
|
// Fires download of recent data or the initialization of the look up service
|
||||||
isDataAvailable();
|
isDataAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
GeoIpService(@DataFolder File dataFolder, BukkitService bukkitService, Settings settings, GeoIp2Provider reader) {
|
GeoIpService(@DataFolder File dataFolder, GeoIp2Provider reader) {
|
||||||
this.bukkitService = bukkitService;
|
|
||||||
this.settings = settings;
|
|
||||||
this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE);
|
this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE);
|
||||||
|
|
||||||
this.databaseReader = reader;
|
this.databaseReader = reader;
|
||||||
@@ -101,73 +85,19 @@ public class GeoIpService {
|
|||||||
|
|
||||||
if (Files.exists(dataFile)) {
|
if (Files.exists(dataFile)) {
|
||||||
try {
|
try {
|
||||||
FileTime lastModifiedTime = Files.getLastModifiedTime(dataFile);
|
|
||||||
if (Duration.between(lastModifiedTime.toInstant(), Instant.now()).toDays() <= UPDATE_INTERVAL_DAYS) {
|
|
||||||
startReading();
|
startReading();
|
||||||
|
|
||||||
// don't fire the update task - we are up to date
|
// don't fire the update task - we are up to date
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
logger.debug("GEO IP database is older than " + UPDATE_INTERVAL_DAYS + " Days");
|
|
||||||
}
|
|
||||||
} catch (IOException ioEx) {
|
} catch (IOException ioEx) {
|
||||||
logger.logException("Failed to load GeoLiteAPI database", ioEx);
|
logger.logException("Failed to load GeoLiteAPI database", ioEx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the downloading flag in order to fix race conditions outside
|
|
||||||
downloading = true;
|
|
||||||
|
|
||||||
// File is outdated or doesn't exist - let's try to download the data file!
|
// File is outdated or doesn't exist - let's try to download the data file!
|
||||||
// use bukkit's cached threads
|
// use bukkit's cached threads
|
||||||
bukkitService.runTaskAsynchronously(this::updateDatabase);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tries to update the database by downloading a new version from the website.
|
|
||||||
*/
|
|
||||||
private void updateDatabase() {
|
|
||||||
logger.info("Downloading GEO IP database, because the old database is older than "
|
|
||||||
+ UPDATE_INTERVAL_DAYS + " days or doesn't exist");
|
|
||||||
|
|
||||||
Path downloadFile = null;
|
|
||||||
Path tempFile = null;
|
|
||||||
try {
|
|
||||||
// download database to temporarily location
|
|
||||||
downloadFile = Files.createTempFile(ARCHIVE_FILE, null);
|
|
||||||
tempFile = Files.createTempFile(DATABASE_TMP_FILE, null);
|
|
||||||
String expectedChecksum = downloadDatabaseArchive(downloadFile);
|
|
||||||
if (expectedChecksum == null) {
|
|
||||||
logger.info("There is no newer GEO IP database uploaded to MaxMind. Using the old one for now.");
|
|
||||||
startReading();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// tar extract database and copy to target destination
|
|
||||||
extractDatabase(downloadFile, tempFile);
|
|
||||||
|
|
||||||
// MD5 checksum verification
|
|
||||||
verifyChecksum(Hashing.md5(), tempFile, expectedChecksum);
|
|
||||||
|
|
||||||
Files.copy(tempFile, dataFile, StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
|
|
||||||
//only set this value to false on success otherwise errors could lead to endless download triggers
|
|
||||||
logger.info("Successfully downloaded new GEO IP database to " + dataFile);
|
|
||||||
startReading();
|
|
||||||
} catch (IOException ioEx) {
|
|
||||||
logger.logException("Could not download GeoLiteAPI database", ioEx);
|
|
||||||
} finally {
|
|
||||||
// clean up
|
|
||||||
if (downloadFile != null) {
|
|
||||||
FileUtils.delete(downloadFile.toFile());
|
|
||||||
}
|
|
||||||
if (tempFile != null) {
|
|
||||||
FileUtils.delete(tempFile.toFile());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startReading() throws IOException {
|
private void startReading() throws IOException {
|
||||||
databaseReader = new Reader(dataFile.toFile(), FileMode.MEMORY, new CHMCache());
|
databaseReader = new Reader(dataFile.toFile(), FileMode.MEMORY, new CHMCache());
|
||||||
@@ -177,101 +107,6 @@ public class GeoIpService {
|
|||||||
downloading = false;
|
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
|
|
||||||
*/
|
|
||||||
private String downloadDatabaseArchive(Instant lastModified, Path destination) throws IOException {
|
|
||||||
String clientId = settings.getProperty(ProtectionSettings.MAXMIND_API_CLIENT_ID);
|
|
||||||
String licenseKey = settings.getProperty(ProtectionSettings.MAXMIND_API_LICENSE_KEY);
|
|
||||||
if (clientId.isEmpty() || licenseKey.isEmpty()) {
|
|
||||||
logger.warning("No MaxMind credentials found in the configuration file!"
|
|
||||||
+ " GeoIp protections will be disabled.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(ARCHIVE_URL).openConnection();
|
|
||||||
String basicAuth = "Basic " + new String(Base64.getEncoder().encode((clientId + ":" + licenseKey).getBytes()));
|
|
||||||
connection.setRequestProperty("Authorization", basicAuth);
|
|
||||||
|
|
||||||
if (lastModified != null) {
|
|
||||||
// Only download if we actually need a newer version - this field is specified in GMT zone
|
|
||||||
ZonedDateTime zonedTime = lastModified.atZone(ZoneId.of("GMT"));
|
|
||||||
String timeFormat = DateTimeFormatter.RFC_1123_DATE_TIME.format(zonedTime);
|
|
||||||
connection.addRequestProperty("If-Modified-Since", timeFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
|
|
||||||
//we already have the newest version
|
|
||||||
connection.getInputStream().close();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String hash = connection.getHeaderField("X-Database-MD5");
|
|
||||||
String rawModifiedDate = connection.getHeaderField("Last-Modified");
|
|
||||||
Instant modifiedDate = Instant.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse(rawModifiedDate));
|
|
||||||
Files.copy(connection.getInputStream(), destination, StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
Files.setLastModifiedTime(destination, FileTime.from(modifiedDate));
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
private String downloadDatabaseArchive(Path destination) throws IOException {
|
|
||||||
Instant lastModified = null;
|
|
||||||
if (Files.exists(dataFile)) {
|
|
||||||
lastModified = Files.getLastModifiedTime(dataFile).toInstant();
|
|
||||||
}
|
|
||||||
|
|
||||||
return downloadDatabaseArchive(lastModified, destination);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
private void verifyChecksum(HashFunction function, Path file, String expectedChecksum) throws IOException {
|
|
||||||
HashCode actualHash = function.hashBytes(Files.readAllBytes(file));
|
|
||||||
HashCode expectedHash = HashCode.fromString(expectedChecksum);
|
|
||||||
if (!Objects.equals(actualHash, expectedHash)) {
|
|
||||||
throw new IOException("GEO IP Checksum verification failed. "
|
|
||||||
+ "Expected: " + expectedChecksum + "Actual:" + actualHash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
private void extractDatabase(Path inputFile, Path outputFile) throws IOException {
|
|
||||||
// .gz -> gzipped file
|
|
||||||
try (BufferedInputStream in = new BufferedInputStream(Files.newInputStream(inputFile));
|
|
||||||
GZIPInputStream gzipIn = new GZIPInputStream(in)) {
|
|
||||||
|
|
||||||
// found the database file and copy file
|
|
||||||
Files.copy(gzipIn, outputFile, StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
|
|
||||||
// update the last modification date to be same as in the archive
|
|
||||||
Files.setLastModifiedTime(outputFile, Files.getLastModifiedTime(inputFile));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the country code of the given IP address.
|
* Get the country code of the given IP address.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.HasCleanup;
|
import fr.xephi.authme.initialization.HasCleanup;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
import fr.xephi.authme.message.Messages;
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
@@ -20,6 +20,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -72,9 +74,10 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
|||||||
if (!checkEmailCooldown(player)) {
|
if (!checkEmailCooldown(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
||||||
|
Date date = new Date(System.currentTimeMillis());
|
||||||
String recoveryCode = recoveryCodeService.generateCode(player.getName());
|
String recoveryCode = recoveryCodeService.generateCode(player.getName());
|
||||||
boolean couldSendMail = emailService.sendRecoveryCode(player.getName(), email, recoveryCode);
|
boolean couldSendMail = emailService.sendRecoveryCode(player.getName(), email, recoveryCode, dateFormat.format(date));
|
||||||
if (couldSendMail) {
|
if (couldSendMail) {
|
||||||
commonService.send(player, MessageKey.RECOVERY_CODE_SENT);
|
commonService.send(player, MessageKey.RECOVERY_CODE_SENT);
|
||||||
emailCooldown.add(player.getName().toLowerCase(Locale.ROOT));
|
emailCooldown.add(player.getName().toLowerCase(Locale.ROOT));
|
||||||
@@ -94,6 +97,8 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
|||||||
if (!checkEmailCooldown(player)) {
|
if (!checkEmailCooldown(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
||||||
|
Date date = new Date(System.currentTimeMillis());
|
||||||
|
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
String thePass = RandomStringUtils.generate(commonService.getProperty(RECOVERY_PASSWORD_LENGTH));
|
String thePass = RandomStringUtils.generate(commonService.getProperty(RECOVERY_PASSWORD_LENGTH));
|
||||||
@@ -102,7 +107,7 @@ public class PasswordRecoveryService implements Reloadable, HasCleanup {
|
|||||||
logger.info("Generating new password for '" + name + "'");
|
logger.info("Generating new password for '" + name + "'");
|
||||||
|
|
||||||
dataSource.updatePassword(name, hashNew);
|
dataSource.updatePassword(name, hashNew);
|
||||||
boolean couldSendMail = emailService.sendPasswordMail(name, email, thePass);
|
boolean couldSendMail = emailService.sendPasswordMail(name, email, thePass, dateFormat.format(date));
|
||||||
if (couldSendMail) {
|
if (couldSendMail) {
|
||||||
commonService.send(player, MessageKey.RECOVERY_EMAIL_SENT_MESSAGE);
|
commonService.send(player, MessageKey.RECOVERY_EMAIL_SENT_MESSAGE);
|
||||||
emailCooldown.add(player.getName().toLowerCase(Locale.ROOT));
|
emailCooldown.add(player.getName().toLowerCase(Locale.ROOT));
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import fr.xephi.authme.data.auth.PlayerAuth;
|
|||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.events.RestoreSessionEvent;
|
import fr.xephi.authme.events.RestoreSessionEvent;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import com.google.common.collect.Multimap;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
import fr.xephi.authme.initialization.Reloadable;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.message.MessageKey;
|
import fr.xephi.authme.message.MessageKey;
|
||||||
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
import fr.xephi.authme.permission.PermissionsManager;
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
@@ -17,7 +17,6 @@ import fr.xephi.authme.settings.properties.ProtectionSettings;
|
|||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.util.StringUtils;
|
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -50,6 +49,7 @@ public class ValidationService implements Reloadable {
|
|||||||
private GeoIpService geoIpService;
|
private GeoIpService geoIpService;
|
||||||
|
|
||||||
private Pattern passwordRegex;
|
private Pattern passwordRegex;
|
||||||
|
private Pattern emailRegex;
|
||||||
private Multimap<String, String> restrictedNames;
|
private Multimap<String, String> restrictedNames;
|
||||||
|
|
||||||
ValidationService() {
|
ValidationService() {
|
||||||
@@ -62,6 +62,8 @@ public class ValidationService implements Reloadable {
|
|||||||
restrictedNames = settings.getProperty(RestrictionSettings.ENABLE_RESTRICTED_USERS)
|
restrictedNames = settings.getProperty(RestrictionSettings.ENABLE_RESTRICTED_USERS)
|
||||||
? loadNameRestrictions(settings.getProperty(RestrictionSettings.RESTRICTED_USERS))
|
? loadNameRestrictions(settings.getProperty(RestrictionSettings.RESTRICTED_USERS))
|
||||||
: HashMultimap.create();
|
: HashMultimap.create();
|
||||||
|
|
||||||
|
emailRegex = Utils.safePatternCompile(settings.getProperty(RestrictionSettings.ALLOWED_EMAIL_REGEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,12 +95,7 @@ public class ValidationService implements Reloadable {
|
|||||||
* @return true if the email is valid, false otherwise
|
* @return true if the email is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean validateEmail(String email) {
|
public boolean validateEmail(String email) {
|
||||||
if (Utils.isEmailEmpty(email) || !StringUtils.isInsideString('@', email)) {
|
return emailRegex.matcher(email).matches();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final String emailDomain = email.split("@")[1];
|
|
||||||
return validateWhitelistAndBlacklist(
|
|
||||||
emailDomain, EmailSettings.DOMAIN_WHITELIST, EmailSettings.DOMAIN_BLACKLIST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,9 @@ public class Settings extends SettingsManagerImpl {
|
|||||||
private String passwordEmailMessage;
|
private String passwordEmailMessage;
|
||||||
private String verificationEmailMessage;
|
private String verificationEmailMessage;
|
||||||
private String recoveryCodeEmailMessage;
|
private String recoveryCodeEmailMessage;
|
||||||
|
private String shutdownEmailMessage;
|
||||||
|
private String newPasswordEmailMessage;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -67,10 +70,19 @@ public class Settings extends SettingsManagerImpl {
|
|||||||
return recoveryCodeEmailMessage;
|
return recoveryCodeEmailMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getShutdownEmailMessage() {return shutdownEmailMessage;}
|
||||||
|
|
||||||
|
public String getNewPasswordEmailMessage() {
|
||||||
|
return newPasswordEmailMessage;
|
||||||
|
}
|
||||||
|
|
||||||
private void loadSettingsFromFiles() {
|
private void loadSettingsFromFiles() {
|
||||||
|
newPasswordEmailMessage = readFile("new_email.html");
|
||||||
passwordEmailMessage = readFile("email.html");
|
passwordEmailMessage = readFile("email.html");
|
||||||
verificationEmailMessage = readFile("verification_code_email.html");
|
verificationEmailMessage = readFile("verification_code_email.html");
|
||||||
recoveryCodeEmailMessage = readFile("recovery_code_email.html");
|
recoveryCodeEmailMessage = readFile("recovery_code_email.html");
|
||||||
|
shutdownEmailMessage = readFile("shutdown.html");
|
||||||
|
String country = readFile("GeoLite2-Country.mmdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
package fr.xephi.authme.settings;
|
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
|
||||||
import fr.xephi.authme.initialization.DataFolder;
|
|
||||||
import fr.xephi.authme.initialization.Reloadable;
|
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
|
||||||
import fr.xephi.authme.service.BukkitService;
|
|
||||||
import fr.xephi.authme.service.CommonService;
|
|
||||||
import fr.xephi.authme.service.GeoIpService;
|
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
|
||||||
import fr.xephi.authme.util.lazytags.Tag;
|
|
||||||
import fr.xephi.authme.util.lazytags.TagReplacer;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.entity.HumanEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static fr.xephi.authme.util.FileUtils.copyFileFromResource;
|
|
||||||
import static fr.xephi.authme.util.lazytags.TagBuilder.createTag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration for the welcome message (welcome.txt).
|
|
||||||
*/
|
|
||||||
public class WelcomeMessageConfiguration implements Reloadable {
|
|
||||||
|
|
||||||
private final ConsoleLogger logger = ConsoleLoggerFactory.get(WelcomeMessageConfiguration.class);
|
|
||||||
|
|
||||||
@DataFolder
|
|
||||||
@Inject
|
|
||||||
private File pluginFolder;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Server server;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private GeoIpService geoIpService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BukkitService bukkitService;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private PlayerCache playerCache;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CommonService service;
|
|
||||||
|
|
||||||
/** List of all supported tags for the welcome message. */
|
|
||||||
private final List<Tag<Player>> availableTags = Arrays.asList(
|
|
||||||
createTag("&", () -> String.valueOf(ChatColor.COLOR_CHAR)),
|
|
||||||
createTag("{PLAYER}", HumanEntity::getName),
|
|
||||||
createTag("{DISPLAYNAME}", Player::getDisplayName),
|
|
||||||
createTag("{DISPLAYNAMENOCOLOR}", Player::getDisplayName),
|
|
||||||
createTag("{ONLINE}", () -> Integer.toString(bukkitService.getOnlinePlayers().size())),
|
|
||||||
createTag("{MAXPLAYERS}", () -> Integer.toString(server.getMaxPlayers())),
|
|
||||||
createTag("{IP}", PlayerUtils::getPlayerIp),
|
|
||||||
createTag("{LOGINS}", () -> Integer.toString(playerCache.getLogged())),
|
|
||||||
createTag("{WORLD}", pl -> pl.getWorld().getName()),
|
|
||||||
createTag("{SERVER}", () -> service.getProperty(PluginSettings.SERVER_NAME)),
|
|
||||||
createTag("{VERSION}", () -> server.getBukkitVersion()),
|
|
||||||
createTag("{COUNTRY}", pl -> geoIpService.getCountryName(PlayerUtils.getPlayerIp(pl))));
|
|
||||||
|
|
||||||
private TagReplacer<Player> messageSupplier;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
@Override
|
|
||||||
public void reload() {
|
|
||||||
if (!(service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> welcomeMessage = new ArrayList<>();
|
|
||||||
for (String line : readWelcomeFile()) {
|
|
||||||
welcomeMessage.add(ChatColor.translateAlternateColorCodes('&', line));
|
|
||||||
}
|
|
||||||
messageSupplier = TagReplacer.newReplacer(availableTags, welcomeMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the welcome message for the given player.
|
|
||||||
*
|
|
||||||
* @param player the player for whom the welcome message should be prepared
|
|
||||||
* @return the welcome message
|
|
||||||
*/
|
|
||||||
public List<String> getWelcomeMessage(Player player) {
|
|
||||||
return messageSupplier.getAdaptedMessages(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends the welcome message accordingly to the configuration
|
|
||||||
*
|
|
||||||
* @param player the player for whom the welcome message should be prepared
|
|
||||||
*/
|
|
||||||
public void sendWelcomeMessage(Player player) {
|
|
||||||
if (service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE)) {
|
|
||||||
List<String> welcomeMessage = getWelcomeMessage(player);
|
|
||||||
if (service.getProperty(RegistrationSettings.BROADCAST_WELCOME_MESSAGE)) {
|
|
||||||
welcomeMessage.forEach(bukkitService::broadcastMessage);
|
|
||||||
} else {
|
|
||||||
welcomeMessage.forEach(player::sendMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the lines of the welcome message file
|
|
||||||
*/
|
|
||||||
private List<String> readWelcomeFile() {
|
|
||||||
if (!(service.getProperty(RegistrationSettings.USE_WELCOME_MESSAGE))) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
File welcomeFile = new File(pluginFolder, "welcome.txt");
|
|
||||||
if (copyFileFromResource(welcomeFile, "welcome.txt")) {
|
|
||||||
try {
|
|
||||||
return Files.readAllLines(welcomeFile.toPath(), StandardCharsets.UTF_8);
|
|
||||||
} catch (IOException e) {
|
|
||||||
logger.logException("Failed to read welcome.txt file:", e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.warning("Failed to copy welcome.txt from JAR");
|
|
||||||
}
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,16 +4,13 @@ import ch.jalu.configme.Comment;
|
|||||||
import ch.jalu.configme.SettingsHolder;
|
import ch.jalu.configme.SettingsHolder;
|
||||||
import ch.jalu.configme.properties.Property;
|
import ch.jalu.configme.properties.Property;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||||
|
|
||||||
public final class EmailSettings implements SettingsHolder {
|
public final class EmailSettings implements SettingsHolder {
|
||||||
|
|
||||||
@Comment("Email SMTP server host")
|
@Comment("Email SMTP server host")
|
||||||
public static final Property<String> SMTP_HOST =
|
public static final Property<String> SMTP_HOST =
|
||||||
newProperty("Email.mailSMTP", "smtp.gmail.com");
|
newProperty("Email.mailSMTP", "smtp.163.com");
|
||||||
|
|
||||||
@Comment("Email SMTP server port")
|
@Comment("Email SMTP server port")
|
||||||
public static final Property<Integer> SMTP_PORT =
|
public static final Property<Integer> SMTP_PORT =
|
||||||
@@ -41,7 +38,7 @@ public final class EmailSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Recovery password length")
|
@Comment("Recovery password length")
|
||||||
public static final Property<Integer> RECOVERY_PASSWORD_LENGTH =
|
public static final Property<Integer> RECOVERY_PASSWORD_LENGTH =
|
||||||
newProperty("Email.RecoveryPasswordLength", 8);
|
newProperty("Email.RecoveryPasswordLength", 12);
|
||||||
|
|
||||||
@Comment("Mail Subject")
|
@Comment("Mail Subject")
|
||||||
public static final Property<String> RECOVERY_MAIL_SUBJECT =
|
public static final Property<String> RECOVERY_MAIL_SUBJECT =
|
||||||
@@ -59,14 +56,6 @@ public final class EmailSettings implements SettingsHolder {
|
|||||||
public static final Property<Integer> DELAY_RECALL =
|
public static final Property<Integer> DELAY_RECALL =
|
||||||
newProperty("Email.delayRecall", 5);
|
newProperty("Email.delayRecall", 5);
|
||||||
|
|
||||||
@Comment("Blacklist these domains for emails")
|
|
||||||
public static final Property<List<String>> DOMAIN_BLACKLIST =
|
|
||||||
newListProperty("Email.emailBlacklisted", "10minutemail.com");
|
|
||||||
|
|
||||||
@Comment("Whitelist ONLY these domains for emails")
|
|
||||||
public static final Property<List<String>> DOMAIN_WHITELIST =
|
|
||||||
newListProperty("Email.emailWhitelisted");
|
|
||||||
|
|
||||||
@Comment("Send the new password drawn in an image?")
|
@Comment("Send the new password drawn in an image?")
|
||||||
public static final Property<Boolean> PASSWORD_AS_IMAGE =
|
public static final Property<Boolean> PASSWORD_AS_IMAGE =
|
||||||
newProperty("Email.generateImage", false);
|
newProperty("Email.generateImage", false);
|
||||||
@@ -74,6 +63,12 @@ public final class EmailSettings implements SettingsHolder {
|
|||||||
@Comment("The OAuth2 token")
|
@Comment("The OAuth2 token")
|
||||||
public static final Property<String> OAUTH2_TOKEN =
|
public static final Property<String> OAUTH2_TOKEN =
|
||||||
newProperty("Email.emailOauth2Token", "");
|
newProperty("Email.emailOauth2Token", "");
|
||||||
|
@Comment("Email notifications when the server shuts down")
|
||||||
|
public static final Property<Boolean> SHUTDOWN_MAIL =
|
||||||
|
newProperty("Email.shutDownEmail", false);
|
||||||
|
@Comment("Email notification address when the server is shut down")
|
||||||
|
public static final Property<String> SHUTDOWN_MAIL_ADDRESS =
|
||||||
|
newProperty("Email.shutDownEmailAddress", "your@mail.com");
|
||||||
|
|
||||||
private EmailSettings() {
|
private EmailSettings() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,21 +18,27 @@ public final class PluginSettings implements SettingsHolder {
|
|||||||
"expired, he will not need to authenticate."
|
"expired, he will not need to authenticate."
|
||||||
})
|
})
|
||||||
public static final Property<Boolean> SESSIONS_ENABLED =
|
public static final Property<Boolean> SESSIONS_ENABLED =
|
||||||
newProperty("settings.sessions.enabled", false);
|
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({
|
@Comment({
|
||||||
"After how many minutes should a session expire?",
|
"After how many minutes should a session expire?",
|
||||||
"A player's session ends after the timeout or if his IP has changed"
|
"A player's session ends after the timeout or if his IP has changed"
|
||||||
})
|
})
|
||||||
public static final Property<Integer> SESSIONS_TIMEOUT =
|
public static final Property<Integer> SESSIONS_TIMEOUT =
|
||||||
newProperty("settings.sessions.timeout", 10);
|
newProperty("settings.sessions.timeout", 43200);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Message language, available languages:",
|
"Message language, available languages:",
|
||||||
"https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md"
|
"https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md"
|
||||||
})
|
})
|
||||||
public static final Property<String> MESSAGES_LANGUAGE =
|
public static final Property<String> MESSAGES_LANGUAGE =
|
||||||
newProperty("settings.messagesLanguage", "en");
|
newProperty("settings.messagesLanguage", "zhcn");
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Enables switching a player to defined permission groups before they log in.",
|
"Enables switching a player to defined permission groups before they log in.",
|
||||||
|
|||||||
@@ -14,30 +14,21 @@ public final class ProtectionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Enable some servers protection (country based login, antibot)")
|
@Comment("Enable some servers protection (country based login, antibot)")
|
||||||
public static final Property<Boolean> ENABLE_PROTECTION =
|
public static final Property<Boolean> ENABLE_PROTECTION =
|
||||||
newProperty("Protection.enableProtection", false);
|
newProperty("Protection.enableProtection", true);
|
||||||
|
|
||||||
@Comment("Apply the protection also to registered usernames")
|
@Comment("Apply the protection also to registered usernames")
|
||||||
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
|
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
|
||||||
newProperty("Protection.enableProtectionRegistered", true);
|
newProperty("Protection.enableProtectionRegistered", true);
|
||||||
|
@Comment("Only allow registed usernames join server")
|
||||||
@Comment({"The MaxMind clientId used to download the GeoIp database,",
|
public static final Property<Boolean> ENABLE_WHITELIST =
|
||||||
"get one at https://www.maxmind.com/en/accounts/current/license-key",
|
newProperty("Protection.enableWhiteList", true);
|
||||||
"The EssentialsX project has a very useful tutorial on how to generate",
|
|
||||||
"the license key: https://github.com/EssentialsX/Wiki/blob/master/GeoIP.md"})
|
|
||||||
public static final Property<String> MAXMIND_API_CLIENT_ID =
|
|
||||||
newProperty("Protection.geoIpDatabase.clientId", "");
|
|
||||||
|
|
||||||
@Comment("The MaxMind licenseKey used to download the GeoIp database.")
|
|
||||||
public static final Property<String> MAXMIND_API_LICENSE_KEY =
|
|
||||||
newProperty("Protection.geoIpDatabase.licenseKey", "");
|
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Countries allowed to join the server and register. For country codes, see",
|
"Countries allowed to join the server and register. For country codes, see",
|
||||||
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
|
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
|
||||||
"Use \"LOCALHOST\" for local addresses.",
|
"Use \"LOCALHOST\" for local addresses.",
|
||||||
"PLEASE USE QUOTES!"})
|
"PLEASE USE QUOTES!"})
|
||||||
public static final Property<List<String>> COUNTRIES_WHITELIST =
|
public static final Property<List<String>> COUNTRIES_WHITELIST =
|
||||||
newListProperty("Protection.countries", "US", "GB", "LOCALHOST");
|
newListProperty("Protection.countries", "CN", "LOCALHOST");
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Countries not allowed to join the server and register",
|
"Countries not allowed to join the server and register",
|
||||||
@@ -69,7 +60,7 @@ public final class ProtectionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Kicks the player that issued a command before the defined time after the join process")
|
@Comment("Kicks the player that issued a command before the defined time after the join process")
|
||||||
public static final Property<Integer> QUICK_COMMANDS_DENIED_BEFORE_MILLISECONDS =
|
public static final Property<Integer> QUICK_COMMANDS_DENIED_BEFORE_MILLISECONDS =
|
||||||
newProperty("Protection.quickCommands.denyCommandsBeforeMilliseconds", 1000);
|
newProperty("Protection.quickCommands.denyCommandsBeforeMilliseconds", 3000);
|
||||||
|
|
||||||
private ProtectionSettings() {
|
private ProtectionSettings() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public final class RegistrationSettings implements SettingsHolder {
|
|||||||
"Send every X seconds a message to a player to",
|
"Send every X seconds a message to a player to",
|
||||||
"remind him that he has to login/register"})
|
"remind him that he has to login/register"})
|
||||||
public static final Property<Integer> MESSAGE_INTERVAL =
|
public static final Property<Integer> MESSAGE_INTERVAL =
|
||||||
newProperty("settings.registration.messageInterval", 5);
|
newProperty("settings.registration.messageInterval", 600);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Only registered and logged in players can play.",
|
"Only registered and logged in players can play.",
|
||||||
@@ -33,17 +33,18 @@ public final class RegistrationSettings implements SettingsHolder {
|
|||||||
"More info at https://github.com/AuthMe/AuthMeReloaded/wiki/Registration"
|
"More info at https://github.com/AuthMe/AuthMeReloaded/wiki/Registration"
|
||||||
})
|
})
|
||||||
public static final Property<RegistrationType> REGISTRATION_TYPE =
|
public static final Property<RegistrationType> REGISTRATION_TYPE =
|
||||||
newProperty(RegistrationType.class, "settings.registration.type", RegistrationType.PASSWORD);
|
newProperty(RegistrationType.class, "settings.registration.type", RegistrationType.EMAIL);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Second argument the /register command should take: NONE = no 2nd argument",
|
"Second argument the /register command should take: ",
|
||||||
|
"NONE = no 2nd argument",
|
||||||
"CONFIRMATION = must repeat first argument (pass or email)",
|
"CONFIRMATION = must repeat first argument (pass or email)",
|
||||||
"EMAIL_OPTIONAL = for password register: 2nd argument can be empty or have email address",
|
"EMAIL_OPTIONAL = for password register: 2nd argument can be empty or have email address",
|
||||||
"EMAIL_MANDATORY = for password register: 2nd argument MUST be an email address"
|
"EMAIL_MANDATORY = for password register: 2nd argument MUST be an email address"
|
||||||
})
|
})
|
||||||
public static final Property<RegisterSecondaryArgument> REGISTER_SECOND_ARGUMENT =
|
public static final Property<RegisterSecondaryArgument> REGISTER_SECOND_ARGUMENT =
|
||||||
newProperty(RegisterSecondaryArgument.class, "settings.registration.secondArg",
|
newProperty(RegisterSecondaryArgument.class, "settings.registration.secondArg",
|
||||||
RegisterSecondaryArgument.CONFIRMATION);
|
RegisterSecondaryArgument.NONE);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Do we force kick a player after a successful registration?",
|
"Do we force kick a player after a successful registration?",
|
||||||
@@ -54,26 +55,9 @@ public final class RegistrationSettings implements SettingsHolder {
|
|||||||
@Comment("Does AuthMe need to enforce a /login after a successful registration?")
|
@Comment("Does AuthMe need to enforce a /login after a successful registration?")
|
||||||
public static final Property<Boolean> FORCE_LOGIN_AFTER_REGISTER =
|
public static final Property<Boolean> FORCE_LOGIN_AFTER_REGISTER =
|
||||||
newProperty("settings.registration.forceLoginAfterRegister", false);
|
newProperty("settings.registration.forceLoginAfterRegister", false);
|
||||||
|
|
||||||
@Comment({
|
|
||||||
"Enable to display the welcome message (welcome.txt) after a login",
|
|
||||||
"You can use colors in this welcome.txt + some replaced strings:",
|
|
||||||
"{PLAYER}: player name, {ONLINE}: display number of online players,",
|
|
||||||
"{MAXPLAYERS}: display server slots, {IP}: player ip, {LOGINS}: number of players logged,",
|
|
||||||
"{WORLD}: player current world, {SERVER}: server name",
|
|
||||||
"{VERSION}: get current bukkit version, {COUNTRY}: player country"})
|
|
||||||
public static final Property<Boolean> USE_WELCOME_MESSAGE =
|
|
||||||
newProperty("settings.useWelcomeMessage", true);
|
|
||||||
|
|
||||||
@Comment({
|
|
||||||
"Broadcast the welcome message to the server or only to the player?",
|
|
||||||
"set true for server or false for player"})
|
|
||||||
public static final Property<Boolean> BROADCAST_WELCOME_MESSAGE =
|
|
||||||
newProperty("settings.broadcastWelcomeMessage", false);
|
|
||||||
|
|
||||||
@Comment("Should we delay the join message and display it once the player has logged in?")
|
@Comment("Should we delay the join message and display it once the player has logged in?")
|
||||||
public static final Property<Boolean> DELAY_JOIN_MESSAGE =
|
public static final Property<Boolean> DELAY_JOIN_MESSAGE =
|
||||||
newProperty("settings.delayJoinMessage", false);
|
newProperty("settings.delayJoinMessage", true);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"The custom join message that will be sent after a successful login,",
|
"The custom join message that will be sent after a successful login,",
|
||||||
@@ -87,15 +71,15 @@ public final class RegistrationSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Should we remove the leave messages of unlogged users?")
|
@Comment("Should we remove the leave messages of unlogged users?")
|
||||||
public static final Property<Boolean> REMOVE_UNLOGGED_LEAVE_MESSAGE =
|
public static final Property<Boolean> REMOVE_UNLOGGED_LEAVE_MESSAGE =
|
||||||
newProperty("settings.removeUnloggedLeaveMessage", false);
|
newProperty("settings.removeUnloggedLeaveMessage", true);
|
||||||
|
|
||||||
@Comment("Should we remove join messages altogether?")
|
@Comment("Should we remove join messages altogether?")
|
||||||
public static final Property<Boolean> REMOVE_JOIN_MESSAGE =
|
public static final Property<Boolean> REMOVE_JOIN_MESSAGE =
|
||||||
newProperty("settings.removeJoinMessage", false);
|
newProperty("settings.removeJoinMessage", true);
|
||||||
|
|
||||||
@Comment("Should we remove leave messages altogether?")
|
@Comment("Should we remove leave messages altogether?")
|
||||||
public static final Property<Boolean> REMOVE_LEAVE_MESSAGE =
|
public static final Property<Boolean> REMOVE_LEAVE_MESSAGE =
|
||||||
newProperty("settings.removeLeaveMessage", false);
|
newProperty("settings.removeLeaveMessage", true);
|
||||||
|
|
||||||
@Comment("Do we need to add potion effect Blinding before login/register?")
|
@Comment("Do we need to add potion effect Blinding before login/register?")
|
||||||
public static final Property<Boolean> APPLY_BLIND_EFFECT =
|
public static final Property<Boolean> APPLY_BLIND_EFFECT =
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
"Max number of allowed registrations per IP",
|
"Max number of allowed registrations per IP",
|
||||||
"The value 0 means an unlimited number of registrations!"})
|
"The value 0 means an unlimited number of registrations!"})
|
||||||
public static final Property<Integer> MAX_REGISTRATION_PER_IP =
|
public static final Property<Integer> MAX_REGISTRATION_PER_IP =
|
||||||
newProperty("settings.restrictions.maxRegPerIp", 1);
|
newProperty("settings.restrictions.maxRegPerIp", 3);
|
||||||
|
|
||||||
@Comment("Minimum allowed username length")
|
@Comment("Minimum allowed username length")
|
||||||
public static final Property<Integer> MIN_NICKNAME_LENGTH =
|
public static final Property<Integer> MIN_NICKNAME_LENGTH =
|
||||||
@@ -74,7 +74,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
"To activate the restricted user feature you need",
|
"To activate the restricted user feature you need",
|
||||||
"to enable this option and configure the AllowedRestrictedUser field."})
|
"to enable this option and configure the AllowedRestrictedUser field."})
|
||||||
public static final Property<Boolean> ENABLE_RESTRICTED_USERS =
|
public static final Property<Boolean> ENABLE_RESTRICTED_USERS =
|
||||||
newProperty("settings.restrictions.AllowRestrictedUser", false);
|
newProperty("settings.restrictions.AllowRestrictedUser", true);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"The restricted user feature will kick players listed below",
|
"The restricted user feature will kick players listed below",
|
||||||
@@ -85,7 +85,12 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
" - playername;127.0.0.1",
|
" - playername;127.0.0.1",
|
||||||
" - playername;regex:127\\.0\\.0\\..*"})
|
" - playername;regex:127\\.0\\.0\\..*"})
|
||||||
public static final Property<Set<String>> RESTRICTED_USERS =
|
public static final Property<Set<String>> RESTRICTED_USERS =
|
||||||
newLowercaseStringSetProperty("settings.restrictions.AllowedRestrictedUser");
|
newLowercaseStringSetProperty("settings.restrictions.AllowedRestrictedUser",
|
||||||
|
"server_land;127.0.0.1","server;127.0.0.1","bukkit;127.0.0.1","purpur;127.0.0.1",
|
||||||
|
"system;127.0.0.1","admin;127.0.0.1","md_5;127.0.0.1","administrator;127.0.0.1","notch;127.0.0.1",
|
||||||
|
"spigot;127.0.0.1","bukkit;127.0.0.1","bukkitcraft;127.0.0.1","paperclip;127.0.0.1","papermc;127.0.0.1",
|
||||||
|
"spigotmc;127.0.0.1","root;127.0.0.1","console;127.0.0.1","purpur;127.0.0.1","authme;127.0.0.1",
|
||||||
|
"owner;127.0.0.1");
|
||||||
|
|
||||||
@Comment("Ban unknown IPs trying to log in with a restricted username?")
|
@Comment("Ban unknown IPs trying to log in with a restricted username?")
|
||||||
public static final Property<Boolean> BAN_UNKNOWN_IP =
|
public static final Property<Boolean> BAN_UNKNOWN_IP =
|
||||||
@@ -97,7 +102,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Should players be kicked on wrong password?")
|
@Comment("Should players be kicked on wrong password?")
|
||||||
public static final Property<Boolean> KICK_ON_WRONG_PASSWORD =
|
public static final Property<Boolean> KICK_ON_WRONG_PASSWORD =
|
||||||
newProperty("settings.restrictions.kickOnWrongPassword", true);
|
newProperty("settings.restrictions.kickOnWrongPassword", false);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Should not logged in players be teleported to the spawn?",
|
"Should not logged in players be teleported to the spawn?",
|
||||||
@@ -108,28 +113,31 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Can unregistered players walk around?")
|
@Comment("Can unregistered players walk around?")
|
||||||
public static final Property<Boolean> ALLOW_UNAUTHED_MOVEMENT =
|
public static final Property<Boolean> ALLOW_UNAUTHED_MOVEMENT =
|
||||||
newProperty("settings.restrictions.allowMovement", false);
|
newProperty("settings.restrictions.allowMovement", true);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"After how many seconds should players who fail to login or register",
|
"After how many seconds should players who fail to login or register",
|
||||||
"be kicked? Set to 0 to disable."})
|
"be kicked? Set to 0 to disable."})
|
||||||
public static final Property<Integer> TIMEOUT =
|
public static final Property<Integer> TIMEOUT =
|
||||||
newProperty("settings.restrictions.timeout", 30);
|
newProperty("settings.restrictions.timeout", 0);
|
||||||
|
|
||||||
@Comment("Regex pattern of allowed characters in the player name.")
|
@Comment("Regex pattern of allowed characters in the player name.")
|
||||||
public static final Property<String> ALLOWED_NICKNAME_CHARACTERS =
|
public static final Property<String> ALLOWED_NICKNAME_CHARACTERS =
|
||||||
newProperty("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*");
|
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({
|
@Comment({
|
||||||
"How far can unregistered players walk?",
|
"How far can unregistered players walk?",
|
||||||
"Set to 0 for unlimited radius"
|
"Set to 0 for unlimited radius"
|
||||||
})
|
})
|
||||||
public static final Property<Integer> ALLOWED_MOVEMENT_RADIUS =
|
public static final Property<Integer> ALLOWED_MOVEMENT_RADIUS =
|
||||||
newProperty("settings.restrictions.allowedMovementRadius", 100);
|
newProperty("settings.restrictions.allowedMovementRadius", 0);
|
||||||
|
|
||||||
@Comment("Should we protect the player inventory before logging in? Requires ProtocolLib.")
|
@Comment("Should we protect the player inventory before logging in? Requires ProtocolLib.")
|
||||||
public static final Property<Boolean> PROTECT_INVENTORY_BEFORE_LOGIN =
|
public static final Property<Boolean> PROTECT_INVENTORY_BEFORE_LOGIN =
|
||||||
newProperty("settings.restrictions.ProtectInventoryBeforeLogIn", true);
|
newProperty("settings.restrictions.ProtectInventoryBeforeLogIn", false);
|
||||||
|
|
||||||
@Comment("Should we deny the tabcomplete feature before logging in? Requires ProtocolLib.")
|
@Comment("Should we deny the tabcomplete feature before logging in? Requires ProtocolLib.")
|
||||||
public static final Property<Boolean> DENY_TABCOMPLETE_BEFORE_LOGIN =
|
public static final Property<Boolean> DENY_TABCOMPLETE_BEFORE_LOGIN =
|
||||||
@@ -139,7 +147,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
"Should we display all other accounts from a player when he joins?",
|
"Should we display all other accounts from a player when he joins?",
|
||||||
"permission: /authme.admin.accounts"})
|
"permission: /authme.admin.accounts"})
|
||||||
public static final Property<Boolean> DISPLAY_OTHER_ACCOUNTS =
|
public static final Property<Boolean> DISPLAY_OTHER_ACCOUNTS =
|
||||||
newProperty("settings.restrictions.displayOtherAccounts", true);
|
newProperty("settings.restrictions.displayOtherAccounts", false);
|
||||||
|
|
||||||
@Comment("Spawn priority; values: authme, essentials, cmi, multiverse, default")
|
@Comment("Spawn priority; values: authme, essentials, cmi, multiverse, default")
|
||||||
public static final Property<String> SPAWN_PRIORITY =
|
public static final Property<String> SPAWN_PRIORITY =
|
||||||
@@ -147,15 +155,15 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Maximum Login authorized by IP")
|
@Comment("Maximum Login authorized by IP")
|
||||||
public static final Property<Integer> MAX_LOGIN_PER_IP =
|
public static final Property<Integer> MAX_LOGIN_PER_IP =
|
||||||
newProperty("settings.restrictions.maxLoginPerIp", 0);
|
newProperty("settings.restrictions.maxLoginPerIp", 3);
|
||||||
|
|
||||||
@Comment("Maximum Join authorized by IP")
|
@Comment("Maximum Join authorized by IP")
|
||||||
public static final Property<Integer> MAX_JOIN_PER_IP =
|
public static final Property<Integer> MAX_JOIN_PER_IP =
|
||||||
newProperty("settings.restrictions.maxJoinPerIp", 0);
|
newProperty("settings.restrictions.maxJoinPerIp", 3);
|
||||||
|
|
||||||
@Comment("AuthMe will NEVER teleport players if set to true!")
|
@Comment("AuthMe will NEVER teleport players if set to true!")
|
||||||
public static final Property<Boolean> NO_TELEPORT =
|
public static final Property<Boolean> NO_TELEPORT =
|
||||||
newProperty("settings.restrictions.noTeleport", false);
|
newProperty("settings.restrictions.noTeleport", true);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Regex syntax for allowed chars in passwords. The default [!-~] allows all visible ASCII",
|
"Regex syntax for allowed chars in passwords. The default [!-~] allows all visible ASCII",
|
||||||
@@ -165,6 +173,11 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
public static final Property<String> ALLOWED_PASSWORD_REGEX =
|
public static final Property<String> ALLOWED_PASSWORD_REGEX =
|
||||||
newProperty("settings.restrictions.allowedPasswordCharacters", "[!-~]*");
|
newProperty("settings.restrictions.allowedPasswordCharacters", "[!-~]*");
|
||||||
|
|
||||||
|
@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$");
|
||||||
|
|
||||||
|
|
||||||
@Comment("Force survival gamemode when player joins?")
|
@Comment("Force survival gamemode when player joins?")
|
||||||
public static final Property<Boolean> FORCE_SURVIVAL_MODE =
|
public static final Property<Boolean> FORCE_SURVIVAL_MODE =
|
||||||
newProperty("settings.GameMode.ForceSurvivalMode", false);
|
newProperty("settings.GameMode.ForceSurvivalMode", false);
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Max allowed tries before a captcha is required")
|
@Comment("Max allowed tries before a captcha is required")
|
||||||
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
||||||
newProperty("Security.captcha.maxLoginTry", 5);
|
newProperty("Security.captcha.maxLoginTry", 8);
|
||||||
|
|
||||||
@Comment("Captcha length")
|
@Comment("Captcha length")
|
||||||
public static final Property<Integer> CAPTCHA_LENGTH =
|
public static final Property<Integer> CAPTCHA_LENGTH =
|
||||||
newProperty("Security.captcha.captchaLength", 5);
|
newProperty("Security.captcha.captchaLength", 6);
|
||||||
|
|
||||||
@Comment("Minutes after which login attempts count is reset for a player")
|
@Comment("Minutes after which login attempts count is reset for a player")
|
||||||
public static final Property<Integer> CAPTCHA_COUNT_MINUTES_BEFORE_RESET =
|
public static final Property<Integer> CAPTCHA_COUNT_MINUTES_BEFORE_RESET =
|
||||||
newProperty("Security.captcha.captchaCountReset", 60);
|
newProperty("Security.captcha.captchaCountReset", 120);
|
||||||
|
|
||||||
@Comment("Require captcha before a player may register?")
|
@Comment("Require captcha before a player may register?")
|
||||||
public static final Property<Boolean> ENABLE_CAPTCHA_FOR_REGISTRATION =
|
public static final Property<Boolean> ENABLE_CAPTCHA_FOR_REGISTRATION =
|
||||||
@@ -45,11 +45,11 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Minimum length of password")
|
@Comment("Minimum length of password")
|
||||||
public static final Property<Integer> MIN_PASSWORD_LENGTH =
|
public static final Property<Integer> MIN_PASSWORD_LENGTH =
|
||||||
newProperty("settings.security.minPasswordLength", 5);
|
newProperty("settings.security.minPasswordLength", 8);
|
||||||
|
|
||||||
@Comment("Maximum length of password")
|
@Comment("Maximum length of password")
|
||||||
public static final Property<Integer> MAX_PASSWORD_LENGTH =
|
public static final Property<Integer> MAX_PASSWORD_LENGTH =
|
||||||
newProperty("settings.security.passwordMaxLength", 30);
|
newProperty("settings.security.passwordMaxLength", 26);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Possible values: SHA256, BCRYPT, BCRYPT2Y, PBKDF2, SALTEDSHA512,",
|
"Possible values: SHA256, BCRYPT, BCRYPT2Y, PBKDF2, SALTEDSHA512,",
|
||||||
@@ -87,7 +87,7 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
"- 'help'"})
|
"- 'help'"})
|
||||||
public static final Property<Set<String>> UNSAFE_PASSWORDS =
|
public static final Property<Set<String>> UNSAFE_PASSWORDS =
|
||||||
newLowercaseStringSetProperty("settings.security.unsafePasswords",
|
newLowercaseStringSetProperty("settings.security.unsafePasswords",
|
||||||
"123456", "password", "qwerty", "12345", "54321", "123456789", "help");
|
"12345678", "password", "qwertyui", "123456789", "87654321", "1234567890", "asdfghjkl","zxcvbnm,","asdfghjk","12312312","123123123","32132132","321321321");
|
||||||
|
|
||||||
@Comment("Tempban a user's IP address if they enter the wrong password too many times")
|
@Comment("Tempban a user's IP address if they enter the wrong password too many times")
|
||||||
public static final Property<Boolean> TEMPBAN_ON_MAX_LOGINS =
|
public static final Property<Boolean> TEMPBAN_ON_MAX_LOGINS =
|
||||||
@@ -95,7 +95,7 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("How many times a user can attempt to login before their IP being tempbanned")
|
@Comment("How many times a user can attempt to login before their IP being tempbanned")
|
||||||
public static final Property<Integer> MAX_LOGIN_TEMPBAN =
|
public static final Property<Integer> MAX_LOGIN_TEMPBAN =
|
||||||
newProperty("Security.tempban.maxLoginTries", 10);
|
newProperty("Security.tempban.maxLoginTries", 8);
|
||||||
|
|
||||||
@Comment({"The length of time a IP address will be tempbanned in minutes",
|
@Comment({"The length of time a IP address will be tempbanned in minutes",
|
||||||
"Default: 480 minutes, or 8 hours"})
|
"Default: 480 minutes, or 8 hours"})
|
||||||
@@ -118,17 +118,17 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("How many hours is a recovery code valid for?")
|
@Comment("How many hours is a recovery code valid for?")
|
||||||
public static final Property<Integer> RECOVERY_CODE_HOURS_VALID =
|
public static final Property<Integer> RECOVERY_CODE_HOURS_VALID =
|
||||||
newProperty("Security.recoveryCode.validForHours", 4);
|
newProperty("Security.recoveryCode.validForHours", 6);
|
||||||
|
|
||||||
@Comment("Max number of tries to enter recovery code")
|
@Comment("Max number of tries to enter recovery code")
|
||||||
public static final Property<Integer> RECOVERY_CODE_MAX_TRIES =
|
public static final Property<Integer> RECOVERY_CODE_MAX_TRIES =
|
||||||
newProperty("Security.recoveryCode.maxTries", 3);
|
newProperty("Security.recoveryCode.maxTries", 4);
|
||||||
|
|
||||||
@Comment({"How long a player has after password recovery to change their password",
|
@Comment({"How long a player has after password recovery to change their password",
|
||||||
"without logging in. This is in minutes.",
|
"without logging in. This is in minutes.",
|
||||||
"Default: 2 minutes"})
|
"Default: 2 minutes"})
|
||||||
public static final Property<Integer> PASSWORD_CHANGE_TIMEOUT =
|
public static final Property<Integer> PASSWORD_CHANGE_TIMEOUT =
|
||||||
newProperty("Security.recoveryCode.passwordChangeTimeout", 2);
|
newProperty("Security.recoveryCode.passwordChangeTimeout", 5);
|
||||||
|
|
||||||
@Comment({
|
@Comment({
|
||||||
"Seconds a user has to wait for before a password recovery mail may be sent again",
|
"Seconds a user has to wait for before a password recovery mail may be sent again",
|
||||||
|
|||||||
Binary file not shown.
@@ -41,7 +41,10 @@
|
|||||||
# executor: CONSOLE
|
# executor: CONSOLE
|
||||||
# ifNumberOfAccountsAtLeast: 5
|
# ifNumberOfAccountsAtLeast: 5
|
||||||
# Commands to run for players logging in whose 'last login date' was empty
|
# Commands to run for players logging in whose 'last login date' was empty
|
||||||
onFirstLogin: {}
|
onFirstLogin:
|
||||||
|
broadcast:
|
||||||
|
command: 'cmi broadcast &b欢迎 &r%p &7( %ip ) &b光临服务器,请大家多多关照!'
|
||||||
|
executor: CONSOLE
|
||||||
onJoin: {}
|
onJoin: {}
|
||||||
onLogin: {}
|
onLogin: {}
|
||||||
# These commands are called whenever a logged in player uses /logout or quits.
|
# These commands are called whenever a logged in player uses /logout or quits.
|
||||||
|
|||||||
+120
-18
@@ -1,18 +1,120 @@
|
|||||||
<h1>
|
<div class="mail">
|
||||||
Dear <playername />,
|
<style>
|
||||||
</h1>
|
.mail td{
|
||||||
|
font-family: "Segoe UI", sans-serif;
|
||||||
<p>
|
text-align: center;
|
||||||
This is your new AuthMe password for the server <servername />:
|
font-size: 16px;
|
||||||
</p>
|
color: #718096;
|
||||||
<p>
|
}
|
||||||
<generatedpass />
|
.mail th, div, p, a, h1, h2, h3, h4, h5, h6{
|
||||||
</p>
|
font-family: "Segoe UI", sans-serif;
|
||||||
<image />
|
text-align: center;
|
||||||
<p>
|
color: #3d4852;
|
||||||
Do not forget to change password after login!<br />
|
}
|
||||||
/changepassword <generatedpass /> newPassword'
|
.mail .mail-content {
|
||||||
</p>
|
max-width: 100vw;
|
||||||
<p>
|
padding: 32px;
|
||||||
See you on <servername />!
|
box-shadow: 0 15px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.25);
|
||||||
</p>
|
}
|
||||||
|
.mail div{
|
||||||
|
background-color: #ffffff;color: #718096;height: 100%;line-height: 1.4;width: 100%;
|
||||||
|
}
|
||||||
|
.mail .x_wrapper{
|
||||||
|
background-color: #edf2f7;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
.mail .x_content{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.mail .x_inner-body{
|
||||||
|
background-color: #ffffff;border-color: #e8e5ef;border-radius: 2px;border-width: 1px;margin: 0 auto;padding:0;width: 570px;
|
||||||
|
}
|
||||||
|
.mail .x_content-cell{
|
||||||
|
margin: 0 auto;padding: 0;width: 570px;line-height: 1.5em;
|
||||||
|
color: #b0adc5;font-size: 12px;
|
||||||
|
}
|
||||||
|
.mail .x_content-cell td{
|
||||||
|
max-width: 100vw;padding: 32px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div>
|
||||||
|
<table class="x_wrapper">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table class="x_content">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="padding: 25px 0;">
|
||||||
|
<h1 style="font-size: 20px;">密码重置邮件</h1>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table class="x_inner-body">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="mail-content">
|
||||||
|
<h1 style="font-size: 18px;margin-bottom: 25px;">Minecraft · <servername /><br/><playername /></h1>
|
||||||
|
<hr>
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
您正在申请的新密码为
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-weight: bold;">
|
||||||
|
<br/><generatedpass /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<br/>请妥善保存,在新地址上进行登录时,需提供该密码.
|
||||||
|
<br/>若非必要,请勿更换密码,否则将对您的账户安全构成威胁.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align:right;">
|
||||||
|
<br/>
|
||||||
|
<br/>祝您游玩愉快~!
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<small>
|
||||||
|
<br/><time />
|
||||||
|
<br/>请勿回复
|
||||||
|
</small>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table class="x_content-cell">
|
||||||
|
<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>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
# AuthmeReloaded帮助文件汉化
|
|
||||||
# Translated By CH1
|
|
||||||
# -------------------------------------------------------
|
|
||||||
common:
|
common:
|
||||||
header: '==========[ AuthMeReloaded ]=========='
|
header: '======================================'
|
||||||
optional: '可选'
|
optional: '可选'
|
||||||
hasPermission: '您拥有权限去使用这个指令'
|
hasPermission: '您拥有权限去使用这个指令'
|
||||||
noPermission: '您没有权限使用这个指令'
|
noPermission: '您没有权限使用这个指令'
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2Сесията е продължена.'
|
|
||||||
invalid_session: '&cТвоят IP се е променил и сесията беше прекратена.'
|
invalid_session: '&cТвоят IP се е променил и сесията беше прекратена.'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ misc:
|
|||||||
|
|
||||||
# Mensagens de sessão
|
# Mensagens de sessão
|
||||||
session:
|
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!'
|
invalid_session: '&fO seu IP foi alterado e sua sessão expirou!'
|
||||||
|
|
||||||
# Mensagens de erro ao entrar
|
# Mensagens de erro ao entrar
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&cAutomatické znovupřihlášení.'
|
|
||||||
invalid_session: '&cChyba: Počkej než vyprší tvoje relace.'
|
invalid_session: '&cChyba: Počkej než vyprší tvoje relace.'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2Erfolgreich eingeloggt!'
|
|
||||||
invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist.'
|
invalid_session: '&cUngültige Session. Bitte starte das Spiel neu oder warte, bis die Session abgelaufen ist.'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
invalid_session: '&cYour IP has been changed and your session data has expired!'
|
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
|
# Error messages when joining
|
||||||
on_join_validation:
|
on_join_validation:
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2Ensalutantojn pro Sesio Rekonektas.'
|
|
||||||
invalid_session: '&cVia IP estis ŝanĝita kaj via seanco datumoj finiĝis!'
|
invalid_session: '&cVia IP estis ŝanĝita kaj via seanco datumoj finiĝis!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&cInicio de sesión'
|
|
||||||
invalid_session: '&fLos datos de sesión no corresponden. Por favor espera a terminar la sesión.'
|
invalid_session: '&fLos datos de sesión no corresponden. Por favor espera a terminar la sesión.'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
invalid_session: '&cSinu IP-aadress muutus, seega sinu sessioon aegus!'
|
invalid_session: '&cSinu IP-aadress muutus, seega sinu sessioon aegus!'
|
||||||
valid_session: '&2Sisse logitud sessiooni jätkumise tõttu.'
|
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
on_join_validation:
|
on_join_validation:
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
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!'
|
invalid_session: '&cZure IP helbidea aldatu da, eta horregatik zure sesioa iraungi da!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&cIstunto jatkettu!'
|
|
||||||
invalid_session: '&fIstunto ei täsmää! Ole hyvä ja odota istunnon loppuun'
|
invalid_session: '&fIstunto ei täsmää! Ole hyvä ja odota istunnon loppuun'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ misc:
|
|||||||
|
|
||||||
# Session
|
# Session
|
||||||
session:
|
session:
|
||||||
valid_session: '&aVous avez été automatiquement connecté !'
|
|
||||||
invalid_session: 'Session expirée suite à un changement d''IP.'
|
invalid_session: 'Session expirée suite à un changement d''IP.'
|
||||||
|
|
||||||
# Erreurs lors d'une tentative connexion
|
# Erreurs lors d'une tentative connexion
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
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'
|
invalid_session: '&fOs datos de sesión non corresponden, por favor, espere a que remate a sesión'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
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.'
|
invalid_session: '&cAz IP címed megváltozott, ezért a visszacsatlakozási időkereted lejárt.'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2Otomatis login, karena sesi masih terhubung.'
|
|
||||||
invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!'
|
invalid_session: '&cIP kamu telah berubah, dan sesi kamu telah berakhir!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2Autenticato automaticamente attraverso la precedente sessione!'
|
|
||||||
invalid_session: '&cIl tuo indirizzo IP è cambiato e la tua sessione è stata terminata!'
|
invalid_session: '&cIl tuo indirizzo IP è cambiato e la tua sessione è stata terminata!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2세션 재 연결로 인해 로그인 되었습니다.'
|
|
||||||
invalid_session: '&cIP가 변경되어 세션이 만료되었습니다!'
|
invalid_session: '&cIP가 변경되어 세션이 만료되었습니다!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&aSesijos prisijungimas'
|
|
||||||
invalid_session: '&cSesijos laikai nesutampa, prasome palaukti kol secija baigsis.'
|
invalid_session: '&cSesijos laikai nesutampa, prasome palaukti kol secija baigsis.'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&2Ingelogd wegens sessie-herverbinding.'
|
|
||||||
invalid_session: '&cJouw IP-adres is veranderd en je sessie is verlopen!'
|
invalid_session: '&cJouw IP-adres is veranderd en je sessie is verlopen!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&aZalogowano automatycznie z powodu sesji logowania.'
|
|
||||||
invalid_session: '&fSesja logowania zakończona!'
|
invalid_session: '&fSesja logowania zakończona!'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ misc:
|
|||||||
|
|
||||||
# Session messages
|
# Session messages
|
||||||
session:
|
session:
|
||||||
valid_session: '&cSessão válida'
|
|
||||||
invalid_session: '&fDados de sessão não correspondem. Por favor aguarde o fim da sessão'
|
invalid_session: '&fDados de sessão não correspondem. Por favor aguarde o fim da sessão'
|
||||||
|
|
||||||
# Error messages when joining
|
# Error messages when joining
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user