コード例 #1
0
 public void call(Player p, String[] args) {
   List<NPCStatistic> npcs =
       Managers.getStatisticManager().getAllStatistics(p.getName(), NPCStatistic.class);
   for (NPCStatistic n : npcs) {
     NPC npc = CitizensAPI.getNPCRegistry().getById(n.getNpcid());
     if (npc == null) continue;
     if (MQAddonCitizens.descriptionManager.activeNPCs.contains(npc.getId())) {
       Frontend.openFrontend(p, npc);
       return;
     }
   }
   p.sendMessage("No such contact!");
 }
コード例 #2
0
 @Override
 public void noOptionSpecified(CommandSender p, String[] args) {
   List<String> tosend = new ArrayList<String>();
   tosend.add(ChatUtils.formatHeader("Active Contacts"));
   List<NPCStatistic> npcs =
       Managers.getStatisticManager().getAllStatistics(p.getName(), NPCStatistic.class);
   for (NPCStatistic n : npcs) {
     NPC npc = CitizensAPI.getNPCRegistry().getById(n.getNpcid());
     if (npc == null) continue;
     tosend.add(
         formatNPC(npc.getName(), npc.getBukkitEntity().getLocation().getWorld().getName()));
   }
   tosend.add(ChatUtils.formatHeader("To call a contact, use /contacts call <name>"));
   for (String s : tosend) {
     p.sendMessage(s);
   }
 }