Created
August 22, 2013 22:29
-
-
Save lualzockt/6313602 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!i.getType().equals(Material.COMPASS)) | |
return; | |
Player pl = null; | |
double dist = 0.0D; | |
for (Entity en : p.getNearbyEntities(1000.0D, 1000.0D, 1000.0D)) { | |
if (!(en instanceof Player)) continue; | |
Player play = (Player)en; | |
dist = p.getLocation().distance(play.getLocation()); | |
if (dist < 15.0) continue; | |
if(MineHG.getInstance().playerkits.get(play.getName()).equalsIgnoreCase("spectator")) { | |
continue; | |
} | |
pl = play; | |
} | |
if (pl == null) { | |
p.sendMessage("§7No valid compass targets. Compass pointing to spawn."); | |
p.setCompassTarget(MineHG.getInstance().spawn); | |
} else { | |
String kitpl = MineHG.getInstance().playerkits.get(pl.getName()); | |
if(kit.equalsIgnoreCase("tracker") || kit.equalsIgnoreCase("spectator")) { | |
Location l = pl.getLocation(); | |
p.sendMessage("§3Compass pointing at " + pl.getName() + "(" + kitpl + ")"); | |
p.sendMessage("§7Tracked location: " + l.getBlockX() + ", " + l.getBlockY() + "," + l.getBlockZ() + " (" + (int) Math.round(l.distance(p.getLocation())) + ")"); | |
}else { | |
p.sendMessage("§7Compass pointing at " + pl.getName()); | |
} | |
p.setCompassTarget(pl.getLocation()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment