Actually support 1.8 servers
This commit is contained in:
parent
650a97647a
commit
427251a4f3
18
pom.xml
18
pom.xml
@ -533,8 +533,26 @@
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<groupId>net.md-5</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Keep in sync with spigot 1.8.8 -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>17.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Keep in sync with spigot 1.8.8 -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Bukkit Libraries -->
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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<LogLevel> 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;
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user