Villager citizen api

Discussion in 'Plugin Development' started by LavenousChaos, Oct 24, 2015.

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

    LavenousChaos

    How can I make npcs talk when they get right-clicked using the Citizen API ?
    I'm trying to make npcs talk when they get right-click.
     
    Last edited: Oct 24, 2015
  2. Offline

    Reynergodoy

    Code:
    @EventHandler
      public void onPlayerRightClick(PlayerInteractEntityEvent e) {
      if(e.getRightClicked() instanceof Villager){
          Entity mob = e.getRightClicked();
          Player p = e.getPlayer();
          if(mob.getCustomName()==null){
          return;
          }
          if ((mob.getCustomName().equalsIgnoreCase("My name is John"))) {
              p.sendMessage("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA@@@@@@@@@");
              e.setCancelled(true);
         }
         }
      }
     
  3. Offline

    WPM

    This is just using the Bukkit/Spigot API, he wants to use the Citizens API :p
     
  4. Offline

    Reynergodoy

    But Citizens API does not extends bukkit?
    '-'
    Just change the My name is John to the name of the citizen '-'
     
Thread Status:
Not open for further replies.

Share This Page