Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.congtubot;
- import java.awt.TextComponent;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class main extends JavaPlugin implements Listener {
- @Override
- public void onEnable() {
- getLogger().info(ChatColor.RED + "Bat plugin - By Congtubot");
- /// thêm cái này.........
- getServer().getPluginManager().registerEvents(this, this);
- }
- @Override
- public void onDisable() {
- getLogger().info(ChatColor.RED + "Plugin Bi Tat - BYE BYE :c");
- }
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
- return false;
- }
- @EventHandler
- public void onDirt(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if (e.getClickedBlock().getType() == Material.WORKBENCH) {
- if(p.hasPermission("p.1")) {
- TextComponent tc = new TextComponent();
- tc.setText("CLICK TO OPEN CRAFT TABLE");
- tc.setColor(ChatColor.AQUA);
- tc.setBold(true);
- tc.setClickEvent(new ClickEvent(Action.RUN_COMMAND,"/workbench"));
- player.spigot().sendMessage(tc);
- //Don't say why i don't use performCommand :v
- }
- }
- if (e.getClickedBlock().getType() == Material.GRASS) {
- if(p.hasPermission("p.1")) {
- p.performCommand("abc");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment