forked from sorceress/EasyAuth
Minor changes
This commit is contained in:
parent
a5bd437227
commit
5a2fc463c3
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -47,7 +47,7 @@ public class AuthConfig {
|
|||
public int kickTime = 60;
|
||||
/**
|
||||
* Disables registering and forces logging in with global password.
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Locking-server-with-global-password">wiki</a>
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Global-password" target="_blank">wiki</a>
|
||||
*/
|
||||
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 <a href="https://github.com/samolego/SimpleAuth/wiki/Portal-Rescue">wiki</a>
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Portal-Rescue" target="_blank">wiki</a>
|
||||
*/
|
||||
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 <a href="https://github.com/samolego/SimpleAuth/wiki/Username-Restriction">wiki</a>
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Username-Restriction" target="_blank">wiki</a>
|
||||
*/
|
||||
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 <a href="https://github.com/samolego/SimpleAuth/wiki/Sessions">wiki</a>
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Sessions" target="_blank">wiki</a>
|
||||
*/
|
||||
public int sessionTimeoutTime = 60;
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class AuthConfig {
|
|||
|
||||
/**
|
||||
* Data for spawn (where deauthenticated players are teleported).
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Coordinate-Hiding">wiki</a>
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/Coordinate-Hiding" target="_blank">wiki</a>
|
||||
*/
|
||||
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 <a href="https://github.com/samolego/SimpleAuth/wiki/GLIBC-problems">wiki</a>
|
||||
* @see <a href="https://github.com/samolego/SimpleAuth/wiki/GLIBC-problems" target="_blank">wiki</a>
|
||||
*/
|
||||
public boolean useBCryptLibrary = false;
|
||||
}
|
||||
|
|
|
@ -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(""))
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue