我遇到此错误:
这是该行中的代码错误:
sender.sendMessage(ConfigurationService.GRAY + Joiner.on(", ").join((Iterable)playerList.stream().map((Function<? super Object, ?>)CommandSender::getName).collect((Collector<? super Object, ?, List<? super Object>>)Collectors.toList())));
完整代码
public class NearCommand implements CommandExecutor
{
public static final int RADIUS = 30;
private final HCF hcf;
public NearCommand(final HCF hcf) {
this.hcf = hcf;
}
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
if (sender instanceof Player) {
final Player player = (Player)sender;
final List<Player> playerList = this.getNearbyEnemies(player);
if (playerList.isEmpty()) {
sender.sendMessage(ConfigurationService.YELLOW + "There are no visible enemies in a " + 30 + " block radius");
}
else {
sender.sendMessage(ConfigurationService.YELLOW + "Nearby visible enemies in a " + 30 + " block radius");
sender.sendMessage(ConfigurationService.GRAY + Joiner.on(", ").join((Iterable)playerList.stream().map((Function<? super Object, ?>)CommandSender::getName).collect((Collector<? super Object, ?, List<? super Object>>)Collectors.toList())));
}
}
else {
sender.sendMessage(ConfigurationService.RED + "You need to be a player to do this");
}
return true;
}
public List<Player> getNearbyEnemies(final Player player) {
final List<Player> players = new ArrayList<Player>();
final FactionManager factionManager = this.hcf.getFactionManager();
final Faction playerFaction = factionManager.getPlayerFaction(player.getUniqueId());
final Collection<Entity> nearby = (Collection<Entity>)player.getNearbyEntities(30.0, 30.0, 30.0);
for (final Entity entity : nearby) {
if (entity instanceof Player) {
final Player target = (Player)entity;
if (!target.canSee(player)) {
continue;
}
if (!player.canSee(target)) {
continue;
}
if (target.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
continue;
}
final Faction targetFaction;
if (playerFaction != null && (targetFaction = factionManager.getPlayerFaction(target)) != null && targetFaction.equals(playerFaction)) {
continue;
}
players.add(target);
}
}
return players;
}
这是bukkit的子句 我需要帮助。