diff --git a/src/main/java/org/mcsg/survivalgames/Game.java b/src/main/java/org/mcsg/survivalgames/Game.java index b155400..45e9068 100644 --- a/src/main/java/org/mcsg/survivalgames/Game.java +++ b/src/main/java/org/mcsg/survivalgames/Game.java @@ -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; @@ -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); } @@ -1018,4 +1022,4 @@ public void msgFall(PrefixType type, String msg, String...vars){ } }*/ -} \ No newline at end of file +} diff --git a/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java b/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java new file mode 100644 index 0000000..d05497f --- /dev/null +++ b/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java @@ -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; + } +}