CentrumGuy / PlayerSimulator

Last working version of PlayerSimulator for Minecraft/Bukkit v1.12
8 stars 8 forks source link

issue of death (migration to 1.15) #2

Open taooceros opened 4 years ago

taooceros commented 4 years ago

Hi, I am trying to modify this program to version 1.15 with the use of the new API.

I replaced most of the code inside the method called a(NetworkManager networkmanager, EntityPlayer entityplayer, PlayerList pl) with the new code from playerlist a(NetworkManager networkmanager, EntityPlayer entityplayer)

Most of the things goes fine, and I actually can spawn the fakeplayer. However, the fakeplayer cannot be killed.

Could you give me a idea about how you have implement that before?

CentrumGuy commented 4 years ago

I don't believe that I included any special implementation for the killing of a fake player. I think that Minecraft automatically gives players a couple seconds of invincibility when they join a server to prevent spawn killing. With that being said, you should be able to damage the fake players a couple seconds after you spawn them. Once killing them, my implementation for respawning them can be seen in the Listeners.java file under onDeath(PlayerDeathEvent e). My implementation forces them to click the "Respawn" button 10 ticks after dying. Without this implementation, a bot will stay dead after being killed and you would have to kick them and make them rejoin the server to respawn them.

taooceros commented 4 years ago

Thanks for replying!

I have test the death event in my computer more. I have only find one way to "kill" the bot, by using bow with power 4 or 5 to kill the entity by one shot. However, although it seems like I have killed the entity, I haven't. When I tried to shout to the position of the entity of the bot, the arrow will disappear, showing that it has been shot to an disappeared "entity". I have added a log inside the death event, while the entity die doesn't trigger the death event.

I would like to ask the application in 1.12 while I don't have used that version. When spawning a fake player, can you use command, such as tp, give, kill, etc., to control the player? When I tried to do it, the system will give me a error, "No entity/player was found". As a result, I want to check whether there may be some issues under the spawn event I modified.

CentrumGuy commented 4 years ago

Ahhh I understand. That is because the fake player's connection "Times Out". Unfortunately that's one bug I was never able to solve. Minecraft automatically times out the fake connection after around 30 seconds of the player joining. Maybe you could try to fix it. If you do, let me know and I'll merge your changes with the master branch.

taooceros commented 4 years ago

I will take a look on it. I think my situation is slightly different while when I do the action, I don't notice that there are time out situation. Probably because of when I migrate the process, some code is for 1.12 but some is copied from the 1.15. I will take a look on the fake connection lost issue after I figure out why my fake player is different from yours and modify the code with the new api. Thanks for replying!

Profeer commented 3 years ago

I will take a look on it. I think my situation is slightly different while when I do the action, I don't notice that there are time out situation. Probably because of when I migrate the process, some code is for 1.12 but some is copied from the 1.15. I will take a look on the fake connection lost issue after I figure out why my fake player is different from yours and modify the code with the new api. Thanks for replying!

Tried to convert to 1.16, for some reason bot cant get it to work, no error, console says [14:50:14] [Server thread/WARN]: Something's taking too long! 'root.nextTickWait' took aprox 1502.7599 ms [14:50:14] [Server thread/WARN]: Something's taking too long! 'root' took aprox 1504.6895 ms i mean join/leave messages work for bots but i cant see them and they are not as entitys because cant teleport to them.

Could you share your 1.15 bot.java? Mine for 1.16 https://ghostbin.co/paste/5grzhr I tried to convert it to 1.14 ages ago, and now i came back to it trying to convert it to 1.16 with no luck