Guest User

Untitled

a guest
Jul 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. //This is in the plugin with the API
  2.  
  3.         public Object run(Object[] os) {
  4.             String mode = (String)os[0];
  5.             if (mode.equalsIgnoreCase("GET_NAME")) {
  6.                 String id = (String)os[1]; 
  7.                 npc npc1 = npc.getNPC(id);
  8.                 if (npc1 != null) {
  9.                     return npc1.getName();
  10.                 }
  11.             }
  12.             return null;
  13.         }
  14.  
  15.  
  16. //and this is in the plugin calling the custom hook
  17.  
  18.         public boolean onCommand(Player player, String[] split) {
  19.             if (split[0].equalsIgnoreCase("/ntest") && player.canUseCommand(split[0])){
  20.                 String Ename = (String)etc.getLoader().callCustomHook("NPCAPI", new Object[] {"GET_NAME", split[1]});
  21.                 if (Ename != null){
  22.                     player.sendMessage("Exists!");
  23.                     return true;
  24.                 }
  25.             }
  26.             return false;
  27.         }
  28.  
  29.  
  30. //throws ClassCastException
Add Comment
Please, Sign In to add comment