OnClientInputEventHandler:

- Added check for dedicated server before cancelling the event.
- Removed old todo comment.
This commit is contained in:
Micle
2022-10-25 17:17:00 +01:00
parent 23d724fa37
commit 2bdaa544f6

View File

@ -1,6 +1,5 @@
package dev.micle.loginprotection.events.client;
import dev.micle.loginprotection.LoginProtection;
import dev.micle.loginprotection.data.ProtectedPlayer;
import dev.micle.loginprotection.network.NetworkManager;
import dev.micle.loginprotection.network.client.InputPacket;
@ -75,7 +74,8 @@ public class OnClientInputEventHandler {
Minecraft minecraft = Minecraft.getInstance();
// Cancel event if not in a game
if (LoginProtection.getProxy().getServer() == null || Proxy.Client.getPlayerState() == null) {
if ((minecraft.getCurrentServer() == null && minecraft.getSingleplayerServer() == null) ||
Proxy.Client.getPlayerState() == null) {
return;
}
@ -157,7 +157,6 @@ public class OnClientInputEventHandler {
}
} else if (key == GLFW.GLFW_KEY_ENTER) {
isChatEnterPressed = isPressed;
// Todo: possibly set isChatPressed and isChatCommandPressed here
if (!checkIfScreenIsAllowed(allowedKeys, minecraft.screen, !isPressed) &&
!allowedKeys.contains(Config.Server.KEYS.CHAT.toString())) {
updateAndNotify();