From 5bd9f0a96fb234d9da81f73b8c7a300dfcab8f09 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 14 May 2019 04:11:49 -0400 Subject: [PATCH] CappedSet.newCappedSet() -> CappedSet.create() --- .../proxy/connection/client/ConnectedPlayer.java | 2 +- .../com/velocitypowered/proxy/util/collect/CappedSet.java | 2 +- .../velocitypowered/proxy/util/collect/CappedSetTest.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 9e950e201..d8c7ee290 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -108,7 +108,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { this.virtualHost = virtualHost; this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED; this.connectionPhase = minecraftConnection.getType().getInitialClientPhase(); - this.knownChannels = CappedSet.newCappedSet(MAX_PLUGIN_CHANNELS); + this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS); } @Override diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java b/proxy/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java index 6b3453134..a0f775f9e 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/util/collect/CappedSet.java @@ -26,7 +26,7 @@ public class CappedSet extends ForwardingSet { * @param the type of elements in the collection * @return the new collection */ - public static Set newCappedSet(int maxSize) { + public static Set create(int maxSize) { return new CappedSet<>(new HashSet<>(), maxSize); } diff --git a/proxy/src/test/java/com/velocitypowered/proxy/util/collect/CappedSetTest.java b/proxy/src/test/java/com/velocitypowered/proxy/util/collect/CappedSetTest.java index 2315c82c4..11df2237d 100644 --- a/proxy/src/test/java/com/velocitypowered/proxy/util/collect/CappedSetTest.java +++ b/proxy/src/test/java/com/velocitypowered/proxy/util/collect/CappedSetTest.java @@ -14,7 +14,7 @@ class CappedSetTest { @Test void basicVerification() { - Collection coll = CappedSet.newCappedSet(1); + Collection coll = CappedSet.create(1); assertTrue(coll.add("coffee"), "did not add single item"); assertThrows(IllegalStateException.class, () -> coll.add("tea"), "item was added to collection although it is too full"); @@ -27,7 +27,7 @@ class CappedSetTest { Set doesFill2 = ImmutableSet.of("chocolate"); Set overfill = ImmutableSet.of("Coke", "Pepsi"); - Collection coll = CappedSet.newCappedSet(3); + Collection coll = CappedSet.create(3); assertTrue(coll.addAll(doesFill1), "did not add items"); assertTrue(coll.addAll(doesFill2), "did not add items"); assertThrows(IllegalStateException.class, () -> coll.addAll(overfill), @@ -41,7 +41,7 @@ class CappedSetTest { Set doesFill2 = ImmutableSet.of("coffee", "chocolate"); Set overfill = ImmutableSet.of("coffee", "Coke", "Pepsi"); - Collection coll = CappedSet.newCappedSet(3); + Collection coll = CappedSet.create(3); assertTrue(coll.addAll(doesFill1), "did not add items"); assertTrue(coll.addAll(doesFill2), "did not add items"); assertThrows(IllegalStateException.class, () -> coll.addAll(overfill),