Skip to content

Commit 7c5d21a

Browse files
simplify to not have to deal with any stupid logic (i hate de morgan)
1 parent 93c733d commit 7c5d21a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package dev.isxander.debugify.mixins.basic.mc171420;
22

3-
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
3+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
44
import com.llamalad7.mixinextras.sugar.Local;
55
import dev.isxander.debugify.fixes.BugFix;
66
import dev.isxander.debugify.fixes.FixCategory;
7+
import net.minecraft.network.chat.Component;
78
import net.minecraft.server.MinecraftServer;
89
import net.minecraft.server.level.ServerPlayer;
10+
import net.minecraft.server.network.ServerGamePacketListenerImpl;
911
import net.minecraft.server.players.PlayerList;
1012
import org.spongepowered.asm.mixin.Mixin;
1113
import 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

Comments
 (0)