Advertisement
DSHunterMC

Untitled

Nov 24th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. EventsClass :
  2. package com.The_Chipmunks_Plugin.Events;
  3.  
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.Location;
  6. import org.bukkit.Material;
  7. import org.bukkit.block.Block;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.block.BlockPlaceEvent;
  12. import net.md_5.bungee.api.ChatColor;
  13.  
  14. public class EventsClass implements Listener {
  15.  
  16. @EventHandler
  17. public void onPlace(BlockPlaceEvent event) {
  18.  
  19. Player player = event.getPlayer();
  20. Block block = event.getBlock();
  21. Location blockLocation = event.getBlock().getLocation();
  22.  
  23. if (block.getType().equals(Material.TNT) || block.getType().equals(Material.LAVA_BUCKET) || block.getType().equals(Material.FLINT_AND_STEEL)) {
  24.  
  25. player.sendMessage(ChatColor.DARK_RED + "You are placing a dangerous material: " + ChatColor.DARK_RED + "" + ChatColor.BOLD + block + ChatColor.DARK_RED + ", at: " + blockLocation.getBlockX() + " " + blockLocation.getY() + " " + blockLocation.getZ());
  26. Bukkit.broadcastMessage(ChatColor.DARK_RED + "WARNING!!! " + ChatColor.UNDERLINE + player.getDisplayName() + ChatColor.RESET + ChatColor.DARK_RED + ChatColor.ITALIC + "(" + player.getName() + ")" + ChatColor.RESET + ChatColor.DARK_RED + " is placing " + block + " at: " + blockLocation.getBlockX() + " " + blockLocation.getY() + " " + blockLocation.getZ());
  27.  
  28. }
  29.  
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement