Fixed dumb error in ProtectedPlayers.java getPlayer method. Fixed client crash when joining server and clicking/pressing keys.
This commit is contained in:
@ -7,6 +7,7 @@ import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
public class OnKeyPressEventHandler {
|
||||
@ -15,7 +16,9 @@ public class OnKeyPressEventHandler {
|
||||
public void KeyPressEvent(InputEvent.KeyInputEvent event) {
|
||||
ServerData server = Minecraft.getInstance().getCurrentServer();
|
||||
if (server == null) { return; }
|
||||
LoginProtection.INSTANCE.sendToServer(new C2SKeyPress());
|
||||
try {
|
||||
LoginProtection.INSTANCE.sendToServer(new C2SKeyPress());
|
||||
} catch (NullPointerException ignored) { }
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@ -23,6 +26,8 @@ public class OnKeyPressEventHandler {
|
||||
public void MouseClickEvent(InputEvent.ClickInputEvent event) {
|
||||
ServerData server = Minecraft.getInstance().getCurrentServer();
|
||||
if (server == null) { return; }
|
||||
LoginProtection.INSTANCE.sendToServer(new C2SKeyPress());
|
||||
try {
|
||||
LoginProtection.INSTANCE.sendToServer(new C2SKeyPress());
|
||||
} catch (NullPointerException ignored) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user