Java Code Examples for org.bukkit.Material#LAVA_BUCKET

The following examples show how to use org.bukkit.Material#LAVA_BUCKET . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestItemStackWrapper.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEquality() {
    ItemStack item = new CustomItem(Material.LAVA_BUCKET, "&4SuperHot.exe", "", "&6Hello");
    ItemStackWrapper wrapper = new ItemStackWrapper(item);

    Assertions.assertEquals(item.getType(), wrapper.getType());
    Assertions.assertEquals(item.hasItemMeta(), wrapper.hasItemMeta());
    Assertions.assertEquals(item.getItemMeta(), wrapper.getItemMeta());
    Assertions.assertTrue(SlimefunUtils.isItemSimilar(wrapper, item, true));
}
 
Example 2
Source File: TestItemStackWrapper.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testImmutability() {
    ItemStack item = new CustomItem(Material.LAVA_BUCKET, "&4SuperHot.exe", "", "&6Hello");
    ItemStackWrapper wrapper = new ItemStackWrapper(item);

    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.setType(Material.BEDROCK));
    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.setAmount(3));
    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.setItemMeta(item.getItemMeta()));
    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.addUnsafeEnchantment(null, 1));
    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.hashCode());
    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.clone());
    Assertions.assertThrows(UnsupportedOperationException.class, () -> wrapper.equals(wrapper));
}
 
Example 3
Source File: Materials.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
static boolean isBucket(Material bucket) {
  return bucket == Material.BUCKET
      || bucket == Material.LAVA_BUCKET
      || bucket == Material.WATER_BUCKET
      || bucket == Material.MILK_BUCKET;
}
 
Example 4
Source File: Materials.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
public static boolean isBucket(Material bucket) {
    return bucket == Material.BUCKET || bucket == Material.LAVA_BUCKET || bucket == Material.WATER_BUCKET || bucket == Material.MILK_BUCKET;
}
 
Example 5
Source File: NewItemShop.java    From BedwarsRel with GNU General Public License v3.0 4 votes vote down vote up
private void handleCategoryInventoryClick(InventoryClickEvent ice, Game game, Player player) {

    int catSize = this.getCategoriesSize(player);
    int sizeCategories = this.getInventorySize(catSize) + 9;
    int rawSlot = ice.getRawSlot();

    if (rawSlot >= this.getInventorySize(catSize) && rawSlot < sizeCategories) {
      ice.setCancelled(true);
      if (ice.getCurrentItem().getType() == Material.SLIME_BALL) {
        this.changeToOldShop(game, player);
        return;
      }

      if (ice.getCurrentItem().getType() == Material.BUCKET) {
        game.getPlayerSettings(player).setOneStackPerShift(false);
        player.playSound(player.getLocation(), SoundMachine.get("CLICK", "UI_BUTTON_CLICK"),
            Float.valueOf("1.0"), Float.valueOf("1.0"));
        this.openCategoryInventory(player);
        return;
      } else if (ice.getCurrentItem().getType() == Material.LAVA_BUCKET) {
        game.getPlayerSettings(player).setOneStackPerShift(true);
        player.playSound(player.getLocation(), SoundMachine.get("CLICK", "UI_BUTTON_CLICK"),
            Float.valueOf("1.0"), Float.valueOf("1.0"));
        this.openCategoryInventory(player);
        return;
      }

    }

    if (rawSlot >= sizeCategories) {
      if (ice.isShiftClick()) {
        ice.setCancelled(true);
        return;
      }

      ice.setCancelled(false);
      return;
    }

    MerchantCategory clickedCategory = this.getCategoryByMaterial(ice.getCurrentItem().getType());
    if (clickedCategory == null) {
      if (ice.isShiftClick()) {
        ice.setCancelled(true);
        return;
      }

      ice.setCancelled(false);
      return;
    }

    this.openBuyInventory(clickedCategory, player, game);
  }