1313import io .github .rothes .protocolstringreplacer .replacer .containers .Container ;
1414import io .github .rothes .protocolstringreplacer .replacer .containers .Replaceable ;
1515import org .apache .commons .lang .Validate ;
16- import org .bukkit .inventory .ItemStack ;
1716import org .jetbrains .annotations .NotNull ;
1817import org .neosearch .stringsearcher .Emit ;
1918
@@ -38,7 +37,7 @@ public class ReplacerManager {
3837 private char papiHead ;
3938 private char papiTail ;
4039 private final List <ReplacerConfig > replacerConfigList = new ArrayList <>();
41- private final ConcurrentHashMap <ItemStack , HandledItemCache > cacheTable = new ConcurrentHashMap <>();
40+ private final ConcurrentHashMap <String , HandledItemCache > cacheTable = new ConcurrentHashMap <>();
4241 private PsrTask cleanTask ;
4342
4443 public static class HandledItemCache {
@@ -121,15 +120,15 @@ public void registerTask() {
121120 long currentTime = System .currentTimeMillis ();
122121 int purged = 0 ;
123122
124- List <ItemStack > needToRemove = new ArrayList <>();
125- for (Map .Entry <ItemStack , HandledItemCache > entry : cacheTable .entrySet ()) {
123+ List <String > needToRemove = new ArrayList <>();
124+ for (Map .Entry <String , HandledItemCache > entry : cacheTable .entrySet ()) {
126125 needToRemove .clear ();
127126 if ((currentTime - entry .getValue ().lastAccessTime ) > cleanAccessInterval ) {
128127 needToRemove .add (entry .getKey ());
129128 }
130129 if (!needToRemove .isEmpty ()) {
131- for (ItemStack itemStack : needToRemove ) {
132- cacheTable .remove (itemStack );
130+ for (String cacheKey : needToRemove ) {
131+ cacheTable .remove (cacheKey );
133132 purged ++;
134133 }
135134 }
@@ -201,11 +200,11 @@ public void saveReplacerConfigs() {
201200 }
202201
203202 @ Nullable
204- public HandledItemCache getReplacedItemCache (ItemStack original ) {
203+ public HandledItemCache getReplacedItemCache (String original ) {
205204 return cacheTable .get (original );
206205 }
207206
208- public HandledItemCache addReplacedItemCache (ItemStack original , @ NotNull ReadWriteNBT nbtItem , boolean blocked , int [] papiIndexes ) {
207+ public HandledItemCache addReplacedItemCache (String original , @ NotNull ReadWriteNBT nbtItem , boolean blocked , int [] papiIndexes ) {
209208 Validate .notNull (nbtItem , "Replaced NBTItem cannot be null" );
210209
211210 HandledItemCache handledItemCache = new HandledItemCache (nbtItem , System .currentTimeMillis (), blocked , papiIndexes );
0 commit comments