Text the console when a mob spawns.

Discussion in 'Plugin Development' started by devxyz, Jun 27, 2020.

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


    Can anybody help me? Thanks in advance. I'm trying to get it to text the console when a mob spawns, but it doesn't work.

    Here the code:
    package com.devxyz.ryuautoclick;
    import java.util.ArrayList;
    import java.util.logging.Logger;
    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    //import org.bukkit.entity.Entity;
    import org.bukkit.entity.LivingEntity;
    //import org.bukkit.entity.Monster;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.Zombie;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.CreatureSpawnEvent;
    import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
    import org.bukkit.event.entity.EntitySpawnEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.w3c.dom.events.Event;
    import net.md_5.bungee.api.ChatColor;
    public class Main extends JavaPlugin implements Listener {
        private void msgCS(ChatColor color,String msg) {
        public void onEnable() {
            msgCS(ChatColor.GREEN, "--------------------");
            msgCS(ChatColor.YELLOW, "RyuAutoclick Ativado");
            msgCS(ChatColor.GREEN, "--------------------");
            this.enabledPlayers = new ArrayList<String>();
        public void onDisable() {
            msgCS(ChatColor.RED, "--------------------");
            msgCS(ChatColor.YELLOW, "RyuAutoclick Desativado");
            msgCS(ChatColor.RED, "--------------------");
        protected ArrayList<String> enabledPlayers;
        public final Logger logger = Logger.getLogger("Minecraft");
        public void onSpawn(EntitySpawnEvent e) {
            msgCS(ChatColor.RED, "Spawn");
    Last edited by a moderator: Jun 28, 2020
  2. Offline


    I think its because you forgot to add @EventHandler ontop of the onSpawn event, And you haven't registered your listener
    Last edited: Jun 28, 2020
Thread Status:
Not open for further replies.

Share This Page