games647 / CommandForward

This simple minecraft bukkit-bungee plugin forwards commands to the bungeecord proxy sent from bukkit
https://www.spigotmc.org/resources/commandforward.27580/
MIT License
28 stars 9 forks source link

Update for Folia and add * wild card forwarder #33

Closed AustinGoodrich closed 4 months ago

AustinGoodrich commented 4 months ago

Summary of your change

This will add support for Folia (Paper Fork by PaperMC).

I also added a wildcard for a playername. This will also allow you to mass run forward commands, helpful for moving people to the lobby. Example: /forward * server lobby

Related issue

games647 commented 4 months ago

The question is if that code is thread-safe for the multi-threading in Folia. We cannot mark it as compatible if we didn't check it.I assume it could be compatible, because command processing and the events should be on the same thread. Do you already checked this behavior?

AustinGoodrich commented 4 months ago

I have checked this behavior and haven't found any issues. I'm currently using my fork on my server just fine across 53 different regions. The good thing is players can't be in the same place twice.

games647 commented 4 months ago

The issue with multi-threading is that that it is hard to reproduce an error and it could be very rare. Nevertheless, CommandForward is only operating on commands. Therefore, it should only operate on the Global region task queue ref and access only data owned by it. I see potential issues with the thread-safety of:

hasPermission - However unlikely to be regionized, because typical use case in command handling https://github.com/games647/CommandForward/blob/d97688a480d16668acded70c41174f39ad484557/bukkit/src/main/java/com/github/games647/commandforward/bukkit/Permissions.java#L25

Bukkit.getOnlinePlayers(), because that could be regionized https://github.com/games647/CommandForward/blob/d97688a480d16668acded70c41174f39ad484557/bukkit/src/main/java/com/github/games647/commandforward/bukkit/command/InterceptCommand.java#L32