SergiFerry / PlayerNPC

PlayerNPC API for Spigot 1.17+
https://www.spigotmc.org/resources/playernpc.93625/
27 stars 6 forks source link

Add a way to access the follow distances from an NPC #39

Open DefiantBurger opened 1 year ago

DefiantBurger commented 1 year ago

Could you add getters for the follow distances for NPCs? I currently have to do a scrappy HashMap to keep track of the follow distances so that I can change them relatively.

SergiFerry commented 1 year ago

Can you show me that part of your code?, to figure out what value you mean.

El vie, 14 jul 2023 a las 20:45, Joseph Cicalese @.***>) escribió:

Could you add getters for the follow distances for NPCs? I currently have to do a scrappy HashMap to keep track of the follow distances so that I can change them relatively.

— Reply to this email directly, view it on GitHub https://github.com/SergiFerry/PlayerNPC/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVGYYCUT6GV4S3SZHIDEBELXQGHURANCNFSM6AAAAAA2KVQE6Y . You are receiving this because you are subscribed to this thread.Message ID: @.***>

DefiantBurger commented 1 year ago

I am no longer using the code, but it was something like this: public static HashMap<Pair<Player, NPCLib.Registry.ID>, Integer> followDistances = new HashMap<>(); ... npc.followPlayer(followDistances.get(new Pair<>(player, NPCLib.Registry.ID.of(plugin, "ghost"))), 100); Then I would have to increment the followDistances HashMap. Instead it would be nice to do something like this: npc.followPlayer(npc.getMinimumFollowDistance() - 1, 100); I wanted to do this so that the NPC very slowly gets closer to the player under certain conditions, then stop at certain distances that gradually reduce. But, I was able to do this through the NPC goTo method instead.