Compare commits
5 Commits
1.8.4
...
architectu
Author | SHA1 | Date |
---|---|---|
Agatha Lovelace | 7ea63ce851 | |
charlotte ✨ | c79e43c318 | |
charlotte ✨ | 50745d7923 | |
Agatha Lovelace | ddfbf4593d | |
Agatha Lovelace | 08f7f3e50e |
|
@ -10,7 +10,7 @@ buildscript {
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "0.11.0-SNAPSHOT" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
|
|
|
@ -161,7 +161,9 @@ public class MixinServerPlayerEntity implements PlayerAuth {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canSkipAuth() {
|
public boolean canSkipAuth() {
|
||||||
return PlatformSpecific.isPlayerFake(this.player) || (isUsingMojangAccount() && config.main.premiumAutologin);
|
return PlatformSpecific.isPlayerFake(this.player) ||
|
||||||
|
this.player.server.isSingleplayer() ||
|
||||||
|
(isUsingMojangAccount() && config.main.premiumAutologin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@ public abstract class MixinSlot {
|
||||||
// Denying item moving etc.
|
// Denying item moving etc.
|
||||||
@Inject(method = "canTakeItems(Lnet/minecraft/entity/player/PlayerEntity;)Z", at = @At(value = "HEAD"), cancellable = true)
|
@Inject(method = "canTakeItems(Lnet/minecraft/entity/player/PlayerEntity;)Z", at = @At(value = "HEAD"), cancellable = true)
|
||||||
private void canTakeItems(PlayerEntity playerEntity, CallbackInfoReturnable<Boolean> cir) {
|
private void canTakeItems(PlayerEntity playerEntity, CallbackInfoReturnable<Boolean> cir) {
|
||||||
ServerPlayerEntity player = (ServerPlayerEntity) playerEntity;
|
if (playerEntity instanceof ServerPlayerEntity player) {
|
||||||
ActionResult result = AuthEventHandler.onTakeItem(player);
|
ActionResult result = AuthEventHandler.onTakeItem(player);
|
||||||
|
|
||||||
if (result == ActionResult.FAIL) {
|
if (result == ActionResult.FAIL) {
|
||||||
|
@ -31,4 +31,5 @@ public abstract class MixinSlot {
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.world.WorldSaveHandler;
|
import net.minecraft.world.WorldSaveHandler;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
|
@ -54,7 +54,7 @@ public interface PlayerAuth {
|
||||||
/**
|
/**
|
||||||
* Checks whether player is a fake player (from CarpetMod).
|
* Checks whether player is a fake player (from CarpetMod).
|
||||||
*
|
*
|
||||||
* @return true if player is fake (can skip authentication process), otherwise false
|
* @return true if player is fake or in singleplayer (can skip authentication process), otherwise false
|
||||||
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
|
* @see <a href="https://samolego.github.io/SimpleAuth/org/samo_lego/simpleauth/mixin/MixinPlayerEntity.html">See implementation</a>
|
||||||
*/
|
*/
|
||||||
boolean canSkipAuth();
|
boolean canSkipAuth();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -40,7 +40,7 @@ dependencies {
|
||||||
// from masa's maven
|
// from masa's maven
|
||||||
//modImplementation "carpet:fabric-carpet:${project.minecraft_version}-${project.carpet_core_version}"
|
//modImplementation "carpet:fabric-carpet:${project.minecraft_version}-${project.carpet_core_version}"
|
||||||
// jitpack for quicker updating
|
// jitpack for quicker updating
|
||||||
modImplementation "carpet:fabric-carpet:1.18-${project.carpet_core_version}"
|
modImplementation "carpet:fabric-carpet:1.18.2-${project.carpet_core_version}"
|
||||||
|
|
||||||
// Password hashing
|
// Password hashing
|
||||||
// Argon2
|
// Argon2
|
||||||
|
|
|
@ -2,9 +2,11 @@ package org.samo_lego.simpleauth;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.event.server.ServerStoppedEvent;
|
import net.minecraftforge.event.server.ServerStoppedEvent;
|
||||||
import net.minecraftforge.fml.loading.FMLPaths;
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
|
@ -15,7 +17,7 @@ import org.samo_lego.simpleauth.commands.*;
|
||||||
public class SimpleAuthForge {
|
public class SimpleAuthForge {
|
||||||
public SimpleAuthForge() {
|
public SimpleAuthForge() {
|
||||||
SimpleAuth.init(FMLPaths.GAMEDIR.get());
|
SimpleAuth.init(FMLPaths.GAMEDIR.get());
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
DistExecutor.safeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> MinecraftForge.EVENT_BUS.register(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.samo_lego.simpleauth.event;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
|
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
@ -15,7 +16,7 @@ import static org.samo_lego.simpleauth.SimpleAuth.MOD_ID;
|
||||||
* This class will take care of actions players try to do,
|
* This class will take care of actions players try to do,
|
||||||
* and cancel them if they aren't authenticated
|
* and cancel them if they aren't authenticated
|
||||||
*/
|
*/
|
||||||
@Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
|
@Mod.EventBusSubscriber(value = Dist.DEDICATED_SERVER, modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
|
||||||
public class AuthEventHandlerForge {
|
public class AuthEventHandlerForge {
|
||||||
@SubscribeEvent(priority = HIGHEST)
|
@SubscribeEvent(priority = HIGHEST)
|
||||||
public static void onContainerOpen(PlayerContainerEvent.Open event) {
|
public static void onContainerOpen(PlayerContainerEvent.Open event) {
|
||||||
|
|
|
@ -2,21 +2,21 @@
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
|
||||||
# Fabric properties
|
# Fabric properties
|
||||||
minecraft_version=1.18.1
|
minecraft_version=1.18.2
|
||||||
yarn_mappings=1.18.1+build.2
|
yarn_mappings=1.18.2+build.2
|
||||||
loader_version=0.12.11
|
loader_version=0.13.3
|
||||||
|
|
||||||
#Fabric api
|
#Fabric api
|
||||||
fabric_version=0.44.0+1.18
|
fabric_version=0.48.0+1.18.2
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
forge_version=39.0.8
|
forge_version=40.0.41
|
||||||
|
|
||||||
# Architectury
|
# Architectury
|
||||||
architectury_version=3.2.57
|
architectury_version=4.1.39
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.8.4-agatha
|
mod_version = 1.8.5-agatha
|
||||||
maven_group = org.samo_lego
|
maven_group = org.samo_lego
|
||||||
archives_base_name = simpleauth
|
archives_base_name = simpleauth
|
||||||
|
|
||||||
|
@ -27,5 +27,7 @@ bytes_version = 1.3.0
|
||||||
|
|
||||||
|
|
||||||
# Carpet for debugging
|
# Carpet for debugging
|
||||||
carpet_core_version = 1.4.56+v211130
|
carpet_core_version = 1.4.69+v220331
|
||||||
carpet_branch = master
|
carpet_branch = master
|
||||||
|
|
||||||
|
org.gradle.jvmargs=-Xmx4G
|
Loading…
Reference in New Issue