Custom Entity instance

Discussion in 'Plugin Development' started by xStrixU, Aug 8, 2020.

  1. Offline

    xStrixU

    I have got problem with custom entity detection.

    Code:Java
    1.  
    2. @EventHandler
    3. public void onInteractCustomEntity(final PlayerInteractEntityEvent e) {
    4. Player player = e.getPlayer();
    5. Entity entity = e.getRightClicked();
    6.  
    7. if(entity instanceof Zombie) {
    8. EntityZombie zombie = ((CraftZombie) entity).getHandle();
    9.  
    10. if(zombie instanceof CustomZombie) {
    11. player.sendMessage("You clicked custom zombie!");
    12. }
    13. }
    14. }
    15.  


    If i click custom zombie without reload server, all works fine, but after reload server it doesn't work. If i stopped and started server all works fine again. What to do so that after reload the server it still detects custom entity?
     
    Last edited: Aug 8, 2020

Share This Page