Advertisement
Adamki11s

ExampleBlockListener.Java

May 9th, 2011
6,899
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.Adamki11s.Example;
  2.  
  3. import org.bukkit.block.Block;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.event.block.BlockListener;
  6. import org.bukkit.event.block.BlockPlaceEvent;
  7.  
  8. /* Example Template
  9.  * By Adamki11s
  10.  * HUGE Plugin Tutorial
  11.  */
  12.  
  13. public class ExampleBlockListener extends BlockListener{
  14.  
  15.     //You HAVE to have this!
  16.     public static Example plugin;
  17.    
  18.     public ExampleBlockListener(Example instance) {
  19.         plugin = instance;
  20.     }
  21.     //You HAVE to have this!
  22.  
  23.     public void onBlockPlace(BlockPlaceEvent event){
  24.        
  25.         Player player = event.getPlayer();
  26.         Block block = event.getBlock();
  27.         Material mat = block.getType();
  28.  
  29.         player.sendMessage("You placed a block with ID : " + mat);//Display a message to the player telling them what type of block they placed.
  30.  
  31.     }
  32. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement