Solved implements Listener??

Discussion in 'Spigot Plugin Development' started by Bruce0203, Oct 6, 2019.

  1. Code (Text):
    public final class BruceLee extends JavaPlugin implements Listener{
    what makes implements Listener on code?
  2. It defines that the Class BruceLee can be used as a Listener

    You can use then
    Code (Java):
    public void onJoin(PlayerJoinEvent event) {
        // DO SOMETHING
    for the PlayerJoinEvent for example.

    After that, you can register the Listener in your Main Class (onEnable) with
    Code (Java):
    Bukkit.getPluginManager().registerEvents(new JoinListenerClass(), this);

    You should create a new class for every new listener.

    Hope this helped you out :)
    English may be not to 100% correct :3
    #2 bayerntvplay, Oct 6, 2019
    Last edited: Oct 6, 2019
    • Friendly Friendly x 1