Updated to version 2.1.1. Fixed issue where the mod didn't work in single-player and LAN.
This commit is contained in:
@ -5,6 +5,7 @@ import com.micle.loginprotection.network.C2SKeyPress;
|
||||
import com.micle.loginprotection.setup.Config;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.server.IntegratedServer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
@ -16,8 +17,9 @@ public class OnKeyPressEventHandler {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void KeyPressEvent(InputEvent.KeyInputEvent event) {
|
||||
Minecraft instance = Minecraft.getInstance();
|
||||
ServerData server = instance.getCurrentServer();
|
||||
if (server == null) { return; }
|
||||
ServerData server_online = instance.getCurrentServer();
|
||||
IntegratedServer server_local = instance.getSingleplayerServer();
|
||||
if (server_online == null && server_local == null) { return; }
|
||||
if (Minecraft.getInstance().screen != null) { return; }
|
||||
if (checkKeyAllowed(instance, event.getKey())) { return; }
|
||||
|
||||
@ -30,8 +32,9 @@ public class OnKeyPressEventHandler {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void MouseClickEvent(InputEvent.ClickInputEvent event) {
|
||||
Minecraft instance = Minecraft.getInstance();
|
||||
ServerData server = instance.getCurrentServer();
|
||||
if (server == null) { return; }
|
||||
ServerData server_online = instance.getCurrentServer();
|
||||
IntegratedServer server_local = instance.getSingleplayerServer();
|
||||
if (server_online == null && server_local == null) { return; }
|
||||
if (Minecraft.getInstance().screen != null) { return; }
|
||||
if (checkKeyAllowed(instance, event.getKeyBinding().getKey().getValue())) { return; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user