Java Code Examples for org.bukkit.Material#SIGN

The following examples show how to use org.bukkit.Material#SIGN . 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: MainListener.java    From ArmorStandTools with MIT License 5 votes vote down vote up
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
    Block b = event.getBlock();
    if((b.getType() == Material.PLAYER_HEAD && b.hasMetadata("protected")) || (b.getType() == Material.SIGN && b.hasMetadata("armorStand"))) {
        event.setCancelled(true);
    }
}
 
Example 2
Source File: NMSHandler.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getMaterial(String item) {
	if (item.equalsIgnoreCase("SKULL_ITEM")) {
		return new ItemStack(Material.SKELETON_SKULL, 1);
	} else if (item.equalsIgnoreCase("ENDER_PORTAL_FRAME")) {
		return new ItemStack(Material.END_PORTAL_FRAME, 1);
	} else if (item.equalsIgnoreCase("WORKBENCH")) {
		return new ItemStack(Material.CRAFTING_TABLE, 1);
	} else if (item.equalsIgnoreCase("IRON_FENCE")) {
		return new ItemStack(Material.IRON_BARS, 1);
	} else if (item.equalsIgnoreCase("REDSTONE_COMPARATOR")) {
		return new ItemStack(Material.COMPARATOR);
	} else if (item.equalsIgnoreCase("SIGN_POST")) {
		return new ItemStack(Material.SIGN);
	} else if (item.equalsIgnoreCase("STONE_PLATE")) {
		return new ItemStack(Material.STONE_PRESSURE_PLATE);
	} else if (item.equalsIgnoreCase("IRON_PLATE")) {
		return new ItemStack(Material.HEAVY_WEIGHTED_PRESSURE_PLATE);
	} else if (item.equalsIgnoreCase("GOLD_PLATE")) {
		return new ItemStack(Material.LIGHT_WEIGHTED_PRESSURE_PLATE);
	} else if (item.equalsIgnoreCase("MOB_SPAWNER")) {
		return new ItemStack(Material.SPAWNER);
	} else if (item.equalsIgnoreCase("SNOW_BALL")) {
		return new ItemStack(Material.SNOWBALL);
	} else {
		return new ItemStack(Material.AIR, 1);
	}
}
 
Example 3
Source File: TutorialListener.java    From ServerTutorial with MIT License 5 votes vote down vote up
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    String name = player.getName();
    if (event.getAction() != Action.PHYSICAL) {
        if (TutorialManager.getManager().isInTutorial(name) && TutorialManager.getManager().getCurrentTutorial
                (name).getViewType() != ViewType.TIME) {
            if (TutorialManager.getManager().getCurrentTutorial(name).getTotalViews() == TutorialManager
                    .getManager().getCurrentView(name)) {
                plugin.getEndTutorial().endTutorial(player);
            } else {
                plugin.incrementCurrentView(name);
                TutorialUtils.getTutorialUtils().messageUtils(player);
                Caching.getCaching().setTeleport(player, true);
                player.teleport(TutorialManager.getManager().getTutorialView(name).getLocation());
            }
        }
    }
    if ((event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) &&
            !TutorialManager.getManager().isInTutorial(name)) {
        Block block = event.getClickedBlock();
        if (block.getType() == Material.SIGN || block.getType() == Material.WALL_SIGN) {
            Sign sign = (Sign) block.getState();
            String match = ChatColor.stripColor(TutorialUtils.color(TutorialManager.getManager().getConfigs()
                    .signSetting()));
            if (sign.getLine(0).equalsIgnoreCase(match) && sign.getLine(1) != null) {
                plugin.startTutorial(sign.getLine(1), player);
            }
        }
    }
}
 
Example 4
Source File: Utils.java    From Shopkeepers with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isSign(Material material) {
	return material == Material.WALL_SIGN || material == Material.SIGN_POST || material == Material.SIGN;
}