Skip to content

Commit

Permalink
Update to 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCartes committed May 5, 2024
1 parent fdd8310 commit 7a11639
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 66 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`.

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<NbtCompound> 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<Optional<NbtCompound>> 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;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"depends": {
"fabric-api": "*",
"fabricloader": "*",
"minecraft": ">=1.20.3-"
"minecraft": ">=1.20.5-"
},
"suggests": {
"fabric-permissions-api-v0": "*"
Expand Down

0 comments on commit 7a11639

Please sign in to comment.