mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Block entity transformations if protected
This commit is contained in:
parent
eed8457b6d
commit
b6563dba8d
@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityPortalEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTransformEvent;
|
||||
import org.bukkit.event.entity.PlayerLeashEntityEvent;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
@ -361,6 +362,16 @@ public class EventListen implements Listener {
|
||||
Bukkit.getPluginManager().callEvent(new EntityTargetNPCEvent(event, npc));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityTransform(EntityTransformEvent event) {
|
||||
NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
|
||||
if (npc == null)
|
||||
return;
|
||||
if (npc.isProtected()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMetaDeserialise(CitizensDeserialiseMetaEvent event) {
|
||||
if (event.getKey().keyExists("skull")) {
|
||||
|
Loading…
Reference in New Issue
Block a user