mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 10:37:35 +01:00
Fix NPCs being pullable
This commit is contained in:
parent
94648aa53e
commit
1d45fe1d3e
@ -27,6 +27,7 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -262,6 +263,12 @@ public class EventListen implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled=true)
|
||||
public void onPlayerFish(PlayerFishEvent event) {
|
||||
if (npcRegistry.isNPC(event.getCaught()) && npcRegistry.getNPC(event.getCaught()).isProtected()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntitySpawn(CreatureSpawnEvent event) {
|
||||
if (event.isCancelled() && npcRegistry.isNPC(event.getEntity())) {
|
||||
|
@ -622,7 +622,7 @@ public class NMS {
|
||||
NPC npc = npcRegistry.getNPC(hook.hooked.getBukkitEntity());
|
||||
if (npc == null)
|
||||
return;
|
||||
if (npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true)) {
|
||||
if (npc.isProtected()) {
|
||||
hook.hooked = null;
|
||||
hook.die();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user