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

UseCooldownComponent - Crash client or delete item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • This server is running CraftBukkit version 4378-Spigot-e65d67a-8ef9079 (MC: 1.21.3)
    • Yes

      Hello !

      When I try to only modify the cooldonwGroup of UseCooldownComponent.

      In survival : The item is deleted after a quit/join.

      In creative : the client return an error and the item is deleted.

      Short video of the test attached.

      It seems not appearing when I initialize the cooldownSeconds setting with a value superior to 0

      The code to reproduce the issue:

      public class TESTEVENT implements Listener {
      
      
          @EventHandler(priority = EventPriority.HIGH)
          public void onPlayerToggleSneakEvent(PlayerToggleSneakEvent e) {
              if(!e.isSneaking()) return;
      
              Player p = e.getPlayer();
      
              ItemStack item = new ItemStack(Material.BEACON);
              ItemMeta meta = item.getItemMeta();
              UseCooldownComponent useCooldownComponent = meta.getUseCooldown();
              useCooldownComponent.setCooldownGroup(NamespacedKey.fromString("its_a_test"));
              // REQUIRED TO NOT HAVE THE ISSUE useCooldownComponent.setCooldownSeconds(1);
              meta.setUseCooldown(useCooldownComponent);
              item.setItemMeta(meta);
      
              p.getInventory().addItem(item);
          }
      
      
      }
      

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

              Created:
              Updated:
              Resolved: