forked from sorceress/EasyAuth
Merge branch 'architectury' into archi-snapshot
This commit is contained in:
commit
240f83549c
|
@ -40,6 +40,7 @@ public class MixinPlayerAdvancementTracker {
|
|||
@Inject(method = "load(Lnet/minecraft/server/ServerAdvancementLoader;)V", at = @At("TAIL"))
|
||||
private void endMigratingOfflineAdvancements(ServerAdvancementLoader advancementLoader, CallbackInfo ci) {
|
||||
if(config.main.premiumAutologin && !config.experimental.forceoOfflineUuids && ((PlayerAuth) this.owner).isUsingMojangAccount()) {
|
||||
// Changes the file name to use online UUID
|
||||
this.advancementFile = new File(this.advancementFile.getParent(), owner.getUuid() + ".json");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.samo_lego.simpleauth.mixin;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.PlayerManager;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.stat.ServerStatHandler;
|
||||
|
@ -11,12 +10,9 @@ import net.minecraft.text.LiteralText;
|
|||
import net.minecraft.text.Text;
|
||||
import org.samo_lego.simpleauth.event.AuthEventHandler;
|
||||
import org.samo_lego.simpleauth.utils.PlayerAuth;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
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.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
@ -30,8 +26,6 @@ import static org.samo_lego.simpleauth.SimpleAuth.config;
|
|||
@Mixin(PlayerManager.class)
|
||||
public abstract class MixinPlayerManager {
|
||||
|
||||
@Shadow @Final private MinecraftServer server;
|
||||
|
||||
@Inject(method = "onPlayerConnect(Lnet/minecraft/network/ClientConnection;Lnet/minecraft/server/network/ServerPlayerEntity;)V", at = @At("RETURN"))
|
||||
private void onPlayerConnect(ClientConnection clientConnection, ServerPlayerEntity serverPlayerEntity, CallbackInfo ci) {
|
||||
AuthEventHandler.onPlayerJoin(serverPlayerEntity);
|
||||
|
@ -55,22 +49,6 @@ public abstract class MixinPlayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
@ModifyVariable(
|
||||
method = "createStatHandler(Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/stat/ServerStatHandler;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/player/PlayerEntity;getName()Lnet/minecraft/text/Text;"
|
||||
),
|
||||
ordinal = 1
|
||||
)
|
||||
private File migrateOfflineStats(File file, PlayerEntity player) {
|
||||
if(config.main.premiumAutologin && !config.experimental.forceoOfflineUuids && ((PlayerAuth) player).isUsingMojangAccount()) {
|
||||
String playername = player.getGameProfile().getName();
|
||||
file = new File(file.getParent(), PlayerEntity.getOfflinePlayerUuid(playername) + ".json");
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "createStatHandler(Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/stat/ServerStatHandler;",
|
||||
at = @At(
|
||||
|
@ -82,6 +60,10 @@ public abstract class MixinPlayerManager {
|
|||
private void migrateOfflineStats(PlayerEntity player, CallbackInfoReturnable<ServerStatHandler> cir, UUID uUID, ServerStatHandler serverStatHandler, File serverStatsDir, File playerStatFile) {
|
||||
File onlineFile = new File(serverStatsDir, uUID + ".json");
|
||||
if(config.main.premiumAutologin && !config.experimental.forceoOfflineUuids && ((PlayerAuth) player).isUsingMojangAccount() && !onlineFile.exists()) {
|
||||
String playername = player.getGameProfile().getName();
|
||||
File offlineFile = new File(onlineFile.getParent(), PlayerEntity.getOfflinePlayerUuid(playername) + ".json");
|
||||
offlineFile.renameTo(onlineFile);
|
||||
|
||||
((ServerStatHandlerAccessor) serverStatHandler).setFile(onlineFile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ forge_version=36.0.4
|
|||
architectury_version=1.5.101
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.7.5
|
||||
mod_version = 1.7.7
|
||||
maven_group = org.samo_lego
|
||||
archives_base_name = simpleauth
|
||||
|
||||
|
|
Loading…
Reference in New Issue