public void addExplorationSign(Player player, CommandSign sign, Location location) throws ExplorersException { final String token = sign.getRouteName(); final String name = player.getName(); Route r = getOrCreateRoute(token, name); if (!r.isOwner(player) && !player.hasPermission(CREATE_PERMISSION)) { throw new ExplorersPermissionException(); } signs.add(locationToArray(location)); player.sendMessage(SIGN_CREATED_MSG); saveState(); }
/** * Called when a player activates a command sign. * * @param player The player who activated the sign * @param signType The command on the sign * @param token The route on the sign * @throws ExplorersException */ public void activateSign(final Player player, final CommandSign sign) throws ExplorersException { switch (sign.getSignType()) { case FINISH_SIGN: activateFinishSign(player, sign.getRouteName(), sign.getWaypoint()); break; case START_SIGN: activateStartSign(player, sign.getRouteName()); break; case VIEW_SIGN: activateViewSign(player, sign.getRouteName()); break; case WAYPOINTS_SIGN: activateWaypointSign(player, sign.getRouteName(), sign.getWaypoint()); break; case LOCK_SIGN: activateLockSign(player, sign.getRouteName()); break; case ENROUTE_SIGN: activateEnrouteSign(player, sign.getRouteName()); break; } }
/** * Predicate if these lines form a valid sign * * @param sign An array of 4 signs on a sign * @return True if these lines form a valid command sign */ public static boolean isExplorerSign(final String[] lines) { return CommandSign.makeCommandSign(lines) != null; }