|
27 | 27 | import org.bukkit.Material; |
28 | 28 | import org.bukkit.World; |
29 | 29 | import org.bukkit.command.CommandSender; |
| 30 | +import org.bukkit.entity.Entity; |
30 | 31 | import org.bukkit.entity.Player; |
31 | 32 | import org.bukkit.entity.SpawnCategory; |
32 | 33 | import org.jetbrains.annotations.NotNull; |
@@ -224,18 +225,19 @@ private Collection<String> suggestDestinations(BukkitCommandCompletionContext co |
224 | 225 | // Most likely console did not specify a player |
225 | 226 | return Collections.<String>emptyList(); |
226 | 227 | } |
227 | | - if (context.hasConfig("othersOnly") && (players.length == 1 && players[0].equals(context.getIssuer().getIssuer()))) { |
| 228 | + CommandSender sender = context.getIssuer().getIssuer(); |
| 229 | + if (context.hasConfig("othersOnly") && (players.length == 1 && players[0].equals(sender))) { |
228 | 230 | return Collections.<String>emptyList(); |
229 | 231 | } |
230 | | - return suggestDestinationsWithPerms(context.getIssuer().getIssuer(), players, context.getInput()); |
| 232 | + return suggestDestinationsWithPerms(sender, Arrays.asList(players), context.getInput()); |
231 | 233 | }) |
232 | 234 | .getOrElse(Collections.emptyList()); |
233 | 235 | } |
234 | 236 |
|
235 | | - private Collection<String> suggestDestinationsWithPerms(CommandSender teleporter, Player[] players, String deststring) { |
| 237 | + private Collection<String> suggestDestinationsWithPerms(CommandSender teleporter, List<Entity> teleportees, String deststring) { |
236 | 238 | return destinationsProvider.suggestDestinations(teleporter, deststring).stream() |
237 | 239 | .filter(packet -> corePermissionsChecker |
238 | | - .checkDestinationPacketPermission(teleporter, Arrays.asList(players), packet)) |
| 240 | + .checkDestinationPacketPermission(teleporter, teleportees, packet)) |
239 | 241 | .map(DestinationSuggestionPacket::parsableString) |
240 | 242 | .toList(); |
241 | 243 | } |
|
0 commit comments