Fixed grace period updating when it shouldn't. Fixed singleplayer making player invulnerable.
This commit is contained in:
@ -44,6 +44,8 @@ public class ProtectedPlayers {
|
|||||||
|
|
||||||
public void updateGracePeriod(UUID player_uuid) {
|
public void updateGracePeriod(UUID player_uuid) {
|
||||||
ProtectedPlayer protected_player = getPlayer(player_uuid);
|
ProtectedPlayer protected_player = getPlayer(player_uuid);
|
||||||
|
if (protected_player.isLoading()) { return; }
|
||||||
|
|
||||||
int grace_period = protected_player.getGracePeriod()-1;
|
int grace_period = protected_player.getGracePeriod()-1;
|
||||||
protected_player.setGracePeriod(grace_period);
|
protected_player.setGracePeriod(grace_period);
|
||||||
if (grace_period <= 0) {
|
if (grace_period <= 0) {
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
package com.micle.loginprotection.events;
|
package com.micle.loginprotection.events;
|
||||||
|
|
||||||
import com.micle.loginprotection.LoginProtection;
|
import com.micle.loginprotection.LoginProtection;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
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.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class OnPlayerJoinEventHandler {
|
public class OnPlayerJoinEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@OnlyIn(Dist.DEDICATED_SERVER)
|
||||||
public void EntityJoinWorldEvent(PlayerEvent.PlayerLoggedInEvent event) {
|
public void EntityJoinWorldEvent(PlayerEvent.PlayerLoggedInEvent event) {
|
||||||
if (!(event.getEntity() instanceof PlayerEntity)) { return; }
|
if (!(event.getEntity() instanceof PlayerEntity)) { return; }
|
||||||
PlayerEntity player = (PlayerEntity) event.getEntity();
|
PlayerEntity player = (PlayerEntity) event.getEntity();
|
||||||
|
|||||||
Reference in New Issue
Block a user