|
1 | 1 | package rip.bolt.ingame.pugs; |
2 | 2 |
|
| 3 | +import static net.kyori.adventure.text.Component.empty; |
| 4 | + |
3 | 5 | import java.util.HashSet; |
4 | 6 | import java.util.Locale; |
5 | 7 | import java.util.Set; |
|
15 | 17 | import org.bukkit.event.player.PlayerJoinEvent; |
16 | 18 | import org.bukkit.event.player.PlayerQuitEvent; |
17 | 19 | import rip.bolt.ingame.api.definitions.BoltMatch; |
| 20 | +import rip.bolt.ingame.api.definitions.MatchStatus; |
18 | 21 | import rip.bolt.ingame.api.definitions.pug.PugCommand; |
19 | 22 | import rip.bolt.ingame.api.definitions.pug.PugTeam; |
20 | 23 | import rip.bolt.ingame.commands.PugCommands; |
| 24 | +import rip.bolt.ingame.config.AppData; |
| 25 | +import rip.bolt.ingame.events.BoltMatchResponseEvent; |
21 | 26 | import rip.bolt.ingame.events.BoltMatchStatusChangeEvent; |
| 27 | +import rip.bolt.ingame.utils.Messages; |
| 28 | +import tc.oc.pgm.api.match.Match; |
22 | 29 | import tc.oc.pgm.api.match.event.MatchLoadEvent; |
| 30 | +import tc.oc.pgm.api.match.event.MatchStatsEvent; |
23 | 31 | import tc.oc.pgm.api.party.Competitor; |
24 | 32 | import tc.oc.pgm.api.party.Party; |
25 | 33 | import tc.oc.pgm.api.party.event.PartyRenameEvent; |
@@ -90,6 +98,20 @@ public void onBoltMatchStateChange(BoltMatchStatusChangeEvent event) { |
90 | 98 | pugManager.write(PugCommand.setMatchStatus(match)); |
91 | 99 | } |
92 | 100 |
|
| 101 | + @EventHandler(priority = EventPriority.NORMAL) |
| 102 | + public void onBoltMatchResponse(BoltMatchResponseEvent event) { |
| 103 | + BoltMatch newMatch = event.getResponseMatch(); |
| 104 | + if (!event.hasMatchFinished() || newMatch.getStatus() != MatchStatus.ENDED) return; |
| 105 | + |
| 106 | + Match match = event.getPgmMatch(); |
| 107 | + match.callEvent(new MatchStatsEvent(match, true, true)); |
| 108 | + |
| 109 | + if (AppData.Web.getMatchLink() != null) { |
| 110 | + match.sendMessage(Messages.matchLink(newMatch)); |
| 111 | + match.sendMessage(empty()); |
| 112 | + } |
| 113 | + } |
| 114 | + |
93 | 115 | @EventHandler |
94 | 116 | public void onTeamChangeSize(TeamResizeEvent event) { |
95 | 117 | int newMax = event.getTeam().getMaxPlayers(); |
|
0 commit comments