|
15 | 15 | import dev.lrxh.neptune.configs.impl.MessagesLocale; |
16 | 16 | import dev.lrxh.neptune.configs.impl.SettingsLocale; |
17 | 17 | import dev.lrxh.neptune.configs.impl.SoundsLocale; |
| 18 | +import dev.lrxh.neptune.feature.event.EventService; |
| 19 | +import dev.lrxh.neptune.feature.event.EventState; |
18 | 20 | import dev.lrxh.neptune.feature.hotbar.HotbarService; |
19 | 21 | import dev.lrxh.neptune.feature.leaderboard.LeaderboardService; |
20 | 22 | import dev.lrxh.neptune.feature.leaderboard.impl.LeaderboardPlayerEntry; |
@@ -100,7 +102,13 @@ public void end(Participant loser) { |
100 | 102 | Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); |
101 | 103 | } |
102 | 104 |
|
103 | | - forEachPlayer(player -> HotbarService.get().giveItems(player)); |
| 105 | + forEachPlayer(player -> { |
| 106 | + var activeEvent = EventService.get().getActiveEvent(); |
| 107 | + if (activeEvent == null || activeEvent.getState() != EventState.ACTIVE |
| 108 | + || !activeEvent.getParticipants().contains(player.getUniqueId())) { |
| 109 | + HotbarService.get().giveItems(player); |
| 110 | + } |
| 111 | + }); |
104 | 112 | } |
105 | 113 |
|
106 | 114 | removePlaying(); |
@@ -193,7 +201,10 @@ public void sendEndMessage() { |
193 | 201 | } |
194 | 202 |
|
195 | 203 | forEachParticipant(participant -> { |
196 | | - if (MessagesLocale.MATCH_PLAY_AGAIN_ENABLED.getBoolean()) { |
| 204 | + var activeEvent = EventService.get().getActiveEvent(); |
| 205 | + boolean inEvent = activeEvent != null && activeEvent.getState() == EventState.ACTIVE |
| 206 | + && activeEvent.getParticipants().contains(participant.getPlayerUUID()); |
| 207 | + if (!inEvent && MessagesLocale.MATCH_PLAY_AGAIN_ENABLED.getBoolean()) { |
197 | 208 | PlayerUtil.sendMessage(participant.getPlayerUUID(), MessagesLocale.MATCH_PLAY_AGAIN.getString(), TagResolver.resolver( |
198 | 209 | Placeholder.parsed("kit", getKit().getDisplayName()), |
199 | 210 | Placeholder.unparsed("kit-name", getKit().getName()), |
|
0 commit comments