geforkt von Mirrors/Velocity
Remove potentially high-frequency usages of streams
Dieser Commit ist enthalten in:
Ursprung
63f22dc2de
Commit
d4910d9edc
@ -68,11 +68,14 @@ public class VelocityCommandManager implements CommandManager {
|
||||
|
||||
String alias = split[0];
|
||||
if (split.length == 1) {
|
||||
return Optional.of(commands.entrySet().stream()
|
||||
.filter(ent -> ent.getKey().regionMatches(true, 0, alias, 0, alias.length()))
|
||||
.filter(ent -> ent.getValue().hasPermission(source, new String[0]))
|
||||
.map(ent -> "/" + ent.getKey())
|
||||
.collect(Collectors.toList()));
|
||||
List<String> availableCommands = new ArrayList<>();
|
||||
for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
||||
if (entry.getKey().regionMatches(true, 0, alias, 0, alias.length()) &&
|
||||
entry.getValue().hasPermission(source, new String[0])) {
|
||||
availableCommands.add("/" + entry.getKey());
|
||||
}
|
||||
}
|
||||
return Optional.of(availableCommands);
|
||||
}
|
||||
|
||||
String[] actualArgs = Arrays.copyOfRange(split, 1, split.length);
|
||||
|
@ -7,6 +7,7 @@ import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
|
||||
import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -44,10 +45,11 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
|
||||
}
|
||||
|
||||
public Collection<String> getModernChannelIds() {
|
||||
return identifierMap.values().stream()
|
||||
.filter(i -> i instanceof MinecraftChannelIdentifier)
|
||||
.map(ChannelIdentifier::getId)
|
||||
.collect(Collectors.toList());
|
||||
Collection<String> ids = new ArrayList<>();
|
||||
for (ChannelIdentifier value : identifierMap.values()) {
|
||||
ids.add(value.getId());
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public boolean registered(String id) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren