From 51844cd291bcac0b2a8c6b797e51eaefbac8e916 Mon Sep 17 00:00:00 2001 From: extendedclip Date: Mon, 3 Aug 2020 13:54:28 -0400 Subject: [PATCH] Always provide a copy of the placeholder map --- .../expansion/manager/LocalExpansionManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java index febb5d0..1867704 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java +++ b/src/main/java/me/clip/placeholderapi/expansion/manager/LocalExpansionManager.java @@ -20,6 +20,7 @@ package me.clip.placeholderapi.expansion.manager; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import java.io.File; @@ -114,17 +115,14 @@ public final class LocalExpansionManager implements Listener { return ImmutableSet.copyOf(expansions.values()); } - @Nullable public PlaceholderExpansion getExpansion(@NotNull final String identifier) { - return expansions.get(identifier.toLowerCase()); + return ImmutableMap.copyOf(expansions).get(identifier.toLowerCase()); } - @NotNull public Optional findExpansionByName(@NotNull final String name) { - return expansions.values().stream() - .filter(expansion -> name.equalsIgnoreCase(expansion.getName())).findFirst(); + return getExpansions().stream().filter(expansion -> name.equalsIgnoreCase(expansion.getName())).findFirst(); } @NotNull