Skip to content

Commit

Permalink
cache skin onjoin
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Nov 23, 2024
1 parent 25fe045 commit 7cbc217
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions src/main/java/de/oliver/fancynpcs/listeners/PlayerJoinListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.destroystokyo.paper.profile.ProfileProperty;
import de.oliver.fancynpcs.FancyNpcs;
import de.oliver.fancynpcs.api.Npc;
import de.oliver.fancynpcs.api.skins.SkinData;
import de.oliver.fancynpcs.v1_19_4.PacketReader_1_19_4;
import de.oliver.fancynpcs.v1_20.PacketReader_1_20;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -38,26 +39,19 @@ public void onPlayerJoin(PlayerJoinEvent event) {
}

for (ProfileProperty property : event.getPlayer().getPlayerProfile().getProperties()) {
//TODO
// if (property.getName().equals("textures")) {
// SkinFetcher.SkinData skinData = new SkinFetcher.SkinData(
// event.getPlayer().getUniqueId().toString(),
// property.getValue(),
// property.getSignature()
// );
//
// // update the skin cache if the skin is already cached
// if (SkinFetcher.skinCache.containsKey(skinData.identifier())) {
// SkinFetcher.skinCache.put(skinData.identifier(), skinData);
// }
//
// // update the skin cache if the skin is already cached
// FancyNpcs.getInstance().getSkinCache().upsert(new SkinFetcher.SkinCacheData(
// skinData,
// System.currentTimeMillis(),
// 1000 * 60 * 60 * 24 * 12
// ), true);
// }
if (!property.getName().equals("textures")) {
continue;
}

SkinData skinData = new SkinData(
event.getPlayer().getUniqueId().toString(),
SkinData.SkinType.UUID,
SkinData.SkinVariant.DEFAULT,
property.getValue(),
property.getSignature()
);

FancyNpcs.getInstance().getSkinManagerImpl().getMemCache().addSkin(skinData);
}
}
}

0 comments on commit 7cbc217

Please sign in to comment.