Remove PlayerScript Cache

This commit is contained in:
Kam committed 2023-06-03 23:07:48 -04:00
1 parent 8732c3331c
commit 59e1950c70
1 file changed
+2 -7
@@ -73,7 +73,6 @@ public class NpcAPI extends AbstractNpcAPI {
private static final Map<Integer, ScriptWorld> worldCache = new LRUHashMap<>(10);
private static final CacheHashMap<ItemStack, CacheHashMap.CachedObject<ScriptItemStack>> scriptItemCache = new CacheHashMap<>(60*1000);
public static final HashMap<String,Object> engineObjects = new HashMap<>();
public static final HashMap<String,ScriptEntityData> playerCache = new HashMap<>();
public static final EventBus EVENT_BUS = new EventBus();
private static AbstractNpcAPI instance = null;
@@ -196,12 +195,8 @@ public class NpcAPI extends AbstractNpcAPI {
ScriptEntityData data = (ScriptEntityData) entity.getExtendedProperties("ScriptedObject");
if(data != null)
return data.base;
if(entity instanceof EntityPlayerMP) {
if (!playerCache.containsKey(((EntityPlayerMP) entity).getDisplayName())) {
playerCache.put(((EntityPlayerMP) entity).getDisplayName(),new ScriptEntityData(new ScriptPlayer<>((EntityPlayerMP) entity)));
}
data = playerCache.get(((EntityPlayerMP) entity).getDisplayName());
}
if(entity instanceof EntityPlayerMP)
data = new ScriptEntityData(new ScriptPlayer<>((EntityPlayerMP) entity));
else if(PixelmonHelper.isPixelmon(entity))
return new ScriptPixelmon<EntityTameable>((EntityTameable) entity);
else if(entity instanceof EntityAnimal)