Remove hashcode dependence
This commit is contained in:
parent
d390a9a492
commit
9c5e5457f5
@ -25,7 +25,7 @@ public class GroupPermission
|
||||
return false;
|
||||
}
|
||||
|
||||
return _identifier.hashCode() == ((GroupPermission)o)._identifier.hashCode();
|
||||
return _identifier.equals(((GroupPermission)o)._identifier);
|
||||
}
|
||||
|
||||
public static GroupPermission of(String identifier)
|
||||
|
@ -2,9 +2,9 @@ package mineplex.core.account.permissions;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@ -16,7 +16,7 @@ public class PermissionGroup
|
||||
private final ChatColor _color;
|
||||
private final int _forumId;
|
||||
private final boolean _canBePrimary;
|
||||
private final Set<Integer> _inherited;
|
||||
private final Set<String> _inherited;
|
||||
|
||||
public PermissionGroup(String identifier, String display, String description, ChatColor color, int forumId, boolean canBePrimary, String... inherited)
|
||||
{
|
||||
@ -26,7 +26,7 @@ public class PermissionGroup
|
||||
_color = Objects.requireNonNull(color, "Group color cannot be null");
|
||||
_forumId = forumId;
|
||||
_canBePrimary = canBePrimary;
|
||||
_inherited = Collections.unmodifiableSet(Arrays.asList(inherited).stream().map(i -> i.hashCode()).collect(Collectors.toSet()));
|
||||
_inherited = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(inherited)));
|
||||
}
|
||||
|
||||
public String getIdentifier()
|
||||
@ -81,7 +81,7 @@ public class PermissionGroup
|
||||
|
||||
public boolean inherits(PermissionGroup group)
|
||||
{
|
||||
return _inherited.contains(group._id.hashCode());
|
||||
return _inherited.contains(group._id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,6 +104,6 @@ public class PermissionGroup
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((PermissionGroup)o)._id.hashCode() == _id.hashCode();
|
||||
return ((PermissionGroup)o)._id.equals(_id);
|
||||
}
|
||||
}
|
@ -163,7 +163,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor
|
||||
|
||||
_clientManager.loadClientByName(name, loadedClient ->
|
||||
{
|
||||
if (rank.getIdentifier().equals("player") || loadedClient.getPrimaryGroup().getIdentifier().equals("player") || !_clientManager.getPermissionManager().inheritsFully(loadedClient.getPrimaryGroup(), rank) || loadedClient.getPrimaryGroup().hashCode() == rank.hashCode())
|
||||
if (rank.getIdentifier().equals("player") || loadedClient.getPrimaryGroup().getIdentifier().equals("player") || !_clientManager.getPermissionManager().inheritsFully(loadedClient.getPrimaryGroup(), rank) || loadedClient.getPrimaryGroup().equals(rank))
|
||||
{
|
||||
_clientManager.setPrimaryGroup(client.getAccountId(), rank, () -> _purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), rank.getIdentifier() + "Permanent", 1, true));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user