Villager Shops

Discussion in 'Plugin Development' started by King_Amun_Ra, Dec 30, 2013.

Thread Status:
Not open for further replies.
  1. Offline


    Making a plugin so I can right click a villager in a certain world and then it opens a inventory. Is there a way I can cancel the villager's's trade like the item trading also is there a way I can get the villager's name like if I name it with a name tag??

    Current Code:
    public class main extends JavaPlugin implements Listener {
            private Menu menu;
            public void onEnable() {
                    menu = new Menu(this);
                    Bukkit.getServer().getPluginManager().registerEvents(this, this);
            public void onPlayerInteract(PlayerInteractEntityEvent e) {
                if (!(e.getRightClicked().getType() == EntityType.VILLAGER)) return;
                if (!(e.getRightClicked().getLocation().getWorld().getName().equalsIgnoreCase("empty2"))) return;
    The menu is working fine so not putting that in.
  2. Offline


    I'm confused why you're using:

    Surely the inventory has a static name?
  3. Offline


    No I just made a custom inventory and showing the player it. I have more stuff in the menu.class but that's not what I need that works it's just when I rightclick a villager there default trade comes up I need to cancel that anyone know how??

    Can anyone help??

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 6, 2016
  4. Offline


  5. Offline


    garrison no on a villager trade is there a even for that?
  6. Offline


    Yes, but there is on the right click/interact event :)
  7. Offline


    If I use the right click event then cancle it then the plugin wouldn't run because its on a right click of a villgager. I just need to disable villager trades in a world or cancle the villagers trade for that signal villager
  8. Offline


    Oh didn't know you ment that, this should work:
  9. Offline


Thread Status:
Not open for further replies.

Share This Page