diff --git a/build.gradle b/build.gradle index 2885a0e..977a494 100755 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = '1.16.5-2.1.0' +version = '1.16.5-2.1.1' group = 'com.micle.loginprotection' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'LoginProtection-Forge' diff --git a/src/main/java/com/micle/loginprotection/events/OnKeyPressEventHandler.java b/src/main/java/com/micle/loginprotection/events/OnKeyPressEventHandler.java index 6104af7..cee48fd 100755 --- a/src/main/java/com/micle/loginprotection/events/OnKeyPressEventHandler.java +++ b/src/main/java/com/micle/loginprotection/events/OnKeyPressEventHandler.java @@ -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.server.integrated.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; } diff --git a/src/main/java/com/micle/loginprotection/events/OnPlayerJoinEventHandler.java b/src/main/java/com/micle/loginprotection/events/OnPlayerJoinEventHandler.java index 8a6a700..fa343bc 100755 --- a/src/main/java/com/micle/loginprotection/events/OnPlayerJoinEventHandler.java +++ b/src/main/java/com/micle/loginprotection/events/OnPlayerJoinEventHandler.java @@ -2,14 +2,11 @@ package com.micle.loginprotection.events; import com.micle.loginprotection.LoginProtection; import net.minecraft.entity.player.PlayerEntity; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class OnPlayerJoinEventHandler { @SubscribeEvent - @OnlyIn(Dist.DEDICATED_SERVER) public void EntityJoinWorldEvent(PlayerEvent.PlayerLoggedInEvent event) { if (!(event.getEntity() instanceof PlayerEntity)) { return; } PlayerEntity player = (PlayerEntity) event.getEntity(); diff --git a/src/main/java/com/micle/loginprotection/events/OnPlayerLeaveEventHandler.java b/src/main/java/com/micle/loginprotection/events/OnPlayerLeaveEventHandler.java index 61b67a6..15cda64 100755 --- a/src/main/java/com/micle/loginprotection/events/OnPlayerLeaveEventHandler.java +++ b/src/main/java/com/micle/loginprotection/events/OnPlayerLeaveEventHandler.java @@ -2,14 +2,11 @@ package com.micle.loginprotection.events; import com.micle.loginprotection.LoginProtection; import net.minecraft.entity.player.PlayerEntity; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class OnPlayerLeaveEventHandler { @SubscribeEvent - @OnlyIn(Dist.DEDICATED_SERVER) public void PlayerLeaveEvent(PlayerEvent.PlayerLoggedOutEvent event) { if (!(event.getEntity() instanceof PlayerEntity)) { return; } PlayerEntity player = event.getPlayer(); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index aa2bc6e..f3b44a6 100755 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="loginprotection" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="2.1.0" #mandatory +version="2.1.1" #mandatory # A display name for the mod displayName="Micle's Login Protection" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/