#NPC Action Bug ?
1 messages · Page 1 of 1 (latest)
public void spawnCityBuildNpc(Player player) {
NpcData data = new NpcData("citybuild", player.getUniqueId(), locationManager.getLocation("lobby", "citybuild_npc").get());
data.setSkin("Maaxxs_");
data.setGlowing(true);
data.setGlowingColor(NamedTextColor.GREEN);
data.setDisplayName("<b><gradient:#00aa00:#55ff55>CityBuild</b>");
data.setInteractionCooldown(5);
data.setTurnToPlayer(true);
data.setOnClick(clicker -> {
connectToService(player,"CityBuild-1");
});
if (FancyNpcsPlugin.get().getNpcManager().getNpc(data.getName()) == null) {
Npc npc = FancyNpcsPlugin.get().getNpcAdapter().apply(data);
FancyNpcsPlugin.get().getNpcManager().registerNpc(npc);
npc.create();
Bukkit.getScheduler().runTaskAsynchronously(CoreSpigotPlugin.getInstance(), npc::spawnForAll);
}
}
here is my code
I think it's because I make NpcData data = new NpcData(“citybuild”, player.getUniqueId(), locationManager.getLocation(‘lobby’, “citybuild_npc”).get()); but I have to do that because he wants to have a CreatorUUID or how can I do it differently
You only need to spawn one npc at all, not one per player.
Change this:
data.setOnClick(clicker -> {
connectToService(player,"CityBuild-1");
});
to
data.setOnClick(clicker -> {
connectToService(clicker,"CityBuild-1");
});
its works thanks