From 780674e8de125e0654a78adcafdf6249e8f3cefa Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 11 May 2023 19:54:04 -0400 Subject: [PATCH] Use Lombok's `EqualsAndHashCode` for comparing scene regions --- .../grasscutter/scripts/data/SceneRegion.java | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java b/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java index 076e33743..76de64881 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneRegion.java @@ -2,10 +2,12 @@ package emu.grasscutter.scripts.data; import emu.grasscutter.scripts.constants.ScriptRegionShape; import emu.grasscutter.utils.Position; -import java.util.List; +import lombok.EqualsAndHashCode; import lombok.Setter; -@Setter +import java.util.List; + +@Setter @EqualsAndHashCode public class SceneRegion { public int config_id; public int shape; @@ -18,6 +20,7 @@ public class SceneRegion { public float height; public List point_array; + @EqualsAndHashCode.Exclude public transient SceneGroup group; /** @@ -42,21 +45,4 @@ public class SceneRegion { } return false; } - - /** - * Checks if two regions are the same. - * - * @param region The region to compare to. - * @return True if the regions are the same, false otherwise. - */ - public boolean equals(SceneRegion region) { - return this.config_id == region.config_id - && this.shape == region.shape - && this.pos.equals(region.pos) - && this.size.equals(region.size) - && this.radius == region.radius - && this.area_id == region.area_id - && this.height == region.height - && this.point_array.equals(region.point_array); - } }