Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ public void setMaskBit(int index, byte bit, boolean value) {
}

@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();
}

Expand Down
14 changes: 7 additions & 7 deletions api/src/main/java/me/tofaa/entitylib/meta/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();

Comment thread
felipepasc marked this conversation as resolved.
public Metadata(int entityId) {
this.entityId = entityId;
Expand All @@ -47,13 +47,13 @@ public void clear() {
}

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();
Expand All @@ -75,7 +75,7 @@ public void setNotifyAboutChanges(boolean notifyAboutChanges) {
return;
}

List<EntityData> entries = null;
List<EntityData<?>> entries = null;
synchronized (this.notNotifiedChanges) {
this.notifyAboutChanges = notifyAboutChanges;
if (notifyAboutChanges) {
Expand All @@ -96,7 +96,7 @@ public void setNotifyAboutChanges(boolean notifyAboutChanges) {
}

public void setMetaFromPacket(WrapperPlayServerEntityMetadata wrapper) {
for (EntityData data : wrapper.getEntityMetadata()) {
for (EntityData<?> data : wrapper.getEntityMetadata()) {
metadataMap.put((byte) data.getIndex(), data);
}
}
Expand All @@ -105,7 +105,7 @@ public boolean isNotifyingChanges() {
return notifyAboutChanges;
}

@NotNull List<EntityData> getEntries() {
@NotNull List<EntityData<?>> getEntries() {
return Collections.unmodifiableList(new ArrayList<>(metadataMap.values()));
}

Expand Down
8 changes: 4 additions & 4 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Loading