From 1e88180b2372e2a1c7525d80dc49bd2dd3dd5b89 Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Thu, 7 May 2020 12:20:00 +0200 Subject: [PATCH] Polishing comments etc. --- gradle.properties | 8 ++++---- .../org/samo_lego/simpleauth/storage/PlayerCache.java | 5 ++--- .../samo_lego/simpleauth/storage/SimpleAuthDatabase.java | 2 +- .../java/org/samo_lego/simpleauth/utils/CarpetHelper.java | 2 +- .../org/samo_lego/simpleauth/utils/UuidConverter.java | 7 ++++--- src/main/resources/fabric.mod.json | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gradle.properties b/gradle.properties index aa996ff..55d82d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,12 +2,12 @@ org.gradle.jvmargs=-Xmx1G # Fabric properties -minecraft_version=20w18a -yarn_mappings=20w18a+build.15 +minecraft_version=20w19a +yarn_mappings=20w19a+build.1 loader_version=0.8.2+build.194 #Fabric api -fabric_version=0.10.4+build.340-1.16 +fabric_version=0.10.5+build.341-1.16 # Mod Properties mod_version = 1.4.1 @@ -15,4 +15,4 @@ fabric_version=0.10.4+build.340-1.16 archives_base_name = simpleauth # Carpet for debugging -carpet_core_version = 1.3.21+v200429 +carpet_core_version = 1.3.22+v200506.jar diff --git a/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java b/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java index 0fbfd69..ed98aa1 100644 --- a/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java +++ b/src/main/java/org/samo_lego/simpleauth/storage/PlayerCache.java @@ -2,7 +2,8 @@ package org.samo_lego.simpleauth.storage; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import org.samo_lego.simpleauth.SimpleAuth; + +import static org.samo_lego.simpleauth.SimpleAuth.db; public class PlayerCache { public boolean isRegistered; @@ -15,8 +16,6 @@ public class PlayerCache { public PlayerCache(String uuid, String ip) { - SimpleAuthDatabase db = SimpleAuth.db; - this.wasAuthenticated = false; this.loginTries = 0; this.lastIp = ip; diff --git a/src/main/java/org/samo_lego/simpleauth/storage/SimpleAuthDatabase.java b/src/main/java/org/samo_lego/simpleauth/storage/SimpleAuthDatabase.java index 3845088..514265f 100644 --- a/src/main/java/org/samo_lego/simpleauth/storage/SimpleAuthDatabase.java +++ b/src/main/java/org/samo_lego/simpleauth/storage/SimpleAuthDatabase.java @@ -90,7 +90,7 @@ public class SimpleAuthDatabase { // Gets the hashed password from DB public String getData(String uuid){ 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); } catch (Error e) { LOGGER.error("[SimpleAuth] Error getting password: " + e.getMessage()); 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 808fe5c..6517e46 100644 --- a/src/main/java/org/samo_lego/simpleauth/utils/CarpetHelper.java +++ b/src/main/java/org/samo_lego/simpleauth/utils/CarpetHelper.java @@ -5,7 +5,7 @@ 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 classes + // This is in its own class since we need carpet import public static boolean isPlayerCarpetFake(PlayerEntity player) { return player instanceof EntityPlayerMPFake; } diff --git a/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java b/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java index 0bec1bc..8d0aff5 100644 --- a/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java +++ b/src/main/java/org/samo_lego/simpleauth/utils/UuidConverter.java @@ -22,10 +22,11 @@ public class UuidConverter { // If server is in online mode online-mode UUIDs should be used if(isOnline) 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 - ExAmple if Example is already taken.*/ + ExAmple if Example is already taken. + */ String playername = player.getName().asString().toLowerCase(); return PlayerEntity.getOfflinePlayerUuid(playername).toString(); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 00a1852..aa2a645 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -9,11 +9,11 @@ "samo_lego" ], "contact": { + "homepage": "https://samolego.github.io/projects", "sources": "https://github.com/samolego/SimpleAuth" }, "license": "MIT", - "environment": "server", "entrypoints": { "server": [