11package dev .isxander .debugify .mixins .basic .mc171420 ;
22
3- import com .llamalad7 .mixinextras .injector .ModifyExpressionValue ;
3+ import com .llamalad7 .mixinextras .injector .v2 . WrapWithCondition ;
44import com .llamalad7 .mixinextras .sugar .Local ;
55import dev .isxander .debugify .fixes .BugFix ;
66import dev .isxander .debugify .fixes .FixCategory ;
7+ import net .minecraft .network .chat .Component ;
78import net .minecraft .server .MinecraftServer ;
89import net .minecraft .server .level .ServerPlayer ;
10+ import net .minecraft .server .network .ServerGamePacketListenerImpl ;
911import net .minecraft .server .players .PlayerList ;
1012import org .spongepowered .asm .mixin .Mixin ;
1113import org .spongepowered .asm .mixin .Shadow ;
@@ -17,12 +19,8 @@ public abstract class MinecraftServerMixin {
1719 @ Shadow
1820 public abstract PlayerList getPlayerList ();
1921
20- /**
21- * The goal is to replace the !isWhiteListed with !isWhiteListed && !isOp
22- * The original isWhiteListed call is negated, so we need to negate our mixin logic here
23- */
24- @ ModifyExpressionValue (method = "kickUnlistedPlayers" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/server/players/UserWhiteList;isWhiteListed(Lcom/mojang/authlib/GameProfile;)Z" ))
25- private boolean isOpCheck (boolean original , @ Local ServerPlayer serverPlayer ) {
26- return original || this .getPlayerList ().isOp (serverPlayer .getGameProfile ());
22+ @ WrapWithCondition (method = "kickUnlistedPlayers" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;disconnect(Lnet/minecraft/network/chat/Component;)V" ))
23+ private boolean isOpCheck (ServerGamePacketListenerImpl instance , Component component , @ Local ServerPlayer serverPlayer ) {
24+ return !this .getPlayerList ().isOp (serverPlayer .getGameProfile ());
2725 }
2826}
0 commit comments