From 9c5e5457f51db37a062bf2edcb2c6696e84fc1c1 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Wed, 2 Aug 2017 19:17:57 -0400 Subject: [PATCH] Remove hashcode dependence --- .../core/account/permissions/GroupPermission.java | 2 +- .../core/account/permissions/PermissionGroup.java | 10 +++++----- .../src/mineplex/enjinTranslator/Enjin.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/GroupPermission.java b/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/GroupPermission.java index 6ca505a47..c68a55996 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/GroupPermission.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/GroupPermission.java @@ -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) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java b/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java index 9ebe3a4a0..337d4858e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/permissions/PermissionGroup.java @@ -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 _inherited; + private final Set _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); } } \ No newline at end of file diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 0f3f9e658..9e49ddbd9 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -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));