CitizensDev / Citizens2

Citizens - the premier plugin and API for creating server-side NPCs in Minecraft.
https://citizensnpcs.co
Open Software License 3.0
589 stars 313 forks source link

NPCs teleport on targeting players #2887

Closed kangarko closed 2 years ago

kangarko commented 2 years ago

/version output

This server is running Paper version git-Paper-142 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: ef0e5a6)
You are running the latest version

/version Citizens output

Citizens version 2.0.30-SNAPSHOT (build 2705)

Log file

https://pastebin.com/QG0NCt2T

config.yml

https://pastebin.com/4aGYWCb5

saves.yml

empty file

Profiler report

No response

Description

Following up on issue https://github.com/kangarko/Boss/issues/1103

In a nutshell, NPCs are targeting players and teleporting themselves to players when players are too far away. I'd like to disable this feature of Citizens. Tried setting npc.follow.teleport-across-worlds to false to no avail.

Here is my code: https://pastebin.com/rwBQyKqy

Thank you!

fullwall commented 2 years ago

You can either use straight line targeting or remove the stuck action.

mcmonkey4eva commented 2 years ago

For an in-game user that'd be /wp disableteleport to disable the stuck teleport action

kangarko commented 2 years ago

You can either use straight line targeting or remove the stuck action.

Thank you, may I please ask you to point me out to the specific API call for this? I am not so familiar with the Citizens API at the moment.

mcmonkey4eva commented 2 years ago

When in doubt, API version of commands can be found by just finding the source of that command: https://github.com/CitizensDev/Citizens2/blob/master/main/src/main/java/net/citizensnpcs/commands/WaypointCommands.java#L70

in this case npc.getNavigator().getDefaultParameters().stuckAction(null);

kangarko commented 2 years ago

Thank you so much that will help a ton <3