forked from MagicBane/Server
equals and hash defined for wpak pojos
This commit is contained in:
@@ -8,10 +8,9 @@
|
|||||||
|
|
||||||
package engine.wpak.data;
|
package engine.wpak.data;
|
||||||
|
|
||||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Effect {
|
public class Effect {
|
||||||
public String effect_id;
|
public String effect_id;
|
||||||
@@ -34,4 +33,19 @@ public class Effect {
|
|||||||
public String message;
|
public String message;
|
||||||
public int cycleDuration;
|
public int cycleDuration;
|
||||||
public int cycleDelay;
|
public int cycleDelay;
|
||||||
|
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Effect effect = (Effect) o;
|
||||||
|
return Objects.equals(effect_id, effect.effect_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return effect_id.hashCode(); // Use only the id field for hashCode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@
|
|||||||
package engine.wpak.data;
|
package engine.wpak.data;
|
||||||
|
|
||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
import engine.objects.AbstractWorldObject;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class Power {
|
public class Power {
|
||||||
public String power_id;
|
public String power_id;
|
||||||
@@ -114,8 +114,22 @@ public class Power {
|
|||||||
public boolean isSkill(){
|
public boolean isSkill(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChant(){
|
public boolean isChant(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Power power = (Power) o;
|
||||||
|
return Objects.equals(power_id, power.power_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return power_id.hashCode(); // Use only the id field for hashCode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ package engine.wpak.data;
|
|||||||
import engine.mbEnums;
|
import engine.mbEnums;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class PowerAction {
|
public class PowerAction {
|
||||||
|
|
||||||
@@ -50,5 +51,18 @@ public class PowerAction {
|
|||||||
public int splashDamageMax;
|
public int splashDamageMax;
|
||||||
public boolean ignoreNoTeleSpire = false;
|
public boolean ignoreNoTeleSpire = false;
|
||||||
|
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PowerAction powerAction = (PowerAction) o;
|
||||||
|
return Objects.equals(action_id, powerAction.action_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return action_id.hashCode(); // Use only the id field for hashCode
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user