Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is in the plugin with the API
- public Object run(Object[] os) {
- String mode = (String)os[0];
- if (mode.equalsIgnoreCase("GET_NAME")) {
- String id = (String)os[1];
- npc npc1 = npc.getNPC(id);
- if (npc1 != null) {
- return npc1.getName();
- }
- }
- return null;
- }
- //and this is in the plugin calling the custom hook
- public boolean onCommand(Player player, String[] split) {
- if (split[0].equalsIgnoreCase("/ntest") && player.canUseCommand(split[0])){
- String Ename = (String)etc.getLoader().callCustomHook("NPCAPI", new Object[] {"GET_NAME", split[1]});
- if (Ename != null){
- player.sendMessage("Exists!");
- return true;
- }
- }
- return false;
- }
- //throws ClassCastException
Add Comment
Please, Sign In to add comment