Updating listeners

This commit is contained in:
sekwah 2018-01-23 17:44:06 +00:00
parent aca96bb0e3
commit 52f58aa3da
3 changed files with 29 additions and 1 deletions

View File

@ -94,6 +94,6 @@ public class AdvancedPortalsCore {
}
public CoreListeners getCoreListeners() {
return coreListeners;
return this.coreListeners;
}
}

View File

@ -12,10 +12,14 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
public void onEnable() {
this.portalsCore = new AdvancedPortalsCore(new DataStorage(this.getDataFolder()),
new SpigotInfoLogger(this), new CommandRegister(this));
this.getServer().getPluginManager().registerEvents(new Listeners(this), this);
}
public void onDisable() {
this.portalsCore.onDisable();
}
public AdvancedPortalsCore getPortalsCore() {
return portalsCore;
}
}

View File

@ -0,0 +1,24 @@
package com.sekwah.advancedportals.spigot;
import com.sekwah.advancedportals.core.CoreListeners;
import com.sekwah.advancedportals.coreconnector.container.PlayerContainer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class Listeners implements Listener {
private final AdvancedPortalsPlugin plugin;
private final CoreListeners coreListeners;
public Listeners(AdvancedPortalsPlugin plugin) {
this.plugin = plugin;
this.coreListeners = plugin.getPortalsCore().getCoreListeners();
}
@EventHandler
public void onJoinEvent(PlayerJoinEvent event) {
coreListeners.playerJoin(new PlayerContainer(event.getPlayer()));
}
}