Invincible flag bug when riding entities you normally can't outside the protected region
LeeTheTech opened this issue ยท 4 comments
WorldEdit Version
7.3.0
WorldGuard Version
7.0.9
Platform Version
Paper-450 1.20.4
Confirmations
- I am using the most recent Minecraft release.
- I am using a version of WorldEdit compatible with my Minecraft version.
- I am using a version of WorldGuard compatible with my Minecraft version.
- I am using the latest or recommended version of my platform software.
- I am NOT using a hybrid server, e.g. a server that combines Bukkit and Forge. Examples include Arclight, Mohist, and Cardboard.
- I am NOT using a fork of WorldEdit, such as FastAsyncWorldEdit (FAWE) or AsyncWorldEdit (AWE)
Bug Description
I created a pet plugin where the player can ride entities they normally can't. On a very fundamental level the plugin just simply adds the player as a passenger on the entity entity.addPassenger(player)
and has a custom controller for movement. For some reason when a player rides one of these custom pets in a protected region with the flag "invincible" on and then leaves that region they are still invincible, as if they were still in the region. As soon as the player unmounts they'll start taking damage again.
Expected Behavior
I expected to not be invincible when leaving the region on a entity you normally can't ride.
Reproduction Steps
- Create a region with the invincible flag on
- Ride custom entity
entity.addPassenger(player)
in region - Move outside of region while still riding entity and try and take damage
https://gyazo.com/2c611052b8c21bf33c7ade6401295a2f
Optional WorldGuard-Report
No response
Anything Else?
No response
i would guess this is because the platform doesn't throw VehicleMoveEvent for non-Vehicle entities, and since spigot also doesn't have EntityMoveEvent, there's no way for us to track this really.
i would guess this is because the platform doesn't throw VehicleMoveEvent for non-Vehicle entities, and since spigot also doesn't have EntityMoveEvent, there's no way for us to track this really.
Yup, you are 100% correct, resolved it with this code:
@EventHandler
public void onRidingPet(PlayerMoveEvent e) {
if (e.getPlayer().getVehicle() == null) return;
if (!pets.getPetManager().isPet(e.getPlayer().getVehicle())) return;
Bukkit.getServer().getPluginManager().callEvent(new VehicleMoveEvent((Vehicle) e.getPlayer().getVehicle(), e.getFrom(), e.getTo()));
}
Thank you! I'll close this now.
nvm, that did not resolve the problem. Not sure why but it sometimes works correctly, threw me off.