@@ -80,7 +80,7 @@ public DataRegistry(Block block) throws UnacceptableBlockException, NullPointerE
8080 }
8181
8282 this .blockState = (TileState ) block .getState ();
83- this .dataContainer = state .getPersistentDataContainer ();
83+ this .dataContainer = this . blockState .getPersistentDataContainer ();
8484
8585 this .manager = new DataContainerManager (dataContainer );
8686 }
@@ -108,6 +108,7 @@ public void registerData(String dataName, Serializable dataValue) throws DataExc
108108 }
109109
110110 if (block != null ) {
111+ this .blockState .update ();
111112 BlockPersistentDataWriteEvent event = new BlockPersistentDataWriteEvent (block , dataName , dataValue );
112113 getJavaPlugin ().getServer ().getPluginManager ().callEvent (event );
113114 }
@@ -135,6 +136,7 @@ public void registerData(AbstractPersistentData data) throws DataException {
135136 }
136137
137138 if (block != null ) {
139+ this .blockState .update ();
138140 BlockPersistentDataWriteEvent event = new BlockPersistentDataWriteEvent (block , data );
139141 getJavaPlugin ().getServer ().getPluginManager ().callEvent (event );
140142 }
@@ -161,6 +163,7 @@ public void unregisterData(String dataName) throws DataException {
161163 }
162164
163165 if (block != null ){
166+ this .blockState .update ();
164167 BlockPersistentDataDeleteEvent event = new BlockPersistentDataDeleteEvent (block , dataName );
165168 getJavaPlugin ().getServer ().getPluginManager ().callEvent (event );
166169 }
@@ -188,6 +191,7 @@ public void unregisterData(AbstractPersistentData data) throws DataException {
188191 }
189192
190193 if (block != null ){
194+ this .blockState .update ();
191195 BlockPersistentDataDeleteEvent event = new BlockPersistentDataDeleteEvent (block , data );
192196 getJavaPlugin ().getServer ().getPluginManager ().callEvent (event );
193197 }
@@ -211,6 +215,11 @@ public void setData(AbstractPersistentData data) {
211215 ItemPersistentDataWriteEvent event = new ItemPersistentDataWriteEvent (item , data );
212216 getJavaPlugin ().getServer ().getPluginManager ().callEvent (event );
213217 }
218+
219+ if (block != null ) {
220+ this .blockState .update ();
221+ BlockPersistentDataWriteEvent event = new BlockPersistentDataWriteEvent (block , data );
222+ }
214223 }
215224
216225 /**
@@ -231,6 +240,11 @@ public void setData(String dataName, Serializable dataValue) {
231240 ItemPersistentDataWriteEvent event = new ItemPersistentDataWriteEvent (item , new PersistentData (dataName , dataValue ));
232241 getJavaPlugin ().getServer ().getPluginManager ().callEvent (event );
233242 }
243+
244+ if (block != null ) {
245+ this .blockState .update ();
246+ BlockPersistentDataWriteEvent event = new BlockPersistentDataWriteEvent (block , new PersistentData (dataName , dataValue ));
247+ }
234248 }
235249
236250 /**
0 commit comments