Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-4647

Cancelling VehicleDamage on boat doesn't prevent "knockback" velocity

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Windows 10 Pro

    • This server is running CraftBukkit version git-Spigot-3cb9dcb-0f708cb (MC: 1.13.2) (Implementing API version 1.13.2-R0.1-SNAPSHOT)
    • Yes

      When a sprinting player leftclicks a boat and the VehicleDamageEvent it calls gets cancelled, the boat doesn't receive any damage, but it does however get receive the "damage knockback" velocity.

      I'm not exactly sure why this is caused, but I might have found the cause, which could be in the 

      boolean damageEntity(DamageSource damagesource, float f)

      of EntityBoat.

      In this method, it basically calls the event:

      VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double)f);
      this.world.getServer().getPluginManager().callEvent(event);
      if (event.isCancelled()) {
          return true;
      } else // Handle stuff here
      

      Hower, as you can see it returns true. I think it should actually return false there for the event to be cancelled correctly. If I use the IntelliJ java debugger to force return false here, the knockback is gone and it appears to work correctly. Though... I'm not sure if returning false has potentially other damaging effects on other plugins or whatsoever, for me it fixed the problem of this issue though

            Unassigned Unassigned
            KoekenMeneer KoekenMeneer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: