mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
Use Fastutil
This commit is contained in:
parent
8b4a2aaac8
commit
dfb471df99
2 changed files with 16 additions and 7 deletions
17
pom.xml
17
pom.xml
|
@ -87,11 +87,18 @@
|
|||
<version>0.0.8.Final</version>
|
||||
<classifier>linux-x86_64</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-annotations</artifactId>
|
||||
<version>4.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.spotbugs</groupId>
|
||||
<artifactId>spotbugs-annotations</artifactId>
|
||||
<version>4.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nukkitx.fastutil</groupId>
|
||||
<artifactId>fastutil-int-object-maps</artifactId>
|
||||
<version>8.5.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.github.steveice10.packetlib.codec.PacketCodecHelper;
|
|||
import com.github.steveice10.packetlib.codec.PacketDefinition;
|
||||
import com.github.steveice10.packetlib.codec.PacketSerializer;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
@ -17,8 +19,8 @@ import java.util.Map;
|
|||
* All implementations must have a constructor that takes in a {@link ByteBuf}.
|
||||
*/
|
||||
public abstract class PacketProtocol {
|
||||
private final Map<Integer, PacketDefinition<? extends Packet, ?>> serverbound = new HashMap<>();
|
||||
private final Map<Integer, PacketDefinition<? extends Packet, ?>> clientbound = new HashMap<>();
|
||||
private final Int2ObjectMap<PacketDefinition<? extends Packet, ?>> serverbound = new Int2ObjectOpenHashMap<>();
|
||||
private final Int2ObjectMap<PacketDefinition<? extends Packet, ?>> clientbound = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
private final Map<Class<? extends Packet>, Integer> clientboundIds = new IdentityHashMap<>();
|
||||
private final Map<Class<? extends Packet>, Integer> serverboundIds = new IdentityHashMap<>();
|
||||
|
|
Loading…
Reference in a new issue