ChestShop (iConomyChestShop)

ChestShop (iConomyChestShop)

6M Downloads

Geyser Bedrock * player name compatiblity

kenyonfiguereo opened this issue ยท 24 comments

commented

My server have geyser and floodgate so its a crossplay server, when a player its playing from bedrock he cant create a shop because it says "Player not found".

Players from bedrock have the prefix "*" in their names, i tried changing it and removing it, and didn't work.

Please make it compatible or give me a solution.

commented

I have the same issue as kenyonfiguereo.. Bedrock player can't create shop can you help me what should I change so bedrock player can create shop and buy/sell

commented

I have the same issue as kenyonfiguereo.. Bedrock player can't create shop can you help me what should I change so bedrock player can create shop and buy/sell

The config contains comments regarding what you need to do to get it to work. If it still doesn't work then please use the chat/forum to provide your config and log or open a new issue if you think something is broken.

commented

image

commented

image

Please make sure you have adjusted your settings how it is described in the config comments/the faq. If you hale and it still doesn't work then please open a new issue and provide all the information requested by the template.

commented

This also prevents Floodgate players from buying from/selling to admin shops, which is quite a major problem as well.
Floodgate UUIDs are consistent and, as far as I understand, don't seem to conflict with those of Java accounts (they are generated by appending zeros before the XUID of the Bedrock players to match the length of a Java ID; there's a generator here: https://floodgate-uuid.heathmitchell1.repl.co/).
No other plugins on our server that make use of UUIDs have had any issues with Floodgate players, however I do not have a deep understanding of how ChestShop uses UUIDs, so sorry if this information is redundant/useless to you. It would be really great if compatibilty between ChestShop and Geyser/Floodgate could be introduced though, so if you think I could provide you with any additional information that would help you accomplish this (without me having any coding knowledge myself), then please just say the word.

commented

Now if I do as the message says, set ENSURE_CORRECT_PLAYERID to false in config.yml, I can successfully create the shop:
[Craft Scheduler Thread - 26/INFO]: [ChestShop] *MagnoBooter created a shop - 4 <MyItem> - B 1 - at [MyWorld] <X>, <Y>, <Z>

Do you mean that this now works and the issue doesn't happen anymore? Or is there still some issue with Geyser?

commented

Just wanted to confirm this problem, I'm getting this when I (as a Bedrock user) try to create a shop:

[10:16:29] [Server thread/WARN]: java.lang.IllegalArgumentException: Invalid OfflinePlayer! 00000000-0000-0000-0009-01f273f16e94 is not of server version 4
[10:16:29] [Server thread/WARN]:        at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
[10:16:29] [Server thread/WARN]:        at com.Acrobot.ChestShop.UUIDs.NameManager.getOrCreateAccount(NameManager.java:82)
[10:16:29] [Server thread/WARN]:        at com.Acrobot.ChestShop.UUIDs.NameManager.getOrCreateAccount(NameManager.java:68)
[10:16:29] [Server thread/WARN]:        at com.Acrobot.ChestShop.Listeners.PreShopCreation.NameChecker.handleEvent(NameChecker.java:41)
[10:16:29] [Server thread/WARN]:        at com.Acrobot.ChestShop.Listeners.PreShopCreation.NameChecker.onPreShopCreationHighest(NameChecker.java:29)
[...]

After the Improve UUID version handling commit on Nov 16, the message changes slightly, to:

[Server thread/WARN]: java.lang.IllegalArgumentException: Invalid OfflinePlayer! 00000000-0000-0000-0009-01f273f16e94 has version 0 and not server version 4. If you believe that is an error and your setup allows such UUIDs then set the ENSURE_CORRECT_PLAYERID config option to false.

Now if I do as the message says, set ENSURE_CORRECT_PLAYERID to false in config.yml, I can successfully create the shop:
[Craft Scheduler Thread - 26/INFO]: [ChestShop] *MagnoBooter created a shop - 4 <MyItem> - B 1 - at [MyWorld] <X>, <Y>, <Z>

commented

I will do some more testing (I've only tried to create a shop, not sell/buy from others' shops), but so far it looks like setting ENSURE_CORRECT_PLAYERID to false solves the problem.
The culprit is the dependency on the UUID version. Why do you depend on its value?

commented

Why do you depend on its value?

It's necessary due to a quirk of the Bukkit API: If it can't find player information for a username It returns an OfflinePlayer object with an offline mode UUID (version 3, generated from the user name). The check ensures that it matches the server's normal mode so that a player doesn't miss out on money if they are offline and the server isn't able to find their data when a trade occurs.

commented

So the UUID changes when a player goes offline? That is really weird, a UUID should be a unique, permanent identifier that should not change whether a player is online or not...
Or maybe I didn't get this right: "can't find player information for a username" When does this occur? When a player is not online (playing on the server)?

commented

So the UUID changes when a player goes offline? That is really weird, a UUID should be a unique, permanent identifier that should not change whether a player is online or not...
Or maybe I didn't get this right: "can't find player information for a username" When does this occur? When a player is not online (playing on the server)?

No, the server generates an offline mode UUID in certain cases e.g. if they aren't online and can't find them in the usercache.json.

commented

To add to this, I installed one of the dev builds that allows me to change the ENSURE_CORRECT_PLAYERID setting, thus allowing for Bedrock clients to create their shop. My issue now is that Bedrock players still cannot buy/sell from admin shops, they always get a "You do not have permission to do that!" error. LuckPerms verbose logs only show the chestshop.adminshop permission node firing, and no setting seems to correct this issue. Even giving the player OP status they still receive the permission message from ChestShop, what exactly is it that ChestShop is checking internally that is preventing these players from accessing the shops?

commented

Checking the permission checker class here https://github.com/ChestShop-authors/ChestShop-3/blob/fd81bc143e02363092d2e0ae1a9474663a4d173c/src/main/java/com/Acrobot/ChestShop/Listeners/PreTransaction/InvalidNameIgnorer.java
it seems that the regex pattern used does not match the Bedrock clients when using the default '*' Prefix. If I changed this to an '' would you expect things to work, since that pattern will match usernames with an ''?

commented

Checking the permission checker class here https://github.com/ChestShop-authors/ChestShop-3/blob/fd81bc143e02363092d2e0ae1a9474663a4d173c/src/main/java/com/Acrobot/ChestShop/Listeners/PreTransaction/InvalidNameIgnorer.java
it seems that the regex pattern used does not match the Bedrock clients when using the default '*' Prefix. If I changed this to an '' would you expect things to work, since that pattern will match usernames with an ''?

That listener is there to avoid players being able to use usernames that are not a valid official Minecraft account name to avoid any potential issues that might arise from invalid name usage on the sign. There would need to be a separate config option to allow invalid names and it could just not check the USERNAME_PATTERN if that option is enabled.

And the regex in the ChestShopSign class would need to be adjusted dynamically based on that option too.

commented

Figured I would add to this ticket rather than a new ticket, as its likely the same issue. When changing the prefix to '_' for Geyser and setting ENSURE_CORRECT_PLAYERID to false, Bedrock players cannot buy from other player shops, they can however buy from Admin Shops now. I have two different Java accounts, each created a player shop. The bedrock client receives the "You cannot trade with shops that you have access to!" message on both of the Java players shops.

Java players can buy from shops created by Bedrock players however.

commented

Figured I would add to this ticket rather than a new ticket, as its likely the same issue. When changing the prefix to '_' for Geyser and setting ENSURE_CORRECT_PLAYERID to false, Bedrock players cannot buy from other player shops, they can however buy from Admin Shops now. I have two different Java accounts, each created a player shop. The bedrock client receives the "You cannot trade with shops that you have access to!" message on both of the Java players shops.

Java players can buy from shops created by Bedrock players however.

That doesn't make much sense tbh., that message only shows when the player has access to the shop (e.g. when they have access permissions or are the owner of the shop which is done with a UUID match and a name match as fallback if no account for the shop owner was found). Make sure that they don't actually have permission to access other player's shops.

It is highly unlikely this has anything to do with Geyser unless they somehow managed to fuck up player names/UUIDs but I highly doubt that.

commented

@TerdyTheTerd @kenyonfiguereo @Keeg-Turner
I've written a PR #410 that should make ChestShop work for Floodgate users. If you want to test, please try the release candidate here: https://github.com/MagnoBooter/ChestShop-3/releases/tag/RC1
Let me know if it works, and please report any bugs! Would be nice to fix them before the PR gets merged ๐Ÿ˜ƒ

commented

Thanks for pointing that out, @Keeg-Turner. Good to hear it's working! ๐Ÿ˜ƒ
I've updated the RC1 description, and even improved the regexp a bit, using clever advice from the maintainer (@Phoenix616).

commented

@MagnoBooter I can confirm that this works like a charm! With this build and the correct settings, Floodgate players are now able to create their own shops and buy from those of others (including admin shops). Thank you so much for this!

There is one little thing I'll point out: in your explanation on GitHub, you said that the regex should be ^[*]*\\\\w+$ when it's supposed to be ^[*]*\\w+$ (it's correctly noted in the config though).

commented

Yes, but the thing is, not everyone who plays at Bedrock has a Java account, or a computer.

Is there anything else I can do?

You would have to take a look at the Geyser config to see if they have an option to only use valid usernames. (Or propose an actual way for ChestShop to better handle that either in the form of a PR or a properly outlined idea. I may get around to that eventually when I find the time for it but any help is obviously appreciated)

I've seen these options in config.yml and I don't know if they might have something to do with it:

# Do you want to deny shop access to unlogged users?
#AUTHME_HOOK: false

# Do you want to allow shop access to unregistered users? (Example: registration is optional)
#AUTHME_ALLOW_UNREGISTERED: true

No, these are for the AuthMe plugin.

commented

Geyser should have an option to link Mojang accounts so that people get proper names/uuids. I can't really guarantee that anything but proper UUIDs and playernames will work so I'm a bit wary allowing such a thing.

commented

Yes, but the thing is, not everyone who plays at Bedrock has a Java account, or a computer.

Is there anything else I can do?

I've seen these options in config.yml and I don't know if they might have something to do with it:

# Do you want to deny shop access to unlogged users?
#AUTHME_HOOK: false
# Do you want to allow shop access to unregistered users? (Example: registration is optional)
#AUTHME_ALLOW_UNREGISTERED: true
commented

so this does work right ๐Ÿ˜„ . and it will work on 1.16.4?

commented

The plugin is for everything above 1.13