Java Code Examples for org.bukkit.Material#QUARTZ_ORE

The following examples show how to use org.bukkit.Material#QUARTZ_ORE . 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: Transporter.java    From AnnihilationPro with MIT License 6 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)
public void MoveListeners(PlayerMoveEvent event)
{
	///block under your feet
	Block to = event.getTo().getBlock().getRelative(BlockFace.DOWN);
	if(to.getType() == Material.QUARTZ_ORE)
	{
		Location x = event.getTo();
		Location y = event.getFrom();
		if(x.getBlockX() != y.getBlockX() || x.getBlockY() != y.getBlockY() || x.getBlockZ() != y.getBlockZ())
		{
			AnniPlayer user = AnniPlayer.getPlayer(event.getPlayer().getUniqueId());
			UUID owner = getBlocksOwner(to);
			if(owner != null && user != null)
			{
				Teleporter tele = this.teleporters.get(owner);
				if(tele != null && tele.isLinked() && tele.getOwner().getTeam() == user.getTeam())
				{
					event.getPlayer().sendMessage(ChatColor.AQUA+"This is a teleporter owned by "+ChatColor.WHITE+tele.getOwner().getName()+ChatColor.AQUA+", Sneak to go through it.");
				}
			}
		}
	}
}
 
Example 2
Source File: Transporter.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)
public void Teleport(PlayerToggleSneakEvent event)
{
	if(event.isSneaking())
	{
		Player player = event.getPlayer();
		Block b = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
		if(b.getType() == Material.QUARTZ_ORE)
		{
			UUID owner = getBlocksOwner(b);
			if(owner != null)
			{
				AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
				if(p != null)
				{
					Teleporter tele = teleporters.get(owner);
					if(tele.isLinked() && tele.getOwner().getTeam() == p.getTeam() && tele.canUse())
					{
						Location loc;
						//if(new Loc(b.getLocation()).isEqual(tele.getLoc1()))
						if(tele.getLoc1().equals(b.getLocation()))
							loc = tele.getLoc2().toLocation();
						else
							loc = tele.getLoc1().toLocation();
						loc.setY(loc.getY()+1);
						player.teleport(this.getMiddle(loc));
						loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1);
						tele.getLoc1().toLocation().getWorld().playSound(tele.getLoc1().toLocation(), Sound.ENDERMAN_TELEPORT, 1F,(float)Math.random());
						tele.getLoc2().toLocation().getWorld().playSound(tele.getLoc2().toLocation(), Sound.ENDERMAN_TELEPORT, 1F,(float)Math.random());
						tele.delay();
						event.setCancelled(true);
					}
				}
			}
		}
	}
}
 
Example 3
Source File: Transporter.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)
public void TeleporterProtect(BlockBreakEvent event)
{
	Player player = event.getPlayer();
	Block b = event.getBlock();
	if(b.getType() == Material.QUARTZ_ORE)
	{
		event.setCancelled(true);
		AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
		if(p != null)
		{
			UUID owner = getBlocksOwner(b);
			if(owner == null)
				return;
			
			Teleporter tele = teleporters.get(owner);
			if(p.getID().equals(owner))
			{
				tele.clear();
			}
			else if(p.getTeam() != tele.getOwner().getTeam())
			{
				tele.clear();
				tele.getOwner().sendMessage(ChatColor.AQUA+"Your teleporter was broken by "+p.getTeam().getColor()+p.getName());
			}
		}
	}
}
 
Example 4
Source File: NerfQuartzXPModule.java    From UHC with MIT License 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void on(BlockBreakEvent event) {
    if (!isEnabled() || event.getBlock().getType() != Material.QUARTZ_ORE) return;

    final int count;
    if (higher == lower) {
        count = higher;
    } else {
        count = RANDOM.nextInt(higher - lower + 1) + lower;
    }

    event.setExpToDrop(count);
}