diff --git a/.checkstyle.xml b/.checkstyle.xml
new file mode 100644
index 00000000..d8f9076d
--- /dev/null
+++ b/.checkstyle.xml
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.codeclimate.yml b/.codeclimate.yml
new file mode 100644
index 00000000..9c4405f8
--- /dev/null
+++ b/.codeclimate.yml
@@ -0,0 +1,30 @@
+engines:
+ duplication:
+ enabled: true
+ config:
+ languages:
+ - java
+ - php
+ checkstyle:
+ enabled: true
+ channel: beta
+ config: '.checkstyle.xml'
+ pmd:
+ enabled: true
+ channel: beta
+ checks:
+ AvoidUsingHardCodedIP:
+ enabled: false
+ratings:
+ paths:
+ # Check only production files
+ - 'src/main/java/**'
+exclude_paths:
+# Exclude code from third-party sources
+- 'src/main/java/fr/xephi/authme/mail/OAuth2Provider.java'
+- 'src/main/java/fr/xephi/authme/mail/OAuth2SaslClient.java'
+- 'src/main/java/fr/xephi/authme/mail/OAuth2SaslClientFactory.java'
+- 'src/main/java/fr/xephi/authme/security/crypts/BCryptService.java'
+- 'src/main/java/fr/xephi/authme/security/crypts/PHPBB.java'
+- 'src/main/java/fr/xephi/authme/security/crypts/WHIRLPOOL.java'
+- 'src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java'
diff --git a/README.md b/README.md
index c9c717c7..2138ed4f 100644
--- a/README.md
+++ b/README.md
@@ -19,20 +19,14 @@
- Project status:
- Dependencies: [](https://www.versioneye.com/user/projects/57b182e8d6ffcd0032d7cf2d)
- Test coverage: [](https://coveralls.io/github/AuthMe-Team/AuthMeReloaded?branch=master)
+ - Code climate: [](https://codeclimate.com/github/AuthMe/AuthMeReloaded)
- Development resources:
- JavaDocs
- Maven Repository
-#####Statistics:
-
-McStats: http://mcstats.org/plugin/AuthMe
-
-
-
-
-
-
+- Statistics:
+ - bStats: [AuthMe on bstats.org](https://bstats.org/plugin/bukkit/AuthMe)
@@ -92,7 +86,7 @@ You can also create your own translation file and, if you want, you can share it
DoubleSaltedMD5: SALTED2MD5
WordPress: WORDPRESS
- Custom MySQL tables/columns names (useful with forums databases)
+ Custom MySQL tables/columns names (useful with forum databases)
Cached database queries!
Fully compatible with Citizens2, CombatTag, CombatTagPlus!
Compatible with Minecraft mods like BuildCraft or RedstoneCraft
diff --git a/src/main/java/fr/xephi/authme/api/API.java b/src/main/java/fr/xephi/authme/api/API.java
index d05fbe6b..75e746e6 100644
--- a/src/main/java/fr/xephi/authme/api/API.java
+++ b/src/main/java/fr/xephi/authme/api/API.java
@@ -23,6 +23,7 @@ import javax.inject.Inject;
* @deprecated Use {@link NewAPI}
*/
@Deprecated
+@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
public class API {
private static AuthMe instance;
diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java
index d4f34b2c..2193f64c 100644
--- a/src/main/java/fr/xephi/authme/api/NewAPI.java
+++ b/src/main/java/fr/xephi/authme/api/NewAPI.java
@@ -24,6 +24,7 @@ import java.util.List;
* NewAPI authmeApi = AuthMe.getApi();
*
*/
+@SuppressWarnings({"checkstyle:AbbreviationAsWordInName"}) // Justification: Class name cannot be changed anymore
public class NewAPI {
private static NewAPI singleton;
diff --git a/src/main/java/fr/xephi/authme/command/CommandDescription.java b/src/main/java/fr/xephi/authme/command/CommandDescription.java
index 18463bca..e195c475 100644
--- a/src/main/java/fr/xephi/authme/command/CommandDescription.java
+++ b/src/main/java/fr/xephi/authme/command/CommandDescription.java
@@ -19,6 +19,7 @@ import static java.util.Arrays.asList;
* {@code /authme} has a child whose label is {@code "register"}, then {@code /authme register} is the command that
* the child defines.
*/
+@SuppressWarnings("checkstyle:FinalClass") // Justification: class is mocked in multiple tests
public class CommandDescription {
/**
diff --git a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java
index c5756cda..d7150c89 100644
--- a/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java
+++ b/src/main/java/fr/xephi/authme/command/executable/captcha/CaptchaCommand.java
@@ -3,7 +3,6 @@ package fr.xephi.authme.command.executable.captcha;
import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.data.CaptchaManager;
import fr.xephi.authme.data.auth.PlayerCache;
-import fr.xephi.authme.command.PlayerCommand;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.CommonService;
diff --git a/src/main/java/fr/xephi/authme/datasource/Columns.java b/src/main/java/fr/xephi/authme/datasource/Columns.java
index b6d732cd..f984007e 100644
--- a/src/main/java/fr/xephi/authme/datasource/Columns.java
+++ b/src/main/java/fr/xephi/authme/datasource/Columns.java
@@ -6,6 +6,8 @@ import fr.xephi.authme.settings.properties.DatabaseSettings;
/**
* Database column names.
*/
+// Justification: String is immutable and this class is used to easily access the configurable column names
+@SuppressWarnings({"checkstyle:VisibilityModifier", "checkstyle:MemberName", "checkstyle:AbbreviationAsWordInName"})
public final class Columns {
public final String NAME;
diff --git a/src/main/java/fr/xephi/authme/datasource/converter/AbstractDataSourceConverter.java b/src/main/java/fr/xephi/authme/datasource/converter/AbstractDataSourceConverter.java
index d2be7804..8ca50625 100644
--- a/src/main/java/fr/xephi/authme/datasource/converter/AbstractDataSourceConverter.java
+++ b/src/main/java/fr/xephi/authme/datasource/converter/AbstractDataSourceConverter.java
@@ -37,7 +37,7 @@ public abstract class AbstractDataSourceConverter implemen
// which is never the case when a converter is launched from the /authme converter command.
@Override
public void execute(CommandSender sender) {
- if (!destinationType.equals(destination.getType())) {
+ if (destinationType != destination.getType()) {
if (sender != null) {
sender.sendMessage("Please configure your connection to "
+ destinationType + " and re-run this command");
@@ -59,6 +59,7 @@ public abstract class AbstractDataSourceConverter implemen
if (destination.isAuthAvailable(auth.getNickname())) {
skippedPlayers.add(auth.getNickname());
} else {
+ adaptPlayerAuth(auth);
destination.saveAuth(auth);
destination.updateQuitLoc(auth);
}
@@ -72,6 +73,15 @@ public abstract class AbstractDataSourceConverter implemen
+ " to " + destinationType);
}
+ /**
+ * Adapts the PlayerAuth from the source before it is saved in the destination.
+ *
+ * @param auth the auth from the source
+ */
+ protected void adaptPlayerAuth(PlayerAuth auth) {
+ // noop
+ }
+
/**
* @return the data source to convert from
* @throws Exception during initialization of source
diff --git a/src/main/java/fr/xephi/authme/datasource/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/datasource/converter/ForceFlatToSqlite.java
index a52b216b..1c67061f 100644
--- a/src/main/java/fr/xephi/authme/datasource/converter/ForceFlatToSqlite.java
+++ b/src/main/java/fr/xephi/authme/datasource/converter/ForceFlatToSqlite.java
@@ -1,5 +1,6 @@
package fr.xephi.authme.datasource.converter;
+import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.FlatFile;
@@ -25,4 +26,11 @@ public class ForceFlatToSqlite extends AbstractDataSourceConverter {
public FlatFile getSource() {
return source;
}
+
+ @Override
+ protected void adaptPlayerAuth(PlayerAuth auth) {
+ // Issue #1120: FlatFile returns PlayerAuth objects with realname = lower-case name all the time.
+ // We don't want to take this over into the new data source.
+ auth.setRealName("Player");
+ }
}
diff --git a/src/main/java/fr/xephi/authme/datasource/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/datasource/converter/RakamakConverter.java
index eb9d904c..42a8ecf1 100644
--- a/src/main/java/fr/xephi/authme/datasource/converter/RakamakConverter.java
+++ b/src/main/java/fr/xephi/authme/datasource/converter/RakamakConverter.java
@@ -16,6 +16,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
+import java.util.Map;
import java.util.Map.Entry;
/**
@@ -40,19 +41,17 @@ public class RakamakConverter implements Converter {
@Override
// TODO ljacqu 20151229: Restructure this into smaller portions
public void execute(CommandSender sender) {
- boolean useIP = settings.getProperty(ConverterSettings.RAKAMAK_USE_IP);
+ boolean useIp = settings.getProperty(ConverterSettings.RAKAMAK_USE_IP);
String fileName = settings.getProperty(ConverterSettings.RAKAMAK_FILE_NAME);
String ipFileName = settings.getProperty(ConverterSettings.RAKAMAK_IP_FILE_NAME);
File source = new File(pluginFolder, fileName);
- File ipfiles = new File(pluginFolder, ipFileName);
- HashMap playerIP = new HashMap<>();
- HashMap playerPSW = new HashMap<>();
+ File ipFiles = new File(pluginFolder, ipFileName);
+ Map playerIP = new HashMap<>();
+ Map playerPassword = new HashMap<>();
try {
- BufferedReader users;
- BufferedReader ipFile;
- ipFile = new BufferedReader(new FileReader(ipfiles));
+ BufferedReader ipFile = new BufferedReader(new FileReader(ipFiles));
String line;
- if (useIP) {
+ if (useIp) {
String tempLine;
while ((tempLine = ipFile.readLine()) != null) {
if (tempLine.contains("=")) {
@@ -63,20 +62,20 @@ public class RakamakConverter implements Converter {
}
ipFile.close();
- users = new BufferedReader(new FileReader(source));
+ BufferedReader users = new BufferedReader(new FileReader(source));
while ((line = users.readLine()) != null) {
if (line.contains("=")) {
String[] arguments = line.split("=");
HashedPassword hashedPassword = passwordSecurity.computeHash(arguments[1], arguments[0]);
- playerPSW.put(arguments[0], hashedPassword);
+ playerPassword.put(arguments[0], hashedPassword);
}
}
users.close();
- for (Entry m : playerPSW.entrySet()) {
+ for (Entry m : playerPassword.entrySet()) {
String playerName = m.getKey();
- HashedPassword psw = playerPSW.get(playerName);
- String ip = useIP ? playerIP.get(playerName) : "127.0.0.1";
+ HashedPassword psw = playerPassword.get(playerName);
+ String ip = useIp ? playerIP.get(playerName) : "127.0.0.1";
PlayerAuth auth = PlayerAuth.builder()
.name(playerName)
.realName(playerName)
diff --git a/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java b/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java
index 34996508..8767e88a 100644
--- a/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java
+++ b/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java
@@ -45,6 +45,12 @@ public class OnStartupTasks {
OnStartupTasks() {
}
+ /**
+ * Sends bstats metrics.
+ *
+ * @param plugin the plugin instance
+ * @param settings the settings
+ */
public static void sendMetrics(AuthMe plugin, Settings settings) {
final Metrics metrics = new Metrics(plugin);
diff --git a/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java b/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java
index e3ff4ec5..06a8761a 100644
--- a/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java
+++ b/src/main/java/fr/xephi/authme/listener/OnJoinVerifier.java
@@ -111,7 +111,7 @@ class OnJoinVerifier implements Reloadable {
* @param event the login event to verify
*
* @return true if the player's connection should be refused (i.e. the event does not need to be processed
- * further), false if the player is not refused
+ * further), false if the player is not refused
*/
public boolean refusePlayerForFullServer(PlayerLoginEvent event) {
final Player player = event.getPlayer();
diff --git a/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java b/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java
index 48cf1868..05150765 100644
--- a/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java
+++ b/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
+
package fr.xephi.authme.listener.protocollib;
import com.comphenix.protocol.PacketType;
@@ -46,7 +47,7 @@ class InventoryPacketAdapter extends PacketAdapter {
private static final int MAIN_SIZE = 27;
private static final int HOTBAR_SIZE = 9;
- public InventoryPacketAdapter(AuthMe plugin) {
+ InventoryPacketAdapter(AuthMe plugin) {
super(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS);
}
diff --git a/src/main/java/fr/xephi/authme/listener/protocollib/TabCompletePacketAdapter.java b/src/main/java/fr/xephi/authme/listener/protocollib/TabCompletePacketAdapter.java
index 4476f80a..daf68638 100644
--- a/src/main/java/fr/xephi/authme/listener/protocollib/TabCompletePacketAdapter.java
+++ b/src/main/java/fr/xephi/authme/listener/protocollib/TabCompletePacketAdapter.java
@@ -12,7 +12,7 @@ import fr.xephi.authme.data.auth.PlayerCache;
class TabCompletePacketAdapter extends PacketAdapter {
- public TabCompletePacketAdapter(AuthMe plugin) {
+ TabCompletePacketAdapter(AuthMe plugin) {
super(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.TAB_COMPLETE);
}
diff --git a/src/main/java/fr/xephi/authme/permission/handlers/PermissionsBukkitHandler.java b/src/main/java/fr/xephi/authme/permission/handlers/PermissionsBukkitHandler.java
index b7773e7a..acae466c 100644
--- a/src/main/java/fr/xephi/authme/permission/handlers/PermissionsBukkitHandler.java
+++ b/src/main/java/fr/xephi/authme/permission/handlers/PermissionsBukkitHandler.java
@@ -31,7 +31,8 @@ public class PermissionsBukkitHandler implements PermissionHandler {
@Override
public boolean addToGroup(Player player, String group) {
- return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player addgroup " + player.getName() + " " + group);
+ return Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ "permissions player addgroup " + player.getName() + " " + group);
}
@Override
@@ -46,17 +47,19 @@ public class PermissionsBukkitHandler implements PermissionHandler {
@Override
public boolean removeFromGroup(Player player, String group) {
- return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player removegroup " + player.getName() + " " + group);
+ return Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ "permissions player removegroup " + player.getName() + " " + group);
}
@Override
public boolean setGroup(Player player, String group) {
- return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player setgroup " + player.getName() + " " + group);
+ return Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ "permissions player setgroup " + player.getName() + " " + group);
}
@Override
public List getGroups(Player player) {
- List groups = new ArrayList();
+ List groups = new ArrayList<>();
for (Group group : permissionsBukkitInstance.getGroups(player.getUniqueId())) {
groups.add(group.getName());
}
diff --git a/src/main/java/fr/xephi/authme/permission/handlers/ZPermissionsHandler.java b/src/main/java/fr/xephi/authme/permission/handlers/ZPermissionsHandler.java
index 1de19f1d..c86863f7 100644
--- a/src/main/java/fr/xephi/authme/permission/handlers/ZPermissionsHandler.java
+++ b/src/main/java/fr/xephi/authme/permission/handlers/ZPermissionsHandler.java
@@ -30,7 +30,8 @@ public class ZPermissionsHandler implements PermissionHandler {
@Override
public boolean addToGroup(Player player, String group) {
- return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player " + player.getName() + " addgroup " + group);
+ return Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ "permissions player " + player.getName() + " addgroup " + group);
}
@Override
@@ -41,20 +42,23 @@ public class ZPermissionsHandler implements PermissionHandler {
@Override
public boolean hasPermissionOffline(String name, PermissionNode node) {
Map perms = zPermissionsService.getPlayerPermissions(null, null, name);
- if (perms.containsKey(node.getNode()))
+ if (perms.containsKey(node.getNode())) {
return perms.get(node.getNode());
- else
+ } else {
return false;
+ }
}
@Override
public boolean removeFromGroup(Player player, String group) {
- return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player " + player.getName() + " removegroup " + group);
+ return Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ "permissions player " + player.getName() + " removegroup " + group);
}
@Override
public boolean setGroup(Player player, String group) {
- return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permissions player " + player.getName() + " setgroup " + group);
+ return Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ "permissions player " + player.getName() + " setgroup " + group);
}
@Override
diff --git a/src/main/java/fr/xephi/authme/process/register/executors/PasswordRegisterExecutorProvider.java b/src/main/java/fr/xephi/authme/process/register/executors/PasswordRegisterExecutorProvider.java
index a79c63c8..9d40bcf8 100644
--- a/src/main/java/fr/xephi/authme/process/register/executors/PasswordRegisterExecutorProvider.java
+++ b/src/main/java/fr/xephi/authme/process/register/executors/PasswordRegisterExecutorProvider.java
@@ -56,10 +56,10 @@ class PasswordRegisterExecutorProvider {
/** Registration executor for password registration. */
class PasswordRegisterExecutor implements RegistrationExecutor {
- protected final Player player;
+ private final Player player;
private final String password;
private final String email;
- protected HashedPassword hashedPassword;
+ private HashedPassword hashedPassword;
/**
* Constructor.
@@ -105,6 +105,14 @@ class PasswordRegisterExecutorProvider {
}
syncProcessManager.processSyncPasswordRegister(player);
}
+
+ protected Player getPlayer() {
+ return player;
+ }
+
+ protected HashedPassword getHashedPassword() {
+ return hashedPassword;
+ }
}
/** Executor for password registration via API call. */
@@ -147,8 +155,9 @@ class PasswordRegisterExecutorProvider {
public void executePostPersistAction() {
super.executePostPersistAction();
- String qrCodeUrl = TwoFactor.getQRBarcodeURL(player.getName(), Bukkit.getIp(), hashedPassword.getHash());
- commonService.send(player, MessageKey.TWO_FACTOR_CREATE, hashedPassword.getHash(), qrCodeUrl);
+ String hash = getHashedPassword().getHash();
+ String qrCodeUrl = TwoFactor.getQRBarcodeURL(getPlayer().getName(), Bukkit.getIp(), hash);
+ commonService.send(getPlayer(), MessageKey.TWO_FACTOR_CREATE, hash, qrCodeUrl);
}
}
diff --git a/src/main/java/fr/xephi/authme/security/crypts/SeparateSaltMethod.java b/src/main/java/fr/xephi/authme/security/crypts/SeparateSaltMethod.java
index 7d4b3d95..d0dacda4 100644
--- a/src/main/java/fr/xephi/authme/security/crypts/SeparateSaltMethod.java
+++ b/src/main/java/fr/xephi/authme/security/crypts/SeparateSaltMethod.java
@@ -8,15 +8,15 @@ public abstract class SeparateSaltMethod implements EncryptionMethod {
@Override
public abstract String computeHash(String password, String salt, String name);
- @Override
- public abstract String generateSalt();
-
@Override
public HashedPassword computeHash(String password, String name) {
String salt = generateSalt();
return new HashedPassword(computeHash(password, salt, name), salt);
}
+ @Override
+ public abstract String generateSalt();
+
@Override
public boolean comparePassword(String password, HashedPassword hashedPassword, String name) {
return hashedPassword.getHash().equals(computeHash(password, hashedPassword.getSalt(), null));
diff --git a/src/main/java/fr/xephi/authme/security/crypts/UsernameSaltMethod.java b/src/main/java/fr/xephi/authme/security/crypts/UsernameSaltMethod.java
index 698979d8..23101e22 100644
--- a/src/main/java/fr/xephi/authme/security/crypts/UsernameSaltMethod.java
+++ b/src/main/java/fr/xephi/authme/security/crypts/UsernameSaltMethod.java
@@ -17,13 +17,13 @@ public abstract class UsernameSaltMethod implements EncryptionMethod {
public abstract HashedPassword computeHash(String password, String name);
@Override
- public boolean comparePassword(String password, HashedPassword hashedPassword, String name) {
- return hashedPassword.getHash().equals(computeHash(password, name).getHash());
+ public String computeHash(String password, String salt, String name) {
+ return computeHash(password, name).getHash();
}
@Override
- public String computeHash(String password, String salt, String name) {
- return computeHash(password, name).getHash();
+ public boolean comparePassword(String password, HashedPassword hashedPassword, String name) {
+ return hashedPassword.getHash().equals(computeHash(password, name).getHash());
}
@Override
diff --git a/src/main/java/fr/xephi/authme/service/BukkitService.java b/src/main/java/fr/xephi/authme/service/BukkitService.java
index 14cf0dcb..e945cebd 100644
--- a/src/main/java/fr/xephi/authme/service/BukkitService.java
+++ b/src/main/java/fr/xephi/authme/service/BukkitService.java
@@ -13,7 +13,6 @@ import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
-import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
@@ -172,7 +171,7 @@ public class BukkitService implements SettingsDependent {
* @return a BukkitTask that contains the id number
* @throws IllegalArgumentException if plugin is null
* @throws IllegalStateException if this was already scheduled
- * @see BukkitScheduler#runTaskTimer(Plugin, Runnable, long, long)
+ * @see BukkitScheduler#runTaskTimer(org.bukkit.plugin.Plugin, Runnable, long, long)
*/
public BukkitTask runTaskTimer(BukkitRunnable task, long delay, long period) {
return task.runTaskTimer(authMe, delay, period);
diff --git a/src/main/java/fr/xephi/authme/settings/properties/BackupSettings.java b/src/main/java/fr/xephi/authme/settings/properties/BackupSettings.java
index 162bf8aa..57bb5941 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/BackupSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/BackupSettings.java
@@ -6,7 +6,7 @@ import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class BackupSettings implements SettingsHolder {
+public final class BackupSettings implements SettingsHolder {
@Comment("Enable or disable automatic backup")
public static final Property ENABLED =
diff --git a/src/main/java/fr/xephi/authme/settings/properties/ConverterSettings.java b/src/main/java/fr/xephi/authme/settings/properties/ConverterSettings.java
index ae289e54..d2b34c9a 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/ConverterSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/ConverterSettings.java
@@ -6,7 +6,7 @@ import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class ConverterSettings implements SettingsHolder {
+public final class ConverterSettings implements SettingsHolder {
@Comment("Rakamak file name")
public static final Property RAKAMAK_FILE_NAME =
diff --git a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java
index fde994af..378bd198 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java
@@ -7,7 +7,7 @@ import fr.xephi.authme.datasource.DataSourceType;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class DatabaseSettings implements SettingsHolder {
+public final class DatabaseSettings implements SettingsHolder {
@Comment({"What type of database do you want to use?",
"Valid values: sqlite, mysql"})
diff --git a/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java b/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java
index 3a9ede5d..f7522b94 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java
@@ -9,7 +9,7 @@ import java.util.List;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class EmailSettings implements SettingsHolder {
+public final class EmailSettings implements SettingsHolder {
@Comment("Email SMTP server host")
public static final Property SMTP_HOST =
diff --git a/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java b/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java
index e82aadfa..05e2e3d9 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java
@@ -9,7 +9,7 @@ import java.util.List;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class HooksSettings implements SettingsHolder {
+public final class HooksSettings implements SettingsHolder {
@Comment("Do we need to hook with multiverse for spawn checking?")
public static final Property MULTIVERSE =
diff --git a/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java b/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
index 5f45ca5d..d99ffa0b 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
@@ -7,7 +7,7 @@ import fr.xephi.authme.output.LogLevel;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class PluginSettings implements SettingsHolder {
+public final class PluginSettings implements SettingsHolder {
@Comment({
"Do you want to enable the session feature?",
diff --git a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java
index 3a19a70e..2bae7179 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java
@@ -10,7 +10,7 @@ import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class ProtectionSettings implements SettingsHolder {
+public final class ProtectionSettings implements SettingsHolder {
@Comment("Enable some servers protection (country based login, antibot)")
public static final Property ENABLE_PROTECTION =
diff --git a/src/main/java/fr/xephi/authme/settings/properties/PurgeSettings.java b/src/main/java/fr/xephi/authme/settings/properties/PurgeSettings.java
index 0cfa029a..2c62454c 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/PurgeSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/PurgeSettings.java
@@ -6,7 +6,7 @@ import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class PurgeSettings implements SettingsHolder {
+public final class PurgeSettings implements SettingsHolder {
@Comment("If enabled, AuthMe automatically purges old, unused accounts")
public static final Property USE_AUTO_PURGE =
diff --git a/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java b/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java
index 38615b78..7d87e77b 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/RegistrationSettings.java
@@ -8,7 +8,7 @@ import fr.xephi.authme.process.register.RegistrationType;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class RegistrationSettings implements SettingsHolder {
+public final class RegistrationSettings implements SettingsHolder {
@Comment("Enable registration on the server?")
public static final Property IS_ENABLED =
@@ -42,7 +42,8 @@ public class RegistrationSettings implements SettingsHolder {
"EMAIL_MANDATORY = for password register: 2nd argument MUST be an email address"
})
public static final Property REGISTER_SECOND_ARGUMENT =
- newProperty(RegisterSecondaryArgument.class, "settings.registration.secondArg", RegisterSecondaryArgument.CONFIRMATION);
+ newProperty(RegisterSecondaryArgument.class, "settings.registration.secondArg",
+ RegisterSecondaryArgument.CONFIRMATION);
@Comment({
"Do we force kick a player after a successful registration?",
diff --git a/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java
index d0677579..5a007b32 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java
@@ -10,7 +10,7 @@ import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class RestrictionSettings implements SettingsHolder {
+public final class RestrictionSettings implements SettingsHolder {
@Comment({
"Can not authenticated players chat?",
diff --git a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java
index 496fb3b2..455af7e8 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java
@@ -12,7 +12,7 @@ import java.util.Set;
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
-public class SecuritySettings implements SettingsHolder {
+public final class SecuritySettings implements SettingsHolder {
@Comment({"Stop the server if we can't contact the sql database",
"Take care with this, if you set this to false,",
@@ -86,7 +86,8 @@ public class SecuritySettings implements SettingsHolder {
"- 'password'",
"- 'help'"})
public static final Property> UNSAFE_PASSWORDS =
- newLowercaseListProperty("settings.security.unsafePasswords", "123456", "password", "qwerty", "12345", "54321", "123456789", "help");
+ newLowercaseListProperty("settings.security.unsafePasswords",
+ "123456", "password", "qwerty", "12345", "54321", "123456789", "help");
@Comment("Tempban a user's IP address if they enter the wrong password too many times")
public static final Property TEMPBAN_ON_MAX_LOGINS =
diff --git a/src/main/java/fr/xephi/authme/util/RandomStringUtils.java b/src/main/java/fr/xephi/authme/util/RandomStringUtils.java
index db166a74..2dce3c64 100644
--- a/src/main/java/fr/xephi/authme/util/RandomStringUtils.java
+++ b/src/main/java/fr/xephi/authme/util/RandomStringUtils.java
@@ -24,7 +24,7 @@ public final class RandomStringUtils {
* @return The random string
*/
public static String generate(int length) {
- return generate(length, LOWER_ALPHANUMERIC_INDEX);
+ return generateString(length, LOWER_ALPHANUMERIC_INDEX);
}
/**
@@ -35,7 +35,7 @@ public final class RandomStringUtils {
* @return The random hexadecimal string
*/
public static String generateHex(int length) {
- return generate(length, HEX_MAX_INDEX);
+ return generateString(length, HEX_MAX_INDEX);
}
/**
@@ -46,10 +46,10 @@ public final class RandomStringUtils {
* @return The random string
*/
public static String generateLowerUpper(int length) {
- return generate(length, CHARS.length);
+ return generateString(length, CHARS.length);
}
- private static String generate(int length, int maxIndex) {
+ private static String generateString(int length, int maxIndex) {
if (length < 0) {
throw new IllegalArgumentException("Length must be positive but was " + length);
}
diff --git a/src/main/java/fr/xephi/authme/util/lazytags/TagReplacer.java b/src/main/java/fr/xephi/authme/util/lazytags/TagReplacer.java
index 660132fb..a9d19319 100644
--- a/src/main/java/fr/xephi/authme/util/lazytags/TagReplacer.java
+++ b/src/main/java/fr/xephi/authme/util/lazytags/TagReplacer.java
@@ -11,7 +11,7 @@ import java.util.stream.Collectors;
*
* @param the argument type
*/
-public class TagReplacer {
+public final class TagReplacer {
private final List> tags;
private final Collection messages;
diff --git a/src/main/resources/messages/messages_ru.yml b/src/main/resources/messages/messages_ru.yml
index 11f55835..ed4e1729 100644
--- a/src/main/resources/messages/messages_ru.yml
+++ b/src/main/resources/messages/messages_ru.yml
@@ -86,19 +86,19 @@ email_send_failure: 'Письмо не може быть отправлено.
show_no_email: '&2В данный момент к вашему аккаунте не привязана электронная почта.'
add_email: '&cДобавьте свой email: &e/email add <Ваш Email> <Ваш Email>'
recovery_email: '&cЗабыли пароль? Используйте &e/email recovery <Ваш Email>'
-# TODO email_cooldown_error: '&cAn email was already sent recently. You must wait %time before you can send a new one.'
+email_cooldown_error: '&cЭлектронное письмо было отправлено недавно. Пожалуйста, подождите %time прежде чем отправить новое письмо.'
# Каптча
usage_captcha: '&cВы должны ввести код, используйте: &e/captcha '
wrong_captcha: '&cНеверный код, используйте: &e/captcha THE_CAPTCHA'
valid_captcha: '&2Вы успешно ввели код!'
-# Time units
-# TODO second: 'second'
-# TODO seconds: 'seconds'
-# TODO minute: 'minute'
-# TODO minutes: 'minutes'
-# TODO hour: 'hour'
-# TODO hours: 'hours'
-# TODO day: 'day'
-# TODO days: 'days'
+# Единицы времени
+second: 'сек.'
+seconds: 'сек.'
+minute: 'мин.'
+minutes: 'мин.'
+hour: 'ч.'
+hours: 'ч.'
+day: 'дн.'
+days: 'дн.'
diff --git a/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java b/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java
index 7e0bb1a5..102584ed 100644
--- a/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java
+++ b/src/test/java/fr/xephi/authme/datasource/FlatFileIntegrationTest.java
@@ -61,13 +61,13 @@ public class FlatFileIntegrationTest {
// then
assertThat(authList, hasSize(7));
- assertThat(getName("bobby", authList), hasAuthBasicData("bobby", "Bobby", "your@email.com", "123.45.67.89"));
+ assertThat(getName("bobby", authList), hasAuthBasicData("bobby", "bobby", "your@email.com", "123.45.67.89"));
assertThat(getName("bobby", authList), hasAuthLocation(1.05, 2.1, 4.2, "world"));
assertThat(getName("bobby", authList).getPassword(), equalToHash("$SHA$11aa0706173d7272$dbba966"));
- assertThat(getName("twofields", authList), hasAuthBasicData("twofields", "twoFields", "your@email.com", "127.0.0.1"));
+ assertThat(getName("twofields", authList), hasAuthBasicData("twofields", "twofields", "your@email.com", "127.0.0.1"));
assertThat(getName("twofields", authList).getPassword(), equalToHash("hash1234"));
- assertThat(getName("threefields", authList), hasAuthBasicData("threefields", "threeFields", "your@email.com", "33.33.33.33"));
- assertThat(getName("fourfields", authList), hasAuthBasicData("fourfields", "fourFields", "your@email.com", "4.4.4.4"));
+ assertThat(getName("threefields", authList), hasAuthBasicData("threefields", "threefields", "your@email.com", "33.33.33.33"));
+ assertThat(getName("fourfields", authList), hasAuthBasicData("fourfields", "fourfields", "your@email.com", "4.4.4.4"));
assertThat(getName("fourfields", authList).getLastLogin(), equalTo(404040404L));
assertThat(getName("sevenfields", authList), hasAuthLocation(7.7, 14.14, 21.21, "world"));
assertThat(getName("eightfields", authList), hasAuthLocation(8.8, 17.6, 26.4, "eightworld"));
diff --git a/src/test/java/fr/xephi/authme/datasource/converter/ForceFlatToSqliteTest.java b/src/test/java/fr/xephi/authme/datasource/converter/ForceFlatToSqliteTest.java
index 3ec28a7b..556f58ef 100644
--- a/src/test/java/fr/xephi/authme/datasource/converter/ForceFlatToSqliteTest.java
+++ b/src/test/java/fr/xephi/authme/datasource/converter/ForceFlatToSqliteTest.java
@@ -63,11 +63,11 @@ public class ForceFlatToSqliteTest {
ArgumentCaptor authCaptor = ArgumentCaptor.forClass(PlayerAuth.class);
verify(dataSource, times(7)).saveAuth(authCaptor.capture());
List auths = authCaptor.getAllValues();
- assertThat(auths, hasItem(hasAuthBasicData("bobby", "Bobby", "your@email.com", "123.45.67.89")));
+ assertThat(auths, hasItem(hasAuthBasicData("bobby", "Player", "your@email.com", "123.45.67.89")));
assertThat(auths, hasItem(hasAuthLocation(1.05, 2.1, 4.2, "world")));
- assertThat(auths, hasItem(hasAuthBasicData("user", "user", "user@example.org", "34.56.78.90")));
+ assertThat(auths, hasItem(hasAuthBasicData("user", "Player", "user@example.org", "34.56.78.90")));
assertThat(auths, hasItem(hasAuthLocation(124.1, 76.3, -127.8, "nether")));
- assertThat(auths, hasItem(hasAuthBasicData("eightfields", "eightFields", "your@email.com", "6.6.6.66")));
+ assertThat(auths, hasItem(hasAuthBasicData("eightfields", "Player", "your@email.com", "6.6.6.66")));
assertThat(auths, hasItem(hasAuthLocation(8.8, 17.6, 26.4, "eightworld")));
}
diff --git a/src/test/resources/fr/xephi/authme/datasource/flatfile-test.txt b/src/test/resources/fr/xephi/authme/datasource/flatfile-test.txt
index da5a1312..d0ac4aa5 100644
--- a/src/test/resources/fr/xephi/authme/datasource/flatfile-test.txt
+++ b/src/test/resources/fr/xephi/authme/datasource/flatfile-test.txt
@@ -1,7 +1,7 @@
-Bobby:$SHA$11aa0706173d7272$dbba966:123.45.67.89:1449136800:1.05:2.1:4.2:world:your@email.com
+bobby:$SHA$11aa0706173d7272$dbba966:123.45.67.89:1449136800:1.05:2.1:4.2:world:your@email.com
user:b28c32f624a4eb161d6adc9acb5bfc5b:34.56.78.90:1453242857:124.1:76.3:-127.8:nether:user@example.org
-twoFields:hash1234
-threeFields:hash369:33.33.33.33
-fourFields:$hash$4444:4.4.4.4:404040404
-sevenFields:hash7749:5.5.5.55:1414141414:7.7:14.14:21.21
-eightFields:hash8168:6.6.6.66:1234567888:8.8:17.6:26.4:eightworld
+twofields:hash1234
+threefields:hash369:33.33.33.33
+fourfields:$hash$4444:4.4.4.4:404040404
+sevenfields:hash7749:5.5.5.55:1414141414:7.7:14.14:21.21
+eightfields:hash8168:6.6.6.66:1234567888:8.8:17.6:26.4:eightworld