Proper equals on servers
This commit is contained in:
@@ -4,6 +4,7 @@ import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Synchronized;
|
||||
@@ -95,4 +96,19 @@ public abstract class ServerInfo
|
||||
{
|
||||
return !restricted || player.hasPermission( "bungeecord.server." + name );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return ( obj instanceof ServerInfo ) && Objects.equals( getAddress(), ( (ServerInfo) obj ).getAddress() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 73 * hash + Objects.hashCode( getClass() );
|
||||
hash = 73 * hash + Objects.hashCode( getAddress() );
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user