Changed grace period time from 200 to 400 (5s to 10s). Added function to ProtectedPlayers.java to remove a player from the list, updated the updateGracePeriods method. Updated C2SKeyPress.java. Made OnKeyPressEventHandler.java check for mouse clicks as well, also made sure it only fires on client-side. Added an event for when a player leaves the server to remove them from the list.

This commit is contained in:
micle
2021-06-03 19:58:21 +01:00
parent 2688402c40
commit 6c30641919
9 changed files with 84 additions and 24 deletions

View File

@ -3,8 +3,11 @@ package com.micle.loginprotection;
import com.micle.loginprotection.data.ProtectedPlayer;
import com.micle.loginprotection.data.ProtectedPlayers;
import com.micle.loginprotection.setup.Registration;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;
import java.util.ArrayList;
import java.util.List;
@ -15,6 +18,14 @@ public class LoginProtection {
public static ProtectedPlayers protected_players = new ProtectedPlayers();
public static boolean has_pressed_key = false;
private static final String PROTOCOL_VERSION = "1";
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
new ResourceLocation(LoginProtection.MOD_ID, "main"),
() -> PROTOCOL_VERSION,
PROTOCOL_VERSION::equals,
PROTOCOL_VERSION::equals
);
public LoginProtection() {
Registration.register();