mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Use Int2ObjectMap in InventoryCache and JavaServerDeclareCommandsTranslator
This commit is contained in:
parent
8b487df698
commit
61587ec320
2 changed files with 7 additions and 6 deletions
|
@ -25,14 +25,13 @@
|
|||
|
||||
package org.geysermc.connector.network.session.cache;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class InventoryCache {
|
||||
|
||||
private GeyserSession session;
|
||||
|
@ -42,7 +41,7 @@ public class InventoryCache {
|
|||
private Inventory openInventory;
|
||||
|
||||
@Getter
|
||||
private Map<Integer, Inventory> inventories = new HashMap<Integer, Inventory>();
|
||||
private Int2ObjectMap<Inventory> inventories = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
public InventoryCache(GeyserSession session) {
|
||||
this.session = session;
|
||||
|
|
|
@ -32,6 +32,8 @@ import com.nukkitx.protocol.bedrock.data.CommandData;
|
|||
import com.nukkitx.protocol.bedrock.data.CommandEnumData;
|
||||
import com.nukkitx.protocol.bedrock.data.CommandParamData;
|
||||
import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
@ -45,8 +47,8 @@ public class JavaServerDeclareCommandsTranslator extends PacketTranslator<Server
|
|||
@Override
|
||||
public void translate(ServerDeclareCommandsPacket packet, GeyserSession session) {
|
||||
List<CommandData> commandData = new ArrayList<>();
|
||||
Map<Integer, String> commands = new HashMap<>();
|
||||
Map<Integer, List<CommandNode>> commandArgs = new HashMap<>();
|
||||
Int2ObjectMap<String> commands = new Int2ObjectOpenHashMap<>();
|
||||
Int2ObjectMap<List<CommandNode>> commandArgs = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
// Get the first node, it should be a root node
|
||||
CommandNode rootNode = packet.getNodes()[packet.getFirstNodeIndex()];
|
||||
|
|
Loading…
Reference in a new issue