Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserCache mixin #25

Merged
merged 2 commits into from Mar 16, 2021
Merged

UserCache mixin #25

merged 2 commits into from Mar 16, 2021

Conversation

Kahzerx
Copy link
Contributor

@Kahzerx Kahzerx commented Mar 16, 2021

UserCache not checking onlineMode causing whitelist issues

@Kahzerx
Copy link
Contributor Author

Kahzerx commented Mar 16, 2021

huh?, it failed on getting sources?

@james58899 james58899 merged commit 3bbe8d7 into OKTW-Network:master Mar 16, 2021
Kahzerx added a commit to otakucraft/RusbikMod that referenced this pull request Mar 16, 2021
@keuin
Copy link

keuin commented May 18, 2021

Can you explain why you force the server to query authserver when FabricProxy is configured to use BungeeCord? This fix broke the carpet mod's fake player functionality.

@Kahzerx
Copy link
Contributor Author

Kahzerx commented May 18, 2021

You can add non premium players to the whitelist, i have had issues with that, this does not break carpetmods fake players, but it wont let you summon non premium players, also I'm pretty sure making non premium players join premium servers is against eula.
If the owner of this repo considers there is no need for 1.4.7 to exist, i dont mind if you remove it, and if you want the non premium players to join your server while the owner decides something you can download 1.4.6 version.

~~ also, I'm not forcing the auth server, that true value I return is always true on normal vanilla online mode.

@Kahzerx
Copy link
Contributor Author

Kahzerx commented May 18, 2021

correction with what i have just said, i have just downloaded latest fabric + fabric-carpet, online mode and no bungeecord and it wont let you summon non premium fake players, behaviour does not change between just fabric-carpet and bungeecord with fabric-carpet and proxy. Correct me if I'm wrong, I'm totally able to summon premium fake players.

@keuin
Copy link

keuin commented May 19, 2021

correction with what i have just said, i have just downloaded latest fabric + fabric-carpet, online mode and no bungeecord and it wont let you summon non premium fake players, behaviour does not change between just fabric-carpet and bungeecord with fabric-carpet and proxy. Correct me if I'm wrong, I'm totally able to summon premium fake players.

Thanks for your detailed explanation. I totally agree that your fix is necessary, since if the bungeecord server is online mode, /whitelist command should only add online mode players even if the sub-servers are set to offline mode. That's necessary, because bungeecord does not work with online sub-servers.

However, this fix broke the ability to summon fake players whith offline UUIDs. FWIW, this is essential, because online mode players own their IDs, and if fake players use their IDs, they will occupy what real players are using. I always summon fake players with IDs starting with a prefix like bot_, to make them distinguishable from real players. Buying each fake players a Minecraft account is impractical, right?

I read the EULA again and modding Minecraft is seemed to be allowed literally in Minecraft EULA, and Mojang does not prevent you from adding fake players with offline IDs.

What's more, this fix also break whitelist in offline bungeecord servers, in which all servers and the bungeecord proxy is set to offline mode, and this fix does not know if the bungeecord server is online, which is the real online switch of the whole bungee server. Finally we got a online uuid in offline server, whitelist-ed offline players are not able to join the offline server.

I've tested BungeeCord with Spigot sub-server and they probably not fixed this issue. In my opinion, this fix could be done without affecting these other cases we've described above. We put a new switch called sth like onlineModeWhitelist in FabricProxy's configuration file and query the authserver only if we are adding players to the whitelist and the switch is set to true. This will let fake players use their own names and offline servers are able to use the whitelist correctly. That's my opinion and I will implement that fix in my fork later. Please let me know your consideration, thank you.

@james58899
Copy link
Member

FabricProxy not require set server to offline mode, mod will takeover vanilla login process.

If fake player mod works on vanilla, it should also work with FabricProxy.

@Kahzerx
Copy link
Contributor Author

Kahzerx commented May 19, 2021

I completely agree with you, there is no way for this mod to know if the global bungee mode is true or false, so there will always be an issue of you set it either true or false, we need either a switch or a way to access the bungee config. If you add that configuration you should pull request to fix offline mode servers.

@james58899
Copy link
Member

FabricProxy assumes proxy is online mode, offline mode is unsupported. Why offline mode need this mod?

@Kahzerx
Copy link
Contributor Author

Kahzerx commented May 19, 2021

what keuin means is that fabric-carpet sets the UserCache to false just to summon offlinemode players
https://github.com/gnembon/fabric-carpet/blob/d3aac224ff641d86e936c382f979965064a6d0e3/src/main/java/carpet/patches/EntityPlayerMPFake.java#L40

@Kahzerx
Copy link
Contributor Author

Kahzerx commented May 19, 2021

The fix would be to make fabric proxy execute UserCache.setUseRemote(true); first of all, and make sure when it calls server.isOnlineMode(), that return value is true.

@Kahzerx
Copy link
Contributor Author

Kahzerx commented May 19, 2021

but we shouldn't set a flag to make whitelist always false since that's not expected online mode vanilla behavior, that's not how fabric-carpet works, adds extra steps for the configuration, could bring security issues to the server, and won't break offline servers since why would you use fabric proxy for an offline server anyways.

@james58899
Copy link
Member

I think that is bug of fabric-carpet.
Create offline GameProfile no need UserCache, just new GameProfile().

@keuin Try report issue to fabric-carpet, if they can't fix it, we will add config to workaround this.

@keuin
Copy link

keuin commented May 19, 2021

Yes, I agree with you that this is a carpet feature that fake players can only have online players' name if the server is in online mode. My previous assumption was wrong. @Kahzerx @james58899

I have posted an issue in fabric-carpet to describe this problem. There is no wrong in FabricProxy, and reverting Kahzerx's fix is just a workaround to this problem, although it will break the whitelist.

@keuin
Copy link

keuin commented May 26, 2021

Okay, finally, my pull request has been merged into Carpet Mod's main stream. This fix changed Carpet Mod's default behavior. Carpet now spawns offline-mode fake player no matter if the server is online-mode or offline-mode, if the online-mode player with specified ID does not exist.
Post here to mention someone else that are confused by old Carpet Mod's default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants