Comments (8)
Are you using NPC#show(player, true/false)
? You're not supposed to utilise this method, nor should you use NPC#hide(player, true/false)
. These are methods used by the internal system. NPCs should (under normal circumstances) hide and show automatically.
from npclib.
the npcs do not appears/dissappears if i don't use NPC#show
for NPC#hide
from npclib.
i will try again later,...
from npclib.
I have tried but the npc does not appear / disappear if I do not use the method manually.
from npclib.
Could you give a snippet of the code you're using the spawn (and show) the NPCs?
from npclib.
Hello, here some part of my code,
public class NpcManager implements Listener {
private List<CustomNPC> npcs;
private final NPCLib library;
private Skin shopSkin, soloSkin, doubleSkin;
private List<String> holoText = Utils.color(Arrays.asList("&d&lHOLOGRAM &f&l- &c&l%s", "&7(Right Click)"));
public NpcManager() {
this.npcs = new ArrayList<CustomNPC>();
this.library = new NPCLib(Main.getMain());
Bukkit.getPluginManager().registerEvents(this, Main.getMain());
}
public void setup() {
this.npcs.clear();
Utils.log("&eLoading NPCs....");
MineSkinFetcher.fetchSkinFromIdAsync(54948, skin -> this.shopSkin = skin);
MineSkinFetcher.fetchSkinFromIdAsync(60474, skin -> this.soloSkin = skin);
MineSkinFetcher.fetchSkinFromIdAsync(78960, skin -> this.doubleSkin = skin);
if (!Main.getMain().config.isConfigurationSection("NPCs"))
return;
Bukkit.getScheduler().runTaskLater(Main.getMain(), () -> {
for (String key : Main.getMain().config.getConfigurationSection("NPCs").getKeys(false)) {
final Location loc = Utils.locFromString(Main.getMain().config.getString("NPCs." + key + ".loc"));
String mode = Main.getMain().config.getString("NPCs." + key + ".mode");
CustomNPC npc;
if (mode.equals("SHOP")) {
npc = addNPC(loc).getNPC();
Main.getMain().config.set("NPCs." + key + ".id", npc.getEntityId());
continue;
}
npc = addNPC(loc, GameMode.valueOf(mode)).getNPC();
Main.getMain().config.set("NPCs." + key + ".id", npc.getEntityId());
}
Utils.log("&eLoaded " + this.npcs.size() + " NPC(s)");
Main.getMain().config.save();
Main.getMain().config.reload();
}, 60L);
}
@eventhandler
public void onJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
for (CustomNPC npc : npcs) {
if (!npc.getNPC().isActuallyShown(p))
npc.getNPC().show(p);
}
}
@EventHandler
public void onQuit(PlayerQuitEvent e) {
final Player p = e.getPlayer();
for (CustomNPC npc : npcs) {
if (npc.getNPC().isActuallyShown(p))
npc.getNPC().hide(p);
}
}
`
It works good, but some times when the player click the pc or walk to the npc got kicked by a error similar to this Team 09e2bc9b88 already exists in this scoreboar #Thanks and sorry for the wait!
from npclib.
First of all, you shouldn't use NPC#isActuallyShown
, that's an internally used method.
One way to generate this error is by not correctly shutting down a server (i.e. terminating the process). If this is something you have done, it's necessary for you to delete the scoreboard file in your world folder.
I'll take a look if I can add an extra check so this will generate a warning in a future version of NPCLib.
from npclib.
oh, Thanks. Sorry for the incovenience.
from npclib.
Related Issues (20)
- Lib fails to initiate ("v1_12_R1 is not supported") HOT 2
- Distant NPCs don't spawn when getting closer with ViaVersion HOT 2
- Custom AI for NPC?
- 1_16_R3 incompatible HOT 5
- HEX colors HOT 1
- NPC Movement HOT 2
- 1.17 support
- The NPC isn't configured to use skin overlays HOT 2
- Nullpointer when creating NPC HOT 1
- Replace Skin id by Skin uuid HOT 1
- discord for the people (link inside)
- Could not resolve dependencies
- Failed load the plugin HOT 1
- Fix NPC not fully loading if constructed when no players are online HOT 1
- Cannot invoke "net.jitse.npclib.api.NPC.setLocation()" because "npc" is null HOT 6
- NPC Rejoin Disappearance
- NPC save system HOT 2
- Exception in thread "pool-14-thread-2" java.lang.NullPointerException: "this.npcLib" is null" HOT 2
- Wrong README info HOT 1
- An opinion on skin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npclib.