Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-08 13:52:50 +02:00
Remove uuid tracking
Dieser Commit ist enthalten in:
Ursprung
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));
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren