parent
af1c51bf73
commit
5aa82f0db0
|
@ -6,8 +6,6 @@ import net.fabricmc.fabric.api.event.server.ServerStopCallback;
|
||||||
import net.fabricmc.fabric.api.registry.CommandRegistry;
|
import net.fabricmc.fabric.api.registry.CommandRegistry;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
|
||||||
import net.minecraft.inventory.Inventory;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
@ -25,7 +23,6 @@ import org.samo_lego.simpleauth.utils.AuthConfig;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
@ -34,7 +31,7 @@ public class SimpleAuth implements DedicatedServerModInitializer {
|
||||||
|
|
||||||
public static SimpleAuthDatabase db = new SimpleAuthDatabase();
|
public static SimpleAuthDatabase db = new SimpleAuthDatabase();
|
||||||
|
|
||||||
// HashSet of players that are not authenticated
|
// HashMap of players that are not authenticated
|
||||||
// Rather than storing all the authenticated players, we just store ones that are not authenticated
|
// Rather than storing all the authenticated players, we just store ones that are not authenticated
|
||||||
public static HashMap<PlayerEntity, Integer> deauthenticatedUsers = new HashMap<>();
|
public static HashMap<PlayerEntity, Integer> deauthenticatedUsers = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ public class LoginCommand {
|
||||||
// Method called for checking the password
|
// Method called for checking the password
|
||||||
private static int login(ServerCommandSource source, String pass) throws CommandSyntaxException {
|
private static int login(ServerCommandSource source, String pass) throws CommandSyntaxException {
|
||||||
// Getting the player who send the command
|
// Getting the player who send the command
|
||||||
System.out.println(maxLoginTries);
|
|
||||||
ServerPlayerEntity player = source.getPlayer();
|
ServerPlayerEntity player = source.getPlayer();
|
||||||
|
|
||||||
if(SimpleAuth.isAuthenticated(player)) {
|
if(SimpleAuth.isAuthenticated(player)) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ public abstract class MixinPlayerEntity {
|
||||||
new ScreenHandlerSlotUpdateS2CPacket(
|
new ScreenHandlerSlotUpdateS2CPacket(
|
||||||
-2,
|
-2,
|
||||||
player.inventory.selectedSlot,
|
player.inventory.selectedSlot,
|
||||||
player.inventory.getInvStack(player.inventory.selectedSlot))
|
player.inventory.getStack(player.inventory.selectedSlot))
|
||||||
);
|
);
|
||||||
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack()));
|
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack()));
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
|
|
|
@ -25,7 +25,7 @@ public abstract class MixinSlot {
|
||||||
new ScreenHandlerSlotUpdateS2CPacket(
|
new ScreenHandlerSlotUpdateS2CPacket(
|
||||||
-2,
|
-2,
|
||||||
player.inventory.selectedSlot,
|
player.inventory.selectedSlot,
|
||||||
player.inventory.getInvStack(player.inventory.selectedSlot))
|
player.inventory.getStack(player.inventory.selectedSlot))
|
||||||
);
|
);
|
||||||
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack()));
|
player.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(-1, -1, player.inventory.getCursorStack()));
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
|
|
|
@ -74,8 +74,8 @@ public class AuthConfig {
|
||||||
public String loginRequired = "§cYou are not authenticated!\n§6Use /login to authenticate!";
|
public String loginRequired = "§cYou are not authenticated!\n§6Use /login to authenticate!";
|
||||||
public String loginTriesExceeded = "§4Too many login tries.";
|
public String loginTriesExceeded = "§4Too many login tries.";
|
||||||
public String globalPasswordSet = "§aGlobal password was successfully set!";
|
public String globalPasswordSet = "§aGlobal password was successfully set!";
|
||||||
public String cannotChangePassword = "§aYou cannot change password!";
|
public String cannotChangePassword = "§cYou cannot change password!";
|
||||||
public String cannotUnregister = "§aYou cannot unregister this account!";
|
public String cannotUnregister = "§cYou cannot unregister this account!";
|
||||||
public String notAuthenticated = "§cYou are not authenticated!\n§6Try with /login or /register.";
|
public String notAuthenticated = "§cYou are not authenticated!\n§6Try with /login or /register.";
|
||||||
public String alreadyAuthenticated = "§6You are already authenticated.";
|
public String alreadyAuthenticated = "§6You are already authenticated.";
|
||||||
public String successfullyAuthenticated = "§aYou are now authenticated.";
|
public String successfullyAuthenticated = "§aYou are now authenticated.";
|
||||||
|
|
Loading…
Reference in New Issue