Doesn't display text when the event is executed

Discussion in 'Plugin Development' started by KoT_B_MaMe, May 27, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    KoT_B_MaMe

    Hi all. I am quite new to plugin development. I'm trying to create a very simple plugin, which should write text to the player when the player enters and display the second text when the right mouse button is pressed. Here is the code:

    package spamshit.yadebil;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;


    public final class Yadebil extends JavaPlugin {

    @Override
    public void onEnable() {
    getLogger().info("SpamGovno is working!");}
    @Override
    public void onDisable() {
    getLogger().info("SpamGovno is disabled!");}
    @EventHandler
    public void onJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    player.sendMessage(ChatColor.GREEN + "text1");}
    @EventHandler
    public void onItemClick(PlayerInteractEvent e) {
    if(e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
    ItemStack item = e.getItem();
    if(item == null) return;
    if(item.getType() == Material.DIRT){
    e.getPlayer().sendMessage("ты хуесос");
    }
    }
    }
     
  2. Offline

    KarimAKL

  3. Offline

    xpaintall

    why is your class final?
     
  4. Offline

    KoT_B_MaMe

    KarimAKL likes this.
Thread Status:
Not open for further replies.

Share This Page