@@ -15,13 +15,13 @@ public abstract class NbtTag : ICloneable {
1515 public abstract NbtTagType TagType { get ; }
1616
1717 /// <summary> Event raised when this tag or one of its children is changed. </summary>
18- public event EventHandler < NbtTag > Changed ;
18+ public event Action < NbtTag > Changed ;
1919
20- /// <summary> Event raised when this tag or one of its children has an undoable action performed on it. </summary>
21- public event EventHandler < UndoableAction > ActionPerformed ;
20+ /// <summary> Event raised when this tag has an undoable action performed on it. </summary>
21+ public event Action < UndoableAction > ActionPerformed ;
2222
23- private void RaiseChanged ( NbtTag tag ) => Changed ? . Invoke ( this , tag ) ;
24- private void RaiseActionPerformed ( UndoableAction action ) => ActionPerformed ? . Invoke ( this , action ) ;
23+ private void RaiseChanged ( NbtTag tag ) => Changed ? . Invoke ( tag ) ;
24+ private void RaiseActionPerformed ( UndoableAction action ) => ActionPerformed ? . Invoke ( action ) ;
2525
2626 /// <summary> Helper method for signaling changes to parent tags. </summary>
2727 protected T PerformAction < T > ( DescriptionHolder description , Func < T > action , Action undo )
@@ -84,21 +84,17 @@ public string Name {
8484 get { return name ; }
8585 set {
8686 string current_name = name ;
87+ if ( current_name == value )
88+ return ;
8789 PerformAction ( new DescriptionHolder ( "Rename {0} from {1}" , this , current_name ) ,
8890 ( ) => SetName ( value ) ,
8991 ( ) => SetName ( current_name )
9092 ) ;
91-
9293 }
9394 }
9495
9596 private void SetName ( string value )
9697 {
97- if ( name == value )
98- {
99- return ;
100- }
101-
10298 var parentAsCompound = Parent as NbtCompound ;
10399 if ( parentAsCompound != null )
104100 {
0 commit comments