mirror of
https://github.com/TeamMidnightDust/SelectiveAuth.git
synced 2025-12-17 07:45:08 +01:00
Just putting this out here, have fun
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package eu.midnightdust.selectiveauth;
|
||||
|
||||
import eu.midnightdust.selectiveauth.config.SelectiveAuthConfig;
|
||||
|
||||
public class SelectiveAuth {
|
||||
public static final String MOD_ID = "selectiveauth";
|
||||
|
||||
public static void init() {
|
||||
SelectiveAuthConfig.init(MOD_ID, SelectiveAuthConfig.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package eu.midnightdust.selectiveauth.config;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SelectiveAuthConfig extends MidnightConfig {
|
||||
@Entry public static List<String> authlessPlayers = Lists.newArrayList();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package eu.midnightdust.selectiveauth.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import eu.midnightdust.selectiveauth.config.SelectiveAuthConfig;
|
||||
import net.minecraft.server.network.ServerLoginNetworkHandler;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(ServerLoginNetworkHandler.class)
|
||||
public class MixinServerLoginNetworkHandler {
|
||||
@Shadow @Nullable String profileName;
|
||||
|
||||
@ModifyExpressionValue(
|
||||
method = "onHello",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;isOnlineMode()Z")
|
||||
)
|
||||
private boolean selectiveauth$skipAuthForSelectedPlayers(boolean isOnlineMode) {
|
||||
return isOnlineMode && !SelectiveAuthConfig.authlessPlayers.contains(this.profileName);
|
||||
}
|
||||
}
|
||||
BIN
common/src/main/resources/assets/selectiveauth/icon.png
Normal file
BIN
common/src/main/resources/assets/selectiveauth/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
12
common/src/main/resources/selectiveauth.mixins.json
Normal file
12
common/src/main/resources/selectiveauth.mixins.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "eu.midnightdust.selectiveauth.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"MixinServerLoginNetworkHandler"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user