From 2fd74f3b7ed969479bb568d13dfa14405373f6e9 Mon Sep 17 00:00:00 2001 From: Luck Date: Sun, 15 Oct 2017 14:51:42 +0100 Subject: [PATCH] fix MetaStackElement equality checks --- .../common/metastacking/StandardStackElements.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java b/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java index 5b846f2d..e090f9d7 100644 --- a/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java +++ b/common/src/main/java/me/lucko/luckperms/common/metastacking/StandardStackElements.java @@ -47,24 +47,28 @@ import java.util.UUID; */ @UtilityClass public class StandardStackElements { + private static final HighestPriority HIGHEST_PRIORITY = new HighestPriority(); + private static final LowestPriority LOWEST_PRIORITY = new LowestPriority(); + private static final HighestPriorityOwn HIGHEST_PRIORITY_OWN = new HighestPriorityOwn(); + private static final LowestPriorityOwn LOWEST_PRIORITY_OWN = new LowestPriorityOwn(); public static Optional parseFromString(LuckPermsPlugin plugin, String s) { s = s.toLowerCase(); if (s.equals("highest")) { - return Optional.of(new HighestPriority()); + return Optional.of(HIGHEST_PRIORITY); } if (s.equals("lowest")) { - return Optional.of(new LowestPriority()); + return Optional.of(LOWEST_PRIORITY); } if (s.equals("highest_own")) { - return Optional.of(new HighestPriorityOwn()); + return Optional.of(HIGHEST_PRIORITY_OWN); } if (s.equals("lowest_own")) { - return Optional.of(new LowestPriorityOwn()); + return Optional.of(LOWEST_PRIORITY_OWN); } if (s.startsWith("highest_on_track_") && s.length() > "highest_on_track_".length()) {