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

SmithItemEvent not firing in Smithing Table

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • None
    • OS: macOS 13.4.1 Ventura and Linux

      openjdk 17.0.4.1 2022-08-12 LTS

      OpenJDK Runtime Environment Zulu17.36+17-CA (build 17.0.4.1+1-LTS)

      OpenJDK 64-Bit Server VM Zulu17.36+17-CA (build 17.0.4.1+1-LTS, mixed mode, sharing)

    •  This server is running CraftBukkit version 3815-Spigot-64b565e-9f64f0d (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT)
    • Yes

      When listening to a SmithItemEvent in Spigot, nothing happens, the code in the event handler does not run:

      public class SmithItemListener implements Listener {
      
      Plugin plugin;
      
      public SmithItemListener(Plugin plugin) {
          this.plugin = plugin;
          plugin.getServer().getPluginManager().registerEvents(this, plugin);
      }
      
      /**
      * Does not get fired.
      * @param e
      */
      @EventHandler
      public void onSmith(SmithItemEvent e) {
          plugin.getLogger().info("Smith");
      }
      
      /**
      * Works as normal, proves that this class is in fact a registered Listener.
      * @param e
      */
      @EventHandler
      public void onPrepareSmith(PrepareSmithingEvent e) {
          plugin.getLogger().info("Prepare");
      }
      
      }

      In this case "Prepare" would be outputted to the console like normal, but when taking the finished item out of the result slot, "Smith" is not logged to console.

      Steps to reproduce:

      1. Use sample plugin or create basic SmithItemEvent Listener.
      2. Open a Smithing Table in Minecraft.
      3. Craft a Netherite Sword like in the appended screenshot and take it out of the result slot.
      4. Look in the console, whether "Smith" (from the example code in the SmithEvent Listener) is logged.

       

      The sample plugin is attached as well as the crafting ingredients/step in the Smithing Table.

      I should note that this worked like expected in Spigot 1.19, probably has something to do with the updated Smithing Table behavior in 1.20.

      Console Output with test/sample plugin:

      [16:14:21] [Server thread/INFO]: [SmithItem] Prepare[16:14:21] [Server thread/INFO]: [SmithItem] Prepare[16:14:21] [Server thread/INFO]: [SmithItem] Prepare[16:14:21] [Server thread/INFO]: [SmithItem] Prepare[16:14:21] [Server thread/INFO]: [SmithItem] Prepare[16:14:21] [Server thread/INFO]: [SmithItem] Prepare[16:14:22] [Server thread/INFO]: [SmithItem] Prepare[16:14:22] [Server thread/INFO]: [SmithItem] Prepare[16:14:22] [Server thread/INFO]: [SmithItem] Prepare[16:14:23] [Server thread/INFO]: [SmithItem] Prepare[16:14:23] [Server thread/INFO]: [SmithItem] Prepare[16:14:23] [Server thread/INFO]: [SmithItem] Prepare

       

       

        1. Screenshot 58.png
          139 kB
          Simon Schütt

            Unassigned Unassigned
            Mcsim Simon Schütt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: