diff --git a/README.md b/README.md
index 5d730aa..ec3f8fe 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Simple Authentication Mod
[![License](https://img.shields.io/github/license/samolego/simpleauth.svg)](https://github.com/samolego/SimpleAuth/blob/master/LICENSE)
-[![Gradle Build](https://github.com/samolego/SimpleAuth/workflows/Gradle%20Build/badge.svg)](https://samolego.github.io/projects/ci/SimpleAuth/latest)
+[![Fabric CI](https://github.com/samolego/SimpleAuth/workflows/Fabric%20CI/badge.svg)](https://samolego.github.io/projects/ci/SimpleAuth/latest)
[![Version](https://img.shields.io/github/v/tag/samolego/SimpleAuth.svg?label=version)](https://github.com/samolego/SimpleAuth/releases/latest)
[![Closed Issues](https://img.shields.io/github/issues-closed/samolego/simpleauth.svg)](https://github.com/samolego/SimpleAuth/issues?q=is%3Aissue+is%3Aclosed)
[![Curseforge downloads](http://cf.way2muchnoise.eu/full_simpleauth_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/simpleauth)
diff --git a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java
index ddd536c..d2500eb 100644
--- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java
+++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java
@@ -41,7 +41,7 @@ public class AuthEventHandler {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(incomingPlayerUsername);
- if((onlinePlayer != null && !isPlayerFake(onlinePlayer)) && config.experimental.disableAnotherLocationKick) {
+ if((onlinePlayer != null && !isPlayerFake(onlinePlayer)) && config.experimental.preventAnotherLocationKick) {
// Player needs to be kicked, since there's already a player with that name
// playing on the server
return new LiteralText(
diff --git a/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java b/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java
index 205d2d8..b5569d3 100644
--- a/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java
+++ b/src/main/java/org/samo_lego/simpleauth/storage/AuthConfig.java
@@ -47,7 +47,7 @@ public class AuthConfig {
public int kickTime = 60;
/**
* Disables registering and forces logging in with global password.
- * @see wiki
+ * @see wiki
*/
public boolean enableGlobalPassword = false;
/**
@@ -56,7 +56,7 @@ public class AuthConfig {
public String globalPassword;
/**
* Tries to rescue players if they are stuck inside a portal on logging in.
- * @see wiki
+ * @see wiki
*/
public boolean tryPortalRescue = true;
/**
@@ -70,13 +70,13 @@ public class AuthConfig {
public int maxPasswordChars = -1;
/**
* Regex of valid playername characters. You probably don't want to change this.
- * @see wiki
+ * @see wiki
*/
public String usernameRegex = "^[a-zA-Z0-9_]{3,16}$";
/**
* How long to keep session (auto-logging in the player), in seconds
* Set to -1 to disable
- * @see wiki
+ * @see wiki
*/
public int sessionTimeoutTime = 60;
@@ -92,7 +92,7 @@ public class AuthConfig {
/**
* Data for spawn (where deauthenticated players are teleported).
- * @see wiki
+ * @see wiki
*/
public static class WorldSpawn {
/**
@@ -138,7 +138,7 @@ public class AuthConfig {
/**
* Prevents player being kicked because another player with the same name has joined the server.
*/
- public boolean disableAnotherLocationKick = true;
+ public boolean preventAnotherLocationKick = true;
/**
* If player should be invulnerable before authentication.
*/
@@ -181,7 +181,7 @@ public class AuthConfig {
public boolean allowEntityPunch = false;
/**
* Whether to use BCrypt instead of Argon2 (GLIBC_2.25 error).
- * @see wiki
+ * @see wiki
*/
public boolean useBCryptLibrary = false;
}
diff --git a/src/main/java/org/samo_lego/simpleauth/utils/AuthHelper.java b/src/main/java/org/samo_lego/simpleauth/utils/AuthHelper.java
index 0397d37..f655159 100644
--- a/src/main/java/org/samo_lego/simpleauth/utils/AuthHelper.java
+++ b/src/main/java/org/samo_lego/simpleauth/utils/AuthHelper.java
@@ -1,5 +1,7 @@
package org.samo_lego.simpleauth.utils;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.samo_lego.simpleauth.SimpleAuth;
@@ -33,7 +35,14 @@ public class AuthHelper {
// Hashed password from DB
else {
JsonObject json = parser.parse(SimpleAuth.DB.getData(uuid)).getAsJsonObject();
- hashed = json.get("password").getAsString();
+ JsonElement passwordElement = json.get("password");
+ if(passwordElement instanceof JsonNull) {
+ // This shouldn't have happened, data seems to be corrupted
+ return -1;
+ }
+ else {
+ hashed = passwordElement.getAsString();
+ }
}
if(hashed.equals(""))
diff --git a/src/main/java/org/samo_lego/simpleauth/utils/CarpetHelper.java b/src/main/java/org/samo_lego/simpleauth/utils/CarpetHelper.java
index 6517e46..cb43bd8 100644
--- a/src/main/java/org/samo_lego/simpleauth/utils/CarpetHelper.java
+++ b/src/main/java/org/samo_lego/simpleauth/utils/CarpetHelper.java
@@ -4,8 +4,13 @@ import carpet.patches.EntityPlayerMPFake;
import net.minecraft.entity.player.PlayerEntity;
public class CarpetHelper {
- // Checking if player is actually a fake one
- // This is in its own class since we need carpet import
+ /**
+ * Checks if player is actually a fake one.
+ * Fake players are counted as ones, summoned with Carpet mod.
+ *
+ * @param player player to check
+ * @return true if it's fake, otherwise false
+ */
public static boolean isPlayerCarpetFake(PlayerEntity player) {
return player instanceof EntityPlayerMPFake;
}