Using Events

Here you can view details on how to listen to events using the Plugin API.

In Night Market you can listen to events using the API, this will allow you to listen to events that happen in the plugin. It uses the Bukkit event system so you should be familiar with that.

Examples

Here is an example of a listener class, this will let you be able to listen to events that happen in the plugin. Here is a list of events you can listen here.

import com.olziedev.nightmarket.api.events.market.NightMarketBuyItemEvent;
import com.olziedev.nightmarket.api.player.MPlayer;
import com.olziedev.nightmarket.api.player.MPlayerItem;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class ExampleEvents implements Listener {

    @EventHandler
    public void onMarketBuy(NightMarketBuyItemEvent event) {
        MPlayerItem item = event.getItem();
        MPlayer buyer = event.getBuyer();
    }
}

Last updated