Ender eye type

Discussion in 'Spigot Plugin Help' started by DenDennisCool, Jul 6, 2021.

  1. Is eye of ender not an entity? When I run this code, it prints ARROW and ENDER_PEARL and EGG in the chat when I use those items, but when I throw the eye of ender it doesn't show anything.

    Code (Java):

    @EventHandler
           public void throwPearl(ProjectileLaunchEvent e) {

            Bukkit.broadcastMessage(e.getEntityType().toString());


        }
     

    Something that did kind of work, but wasn't what I wanted: Using PlayerInteractEvent , it also displays the messsage Ender eye was thrown on left click which isn't what i want; I only want it when the eye is thrown.

    @EventHandler
    public void throwPearl(PlayerInteractEvent e) {


    if(e.getItem().toString().contains("ENDER_EYE")) {
    Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "locate stronghold");
    Bukkit.broadcastMessage("Ender eye was thrown");

    }
    [/code]
     
  2. NoTime

    NoTime Previously iTz_3ZoOz99

    Just "if(e.getItem().toString().contains("ENDER_EYE"))" ?

    Try more checks like the type of material or something else.
     
  3. That won't work.



    The ender eye entity type is:
    Code (Java):
    EntityType.ENDER_SIGNAL

    In the PlayerInteractEvent you can check the click type with:
    Code (Text):
    e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK
     
    • Like Like x 1
  4. Thanks for helping, but someone already helped me on another thread I made, if you are interested you can check it from my profile
     
    • Like Like x 1