-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
src/main/java/io/github/rektroth/whiteout/mixin/mc145260/MinecraftServerMixin.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,34 @@ | ||
/* | ||
* Patch for MC-145260 | ||
* | ||
* Authored for CraftBukkit/Spigot by Aikar <[email protected]> on March 2, 2019. | ||
* Ported to Fabric by Rektroth <[email protected]> on October 13, 2024. | ||
*/ | ||
|
||
package io.github.rektroth.whiteout.mixin.mc145260; | ||
|
||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.server.PlayerManager; | ||
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.CallbackInfoReturnable; | ||
|
||
@Mixin(MinecraftServer.class) | ||
public abstract class MinecraftServerMixin { | ||
@Shadow | ||
private boolean enforceWhitelist; | ||
|
||
@Shadow | ||
private PlayerManager playerManager; | ||
|
||
/** | ||
* Modifies the target method to return {@code true} only if the whitelist is also enabled. | ||
* @param cir The return callback. | ||
*/ | ||
@Inject(at = @At("RETURN"), cancellable = true, method = "isEnforceWhitelist") | ||
private void isEnforceWhitelistAndWhitelistEnabled(CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(this.enforceWhitelist && this.playerManager.isWhitelistEnabled()); | ||
} | ||
} |
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
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