diff --git a/CHANGELOG.md b/CHANGELOG.md index 111cadb..55c42ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -### 3.0.23-SNAPSHOT -##### Minecraft 1.20.3-1.20.4 +### 3.0.23 +##### Minecraft 1.20.5-1.20.6 1) Fix `auth list`. diff --git a/build.gradle b/build.gradle index 177d828..3a4eaec 100644 --- a/build.gradle +++ b/build.gradle @@ -106,11 +106,11 @@ modrinth { token.set(System.getenv("MODRINTH_TOKEN")) projectId.set("aZj58GfX") versionNumber.set("${project.version}") - versionName = "[1.20.3, 1.20.4] ${project.version}" + versionName = "[1.20.5, 1.20.6] ${project.version}" versionType = "beta" changelog.set("Release notes:\nhttps://github.com/NikitaCartes/EasyAuth/releases/tag/${project.version}\n\nChangelog:\nhttps://github.com/NikitaCartes/EasyAuth/tree/HEAD/CHANGELOG.md") uploadFile = remapJar - gameVersions.addAll("1.20.3", "1.20.4") + gameVersions.addAll("1.20.5", "1.20.6") loaders = ["fabric", "quilt"] dependencies { required.project("P7dR8mSH") // Fabric API @@ -130,11 +130,11 @@ curseforge { addGameVersion("Java 21") - addGameVersion("1.20.3") - addGameVersion("1.20.4") + addGameVersion("1.20.5") + addGameVersion("1.20.6") mainArtifact(remapJar) { - displayName = "[1.20.3, 1.20.4] ${project.version}" + displayName = "[1.20.5, 1.20.6] ${project.version}" relations { requiredDependency("fabric-api") embeddedLibrary 'server-translation-api' diff --git a/gradle.properties b/gradle.properties index 8827053..d84f291 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ mod_id=easyauth mod_version=3.0.23-SNAPSHOT # Fabric -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 -loader_version=0.15.2 -fabric_version=0.91.3+1.20.4 +minecraft_version=1.20.6 +yarn_mappings=1.20.6+build.1 +loader_version=0.15.11 +fabric_version=0.97.8+1.20.6 # Dependencies -server_translations_version=2.2.0+1.20.3-rc1 -fabric_permissions_version=0.2-SNAPSHOT -floodgate_api_version=2.2.0-20220810.210256-12 +server_translations_version=2.3.0+1.20.5-rc2 +fabric_permissions_version=0.3.1 +floodgate_api_version=2.2.0-SNAPSHOT argon2_version=2.11 bcrypt_version=0.10.2 diff --git a/src/main/java/xyz/nikitacartes/easyauth/mixin/PlayerManagerMixin.java b/src/main/java/xyz/nikitacartes/easyauth/mixin/PlayerManagerMixin.java index 91feff9..c1efb51 100644 --- a/src/main/java/xyz/nikitacartes/easyauth/mixin/PlayerManagerMixin.java +++ b/src/main/java/xyz/nikitacartes/easyauth/mixin/PlayerManagerMixin.java @@ -82,9 +82,9 @@ private void onPlayerConnect(Args args, ClientConnection connection, ServerPlaye LogDebug(String.format("Teleporting player %s", ((PlayerAuth) player).easyAuth$getFakeUuid())); - NbtCompound nbtCompound = playerManager.loadPlayerData(player); - if(nbtCompound != null && nbtCompound.contains("RootVehicle", 10)) { - NbtCompound nbtCompound2 = nbtCompound.getCompound("RootVehicle"); + Optional nbtCompound = playerManager.loadPlayerData(player); + if(nbtCompound.isPresent() && nbtCompound.get().contains("RootVehicle", 10)) { + NbtCompound nbtCompound2 = nbtCompound.get().getCompound("RootVehicle"); if (nbtCompound2.containsUuid("Attach")) { cache.ridingEntityUUID = nbtCompound2.getUuid("Attach"); } else { diff --git a/src/main/java/xyz/nikitacartes/easyauth/mixin/ServerPlayNetworkHandlerMixin.java b/src/main/java/xyz/nikitacartes/easyauth/mixin/ServerPlayNetworkHandlerMixin.java index c345857..10a6186 100644 --- a/src/main/java/xyz/nikitacartes/easyauth/mixin/ServerPlayNetworkHandlerMixin.java +++ b/src/main/java/xyz/nikitacartes/easyauth/mixin/ServerPlayNetworkHandlerMixin.java @@ -27,7 +27,7 @@ public abstract class ServerPlayNetworkHandlerMixin { method = "onChatMessage(Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;)V", at = @At( value = "INVOKE", - target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;validateMessage(Lnet/minecraft/network/message/LastSeenMessageList$Acknowledgment;)Ljava/util/Optional;", + target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;validateAcknowledgment(Lnet/minecraft/network/message/LastSeenMessageList$Acknowledgment;)Ljava/util/Optional;", shift = At.Shift.BEFORE ), cancellable = true diff --git a/src/main/java/xyz/nikitacartes/easyauth/mixin/WorldSaveHandlerMixin.java b/src/main/java/xyz/nikitacartes/easyauth/mixin/WorldSaveHandlerMixin.java index 95489b6..8d7fd99 100644 --- a/src/main/java/xyz/nikitacartes/easyauth/mixin/WorldSaveHandlerMixin.java +++ b/src/main/java/xyz/nikitacartes/easyauth/mixin/WorldSaveHandlerMixin.java @@ -9,16 +9,14 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; +import java.util.Optional; import static xyz.nikitacartes.easyauth.EasyAuth.*; import static xyz.nikitacartes.easyauth.utils.EasyLogger.LogDebug; @@ -30,62 +28,37 @@ public class WorldSaveHandlerMixin { @Shadow private File playerDataDir; - @Unique - private boolean fileExists; - /** - * Saves whether player save file exists. + * Loads offline-uuid player data to compoundTag in order to migrate from offline to online. * - * @param playerEntity * @param cir - * @param compoundTag - * @param file + * @param mixinFile */ @Inject( - method = "loadPlayerData(Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/nbt/NbtCompound;", + method = "loadPlayerData(Lnet/minecraft/entity/player/PlayerEntity;Ljava/lang/String;)Ljava/util/Optional;", at = @At( value = "INVOKE", target = "Ljava/io/File;exists()Z" ), - locals = LocalCapture.CAPTURE_FAILHARD - ) - private void fileExists(PlayerEntity playerEntity, CallbackInfoReturnable cir, NbtCompound compoundTag, File file) { - // @ModifyVariable cannot capture locals - this.fileExists = file.exists(); - } - - /** - * Loads offline-uuid player data to compoundTag in order to migrate from offline to online. - * - * @param compoundTag null compound tag. - * @param player player who might need migration of data. - * @return compoundTag containing migrated data. - */ - @ModifyVariable( - method = "loadPlayerData(Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/nbt/NbtCompound;", - at = @At( - value = "INVOKE", - target = "Ljava/io/File;exists()Z" - ) - ) - private NbtCompound migratePlayerData(NbtCompound compoundTag, PlayerEntity player) { - // Checking for offline player data only if online doesn't exist yet - String playername = player.getGameProfile().getName().toLowerCase(); - if (Boolean.parseBoolean(serverProp.getProperty("online-mode")) && mojangAccountNamesCache.contains(playername) && !this.fileExists) { - LogDebug(String.format("Migrating data for %s", playername)); - File file = new File(this.playerDataDir, Uuids.getOfflinePlayerUuid(player.getGameProfile().getName()) + ".dat"); - if (file.exists() && file.isFile()) - try { - compoundTag = NbtIo.readCompressed(new FileInputStream(file), NbtSizeTracker.ofUnlimitedBytes()); + locals = LocalCapture.CAPTURE_FAILHARD, + cancellable = true) + private void fileExists(PlayerEntity player, String extension, CallbackInfoReturnable> cir, File mixinFile) { + if (!(mixinFile.exists() && mixinFile.isFile())) { + String playername = player.getGameProfile().getName().toLowerCase(); + if (Boolean.parseBoolean(serverProp.getProperty("online-mode")) && mojangAccountNamesCache.contains(playername)) { + LogDebug(String.format("Migrating data for %s", playername)); + File file = new File(this.playerDataDir, Uuids.getOfflinePlayerUuid(player.getGameProfile().getName()) + extension); + if (file.exists() && file.isFile()) try { + cir.setReturnValue(Optional.of(NbtIo.readCompressed(file.toPath(), NbtSizeTracker.ofUnlimitedBytes()))); } catch (IOException e) { LogWarn(String.format("Failed to load player data for: %s", playername)); } - } else { - LogDebug( - String.format("Not migrating %s, as premium status is '%s' and data file is %s present.", - playername, mojangAccountNamesCache.contains(playername), this.fileExists ? "" : "not") - ); + } else { + LogDebug( + String.format("Not migrating %s, as premium status is '%s' and data file is %s present.", + playername, mojangAccountNamesCache.contains(playername), mixinFile.exists() && mixinFile.isFile() ? "" : "not") + ); + } } - return compoundTag; } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 123e79f..4dd665d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,7 +27,7 @@ "depends": { "fabric-api": "*", "fabricloader": "*", - "minecraft": ">=1.20.3-" + "minecraft": ">=1.20.5-" }, "suggests": { "fabric-permissions-api-v0": "*"