Lisenochek

Untitled

Sep 28th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package com.realistic.signals;
  2.  
  3. import java.util.Random;
  4.  
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.block.Block;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.block.BlockPlaceEvent;
  11.  
  12. import com.realistic.api.MessageManager;
  13. import com.realistic.api.MessageManager.MsgType;
  14. import com.realistic.config.configMessage;
  15. import com.realistic.list.MinecraftList;
  16.  
  17. public class Handler_CommonSignal implements Listener {
  18.  
  19. @SuppressWarnings("deprecation")
  20. @EventHandler
  21. public static void dropCommon(BlockPlaceEvent e) {
  22.  
  23. Player p = e.getPlayer();
  24. Block b = e.getBlockPlaced();
  25.  
  26. if (e.isCancelled()) {
  27. return;
  28. }
  29.  
  30. if (e.getBlockPlaced().getTypeId() == 76) {
  31.  
  32. if (p.getItemInHand().getItemMeta().getDisplayName() != null
  33. && p.getItemInHand().getItemMeta().getDisplayName()
  34. .equalsIgnoreCase(ChatColor.GOLD + ChatColor.BOLD.toString() + "Сигнальная шашка")) {
  35.  
  36. MinecraftList.commonSignal.put(new StringBuilder().append(new Random().nextInt(5000)).toString(),
  37. b.getLocation());
  38.  
  39. MessageManager.getManager().msg(p, MsgType.SUCCESS,
  40. configMessage.messageConfig.getString("signal_enable"));
  41. }
  42. }
  43. }
  44. }
Add Comment
Please, Sign In to add comment