fix MetaStackElement equality checks

This commit is contained in:
Luck 2017-10-15 14:51:42 +01:00
parent fb171a57c2
commit 2fd74f3b7e
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -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<MetaStackElement> 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()) {