Polishing comments etc.

This commit is contained in:
samo_lego 2020-05-07 12:20:00 +02:00
parent 6d507bdc7b
commit 1e88180b23
6 changed files with 13 additions and 13 deletions

View File

@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric properties # Fabric properties
minecraft_version=20w18a minecraft_version=20w19a
yarn_mappings=20w18a+build.15 yarn_mappings=20w19a+build.1
loader_version=0.8.2+build.194 loader_version=0.8.2+build.194
#Fabric api #Fabric api
fabric_version=0.10.4+build.340-1.16 fabric_version=0.10.5+build.341-1.16
# Mod Properties # Mod Properties
mod_version = 1.4.1 mod_version = 1.4.1
@ -15,4 +15,4 @@ fabric_version=0.10.4+build.340-1.16
archives_base_name = simpleauth archives_base_name = simpleauth
# Carpet for debugging # Carpet for debugging
carpet_core_version = 1.3.21+v200429 carpet_core_version = 1.3.22+v200506.jar

View File

@ -2,7 +2,8 @@ package org.samo_lego.simpleauth.storage;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import org.samo_lego.simpleauth.SimpleAuth;
import static org.samo_lego.simpleauth.SimpleAuth.db;
public class PlayerCache { public class PlayerCache {
public boolean isRegistered; public boolean isRegistered;
@ -15,8 +16,6 @@ public class PlayerCache {
public PlayerCache(String uuid, String ip) { public PlayerCache(String uuid, String ip) {
SimpleAuthDatabase db = SimpleAuth.db;
this.wasAuthenticated = false; this.wasAuthenticated = false;
this.loginTries = 0; this.loginTries = 0;
this.lastIp = ip; this.lastIp = ip;

View File

@ -90,7 +90,7 @@ public class SimpleAuthDatabase {
// Gets the hashed password from DB // Gets the hashed password from DB
public String getData(String uuid){ public String getData(String uuid){
try { try {
if(this.isUserRegistered(uuid)) // Gets password from db and removes "password:" prefix from it if(this.isUserRegistered(uuid)) // Gets password from db and removes "data:" prefix from it
return new String(levelDBStore.get(bytes("UUID:" + uuid))).substring(5); return new String(levelDBStore.get(bytes("UUID:" + uuid))).substring(5);
} catch (Error e) { } catch (Error e) {
LOGGER.error("[SimpleAuth] Error getting password: " + e.getMessage()); LOGGER.error("[SimpleAuth] Error getting password: " + e.getMessage());

View File

@ -5,7 +5,7 @@ import net.minecraft.entity.player.PlayerEntity;
public class CarpetHelper { public class CarpetHelper {
// Checking if player is actually a fake one // Checking if player is actually a fake one
// This is in its own class since we need carpet classes // This is in its own class since we need carpet import
public static boolean isPlayerCarpetFake(PlayerEntity player) { public static boolean isPlayerCarpetFake(PlayerEntity player) {
return player instanceof EntityPlayerMPFake; return player instanceof EntityPlayerMPFake;
} }

View File

@ -22,10 +22,11 @@ public class UuidConverter {
// If server is in online mode online-mode UUIDs should be used // If server is in online mode online-mode UUIDs should be used
if(isOnline) if(isOnline)
return player.getUuidAsString(); return player.getUuidAsString();
/*
/* Lower case is used for Player and PlAyEr to get same UUID Lower case is used for Player and PlAyEr to get same UUID (for password storing)
Mimicking Mojang behaviour, where players cannot set their name to Mimicking Mojang behaviour, where players cannot set their name to
ExAmple if Example is already taken.*/ ExAmple if Example is already taken.
*/
String playername = player.getName().asString().toLowerCase(); String playername = player.getName().asString().toLowerCase();
return PlayerEntity.getOfflinePlayerUuid(playername).toString(); return PlayerEntity.getOfflinePlayerUuid(playername).toString();
} }

View File

@ -9,11 +9,11 @@
"samo_lego" "samo_lego"
], ],
"contact": { "contact": {
"homepage": "https://samolego.github.io/projects",
"sources": "https://github.com/samolego/SimpleAuth" "sources": "https://github.com/samolego/SimpleAuth"
}, },
"license": "MIT", "license": "MIT",
"environment": "server", "environment": "server",
"entrypoints": { "entrypoints": {
"server": [ "server": [