EssentialsX

EssentialsX

2M Downloads

Add NPC check for register-back-in-listener

HexedHero opened this issue ยท 2 comments

commented

Information

Full output of /ess version:

[09:38:57 INFO]: CONSOLE issued server command: /ess ver
[09:38:57 INFO]: Server version: 1.14.4-R0.1-SNAPSHOT git-Paper-221 (MC: 1.14.4)
[09:38:57 INFO]: EssentialsX version: 2.17.1.19
[09:38:57 INFO]: PlaceholderAPI version: 2.10.4
[09:38:57 INFO]: LuckPerms version: 4.4.1
[09:38:57 INFO]: Vault version: 1.7.2-b107
[09:38:57 INFO]: Citizens version: 2.0.25-SNAPSHOT (build 1762)
[09:38:57 INFO]: EssentialsXSpawn version: 2.17.1.19

Server log:
Nothing much, just essentials making new userdata files for NPCs

EssentialsX config:
#Do you want Essentials to keep track of previous location for /back in the teleport listener?
#If you set this to true any plugin that uses teleport will have the previous location registered.
register-back-in-listener: true
false = fixes this bug

Details

Description

So, there is A LOT of reports with random userdata files being created and the cause is when you have NPC's like ones from Citizens and have register-back-in-listener: true set to true, it will add userdata files because of the NPCs, setting this to false or disabling Citizens completely fixes this issue.

The fix for this is simply add an NPC check for the PlayerTeleportListener when register-back-inlistener is true (Check for the "player" Metdata if it has "NPC" in it)
boolean isCitizensNPC = entity.hasMetadata("NPC");

Add the check here:
https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java#L422

commented

@pop4959 Did u check the PR?

commented

Looks fine at a glance. ๐Ÿ˜ƒ