Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The package
- package com.bukkit.samkio.Basic;
- //All the imports
- import com.bukkit.samkio.Basic.BasicPlayerListener;
- import org.bukkit.Material;
- import org.bukkit.block.Block;
- import org.bukkit.entity.Player;
- import org.bukkit.event.block.BlockPlaceEvent;
- import org.bukkit.event.block.BlockListener;
- //Start the class BasicBlockListener
- public class BasicBlockListener extends BlockListener{
- public static Basic plugin;
- public BasicBlockListener(Basic instance) {
- plugin = instance;
- }
- //This method is called when ever a block is placed.
- public void onBlockPlace(BlockPlaceEvent event) {
- //Get the player doing the placing
- Player player = event.getPlayer();
- //Get the block that was placed
- Block block = event.getBlockPlaced();
- //If the block is a torch and the player has the command enabled. Do this.
- if(block.getType() == Material.TORCH && BasicPlayerListener.plugin.enabled(player)){
- //Tells the player they have placed a torch
- player.sendMessage("You placed a torch!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement