Skip to content

Commit 3d4c07e

Browse files
committed
Don't bubble ActionPerformed
1 parent fd53833 commit 3d4c07e

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

fNbt/Tags/NbtTag.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public abstract class NbtTag : ICloneable {
1818
public event EventHandler<NbtTag> Changed;
1919

2020
/// <summary> Event raised when this tag or one of its children has an undoable action performed on it. </summary>
21-
public event EventHandler<(NbtTag tag, UndoableAction action)> ActionPerformed;
21+
public event EventHandler<UndoableAction> ActionPerformed;
2222

2323
private void RaiseChanged(NbtTag tag) => Changed?.Invoke(this, tag);
24-
private void RaiseActionPerformed(NbtTag tag, UndoableAction action) => ActionPerformed?.Invoke(this, (tag, action));
24+
private void RaiseActionPerformed(UndoableAction action) => ActionPerformed?.Invoke(this, 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)
@@ -35,7 +35,7 @@ T modified_action()
3535
undo += RaiseChangedLoop;
3636
var undoable = new UndoableAction<T>(description, modified_action, undo);
3737
var result = undoable.Do();
38-
RaiseActionLoop(undoable);
38+
RaiseActionPerformed(undoable);
3939
return result;
4040
}
4141

@@ -46,7 +46,7 @@ protected void PerformAction(DescriptionHolder description, Action action, Actio
4646
undo += RaiseChangedLoop;
4747
var undoable = new UndoableAction(description, action, undo);
4848
undoable.Do();
49-
RaiseActionLoop(undoable);
49+
RaiseActionPerformed(undoable);
5050
}
5151

5252
private void RaiseChangedLoop()
@@ -59,16 +59,6 @@ private void RaiseChangedLoop()
5959
}
6060
}
6161

62-
private void RaiseActionLoop(UndoableAction action)
63-
{
64-
var tag = this;
65-
while (tag != null)
66-
{
67-
tag.RaiseActionPerformed(this, action);
68-
tag = tag.Parent;
69-
}
70-
}
71-
7262
/// <summary> Returns true if tags of this type have a value attached.
7363
/// All tags except Compound, List, and End have values. </summary>
7464
public bool HasValue {

0 commit comments

Comments
 (0)