diff --git a/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerPlaceholder.java b/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerPlaceholder.java index 252a3938..e721c263 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerPlaceholder.java +++ b/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerPlaceholder.java @@ -4,7 +4,9 @@ import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import java.util.Objects; import java.util.function.Function; /** @@ -70,4 +72,21 @@ public final class PlayerPlaceholder implements Placeholder { public String getIdentifier() { return this.identifier; } + + @Override + public boolean equals(@Nullable final Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StaticPlaceholder that)) { + return false; + } + return Objects.equals(this.getIdentifier(), that.getIdentifier()) + && Objects.equals(this.getPlugin(), that.getPlugin()); + } + + @Override + public int hashCode() { + return Objects.hash(this.getIdentifier(), this.getPlugin()); + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerlessPlaceholder.java b/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerlessPlaceholder.java index f5179a58..86a78f9e 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerlessPlaceholder.java +++ b/eco-api/src/main/java/com/willfp/eco/core/placeholder/PlayerlessPlaceholder.java @@ -3,7 +3,9 @@ package com.willfp.eco.core.placeholder; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import java.util.Objects; import java.util.function.Supplier; /** @@ -68,4 +70,21 @@ public final class PlayerlessPlaceholder implements Placeholder { public String getIdentifier() { return this.identifier; } + + @Override + public boolean equals(@Nullable final Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StaticPlaceholder that)) { + return false; + } + return Objects.equals(this.getIdentifier(), that.getIdentifier()) + && Objects.equals(this.getPlugin(), that.getPlugin()); + } + + @Override + public int hashCode() { + return Objects.hash(this.getIdentifier(), this.getPlugin()); + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/placeholder/StaticPlaceholder.java b/eco-api/src/main/java/com/willfp/eco/core/placeholder/StaticPlaceholder.java index 65fce9c2..a108fbd4 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/placeholder/StaticPlaceholder.java +++ b/eco-api/src/main/java/com/willfp/eco/core/placeholder/StaticPlaceholder.java @@ -3,7 +3,9 @@ package com.willfp.eco.core.placeholder; import com.willfp.eco.core.Eco; import com.willfp.eco.core.EcoPlugin; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import java.util.Objects; import java.util.function.Supplier; /** @@ -50,4 +52,20 @@ public final class StaticPlaceholder implements Placeholder { public String getIdentifier() { return this.identifier; } + + @Override + public boolean equals(@Nullable final Object o) { + if (this == o) { + return true; + } + if (!(o instanceof StaticPlaceholder that)) { + return false; + } + return Objects.equals(this.getIdentifier(), that.getIdentifier()); + } + + @Override + public int hashCode() { + return Objects.hash(this.getIdentifier()); + } }