fix(meta): update EntityData type to be generic in EntityMeta and Metadata
This commit is contained in:
parent
49943c9515
commit
a4ce05886d
3 changed files with 13 additions and 13 deletions
|
@ -272,12 +272,12 @@ public class EntityMeta implements EntityMetadataProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<EntityData> entityData(ClientVersion clientVersion) {
|
||||
public @NotNull List<EntityData<?>> entityData(@NotNull ClientVersion clientVersion) {
|
||||
return metadata.getEntries(); // TODO: Atm this is useless cause of the way the api works. Might change in the future
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityData> entityData() {
|
||||
public @NotNull List<EntityData<?>> entityData() {
|
||||
return metadata.getEntries();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public class Metadata {
|
|||
|
||||
private final int entityId;
|
||||
private volatile boolean notifyAboutChanges = true;
|
||||
private final HashMap<Byte, EntityData> notNotifiedChanges = new HashMap<>();
|
||||
private final ConcurrentHashMap<Byte, EntityData> metadataMap = new ConcurrentHashMap<>();
|
||||
private final HashMap<Byte, EntityData<?>> notNotifiedChanges = new HashMap<>();
|
||||
private final ConcurrentHashMap<Byte, EntityData<?>> metadataMap = new ConcurrentHashMap<>();
|
||||
|
||||
public Metadata(int entityId) {
|
||||
this.entityId = entityId;
|
||||
|
@ -47,13 +47,13 @@ public class Metadata {
|
|||
}
|
||||
|
||||
public <T> T getIndex(byte index, @Nullable T defaultValue) {
|
||||
EntityData value = this.metadataMap.get(index);
|
||||
EntityData<?> value = this.metadataMap.get(index);
|
||||
return value != null ? (T) value.getValue() : defaultValue;
|
||||
}
|
||||
|
||||
public <T> void setIndex(byte index, @NotNull EntityDataType<T> dataType, T value) {
|
||||
|
||||
final EntityData entry = new EntityData(index, dataType, value);
|
||||
final EntityData<?> entry = new EntityData<>(index, dataType, value);
|
||||
this.metadataMap.put(index, entry);
|
||||
|
||||
final Optional<EntityLibAPI<?>> optionalApi = EntityLib.getOptionalApi();
|
||||
|
@ -75,7 +75,7 @@ public class Metadata {
|
|||
return;
|
||||
}
|
||||
|
||||
List<EntityData> entries = null;
|
||||
List<EntityData<?>> entries = null;
|
||||
synchronized (this.notNotifiedChanges) {
|
||||
this.notifyAboutChanges = notifyAboutChanges;
|
||||
if (notifyAboutChanges) {
|
||||
|
@ -96,7 +96,7 @@ public class Metadata {
|
|||
}
|
||||
|
||||
public void setMetaFromPacket(WrapperPlayServerEntityMetadata wrapper) {
|
||||
for (EntityData data : wrapper.getEntityMetadata()) {
|
||||
for (EntityData<?> data : wrapper.getEntityMetadata()) {
|
||||
metadataMap.put((byte) data.getIndex(), data);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class Metadata {
|
|||
return notifyAboutChanges;
|
||||
}
|
||||
|
||||
@NotNull List<EntityData> getEntries() {
|
||||
@NotNull List<EntityData<?>> getEntries() {
|
||||
return Collections.unmodifiableList(new ArrayList<>(metadataMap.values()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
[versions]
|
||||
adventure = "4.16.0"
|
||||
jetbrains-annotations = "24.0.0"
|
||||
gson = "2.11.0"
|
||||
packetevents = "2.7.0"
|
||||
adventure = "4.22.0"
|
||||
jetbrains-annotations = "26.0.2"
|
||||
gson = "2.13.1"
|
||||
packetevents = "2.9.1"
|
||||
paper = "1.21-R0.1-SNAPSHOT"
|
||||
velocity = "3.3.0-SNAPSHOT"
|
||||
run-paper = "2.3.0"
|
||||
|
|
Loading…
Reference in a new issue