[Feature Request] Default NPC Type setting on config file
joex92 opened this issue ยท 6 comments
a setting for the default NPC Shopkeeper Type to fix an issue with Citizens plugin in Offline-mode servers.
Suggested setting name: default-npc-type
Additional notes:
- Player npc shopkeepers (npc type 'player', and name of the player) cannot be spawned, because the server (for some not yet clear reason) will use an uuid based on the npc's name, which matches and conflicts with the uuid of the player.
- Probably since: CitizensDev/Citizens2@a944c3c
- (Potential other issue: This commit seems to only set the uuid field of the entity, but there are other derived fields that do not get updated accordingly (eg. the string representation of the uuid is cached by the entity)
- It is not yet clear why the npc entity uses an uuid based on its name.
- New NPC's use a random UUID: https://github.com/CitizensDev/Citizens2/blob/master/main/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java#L51
- This UUID is then used for the GameProfile of the Player NPC: https://github.com/CitizensDev/Citizens2/blob/master/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/HumanController.java#L37
- Which is passed to the underlying MC EntityHuman (https://github.com/CitizensDev/Citizens2/blob/master/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/EntityHumanNPC.java), which then should extract the uuid from the GameProfile. An offline uuid is only used if the profile does not provide an uuid.
Another alterantive could be to conditionally check if the server is in offline mode and then fallback to using entitytype villager.
well, seems to be intended: CitizensDev/Citizens2#2404
The next version comes with a setting 'default-citizen-npc-type' (default: 'PLAYER'), which should allow you to resolve this issue. I will close this ticket once that update is released.
I believe it would be nice also if you could set a "default-npc-skin", where the player's skin is by default with no value (because there might be a player's name set to player or null or none, idk), that way you could set a default skin and all npc citizens would be created with a default skin, wouldn't still that work on offline servers? the citizen shopkeeper would be set with a player's username skin by default, not by UUID... idk...
Added in v2.13.0.
I created a separate ticket for the NPC skin suggestion: #745