No way to detect when a player tramples a turtle egg

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • This server is running CraftBukkit version git-Spigot-fe3ab0d-7c341e9 (MC: 1.13) (Implementing API version 1.13-R0.1-SNAPSHOT)
    • Yes

      At the moment, there's no way to detect when a player tramples a turtle egg.

      Although the following code fires, it fires over 100 times when a player is standing on a turtle egg, and there's no way to distinguish when the egg breaks.

      That is, the event is identical if a player moves on/off an egg and it doesn't break, or if a player moves on an egg and it does break.

      @EventHandler(priority = EventPriority.MONITOR)
      protected void onPlayerInteractEvent(PlayerInteractEvent event) {
        if (event.getAction().equals(Action.PHYSICAL)) {
          if (event.getClickedBlock().getType().equals(Material.TURTLE_EGG)) {
            System.out.println("this triggers approximately 150 times per turtle egg");
            System.out.println(((TurtleEgg) block.getBlockData()).getAsString());
          }
        }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Intelli
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: