tastybento / ASkyBlock-Bugs-N-Features

Bug Tracker for ASkyBlock and AcidIsland - note team is 100% working on next version BentoBox
6 stars 3 forks source link

IslandNewEvent in API is not working. #544

Closed Pladetor closed 6 years ago

Pladetor commented 6 years ago

Hello, I have tried to make a plugin with the ASkyBlockAPI. I tried listening to the IslandNewEvent that the api provides but whenever I make a new island it is not getting fired at all, no erros in console neither in code and it just doesn't do anything.

Code:

    public void setBorderAroundIslandWhenCreatedNewIsland(IslandNewEvent e)
    {
        Player p = (Player) e.getPlayer();

        int wbradius = e.getProtectionSize();

        Location newIsLocation = e.getIslandLocation();

        this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { wapi.setBorder(p, wbradius, newIsLocation); } }, 20 * 5);
    }

And yes I tried to debug with System out println and yes I have registered the event on my main class.

tastybento commented 6 years ago

I think you forgot the annotation that is required above your listener method.

This plugin works:

package testplug;

import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

import com.wasteofplastic.askyblock.events.IslandNewEvent;

public class Testplug extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        // Done
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable(){
    }

    @EventHandler(priority = EventPriority.NORMAL)
    public void setBorderAroundIslandWhenCreatedNewIsland(IslandNewEvent e)
    {
        getLogger().info("HELLO");
    }
}