sjavi4 / PlayerDoll

Fake Player Plugin for Spigot Paper Folia
38 stars 0 forks source link

bungeecord not supported #28

Closed cgw2023 closed 2 months ago

cgw2023 commented 6 months ago

problem

bungeecord not supported, seems like is because bungeecord have ip forwarding, and the fake player joins with the direct local ip+port, instead of the bungeecord ip+port

error

 issued server command: /doll spawn one
[22:14:48 INFO]: [PlayerDoll] Doll Config [-one] Saved Successfully.
[22:14:48 INFO]: [PlayerDoll] Fake Client connected to Server
[22:14:48 INFO]: [PlayerDoll] Client Connected
[22:14:48 INFO]: [PlayerDoll] Client Disconnected, If you wish to use IP forwarding, please enable it in your BungeeCord config as well!
[22:14:48 INFO]: [PlayerDoll] Client Disconnected, End of stream
[22:14:48 INFO]: /127.0.0.1:57124 lost connection: If you wish to use IP forwarding, please enable it in your BungeeCord config as well!

proposed solution flow

1.add a setting in the config to define ip and port for the fake player packet to send

2.create a bungeecord addon plugin that link between bungeecord and server plugin by pluginmessaging ( a key:value message with fake player name: bungeecord server name)

3.when doll is created and got spawn in bungeecord mode, plugin join the doll by connecting to the server according to the given ip and port in config, and send plugin message to the bungeecord addon plugin

  1. when fake player is joined, bungeecord login event trigger and check whether the player name is same as the doll

  2. if it is a doll, send the fake player to the corresponding bungeecord server according to the pluginmessage

sjavi4 commented 6 months ago

Thank you for the solution, it does helped. After some days of research. A test version has been published. https://github.com/sjavi4/PlayerDoll/releases/tag/test Use and Test this plugin with cautious. Report if any problem encountered

cgw2023 commented 6 months ago

Thank you for the hard work, very appreciate for your help.

sometimes the doll cannot be spawn, it show "Wrong Joining", seems like it is a Mojang message I also see that even I got the doll name as "one", but the server recognize it as username = "0" during login, however when I see the doll in game, the name is normal 0[/192.168.0.9:60648] the 0

I need to retype the command 2-3 times for the doll to successfully join the server without instantly offline

Doll die and then they will be disconnected, is it normal?

issued server command: /doll spawn one
[16:51:20 INFO]: [PlayerDoll] Doll Config [-one] Saved Successfully.
[16:51:20 INFO]: [PlayerDoll] Fake Client connected to Server
[16:51:20 INFO]: [PlayerDoll] Client Connected
[16:51:20 INFO]: [PlayerDoll] BungeeCord Connection
[16:51:20 INFO]: [PlayerDoll] Finding Bungee Connection
[16:51:22 INFO]: [PlayerDoll] Setup Compression for Fake Client
[16:51:22 INFO]: UUID of player 0 is 91bc6dab-cb76-46af-97a3-e33507acfb8c
[16:51:22 INFO]: [PlayerDoll] Fake Client Handle Client GameProfile
[16:51:22 INFO]: [PlayerDoll] Handle Fake Client Configuration
[16:51:22 INFO]: [PlayerDoll] Did not capture this Doll, please Respawn
[16:51:22 INFO]: 0[/192.168.0.9:60648] logged in with entity id 534 at ([world]10.5, 69.0, -3.5)
[16:51:22 INFO]: 0 lost connection: Wrong Joining
[16:51:22 INFO]: [PlayerDoll] Client Disconnected, Wrong Joining
[16:51:22 INFO]: [PlayerDoll] Client Disconnected, End of stream

image image image

sjavi4 commented 6 months ago

sometimes the doll cannot be spawn, it show "Wrong Joining", seems like it is a Mojang message

Wrong Joining is a message implies that the joining is not captured by the plugin. Then the player will be kicked since it is not the same Entity type of Doll.

I also see that even I got the doll name as "one", but the server recognize it as username = "0" during login, however when I see the doll in game, the name is normal 0[/192.168.0.9:60648] the 0

During BungeeCord Connection, Name cannot contain invalid character (the "-") while making login attempt. Therefore, i used single letter name as their temporary name to deal with login procedure. Since there is no player using single letter username.

I need to retype the command 2-3 times for the doll to successfully join the server without instantly offline

This problem might be difficult to solve, once BungeeCord finished login process, it will immediately send a packet to Minecraft server and start up a proxy connection by making client intent, ServerHello packet. Once the server received ServerHello, it enters the login phase, and there is no ways to stop or waiting the client to accept any new packets for continuation. (Because of this, i don't know how to stably capture the connection)

In my test, this sometimes happen when the first doll joins the server, after that, should become less likely to occur.

UUID of player 0 is 91bc6dab-cb76-46af-97a3-e33507acfb8c

Therefore, This message will always pop up.

Although BungeeCord logs the doll as single character, but it will resume their name after a successful join. (can be checked by /glist , /find)

Doll die and then they will be disconnected, is it normal?

yes, to be like Carpet Mod.

sjavi4 commented 6 months ago

There might be a better way to handle the BungeeCord connection, but it will take time. 😢

sjavi4 commented 6 months ago

There might be a better way to handle the BungeeCord connection, but it will take time. 😢

After skimming ViaVersion's source code about BungeeCord injector, there might be a more stable way to do the proxy connection

sjavi4 commented 6 months ago

@cgw2023 Sadly, this will be a won't fix issue. :( and it is not that fatal actually, spawn again could solve. (Maybe another apporach could fix this on one day)

sjavi4 commented 6 months ago

@cgw2023 v1.26.1 (https://modrinth.com/plugin/playerdoll/version/YsrX7x16) has released, another connection approach is used, hope it solve your problem.

cgw2023 commented 4 months ago

@cgw2023 v1.26.1 (https://modrinth.com/plugin/playerdoll/version/YsrX7x16) has released, another connection approach is used, hope it solve your problem.

i see there are two jar PlayerDollBungee and PlayerDoll , do i have to put PlayerDollBungee to bungeecord and PlayerDoll to folia for bungeecord environment to work?

sjavi4 commented 4 months ago

i see there are two jar PlayerDollBungee and PlayerDoll , do i have to put PlayerDollBungee to bungeecord and PlayerDoll to folia for bungeecord environment to work?

The prior one is optional, for addition feature only (check for duplicate UUID). Which does not affect normal usage

cgw2023 commented 4 months ago

i see there are two jar PlayerDollBungee and PlayerDoll , do i have to put PlayerDollBungee to bungeecord and PlayerDoll to folia for bungeecord environment to work?

The prior one is optional, for addition feature only (check for duplicate UUID). Which does not affect normal usage

i am using playerdoll 1.27.2 in a bungeecord server. I typed /doll create one /doll spawn one

but no playerdoll can be see, am i typing wrong commands? How should i able to create and spawn a playerdoll?

sjavi4 commented 4 months ago

i am using playerdoll 1.27.2 in a bungeecord server. I typed /doll create one /doll spawn one

but no playerdoll can be see, am i typing wrong commands? How should i able to create and spawn a playerdoll?

This connection method is rely on an IP-forward exploit from BungeeCord, if you are using a modified BungeeCord jar which patched the exploit. The server will not process anything.

sjavi4 commented 3 months ago

@cgw2023 A new version 1.29 has released for BungeeCord connection Please read the change logs for 1.29, 1.28.1 and also 1.28 to get the context.

The Server plugin and BungeeCord plugin is provided in this link

https://modrinth.com/plugin/playerdoll/version/PYo9gdCJ

during test, doll connection in BungeeCord mode is working nice. There is still be a Rare case that the doll will fail to join. It should not impact the usage at all.

cgw2023 commented 3 months ago

I am now using velocity because waterfall has reached end of life. Will you add velocity support 😢?

sjavi4 commented 3 months ago

I am now using velocity because waterfall has reached end of life. Will you add velocity support 😢?

@cgw2023 Tested. Using "modern" forward setting could perfectly let Doll connect without any plugin required under clean Velocity. It should also work for "none" mode

All PlayerDoll proxy-related config is no need for Velocity.

sjavi4 commented 2 months ago

@cgw2023 According to the status of other issues. The plugin should works properly in Folia Velocity. And there are some vital updates across this period. Readme and changelog starting from 1.28 - 1.31.1 on Modrinth are available for more contexts.

sjavi4 commented 2 months ago

This issue should be fixed. If you are using a Folia server, please aware of the MapItem ticking issue. https://github.com/sjavi4/PlayerDoll?tab=readme-ov-file#cautions

If your server is not care about cursor update in Maps, a temoprary solution has provided. (This Bug might be hard to fix)