diff --git a/pom.xml b/pom.xml
index e778c844..e8263709 100644
--- a/pom.xml
+++ b/pom.xml
@@ -533,8 +533,26 @@
bungeecord-chat
net.md-5
+
+ com.googlecode.json-simple
+ json-simple
+
+
+
+ com.google.guava
+ guava
+ 17.0
+ provided
+
+
+
+ com.google.code.gson
+ gson
+ 2.2.4
+ provided
+
diff --git a/src/main/java/fr/xephi/authme/data/auth/PlayerAuth.java b/src/main/java/fr/xephi/authme/data/auth/PlayerAuth.java
index 53d74dfb..32bdc01b 100644
--- a/src/main/java/fr/xephi/authme/data/auth/PlayerAuth.java
+++ b/src/main/java/fr/xephi/authme/data/auth/PlayerAuth.java
@@ -4,8 +4,8 @@ import fr.xephi.authme.security.crypts.HashedPassword;
import org.bukkit.Location;
import java.util.Objects;
+import java.util.Optional;
-import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -227,8 +227,8 @@ public class PlayerAuth {
public PlayerAuth build() {
PlayerAuth auth = new PlayerAuth();
auth.nickname = checkNotNull(name).toLowerCase();
- auth.realName = firstNonNull(realName, "Player");
- auth.password = firstNonNull(password, new HashedPassword(""));
+ auth.realName = Optional.ofNullable(realName).orElse("Player");
+ auth.password = Optional.ofNullable(password).orElse(new HashedPassword(""));
auth.totpKey = totpKey;
auth.email = DB_EMAIL_DEFAULT.equals(email) ? null : email;
auth.lastIp = lastIp; // Don't check against default value 127.0.0.1 as it may be a legit value
@@ -240,7 +240,7 @@ public class PlayerAuth {
auth.x = x;
auth.y = y;
auth.z = z;
- auth.world = firstNonNull(world, "world");
+ auth.world = Optional.ofNullable(world).orElse("world");
auth.yaw = yaw;
auth.pitch = pitch;
return auth;
diff --git a/src/main/java/fr/xephi/authme/service/yaml/YamlParseException.java b/src/main/java/fr/xephi/authme/service/yaml/YamlParseException.java
index 5cc3283e..eba631d3 100644
--- a/src/main/java/fr/xephi/authme/service/yaml/YamlParseException.java
+++ b/src/main/java/fr/xephi/authme/service/yaml/YamlParseException.java
@@ -2,7 +2,7 @@ package fr.xephi.authme.service.yaml;
import ch.jalu.configme.exception.ConfigMeException;
-import static com.google.common.base.MoreObjects.firstNonNull;
+import java.util.Optional;
/**
* Exception when a YAML file could not be parsed.
@@ -18,7 +18,7 @@ public class YamlParseException extends RuntimeException {
* @param configMeException the caught exception from ConfigMe
*/
public YamlParseException(String file, ConfigMeException configMeException) {
- super(firstNonNull(configMeException.getCause(), configMeException));
+ super(Optional.ofNullable(configMeException.getCause()).orElse(configMeException));
this.file = file;
}
diff --git a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java
index 2b9cdd83..6bd9e5eb 100644
--- a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java
+++ b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java
@@ -4,7 +4,6 @@ import ch.jalu.configme.configurationdata.ConfigurationData;
import ch.jalu.configme.migration.PlainMigrationService;
import ch.jalu.configme.properties.Property;
import ch.jalu.configme.resource.PropertyReader;
-import com.google.common.base.MoreObjects;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.LogLevel;
@@ -22,6 +21,7 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
@@ -214,7 +214,7 @@ public class SettingsMigrationService extends PlainMigrationService {
final Property newProperty = PluginSettings.LOG_LEVEL;
if (!newProperty.isPresent(reader) && reader.contains(oldPath)) {
ConsoleLogger.info("Moving '" + oldPath + "' to '" + newProperty.getPath() + "'");
- boolean oldValue = MoreObjects.firstNonNull(reader.getBoolean(oldPath), false);
+ boolean oldValue = Optional.ofNullable(reader.getBoolean(oldPath)).orElse(false);
LogLevel level = oldValue ? LogLevel.INFO : LogLevel.FINE;
configData.setValue(newProperty, level);
return true;
diff --git a/src/test/java/tools/docs/translations/TranslationPageGenerator.java b/src/test/java/tools/docs/translations/TranslationPageGenerator.java
index 80681987..d5e48099 100644
--- a/src/test/java/tools/docs/translations/TranslationPageGenerator.java
+++ b/src/test/java/tools/docs/translations/TranslationPageGenerator.java
@@ -10,10 +10,9 @@ import tools.utils.ToolsConstants;
import java.util.Arrays;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
-import static com.google.common.base.MoreObjects.firstNonNull;
-
/**
* Generates the translations page in docs.
*/
@@ -47,7 +46,7 @@ public class TranslationPageGenerator implements AutoToolTask {
for (TranslationInfo translation : gatherer.getTranslationInfo()) {
int percentage = (int) Math.round(translation.getPercentTranslated() * 100);
- String name = firstNonNull(LANGUAGE_NAMES.get(translation.getCode()), "?");
+ String name = Optional.ofNullable(LANGUAGE_NAMES.get(translation.getCode())).orElse("?");
TagValueHolder valueHolder = TagValueHolder.create()
.put("code", translation.getCode())
.put("name", name)