Added Bukkit Player to join/leave events

This commit is contained in:
Norbi Peti 2017-07-09 21:28:26 +02:00
parent fc11b1fa7e
commit cf74a1cb3c
3 changed files with 18 additions and 4 deletions

View file

@ -153,7 +153,7 @@ public abstract class TBMCPlayerBase extends ChromaGamerBase {
// Load in other plugins
Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerLoadEvent(player));
Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerJoinEvent(player));
Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerJoinEvent(player, p));
player.save();
}
@ -163,7 +163,7 @@ public abstract class TBMCPlayerBase extends ChromaGamerBase {
public static void quitPlayer(Player p) {
final TBMCPlayerBase player = playermap.get(p.getUniqueId() + "-" + TBMCPlayer.class.getSimpleName());
player.save();
Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerQuitEvent(player));
Bukkit.getServer().getPluginManager().callEvent(new TBMCPlayerQuitEvent(player, p));
Iterator<Entry<String, TBMCPlayerBase>> it = playermap.entrySet().iterator();
while (it.hasNext()) {
Entry<String, TBMCPlayerBase> entry = it.next();

View file

@ -1,5 +1,6 @@
package buttondevteam.lib.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@ -7,15 +8,21 @@ public class TBMCPlayerJoinEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private TBMCPlayerBase player;
private Player player_;
public TBMCPlayerJoinEvent(TBMCPlayerBase player) {
public TBMCPlayerJoinEvent(TBMCPlayerBase player, Player player_) {
this.player = player;
this.player_ = player_;
}
public TBMCPlayerBase GetPlayer() {
return player;
}
public Player getPlayer() { // :P
return player_;
}
@Override
public HandlerList getHandlers() {
return handlers;

View file

@ -1,5 +1,6 @@
package buttondevteam.lib.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@ -7,15 +8,21 @@ public class TBMCPlayerQuitEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private TBMCPlayerBase player;
private Player player_;
public TBMCPlayerQuitEvent(TBMCPlayerBase player) {
public TBMCPlayerQuitEvent(TBMCPlayerBase player, Player player_) {
this.player = player;
this.player_ = player_;
}
public TBMCPlayerBase GetPlayer() {
return player;
}
public Player getPlayer() {
return player_;
}
@Override
public HandlerList getHandlers() {
return handlers;