Guest User

Untitled

a guest
Jan 9th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. package me.congtubot;
  2. import java.awt.TextComponent;
  3.  
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Material;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.event.EventHandler;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.player.PlayerInteractEvent;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. public class main extends JavaPlugin implements Listener {
  15.  
  16. @Override
  17. public void onEnable() {
  18. getLogger().info(ChatColor.RED + "Bat plugin - By Congtubot");
  19. /// thêm cái này.........
  20. getServer().getPluginManager().registerEvents(this, this);
  21. }
  22. @Override
  23. public void onDisable() {
  24. getLogger().info(ChatColor.RED + "Plugin Bi Tat - BYE BYE :c");
  25. }
  26. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  27. return false;
  28. }
  29. @EventHandler
  30. public void onDirt(PlayerInteractEvent e) {
  31. Player p = e.getPlayer();
  32. if (e.getClickedBlock().getType() == Material.WORKBENCH) {
  33. if(p.hasPermission("p.1")) {
  34. TextComponent tc = new TextComponent();
  35. tc.setText("CLICK TO OPEN CRAFT TABLE");
  36. tc.setColor(ChatColor.AQUA);
  37. tc.setBold(true);
  38. tc.setClickEvent(new ClickEvent(Action.RUN_COMMAND,"/workbench"));
  39. player.spigot().sendMessage(tc);
  40. //Don't say why i don't use performCommand :v
  41. }
  42. }
  43.  
  44. if (e.getClickedBlock().getType() == Material.GRASS) {
  45. if(p.hasPermission("p.1")) {
  46. p.performCommand("abc");
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment