parent
16be94d926
commit
ea4b75a212
346
pom.xml
346
pom.xml
|
@ -1,176 +1,176 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>AuthMe</artifactId>
|
||||
<version>6.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>AuthMe</name>
|
||||
<description>登录插件重制版本</description>
|
||||
<inceptionYear>2013</inceptionYear>
|
||||
<url>http://dev.bukkit.org/bukkit-plugins/authme-reloaded/</url>
|
||||
<!-- See also: https://www.spigotmc.org/resources/authme-reloaded.6269/ -->
|
||||
<organization>
|
||||
<name>AuthMe-Team</name>
|
||||
<url>https://github.com/AuthMe-Team</url>
|
||||
</organization>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/Xephi/AuthMeReloaded.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:Xephi/AuthMeReloaded.git</developerConnection>
|
||||
<url>http://github.com/Xephi/AuthMeReloaded</url>
|
||||
</scm>
|
||||
<!-- Official Build Server -->
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/Xephi/AuthMeReloaded/issues</url>
|
||||
</issueManagement>
|
||||
<ciManagement>
|
||||
<system>hudson</system>
|
||||
<url>http://ci.citycraft.cn:8080/job/AuthMe/</url>
|
||||
</ciManagement>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The GNU General Public Licence version 3 (GPLv3)</name>
|
||||
<url>http://www.gnu.org/licenses/gpl-3.0.html</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<javaVersion>1.7</javaVersion>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<update.description>测试版本发布...</update.description>
|
||||
<bukkitVersion>1.8.8-R0.1-SNAPSHOT</bukkitVersion>
|
||||
</properties>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>./messages/</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources/messages/</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>${javaVersion}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.zaxxer:HikariCP</include>
|
||||
<include>org.slf4j:slf4j-jdk14</include>
|
||||
<include>org.slf4j:slf4j-api</include>
|
||||
<include>com.maxmind.geoip:geoip-api</include>
|
||||
<include>com.google.code.gson:gson</include>
|
||||
<include>cn.citycraft:PluginHelper</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>http://hub.spigotmc.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citycraft-repo</id>
|
||||
<url>${jenkins.url}/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>PluginHelper</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Vault.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.earth2me</groupId>
|
||||
<artifactId>essentials</artifactId>
|
||||
<version>2.9.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Essentials.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.maxmind.geoip</groupId>
|
||||
<artifactId>geoip-api</artifactId>
|
||||
<version>1.2.15</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.0-beta9</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>3.6.5-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/ProtocolLib-3.6.5-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>AuthMe</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>AuthMe</name>
|
||||
<description>登录插件重制版本</description>
|
||||
<inceptionYear>2013</inceptionYear>
|
||||
<url>http://dev.bukkit.org/bukkit-plugins/authme-reloaded/</url>
|
||||
<!-- See also: https://www.spigotmc.org/resources/authme-reloaded.6269/ -->
|
||||
<organization>
|
||||
<name>AuthMe-Team</name>
|
||||
<url>https://github.com/AuthMe-Team</url>
|
||||
</organization>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/Xephi/AuthMeReloaded.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:Xephi/AuthMeReloaded.git</developerConnection>
|
||||
<url>http://github.com/Xephi/AuthMeReloaded</url>
|
||||
</scm>
|
||||
<!-- Official Build Server -->
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/Xephi/AuthMeReloaded/issues</url>
|
||||
</issueManagement>
|
||||
<ciManagement>
|
||||
<system>hudson</system>
|
||||
<url>http://ci.citycraft.cn:8080/job/AuthMe/</url>
|
||||
</ciManagement>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The GNU General Public Licence version 3 (GPLv3)</name>
|
||||
<url>http://www.gnu.org/licenses/gpl-3.0.html</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<javaVersion>1.7</javaVersion>
|
||||
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||
<update.description>&c修复注册后无法直接登录的问题...</update.description>
|
||||
<bukkitVersion>1.8.8-R0.1-SNAPSHOT</bukkitVersion>
|
||||
</properties>
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources/</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>./messages/</targetPath>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources/messages/</directory>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>${javaVersion}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.zaxxer:HikariCP</include>
|
||||
<include>org.slf4j:slf4j-jdk14</include>
|
||||
<include>org.slf4j:slf4j-api</include>
|
||||
<include>com.maxmind.geoip:geoip-api</include>
|
||||
<include>com.google.code.gson:gson</include>
|
||||
<include>cn.citycraft:PluginHelper</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>cn.citycraft.PluginHelper</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>http://hub.spigotmc.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citycraft-repo</id>
|
||||
<url>${jenkins.url}/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>PluginHelper</artifactId>
|
||||
<type>jar</type>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Vault.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.earth2me</groupId>
|
||||
<artifactId>essentials</artifactId>
|
||||
<version>2.9.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/Essentials.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.maxmind.geoip</groupId>
|
||||
<artifactId>geoip-api</artifactId>
|
||||
<version>1.2.15</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.0-beta9</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>3.6.5-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/ProtocolLib-3.6.5-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -13,88 +13,85 @@ import cn.citycraft.AuthMe.cache.backup.JsonCache;
|
|||
import cn.citycraft.AuthMe.settings.Settings;
|
||||
|
||||
public class LimboCache {
|
||||
private volatile static LimboCache singleton;
|
||||
public ConcurrentHashMap<String, LimboPlayer> cache;
|
||||
public AuthMe plugin;
|
||||
private final JsonCache playerData;
|
||||
|
||||
private volatile static LimboCache singleton;
|
||||
private LimboCache(final AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.cache = new ConcurrentHashMap<>();
|
||||
this.playerData = new JsonCache();
|
||||
}
|
||||
|
||||
public static LimboCache getInstance() {
|
||||
if (singleton == null) {
|
||||
singleton = new LimboCache(AuthMe.getInstance());
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
public static LimboCache getInstance() {
|
||||
if (singleton == null) {
|
||||
singleton = new LimboCache(AuthMe.getInstance());
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, LimboPlayer> cache;
|
||||
public AuthMe plugin;
|
||||
public void addLimboPlayer(final Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
Location loc = player.getLocation();
|
||||
GameMode gameMode = player.getGameMode();
|
||||
boolean operator = false;
|
||||
String playerGroup = "";
|
||||
boolean flying = false;
|
||||
|
||||
private final JsonCache playerData;
|
||||
if (playerData.doesCacheExist(player)) {
|
||||
final DataFileCache cache = playerData.readCache(player);
|
||||
if (cache != null) {
|
||||
playerGroup = cache.getGroup();
|
||||
operator = cache.getOperator();
|
||||
flying = cache.isFlying();
|
||||
}
|
||||
} else {
|
||||
operator = player.isOp();
|
||||
flying = player.isFlying();
|
||||
if (plugin.permission != null) {
|
||||
try {
|
||||
playerGroup = plugin.permission.getPrimaryGroup(player);
|
||||
} catch (final UnsupportedOperationException e) {
|
||||
ConsoleLogger.showError("你的权限系统 (" + plugin.permission.getName() + ") 不支持权限组功能 移除配置... UnHook!");
|
||||
plugin.permission = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LimboCache(final AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.cache = new ConcurrentHashMap<>();
|
||||
this.playerData = new JsonCache();
|
||||
}
|
||||
if (Settings.isForceSurvivalModeEnabled) {
|
||||
if (gameMode == GameMode.CREATIVE) {
|
||||
flying = false;
|
||||
}
|
||||
gameMode = GameMode.SURVIVAL;
|
||||
}
|
||||
if (player.isDead()) {
|
||||
loc = plugin.getSpawnLocation(player);
|
||||
}
|
||||
cache.put(name, new LimboPlayer(name, loc, gameMode, operator, playerGroup, flying));
|
||||
}
|
||||
|
||||
public void addLimboPlayer(final Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
Location loc = player.getLocation();
|
||||
GameMode gameMode = player.getGameMode();
|
||||
boolean operator = false;
|
||||
String playerGroup = "";
|
||||
boolean flying = false;
|
||||
public void addLimboPlayer(final Player player, final String group) {
|
||||
cache.put(player.getName().toLowerCase(), new LimboPlayer(player.getName().toLowerCase(), group));
|
||||
}
|
||||
|
||||
if (playerData.doesCacheExist(player)) {
|
||||
final DataFileCache cache = playerData.readCache(player);
|
||||
if (cache != null) {
|
||||
playerGroup = cache.getGroup();
|
||||
operator = cache.getOperator();
|
||||
flying = cache.isFlying();
|
||||
}
|
||||
} else {
|
||||
operator = player.isOp();
|
||||
flying = player.isFlying();
|
||||
if (plugin.permission != null) {
|
||||
try {
|
||||
playerGroup = plugin.permission.getPrimaryGroup(player);
|
||||
} catch (final UnsupportedOperationException e) {
|
||||
ConsoleLogger.showError("Your permission system (" + plugin.permission.getName() + ") do not support Group system with that config... unhook!");
|
||||
plugin.permission = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void deleteLimboPlayer(final String name) {
|
||||
cache.remove(name);
|
||||
}
|
||||
|
||||
if (Settings.isForceSurvivalModeEnabled) {
|
||||
if (gameMode == GameMode.CREATIVE) {
|
||||
flying = false;
|
||||
}
|
||||
gameMode = GameMode.SURVIVAL;
|
||||
}
|
||||
if (player.isDead()) {
|
||||
loc = plugin.getSpawnLocation(player);
|
||||
}
|
||||
cache.put(name, new LimboPlayer(name, loc, gameMode, operator, playerGroup, flying));
|
||||
}
|
||||
public LimboPlayer getLimboPlayer(final String name) {
|
||||
return cache.get(name);
|
||||
}
|
||||
|
||||
public void addLimboPlayer(final Player player, final String group) {
|
||||
cache.put(player.getName().toLowerCase(), new LimboPlayer(player.getName().toLowerCase(), group));
|
||||
}
|
||||
public boolean hasLimboPlayer(final String name) {
|
||||
return cache.containsKey(name);
|
||||
}
|
||||
|
||||
public void deleteLimboPlayer(final String name) {
|
||||
cache.remove(name);
|
||||
}
|
||||
|
||||
public LimboPlayer getLimboPlayer(final String name) {
|
||||
return cache.get(name);
|
||||
}
|
||||
|
||||
public boolean hasLimboPlayer(final String name) {
|
||||
return cache.containsKey(name);
|
||||
}
|
||||
|
||||
public void updateLimboPlayer(final Player player) {
|
||||
if (this.hasLimboPlayer(player.getName().toLowerCase())) {
|
||||
this.deleteLimboPlayer(player.getName().toLowerCase());
|
||||
}
|
||||
addLimboPlayer(player);
|
||||
}
|
||||
public void updateLimboPlayer(final Player player) {
|
||||
if (this.hasLimboPlayer(player.getName().toLowerCase())) {
|
||||
this.deleteLimboPlayer(player.getName().toLowerCase());
|
||||
}
|
||||
addLimboPlayer(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,135 +16,135 @@ import cn.citycraft.AuthMe.settings.Settings;
|
|||
|
||||
public class AsyncronousRegister {
|
||||
|
||||
private final DataSource database;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final AuthMe plugin;
|
||||
protected boolean allowRegister;
|
||||
protected String email = "";
|
||||
protected String name;
|
||||
protected String password;
|
||||
protected Player player;
|
||||
private final DataSource database;
|
||||
private final Messages m = Messages.getInstance();
|
||||
private final AuthMe plugin;
|
||||
protected boolean allowRegister;
|
||||
protected String email = "";
|
||||
protected String name;
|
||||
protected String password;
|
||||
protected Player player;
|
||||
|
||||
public AsyncronousRegister(final Player player, final String password, final String email, final AuthMe plugin, final DataSource data) {
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.email = email;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
this.allowRegister = true;
|
||||
}
|
||||
public AsyncronousRegister(final Player player, final String password, final String email, final AuthMe plugin, final DataSource data) {
|
||||
this.player = player;
|
||||
this.password = password;
|
||||
this.name = player.getName().toLowerCase();
|
||||
this.email = email;
|
||||
this.plugin = plugin;
|
||||
this.database = data;
|
||||
this.allowRegister = true;
|
||||
}
|
||||
|
||||
public void process() {
|
||||
preRegister();
|
||||
if (!allowRegister) {
|
||||
return;
|
||||
}
|
||||
// TODO 计划删除邮箱
|
||||
// if (!email.isEmpty() && !email.equals("")) {
|
||||
// if (Settings.getmaxRegPerEmail > 0) {
|
||||
// if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
// m.send(player, "max_reg");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// emailRegister();
|
||||
// return;
|
||||
// }
|
||||
passwordRegister();
|
||||
}
|
||||
// TODO 计划删除邮箱
|
||||
// protected void emailRegister() {
|
||||
// if (Settings.getmaxRegPerEmail > 0) {
|
||||
// if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
// m.send(player, "max_reg");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// PlayerAuth auth;
|
||||
// try {
|
||||
// final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
// auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player
|
||||
// .getLocation()
|
||||
// .getWorld()
|
||||
// .getName(), email, player.getName());
|
||||
// } catch (final NoSuchAlgorithmException e) {
|
||||
// ConsoleLogger.showError(e.getMessage());
|
||||
// m.send(player, "error");
|
||||
// return;
|
||||
// }
|
||||
// if (PasswordSecurity.userSalt.containsKey(name)) {
|
||||
// auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
// }
|
||||
// database.saveAuth(auth);
|
||||
// database.updateEmail(auth);
|
||||
// database.updateSession(auth);
|
||||
// final ProcessSyncronousEmailRegister syncronous = new ProcessSyncronousEmailRegister(player, plugin);
|
||||
// plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
// }
|
||||
public void process() {
|
||||
preRegister();
|
||||
if (!allowRegister) {
|
||||
return;
|
||||
}
|
||||
// TODO 计划删除邮箱
|
||||
// if (!email.isEmpty() && !email.equals("")) {
|
||||
// if (Settings.getmaxRegPerEmail > 0) {
|
||||
// if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
// m.send(player, "max_reg");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// emailRegister();
|
||||
// return;
|
||||
// }
|
||||
passwordRegister();
|
||||
}
|
||||
// TODO 计划删除邮箱
|
||||
// protected void emailRegister() {
|
||||
// if (Settings.getmaxRegPerEmail > 0) {
|
||||
// if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
// m.send(player, "max_reg");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// PlayerAuth auth;
|
||||
// try {
|
||||
// final String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
// auth = new PlayerAuth(name, hashnew, getIp(), 0, (int) player.getLocation().getX(), (int) player.getLocation().getY(), (int) player.getLocation().getZ(), player
|
||||
// .getLocation()
|
||||
// .getWorld()
|
||||
// .getName(), email, player.getName());
|
||||
// } catch (final NoSuchAlgorithmException e) {
|
||||
// ConsoleLogger.showError(e.getMessage());
|
||||
// m.send(player, "error");
|
||||
// return;
|
||||
// }
|
||||
// if (PasswordSecurity.userSalt.containsKey(name)) {
|
||||
// auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
// }
|
||||
// database.saveAuth(auth);
|
||||
// database.updateEmail(auth);
|
||||
// database.updateSession(auth);
|
||||
// final ProcessSyncronousEmailRegister syncronous = new ProcessSyncronousEmailRegister(player, plugin);
|
||||
// plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
// }
|
||||
|
||||
protected String getIp() {
|
||||
return plugin.getIP(player);
|
||||
}
|
||||
protected String getIp() {
|
||||
return plugin.getIP(player);
|
||||
}
|
||||
|
||||
protected void passwordRegister() {
|
||||
PlayerAuth auth;
|
||||
String hash;
|
||||
try {
|
||||
hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
m.send(player, "error");
|
||||
return;
|
||||
}
|
||||
if (Settings.getMySQLColumnSalt.isEmpty() && !PasswordSecurity.userSalt.containsKey(name)) {
|
||||
auth = new PlayerAuth(name, hash, getIp(), new Date().getTime(), "your@email.com", player.getName());
|
||||
} else {
|
||||
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), getIp(), new Date().getTime(), player.getName());
|
||||
}
|
||||
if (!database.saveAuth(auth)) {
|
||||
m.send(player, "error");
|
||||
return;
|
||||
}
|
||||
if (!Settings.forceRegLogin) {
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
database.setLogged(name);
|
||||
}
|
||||
plugin.otherAccounts.addPlayer(player.getName());
|
||||
final ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
}
|
||||
protected void passwordRegister() {
|
||||
PlayerAuth auth;
|
||||
String hash;
|
||||
try {
|
||||
hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
m.send(player, "error");
|
||||
return;
|
||||
}
|
||||
if (Settings.getMySQLColumnSalt.isEmpty() && !PasswordSecurity.userSalt.containsKey(name)) {
|
||||
auth = new PlayerAuth(name, hash, getIp(), new Date().getTime(), "your@email.com", player.getName());
|
||||
} else {
|
||||
auth = new PlayerAuth(name, hash, PasswordSecurity.userSalt.get(name), getIp(), new Date().getTime(), player.getName());
|
||||
}
|
||||
if (!database.saveAuth(auth)) {
|
||||
m.send(player, "error");
|
||||
return;
|
||||
}
|
||||
if (Settings.forceRegLogin) {
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
database.setLogged(name);
|
||||
}
|
||||
plugin.otherAccounts.addPlayer(player.getName());
|
||||
final ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
}
|
||||
|
||||
protected void preRegister() {
|
||||
final String lowpass = password.toLowerCase();
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "logged_in");
|
||||
allowRegister = false;
|
||||
} else if (!Settings.isRegistrationEnabled) {
|
||||
m.send(player, "reg_disabled");
|
||||
allowRegister = false;
|
||||
} else if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select")
|
||||
|| lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
|
||||
m.send(player, "password_error");
|
||||
allowRegister = false;
|
||||
} else if (lowpass.equalsIgnoreCase(player.getName())) {
|
||||
m.send(player, "password_error_nick");
|
||||
allowRegister = false;
|
||||
} else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
|
||||
m.send(player, "pass_len");
|
||||
allowRegister = false;
|
||||
} else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) {
|
||||
m.send(player, "password_error_unsafe");
|
||||
allowRegister = false;
|
||||
} else if (database.isAuthAvailable(name)) {
|
||||
m.send(player, "user_regged");
|
||||
allowRegister = false;
|
||||
} else if (Settings.getmaxRegPerIp > 0) {
|
||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1")
|
||||
&& !getIp().equalsIgnoreCase("localhost")) {
|
||||
m.send(player, "max_reg");
|
||||
allowRegister = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void preRegister() {
|
||||
final String lowpass = password.toLowerCase();
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "logged_in");
|
||||
allowRegister = false;
|
||||
} else if (!Settings.isRegistrationEnabled) {
|
||||
m.send(player, "reg_disabled");
|
||||
allowRegister = false;
|
||||
} else if (lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select")
|
||||
|| lowpass.contains(";") || lowpass.contains("null") || !lowpass.matches(Settings.getPassRegex)) {
|
||||
m.send(player, "password_error");
|
||||
allowRegister = false;
|
||||
} else if (lowpass.equalsIgnoreCase(player.getName())) {
|
||||
m.send(player, "password_error_nick");
|
||||
allowRegister = false;
|
||||
} else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
|
||||
m.send(player, "pass_len");
|
||||
allowRegister = false;
|
||||
} else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) {
|
||||
m.send(player, "password_error_unsafe");
|
||||
allowRegister = false;
|
||||
} else if (database.isAuthAvailable(name)) {
|
||||
m.send(player, "user_regged");
|
||||
allowRegister = false;
|
||||
} else if (Settings.getmaxRegPerIp > 0) {
|
||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1")
|
||||
&& !getIp().equalsIgnoreCase("localhost")) {
|
||||
m.send(player, "max_reg");
|
||||
allowRegister = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -196,8 +196,8 @@ settings:
|
|||
# 是否在玩家成功注册后t出玩家
|
||||
# 不使用下面的注册功能
|
||||
forceKickAfterRegister: false
|
||||
# 是否需要Autheme强制在正常注册后才能使用/login
|
||||
forceLoginAfterRegister: false
|
||||
# 是否需要Autheme注册以后直接使玩家登录
|
||||
forceLoginAfterRegister: true
|
||||
unrestrictions:
|
||||
# 在下面列出的所有id,Authme都将忽略注册和登陆。启用该选项要注意风险!
|
||||
# 如果你要添加[]的括号,你必须使用' '
|
||||
|
@ -226,8 +226,6 @@ settings:
|
|||
delayJoinMessage: false
|
||||
# 是否需要再 login或register 后使用药水效果?
|
||||
applyBlindEffect: false
|
||||
|
||||
|
||||
ExternalBoardOptions:
|
||||
# MySQL column for the salt , needed for some forum/cms support
|
||||
mySQLColumnSalt: ''
|
||||
|
|
Loading…
Reference in New Issue