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

Cancelling EntityBreedEvent doesn't reset love ticks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • 3092-Spigot-9fb885e-ebe18b9
    • Yes

      This might be controversial whether it is a bug or a feature - decided to report anyway.

      When cancelling the EntityBreedEvent, it keeps firing again. What is more, when it's called and cancelled, it seems to fire immediately again (probably with swapped parents). Resetting love ticks should solve both issues.
      If it's considered a feature, a mention in JavaDocs would be nice.

      Repro:

      core.event('org.bukkit.event.entity.EntityBreedEvent', (event) => {
        event.setCancelled(true);
        global.server.broadcastMessage(`Cancelled entity breed event`);
      });
      

      Logs (notice 2 messages in the same second):

      [18:10:36] [Server thread/INFO]: Cancelled entity breed event
      [18:10:36] [Server thread/INFO]: Cancelled entity breed event
      [18:10:39] [Server thread/INFO]: Cancelled entity breed event
      [18:10:39] [Server thread/INFO]: Cancelled entity breed event
      [18:10:42] [Server thread/INFO]: Cancelled entity breed event
      [18:10:42] [Server thread/INFO]: Cancelled entity breed event
      [18:10:45] [Server thread/INFO]: Cancelled entity breed event
      [18:10:45] [Server thread/INFO]: Cancelled entity breed event
      [18:10:48] [Server thread/INFO]: Cancelled entity breed event
      [18:10:48] [Server thread/INFO]: Cancelled entity breed event
      [18:10:51] [Server thread/INFO]: Cancelled entity breed event
      [18:10:51] [Server thread/INFO]: Cancelled entity breed event
      [18:10:54] [Server thread/INFO]: Cancelled entity breed event
      [18:10:54] [Server thread/INFO]: Cancelled entity breed event
      

      Downstream issue: https://github.com/PaperMC/Paper/issues/5444

            Unassigned Unassigned
            Prof_Bloodstone Prof Bloodstone
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: