-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix whitelist check not being executed
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
common/src/main/java/dev/erdragh/astralbot/mixins/DedicatedPlayerListMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dev.erdragh.astralbot.mixins; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import dev.erdragh.astralbot.handlers.WhitelistHandler; | ||
import net.minecraft.server.dedicated.DedicatedPlayerList; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(DedicatedPlayerList.class) | ||
public class DedicatedPlayerListMixin { @Inject(method = "isWhiteListed", at = @At("RETURN"), cancellable = true) | ||
void astralbot$isWhiteListed(GameProfile profile, CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(Boolean.TRUE.equals(cir.getReturnValue()) || WhitelistHandler.INSTANCE.checkWhitelist(profile.getId()) != null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters