9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-20 15:39:31 +00:00

Fixed 2 effects of the same type not working

This commit is contained in:
Auxilor
2021-05-19 11:30:03 +01:00
parent 730c259d19
commit fa8c5da31a
2 changed files with 20 additions and 2 deletions

View File

@@ -442,8 +442,8 @@ public class EcoBoss extends PluginDependent {
*
* @return The effects.
*/
public Set<Effect> createEffects() {
Set<Effect> effects = new HashSet<>();
public List<Effect> createEffects() {
List<Effect> effects = new ArrayList<>();
this.effectNames.forEach((string, args) -> {
effects.add(Effects.getEffect(string, args));
});

View File

@@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Objects;
public abstract class Effect implements BossTicker {
/**
@@ -83,4 +84,21 @@ public abstract class Effect implements BossTicker {
final long tick) {
// Override when needed.
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Effect)) {
return false;
}
Effect effect = (Effect) o;
return Objects.equals(getArgs(), effect.getArgs());
}
@Override
public int hashCode() {
return Objects.hash(getArgs());
}
}