Checkstyle, CappedCollection -> CappedSet
This commit is contained in:
@@ -46,10 +46,14 @@ import com.velocitypowered.proxy.protocol.packet.TitlePacket;
|
||||
import com.velocitypowered.proxy.server.VelocityRegisteredServer;
|
||||
import com.velocitypowered.proxy.tablist.VelocityTabList;
|
||||
import com.velocitypowered.proxy.util.VelocityMessages;
|
||||
import com.velocitypowered.proxy.util.collect.CappedCollection;
|
||||
import com.velocitypowered.proxy.util.collect.CappedSet;
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -103,7 +107,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
this.virtualHost = virtualHost;
|
||||
this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED;
|
||||
this.connectionPhase = minecraftConnection.getType().getInitialClientPhase();
|
||||
this.knownChannels = CappedCollection.newCappedSet(MAX_PLUGIN_CHANNELS);
|
||||
this.knownChannels = CappedSet.newCappedSet(MAX_PLUGIN_CHANNELS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -650,8 +654,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
||||
* @return {@code true} if the message can be forwarded, {@code false} otherwise
|
||||
*/
|
||||
public boolean canForwardPluginMessage(PluginMessage message) {
|
||||
// If we're forwarding a plugin message onto the client, that implies that we have a backend connection
|
||||
// already.
|
||||
// If we're forwarding a plugin message onto the client, that implies that we have a backend
|
||||
// connection already.
|
||||
MinecraftConnection mc = ensureBackendConnection();
|
||||
|
||||
boolean minecraftOrFmlMessage;
|
||||
|
@@ -1,20 +1,21 @@
|
||||
package com.velocitypowered.proxy.util.collect;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ForwardingCollection;
|
||||
import com.google.common.collect.ForwardingSet;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An unsynchronized collection that puts an upper bound on the size of the collection.
|
||||
*/
|
||||
public class CappedCollection<T> extends ForwardingCollection<T> {
|
||||
public class CappedSet<T> extends ForwardingSet<T> {
|
||||
|
||||
private final Collection<T> delegate;
|
||||
private final Set<T> delegate;
|
||||
private final int upperSize;
|
||||
|
||||
private CappedCollection(Collection<T> delegate, int upperSize) {
|
||||
private CappedSet(Set<T> delegate, int upperSize) {
|
||||
this.delegate = delegate;
|
||||
this.upperSize = upperSize;
|
||||
}
|
||||
@@ -25,12 +26,12 @@ public class CappedCollection<T> extends ForwardingCollection<T> {
|
||||
* @param <T> the type of elements in the collection
|
||||
* @return the new collection
|
||||
*/
|
||||
public static <T> Collection<T> newCappedSet(int maxSize) {
|
||||
return new CappedCollection<>(new HashSet<>(), maxSize);
|
||||
public static <T> Set<T> newCappedSet(int maxSize) {
|
||||
return new CappedSet<>(new HashSet<>(), maxSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<T> delegate() {
|
||||
protected Set<T> delegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
Reference in New Issue
Block a user