Skip to content

Commit

Permalink
MicroTickLogger: complete hashCode and equals method for /log microti…
Browse files Browse the repository at this point in the history
…ck unique
  • Loading branch information
Fallen-Breath committed Oct 20, 2020
1 parent fda0c77 commit 1d83b34
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,22 @@ public PropertyChanges(String name, Object oldValue, Object newValue)
this.oldValue = oldValue;
this.newValue = newValue;
}

@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (!(o instanceof PropertyChanges)) return false;
PropertyChanges changes = (PropertyChanges) o;
return Objects.equals(name, changes.name) &&
Objects.equals(oldValue, changes.oldValue) &&
Objects.equals(newValue, changes.newValue);
}

@Override
public int hashCode()
{
return Objects.hash(name, oldValue, newValue);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.text.BaseText;

import java.util.List;
import java.util.Objects;

public class EmitBlockUpdateEvent extends BaseEvent
{
Expand Down Expand Up @@ -54,4 +55,21 @@ public BaseText toText()
}
return Messenger.c(list.toArray(new Object[0]));
}

@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (!(o instanceof EmitBlockUpdateEvent)) return false;
if (!super.equals(o)) return false;
EmitBlockUpdateEvent that = (EmitBlockUpdateEvent) o;
return Objects.equals(block, that.block) &&
Objects.equals(methodName, that.methodName);
}

@Override
public int hashCode()
{
return Objects.hash(super.hashCode(), block, methodName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public boolean equals(Object o)
if (!(o instanceof ScheduleBlockEventEvent)) return false;
if (!super.equals(o)) return false;
ScheduleBlockEventEvent that = (ScheduleBlockEventEvent) o;
return Objects.equals(blockAction, that.blockAction);
return success == that.success &&
Objects.equals(blockAction, that.blockAction);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public boolean equals(Object o)
return delay == that.delay &&
Objects.equals(block, that.block) &&
Objects.equals(pos, that.pos) &&
priority == that.priority;
priority == that.priority &&
Objects.equals(success, that.success);
}

@Override
Expand Down

0 comments on commit 1d83b34

Please sign in to comment.