diff --git a/src/main/java/net/teamfruit/sushida/listener/ManageCommandListener.java b/src/main/java/net/teamfruit/sushida/listener/ManageCommandListener.java index a7c0335..f7dd2c0 100644 --- a/src/main/java/net/teamfruit/sushida/listener/ManageCommandListener.java +++ b/src/main/java/net/teamfruit/sushida/listener/ManageCommandListener.java @@ -71,25 +71,19 @@ private boolean validateRanking(CommandSender sender, PlayerData state, String a } private List getPlayers(CommandSender sender, List args) { - List players = new ArrayList<>(); - String arg0 = get(args, 0); - if (arg0 == null) - players.add((Player) sender); - else if ("@a".equals(arg0)) - players.addAll(Bukkit.getOnlinePlayers()); - else if ("@p".equals(arg0)) { - Location loc = (sender instanceof BlockCommandSender) - ? ((BlockCommandSender) sender).getBlock().getLocation() - : (sender instanceof Entity) - ? ((Entity) sender).getLocation() - : null; - if (loc != null) - loc.getNearbyPlayers(32, e -> !e.equals(sender)).stream() - .min(Comparator.comparing(e -> loc.distanceSquared(e.getLocation()))) - .ifPresent(players::add); - } else - players.addAll(args.stream().map(Bukkit::getPlayer).filter(Objects::nonNull).collect(Collectors.toList())); - return players; + try { + return Bukkit.selectEntities(sender, String.join(" ", args)).stream() + .filter(Player.class::isInstance) + .map(Player.class::cast) + .collect(Collectors.toList()); + } catch (IllegalArgumentException e) { + sender.sendMessage(new ComponentBuilder() + .append("[かめすたプラグイン] ").color(ChatColor.LIGHT_PURPLE) + .append("セレクターが間違っています").color(ChatColor.RED) + .create() + ); + } + return Collections.emptyList(); } @Override diff --git a/src/main/resources/romaji.csv b/src/main/resources/romaji.csv index 8a94b66..e2cbe85 100644 --- a/src/main/resources/romaji.csv +++ b/src/main/resources/romaji.csv @@ -8,7 +8,7 @@ o,お ?,? ,,、 (,( -(,) +),) [,「 ],」 .,。