From acae0c67881457e6544db5ee40768a50b58c4dff Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Fri, 12 Jul 2024 20:39:41 -0500 Subject: [PATCH] Add classes and scoreboards to default arenas --- module/classes/src/main/resources/classes.yml | 2 +- .../line/PlayerListLineCreator.java | 16 +++++++++++ .../src/main/resources/scoreboards.yml | 18 +++++++++++- .../src/main/resources/tournament-config.yml | 2 +- .../arena/command/ArenaCommandExecutor.java | 2 +- plugin/src/main/resources/arenas/arena.yml | 25 ++++++++++++++--- .../main/resources/arenas/battlegrounds.yml | 27 +++++++++++++++--- .../src/main/resources/arenas/colosseum.yml | 26 ++++++++++++++--- .../src/main/resources/arenas/deathmatch.yml | 28 +++++++++++++++---- plugin/src/main/resources/arenas/ffa.yml | 28 +++++++++++++++---- plugin/src/main/resources/arenas/skirmish.yml | 6 ++++ plugin/src/main/resources/config.yml | 2 +- plugin/src/main/resources/teams.yml | 2 +- 13 files changed, 156 insertions(+), 28 deletions(-) diff --git a/module/classes/src/main/resources/classes.yml b/module/classes/src/main/resources/classes.yml index fdd65c61..6e982491 100644 --- a/module/classes/src/main/resources/classes.yml +++ b/module/classes/src/main/resources/classes.yml @@ -1,7 +1,7 @@ # ----------------- # Classes configuration for BattleArena # -# Documentation: https://docs.battleplugins.org/docs/ba/customization/teams +# Documentation: https://docs.battleplugins.org/books/user-guide/page/classes # Support: https://discord.gg/tMVPVJf # GitHub: https://github.com/BattlePlugins/BattleArena # ----------------- diff --git a/module/scoreboards/src/main/java/org/battleplugins/arena/module/scoreboard/line/PlayerListLineCreator.java b/module/scoreboards/src/main/java/org/battleplugins/arena/module/scoreboard/line/PlayerListLineCreator.java index 7a14d250..fff20430 100644 --- a/module/scoreboards/src/main/java/org/battleplugins/arena/module/scoreboard/line/PlayerListLineCreator.java +++ b/module/scoreboards/src/main/java/org/battleplugins/arena/module/scoreboard/line/PlayerListLineCreator.java @@ -5,6 +5,8 @@ import net.kyori.adventure.text.format.TextColor; import org.battleplugins.arena.ArenaPlayer; import org.battleplugins.arena.config.ArenaOption; +import org.battleplugins.arena.options.Lives; +import org.battleplugins.arena.stat.ArenaStats; import org.battleplugins.arena.util.Version; import java.util.ArrayList; @@ -18,6 +20,9 @@ public class PlayerListLineCreator implements ScoreboardLineCreator { @ArenaOption(name = "show-team-color", description = "Whether to show the team color of the player.") private boolean showTeamColor; + @ArenaOption(name = "require-alive", description = "Whether to only show alive players.") + private boolean requireAlive; + @Override public List createLines(ArenaPlayer player) { List lines = new ArrayList<>(this.maxEntries); @@ -26,6 +31,17 @@ public List createLines(ArenaPlayer player) { .limit(this.maxEntries) .toList(); + if (this.requireAlive) { + players = players.stream().filter(entry -> { + Lives lives = entry.getArena().getLives(); + if (lives == null || !lives.isEnabled()) { + return entry.stat(ArenaStats.DEATHS).orElse(0) == 0; + } + + return entry.stat(ArenaStats.LIVES).orElse(0) > 0; + }).toList(); + } + for (ArenaPlayer arenaPlayer : players) { Component component = Component.text(arenaPlayer.getPlayer().getName()); if (this.showTeamColor && arenaPlayer.getTeam() != null) { diff --git a/module/scoreboards/src/main/resources/scoreboards.yml b/module/scoreboards/src/main/resources/scoreboards.yml index d72a1128..be7a8755 100644 --- a/module/scoreboards/src/main/resources/scoreboards.yml +++ b/module/scoreboards/src/main/resources/scoreboards.yml @@ -1,7 +1,7 @@ # ----------------- # Scoreboards configuration for BattleArena # -# Documentation: https://docs.battleplugins.org/docs/ba/customization/teams +# Documentation: https://docs.battleplugins.org/books/user-guide/page/scoreboards # Support: https://discord.gg/tMVPVJf # GitHub: https://github.com/BattlePlugins/BattleArena # ----------------- @@ -34,6 +34,21 @@ templates: - " " - "battleplugins.org" ingame-list: + title: "%arena%" + refresh-time: 1s + lines: + - simple: + lines: + - " " + - "Map: %map%" + - "Players:" + - player-list: + max-entries: 10 + - simple: + lines: + - " " + - "battleplugins.org" + ingame-list-alive: title: "%arena%" refresh-time: 1s lines: @@ -44,6 +59,7 @@ templates: - "Alive players:" - player-list: max-entries: 10 + require-alive: true - simple: lines: - " " diff --git a/module/tournaments/src/main/resources/tournament-config.yml b/module/tournaments/src/main/resources/tournament-config.yml index 2d9b1de8..042af0d0 100644 --- a/module/tournaments/src/main/resources/tournament-config.yml +++ b/module/tournaments/src/main/resources/tournament-config.yml @@ -1,7 +1,7 @@ # ----------------- # Tournament configuration for BattleArena # -# Documentation: https://docs.battleplugins.org/docs/ba/customization/teams +# Documentation: https://docs.battleplugins.org/books/user-guide/page/tournaments # Support: https://discord.gg/tMVPVJf # GitHub: https://github.com/BattlePlugins/BattleArena # ----------------- diff --git a/plugin/src/main/java/org/battleplugins/arena/command/ArenaCommandExecutor.java b/plugin/src/main/java/org/battleplugins/arena/command/ArenaCommandExecutor.java index 152463c9..da665115 100644 --- a/plugin/src/main/java/org/battleplugins/arena/command/ArenaCommandExecutor.java +++ b/plugin/src/main/java/org/battleplugins/arena/command/ArenaCommandExecutor.java @@ -194,7 +194,7 @@ public void list(CommandSender sender) { return; } - Messages.HEADER.sendCentered(sender, "Competitions"); + this.sendHeader(sender); for (Map.Entry>> entry : competitionMap.entrySet()) { CompetitionMap map = entry.getKey(); List> competitions = entry.getValue(); diff --git a/plugin/src/main/resources/arenas/arena.yml b/plugin/src/main/resources/arenas/arena.yml index 9e1b698a..a5414f15 100644 --- a/plugin/src/main/resources/arenas/arena.yml +++ b/plugin/src/main/resources/arenas/arena.yml @@ -5,6 +5,10 @@ team-options: team-size: 1 team-amount: 2 team-selection: none +modules: + - arena-restoration + - classes + - scoreboards lives: enabled: false victory-conditions: @@ -26,6 +30,7 @@ events: on-leave: - clear-effects - restore{types=all} + - remove-scoreboard on-death: - clear-inventory - respawn @@ -38,6 +43,7 @@ options: - damage-entities{option=never} - keep-inventory{enabled=true} - keep-experience{enabled=true} + - class-equip-only-selects{enabled=true} initial-phase: waiting phases: waiting: @@ -45,6 +51,10 @@ phases: next-phase: countdown options: - damage-players{option=never} + - class-equipping{enabled=true} + events: + on-join: + - apply-scoreboard{scoreboard=waiting} countdown: allow-join: false allow-spectate: true @@ -53,17 +63,23 @@ phases: countdown-time: 5s options: - damage-players{option=never} + - class-equipping{enabled=true} events: - on-complete: - - teleport{location=team_spawn} - - give-effects{effects=[speed{duration=300;amplifier=1}]} - - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + on-start: + - apply-scoreboard{scoreboard=countdown} ingame: allow-join: false allow-spectate: true next-phase: victory options: - damage-players{option=other_team} + events: + on-start: + - equip-class{class=warrior} + - teleport{location=team_spawn} + - give-effects{effects=[speed{duration=300;amplifier=1}]} + - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=ingame-list} victory: allow-join: false allow-spectate: false @@ -72,6 +88,7 @@ phases: events: on-complete: - leave + - remove-scoreboard on-victory: - send-message{message=Congrats, you won!} - play-sound{sound=entity.player.levelup;pitch=1;volume=1} diff --git a/plugin/src/main/resources/arenas/battlegrounds.yml b/plugin/src/main/resources/arenas/battlegrounds.yml index 185d944f..494e6fbc 100644 --- a/plugin/src/main/resources/arenas/battlegrounds.yml +++ b/plugin/src/main/resources/arenas/battlegrounds.yml @@ -7,6 +7,10 @@ team-options: team-size: 1 team-amount: 2+ team-selection: none +modules: + - arena-restoration + - classes + - scoreboards lives: enabled: false victory-conditions: @@ -28,6 +32,7 @@ events: on-leave: - clear-effects - restore{types=all} + - remove-scoreboard on-death: - respawn on-respawn: @@ -39,6 +44,7 @@ options: - damage-entities{option=never} - keep-inventory{enabled=true} - keep-experience{enabled=true} + - class-equip-only-selects{enabled=true} initial-phase: waiting phases: waiting: @@ -46,6 +52,10 @@ phases: next-phase: countdown options: - damage-players{option=never} + - class-equipping{enabled=true} + events: + on-join: + - apply-scoreboard{scoreboard=waiting} countdown: allow-join: true allow-spectate: true @@ -54,17 +64,25 @@ phases: countdown-time: 60s options: - damage-players{option=never} + - class-equipping{enabled=true} events: - on-complete: - - teleport{location=team_spawn} - - give-effects{effects=[speed{duration=300;amplifier=1}]} - - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + on-join: + - apply-scoreboard{scoreboard=countdown} + on-start: + - apply-scoreboard{scoreboard=countdown} ingame: allow-join: false allow-spectate: true next-phase: victory options: - damage-players{option=other_team} + events: + on-start: + - equip-class{class=warrior} + - teleport{location=team_spawn} + - give-effects{effects=[speed{duration=300;amplifier=1}]} + - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=ingame-top-kills} victory: allow-join: false allow-spectate: false @@ -73,6 +91,7 @@ phases: events: on-complete: - leave + - remove-scoreboard on-victory: - send-message{message=Congrats, you won!} - play-sound{sound=entity.player.levelup;pitch=1;volume=1} diff --git a/plugin/src/main/resources/arenas/colosseum.yml b/plugin/src/main/resources/arenas/colosseum.yml index 6bcfaccb..ff5152ff 100644 --- a/plugin/src/main/resources/arenas/colosseum.yml +++ b/plugin/src/main/resources/arenas/colosseum.yml @@ -7,6 +7,11 @@ team-options: team-size: 4 team-amount: 4 team-selection: pick + shared-spawn-points: true +modules: + - arena-restoration + - classes + - scoreboards lives: enabled: false victory-conditions: @@ -28,6 +33,7 @@ events: on-leave: - clear-effects - restore{types=all} + - remove-scoreboard on-death: - clear-inventory - respawn @@ -40,6 +46,7 @@ options: - damage-entities{option=never} - keep-inventory{enabled=true} - keep-experience{enabled=true} + - class-equip-only-selects{enabled=true} initial-phase: waiting phases: waiting: @@ -47,6 +54,10 @@ phases: next-phase: countdown options: - damage-players{option=never} + - class-equipping{enabled=true} + events: + on-join: + - apply-scoreboard{scoreboard=waiting} countdown: allow-join: false allow-spectate: true @@ -55,17 +66,23 @@ phases: countdown-time: 5s options: - damage-players{option=never} + - class-equipping{enabled=true} events: - on-complete: - - teleport{location=team_spawn} - - give-effects{effects=[speed{duration=300;amplifier=1}]} - - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + on-start: + - apply-scoreboard{scoreboard=countdown} ingame: allow-join: false allow-spectate: true next-phase: victory options: - damage-players{option=other_team} + events: + on-start: + - equip-class{class=warrior} + - teleport{location=team_spawn} + - give-effects{effects=[speed{duration=300;amplifier=1}]} + - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=ingame-list-alive} victory: allow-join: false allow-spectate: false @@ -74,6 +91,7 @@ phases: events: on-complete: - leave + - remove-scoreboard on-victory: - send-message{message=Congrats, you won!} - play-sound{sound=entity.player.levelup;pitch=1;volume=1} diff --git a/plugin/src/main/resources/arenas/deathmatch.yml b/plugin/src/main/resources/arenas/deathmatch.yml index 0eb3dfce..3726c599 100644 --- a/plugin/src/main/resources/arenas/deathmatch.yml +++ b/plugin/src/main/resources/arenas/deathmatch.yml @@ -7,6 +7,10 @@ team-options: team-size: 1 team-amount: 2+ team-selection: none +modules: + - arena-restoration + - classes + - scoreboards lives: enabled: false victory-conditions: @@ -28,6 +32,7 @@ events: on-leave: - clear-effects - restore{types=all} + - remove-scoreboard on-death: - respawn on-respawn: @@ -39,6 +44,7 @@ options: - damage-entities{option=never} - keep-inventory{enabled=true} - keep-experience{enabled=true} + - class-equip-only-selects{enabled=true} initial-phase: waiting phases: waiting: @@ -46,6 +52,10 @@ phases: next-phase: countdown options: - damage-players{option=never} + - class-equipping{enabled=true} + events: + on-join: + - apply-scoreboard{scoreboard=waiting} countdown: allow-join: true allow-spectate: true @@ -54,19 +64,26 @@ phases: countdown-time: 60s options: - damage-players{option=never} + - class-equipping{enabled=true} events: + on-join: + - apply-scoreboard{scoreboard=countdown} on-start: - - broadcast{message=[BattleArena] The Deathmatch event is about to start! Run /deathmatch join to join!} - on-complete: - - teleport{location=team_spawn} - - give-effects{effects=[speed{duration=300;amplifier=1}]} - - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=countdown} + - broadcast{message=[BattleArena] The Deathmatch event is about to start! Run /deathmatch join to join!;audience=server} ingame: allow-join: false allow-spectate: true next-phase: victory options: - damage-players{option=other_team} + events: + on-start: + - equip-class{class=warrior} + - teleport{location=team_spawn} + - give-effects{effects=[speed{duration=300;amplifier=1}]} + - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=ingame-top-kills} victory: allow-join: false allow-spectate: false @@ -76,6 +93,7 @@ phases: on-complete: - leave - teardown + - remove-scoreboard on-victory: - send-message{message=Congrats, you won!} - play-sound{sound=entity.player.levelup;pitch=1;volume=1} diff --git a/plugin/src/main/resources/arenas/ffa.yml b/plugin/src/main/resources/arenas/ffa.yml index 86f6eec7..c9494261 100644 --- a/plugin/src/main/resources/arenas/ffa.yml +++ b/plugin/src/main/resources/arenas/ffa.yml @@ -7,6 +7,10 @@ team-options: team-size: 1 team-amount: 2+ team-selection: none +modules: + - arena-restoration + - classes + - scoreboards lives: enabled: false victory-conditions: @@ -28,6 +32,7 @@ events: on-leave: - clear-effects - restore{types=all} + - remove-scoreboard on-death: - clear-inventory - respawn @@ -40,6 +45,7 @@ options: - damage-entities{option=never} - keep-inventory{enabled=true} - keep-experience{enabled=true} + - class-equip-only-selects{enabled=true} initial-phase: waiting phases: waiting: @@ -47,6 +53,10 @@ phases: next-phase: countdown options: - damage-players{option=never} + - class-equipping{enabled=true} + events: + on-join: + - apply-scoreboard{scoreboard=waiting} countdown: allow-join: true allow-spectate: true @@ -55,19 +65,26 @@ phases: countdown-time: 60s options: - damage-players{option=never} + - class-equipping{enabled=true} events: + on-join: + - apply-scoreboard{scoreboard=countdown} on-start: - - broadcast{message=[BattleArena] The Deathmatch event is about to start! Run /deathmatch join to join!} - on-complete: - - teleport{location=team_spawn} - - give-effects{effects=[speed{duration=300;amplifier=1}]} - - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=countdown} + - broadcast{message=[BattleArena] The FFA event is about to start! Run /ffa join to join!;audience=server} ingame: allow-join: false allow-spectate: true next-phase: victory options: - damage-players{option=other_team} + events: + on-start: + - equip-class{class=warrior} + - teleport{location=team_spawn} + - give-effects{effects=[speed{duration=300;amplifier=1}]} + - play-sound{sound=block.note_block.pling;pitch=2;volume=1} + - apply-scoreboard{scoreboard=ingame-list-alive} victory: allow-join: false allow-spectate: false @@ -77,6 +94,7 @@ phases: on-complete: - leave - teardown + - remove-scoreboard on-victory: - send-message{message=Congrats, you won!} - play-sound{sound=entity.player.levelup;pitch=1;volume=1} diff --git a/plugin/src/main/resources/arenas/skirmish.yml b/plugin/src/main/resources/arenas/skirmish.yml index 2530afaa..73a25e9d 100644 --- a/plugin/src/main/resources/arenas/skirmish.yml +++ b/plugin/src/main/resources/arenas/skirmish.yml @@ -6,12 +6,17 @@ team-options: team-size: 1 team-amount: 1+ team-selection: none + shared-spawn-points: true +modules: + - arena-restoration + - scoreboards lives: enabled: false events: on-join: - store{types=location} - teleport{location=waitroom} + - apply-scoreboard{scoreboard=ingame-top-kills} on-spectate: - store{types=location} - change-gamemode{gamemode=spectator} @@ -19,6 +24,7 @@ events: - teleport{location=spectator} on-leave: - restore{types=location} + - remove-scoreboard on-kill: - play-sound{sound=entity.player.levelup;pitch=1;volume=1} on-death: diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml index 349b140f..e77a1619 100644 --- a/plugin/src/main/resources/config.yml +++ b/plugin/src/main/resources/config.yml @@ -1,7 +1,7 @@ # ----------------- # Main configuration for BattleArena # -# Documentation: https://docs.battleplugins.org/docs/ba/ +# Documentation: https://docs.battleplugins.org/shelves/battlearena # Support: https://discord.gg/tMVPVJf # GitHub: https://github.com/BattlePlugins/BattleArena # ----------------- diff --git a/plugin/src/main/resources/teams.yml b/plugin/src/main/resources/teams.yml index 4ebc5769..2e2b9fb0 100644 --- a/plugin/src/main/resources/teams.yml +++ b/plugin/src/main/resources/teams.yml @@ -1,7 +1,7 @@ # ----------------- # Teams configuration for BattleArena # -# Documentation: https://docs.battleplugins.org/docs/ba/customization/teams +# Documentation: https://docs.battleplugins.org/books/user-guide/page/teams # Support: https://discord.gg/tMVPVJf # GitHub: https://github.com/BattlePlugins/BattleArena # -----------------