Java Code Examples for org.bukkit.Material#BURNING_FURNACE

The following examples show how to use org.bukkit.Material#BURNING_FURNACE . 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: GameMap.java    From AnnihilationPro with MIT License 6 votes vote down vote up
public void addEnderFurnace(FacingObject furnace)
{
	MapKey key = MapKey.getKey(furnace.getLocation());
	if(!enderFurnaces.containsKey(key))
	{
		try
		{
			Block block = furnace.getLocation().toLocation().getBlock();
			if(block.getType() != Material.FURNACE && block.getType() != Material.BURNING_FURNACE)
				block.setType(Material.BURNING_FURNACE);
			
			Furnace f = new Furnace(Material.BURNING_FURNACE);
			f.setFacingDirection(furnace.getFacingDirection());
			BlockState s = block.getState();
			s.setData(f);
			s.update(true);
		}
		catch(Exception e)
		{
			
		}
		enderFurnaces.put(key, furnace);
	}
}
 
Example 2
Source File: GameMap.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
	public void signClickCheck(PlayerInteractEvent event)
	{
		if(event.getAction() == Action.RIGHT_CLICK_BLOCK)
		{
			Block b = event.getClickedBlock();
			if(b != null)
			{
				//Bukkit.getLogger().info("Error test 1");
				if(b.getType() == Material.FURNACE || b.getType() == Material.BURNING_FURNACE)
				{
					//Bukkit.getLogger().info("Error test 1");
					MapKey key = MapKey.getKey(b.getLocation());
					if(this.enderFurnaces.containsKey(key))
					{
						//Bukkit.getLogger().info("Error test 2");
						event.setCancelled(true);
						AnniPlayer p = AnniPlayer.getPlayer(event.getPlayer().getUniqueId());
						if(p != null)
						{
//							Bukkit.getLogger().info("Error test 3");
//							if(p.getFurnace() != null)
//							{
//								Bukkit.getLogger().info("Error test 4");
								p.openFurnace();
//							}
//							else
//								Bukkit.getLogger().warning("[Annihilation] Someones enderfurnace was null!");
						}
					}
				}
			}
		}
	}
 
Example 3
Source File: GameMap.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOW,ignoreCancelled = true)
public void signBreakCheck(BlockBreakEvent event)
{
	if(event.getBlock() != null && event.getPlayer().getGameMode() != GameMode.CREATIVE)
	{
		if(event.getBlock().getType() == Material.FURNACE || event.getBlock().getType() == Material.BURNING_FURNACE)
		{
			MapKey key = MapKey.getKey(event.getBlock().getLocation());
			if(this.enderFurnaces.containsKey(key))
				event.setCancelled(true);
		}
	}
}