citizensdev / citizensapi Goto Github PK
View Code? Open in Web Editor NEWAPI for Citizens
Home Page: https://citizensnpcs.co
License: Open Software License 3.0
API for Citizens
Home Page: https://citizensnpcs.co
License: Open Software License 3.0
Would it be possible to have an update rate property in NavigatorParameters? Would be helpful to have the flexibility, having seen the effects of CitizensDev/Citizens2@3b295fa.
My code:
Location spawnLocation;
Location targetLocation;
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.BAT, "My awesome bat");
npc.spawn(spawnLocation);
if (!npc.isSpawned()) return;
npc.getNavigator().setTarget(targetLocation);
But the entity teleports to the target instead of flying to the target.
What is the best way to set a Player NPC max health?
I have a user wanting to increase the default Player NPCs health. I have tried:
fakePlayer.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(boss.getMaxHealth());
or
fakePlayer.setHealth(boss.getMaxHealth());
Where the fakePlayer being NPC#getEntity() casted to a Player.
To no avail, and even if the health appeared to be changed it is lost and reset back to 20HP after a restart.
Thank you.
Matej
Wondering if there is a way to sapwn NPC which only a certain Player can see?
I tried using packets and sending EntityDestroyPacket but dosent seem to work on Citizens
I tried to get NPC from id CitizensAPI.getNPCRegistry().getById(_npcid) but it always throws nullpointerexemption.
[23:00:17 ERROR]: Error occurred while enabling XGCoreHub vb0.0.1 (Is it up to date?)
java.lang.NullPointerException: null
at cz.xglockman.XGCore.Nametag.Nametag.hideNPCnt(Nametag.java:161) ~[?:?]
at cz.xglockman.XGCore.NPC.NPC.load(NPC.java:31) ~[?:?]
at cz.xglockman.XGCore.NPC.NPCAPI.createnpc(NPCAPI.java:64) ~[?:?]
at cz.xglockman.XGCore.NPC.NPCAPI.loadnpcs(NPCAPI.java:24) ~[?:?]
at cz.xglockman.XGCoreHub.Loader.onEnable(Loader.java:55) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[server.jar:git-Paper-33d42c8e]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316) ~[server.jar:git-Paper-33d42c8e]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) ~[server.jar:git-Paper-33d42c8e]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:395) ~[server.jar:git-Paper-33d42c8e]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:344) ~[server.jar:git-Paper-33d42c8e]
at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:442) ~[server.jar:git-Paper-33d42c8e]
at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:403) ~[server.jar:git-Paper-33d42c8e]
at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:341) ~[server.jar:git-Paper-33d42c8e]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:289) ~[server.jar:git-Paper-33d42c8e]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) ~[server.jar:git-Paper-33d42c8e]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
After I closed my server I saw that my Dynmap URL was not working. It worked when it was working before I closed but after I opened it back up it didn't work.
Hello,
I'm trying to spawn human NPCs that changes their names every single second. The problem is: npc.setName() respawns the entity if it is human. Is it possible to change its name without respawning it?
I know that if it isn't possible I'll have to make a hologram on the human's head. But doing that I have other problem: http://prntscr.com/d3l5zh
Is it possible to spawn humans without nametags?
Thank you.
Currently if I use Navigator#setTarget(Location) on a SkyBlock Island, the NPC falls right off if the Location is over the void. Is there a way to make the NPC stop if there is no path towards the target. If not, can you please add one if possible?
Hi !
Was using Citizen API for my plugin, and I just saw that LivingEntity.getEquipment().setHelmet(ItemStack) etc ... wasn't working when npc is instance of Human entity but work if it's instance of Zombie or other mobs, is there a way to do it or it's a bug ?
Thanks
So when I create a NPC from code it doesn't get detected in EntityDeathEvent or NPCDeathEvent. Why is that?
public void spawnNPC() {
NPC goblin = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "Goblin");
double angle = Math.random() * 360;
double radius = Math.random() * 10;
Location location = new Location(Bukkit.getWorld("world"), -4.762, 89, -19.306);
Location pos = location.add(Math.cos(angle) * radius, 0, Math.sin(angle) * radius).getWorld().getHighestBlockAt(location).getLocation();
System.out.println(goblin.getName() + " doesn't exist");
System.out.println(goblin.getName() + " NPC spawned!");
goblin.addTrait(LookClose.class);
goblin.getTrait(LookClose.class).setRealisticLooking(true);
goblin.getTrait(LookClose.class).toggle();
goblin.addTrait(SentinelTrait.class);
goblin.addTrait(Equipment.class);
GoblinSword sword = new GoblinSword();
sword.createItem();
ItemStack goblinsword = sword.getItemStack();
goblin.getTrait(Equipment.class).set(EquipmentSlot.HAND, goblinsword);
SentinelTrait sentinel = goblin.getTrait(SentinelTrait.class);
new SentinelTargetLabel("players").addToList(sentinel.allTargets);
goblin.getTrait(SentinelTrait.class).health = 20;
System.out.println(sentinel.health);
goblin.getTrait(SentinelTrait.class).range = 5;
goblin.getTrait(SentinelTrait.class).chaseRange = 5;;
goblin.getTrait(SentinelTrait.class).greetRange = 5;
goblin.getTrait(SentinelTrait.class).greetingText = goblin.getName() + ": Prepare to die!";
goblin.getTrait(SentinelTrait.class).invincible = false;
goblin.getTrait(SentinelTrait.class).realistic = true;
goblin.spawn(pos);
}
@EventHandler
public void onEntitydeath(EntityDeathEvent e) {
GoblinSword sword = new GoblinSword();
sword.createItem();
ItemStack goblinsword = sword.getItemStack();
System.out.println("test1");
if(e.getEntity().getName().equals("Goblin")) {
e.getEntity().getWorld().dropItemNaturally(e.getEntity().getLocation(), goblinsword);
System.out.println("test");
goblindupe.remove("Goblin");
} else {
System.out.println("is not goblin");
}
}
System Info: Java 16 (OpenJDK 64-Bit Server VM 16.0.2+7) Host: Mac OS X 12.0.1 (aarch64)
Loading libraries, please wait...
[09:48:00 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[09:48:00 INFO]: Reloading ResourceManager: Default, bukkit
[09:48:01 INFO]: Loaded 7 recipes
[09:48:01 INFO]: Starting minecraft server version 1.16.5
[09:48:01 INFO]: Loading properties
[09:48:01 INFO]: This server is running Paper version git-Paper-792 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
[09:48:01 INFO]: Debug logging is disabled
[09:48:01 INFO]: Server Ping Player Sample Count: 12
[09:48:01 INFO]: Using 4 threads for Netty based IO
[09:48:01 INFO]: Default game type: SURVIVAL
[09:48:01 INFO]: Generating keypair
[09:48:01 INFO]: Starting Minecraft server on *:25565
[09:48:01 INFO]: Using default channel type
[09:48:02 INFO]: [Citizens] Loading Citizens v2.0.29-SNAPSHOT (build 2419)
[09:48:02 INFO]: [Sentinel] Loading Sentinel v2.4.0-SNAPSHOT (build 446)
[09:48:02 INFO]: [CombatNPCs] Loading CombatNPCs v1.0-SNAPSHOT
[09:48:02 INFO]: Server permissions file permissions.yml is empty, ignoring it
[09:48:02 INFO]: Preparing level "world"
[09:48:02 INFO]: Preparing start region for dimension minecraft:overworld
[09:48:02 INFO]: Preparing spawn area: 0%
[09:48:02 INFO]: Time elapsed: 248 ms
[09:48:02 INFO]: Preparing start region for dimension minecraft:the_nether
[09:48:02 INFO]: Preparing spawn area: 0%
[09:48:02 INFO]: Preparing spawn area: 11%
[09:48:03 INFO]: Time elapsed: 529 ms
[09:48:03 INFO]: Preparing start region for dimension minecraft:the_end
[09:48:03 INFO]: Preparing spawn area: 0%
[09:48:03 INFO]: Time elapsed: 213 ms
[09:48:03 INFO]: [Citizens] Enabling Citizens v2.0.29-SNAPSHOT (build 2419)
[09:48:03 INFO]: [Citizens] Vault not found -> no economy handling.
[09:48:03 INFO]: [Sentinel] Enabling Sentinel v2.4.0-SNAPSHOT (build 446)
[09:48:03 INFO]: [Sentinel] Sentinel loading...
[09:48:03 INFO]: [Sentinel] Running on java version: 16.0.2
[09:48:03 INFO]: [Sentinel] Sentinel loaded on a fully supported Minecraft version. If you encounter any issues or need to ask a question, please join our Discord at https://discord.gg/Q6pZGSR and post in the '#sentinel' channel.
[09:48:03 INFO]: [Sentinel] Sentinel loaded!
[09:48:03 INFO]: [CombatNPCs] Enabling CombatNPCs v1.0-SNAPSHOT
[09:48:03 INFO]: Running delayed init tasks
[09:48:03 INFO]: [Citizens] Loaded 1 NPCs.
[09:48:03 INFO]: Done (1.974s)! For help, type "help"
[09:48:03 INFO]: Timings Reset
[09:48:11 INFO]: UUID of player DiamondLuda is 6ab49aec-d093-4eec-8812-89f95f6b0bf5
[09:48:11 INFO]: DiamondLuda joined the game
[09:48:11 INFO]: DiamondLuda[/127.0.0.1:52674] logged in with entity id 213 at ([world]230.90351538076416, 69.0, 25.397396154719843)
[09:48:14 INFO]: DiamondLuda issued server command: /createcombatnpc
[09:48:14 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'createcombatnpc' in plugin CombatNPCs v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.16.5.jar:git-Paper-792]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.16.5.jar:git-Paper-792]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:826) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2185) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1953) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:49) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:7) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1271) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1264) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeAll(IAsyncTaskHandler.java:95) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1400) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1135) ~[patched_1.16.5.jar:git-Paper-792]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-792]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.IllegalStateException: no implementation set
at net.citizensnpcs.api.CitizensAPI.getImplementation(CitizensAPI.java:79) ~[?:?]
at net.citizensnpcs.api.CitizensAPI.getNPCRegistry(CitizensAPI.java:111) ~[?:?]
at com.kadtheaad.combatnpcs.commands.MainCommand.onCommand(MainCommand.java:22) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-792]
... 19 more
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, "Welcome");
npc.spawn(player.getLocation());
return true;
}
@EventHandler
public void onPlayerLeave(PlayerQuitEvent e) {
Location loc = e.getPlayer().getLocation();
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, e.getPlayer().getName());
npc.teleport(loc, TeleportCause.PLUGIN);
npc.setProtected(true);
}
this does work i leave the game then i log back in and its there but not at the location i can tell its there by doing /npc list
Hi,
Is there a plan for adding more traits to the CitizensAPI from the main plugin?
Since currently there are only a limited Traits available in the CitizensAPI.
And maybe even more functionality that is available for people trough Citizens commands but not trough the API.
Or do i then need to use the Citizens2 plugin to get access to those additional Traits and functionality.
Harm (Harm27)
in my console when loading citizens api it say it missing plugin.yml file.I tried reinstal it like 3 times but same error. There's that error: [ERROR] Could not load 'plugins/citizensapi-2.0.32-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.loadPlugins(CraftServer.java:435) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3868-Spigot-d2eba2c-ddc9a2d]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3868-Spigot-d2eba2c-ddc9a2d]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:972) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3868-Spigot-d2eba2c-ddc9a2d]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:303) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3868-Spigot-d2eba2c-ddc9a2d]
at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more and here is that api:
citizensapi-2.0.32-SNAPSHOT.zip
how to disable health nametag from NPCs ?
i want it to shows for players only
`@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
boolean isCitizensNPC = e.hasMetadata("NPC");
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("showhealth", "health");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setDisplayName(ChatColor.RED + ":heart:");
if (!isCitizensNPC) {
return;
}
}`
I don't know if is there a way to get the cloned NPCs without complicating the code too much.
Adding a NPCCloneEvent with a source of the clone will be nice. Thanks!
Has quests been completely discontinued for current version?
Hello. After some testing I figured out that Citizens is the reason splash potions have no affect on my server. I also noticed that out of nowhere, the npcs take 0 damage no matter what I try to damage them with.
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
CitizensAPI.removeNamedNPCRegistry(e.getPlayer().getName() + " [OFFLINE]");
}
i cant seem to remove the npc named this
Right now, if I use this.npc.faceLocation(Location), it rotates the NPC's head to look at the location but the body can be facing in the opposite direction. Is there a way to make both the head and body look at the same location? I know in Citizens2 code I saw 'onlyHead' boolean or something, but in the CitizensAPI this doesn't exist. Please make one, thanks.
Hi i'm using the api and i'm trying to make it when an npc spawns, it automatically walks to a certain x, y, z, coord in the world. I used this code here: if (args[0].equalsIgnoreCase("start")) { NPCRegistry registry = CitizensAPI.getNPCRegistry(); NPC blueKing = registry.createNPC(EntityType.PLAYER, "Blue King"); Location spawnPlace = new Location(Bukkit.getWorld("E1"), 0, 100, 0, 0, 0); Location movePlace = new Location(Bukkit.getWorld("E1"), 10, 100, 0, 0, 0); blueKing.spawn(spawnPlace); blueKing.getNavigator().setTarget(movePlace);
The NPC is created fine but it doesn't move to the coordinates i want it to. It just stays there and does nothing. Please help.
For my plugin, I need NPCS to fight each other and I intended to write mechanics to make this possible using events such as NPCCollisionEvent and NPCPushEvent, but they do not work when two npcs touch each other. This may be because of the fact that NPCs are completely unhindered by each other when they collide or touch each other, but no where do I see an option that would make them be able to collide with each other or affect each other, so that NPCCollisionEvent and NPCPushEvent would work. I have tried toggling the settings collidable and vulnerable, and I have even tried changing "pushable" with denizens, but these do nothing.
Both the link on the spigot as the url on the github page returns a 404 error.
I tried making an NPC look at me using the code
npc.faceLocation(p.getLocation());
It works, but only for the yaw. The pitch gets reset every tick (I think), because when I call the previously mentioned method in an EventListener for PlayerMoveEvent, the NPC looks at me, but only when I keep moving. As soon as I stop moving and thus stop calling faceLocation, the yaw is still correct but the pitch resets to make the NPC face straight forward again instead of up/down.
This also causes the following
npc.teleport(p.getLocation())
to only work for one tick and then have its pitch reset. Something is obviously updating the NPC every tick and then resetting the head pitch! Yaw works fine.
I am using CitizensAPI 2.0.21-SNAPSHOT
The weird thing is that LookClose on the plugin itself works fine and can set yaw/pitch fine, just not the API.
hello, i want use your API for make my own citizens plugin,
but when i try to init my class who extends AbstractNPC i get an NullPointerException :
java.lang.NullPointerException
at net.citizensnpcs.api.npc.AbstractNPC.<init>(AbstractNPC.java:84) ~[?:?]
i check the params, uuid, id, name and registry are not null :/
i'm on the 1.10
any idea ?
Due to the use of annotations isn't it possible to register Traits dynamically.
Is there any chance that it will be possible to register Traits dynamically in the future or is there a workaround for this?
I want to create a custom data store where NPCs can be loaded by single files scattered accross multiple sub directories. The primary key would be the path to the file instead of an unique to int id.
Is this possible with the current storage api? Can you give me a short example or hint where I need to start and what classes I need to implement?
Thanks!
Is this compatible with Minecraft Release 1.9?
Cheers!
I'm currently working on a simple pet plugin based on Citizens, because I don't want to work with NMS stuff and reflections (or I'm just to lazy) ...
public static void createPet(Player p, PetType pt) {
NPCRegistry reg = CitizensAPI.getNPCRegistry();
NPC npc = reg.createNPC(pt.getType(), "MyNPC");
npc.spawn(p.getLocation());
npc.setName("§e" + p.getName() + "§6's " + pt.getName());
npc.addTrait(Controllable.class);
setPet(p, npc);
}
(PetType
contains all variants of pets you can choose.)
When I spawn a cow using this method, the cow is moving extremely slow (especially when riding it). Using /npc create TEST --type Cow
and /npc controllable
the cow is perfect. But how can I achieve this with the API?
A new event would be very helpful which gets called if I set the NPC target to an armor stand and when the NPC reaches the target armor stand, the event get called
I tried to use custom skin texture on my NPC and i was not able to do it.
How can I do it?
Hey,
i recently tested out the citizens Api to check if an Player Clicks at an Npc. The problem is, it wont call, I am using the build 2.0.21-SNAPSHOT and in this version it just dont work, i tested the subevents of left and rightclicking and they are totaly fine only the upper class just sleeps.
I tested it by simply sendig a message to whoerver clicked an npc and at the fact that I only got a message form the secific classes (LeftClick and RightClick) I can tell that there must be something messed up.
I hope you will fix it and I could help you with this issue to improof the plugin.
Have a nice day, Nitwel
The output of command /version on my server is: This server is running Paper version git-Paper-624 (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
You are 1 version(s) behind
The output of command /version citizens on my server is: Citizens version 2.0.25-SNAPSHOT (build 1675)
The documented / listed Traits by far not all traits available. I found about 3 - 4 Times
as many traits in the source code. But I can't always predict what these traits do (and mabe how to use them) just from the name.
Adding the missing traits to the docs and adding a short description to all traits would be really helpful.
Line:
hasPlayedBefore
will return false
for first-time players, which will cause some placeholders like %player%
or <p>
not to be replaced with the players' name.
Hi I am using 1.16.5 to code a plugin and I am trying to cancel NPCRightClickEvent however when I do this
e.getClicker().sendMessage("Hey! Im still talking to you!!");
e.setCancelled(true);
the task I provided which would run on the NPCRightClickEvent Still runs!
When I register my trait, I get thrown with this error - even though there is a no-arguments construct:
java.lang.IllegalArgumentException: Trait class must have a no-arguments constructor
at net.citizensnpcs.api.trait.TraitInfo.create(TraitInfo.java:81) ~[?:?]
at my.test.trait.MyTrait.register(MyTrait.java:21) ~[?:?]
at my.test.Plugin.onEnable(Plugin.java:40) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) ~[patched_1.10.jar:git-Paper-785]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:319) [patched_1.10.jar:git-Paper-785]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.10.jar:git-Paper-785]
at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugin(CraftServer.java:358) [patched_1.10.jar:git-Paper-785]
at org.bukkit.craftbukkit.v1_10_R1.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.10.jar:git-Paper-785]
at net.minecraft.server.v1_10_R1.MinecraftServer.t(MinecraftServer.java:414) [patched_1.10.jar:git-Paper-785]
at net.minecraft.server.v1_10_R1.MinecraftServer.l(MinecraftServer.java:379) [patched_1.10.jar:git-Paper-785]
at net.minecraft.server.v1_10_R1.MinecraftServer.a(MinecraftServer.java:333) [patched_1.10.jar:git-Paper-785]
at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:274) [patched_1.10.jar:git-Paper-785]
at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:580) [patched_1.10.jar:git-Paper-785]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]
@TraitName("traittest")
public class MyTrait extends Trait {
// ----------------------------------------
// STATIC
// ----------------------------------------
private static TraitInfo traitInfo;
public static void register() {
traitInfo = TraitInfo.create(MyTrait.class);
CitizensAPI.getTraitFactory().registerTrait(traitInfo);
}
public static void deregister() {
CitizensAPI.getTraitFactory().deregisterTrait(traitInfo);
traitInfo = null;
}
// ----------------------------------------
// CONSTRUCT
// ----------------------------------------
protected MyTrait() {
super("traittest");
}
// ...
Which is weird.. I followed just as the wiki said. I assume this is a bug?
This works
Boolean test = npc.isProtected();
This doesn't work
npc.setProtected(false);
Please check out the protection state method. I'm 99% sure it does nothing in the damage event. It's always in protected state for the damage event after spawning an Npc. This is critical for my server as I want to allow damaging for Citizens.
The value gets set but it never actually uses the protection state in the damage event or something. The protection state is false but still can't deal damage. Spawning a NPC from command and adding vulnerable works and allows for damaging, but using the API doesn't.
Also this only applies on PLAYER entity type citizens.
Spigot version: 1.11 R0.1 (1.11.2 doesn't work due to a method not existing, reported this minutes ago aswell)
Citizens version: 2.0.21 Build 1464
It seems the fastest a NPC or mob can walk is 3x as fast as default speed either through /npc speed or the API. Is it possible a NPC can walk faster than that? Setting base speed or speed modifier really high doesn't make it any faster.
How can we detect an EntityExplodeEvent with NPCs?
There appears to be a death event, but this doesn't specify if it was by explosion (and no way to change how the explosion works - i.e. blocks being exploded)
None of these events are called on explosion:
Any pointers? 😄
for net.citizensnpcs.api.ai.tree.Sequence, when selectNext is called, it increments the executingIndex before it gets the value.
Thus, when executingIndex is reset to 0 with reset(), ++executingIndex return 1, causing the sequence to always skip the first behaviour.
Changing the executingIndex to be set back to -1 like in the constructor would fix this issue.
The event wont cancel properly.
You can still technically stop it by using event.setDuration(0) but it is still odd that canceling the event doesn't stop it.
[22:59:36] [Server thread/ERROR]: Could not load 'plugins\citizensapi-2.0.22-SNAPSHOT.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:150) ~[patched_1.12.2.jar:git-Paper-1431] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) [patched_1.12.2.jar:git-Paper-1431] at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:318) [patched_1.12.2.jar:git-Paper-1431] at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:226) [patched_1.12.2.jar:git-Paper-1431] at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) [patched_1.12.2.jar:git-Paper-1431] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162] Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml ... 6 more
[23:02:15 INFO]: Plugins (94): ActionHealth, AdminPlayerMenu, AdvancedPortals, AlwaysOnline, AutoUpdaterAPI, BlockStatus, BottleRecycling, Broadcaster, ChangeSkin, Citizens, CityWorld, ColoredAnvils, CombatTagPlus, CommandPrompter, Craftconomy3, CS-CoreLib, CustomSoundManagerAPI, DamageIndicator, DeathFeathers, DeluxeChat, DeluxeMenus, DiscordSRV, DragonEggRespawn, DyeableSwords, DynamicSigns, EazyEmojis-Lite, EditableSign, Essentials, EssentialsChat, EventSounds, FirstJoinPlus, fly-permission, FOLFriends, ForceResourcepacks, gravy, HolographicDisplays, icJukeBox, InfoBook, InventoryFullPlus, InventoryOverflow, InventoryTweaks, LastHolo, LibsDisguises, LuckPerms, MaintenanceSpigot, Mentions.gg, MoneyDrop, MultiInv, Multiverse-Core, Multiverse-Portals, MVdWPlaceholderAPI, NoPos, NpcSkin, numberKeyBind, OnlinePlayersMenu, OpenAudioMc, OpenInv, PacketListenerApi, ParadiseLand, PerPlayerDrops, PlaceholderAPI, PluginManagerReloaded, Protectiontime, ProtocolLib, Questioner, RealisticLiquid, RealisticMC, SecurityVillagers, Sentinel, ShulkerBoxPlus, SilkSpawners, SimpleSit, Skript, StackableItems, SuperTrails, TabList, TitleManager, Towny, TownyChat, TownyNameUpdater, TownyTitle, TradeMe, Trails, UltimateDrugs, UltimateTrash, UltimateTroll, Vault, ViaBackwards, ViaRewind, ViaVersion, Votifier, VotingPlugin, WorldEdit, WorldGuard
I am trying to use this API in my plugin, and I am importing it through maven. Here is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>City</groupId>
<artifactId>City</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Bukkit API-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizensapi</artifactId>
<version>2.0.21</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
I don't understand, it always says: Can't find dependency: net.citizensapi.citizensapi:2.0.21
I've tried this with every version I could find (SNAPSHOT or not). Nothing has worked. Is this API still working?
Hi, I asked 2 days ago on the Spigot thread:
Hey, is there a way to hide the nametag on an NPC (e.g. Zombie NPC) via. the API? I know you can use a command, but I need this for a plugin. I tried npc.getEntity().setCustomNameVisible(false) but it doesn't do anything.
Edit: I just set it to ChatColor.GRAY and it shows a small nametag (transparent black, with no text). I still want this removed.
However, I received no support. So I'll ask here, how do I do this? Why doesn't setting it to "" or null (throws Exception) work?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.