diff --git a/connector/pom.xml b/connector/pom.xml
index e9de81e64..a523d2633 100644
--- a/connector/pom.xml
+++ b/connector/pom.xml
@@ -39,13 +39,37 @@
com.nukkitx.protocol
bedrock-v389
- 2.5.1
+ 2.5.4
+ compile
+
+
+ net.sf.trove4j
+ trove
+
+
+
+
+ com.nukkitx.fastutil
+ fastutil-int-int-maps
+ 8.3.1
compile
- com.nukkitx
- fastutil-lite
- 8.1.1
+ com.nukkitx.fastutil
+ fastutil-int-float-maps
+ 8.3.1
+ compile
+
+
+ com.nukkitx.fastutil
+ fastutil-long-long-maps
+ 8.3.1
+ compile
+
+
+ com.nukkitx.fastutil
+ fastutil-object-long-maps
+ 8.3.1
compile
diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java
index bbd714e2f..f32ee2a5c 100644
--- a/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java
+++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/EntityCache.java
@@ -26,6 +26,9 @@
package org.geysermc.connector.network.session.cache;
import it.unimi.dsi.fastutil.longs.*;
+import it.unimi.dsi.fastutil.objects.Object2LongMap;
+import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import lombok.Getter;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.entity.PlayerEntity;
@@ -45,7 +48,7 @@ public class EntityCache {
private Long2ObjectMap entities = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>());
private Long2LongMap entityIdTranslations = Long2LongMaps.synchronize(new Long2LongOpenHashMap());
private Map playerEntities = Collections.synchronizedMap(new HashMap<>());
- private Map bossbars = new HashMap<>();
+ private Object2LongMap bossbars = new Object2LongOpenHashMap<>();
@Getter
private AtomicLong nextEntityId = new AtomicLong(2L);
@@ -92,7 +95,7 @@ public class EntityCache {
}
public Set getEntitiesByType(Class entityType) {
- Set entitiesOfType = new HashSet<>();
+ Set entitiesOfType = new ObjectOpenHashSet<>();
for (Entity entity : (entityType == PlayerEntity.class ? playerEntities : entities).values()) {
if (entity.is(entityType)) {
entitiesOfType.add(entity.as(entityType));
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/block/BlockTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/block/BlockTranslator.java
index 8308db2ed..c782e099a 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/block/BlockTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/block/BlockTranslator.java
@@ -32,9 +32,14 @@ import com.nukkitx.nbt.NbtUtils;
import com.nukkitx.nbt.stream.NBTInputStream;
import com.nukkitx.nbt.tag.CompoundTag;
import com.nukkitx.nbt.tag.ListTag;
-import gnu.trove.map.TObjectIntMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import it.unimi.dsi.fastutil.ints.*;
+import it.unimi.dsi.fastutil.ints.Int2IntMap;
+import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
+import it.unimi.dsi.fastutil.ints.IntSet;
+import it.unimi.dsi.fastutil.objects.Object2IntMap;
+import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.utils.Toolbox;
@@ -78,7 +83,8 @@ public class BlockTranslator {
} catch (Exception e) {
throw new AssertionError("Unable to load Java block mappings", e);
}
- TObjectIntMap addedStatesMap = new TObjectIntHashMap<>(512, 0.5f, -1);
+ Object2IntMap addedStatesMap = new Object2IntOpenHashMap<>();
+ addedStatesMap.defaultReturnValue(-1);
List paletteList = new ArrayList<>();
int waterRuntimeId = -1;
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java
index f27be49bf..8e9224ed3 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/entity/player/JavaPlayerAbilitiesTranslator.java
@@ -31,11 +31,11 @@ import com.nukkitx.protocol.bedrock.data.EntityFlag;
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
-import java.util.HashSet;
import java.util.Set;
public class JavaPlayerAbilitiesTranslator extends PacketTranslator {
@@ -54,7 +54,7 @@ public class JavaPlayerAbilitiesTranslator extends PacketTranslator playerFlags = new HashSet<>();
+ Set playerFlags = new ObjectOpenHashSet<>();
playerFlags.add(AdventureSettingsPacket.Flag.AUTO_JUMP);
if (packet.isCanFly())
playerFlags.add(AdventureSettingsPacket.Flag.MAY_FLY);
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java
index 48a553048..9ef7c7056 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/scoreboard/JavaTeamTranslator.java
@@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.java.scoreboard;
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
@@ -73,6 +74,6 @@ public class JavaTeamTranslator extends PacketTranslator {
}
private Set toPlayerSet(String[] players) {
- return new HashSet<>(Arrays.asList(players));
+ return new ObjectOpenHashSet<>(Arrays.asList(players));
}
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java
index 490a66437..29ad5c3ed 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java
@@ -36,11 +36,11 @@ import com.nukkitx.protocol.bedrock.data.EntityFlag;
import com.nukkitx.protocol.bedrock.data.LevelEventType;
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
import com.nukkitx.protocol.bedrock.packet.*;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
-import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
@@ -68,7 +68,7 @@ public class JavaNotifyClientTranslator extends PacketTranslator playerFlags = new HashSet<>();
+ Set playerFlags = new ObjectOpenHashSet<>();
GameMode gameMode = (GameMode) packet.getValue();
if (gameMode == GameMode.ADVENTURE)
playerFlags.add(AdventureSettingsPacket.Flag.IMMUTABLE_WORLD);
diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java
index 48fe492f4..03ccb2fd3 100644
--- a/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java
+++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Scoreboard.java
@@ -30,6 +30,7 @@ import com.nukkitx.protocol.bedrock.data.ScoreInfo;
import com.nukkitx.protocol.bedrock.packet.RemoveObjectivePacket;
import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket;
import com.nukkitx.protocol.bedrock.packet.SetScorePacket;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import lombok.Getter;
import org.geysermc.connector.network.session.GeyserSession;
@@ -113,7 +114,7 @@ public class Scoreboard {
}
public void onUpdate() {
- Set changedObjectives = new HashSet<>();
+ Set changedObjectives = new ObjectOpenHashSet<>();
List addScores = new ArrayList<>();
List removeScores = new ArrayList<>();
@@ -133,7 +134,7 @@ public class Scoreboard {
boolean hasUpdate = globalUpdate;
List handledScores = new ArrayList<>();
- for (String identifier : new HashSet<>(objective.getScores().keySet())) {
+ for (String identifier : new ObjectOpenHashSet<>(objective.getScores().keySet())) {
Score score = objective.getScores().get(identifier);
Team team = score.getTeam();
diff --git a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java
index d72fb60fd..bf4b78532 100644
--- a/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java
+++ b/connector/src/main/java/org/geysermc/connector/scoreboard/Team.java
@@ -25,12 +25,12 @@
package org.geysermc.connector.scoreboard;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -45,7 +45,7 @@ public class Team {
private String name;
private String prefix;
private String suffix;
- private Set entities = new HashSet<>();
+ private Set entities = new ObjectOpenHashSet<>();
public Team(Scoreboard scoreboard, String id) {
diff --git a/connector/src/main/java/org/geysermc/connector/utils/Toolbox.java b/connector/src/main/java/org/geysermc/connector/utils/Toolbox.java
index 27c0fd617..45802196b 100644
--- a/connector/src/main/java/org/geysermc/connector/utils/Toolbox.java
+++ b/connector/src/main/java/org/geysermc/connector/utils/Toolbox.java
@@ -48,7 +48,7 @@ public class Toolbox {
public static final ObjectMapper JSON_MAPPER = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
public static final CompoundTag BIOMES;
- public static final Collection ITEMS = new ArrayList<>();
+ public static final List ITEMS = new ArrayList<>();
public static final Int2ObjectMap ITEM_ENTRIES = new Int2ObjectOpenHashMap<>();