Advertisement
Marcely99

Marcely's Bedwars API Example: ShopGUIBuildEvent

Aug 13th, 2019
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1.     @EventHandler
  2.     public void test(ShopGUIBuildEvent event){
  3.         if(!(event.getGUI() instanceof GUI))
  4.             return;
  5.        
  6.         final GUI gui = (GUI) event.getGUI();
  7.        
  8.         for(int ix=0; ix<9; ix++){
  9.             for(int iy=0; iy<gui.getHeight(); iy++){
  10.                 final GUIItem item = gui.getItemAt(ix, iy);
  11.                
  12.                 if(item == null || item.attachment == null || !(item.attachment instanceof ShopItem))
  13.                     continue;
  14.                
  15.                 final ItemStack is = item.getItemStack(); // final itemstack of the shop item
  16.                 final ItemMeta im = is.getItemMeta();
  17.                
  18.                 im.setLore(new ArrayList<>()); // example: remove its lore
  19.                
  20.                 is.setItemMeta(im);
  21.             }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement