mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Trial portals
This commit is contained in:
parent
edc36c76c8
commit
92121c11e2
@ -26,6 +26,7 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
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.PlayerLeashEntityEvent;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
@ -270,6 +271,17 @@ public class EventListen implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityPortal(EntityPortalEvent event) {
|
||||
NPC npc = npcRegistry.getNPC(event.getEntity());
|
||||
if (npc == null && event.getEntityType() != EntityType.PLAYER)
|
||||
return;
|
||||
event.setCancelled(true);
|
||||
npc.despawn(DespawnReason.PENDING_RESPAWN);
|
||||
event.getTo().getChunk();
|
||||
npc.spawn(event.getTo(), SpawnReason.RESPAWN);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntitySpawn(CreatureSpawnEvent event) {
|
||||
if (event.isCancelled() && npcRegistry.isNPC(event.getEntity())) {
|
||||
|
Loading…
Reference in New Issue
Block a user