Ported 1.17.1-2.1.1 to 1.18.1.
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user