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