Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e6cee92ef1 | |||
| 31123081c7 | |||
| b5b435d398 | |||
| 395f8f825f | |||
| c71bd9f3a8 | |||
| 3e971c3dfd | |||
| 3f372d9228 | |||
| d385093403 | |||
| f978b285ae | |||
| 1eeaa442db | |||
| 14cc0abdc5 | |||
| d5ce692933 | |||
| 56a7b90c99 | |||
| 9352e7f32e | |||
| 0fc2f61a42 | |||
| 25249125b1 | |||
| 9d6d325fa6 | |||
| 0d408ede47 | |||
| 36bc761c19 | |||
| 9c3f0b0142 | |||
| e6be595c16 | |||
| dd4739a822 | |||
| 39254506bf | |||
| 227d93d756 | |||
| d223f316d6 | |||
| b6ec553dcb | |||
| cc6a9c38bd | |||
| 04ad3adbd1 | |||
| ef3804bf4e | |||
| b5d3408773 | |||
| 470f5ff28f | |||
| 888ee7235b | |||
| c97eda6672 | |||
| 81478f203c | |||
| ec51635d44 | |||
| aae15fba60 | |||
| 57fad7e113 | |||
| 1c25908a04 | |||
| 84a8137955 | |||
| 038d4c1850 | |||
| 0ffe2c2fc9 | |||
| 401933038d | |||
| 5cf88f308a | |||
| 29df796c48 | |||
| 79af85667e | |||
| 57237f6dfa | |||
| fc86e3ef78 | |||
| 846b7f67e5 | |||
| ffe3f5d24a | |||
| 2db1a15c72 | |||
| 95342ae054 | |||
| 6800356f10 | |||
| 95b5d88197 | |||
| 9f6f55d8e8 | |||
| d1ebcfeef0 | |||
| 5305bf0bfd | |||
| 78c5ab5d8a | |||
| 836c568fef | |||
| 7cbd1ebae7 | |||
| a35a277b32 | |||
| 971f0f7683 | |||
| d2718c1934 | |||
| 0cdd2b20d6 | |||
| 66b2bf8436 | |||
| cf01767ad3 | |||
| fdefdb88cc | |||
| 4bcc992b7f | |||
| 35aba2207b | |||
| ce2ee9e0fb | |||
| 9093ad2d9f | |||
| 08ed6504f2 | |||
| 9f70748b55 | |||
| 3f6a7ce48f | |||
| ed320196fe | |||
| 62f27f8231 | |||
| c3485903c5 | |||
| 5f3089b61b | |||
| e8f42ab669 | |||
| e3ff584bf4 | |||
| a9116a2f28 | |||
| ddd8c44396 | |||
| 6edcfa993e | |||
| e63764e2cf | |||
| 63540088c9 |
@@ -1,34 +0,0 @@
|
|||||||
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
|
|
||||||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
|
|
||||||
|
|
||||||
name: Maven Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set up JDK 11
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
java-version: '11'
|
|
||||||
distribution: 'temurin'
|
|
||||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
|
||||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
|
||||||
|
|
||||||
- name: Build with Maven
|
|
||||||
run: mvn -B package --file pom.xml
|
|
||||||
|
|
||||||
- name: Publish to GitHub Packages Apache Maven
|
|
||||||
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
@@ -21,4 +21,3 @@ jobs:
|
|||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
- name: 使用Maven构建
|
- name: 使用Maven构建
|
||||||
run: mvn -V -B clean package --file pom.xml
|
run: mvn -V -B clean package --file pom.xml
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -21,10 +21,11 @@ hs_err_pid*
|
|||||||
|
|
||||||
# Ignore IDEA directory
|
# Ignore IDEA directory
|
||||||
.idea/*
|
.idea/*
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
|
||||||
# Include the project's code style settings file
|
# Include the project's code style settings file
|
||||||
!.idea/codeStyleSettings.xml
|
|
||||||
/target/class/
|
|
||||||
# File-based project format:
|
# File-based project format:
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
|||||||
Generated
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
@@ -1,4 +1,21 @@
|
|||||||
# AuthMeReReloaded
|
# AuthMeReReloaded
|
||||||
**"A fork of the best authentication plugin for the Bukkit modding API!"**
|
**"A fork of the best authentication plugin for the Bukkit modding API!"**
|
||||||
|
MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471495)
|
||||||

|

|
||||||
|
|
||||||
|
**Detailed Changes:**
|
||||||
|
1. Improved mail sending logic & support more emails
|
||||||
|
2. Shutdown mail sending(When server is closed, email you)
|
||||||
|
3. Old bug fixes
|
||||||
|
4. Anti Ghost Player(Doubled login bug)
|
||||||
|
5. Use the best performance method by server brand
|
||||||
|
6. Bedrock Compatibility(Floodgate needed)
|
||||||
|
7. Update checker
|
||||||
|
8. Integrated GUI Captcha feature(Bedrock compatibility & ProtocolLib needed)(70% Asynchronous)
|
||||||
|
9. Improved listeners
|
||||||
|
10. Player login logic improvement to reduce lag
|
||||||
|
11. Automatically purge bot data
|
||||||
|
12. Folia compatibility [Here](https://github.com/HaHaWTH/AuthMeReReloaded/releases/download/b20/AuthMe-5.6.0-FORK-Folia.jar)
|
||||||
|
13. Offhand Menu compatibility(Thats amazing)
|
||||||
|
14. Automatically fix portal stuck issue
|
||||||
|
15. More......
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
<maven.minimumVersion>3.6.3</maven.minimumVersion>
|
<maven.minimumVersion>3.6.3</maven.minimumVersion>
|
||||||
|
|
||||||
<!-- Dependencies versions -->
|
<!-- Dependencies versions -->
|
||||||
<spigot.version>1.19.2-R0.1-SNAPSHOT</spigot.version>
|
<spigot.version>1.20.1-R0.1-SNAPSHOT</spigot.version>
|
||||||
|
|
||||||
<!-- Versioning properties -->
|
<!-- Versioning properties -->
|
||||||
<project.outputName>AuthMe</project.outputName>
|
<project.outputName>AuthMe</project.outputName>
|
||||||
@@ -217,7 +217,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.8.10</version>
|
<version>0.8.8</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>pre-unit-test</id>
|
<id>pre-unit-test</id>
|
||||||
@@ -608,6 +608,16 @@
|
|||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack</id>
|
||||||
|
<url>https://jitpack.io/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -616,7 +626,7 @@
|
|||||||
<groupId>org.geysermc.floodgate</groupId>
|
<groupId>org.geysermc.floodgate</groupId>
|
||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>2.2.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Jalu Injector -->
|
<!-- Jalu Injector -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -690,7 +700,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-simple</artifactId>
|
<artifactId>slf4j-simple</artifactId>
|
||||||
<version>2.0.7</version> <!-- We can't update to 2.x as long as we use HikariCP for java 8 -->
|
<version>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>
|
||||||
|
|
||||||
@@ -706,13 +716,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<version>8.1.0</version>
|
<version>8.0.33</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mariadb.jdbc</groupId>
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
<artifactId>mariadb-java-client</artifactId>
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
<version>3.1.4</version>
|
<version>3.1.2</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -780,7 +790,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.jalu</groupId>
|
<groupId>ch.jalu</groupId>
|
||||||
<artifactId>configme</artifactId>
|
<artifactId>configme</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.3.1</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -802,7 +812,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
<artifactId>ProtocolLib</artifactId>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
<version>5.0.0</version>
|
<version>5.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -945,7 +955,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.essentialsx</groupId>
|
<groupId>net.essentialsx</groupId>
|
||||||
<artifactId>EssentialsX</artifactId>
|
<artifactId>EssentialsX</artifactId>
|
||||||
<version>2.20.0</version>
|
<version>2.20.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -1017,7 +1027,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>42.6.0</version>
|
<version>42.5.4</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@@ -1047,7 +1057,7 @@
|
|||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<version>5.4.0</version>
|
<version>5.2.0</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>hamcrest-core</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
@@ -1060,7 +1070,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.checkerframework</groupId>
|
<groupId>org.checkerframework</groupId>
|
||||||
<artifactId>checker-qual</artifactId>
|
<artifactId>checker-qual</artifactId>
|
||||||
<version>3.36.0</version>
|
<version>3.39.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -1068,13 +1078,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.42.0.0</version>
|
<version>3.40.1.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>2.2.220</version>
|
<version>2.1.214</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package fr.xephi.authme;
|
|||||||
|
|
||||||
import ch.jalu.injector.Injector;
|
import ch.jalu.injector.Injector;
|
||||||
import ch.jalu.injector.InjectorBuilder;
|
import ch.jalu.injector.InjectorBuilder;
|
||||||
import com.google.gson.annotations.Since;
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
import fr.xephi.authme.command.CommandArgumentDescription;
|
|
||||||
import fr.xephi.authme.command.CommandHandler;
|
import fr.xephi.authme.command.CommandHandler;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.initialization.DataFolder;
|
import fr.xephi.authme.initialization.DataFolder;
|
||||||
@@ -12,27 +10,22 @@ import fr.xephi.authme.initialization.DataSourceProvider;
|
|||||||
import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
|
import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
|
||||||
import fr.xephi.authme.initialization.OnStartupTasks;
|
import fr.xephi.authme.initialization.OnStartupTasks;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import fr.xephi.authme.initialization.SettingsProvider;
|
import fr.xephi.authme.initialization.SettingsProvider;
|
||||||
import fr.xephi.authme.initialization.TaskCloser;
|
import fr.xephi.authme.initialization.TaskCloser;
|
||||||
import fr.xephi.authme.listener.BlockListener;
|
import fr.xephi.authme.listener.BlockListener;
|
||||||
import fr.xephi.authme.listener.EntityListener;
|
import fr.xephi.authme.listener.EntityListener;
|
||||||
|
import fr.xephi.authme.listener.LoginLocationFixListener;
|
||||||
import fr.xephi.authme.listener.PlayerListener;
|
import fr.xephi.authme.listener.PlayerListener;
|
||||||
import fr.xephi.authme.listener.PlayerListener111;
|
import fr.xephi.authme.listener.PlayerListener111;
|
||||||
import fr.xephi.authme.listener.PlayerListener19;
|
import fr.xephi.authme.listener.PlayerListener19;
|
||||||
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
import fr.xephi.authme.listener.PlayerListener19Spigot;
|
||||||
import fr.xephi.authme.listener.PlayerQuitListener;
|
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
||||||
import fr.xephi.authme.listener.RegisterListener;
|
import fr.xephi.authme.listener.GuiCaptchaHandler;
|
||||||
|
import fr.xephi.authme.listener.PlayerListenerHigherThan18;
|
||||||
import fr.xephi.authme.listener.ServerListener;
|
import fr.xephi.authme.listener.ServerListener;
|
||||||
import fr.xephi.authme.mail.EmailService;
|
import fr.xephi.authme.mail.EmailService;
|
||||||
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
import fr.xephi.authme.output.ConsoleLoggerFactory;
|
||||||
@@ -45,13 +38,10 @@ import fr.xephi.authme.service.yaml.YamlParseException;
|
|||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.settings.SettingsWarner;
|
import fr.xephi.authme.settings.SettingsWarner;
|
||||||
import fr.xephi.authme.settings.properties.EmailSettings;
|
import fr.xephi.authme.settings.properties.EmailSettings;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.task.CleanupTask;
|
import fr.xephi.authme.task.CleanupTask;
|
||||||
import fr.xephi.authme.task.purge.PurgeService;
|
import fr.xephi.authme.task.purge.PurgeService;
|
||||||
import fr.xephi.authme.util.ExceptionUtils;
|
import fr.xephi.authme.util.ExceptionUtils;
|
||||||
import fr.xephi.authme.util.TeleportUtils;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -61,24 +51,17 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import fr.xephi.authme.listener.PlayerQuitListener;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE;
|
||||||
import static fr.xephi.authme.util.Utils.isClassLoaded;
|
import static fr.xephi.authme.util.Utils.isClassLoaded;
|
||||||
import static org.bukkit.Bukkit.getServer;
|
|
||||||
import static org.bukkit.Bukkit.isHardcore;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AuthMe main class.
|
* The AuthMe main class.
|
||||||
@@ -93,26 +76,25 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// Version and build number values
|
// Version and build number values
|
||||||
private static String pluginVersion = "5.6.0-Fork";
|
private static String pluginVersion = "5.6.0-Fork";
|
||||||
private static final String pluginBuild = "b";
|
private static final String pluginBuild = "b";
|
||||||
private static String pluginBuildNumber = "17";
|
private static String pluginBuildNumber = "26";
|
||||||
protected final Boolean SHAEnabled = false;
|
protected final Boolean SHAEnabled = false;
|
||||||
// Private instances
|
// Private instances
|
||||||
private EmailService emailService;
|
private EmailService emailService;
|
||||||
private CommandHandler commandHandler;
|
private CommandHandler commandHandler;
|
||||||
@Inject
|
@Inject
|
||||||
private Settings settings;
|
public static Settings settings;
|
||||||
private DataSource database;
|
private DataSource database;
|
||||||
private BukkitService bukkitService;
|
private BukkitService bukkitService;
|
||||||
private Injector injector;
|
private Injector injector;
|
||||||
private BackupService backupService;
|
private BackupService backupService;
|
||||||
private ConsoleLogger logger;
|
public static ConsoleLogger logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public AuthMe() {
|
public AuthMe() {
|
||||||
}
|
}
|
||||||
public static Boolean SATEnabled = false;
|
|
||||||
public static Boolean GUIEnabled = false;
|
|
||||||
/**
|
/**
|
||||||
* Get the plugin's name.
|
* Get the plugin's name.
|
||||||
*
|
*
|
||||||
@@ -146,28 +128,28 @@ public class AuthMe extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
AuthMe.GUIEnabled = false;
|
|
||||||
AuthMe.SATEnabled = false;
|
|
||||||
// Load the plugin version data from the plugin description file
|
// Load the plugin version data from the plugin description file
|
||||||
loadPluginInfo(getDescription().getVersion());
|
loadPluginInfo(getDescription().getVersion());
|
||||||
|
|
||||||
// Set the Logger instance and log file path
|
// Set the Logger instance and log file path
|
||||||
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
ConsoleLogger.initialize(getLogger(), new File(getDataFolder(), LOG_FILENAME));
|
||||||
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
logger = ConsoleLoggerFactory.get(AuthMe.class);
|
||||||
logger.info("您正在加载的是由第三方Fork并修复众多错误的 AuthMeReReloaded!");
|
logger.info("You are running an unofficial fork version of AuthMe!");
|
||||||
|
|
||||||
|
|
||||||
// Check server version
|
// Check server version
|
||||||
if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")
|
if (!isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")
|
||||||
|| !isClassLoaded("org.bukkit.event.player.PlayerInteractAtEntityEvent")) {
|
|| !isClassLoaded("org.bukkit.event.player.PlayerInteractAtEntityEvent")) {
|
||||||
logger.warning("你正在运行不受支持的服务器版本 (" + getServerNameVersionSafe() + "). "
|
logger.warning("You are running an unsupported server version (" + getServerNameVersionSafe() + "). "
|
||||||
+ "AuthMe 仅支持Spigot 1.9及之后的版本!");
|
+ "AuthMe requires Spigot 1.8.X or later!");
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent running AuthMeBridge due to major exploit issues
|
// Prevent running AuthMeBridge due to major exploit issues
|
||||||
if (getServer().getPluginManager().isPluginEnabled("AuthMeBridge")) {
|
if (getServer().getPluginManager().isPluginEnabled("AuthMeBridge")) {
|
||||||
logger.warning("检测到 AuthMeBridge被加载, 对AuthMeBridge的支持已经停止 "
|
logger.warning("Detected AuthMeBridge, support for it has been dropped as it was "
|
||||||
+ "且可能会造成严重漏洞! 已中止加载!");
|
+ "causing exploit issues, please use AuthMeBungee instead! Aborting!");
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -178,11 +160,11 @@ public class AuthMe extends JavaPlugin {
|
|||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
YamlParseException yamlParseException = ExceptionUtils.findThrowableInCause(YamlParseException.class, th);
|
YamlParseException yamlParseException = ExceptionUtils.findThrowableInCause(YamlParseException.class, th);
|
||||||
if (yamlParseException == null) {
|
if (yamlParseException == null) {
|
||||||
logger.logException("已中止AuthMeReReloaded的初始化,原因:", th);
|
logger.logException("Aborting initialization of AuthMe:", th);
|
||||||
th.printStackTrace();
|
th.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
logger.logException("文件 '" + yamlParseException.getFile() + "' 包含YAML语法错误. "
|
logger.logException("File '" + yamlParseException.getFile() + "' contains invalid YAML. "
|
||||||
+ "请尝试在 https://yamllint.com 中运行文件内容", yamlParseException);
|
+ "Please run its contents through http://yamllint.com", yamlParseException);
|
||||||
}
|
}
|
||||||
stopOrUnload();
|
stopOrUnload();
|
||||||
return;
|
return;
|
||||||
@@ -199,34 +181,52 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
// Set up Metrics
|
// Set up Metrics
|
||||||
OnStartupTasks.sendMetrics(this, settings);
|
OnStartupTasks.sendMetrics(this, settings);
|
||||||
|
if(settings.getProperty(SecuritySettings.SHOW_STARTUP_BANNER)) {
|
||||||
|
String loadColorConfig = settings.getProperty(SecuritySettings.STARTUP_BANNER_COLOR);
|
||||||
|
if (loadColorConfig.startsWith("§")) {
|
||||||
|
logger.info("\n" + loadColorConfig + " ___ __ __ __ ___ \n" +
|
||||||
|
loadColorConfig + " / | __ __/ /_/ /_ / |/ /__ \n" +
|
||||||
|
loadColorConfig + " / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
|
||||||
|
loadColorConfig + " / ___ / /_/ / /_/ / / / / / / __/\n" +
|
||||||
|
loadColorConfig + "/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
|
||||||
|
loadColorConfig + " ");
|
||||||
|
}else {
|
||||||
|
logger.info("\n"+" ___ __ __ __ ___ \n" +
|
||||||
|
" / | __ __/ /_/ /_ / |/ /__ \n" +
|
||||||
|
" / /| |/ / / / __/ __ \\/ /|_/ / _ \\\n" +
|
||||||
|
" / ___ / /_/ / /_/ / / / / / / __/\n" +
|
||||||
|
"/_/ |_\\__,_/\\__/_/ /_/_/ /_/\\___/ \n" +
|
||||||
|
" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
// Successful message
|
// Successful message
|
||||||
logger.info("AuthMeReReloaded 已成功启动!");
|
//detect server brand with classloader
|
||||||
|
checkServerType();
|
||||||
|
logger.info("AuthMeReReloaded is enabled successfully!");
|
||||||
// Purge on start if enabled
|
// Purge on start if enabled
|
||||||
PurgeService purgeService = injector.getSingleton(PurgeService.class);
|
PurgeService purgeService = injector.getSingleton(PurgeService.class);
|
||||||
purgeService.runAutoPurge();
|
purgeService.runAutoPurge();
|
||||||
// 注册玩家退出事件监听
|
// 注册玩家加入事件监听
|
||||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS) || settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)/* || settings.getProperty(SecuritySettings.GUI_CAPTCHA)*/) {
|
// if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS) || settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)/* || settings.getProperty(SecuritySettings.GUI_CAPTCHA)*/) {
|
||||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
||||||
getServer().getPluginManager().registerEvents(new PlayerQuitListener((Plugin) this), this);
|
getServer().getPluginManager().registerEvents(new DoubleLoginFixListener((Plugin) this), this);
|
||||||
}
|
}
|
||||||
if (settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
if (settings.getProperty(SecuritySettings.LOGIN_LOC_FIX)) {
|
||||||
logger.info("(RC2)SmartAsyncTeleport功能已注册");
|
getServer().getPluginManager().registerEvents(new LoginLocationFixListener((Plugin) this), this);
|
||||||
AuthMe.SATEnabled = true;
|
|
||||||
}
|
}
|
||||||
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
getServer().getPluginManager().registerEvents(new RegisterListener((Plugin) this), this);
|
getServer().getPluginManager().registerEvents(new GuiCaptchaHandler((Plugin) this), this);
|
||||||
logger.info("(RC2)GUI验证码功能已注册");
|
logger.info("(Alpha4)GUICaptcha Feature is enabled successfully!");
|
||||||
AuthMe.GUIEnabled = true;
|
logger.info("These features are still in development, if you encountered any problem, please report.");
|
||||||
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && !getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
} else if (settings.getProperty(SecuritySettings.GUI_CAPTCHA) && !getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
logger.warning("ProtocolLib未加载,GUI验证码功能无法使用");
|
logger.warning("ProtocolLib is not loaded, we can't enable GUI Captcha.");
|
||||||
}
|
|
||||||
logger.info("以上功能尚在测试中,如有问题请反馈,如需关闭请前往config.yml修改");
|
|
||||||
logger.info("反馈地址: github.com/HaHaWTH/AuthMeReReloaded/issues");
|
|
||||||
}
|
}
|
||||||
|
logger.info("GitHub: https://github.com/HaHaWTH/AuthMeReReloaded/");
|
||||||
|
|
||||||
if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) {
|
if (settings.getProperty(SecuritySettings.CHECK_FOR_UPDATES)) {
|
||||||
checkForUpdates();
|
checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SHAEnabled){
|
if (SHAEnabled){
|
||||||
//shaChecker();
|
//shaChecker();
|
||||||
}
|
}
|
||||||
@@ -326,11 +326,18 @@ public class AuthMe extends JavaPlugin {
|
|||||||
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(EntityListener.class), this);
|
||||||
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(ServerListener.class), this);
|
||||||
|
|
||||||
// Try to register 1.9 player listeners
|
// Try to register 1.8+ player listeners
|
||||||
if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
if (isClassLoaded("org.bukkit.event.entity.EntityPickupItemEvent") && isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")){
|
||||||
|
pluginManager.registerEvents(injector.getSingleton(PlayerListenerHigherThan18.class), this);
|
||||||
|
} else if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to register 1.9 player listeners(Moved to else-if)
|
||||||
|
// if (isClassLoaded("org.bukkit.event.player.PlayerSwapHandItemsEvent")) {
|
||||||
|
// pluginManager.registerEvents(injector.getSingleton(PlayerListener19.class), this);
|
||||||
|
// }
|
||||||
|
|
||||||
// Try to register 1.9 spigot player listeners
|
// Try to register 1.9 spigot player listeners
|
||||||
if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) {
|
if (isClassLoaded("org.spigotmc.event.player.PlayerSpawnLocationEvent")) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(PlayerListener19Spigot.class), this);
|
pluginManager.registerEvents(injector.getSingleton(PlayerListener19Spigot.class), this);
|
||||||
@@ -365,7 +372,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
onShutdownPlayerSaver.saveAllPlayers();
|
onShutdownPlayerSaver.saveAllPlayers();
|
||||||
}
|
}
|
||||||
if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){
|
if (settings.getProperty(EmailSettings.SHUTDOWN_MAIL)){
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'年'MM'月'dd'日' HH:mm:ss");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy'.'MM'.'dd'.' HH:mm:ss");
|
||||||
Date date = new Date(System.currentTimeMillis());
|
Date date = new Date(System.currentTimeMillis());
|
||||||
emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date));
|
emailService.sendShutDown(settings.getProperty(EmailSettings.SHUTDOWN_MAIL_ADDRESS),dateFormat.format(date));
|
||||||
}
|
}
|
||||||
@@ -380,17 +387,17 @@ public class AuthMe extends JavaPlugin {
|
|||||||
|
|
||||||
// Disabled correctly
|
// Disabled correctly
|
||||||
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
Consumer<String> infoLogMethod = logger == null ? getLogger()::info : logger::info;
|
||||||
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " 已卸载!");
|
infoLogMethod.accept("AuthMe " + this.getDescription().getVersion() + " is unloaded successfully!");
|
||||||
ConsoleLogger.closeFileWriter();
|
ConsoleLogger.closeFileWriter();
|
||||||
}
|
}
|
||||||
private static final String owner = "HaHaWTH";
|
private static final String owner = "HaHaWTH";
|
||||||
private static final String owner_gitee = "Shixuehan114514";
|
private static final String owner_gitee = "Shixuehan114514";
|
||||||
private static final String repo = "AuthMeReReloaded";
|
private static final String repo = "AuthMeReReloaded";
|
||||||
private void checkForUpdates() {
|
private void checkForUpdates() {
|
||||||
logger.info("正在检查更新...");
|
logger.info("Checking for updates...");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
|
||||||
try {
|
try {
|
||||||
// Get the latest version number from GitHub
|
// 从南通集线器获取最新版本号
|
||||||
|
|
||||||
URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest");
|
URL url = new URL("https://api.github.com/repos/" + owner + "/" + repo + "/releases/latest");
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
@@ -400,23 +407,41 @@ public class AuthMe extends JavaPlugin {
|
|||||||
String response = scanner.useDelimiter("\\Z").next();
|
String response = scanner.useDelimiter("\\Z").next();
|
||||||
scanner.close();
|
scanner.close();
|
||||||
|
|
||||||
// Parse JSON response and extract version number
|
// 处理JSON响应
|
||||||
String latestVersion = response.substring(response.indexOf("tag_name") + 11);
|
String latestVersion = response.substring(response.indexOf("tag_name") + 11);
|
||||||
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
|
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
|
||||||
if ((pluginBuild + pluginBuildNumber).equals(latestVersion)) {
|
if ((pluginBuild + pluginBuildNumber).equals(latestVersion)) {
|
||||||
getLogger().log(Level.INFO,"当前为最新版本");
|
getLogger().log(Level.INFO,"You are running the latest version.");
|
||||||
}
|
}
|
||||||
if (!(pluginBuild + pluginBuildNumber).equals(latestVersion)) {
|
if (!(pluginBuild + pluginBuildNumber).equals(latestVersion)) {
|
||||||
// Display update message to users
|
// Display update message
|
||||||
String message = "有新版本可用! 最新版本:" + latestVersion + " 当前版本:" + pluginBuild + pluginBuildNumber;
|
String message = "New version available! Latest:" + latestVersion + " Current:" + pluginBuild + pluginBuildNumber;
|
||||||
getLogger().log(Level.INFO, message);
|
getLogger().log(Level.INFO, message);
|
||||||
getLogger().log(Level.INFO,"下载地址:github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
|
getLogger().log(Level.INFO,"Download from here:github.com/HaHaWTH/AuthMeReReloaded/releases/latest");
|
||||||
}
|
}
|
||||||
}catch (IOException e) {
|
}catch (IOException e) {
|
||||||
getLogger().log(Level.WARNING,"从GitHub检查更新时出现错误,原因: " + e.getMessage());
|
getLogger().log(Level.WARNING,"Error occurred while checking updates from GitHub. Reason: " + e.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkServerType() {
|
||||||
|
if (isClassLoaded("com.destroystokyo.paper.PaperConfig")) {
|
||||||
|
logger.info("AuthMeReReloaded is running on Paper");
|
||||||
|
}else if (isClassLoaded("catserver.server.CatServerConfig")) {
|
||||||
|
logger.info("AuthMeReReloaded is running on CatServer");
|
||||||
|
} else if (isClassLoaded("org.spigotmc.SpigotConfig")) {
|
||||||
|
logger.info("AuthMeReReloaded is running on Spigot");
|
||||||
|
} else if (isClassLoaded("org.bukkit.craftbukkit.CraftServer")) {
|
||||||
|
logger.info("AuthMeReReloaded is running on Bukkit");
|
||||||
|
} else {
|
||||||
|
logger.info("AuthMeReReloaded is running on Unknown*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 其他方法和事件处理
|
||||||
|
|
||||||
|
|
||||||
|
// 其他方法和事件处理
|
||||||
private static final String SHA_URL = "https://raw.githubusercontent.com/"+ owner +"/"+ repo + "/master/"+pluginBuild +pluginBuildNumber+ ".sha";
|
private static final String SHA_URL = "https://raw.githubusercontent.com/"+ owner +"/"+ repo + "/master/"+pluginBuild +pluginBuildNumber+ ".sha";
|
||||||
private static final String ALGORITHM = "SHA-256";
|
private static final String ALGORITHM = "SHA-256";
|
||||||
private static final String PROXY_URL = "https://ghproxy.com/";
|
private static final String PROXY_URL = "https://ghproxy.com/";
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public final class ConsoleLogger {
|
|||||||
*/
|
*/
|
||||||
public void warning(String message) {
|
public void warning(String message) {
|
||||||
logger.warning(message);
|
logger.warning(message);
|
||||||
writeLog("[警告] " + message);
|
writeLog("[WARN] " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,7 +128,7 @@ public final class ConsoleLogger {
|
|||||||
*/
|
*/
|
||||||
public void info(String message) {
|
public void info(String message) {
|
||||||
logger.info(message);
|
logger.info(message);
|
||||||
writeLog("[信息] " + message);
|
writeLog("[INFO] " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,7 +142,7 @@ public final class ConsoleLogger {
|
|||||||
public void fine(String message) {
|
public void fine(String message) {
|
||||||
if (logLevel.includes(LogLevel.FINE)) {
|
if (logLevel.includes(LogLevel.FINE)) {
|
||||||
logger.info(message);
|
logger.info(message);
|
||||||
writeLog("[信息:调试] " + message);
|
writeLog("[INFO:FINE] " + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ public final class ConsoleLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void logAndWriteWithDebugPrefix(String message) {
|
private void logAndWriteWithDebugPrefix(String message) {
|
||||||
String debugMessage = "[信息:调试] " + message;
|
String debugMessage = "[INFO:DEBUG] " + message;
|
||||||
logger.info(debugMessage);
|
logger.info(debugMessage);
|
||||||
writeLog(debugMessage);
|
writeLog(debugMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ public abstract class PlayerCommand implements ExecutableCommand {
|
|||||||
} else {
|
} else {
|
||||||
String alternative = getAlternativeCommand();
|
String alternative = getAlternativeCommand();
|
||||||
if (alternative != null) {
|
if (alternative != null) {
|
||||||
sender.sendMessage("此命令仅限玩家使用!请使用 " + alternative + " .");
|
sender.sendMessage("Player only! Please use " + alternative + " instead.");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("此命令只能被玩家执行.");
|
sender.sendMessage("This command is only for players.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class FirstSpawnCommand extends PlayerCommand {
|
|||||||
player.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn");
|
player.sendMessage("[AuthMe] First spawn has failed, please try to define the first spawn");
|
||||||
} else {
|
} else {
|
||||||
//String name= player.getName();
|
//String name= player.getName();
|
||||||
if(AuthMe.SATEnabled) {
|
if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||||
TeleportUtils.teleport(player, spawnLoader.getFirstSpawn());
|
TeleportUtils.teleport(player, spawnLoader.getFirstSpawn());
|
||||||
} else {
|
} else {
|
||||||
player.teleport(spawnLoader.getFirstSpawn());
|
player.teleport(spawnLoader.getFirstSpawn());
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
//Prevent Ghost Players
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class DoubleLoginFixListener implements Listener {
|
||||||
|
private final Plugin plugin;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public DoubleLoginFixListener(Plugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Collection<? extends Player> PlayerList = Bukkit.getServer().getOnlinePlayers();
|
||||||
|
HashSet<String> PlayerSet = new HashSet<String>();
|
||||||
|
for (Player ep : PlayerList) {
|
||||||
|
if (PlayerSet.contains(ep.getName().toLowerCase())) {
|
||||||
|
ep.kickPlayer("You have been disconnected due to doubled login.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
PlayerSet.add(ep.getName().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.earth2me.essentials.libs.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import static org.bukkit.Bukkit.getLogger;
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
public class GuiCaptchaHandler implements Listener {
|
||||||
|
//define AuthMeApi
|
||||||
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
|
private final Plugin plugin;
|
||||||
|
|
||||||
|
|
||||||
|
//define timesLeft
|
||||||
|
public int timesLeft = 3;
|
||||||
|
//Use ConcurrentHashMap to store player and their close reason
|
||||||
|
/* We used many async tasks so there is concurrent**/
|
||||||
|
protected static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
|
||||||
|
//define randomStringSet
|
||||||
|
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
|
||||||
|
String randomString = "";
|
||||||
|
Random randomItemSet = new Random();
|
||||||
|
Random howManyRandom = new Random();
|
||||||
|
|
||||||
|
|
||||||
|
int howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
||||||
|
|
||||||
|
public GuiCaptchaHandler(Plugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
|
if (event.getWhoClicked() instanceof Player) {
|
||||||
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
ItemStack currentItem = event.getCurrentItem();
|
||||||
|
if (!authmeApi.isRegistered(player.getName()) && !closeReasonMap.containsKey(player)) {
|
||||||
|
if (AuthMe.settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getWhoClicked().getUniqueId()) && (getServer().getPluginManager().isPluginEnabled("floodgate") || getServer().getPluginManager().getPlugin("floodgate") != null)) {
|
||||||
|
if (!closeReasonMap.containsKey(player)) {
|
||||||
|
closeReasonMap.put(player,"verified");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (currentItem != null && currentItem.getType().equals(Material.REDSTONE_BLOCK)){
|
||||||
|
event.setCancelled(true);
|
||||||
|
closeReasonMap.put(player, "verified");
|
||||||
|
player.closeInventory();
|
||||||
|
player.sendMessage("§a验证完成");
|
||||||
|
} else {
|
||||||
|
player.sendMessage("§c验证失败,你还有" + timesLeft + "§c次机会");
|
||||||
|
timesLeft--;
|
||||||
|
}
|
||||||
|
//force to string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
randomString = "";
|
||||||
|
Player playerunreg = event.getPlayer();
|
||||||
|
String name = playerunreg.getName();
|
||||||
|
if (!authmeApi.isRegistered(name)) {
|
||||||
|
if (AuthMe.settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_BE_COMPATIBILITY) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getPlayer().getUniqueId()) && (getServer().getPluginManager().isPluginEnabled("floodgate") || getServer().getPluginManager().getPlugin("floodgate") != null)) {
|
||||||
|
closeReasonMap.put(playerunreg, "verified");
|
||||||
|
playerunreg.sendMessage("§a基岩版自动验证完成");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
howLongIsRandomString = (howManyRandom.nextInt(3) + 1);
|
||||||
|
for (int i = 0; i < howLongIsRandomString; i++) {
|
||||||
|
//生成随机索引号
|
||||||
|
int index = randomItemSet.nextInt(randomSet.length());
|
||||||
|
|
||||||
|
// 从字符串中获取由索引 index 指定的字符
|
||||||
|
char randomChar = randomSet.charAt(index);
|
||||||
|
|
||||||
|
// 将字符追加到字符串生成器
|
||||||
|
sb.append(randomChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
randomString = sb.toString();
|
||||||
|
Random random_blockpos = new Random();
|
||||||
|
AtomicInteger random_num = new AtomicInteger(random_blockpos.nextInt(26));
|
||||||
|
Inventory menu = Bukkit.createInventory(null, 27, randomString + "请验证你是真人");
|
||||||
|
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
try {
|
||||||
|
if (meta != null) {
|
||||||
|
meta.setDisplayName("§a我是真人");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
getLogger().log(Level.WARNING, "Unexpected error occurred while setting item meta.");
|
||||||
|
}
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
menu.setItem(random_num.get(), item);
|
||||||
|
});
|
||||||
|
menu.setItem(random_num.get(), item);
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
playerunreg.openInventory(menu);
|
||||||
|
});
|
||||||
|
if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > 0) {
|
||||||
|
long timeOut = AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT);
|
||||||
|
if (AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) > AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT)) {
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
Bukkit.getLogger().warning("AuthMe detected that your GUI captcha timeout seconds(" + AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA_TIMEOUT) + ") is bigger than the Login timeout seconds(" +
|
||||||
|
AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT) + "). To prevent issues, we will let the GUI captcha follow the Login timeout seconds, please check and modify your config.");
|
||||||
|
});
|
||||||
|
timeOut = AuthMe.settings.getProperty(RestrictionSettings.TIMEOUT);
|
||||||
|
}
|
||||||
|
long finalTimeOut = timeOut;
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
|
||||||
|
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||||
|
playerunreg.kickPlayer("§c验证超时");
|
||||||
|
timesLeft = 3; // Reset the attempt counter
|
||||||
|
}
|
||||||
|
}, finalTimeOut * 20L);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||||
|
if (timesLeft <= 0) {
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
playerunreg.kickPlayer("§c请先完成人机验证!");
|
||||||
|
});
|
||||||
|
timesLeft = 3;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
timesLeft--;
|
||||||
|
playerunreg.sendMessage("§c请先完成验证!,你还有" + timesLeft + "次机会");
|
||||||
|
|
||||||
|
}
|
||||||
|
event.setCancelled(true);
|
||||||
|
random_num.set(random_blockpos.nextInt(26));
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
|
menu.clear();
|
||||||
|
menu.setItem(random_num.get(), item);
|
||||||
|
});
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
|
playerunreg.openInventory(menu);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||||
|
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
|
||||||
|
playerunreg.sendMessage("§c请先完成验证!");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deletePlayerData(UUID playerUUID) {
|
||||||
|
// 获取服务器的存储文件夹路径
|
||||||
|
File serverFolder = Bukkit.getServer().getWorldContainer();
|
||||||
|
String worldFolderName = AuthMe.settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
||||||
|
// 构建playerdata文件夹路径
|
||||||
|
File playerDataFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "playerdata");
|
||||||
|
|
||||||
|
// 构建玩家数据文件路径
|
||||||
|
File playerDataFile = new File(playerDataFolder, File.separator + playerUUID + ".dat");
|
||||||
|
|
||||||
|
// 删除玩家数据文件
|
||||||
|
if (playerDataFile.exists()) {
|
||||||
|
playerDataFile.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void deletePlayerStats(UUID playerUUID) {
|
||||||
|
// 获取服务器的存储文件夹路径
|
||||||
|
File serverFolder = Bukkit.getServer().getWorldContainer();
|
||||||
|
String worldFolderName = AuthMe.settings.getProperty(SecuritySettings.DELETE_PLAYER_DATA_WORLD);
|
||||||
|
// 构建stats文件夹路径
|
||||||
|
File statsFolder = new File(serverFolder, File.separator + worldFolderName + File.separator + "stats");
|
||||||
|
// 构建玩家统计数据文件路径
|
||||||
|
File statsFile = new File(statsFolder, File.separator + playerUUID + ".json");
|
||||||
|
// 删除玩家统计数据文件
|
||||||
|
|
||||||
|
if (statsFile.exists()) {
|
||||||
|
statsFile.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
String name = player.getName();
|
||||||
|
UUID playerUUID = event.getPlayer().getUniqueId();
|
||||||
|
if (!authmeApi.isRegistered(name)) {
|
||||||
|
if(AuthMe.settings.getProperty(SecuritySettings.DELETE_UNVERIFIED_PLAYER_DATA) && !closeReasonMap.containsKey(player)){
|
||||||
|
Bukkit.getScheduler().runTaskLater(this.plugin , () -> {
|
||||||
|
if(!player.isOnline()) {
|
||||||
|
deletePlayerData(playerUUID);
|
||||||
|
deletePlayerStats(playerUUID);
|
||||||
|
}
|
||||||
|
},100L);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
closeReasonMap.remove(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -10,19 +10,12 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
import fr.xephi.authme.util.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityEvent;
|
import org.bukkit.event.entity.EntityEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service class for the AuthMe listeners to determine whether an event should be canceled.
|
* Service class for the AuthMe listeners to determine whether an event should be canceled.
|
||||||
@@ -93,7 +86,7 @@ class ListenerService implements SettingsDependent {
|
|||||||
}
|
}
|
||||||
public boolean shouldCancelInvEvent(Player player) {
|
public boolean shouldCancelInvEvent(Player player) {
|
||||||
try {
|
try {
|
||||||
return !AuthMe.GUIEnabled || authmeApi.isRegistered(player.getName()) || RegisterListener.closeReasonMap.containsKey(player)/* || !player.getOpenInventory().getTitle().equals("请验证你是真人")*/;
|
return !AuthMe.settings.getProperty(SecuritySettings.GUI_CAPTCHA) || authmeApi.isRegistered(player.getName()) || GuiCaptchaHandler.closeReasonMap.containsKey(player)/* || !player.getOpenInventory().getTitle().equals("请验证你是真人")*/;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
import fr.xephi.authme.AuthMe;
|
||||||
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
|
import fr.xephi.authme.events.LoginEvent;
|
||||||
|
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class LoginLocationFixListener implements Listener{
|
||||||
|
private final Plugin plugin;
|
||||||
|
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
||||||
|
public LoginLocationFixListener(Plugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
BlockFace[] faces = {BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST};
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (authmeApi.isRegistered(player.getName())) {
|
||||||
|
Material material = Material.matchMaterial("PORTAL");
|
||||||
|
if (material == null) {
|
||||||
|
material = Material.matchMaterial("PORTAL_BLOCK");
|
||||||
|
} else {
|
||||||
|
material = Material.matchMaterial("NETHER_PORTAL");
|
||||||
|
}
|
||||||
|
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5);
|
||||||
|
if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL)) {
|
||||||
|
if (!JoinLocation.getBlock().getType().equals(material) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(material)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Block JoinBlock = JoinLocation.getBlock();
|
||||||
|
boolean solved = false;
|
||||||
|
for (BlockFace face : faces) {
|
||||||
|
if (JoinBlock.getRelative(face).getType().equals(Material.AIR) && JoinBlock.getRelative(face).getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||||
|
player.teleport(JoinBlock.getRelative(face).getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
solved = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!solved) {
|
||||||
|
JoinBlock.getRelative(BlockFace.UP).breakNaturally();
|
||||||
|
JoinBlock.breakNaturally();
|
||||||
|
}
|
||||||
|
player.sendMessage("§a你在登录时卡在了地狱门, 现已修正");
|
||||||
|
} else if (AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND)) {
|
||||||
|
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
|
||||||
|
World world = player.getWorld();
|
||||||
|
int MaxHeight = world.getMaxHeight();
|
||||||
|
int MinHeight = world.getMinHeight();
|
||||||
|
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = MinHeight; i <= MaxHeight; i++) {
|
||||||
|
JoinLocation.setY(i);
|
||||||
|
Block JoinBlock = JoinLocation.getBlock();
|
||||||
|
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
|
||||||
|
&& JoinBlock.getType().equals(Material.AIR)
|
||||||
|
&& JoinBlock.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||||
|
if (JoinBlock.getRelative(BlockFace.DOWN).getType().equals(Material.LAVA)) {
|
||||||
|
JoinBlock.getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
||||||
|
}
|
||||||
|
player.teleport(JoinBlock.getLocation().add(0.5, 0.1, 0.5));
|
||||||
|
player.sendMessage("§a你被埋住了, 坐标已修正, 下次下线之前请小心!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == MaxHeight) {
|
||||||
|
player.teleport(JoinBlock.getLocation().add(0.5, 1.1, 0.5));
|
||||||
|
player.sendMessage("§a你被埋住了, 坐标无法修正, 只好送你去了最高点, 自求多福吧少年~");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
package fr.xephi.authme.listener;
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.listener.RegisterListener;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
import fr.xephi.authme.api.v3.AuthMeApi;
|
||||||
import fr.xephi.authme.data.QuickCommandsProtectionManager;
|
import fr.xephi.authme.data.QuickCommandsProtectionManager;
|
||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
@@ -31,7 +25,6 @@ import fr.xephi.authme.util.TeleportUtils;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -39,7 +32,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
//import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
@@ -61,16 +54,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
//import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOWED_MOVEMENT_RADIUS;
|
import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOWED_MOVEMENT_RADIUS;
|
||||||
@@ -134,8 +124,10 @@ public class PlayerListener implements Listener{
|
|||||||
if (validationService.isUnrestricted(name)) {
|
if (validationService.isUnrestricted(name)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER) && org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())){
|
if (settings.getProperty(HooksSettings.HOOK_FLOODGATE_PLAYER)) {
|
||||||
return;
|
if (getServer().getPluginManager().getPlugin("floodgate") != null) {
|
||||||
|
if (org.geysermc.floodgate.api.FloodgateApi.getInstance().isFloodgateId(event.getUniqueId())) return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Non-blocking checks
|
// Non-blocking checks
|
||||||
try {
|
try {
|
||||||
@@ -387,13 +379,13 @@ public class PlayerListener implements Listener{
|
|||||||
Location spawn = spawnLoader.getSpawnLocation(player);
|
Location spawn = spawnLoader.getSpawnLocation(player);
|
||||||
if (spawn != null && spawn.getWorld() != null) {
|
if (spawn != null && spawn.getWorld() != null) {
|
||||||
if (!player.getWorld().equals(spawn.getWorld())) {
|
if (!player.getWorld().equals(spawn.getWorld())) {
|
||||||
if(AuthMe.SATEnabled) {
|
if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||||
TeleportUtils.teleport(player,spawn);
|
TeleportUtils.teleport(player,spawn);
|
||||||
} else {
|
} else {
|
||||||
player.teleport(spawn);
|
player.teleport(spawn);
|
||||||
}
|
}
|
||||||
} else if (spawn.distance(player.getLocation()) > settings.getProperty(ALLOWED_MOVEMENT_RADIUS)) {
|
} else if (spawn.distance(player.getLocation()) > settings.getProperty(ALLOWED_MOVEMENT_RADIUS)) {
|
||||||
if(AuthMe.SATEnabled) {
|
if(settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT)) {
|
||||||
TeleportUtils.teleport(player,spawn);
|
TeleportUtils.teleport(player,spawn);
|
||||||
} else {
|
} else {
|
||||||
player.teleport(spawn);
|
player.teleport(spawn);
|
||||||
@@ -488,12 +480,12 @@ public class PlayerListener implements Listener{
|
|||||||
* Inventory interactions
|
* Inventory interactions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
// @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
// public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
if (listenerService.shouldCancelEvent(event)) {
|
// if (listenerService.shouldCancelEvent(event)) {
|
||||||
event.setCancelled(true);
|
// event.setCancelled(true);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
@@ -548,12 +540,12 @@ public class PlayerListener implements Listener{
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
// @EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
// public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||||
Player player = event.getPlayer();
|
// Player player = event.getPlayer();
|
||||||
if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
// if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||||
return;
|
// return;
|
||||||
event.setCancelled(true);
|
// event.setCancelled(true);
|
||||||
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
// Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
|
import fr.xephi.authme.data.QuickCommandsProtectionManager;
|
||||||
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
import fr.xephi.authme.message.Messages;
|
||||||
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
|
import fr.xephi.authme.process.Management;
|
||||||
|
import fr.xephi.authme.service.AntiBotService;
|
||||||
|
import fr.xephi.authme.service.BukkitService;
|
||||||
|
import fr.xephi.authme.service.JoinMessageService;
|
||||||
|
import fr.xephi.authme.service.TeleportationService;
|
||||||
|
import fr.xephi.authme.service.ValidationService;
|
||||||
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
public class PlayerListenerHigherThan18 implements Listener {
|
||||||
|
@Inject
|
||||||
|
private ListenerService listenerService;
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
|
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
|
if (listenerService.shouldCancelEvent(event)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||||
|
return;
|
||||||
|
event.setCancelled(true);
|
||||||
|
Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package fr.xephi.authme.listener;
|
|
||||||
//Prevent Ghost Players
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class PlayerQuitListener implements Listener {
|
|
||||||
private final Plugin plugin;
|
|
||||||
public PlayerQuitListener(Plugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
String LastAddr = Objects.requireNonNull(player.getAddress()).getAddress().getHostAddress();
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (player.isOnline()) {
|
|
||||||
player.kickPlayer("You have been disconnected.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 20L); // 20 ticks = 1 second
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
package fr.xephi.authme.listener;
|
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import com.comphenix.protocol.events.PacketListener;
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.api.v3.AuthMeApi;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getLogger;
|
|
||||||
|
|
||||||
public class RegisterListener implements Listener {
|
|
||||||
private final AuthMeApi authmeApi = AuthMeApi.getInstance();
|
|
||||||
private final Plugin plugin;
|
|
||||||
public static boolean enabled=true;
|
|
||||||
// 创建一个储存玩家关闭箱子GUI的原因的HashMap
|
|
||||||
public static HashMap<Player, String> closeReasonMap = new HashMap<>();
|
|
||||||
// Add a timer to kick the player if they don't verify in time
|
|
||||||
|
|
||||||
|
|
||||||
public RegisterListener(Plugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
|
||||||
if (event.getWhoClicked() instanceof Player) {
|
|
||||||
Player player = (Player) event.getWhoClicked();
|
|
||||||
ItemStack item = event.getCurrentItem();
|
|
||||||
// 获取点击事件的容器
|
|
||||||
Inventory inventory = event.getInventory();
|
|
||||||
if (event.getView().getTitle().equals("请验证你是真人")&&!authmeApi.isRegistered(player.getName())) {
|
|
||||||
if (Objects.requireNonNull(event.getCurrentItem()).getType().equals(Material.REDSTONE_BLOCK)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
closeReasonMap.put(player, "verified");
|
|
||||||
player.closeInventory();
|
|
||||||
player.sendMessage("§a验证完成");
|
|
||||||
//force to string
|
|
||||||
|
|
||||||
// ProtocolLibrary.getProtocolManager().removePacketListeners(this.plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true,priority = EventPriority.HIGHEST)
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
|
||||||
Random random_blockpos = new Random();
|
|
||||||
int random_num = random_blockpos.nextInt(26);
|
|
||||||
Inventory menu = Bukkit.createInventory(null, 27, "请验证你是真人");
|
|
||||||
ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
if (meta != null) {
|
|
||||||
meta.setDisplayName("§a我是真人");
|
|
||||||
}
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
menu.setItem(random_num, item);
|
|
||||||
Player playerunreg = event.getPlayer();
|
|
||||||
String name = playerunreg.getName();
|
|
||||||
if (!authmeApi.isRegistered(name)) {
|
|
||||||
// getLogger().log(Level.INFO, "TESTTEST");
|
|
||||||
Bukkit.getScheduler().runTaskLater(this.plugin, () -> {
|
|
||||||
playerunreg.openInventory(menu);
|
|
||||||
}, 1L);
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CLOSE_WINDOW) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg)) {
|
|
||||||
playerunreg.sendMessage("§c请先完成验证!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
|
||||||
playerunreg.openInventory(menu);
|
|
||||||
//playerunreg.kickPlayer("§c请先完成人机验证!");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
if (event.getPlayer() == playerunreg && !closeReasonMap.containsKey(playerunreg)) {
|
|
||||||
playerunreg.sendMessage("§c请先完成验证!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// chatListener = new PacketAdapter(this.plugin, ListenerPriority.HIGHEST, PacketType.Play.Client.CHAT) {
|
|
||||||
// @Override
|
|
||||||
// public void onPacketReceiving(PacketEvent event) {
|
|
||||||
// if (event.getPlayer() == player) {
|
|
||||||
// event.setCancelled(true);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerQuit(PlayerQuitEvent event){
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
String name = player.getName();
|
|
||||||
if (!authmeApi.isRegistered(name)){closeReasonMap.remove(player);}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ package fr.xephi.authme.message;
|
|||||||
* Keys for translatable messages managed by {@link Messages}.
|
* Keys for translatable messages managed by {@link Messages}.
|
||||||
*/
|
*/
|
||||||
public enum MessageKey {
|
public enum MessageKey {
|
||||||
|
|
||||||
/** In order to use this command you must be authenticated! */
|
/** In order to use this command you must be authenticated! */
|
||||||
DENIED_COMMAND("error.denied_command"),
|
DENIED_COMMAND("error.denied_command"),
|
||||||
|
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class Whirlpool extends UnsaltedMethod {
|
|||||||
if (bufferRem + sourceBits < 8) {
|
if (bufferRem + sourceBits < 8) {
|
||||||
// all remaining data fits on buffer[bufferPos], and there still
|
// all remaining data fits on buffer[bufferPos], and there still
|
||||||
// remains some space.
|
// remains some space.
|
||||||
bufferBits += sourceBits;
|
bufferBits += (int) sourceBits;
|
||||||
} else {
|
} else {
|
||||||
// buffer[bufferPos] is full:
|
// buffer[bufferPos] is full:
|
||||||
bufferPos++;
|
bufferPos++;
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public final class RestrictionSettings implements SettingsHolder {
|
|||||||
|
|
||||||
@Comment("Regex syntax for allowed chars in email.")
|
@Comment("Regex syntax for allowed chars in email.")
|
||||||
public static final Property<String> ALLOWED_EMAIL_REGEX =
|
public static final Property<String> ALLOWED_EMAIL_REGEX =
|
||||||
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9]{4,15}@(qq|outlook|163|gmail|icloud).com$");
|
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9_]{4,15}@(qq|outlook|163|gmail|icloud)\\.com$");
|
||||||
|
|
||||||
|
|
||||||
@Comment("Force survival gamemode when player joins?")
|
@Comment("Force survival gamemode when player joins?")
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package fr.xephi.authme.settings.properties;
|
|||||||
|
|
||||||
import ch.jalu.configme.Comment;
|
import ch.jalu.configme.Comment;
|
||||||
import ch.jalu.configme.SettingsHolder;
|
import ch.jalu.configme.SettingsHolder;
|
||||||
import ch.jalu.configme.properties.BooleanProperty;
|
|
||||||
import ch.jalu.configme.properties.Property;
|
import ch.jalu.configme.properties.Property;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
import fr.xephi.authme.security.HashAlgorithm;
|
||||||
import fr.xephi.authme.settings.EnumSetProperty;
|
import fr.xephi.authme.settings.EnumSetProperty;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import fr.xephi.authme.listener.PlayerQuitListener;
|
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
|
||||||
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
|
||||||
|
|
||||||
@@ -17,21 +17,46 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
"Take care with this, if you set this to false,",
|
"Take care with this, if you set this to false,",
|
||||||
"AuthMe will automatically disable and the server won't be protected!"})
|
"AuthMe will automatically disable and the server won't be protected!"})
|
||||||
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
|
||||||
newProperty("Security.SQLProblem.stopServer", true);
|
newProperty("Security.SQLProblem.stopServer", false);
|
||||||
|
|
||||||
@Comment("Enable the new feature to prevent ghost players?")
|
@Comment("Enable the new feature to prevent ghost players?")
|
||||||
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
||||||
|
|
||||||
@Comment({"(BETA Feature)Choose the best teleport method by server brand?",
|
@Comment({"Choose the best teleport method by server brand?",
|
||||||
"(Enable this if you are using Paper)"})
|
"(Enable this if you are using Paper)"})
|
||||||
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport",false);
|
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport",false);
|
||||||
|
|
||||||
@Comment("(BETA Feature)Send a GUI captcha to unregistered players?")
|
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
|
||||||
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.captcha.guiCaptcha",false);
|
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.captcha.guiCaptcha",false);
|
||||||
|
|
||||||
// @Comment({"Kick the players when they didn't finish the gui captcha in time? " ,
|
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
|
||||||
// "(0 is disabled)"})
|
"(less than or equals 0 is disabled)"})
|
||||||
// public static final Property<Integer> CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.captcha.timeout",0);
|
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.captcha.timeOut",0);
|
||||||
|
|
||||||
|
@Comment({"Should we ignore floodgate players when sending GUI captcha?",
|
||||||
|
"(Requires floodgate and hookFloodgate: true)"})
|
||||||
|
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.captcha.ignoreBedrock",false);
|
||||||
|
|
||||||
|
@Comment("Should we delete player data and stats when they didn't finish the captcha?")
|
||||||
|
public static final Property<Boolean> DELETE_UNVERIFIED_PLAYER_DATA = newProperty("3rdPartyFeature.captcha.purgePlayerData",false);
|
||||||
|
|
||||||
|
@Comment("Which world's player data should be deleted?(Enter the world *FOLDER* name where your players first logged in)")
|
||||||
|
public static final Property<String> DELETE_PLAYER_DATA_WORLD = newProperty("3rdPartyFeature.captcha.purgeWorldFolderName","world");
|
||||||
|
|
||||||
|
@Comment("Should we enable the new LoginLocationFix feature?")
|
||||||
|
public static final Property<Boolean> LOGIN_LOC_FIX = newProperty("3rdPartyFeature.fixes.loginLocationFix.enabled", false);
|
||||||
|
|
||||||
|
@Comment("Should we fix the location when players logged in the portal?")
|
||||||
|
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_PORTAL = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixPortalStuck", false);
|
||||||
|
|
||||||
|
@Comment("Should we fix the location when players logged underground?")
|
||||||
|
public static final Property<Boolean> LOGIN_LOC_FIX_SUB_UNDERGROUND = newProperty("3rdPartyFeature.fixes.loginLocationFix.fixGroundStuck", false);
|
||||||
|
|
||||||
|
// @Comment({"Should we kick the players when they failed captcha too many times?",
|
||||||
|
// "(Minimum value is 1)(Default: 3)"})
|
||||||
|
// public static final Property<Integer> GUI_CAPTCHA_MAX_TRY = newProperty("3rdPartyFeature.captcha.maxTryTimes",3);
|
||||||
|
|
||||||
|
|
||||||
//@Comment({"Using which API to get hash data?",
|
//@Comment({"Using which API to get hash data?",
|
||||||
//"Available options: github, gitee, ghproxy (if your server is in China, please use gitee or ghproxy.)"})
|
//"Available options: github, gitee, ghproxy (if your server is in China, please use gitee or ghproxy.)"})
|
||||||
//public static final Property<String> SHA_CHECK_METHOD = newProperty("Plugin.hashing.hashApi","github");
|
//public static final Property<String> SHA_CHECK_METHOD = newProperty("Plugin.hashing.hashApi","github");
|
||||||
@@ -63,6 +88,14 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> CHECK_FOR_UPDATES =
|
public static final Property<Boolean> CHECK_FOR_UPDATES =
|
||||||
newProperty("Plugin.updates.checkForUpdates", true);
|
newProperty("Plugin.updates.checkForUpdates", true);
|
||||||
|
|
||||||
|
@Comment("Should we show the AuthMe banner on startup?")
|
||||||
|
public static final Property<Boolean> SHOW_STARTUP_BANNER =
|
||||||
|
newProperty("Plugin.banners.showBanners", true);
|
||||||
|
|
||||||
|
@Comment("Change the banner colors here (Default: §r)")
|
||||||
|
public static final Property<String> STARTUP_BANNER_COLOR =
|
||||||
|
newProperty("Plugin.banners.bannerColor", "§r");
|
||||||
|
|
||||||
@Comment("Max allowed tries before a captcha is required")
|
@Comment("Max allowed tries before a captcha is required")
|
||||||
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
|
||||||
newProperty("Security.captcha.maxLoginTry", 8);
|
newProperty("Security.captcha.maxLoginTry", 8);
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
package fr.xephi.authme.util;
|
package fr.xephi.authme.util;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//public class TeleportUtils {
|
//public class TeleportUtils {
|
||||||
|
|||||||
Binary file not shown.
@@ -3,7 +3,7 @@ authors: [${pluginDescription.authors}]
|
|||||||
website: http://github.com/HaHaWTH/AuthMeReReloaded/
|
website: http://github.com/HaHaWTH/AuthMeReReloaded/
|
||||||
description: A fork of AuthMeReloaded that contains bug fixes
|
description: A fork of AuthMeReloaded that contains bug fixes
|
||||||
main: ${pluginDescription.main}
|
main: ${pluginDescription.main}
|
||||||
version: 5.6.0-FORK-b17
|
version: 5.6.0-FORK-b26
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
|
|||||||
Reference in New Issue
Block a user