mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-02-02 12:51:22 +01:00
Remove uuid tracking
This commit is contained in:
parent
35bb80d67a
commit
11b25151f7
@ -1,9 +1,6 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||
@ -14,19 +11,16 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class EntityTracker extends StoredObject {
|
||||
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
|
||||
private final BiMap<UUID, Integer> uuidToId = Maps.synchronizedBiMap(HashBiMap.<UUID, Integer>create());
|
||||
|
||||
public EntityTracker(UserConnection user) {
|
||||
super(user);
|
||||
}
|
||||
|
||||
public void removeEntity(int entityId) {
|
||||
uuidToId.inverse().remove(entityId);
|
||||
clientEntityTypes.remove(entityId);
|
||||
}
|
||||
|
||||
public void addEntity(int entityId, UUID uuid, Entity1_14Types.EntityType type) {
|
||||
uuidToId.forcePut(uuid, entityId);
|
||||
clientEntityTypes.put(entityId, type);
|
||||
}
|
||||
|
||||
@ -37,8 +31,4 @@ public class EntityTracker extends StoredObject {
|
||||
public Optional<Entity1_14Types.EntityType> get(int id) {
|
||||
return Optional.fromNullable(clientEntityTypes.get(id));
|
||||
}
|
||||
|
||||
public Optional<UUID> getUUID(int id) {
|
||||
return Optional.fromNullable(uuidToId.inverse().get(id));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user