Jumper251 / AdvancedReplay

Minecraft plugin to record players on your server
GNU General Public License v3.0
146 stars 59 forks source link

Api improvements, Now 1.8server->1.17+clients compatible #95

Closed MrF1yn closed 2 years ago

Jumper251 commented 2 years ago

What is the purpose of handleButtons? Is there any reason you changed the position of executeTick(0, false);

MrF1yn commented 2 years ago

Well the purpose of handleButtons is to allow a third party addon to handle the replay inventory. So he could setHandleButtons to true and then he can proceed to modify the players inventory with his custom buttons.

And the i changed the executetick line to better represent the timing when it gets called.

MrF1yn commented 2 years ago

Technically one would get around the handleButton part by just clearing the players inventory on replay start event and then add his own items but that means the server spends extra time setting the player's inventory which will eventually get cleared. Therefore when handleButtons is true the plugin will not attempt to set the player's inventory saving performance.

Also this allows for per replay inventory instead of a global inventory defined in the config.

MrF1yn commented 2 years ago

Any update?

Jumper251 commented 2 years ago

I did some tests and I noticed two issues (MC 1.8.8):

  1. Skins of online players do not work.

  2. I don't think the ReplaySessionStartEvent works as intended. If you cancel the event you don't get the items but the replay starts anyway and you cannot leave it. Also there is this error message java.lang.NullPointerException: Cannot read the array length because "items" is null at org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory.setContents(CraftInventory.java:63) ~[patched_1.8.8.jar:git-PaperSpigot-445] at me.jumper251.replay.replaysystem.replaying.ReplaySession.resetPlayer(ReplaySession.java:132) ~[?:?] at me.jumper251.replay.replaysystem.replaying.ReplaySession$1.run(ReplaySession.java:109) ~[?:?] at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[patched_1.8.8.jar:git-PaperSpigot-445] at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:352) [patched_1.8.8.jar:git-PaperSpigot-445] at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:783) [patched_1.8.8.jar:git-PaperSpigot-445] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [patched_1.8.8.jar:git-PaperSpigot-445] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched_1.8.8.jar:git-PaperSpigot-445] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched_1.8.8.jar:git-PaperSpigot-445] at java.lang.Thread.run(Unknown Source) [?:?]