public void go() { if (!(this.sender instanceof Player)) return; Player p = (Player) this.sender; Map map = this.editor.getMap(p.getWorld()); if (map == null) return; if (this.args.length == 1) return; if (!Utils.isInt(this.args[1])) return; int n = Integer.parseInt(this.args[1]); if (n < 1) return; Sign sign = map.getSign(n); if (sign == null) { message("Sign not found, check /editor find..."); return; } p.teleport(sign.getRealLocation(p.getWorld())); message("Teleported to sign #" + n); }
public void find() { if (!(this.sender instanceof Player)) return; Player p = (Player) this.sender; Map map = this.editor.getMap(p.getWorld()); if (map == null) return; ArrayList<Sign> results; if (this.args.length == 1) { message("Searching for signs..."); results = map.getSigns(); } else { results = new ArrayList<Sign>(); for (Sign s : map.getSigns()) { if (s.getObjectName().contains(this.args[1])) { results.add(s); } } } message(results.size() + " signs found :"); for (Sign sign : results) { int n = map.getSignNumber(sign); int distance = (int) Math.round(sign.getRealLocation(p.getWorld()).distance(p.getLocation())); message( "#" + n + " " + ChatColor.WHITE + sign.getTypeName() + ChatColor.GRAY + " (" + distance + "m)"); } }