Ported 1.17.1-2.1.1 to 1.18.1.

This commit is contained in:
2022-01-19 16:47:55 +00:00
parent 9c77ebc2cb
commit 6b6a029541
13 changed files with 525 additions and 88 deletions

View File

@ -0,0 +1,18 @@
package dev.micle.loginprotection.events;
import dev.micle.loginprotection.LoginProtection;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class OnPlayerDamageEventHandler {
@SubscribeEvent
public void LivingDamageEvent(LivingDamageEvent event) {
if (!(event.getEntity() instanceof Player)) { return; }
Player player = (Player) event.getEntity();
if (LoginProtection.protected_players.getPlayer(player.getUUID()) != null) {
event.setCanceled(true);
}
}
}