Events

This page will explain the events fired, when the player places or breaks a LuckyBlock.

When a player break a LuckyBlock, the OpenLuckyBlockEvent will be fired, you can listen for it like that:

	@EventHandler
	public void onOpenLuckyBlock(OpenLuckyBlockEvent e) {
		//get the location of the LuckyBlock
		Location loc = e.getBlock().getLocation();
		//get the location of the player
		Location ploc = e.getBreaker().getLocation();
		//get the LuckyEvent
		LuckyEvent event = e.getLuckyevent();
		//cancel the event
		e.setCancelled(true);
	}

When a player place a LuckyBlock, the PlaceLuckyBlockEvent will be fired, you can listen for it like that:

	@EventHandler
	public void onOpenLuckyBlock(PlaceLuckyBlockEvent e) {
		//get the location of the LuckyBlock
		Location loc = e.getBlock().getLocation();
		//get the location of the player
		Location ploc = e.getPlacer().getLocation();
		//cancel the event
		e.setCancelled(true);
	}

Comments

Posts Quoted:
Reply
Clear All Quotes