Updated to version 2.1.1. Fixed issue where the mod didn't work in single-player and LAN.
This commit is contained in:
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.17.1-2.1.0'
|
||||
version = '1.17.1-2.1.1'
|
||||
group = 'com.micle.loginprotection' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'LoginProtection-Forge'
|
||||
|
||||
|
||||
@ -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; }
|
||||
|
||||
|
||||
@ -2,14 +2,11 @@ package com.micle.loginprotection.events;
|
||||
|
||||
import com.micle.loginprotection.LoginProtection;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
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 Player)) { return; }
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
@ -2,14 +2,11 @@ package com.micle.loginprotection.events;
|
||||
|
||||
import com.micle.loginprotection.LoginProtection;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
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 Player)) { return; }
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@ -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/
|
||||
|
||||
Reference in New Issue
Block a user