public static Location getRandLoc(Location loc, int radius) { return getRandLoc(loc, radius, radius, radius); } public static Location getRandLoc(Location loc, int xzRadius, int yRadius) {
public static Location getTargetLoc(Player player) { return getTargetLoc(player, 128); } public static Location getTargetLoc(Player player, int maxDist) {
if (!isValidName(name)) { issuer.sendError(MinecraftMessageKeys.IS_NOT_A_VALID_NAME, "{name}", name); return null; findMatches(search, requester, matches, confirmList);
@Override public void sendMessageInternal(String message) { sender.sendMessage(ACFBukkitUtil.color(message)); }
/** * Please move to the CommandIssuer version * @deprecated */ public static Player findPlayerSmart(CommandSender requester, String search) { CommandManager manager = CommandManager.getCurrentCommandManager(); if (manager != null) { return findPlayerSmart(manager.getCommandIssuer(requester), search); } throw new IllegalStateException("You may not use the ACFBukkitUtil#findPlayerSmart(CommandSender) async to the command execution."); }
public static double distance(@NotNull Entity e1, @NotNull Entity e2) { return distance(e1.getLocation(), e2.getLocation()); } public static double distance2d(@NotNull Entity e1, @NotNull Entity e2) {
public static double distance2d(@NotNull Entity e1, @NotNull Entity e2) { return distance2d(e1.getLocation(), e2.getLocation()); } public static double distance2d(@NotNull Location loc1, @NotNull Location loc2) {
public static boolean isWithinDistance(@NotNull Player p1, @NotNull Player p2, int dist) { return isWithinDistance(p1.getLocation(), p2.getLocation(), dist); } public static boolean isWithinDistance(@NotNull Location loc1, @NotNull Location loc2, int dist) {
if (inventory != null && c.hasFlag("itemheld") && !ACFBukkitUtil.isValidItem(inventory.getItem(inventory.getHeldItemSlot()))) { throw new InvalidCommandArgument(MinecraftMessageKeys.YOU_MUST_BE_HOLDING_ITEM, false);
/** * Move to Message Keys on the CommandIssuer * @deprecated */ @Deprecated public static void sendMsg(CommandSender player, String message) { message = color(message); for (String msg : ACFPatterns.NEWLINE.split(message)) { player.sendMessage(msg); } }
@Nullable OnlinePlayer getOnlinePlayer(BukkitCommandIssuer issuer, String lookup, boolean allowMissing) throws InvalidCommandArgument { Player player = ACFBukkitUtil.findPlayerSmart(issuer, lookup); //noinspection Duplicates if (player == null) { if (allowMissing) { return null; } throw new InvalidCommandArgument(false); } return new OnlinePlayer(player); } }
public static double distance2d(@NotNull Location loc1, @NotNull Location loc2) { loc1 = loc1.clone(); loc1.setY(loc2.getY()); return distance(loc1, loc2); } public static double distance(@NotNull Location loc1, @NotNull Location loc2) {
public static String removeColors(String msg) { return ChatColor.stripColor(color(msg)); }
public static Location getRandLoc(Location loc, int xzRadius, int yRadius) { return getRandLoc(loc, xzRadius, yRadius, xzRadius); } @NotNull public static Location getRandLoc(Location loc, int xRadius, int yRadius, int zRadius) {
public static Location getTargetLoc(Player player, int maxDist) { return getTargetLoc(player, maxDist, 1.5); } public static Location getTargetLoc(Player player, int maxDist, double addY) {