mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-24 11:15:19 +01:00
Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into 547-process-architecture
Conflicts: src/main/java/fr/xephi/authme/settings/Settings.java
This commit is contained in:
commit
7dd1d52893
@ -1,7 +1,7 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
language: java
|
language: java
|
||||||
jdk: oraclejdk7
|
jdk: oraclejdk8
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
machine:
|
machine:
|
||||||
java:
|
java:
|
||||||
version: oraclejdk7
|
version: oraclejdk8
|
||||||
general:
|
general:
|
||||||
artifacts:
|
artifacts:
|
||||||
- "target/AuthMe-*.jar"
|
- "target/AuthMe-*.jar"
|
||||||
|
27
pom.xml
27
pom.xml
@ -48,7 +48,9 @@
|
|||||||
</prerequisites>
|
</prerequisites>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<!-- Project Encoding -->
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
|
||||||
|
|
||||||
<!-- Project Properties -->
|
<!-- Project Properties -->
|
||||||
<pluginName>AuthMe</pluginName>
|
<pluginName>AuthMe</pluginName>
|
||||||
@ -57,9 +59,6 @@
|
|||||||
<pluginAuthors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu</pluginAuthors>
|
<pluginAuthors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu</pluginAuthors>
|
||||||
<buildNumber>Unknown</buildNumber>
|
<buildNumber>Unknown</buildNumber>
|
||||||
|
|
||||||
<!-- Change Compiler Version (JDK) HERE! -->
|
|
||||||
<javaVersion>1.7</javaVersion>
|
|
||||||
|
|
||||||
<!-- Change Bukkit Version HERE! -->
|
<!-- Change Bukkit Version HERE! -->
|
||||||
<bukkitVersion>1.9-pre1-SNAPSHOT</bukkitVersion>
|
<bukkitVersion>1.9-pre1-SNAPSHOT</bukkitVersion>
|
||||||
</properties>
|
</properties>
|
||||||
@ -147,14 +146,28 @@
|
|||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- Maven Java Compiler -->
|
<!-- Maven Java Compiler (compile under 1.8 but allow 1.7/1.6 thanks to Retrolambda) -->
|
||||||
<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.5.1</version>
|
<version>3.5.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.7</source>
|
<source>1.8</source>
|
||||||
<target>${javaVersion}</target>
|
<target>1.8</target>
|
||||||
|
<!-- We need to run tests with java 1.7 to avoid errors with retrolambda! -->
|
||||||
|
<testSource>1.7</testSource>
|
||||||
|
<testTarget>1.7</testTarget>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- Test Plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.19.1</version>
|
||||||
|
<configuration>
|
||||||
|
<forkCount>3</forkCount>
|
||||||
|
<reuseForks>true</reuseForks>
|
||||||
|
<argLine>-client -Xmx512M -Dfile.encoding=UTF-8 ${argLine}</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Libs Shading and Relocation -->
|
<!-- Libs Shading and Relocation -->
|
||||||
@ -717,7 +730,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.minelink</groupId>
|
<groupId>net.minelink</groupId>
|
||||||
<artifactId>CombatTagPlus</artifactId>
|
<artifactId>CombatTagPlus</artifactId>
|
||||||
<version>1.2.1-SNAPSHOT</version>
|
<version>1.2.2-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
@ -41,7 +41,7 @@ public enum MessageKey {
|
|||||||
|
|
||||||
REGISTER_EMAIL_MESSAGE("reg_email_msg"),
|
REGISTER_EMAIL_MESSAGE("reg_email_msg"),
|
||||||
|
|
||||||
MAX_REGISTER_EXCEEDED("max_reg"),
|
MAX_REGISTER_EXCEEDED("max_reg", "%acc_nb"),
|
||||||
|
|
||||||
USAGE_REGISTER("usage_reg"),
|
USAGE_REGISTER("usage_reg"),
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
private final String name;
|
private final String name;
|
||||||
private final PlayerAuth auth;
|
private final PlayerAuth auth;
|
||||||
private final AuthMe plugin;
|
private final AuthMe plugin;
|
||||||
private final DataSource database;
|
|
||||||
private final PluginManager pm;
|
private final PluginManager pm;
|
||||||
private final JsonCache playerCache;
|
private final JsonCache playerCache;
|
||||||
private final NewSetting settings;
|
private final NewSetting settings;
|
||||||
@ -54,7 +53,6 @@ public class ProcessSyncPlayerLogin implements Runnable {
|
|||||||
public ProcessSyncPlayerLogin(Player player, AuthMe plugin,
|
public ProcessSyncPlayerLogin(Player player, AuthMe plugin,
|
||||||
DataSource database, NewSetting settings) {
|
DataSource database, NewSetting settings) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.database = database;
|
|
||||||
this.pm = plugin.getServer().getPluginManager();
|
this.pm = plugin.getServer().getPluginManager();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.name = player.getName().toLowerCase();
|
this.name = player.getName().toLowerCase();
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package fr.xephi.authme.process.register;
|
package fr.xephi.authme.process.register;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
@ -13,8 +16,6 @@ import fr.xephi.authme.security.crypts.TwoFactor;
|
|||||||
import fr.xephi.authme.settings.NewSetting;
|
import fr.xephi.authme.settings.NewSetting;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.util.StringUtils;
|
import fr.xephi.authme.util.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@ -71,6 +72,7 @@ public class AsyncRegister {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check this in both possiblities so don't use 'else if'
|
//check this in both possiblities so don't use 'else if'
|
||||||
|
Integer size = 0;
|
||||||
if (database.isAuthAvailable(name)) {
|
if (database.isAuthAvailable(name)) {
|
||||||
m.send(player, MessageKey.NAME_ALREADY_REGISTERED);
|
m.send(player, MessageKey.NAME_ALREADY_REGISTERED);
|
||||||
return false;
|
return false;
|
||||||
@ -78,8 +80,8 @@ public class AsyncRegister {
|
|||||||
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||||
&& !ip.equalsIgnoreCase("127.0.0.1")
|
&& !ip.equalsIgnoreCase("127.0.0.1")
|
||||||
&& !ip.equalsIgnoreCase("localhost")
|
&& !ip.equalsIgnoreCase("localhost")
|
||||||
&& database.getAllAuthsByIp(ip).size() >= Settings.getmaxRegPerIp) {
|
&& (size = database.getAllAuthsByIp(ip).size()) >= Settings.getmaxRegPerIp) {
|
||||||
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED);
|
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, size.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -96,10 +98,11 @@ public class AsyncRegister {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void emailRegister() {
|
private void emailRegister() {
|
||||||
|
Integer size = 0;
|
||||||
if (Settings.getmaxRegPerEmail > 0
|
if (Settings.getmaxRegPerEmail > 0
|
||||||
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||||
&& database.countAuthsByEmail(email) >= Settings.getmaxRegPerEmail) {
|
&& (size = database.countAuthsByEmail(email)) >= Settings.getmaxRegPerEmail) {
|
||||||
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED);
|
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED, size.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final HashedPassword hashedPassword = plugin.getPasswordSecurity().computeHash(password, name);
|
final HashedPassword hashedPassword = plugin.getPasswordSecurity().computeHash(password, name);
|
||||||
|
@ -2,15 +2,13 @@ package fr.xephi.authme.util;
|
|||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
|
||||||
public class Profiler {
|
public class Profiler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the past time in milliseconds.
|
* Defines the past time in milliseconds.
|
||||||
*/
|
*/
|
||||||
private long time = 0;
|
private long time = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the time in milliseconds the profiler last started at.
|
* Defines the time in milliseconds the profiler last started at.
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@ login: '&2Successful login!'
|
|||||||
vb_nonActiv: '&cYour account isn''t activated yet, please check your emails!'
|
vb_nonActiv: '&cYour account isn''t activated yet, please check your emails!'
|
||||||
user_regged: '&cYou already have registered this username!'
|
user_regged: '&cYou already have registered this username!'
|
||||||
usage_reg: '&cUsage: /register <password> <ConfirmPassword>'
|
usage_reg: '&cUsage: /register <password> <ConfirmPassword>'
|
||||||
max_reg: '&cYou have exceeded the maximum number of registrations for your connection!'
|
max_reg: '&cYou have exceeded the maximum number of registrations (%acc_nb) for your connection!'
|
||||||
no_perm: '&4You don''t have the permission to perform this action!'
|
no_perm: '&4You don''t have the permission to perform this action!'
|
||||||
error: '&4An unexpected error occurred, please contact an administrator!'
|
error: '&4An unexpected error occurred, please contact an administrator!'
|
||||||
login_msg: '&cPlease, login with the command "/login <password>"'
|
login_msg: '&cPlease, login with the command "/login <password>"'
|
||||||
|
@ -167,7 +167,9 @@ public abstract class AbstractResourceClosingTest {
|
|||||||
* Verify that all AutoCloseables that have been created during the method execution have been closed.
|
* Verify that all AutoCloseables that have been created during the method execution have been closed.
|
||||||
*/
|
*/
|
||||||
private void verifyHaveMocksBeenClosed() {
|
private void verifyHaveMocksBeenClosed() {
|
||||||
System.out.println("Found " + closeables.size() + " resources");
|
if (closeables.isEmpty()) {
|
||||||
|
System.out.println("Note: detected no AutoCloseables for method '" + method.getName() + "'");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
for (AutoCloseable autoCloseable : closeables) {
|
for (AutoCloseable autoCloseable : closeables) {
|
||||||
verify(autoCloseable).close();
|
verify(autoCloseable).close();
|
||||||
|
Loading…
Reference in New Issue
Block a user