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

Crafting recipe is removed from the recipe book on server reload.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • Windows 10
      Running on my local machine from a .bat file

      java -Xmx1024M -Xms1024M -jar spigot-1.18.jar nogui

    • CraftBukkit version 3332-Spigot-a5dea1c-bc14cb6 (MC: 1.18)
    • Yes

      To the best of my knowledge, this affects every version that has a knowledge book in it (1.12+)

      You can reproduce this by running the attached jar file that has a basic recipe that adds a debug stick to the crafting recipe. After adding it reload the server don't restart the server and the recipe won't be added to the player's recipe book. To get the recipe back all you need to do is leave the server and then rejoin and you will have the recipe back,

      Alternatively, you can compile your own plugin with similar code.

      onEnabled Method

      @Override
      public void onEnable() {
          // Create the recipe
          createRecipe();
      
          // Give all online players the recipe
          for (Player p : Bukkit.getOnlinePlayers()) {
              p.discoverRecipe(new NamespacedKey(this, "test"));
          }
      } 

      onJoinEvent Method

      @EventHandler
      public void onJoinEvent(PlayerJoinEvent e) {
          // Give all new players the recipe
          e.getPlayer().discoverRecipe(new NamespacedKey(this, "test"));
      } 

      createRecipe Method

      public void createRecipe() {
          // Create the output item
          ItemStack outputItem = new ItemStack(Material.DEBUG_STICK);
          // Create the recipe key
          NamespacedKey key = new NamespacedKey(this, "test");
          // Create the recipe
          ShapelessRecipe recipe = new ShapelessRecipe(key, outputItem);
      
          // Add the ingredients
          recipe.addIngredient(Material.STICK);
          recipe.addIngredient(Material.COMMAND_BLOCK);
      
          // Tell bukkit about the recipe
          Bukkit.addRecipe(recipe);
      } 

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

              Created:
              Updated: