Need help with ChunkEnter listener

Discussion in 'Spigot Plugin Development' started by Msql, May 23, 2016.

  1. Hello, I am trying to create simple listener that will call event, when player steps on different chunk.
    Code (Java):
    package com.Morkaz.skMorkaz.Events.Listeners;

    import java.util.HashMap;

    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerMoveEvent;

    import com.Morkaz.skMorkaz.SkMorkaz;
    import com.Morkaz.skMorkaz.Events.EvtChunkEnter;

    public class ChunkEnterListener implements Listener{
        public HashMap<Player,Long> cooldown = new HashMap<Player,Long>();
        public ChunkEnterListener(SkMorkaz core) {
            core.getServer().getPluginManager().registerEvents(this, core);
        public void onChunkEnter (PlayerMoveEvent event){
            if (event.isCancelled() != false){
                if (event.getFrom().getChunk() != event.getTo().getChunk()){
                    EvtChunkEnter evt = new EvtChunkEnter(event.isCancelled(), event.getTo(), event.getFrom(), event.getTo().getChunk(), event.getFrom().getChunk(), event.getPlayer());
                    if (evt.isCancelled() == true){

    Can some explain me why this does not work :/?
  2. Omg. My bad :x
    I just put
    Code (Java):
    instead of
    Code (Java):
  3. got fixed alreadY ?