Skip to content

Commit 6ff2006

Browse files
committed
fix GenericMapSyncHandler not calling change listener after packet read
1 parent 51f333a commit 6ff2006

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/cleanroommc/modularui/value/sync/GenericMapSyncHandler.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public void setValue(Map<K, V> value, boolean setSource, boolean sync) {
5656
for (Map.Entry<K, V> entry : value.entrySet()) {
5757
this.cache.put(this.keyCopy.createDeepCopy(entry.getKey()), this.valueCopy.createDeepCopy(entry.getValue()));
5858
}
59+
onSetCache(value, setSource, sync);
60+
}
61+
62+
protected void onSetCache(Map<K, V> value, boolean setSource, boolean sync) {
5963
if (setSource && this.setter != null) {
6064
this.setter.accept(value);
6165
}
@@ -104,7 +108,7 @@ public void read(PacketBuffer buffer) throws IOException {
104108
for (int i = 0; i < size; i++) {
105109
this.cache.put(this.keyDeserializer.deserialize(buffer), this.valueDeserializer.deserialize(buffer));
106110
}
107-
this.setter.accept(getValue());
111+
onSetCache(getValue(), true, false);
108112
}
109113

110114
@Override
@@ -114,7 +118,7 @@ public Map<K, V> getValue() {
114118

115119
@Override
116120
public Class<Map<K, V>> getValueType() {
117-
return (Class<Map<K,V>>) (Object) Map.class;
121+
return (Class<Map<K, V>>) (Object) Map.class;
118122
}
119123

120124
public static class Builder<K, V> {

0 commit comments

Comments
 (0)