Advertisement
Guest User

com.bukket.samkio.Basic.BasicBlockListener.java

a guest
Jan 20th, 2011
2,945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. //The package
  2. package com.bukkit.samkio.Basic;
  3. //All the imports
  4. import com.bukkit.samkio.Basic.BasicPlayerListener;
  5. import org.bukkit.Material;
  6. import org.bukkit.block.Block;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.block.BlockPlaceEvent;
  9. import org.bukkit.event.block.BlockListener;
  10. //Start the class BasicBlockListener
  11. public class BasicBlockListener extends BlockListener{
  12.      public static Basic plugin;
  13.      public BasicBlockListener(Basic instance) {
  14.          plugin = instance;
  15.     }
  16.      //This method is called when ever a block is placed.
  17.      public void onBlockPlace(BlockPlaceEvent event) {
  18.          //Get the player doing the placing
  19.             Player player = event.getPlayer();
  20.             //Get the block that was placed
  21.             Block block = event.getBlockPlaced();
  22.             //If the block is a torch and the player has the command enabled. Do this.
  23.             if(block.getType() == Material.TORCH && BasicPlayerListener.plugin.enabled(player)){
  24.                 //Tells the player they have placed a torch
  25.             player.sendMessage("You placed a torch!");
  26.             }
  27.         }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement