Hey guys, I got another question about a kit i was coding, the ninja kit. For the people who dont know what it does. If you hit a player, you will be able to teleport to him for 7 seconds if you sneak. So, i try coding it, but it didnt work out that fine. It just doesnt teleport me to the player i hit. Anyways, here is my code: Code:java ArrayList<String> ninjateleport = new ArrayList<String>(); ArrayList<String> ninjacooldown = new ArrayList<String>(); @EventHandler public void ninja(EntityDamageByEntityEvent e) { if(e.getEntity() instanceof Player && e.getDamager() instanceof Player) { Player p = (Player) e.getEntity(); final Player dmger = (Player) e.getDamager(); final String pName = dmger.getName(); if(PvPKits.hasKit(pName)) { if(PvPKits.getKit(pName).equalsIgnoreCase("Ninja")) { ninjateleport.add(pName); if(dmger.isSneaking()) { if(!ninjacooldown.contains(pName)) { dmger.teleport(p); ninjateleport.remove(pName); ninjacooldown.add(pName); } Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run(){ ninjacooldown.remove(pName); } }, 140L); if(ninjacooldown.contains(pName)) { p.sendMessage(ChatColor.RED + "You may not tp yet!"); } } } } } } Thx, iAmGuus
Yeah, but you could you even explain it then? Ok, iknow what a stack-trace is. But anyways will look further on to it tomorrow. Its 11:00 PM here
U have to do another event, onplayersneak and check if the player is on the arraylist and u have to store d player who was "punched" and when the player (ninja) sneak and if he is on arraylist get the punched location and teleport the ninja for that location, thats simple...