Skip to content

Commit 93c733d

Browse files
fix MC-171420
1 parent 9bbc40b commit 93c733d

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

PATCHED.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
| Basic | [MC-159283](https://bugs.mojang.com/browse/MC-159283) | The End terrain does not generate in multiple rings centered around the world center |
8686
| Basic | [MC-160095](https://bugs.mojang.com/browse/MC-160095) | End Rods only break Cactus when moved by pistons |
8787
| Basic | [MC-170462](https://bugs.mojang.com/browse/MC-170462) | Bad Omen is considered a positive effect in potion item tooltips |
88+
| Basic | [MC-171420](https://bugs.mojang.com/browse/MC-171420) | OP players get kicked for not being on the whitelist (enforce = on) |
8889
| Basic | [MC-176806](https://bugs.mojang.com/browse/MC-176806) | Scoreboard criteria for using glowstone doesn't increase score when charging a respawn anchor |
8990
| Basic | [MC-177381](https://bugs.mojang.com/browse/MC-177381) | Game does not count the distance properly if you locate a structure from more than 46340 blocks away |
9091
| Basic | [MC-179072](https://bugs.mojang.com/browse/MC-179072) | Creepers do not defuse when switching from Survival to Creative/Spectator |
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package dev.isxander.debugify.mixins.basic.mc171420;
2+
3+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
4+
import com.llamalad7.mixinextras.sugar.Local;
5+
import dev.isxander.debugify.fixes.BugFix;
6+
import dev.isxander.debugify.fixes.FixCategory;
7+
import net.minecraft.server.MinecraftServer;
8+
import net.minecraft.server.level.ServerPlayer;
9+
import net.minecraft.server.players.PlayerList;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.Shadow;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
14+
@BugFix(id = "MC-171420", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "OP players get kicked for not being on the whitelist (enforce = on)")
15+
@Mixin(MinecraftServer.class)
16+
public abstract class MinecraftServerMixin {
17+
@Shadow
18+
public abstract PlayerList getPlayerList();
19+
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());
27+
}
28+
}

src/main/resources/debugify.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"basic.mc160095.CactusBlockMixin",
3232
"basic.mc168573.BlocksAttacksMixin",
3333
"basic.mc170462.MobEffectsMixin",
34+
"basic.mc171420.MinecraftServerMixin",
3435
"basic.mc176806.RespawnAnchorBlockMixin",
3536
"basic.mc17738.LocateCommandMixin",
3637
"basic.mc179072.SwellGoalMixin",

0 commit comments

Comments
 (0)