1.17.1 Setting canPlaceOn and canBreak

Discussion in 'Spigot Plugin Development' started by devJordan, Dec 11, 2021.

  1. Hey there, so from doing some research I understand that this is not possible using the spigot api but it is with papermc api, so I have switched for this simple plugin only to do so.

    I am trying to set canPlaceOn at the moment using paper's setPlaceableKeys but am having trouble because I'm not at all familiar with namespacedkeys and haven't been able to find and good resources on learning about them, the task seems simple.

    Code (Text):
        @EventHandler
        public void onGoldPickup(EntityPickupItemEvent event) {
            System.out.println("Pickup seen");
            if (event.getEntity().getType() != EntityType.PLAYER) return;
            System.out.println("Pickup is player");
            if (event.getItem().getItemStack().getType() == Material.GOLD_BLOCK) {
                System.out.println("Pickup is gold block");
                event.getItem().getItemStack().getItemMeta().setPlaceableKeys();
            }
        }
    this is what I have, however within setPlaceableKeys() I have no idea where to go from there if anyone would be so kind to help me? (I know this isn't a paper thread but the issue is more with namespacedkeys than it is with anything)