Issues with entities...

Discussion in 'Spigot Plugin Development' started by ZalewSki, Jun 8, 2016.

  1. Hi everybody!

    I've make a plugin lobby with a friend, but we meet a problem with all entities... ItemFrame, Villager, Players, ...

    The problem is that we can ride all entities like that:
    - http://prntscr.com/be0z05
    - http://prntscr.com/be18v8 (as you can see, it's as if we were on a horse...)

    I can give you others informations but i don't what give you.
    Hoping that a well-meaning soul comes to our help! :D

    Good night/day! :p

    ZalewSki.
     
    #1 ZalewSki, Jun 8, 2016
    Last edited: Jun 8, 2016
  2. What is your intent with this plugin? If you don't want a player to mount a certain entity then you need to check for entity type.
     
  3. Why are you having this issue in the first place? Is it your plugin or another? Simple fix if it's yours.
     
  4. Thank's for your answer.

    In fact i've a system to mount mobs on my lobby plugin, but I've disable it and I've the same issue...

    I've already check with the PlayerInteractEntity but.. doesn't work...
     
  5. Saying "it doesn't work" will not help us answer your question. Show us your code please
     
  6. In fact, I don't know.. It's my plugin yes, because if it's disabled, it work well
     
    #6 ZalewSki, Jun 8, 2016
    Last edited: Jun 8, 2016
  7. Sorry, I'm not used to post on forum :/
    Here is the current PlayerInteractEntity

    Code (Text):
    package fr.standblock.hub.listeners;

    import org.bukkit.entity.EntityType;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEntityEvent;

    import fr.standblock.hub.partymob.CustomInv;

    public class PlayerInteractEntity implements Listener {
       
        // Interaction entitées (itemframe...)
        @EventHandler
        public void onInteractEntity(PlayerInteractEntityEvent event) {
            event.setCancelled(true);
           
            if (event.getRightClicked().getType() != EntityType.VILLAGER) return;
           
            // Mauvaise entitée
            if (event.getRightClicked().getUniqueId() == null) return;
           
            // Right click sur les NPC
            try {
                for (CustomInv villager : CustomInv.inventories.values()) {
                    if (villager.entity == null || villager.getUniqueId() == null) continue;
                   
                    if (villager.isClick && villager.getUniqueId().equals(event.getRightClicked().getUniqueId())) {
                        villager.onPNJClick(event.getPlayer());
                        return;
                    }
                   
                    if (villager.getUniqueId().equals(event.getRightClicked().getUniqueId())) {
                        villager.rightClick(event.getPlayer());
                        return;
                    }
                }
            } catch (Exception error) {
                error.printStackTrace();
            }
        }
       
    }
     
  8. Try outputting the current entity to console to see what it is. Not sure why that isn't working for you right now :/
     
  9. If I click on PNJ, it say « Entity.VILLAGER », but if I click on itemframe and player, it say nothing
     
  10. I gonna try to revert with old version and I said if it's work