From cdffb9e28575ac6bb715827f48b7c75f7bf36df3 Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 16 Jun 2013 00:28:21 +0300 Subject: [PATCH 1/4] Create PlayerWinEvent.java To use in Game.playerWin(Player) --- .../survivalgames/api/PlayerWinEvent.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java 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..97f9b99 --- /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 PlayerJoinArenaEvent(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; + } +} From 51d5433fb13ac2864851f7978dc1d3732d1ee875 Mon Sep 17 00:00:00 2001 From: Mitch Date: Sat, 15 Jun 2013 23:30:58 +0200 Subject: [PATCH 2/4] Added PlayerWinEvent to method playerWin(Player) --- src/main/java/org/mcsg/survivalgames/Game.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/mcsg/survivalgames/Game.java b/src/main/java/org/mcsg/survivalgames/Game.java index b155400..9c05756 100644 --- a/src/main/java/org/mcsg/survivalgames/Game.java +++ b/src/main/java/org/mcsg/survivalgames/Game.java @@ -644,6 +644,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 +1021,4 @@ public void msgFall(PrefixType type, String msg, String...vars){ } }*/ -} \ No newline at end of file +} From 281af31d4d916a5ca0baacbb3ccb125130beb81d Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 16 Jun 2013 00:36:15 +0300 Subject: [PATCH 3/4] Fixed constructor --- src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java b/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java index 97f9b99..d05497f 100644 --- a/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java +++ b/src/main/java/org/mcsg/survivalgames/api/PlayerWinEvent.java @@ -13,7 +13,7 @@ public class PlayerWinEvent extends Event { private Player player; private Game game; - public PlayerJoinArenaEvent(Player p, Game g) { + public PlayerWinEvent(Player p, Game g) { player = p; game = g; } From b67a9ca1b5acf18e41d7fdfcdb706f11822ea67d Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 16 Jun 2013 00:39:17 +0300 Subject: [PATCH 4/4] Fixed import of PlayerWinEvent --- src/main/java/org/mcsg/survivalgames/Game.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/mcsg/survivalgames/Game.java b/src/main/java/org/mcsg/survivalgames/Game.java index 9c05756..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;