Java Code Examples for org.bukkit.Material#CARPET

The following examples show how to use org.bukkit.Material#CARPET . 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: WrappedBlock7.java    From Hawk with GNU General Public License v3.0 5 votes vote down vote up
private boolean isReallySolid(Block b) {
    boolean reallySolid = block.getMaterial().isSolid();
    if (b.getType() == Material.CARPET || b.getType() == Material.WATER_LILY) {
        reallySolid = true;
    }
    return reallySolid;
}
 
Example 2
Source File: WrappedBlock8.java    From Hawk with GNU General Public License v3.0 5 votes vote down vote up
private boolean isReallySolid(Block b) {
    boolean reallySolid = block.getMaterial().isSolid();
    MaterialData matData = b.getState().getData();
    if (matData instanceof Sign || matData instanceof Banner)
        reallySolid = false;
    else if (matData instanceof FlowerPot || matData instanceof Diode || matData instanceof Skull ||
            b.getType() == Material.CARPET || matData instanceof Ladder ||
            b.getType() == Material.REDSTONE_COMPARATOR || b.getType() == Material.REDSTONE_COMPARATOR_ON ||
            b.getType() == Material.REDSTONE_COMPARATOR_OFF || b.getType() == Material.SOIL ||
            b.getType() == Material.WATER_LILY || b.getType() == Material.SNOW || b.getType() == Material.COCOA) {
        reallySolid = true;
    }
    return reallySolid;
}
 
Example 3
Source File: MapRatingsMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onButtonClick(final InventoryClickEvent event) {
    ItemStack stack = event.getCurrentItem();
    final MatchPlayer player = this.getMatch().getPlayer(event.getWhoClicked());

    if(stack == null || player == null) return;
    if(stack.getType() != Material.WOOL && stack.getType() != Material.CARPET) return;
    ItemMeta meta = stack.getItemMeta();
    if(!meta.hasDisplayName()) return;
    String name = meta.getDisplayName();
    if(!name.startsWith(BUTTON_PREFIX)) return;

    event.setCancelled(true);

    final int score = stack.getAmount();
    if(!isScoreValid(score)) return;

    this.getMatch().getScheduler(MatchScope.LOADED).createTask(() -> {
        Integer oldScore = playerRatings.get(player);
        if(oldScore == null || oldScore != score) {
            player.playSound(Sound.UI_BUTTON_CLICK, 1, 2);
            rate(player, score);
        }
        else {
            player.getBukkit().closeInventory();
        }
    });
}