From 2d6911484ab9bf6fed2570fa372ef73c113767ed Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Sun, 19 Apr 2020 17:13:16 +0200 Subject: [PATCH] Build fixes, present in previous commit. --- .../simpleauth/event/AuthEventHandler.java | 18 +++++++++--------- .../simpleauth/mixin/MixinPlayerManager.java | 6 ------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java index 2225e95..ccd1a46 100644 --- a/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java +++ b/src/main/java/org/samo_lego/simpleauth/event/AuthEventHandler.java @@ -188,7 +188,7 @@ public class AuthEventHandler { // Getting the message to then be able to check it String msg = chatMessageC2SPacket.getChatMessage(); if( - !isAuthenticated(player) && + !isAuthenticated((ServerPlayerEntity) player) && !msg.startsWith("/login") && !msg.startsWith("/register") && (!config.experimental.allowChat || msg.startsWith("/")) @@ -201,7 +201,7 @@ public class AuthEventHandler { // Player movement public static ActionResult onPlayerMove(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowMovement) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowMovement) { return ActionResult.FAIL; } return ActionResult.PASS; @@ -209,7 +209,7 @@ public class AuthEventHandler { // Using a block (right-click function) public static ActionResult onUseBlock(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowBlockUse) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowBlockUse) { player.sendMessage(notAuthenticated(), false); return ActionResult.FAIL; } @@ -218,7 +218,7 @@ public class AuthEventHandler { // Punching a block public static ActionResult onAttackBlock(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowBlockPunch) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowBlockPunch) { player.sendMessage(notAuthenticated(), false); return ActionResult.FAIL; } @@ -227,7 +227,7 @@ public class AuthEventHandler { // Using an item public static TypedActionResult onUseItem(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowItemUse) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowItemUse) { player.sendMessage(notAuthenticated(), false); return TypedActionResult.fail(ItemStack.EMPTY); } @@ -236,7 +236,7 @@ public class AuthEventHandler { } // Dropping an item public static ActionResult onDropItem(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowItemDrop) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowItemDrop) { player.sendMessage(notAuthenticated(), false); return ActionResult.FAIL; } @@ -244,7 +244,7 @@ public class AuthEventHandler { } // Changing inventory (item moving etc.) public static ActionResult onTakeItem(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowItemMoving) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowItemMoving) { player.sendMessage(notAuthenticated(), false); return ActionResult.FAIL; } @@ -253,7 +253,7 @@ public class AuthEventHandler { } // Attacking an entity public static ActionResult onAttackEntity(PlayerEntity player) { - if(!isAuthenticated(player) && !config.experimental.allowEntityPunch) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.experimental.allowEntityPunch) { player.sendMessage(notAuthenticated(), false); return ActionResult.FAIL; } @@ -262,7 +262,7 @@ public class AuthEventHandler { } // Interacting with entity public static ActionResult onUseEntity(PlayerEntity player) { - if(!isAuthenticated(player) && !config.main.allowEntityInteract) { + if(!isAuthenticated((ServerPlayerEntity) player) && !config.main.allowEntityInteract) { player.sendMessage(notAuthenticated(), false); return ActionResult.FAIL; } diff --git a/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerManager.java b/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerManager.java index 8aca193..0a48656 100644 --- a/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerManager.java +++ b/src/main/java/org/samo_lego/simpleauth/mixin/MixinPlayerManager.java @@ -2,7 +2,6 @@ package org.samo_lego.simpleauth.mixin; import com.mojang.authlib.GameProfile; import net.minecraft.network.ClientConnection; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.PlayerManager; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.LiteralText; @@ -10,9 +9,7 @@ import net.minecraft.text.Text; import org.samo_lego.simpleauth.event.entity.player.PlayerJoinServerCallback; import org.samo_lego.simpleauth.event.entity.player.PlayerLeaveServerCallback; import org.samo_lego.simpleauth.event.entity.player.PrePlayerJoinCallback; -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.callback.CallbackInfo; @@ -23,9 +20,6 @@ import java.net.SocketAddress; @Mixin(PlayerManager.class) public abstract class MixinPlayerManager { - @Final @Shadow - 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) { PlayerJoinServerCallback.EVENT.invoker().onPlayerJoin(serverPlayerEntity);