From 64359d91f58dbde09e7232095e6ffb370346fd76 Mon Sep 17 00:00:00 2001 From: Thiago Gebrim <75040244+thiagogebrimm@users.noreply.github.com> Date: Mon, 23 Jan 2023 10:27:22 -0300 Subject: [PATCH] feat: sends game winners message to discord (#90) --- .../java/me/roinujnosde/titansbattle/challenges/Challenge.java | 1 + .../titansbattle/games/EliminationTournamentGame.java | 2 ++ .../java/me/roinujnosde/titansbattle/games/FreeForAllGame.java | 1 + src/main/resources/language-en.yml | 2 ++ 4 files changed, 6 insertions(+) diff --git a/src/main/java/me/roinujnosde/titansbattle/challenges/Challenge.java b/src/main/java/me/roinujnosde/titansbattle/challenges/Challenge.java index dc5acb4b..68f5490e 100644 --- a/src/main/java/me/roinujnosde/titansbattle/challenges/Challenge.java +++ b/src/main/java/me/roinujnosde/titansbattle/challenges/Challenge.java @@ -103,6 +103,7 @@ protected void processWinners() { SoundUtils.playSound(VICTORY, plugin.getConfig(), winners); givePrizes(FIRST, winnerGroup, winners); broadcastKey("who_won", winnerName, getLoserName()); + discordAnnounce("discord_who_won", winnerName, getLoserName()); } @Override diff --git a/src/main/java/me/roinujnosde/titansbattle/games/EliminationTournamentGame.java b/src/main/java/me/roinujnosde/titansbattle/games/EliminationTournamentGame.java index 04f7f292..698ec51b 100644 --- a/src/main/java/me/roinujnosde/titansbattle/games/EliminationTournamentGame.java +++ b/src/main/java/me/roinujnosde/titansbattle/games/EliminationTournamentGame.java @@ -439,6 +439,8 @@ protected void processWinners() { } broadcastKey("who_won_tournament", getWinnerName(firstPlaceWinners), getWinnerName(secondPlaceWinners), getWinnerName(thirdPlaceWinners)); + discordAnnounce("discord_who_won_tournament", getWinnerName(firstPlaceWinners), + getWinnerName(secondPlaceWinners), getWinnerName(thirdPlaceWinners)); firstPlaceWinners.forEach(warrior -> warrior.increaseVictories(getConfig().getName())); } diff --git a/src/main/java/me/roinujnosde/titansbattle/games/FreeForAllGame.java b/src/main/java/me/roinujnosde/titansbattle/games/FreeForAllGame.java index 36ce5912..0dee0263 100644 --- a/src/main/java/me/roinujnosde/titansbattle/games/FreeForAllGame.java +++ b/src/main/java/me/roinujnosde/titansbattle/games/FreeForAllGame.java @@ -92,6 +92,7 @@ protected void processWinners() { today.setWinners(gameName, Helper.warriorListToUuidList(winners)); String winnerName = getConfig().isGroupMode() ? winnerGroup.getName() : winners.get(0).getName(); broadcastKey("who_won", winnerName); + discordAnnounce("discord_who_won", winnerName); winners.forEach(w -> w.increaseVictories(gameName)); givePrizes(FIRST, winnerGroup, winners); } diff --git a/src/main/resources/language-en.yml b/src/main/resources/language-en.yml index 0bbf2135..0ba21bf6 100644 --- a/src/main/resources/language-en.yml +++ b/src/main/resources/language-en.yml @@ -126,6 +126,8 @@ error-saving-config: "&c» Error saving config!" challenge_starting_game: " \n&b» Starting challenge in {0} seconds! \n» Needed: {1} groups, {2} players\n» Participating: {3} groups, {4} players.\n " starting_game: "!!broadcast \n&b» Starting game in {0} seconds! Join using /tb join.\n» Needed: {1} groups, {2} players\n» Participating: {3} groups, {4} players.\n " discord_game_starting: "» The countdown to a new game has started! \nJoin the server to participate." +discord_who_won: "» Game over! Winner group is: {0}." +discord_who_won_tournament: "» Game over! Winners are:\n &b1# &f{0}\n &b2# &f{1}\n &b3# &f{2}." players-ranking: victories-title: "V" kills-title: "K"