Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PlayerWinEvent.java, calling event at the end of Game.playerWin(Player) #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/org/mcsg/survivalgames/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.bukkit.plugin.Plugin;
import org.mcsg.survivalgames.MessageManager.PrefixType;
import org.mcsg.survivalgames.api.PlayerJoinArenaEvent;
import org.mcsg.survivalgames.api.PlayerWinEvent;
import org.mcsg.survivalgames.hooks.HookManager;
import org.mcsg.survivalgames.logging.QueueManager;
import org.mcsg.survivalgames.stats.StatsManager;
Expand Down Expand Up @@ -644,6 +645,9 @@ public void playerWin(Player p) {
loadspawns();
LobbyManager.getInstance().updateWall(gameID);
MessageManager.getInstance().broadcastFMessage(PrefixType.INFO, "broadcast.gameend", "arena-"+gameID);

PlayerWinEvent winEvent = new PlayerWinEvent(p, this);
Bukkit.getPluginManager().callEvent(winEvent);

}

Expand Down Expand Up @@ -1018,4 +1022,4 @@ public void msgFall(PrefixType type, String msg, String...vars){
}

}*/
}
}
36 changes: 36 additions & 0 deletions src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.mcsg.survivalgames.api;

import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.mcsg.survivalgames.Game;



public class PlayerWinEvent extends Event {

private static final HandlerList handlers = new HandlerList();
private Player player;
private Game game;

public PlayerWinEvent(Player p, Game g) {
player = p;
game = g;
}

public Player getPlayer() {
return player;
}

public Game getGame() {
return game;
}

public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}