From 22f1a36a0dda27eb04060296a50f4f1f1cde09aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Dasc=C4=83lu?= Date: Fri, 10 Nov 2023 19:38:22 +0100 Subject: [PATCH] November 2023 release (#901) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix sidebar title animation not working #660 * Fixed wins placeholder not in lobby sidebar #658 * Fixed NPE when clicking outside of shop inventory #664 * Fixed command error when lobby location is not set * Added unformatted player name to kill message and bed destroy * Added Netherite armor to 1.16+ (#657) * Added missing items in v1_12_R1 * Fixed level just showing numer (#661) * expose sidebar on API * a few updates (#632) * Italian Language Update * Fix Moneys reward team-support on Solo & update variables names * add sidebar init event * fix team identifier length (#682) * Bug fixes and placeholder adjustments (#685) read pr details * fix no tab formatting for first player (#692) * fix losing permanent items on rejoin (#385) * fix scoreboard getting send twice (#690) * fix void tp on newer servers * fix swords disappearing (#686) * fix invisibility potion compatibility with 1.8.8 * fix lobby tablist (#701) * Add translation for Simplified Chinese (#628) Co-authored-by: hugeBlack Co-authored-by: YukiEnd233 <85435560+YukiEnd233@users.noreply.github.com> * Remove hand from hideArmor * fix placeholders * Fix elapsed time always null (#574) * fix header and footer * clean up * should fix #699 * Remove Deprecation Warning for Version and Update getServerVersion Methods (#623) * Remove Version Deprecation Warning * update methods that use getServerVersion() * Update Sidebar API link in README.md for new sidebar * More ReadME changes * Back to Java 11 and some clean up * Mark PrePartyListener for removal * Massive Clean up * Improve TeamEliminatedEvent JavaDoc * Updates * fix #712 fix #681 * Add user texture to player head (#333) * Add gamesPlayed placeholder * Fixed placeholder typos * remove unnecessary teams * fix placeholder completely fix #724 * fix player name invisible on 1.8 * removed replace gens with air (#529) * add check if respawning (#732) * Add catch for teleport exceptions * Add global placeholders * Add global placeholders to header and footer (#730) * Add invis removed message * fix papi support * keep old placeholder at least for a few updates * Bug fixes (#740) * fix no tab formatting for first player (#692) * fix losing permanent items on rejoin (#385) * fix scoreboard getting send twice (#690) * fix void tp on newer servers * fix swords disappearing (#686) * fix invisibility potion compatibility with 1.8.8 * fix lobby tablist (#701) * Remove hand from hideArmor * fix placeholders * Fix elapsed time always null (#574) * fix header and footer * clean up * should fix #699 * fix #712 fix #681 * Add user texture to player head (#333) * Add gamesPlayed placeholder * Fixed placeholder typos * remove unnecessary teams * fix placeholder completely fix #724 * fix player name invisible on 1.8 * removed replace gens with air (#529) * add check if respawning (#732) * Add catch for teleport exceptions * Add global placeholders * Add global placeholders to header and footer (#730) * Add invis removed message * fix papi support * keep old placeholder at least for a few updates --------- Co-authored-by: Andrei Dascălu Co-authored-by: andrei1058 * clean up * Internal Party Additions (Promote, list/info commands) (#715) * getOwner and promote methods to Party interface * Add /party promote command and English Lang * Add /party info/list commands * break; * add Romanian Lang * add Italian Lang * add Other Lang * clean up * clean up * clean up * add missing messages * do not break addons --------- Co-authored-by: Andrei Dascălu * Update Russian.java (#696) update translations Co-authored-by: Andrei Dascălu * add missing return * Fix #760 (#792) * Added placeholders {team} and {teamColor} to display the player team and its corresponding colors on the teleporter (#796) * Added placeholders for {team} and {teamColor} to display the player team and their corresponding colors on the teleporter * Fixed an error in calculating the player teleporter gui size * limit size to 54 --------- Co-authored-by: Andrei Dascălu * Reduce some race conditions with IArena#getStatus (#775) * Added support for 1.19_R3 (#761) Co-authored-by: ItzCodex * Fix dropping and picking up items if main lobby is set on shared mode (#805) * tag event handler * fix drop/ pick up if main lobby is set on SHARED server type * readme update (#811) * Fixed bug where Dream Defender and Bed Bug were spawning at player's location instead of where they clicked. (#813) Co-authored-by: PmzHeroV69 * Add 1.20 support (#814) * add 1.20 support * mention jetbrains * add new sidebar version that supports 1.20 * fix missing dependency on 1.17+ (#817) * world restore adapters update (#820) * world restore adapters update * update workflow * update workflow * update workflow * update workflow * add missing dependency * Glass protection barrier rework (#469) * Add VersionSupport#calculateExplosionBlocks * Add isGlass & isProtectedByGlass to VersionSupport * isProtectedByGlass performs ray tracing to ensure there is no glass inbetween * Change VersionSupport#calculateExplosionBlocks implementation * Implement v1_8_R3#calculateExplosionBlocks * Copied from net.minecraft.server.v1_8_R3.Explosion#a() (The NMS implementation of https://minecraft.fandom.com/wiki/Explosion#Model_of_block_destruction) * Implement v1_9_R2#calculateExplosionBlocks * Implement v1_10_R1#calculateExplosionBlocks * Implement v1_11_R1#calculateExplosionBlocks * Implement v1_12_R1#calculateExplosionBlocks * Implement v1_13_R2#calculateExplosionBlocks * Fix wrong behavior from locY in calculateExplosionBlocks * Implement v1_14_R1#calculateExplosionBlocks * Fix tnt breaking blocks under water @ 1.13 * Fix locY @ 1.12 * Fix blocks under water getting exploded * Fix comments * Implement v1_15_R1#calculateExplosionBlocks * Implement v1_16_*#calculateExplosionBlocks * Add exceptions for not implemented versions of calculateExplosionBlocks * Change radius of explosion to float instead of int * Reimplement explosive-related events to use NMS/better detection * Add Config explosion-settings.explosion-size * if size is set to auto OR any negative value it will cache the actual size of that entity, if it could not cache it (not found) then the default implementation is used (removing and protecting blocks) * Fix location hashing rounding instead of flooring coords * Add function caching to the default callback of calculateExplosionBlocks * Add comment describing whatever this is * Fix ExplosionPrimeEvent not being check correctly * Fix distances being calculated wrong in VersionSupport#isProtectedByGlass * Add BlockRay for better ray tracing * Reimplement VersionSupport#isProtected and its events * Fix typo * Remove debug junk * Add cache cleaning for BreakPlace * test if block is placed in special cases * Fix air being counted as a block * Increase caching lifetime & change keys to Entity * always manage explosions even if blockList is empty * Fix imports * Fix inaccurate calculation of the delta vector in BlockRay * Add the 3 missing components to BlockRay * wip * wip * implement explosion function * improvements and clean up * clean up * clean up * clean up * fix typo --------- Co-authored-by: Andrei Dascălu * Fix default tower item (#831) Fixed bug where wrong tower item was added as invalid material in shop.yml * version string update * change heal pool work (#832) * change heal pool work Since the upgrade price is likely to be different for each arena group, if the upgrade has a heal-pool in the name, it is changed to work * Fix magic miner upgrade (#830) * Fix magic miner upgrade Fixed bug where magic miner upgrade was showing wrong material name in version 1.13 and above. * Fix heal pool not working (#829) Fixed bug preventing heal pool from working with wrong config path * Fix sword upgrade (#828) Fixed bug where upgrade-swords purchases in the upgrade shop didn't apply to axes * fix missed implementation * Fix Parties getParty with player UUID (#860) * fix not loading (#875) * Sidebar and Tab improvements, session stats remake (#845) tab rework, sidebar imrovements, new top system and session statistics * add 1.20 r2 support (#896) * add 1.20 r2 support * version string update * Fix PAF Null issue (#853) * Fix PAF Null issue * Update Github actions * Build 1.20 module against 1.20.1 * fix disablearena command (#839) Changed this arena to not be disabled if a game is in progress The reason for the change is that many errors occur when disableArena and enableArena. I will upload the file * correct silverfish name (#840) correct silverfish name * Fix block protection (#841) * Fix block protection Fixed bug where shop protection and upgrades protection and generators protection did not work * fix fix * SpoilPlayerTNTFeature code improvements (#892) SpoilPlayerTNTFeature code improvements --------- Co-authored-by: Tom Keuper Co-authored-by: Yuri <84080587+Xxyuri2005xX@users.noreply.github.com> Co-authored-by: skbeh <60107333+skbeh@users.noreply.github.com> Co-authored-by: hugeBlack Co-authored-by: YukiEnd233 <85435560+YukiEnd233@users.noreply.github.com> Co-authored-by: J.T. McQuigg Co-authored-by: Matveev_ <122512138+UnMatveev@users.noreply.github.com> Co-authored-by: grass <68882326+Lsy-291@users.noreply.github.com> Co-authored-by: Tom <72739475+Tom18314@users.noreply.github.com> Co-authored-by: ItzCodex Co-authored-by: PmzHeroV69 <91284999+PmzHeroV69@users.noreply.github.com> Co-authored-by: PmzHeroV69 Co-authored-by: IIHERO4 <46909116+IIHERO4@users.noreply.github.com> Co-authored-by: Yenil <85287520+ImYenil@users.noreply.github.com> Co-authored-by: AlessioDP --- .github/workflows/compile_snapshot.yml | 8 +- .github/workflows/deploy.yml | 8 +- .github/workflows/deploy_snapshot.yml | 8 +- CONTRIBUTING.md | 15 + README.md | 42 +- bedwars-api/pom.xml | 2 +- .../andrei1058/bedwars/api/arena/IArena.java | 50 +- .../api/arena/stats/DefaultStatistics.java | 29 + .../api/arena/stats/GameStatistic.java | 29 + .../arena/stats/GameStatisticProvider.java | 30 + .../api/arena/stats/GameStatsHolder.java | 96 ++ .../api/arena/stats/Incrementable.java | 6 + .../api/arena/stats/PlayerGameStats.java | 39 + .../bedwars/api/arena/team/ITeam.java | 18 + .../api/configuration/ConfigManager.java | 5 + .../bedwars/api/configuration/ConfigPath.java | 31 +- .../configuration/GameMainOverridable.java | 8 + .../api/events/player/PlayerKillEvent.java | 63 +- .../bedwars/api/language/Language.java | 96 +- .../bedwars/api/language/Messages.java | 279 ++++-- .../bedwars/api/server/RestoreAdapter.java | 2 + .../bedwars/api/server/VersionSupport.java | 27 +- .../bedwars/api/sidebar/ISidebar.java | 16 +- .../bedwars/api/util/BlastProtectionUtil.java | 99 +++ .../andrei1058/bedwars/api/util/BlockRay.java | 187 ++++ bedwars-plugin/pom.xml | 93 +- .../java/com/andrei1058/bedwars/BedWars.java | 173 ++-- .../com/andrei1058/bedwars/arena/Arena.java | 462 +++++----- .../andrei1058/bedwars/arena/ArenaGUI.java | 33 +- .../com/andrei1058/bedwars/arena/Misc.java | 4 +- .../bedwars/arena/OreGenerator.java | 2 +- .../bedwars/arena/SetupSession.java | 8 +- .../arena/feature/SpoilPlayerTNTFeature.java | 23 +- .../arena/spectator/TeleporterGUI.java | 25 +- .../arena/stats/DefaultStatsHandler.java | 79 ++ .../bedwars/arena/stats/GameStatsManager.java | 124 +++ .../bedwars/arena/stats/GenericStatistic.java | 52 ++ .../arena/stats/StatisticsOrdered.java | 176 ++++ .../defaults/PlayerGameStatsContainer.java | 66 ++ .../arena/tasks/GameRestartingTask.java | 37 +- .../bedwars/arena/tasks/GameStartingTask.java | 2 +- .../bedwars/arena/team/BedWarsTeam.java | 37 +- .../arena/upgrades/HealPoolListner.java | 2 +- .../com/andrei1058/bedwars/commands/Misc.java | 4 +- .../bedwars/subcmds/regular/CmdStart.java | 4 +- .../bedwars/subcmds/regular/CmdTpStaff.java | 4 +- .../subcmds/sensitive/DisableArena.java | 5 + .../bedwars/subcmds/sensitive/setup/Save.java | 6 +- .../subcmds/sensitive/setup/SetSpawn.java | 4 +- .../bedwars/configuration/ArenaConfig.java | 56 +- .../bedwars/configuration/MainConfig.java | 25 +- .../bedwars/configuration/UpgradesConfig.java | 16 +- .../andrei1058/bedwars/language/Bangla.java | 564 +++++++++++- .../andrei1058/bedwars/language/English.java | 583 +++++++++++- .../andrei1058/bedwars/language/Hindi.java | 582 +++++++++++- .../bedwars/language/Indonesia.java | 572 +++++++++++- .../andrei1058/bedwars/language/Italian.java | 571 +++++++++++- .../andrei1058/bedwars/language/Persian.java | 582 +++++++++++- .../andrei1058/bedwars/language/Polish.java | 573 +++++++++++- .../bedwars/language/Portuguese.java | 574 +++++++++++- .../andrei1058/bedwars/language/Romanian.java | 590 +++++++++++- .../andrei1058/bedwars/language/Russian.java | 574 +++++++++++- .../bedwars/language/SimplifiedChinese.java | 575 +++++++++++- .../andrei1058/bedwars/language/Spanish.java | 558 +++++++++++- .../andrei1058/bedwars/language/Turkish.java | 576 +++++++++++- .../bedwars/listeners/BreakPlace.java | 85 +- .../bedwars/listeners/DamageDeathMove.java | 80 +- .../listeners/QuitAndTeleportListener.java | 73 +- .../bedwars/listeners/Warnings.java | 4 +- .../arenaselector/ArenaSelectorListener.java | 8 +- .../blockstatus/BlockStatusListener.java | 2 + .../joinhandler/JoinListenerBungee.java | 149 ++-- .../joinhandler/JoinListenerMultiArena.java | 4 +- .../maprestore/internal/InternalAdapter.java | 5 + .../andrei1058/bedwars/shop/ShopManager.java | 2 +- .../shop/listeners/SpecialsListener.java | 10 +- .../andrei1058/bedwars/sidebar/BwSidebar.java | 692 ++++++--------- .../andrei1058/bedwars/sidebar/BwTabList.java | 508 +++++++++++ .../bedwars/sidebar/ScoreboardListener.java | 99 ++- .../bedwars/sidebar/SidebarService.java | 84 +- ...stTask.java => RefreshPlayerListTask.java} | 2 +- .../thread/RefreshTabHeaderFooterTask.java | 33 + .../bedwars/stats/StatsListener.java | 102 ++- ...PaperSupport.java => TeleportManager.java} | 22 +- .../andrei1058/bedwars/support/party/PAF.java | 1 + .../support/party/PAFBungeecordRedisApi.java | 1 + .../bedwars/support/party/PartiesAdapter.java | 22 +- bedwars-plugin/src/main/resources/plugin.yml | 2 +- pom.xml | 25 +- resetadapter_aswm/pom.xml | 68 ++ .../mapreset/slime/AdvancedSlimeAdapter.java | 484 ++++++++++ resetadapter_slime/pom.xml | 4 +- .../arena/mapreset/slime/SlimeAdapter.java | 5 + resetadapter_slimepaper/pom.xml | 76 ++ .../mapreset/slime/SlimePaperAdapter.java | 478 ++++++++++ versionsupport_1_12_R1/pom.xml | 2 +- .../support/version/v1_12_R1/Silverfish.java | 2 +- .../support/version/v1_12_R1/v1_12_R1.java | 16 +- versionsupport_1_8_R3/pom.xml | 2 +- .../support/version/v1_8_R3/Silverfish.java | 2 +- .../support/version/v1_8_R3/v1_8_R3.java | 22 +- versionsupport_common/pom.xml | 2 +- .../listeners/ItemDropPickListener.java | 4 +- .../listeners/PlayerDropPick_1_11Minus.java | 4 +- versionsupport_v1_16_R3/pom.xml | 2 +- .../support/version/v1_16_R3/Silverfish.java | 2 +- .../support/version/v1_16_R3/v1_16_R3.java | 34 +- versionsupport_v1_17_R1/pom.xml | 2 +- .../support/version/v1_17_R1/Silverfish.java | 2 +- .../support/version/v1_17_R1/v1_17_R1.java | 36 +- versionsupport_v1_18_R2/pom.xml | 2 +- .../support/version/v1_18_R2/Silverfish.java | 2 +- .../support/version/v1_18_R2/v1_18_R2.java | 35 +- versionsupport_v1_19_R2/pom.xml | 2 +- .../support/version/v1_19_R2/v1_19_R2.java | 18 +- versionsupport_v1_19_R3/pom.xml | 64 ++ .../despawnable/DespawnableAttributes.java | 5 + .../despawnable/DespawnableFactory.java | 27 + .../despawnable/DespawnableProvider.java | 71 ++ .../v1_19_R3/despawnable/DespawnableType.java | 6 + .../v1_19_R3/despawnable/TeamIronGolem.java | 58 ++ .../v1_19_R3/despawnable/TeamSilverfish.java | 56 ++ .../support/version/v1_19_R3/v1_19_R3.java | 824 +++++++++++++++++ versionsupport_v1_20_R1/pom.xml | 64 ++ .../despawnable/DespawnableAttributes.java | 5 + .../despawnable/DespawnableFactory.java | 27 + .../despawnable/DespawnableProvider.java | 71 ++ .../v1_20_R1/despawnable/DespawnableType.java | 6 + .../v1_20_R1/despawnable/TeamIronGolem.java | 58 ++ .../v1_20_R1/despawnable/TeamSilverfish.java | 56 ++ .../support/version/v1_20_R1/v1_20_R1.java | 837 ++++++++++++++++++ versionsupport_v1_20_R2/pom.xml | 64 ++ .../despawnable/DespawnableAttributes.java | 5 + .../despawnable/DespawnableFactory.java | 27 + .../despawnable/DespawnableProvider.java | 71 ++ .../v1_20_R2/despawnable/DespawnableType.java | 6 + .../v1_20_R2/despawnable/TeamIronGolem.java | 58 ++ .../v1_20_R2/despawnable/TeamSilverfish.java | 56 ++ .../support/version/v1_20_R2/v1_20_R2.java | 836 +++++++++++++++++ 139 files changed, 14971 insertions(+), 1899 deletions(-) create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/DefaultStatistics.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatistic.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatisticProvider.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatsHolder.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/Incrementable.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/PlayerGameStats.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/GameMainOverridable.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlastProtectionUtil.java create mode 100644 bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlockRay.java create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/DefaultStatsHandler.java create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GameStatsManager.java create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GenericStatistic.java create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/StatisticsOrdered.java create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/defaults/PlayerGameStatsContainer.java create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwTabList.java rename bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/{RefreshTabListTask.java => RefreshPlayerListTask.java} (94%) create mode 100644 bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabHeaderFooterTask.java rename bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/{PaperSupport.java => TeleportManager.java} (64%) create mode 100644 resetadapter_aswm/pom.xml create mode 100644 resetadapter_aswm/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/AdvancedSlimeAdapter.java create mode 100644 resetadapter_slimepaper/pom.xml create mode 100644 resetadapter_slimepaper/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimePaperAdapter.java create mode 100644 versionsupport_v1_19_R3/pom.xml create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableAttributes.java create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableFactory.java create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableProvider.java create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableType.java create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamIronGolem.java create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamSilverfish.java create mode 100644 versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/v1_19_R3.java create mode 100644 versionsupport_v1_20_R1/pom.xml create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableAttributes.java create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableFactory.java create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableProvider.java create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableType.java create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamIronGolem.java create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamSilverfish.java create mode 100644 versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/v1_20_R1.java create mode 100644 versionsupport_v1_20_R2/pom.xml create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableAttributes.java create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableFactory.java create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableProvider.java create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableType.java create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamIronGolem.java create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamSilverfish.java create mode 100644 versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/v1_20_R2.java diff --git a/.github/workflows/compile_snapshot.yml b/.github/workflows/compile_snapshot.yml index 683cb18d1..3405ba91d 100644 --- a/.github/workflows/compile_snapshot.yml +++ b/.github/workflows/compile_snapshot.yml @@ -14,11 +14,11 @@ jobs: name: development url: https://repo.andrei1058.dev steps: - - uses: actions/checkout@v2 - - name: Set up JDK 17.0.5 - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 with: - java-version: '17.0.5' + java-version: '19.0.2+7' distribution: 'adopt' - name: Deploy snapshot with Maven env: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 74211a889..a55e8fc42 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,11 +11,11 @@ jobs: name: production url: https://repo.andrei1058.com steps: - - uses: actions/checkout@v2 - - name: Set up JDK 17.0.5 - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 with: - java-version: '17.0.5' + java-version: '19.0.2+7' distribution: 'adopt' - name: Deploy with Maven env: diff --git a/.github/workflows/deploy_snapshot.yml b/.github/workflows/deploy_snapshot.yml index 0d5575620..a736953be 100644 --- a/.github/workflows/deploy_snapshot.yml +++ b/.github/workflows/deploy_snapshot.yml @@ -13,11 +13,11 @@ jobs: name: development url: https://repo.andrei1058.dev steps: - - uses: actions/checkout@v2 - - name: Set up JDK 17.0.5 - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 with: - java-version: '17.0.5' + java-version: '19.0.2+7' distribution: 'adopt' - name: Deploy snapshot with Maven env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2b45e7d1..3152091f5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,3 +89,18 @@ core team. | | `under-review` | Pull requests being reviewed by maintainers. | | `requires-changes` | Pull requests which need to be updated based on review comments and then reviewed again. | | `needs-testing` | Pull requests which need manual testing. | + +# How to add support for a new Minecraft version + +First give a look at the project structure above on this page, clone the versionsupport of +the latest supported version and then make sure to rename the package and class, plus update +the pom file with the new version name. + +At this point make sure to map the following aspects on the new NMS: +- Pathfinders for goals and targets in `DespawnableProvider` +- `PlayerConnection` used to send packets in `v1_nn_Rx` class +- Glass and other modified blocks in `v1_nn_Rx#registerTntWhitelist` +- NBTTags in `v1_nn_Rx` for Item, Entity and ItemStacks +- eventually other functions that were not mapped yet by spigot + +For your update to go live, [SidebarLib](https://github.com/andrei1058/SidebarLib) needs to be updated to your new version as well. diff --git a/README.md b/README.md index cfdce1492..7e8c75a33 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ -[![Logo](./.github/assets/logo_open_source.png)](#) +![Logo](./.github/assets/logo_open_source.png) -[![Discord](https://discordapp.com/api/guilds/201345265821679617/widget.png?style=shield)](https://discord.gg/XdJfN2X) [![bStats](https://img.shields.io/bstats/servers/1885)](#) As from November 1st 2021 BedWars1058 by Andrei Dascălu becomes open source under GNU GPL 3.0 license. If you are a developer I would really appreciate if you'd come with pull requests instead of making hundreds of forks. Let's make updates available for everyone! +[![Discord](https://discordapp.com/api/guilds/201345265821679617/widget.png?style=shield)](https://discord.gg/XdJfN2X) + +[![Crowdin](https://support.crowdin.com/assets/badges/localization-at-white-rounded-bordered@1x.svg)](https://crowdin.com/project/bedwars1058) + # Description BedWars is a mini-game where you have to defend your bed and destroy the others. Once your bed is destroyed, you cannot respawn. @@ -12,16 +15,20 @@ Once your bed is destroyed, you cannot respawn. This software runs on [Spigot](https://www.spigotmc.org/) and NMS. Spigot forks without compiled NMS code are not supported. Officially supported servers are [spigot](https://www.spigotmc.org/) and [paper](https://papermc.io/). -It is required to use Java 11 or newer. +It is required to use **Java 11** or newer. The internal world restore system is based on zipping and unzipping maps which can become -heavy if you are still making use of HDD in 2021, and you do not have a decent CPU, for a better -and faster restore system install [SlimeWorldManager](https://www.spigotmc.org/resources/slimeworldmanager.69974/) or [AdvancedWorldManager](https://www.spigotmc.org/resources/advanced-slimeworldmanager.87209/). -BedWars1058 will hook into it and do everything for you. +heavy if you are still making use of HDDs and you do not have a decent CPU, for a better +and faster restore system we recommend using one of the following solutions: +- [SlimeWorldManager](https://www.spigotmc.org/resources/slimeworldmanager.69974/) plug-in (v2.2.1 **only**) +- [AdvancedWorldManager](https://www.spigotmc.org/resources/advanced-slimeworldmanager.87209/) plug-in (v2.8.0 **only**) +- [AdvancedSlimePaper](https://github.com/InfernalSuite/AdvancedSlimePaper) server jar (**1.20 or newer**) + +BedWars1058 will hook into it and do everything for you, no additional configuration is needed. -# Pre-made setups and community addons +# Pre-made setups and community add-ons -You can find a list of pre-made setups and community addons [on the wiki](https://wiki.andrei1058.dev/docs/BedWars1058/addons) +You can find a list of pre-made server setups and a lot of community add-ons [on BedWars1058 Wiki](https://wiki.andrei1058.dev/docs/BedWars1058/addons). # Main features @@ -115,20 +122,25 @@ If you get disconnected, or if you leave a game (configurable) you can re-join i ###### Season events: - Halloween special. It is enabled automatically based on your machine timezone and will provide cool effects. -# Community servers -Chosen by hundreds of servers all around the world. -[![Fear Games Logo](.github/assets/servers/fear_games.png)](https://feargames.it/) -[![Gamster Logo](.github/assets/servers/gamster.png)](https://www.gamster.org/) -- mc.feargames.it -- mc.gamster.org +# Contributing +Any help is appreciated, just give a quick look at [CONTRIBUTING.md](https://github.com/andrei1058/BedWars1058/blob/master/CONTRIBUTING.md) first! +If you are not a programmer you can help answering people in the [Issues](https://github.com/andrei1058/BedWars1058/issues) section or even [translate the plugin in your languae on Crowdin](https://crowdin.com/project/bedwars1058). + +### Translation progress +[Translation Chart](https://badges.awesome-crowdin.com/translation-12780139-594479.png) # 3rd party libraries - [bStats](https://bstats.org/getting-started/include-metrics) -- [Sidebar API](https://github.com/andrei1058/SiderbarLib) +- [SidebarLib](https://github.com/andrei1058/SiderbarLib) - [Commons IO](https://mvnrepository.com/artifact/commons-io/commons-io) - [HikariCP](https://mvnrepository.com/artifact/com.zaxxer/HikariCP) - [SLF4J](http://www.slf4j.org/) # Contact [![Discord Server](https://discordapp.com/api/guilds/201345265821679617/widget.png?style=banner3)](https://discord.gg/XdJfN2X) + +# Special Thanks To +[](https://www.jetbrains.com) + +Jetbrains supports BedWars1058 with their [Open Source Licenses](https://www.jetbrains.com/opensource/). diff --git a/bedwars-api/pom.xml b/bedwars-api/pom.xml index 5dcbe3698..733d6f250 100644 --- a/bedwars-api/pom.xml +++ b/bedwars-api/pom.xml @@ -5,7 +5,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT 4.0.0 bedwars-api diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/IArena.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/IArena.java index 8ff0849b4..e15255569 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/IArena.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/IArena.java @@ -21,6 +21,7 @@ package com.andrei1058.bedwars.api.arena; import com.andrei1058.bedwars.api.arena.generator.IGenerator; +import com.andrei1058.bedwars.api.arena.stats.GameStatsHolder; import com.andrei1058.bedwars.api.arena.team.ITeam; import com.andrei1058.bedwars.api.arena.team.ITeamAssigner; import com.andrei1058.bedwars.api.configuration.ConfigManager; @@ -34,14 +35,13 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import org.jetbrains.annotations.Nullable; import java.time.Instant; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; +@SuppressWarnings("unused") public interface IArena { /** @@ -264,13 +264,22 @@ public interface IArena { * @param p Target player * @param finalKills True if you want to get the Final Kills. False for regular kills. */ + @Deprecated int getPlayerKills(Player p, boolean finalKills); + /** + * Session stats. + * @return stats container for this game. + */ + @Nullable + GameStatsHolder getStatsHolder(); + /** * Get the player beds destroyed count * * @param p Target player */ + @Deprecated int getPlayerBedsDestroyed(Player p); /** @@ -318,11 +327,13 @@ default boolean isRespawning(Player p) { /** * Add a kill point to the game stats. */ + @Deprecated void addPlayerKill(Player p, boolean finalKill, Player victim); /** * Add a destroyed bed point to the player temp stats. */ + @Deprecated void addPlayerBedDestroyed(Player p); @@ -343,6 +354,7 @@ default boolean isRespawning(Player p) { /** * Add a kill to the player temp stats. */ + @Deprecated void addPlayerDeath(Player p); /** @@ -392,6 +404,7 @@ default boolean isRespawning(Player p) { /** * Get player deaths. */ + @Deprecated int getPlayerDeaths(Player p, boolean finalDeaths); /** @@ -494,4 +507,33 @@ default boolean isRespawning(Player p) { void setTeamAssigner(ITeamAssigner teamAssigner); List getLeavingPlayers(); + + + /** + * Check if breaking map is allowed, otherwise only placed blocks are allowed. + * Some blocks like have a special protections, like blocks under shopkeepers, bed, ecc. + */ + @SuppressWarnings("BooleanMethodIsAlwaysInverted") + boolean isAllowMapBreak(); + + /** + * Toggle map block break rule. + */ + void setAllowMapBreak(boolean allowMapBreak); + + /** + * Check if there is a player bed at given location. + */ + boolean isTeamBed(Location location); + + /** + * Get owner team of a bed based on location. + */ + @Nullable ITeam getBedsTeam(Location location); + + /** + * Provides the winner team. + * This is populated on restarting phase. + */ + @Nullable ITeam getWinner(); } diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/DefaultStatistics.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/DefaultStatistics.java new file mode 100644 index 000000000..02c390555 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/DefaultStatistics.java @@ -0,0 +1,29 @@ +package com.andrei1058.bedwars.api.arena.stats; + +import org.jetbrains.annotations.NotNull; + +@SuppressWarnings("SpellCheckingInspection") +public enum DefaultStatistics { + + KILLS("kills", true), + KILLS_FINAL("finalKills", true), + DEATHS("deaths", true), + DEATHS_FINAL("finalDeaths", true), + BEDS_DESTROYED("bedsDestroyed", true); + + private final String id; + private final boolean incrementable; + DefaultStatistics(String id, boolean incrementable) { + this.id = id; + this.incrementable = incrementable; + } + + @Override + public @NotNull String toString() { + return id; + } + + public boolean isIncrementable() { + return incrementable; + } +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatistic.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatistic.java new file mode 100644 index 000000000..f143e8fe6 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatistic.java @@ -0,0 +1,29 @@ +package com.andrei1058.bedwars.api.arena.stats; + +import com.andrei1058.bedwars.api.language.Language; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Game statistic. + * @param statistic type. We usually work with integers. + */ +public interface GameStatistic extends Comparable> { + + /** + * Current value. + */ + T getValue(); + + /** + * Value displayed in tops etc. + * @param language - message receiver. + */ + String getDisplayValue(@Nullable Language language); + + /** + * Comparison for tops. + * @param o the object to be compared. + */ + int compareTo(@NotNull GameStatistic o); +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatisticProvider.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatisticProvider.java new file mode 100644 index 000000000..1e8d5b6e5 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatisticProvider.java @@ -0,0 +1,30 @@ +package com.andrei1058.bedwars.api.arena.stats; + +import com.andrei1058.bedwars.api.language.Language; +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.Nullable; + +public interface GameStatisticProvider> { + + /** + * Unique statistic identifier. + */ + String getIdentifier(); + + /** + * Plugin provider. + * @return statistic owner. + */ + Plugin getOwner(); + + /** + * Default value used when initializing game stats. + */ + T getDefault(); + + /** + * Display value for undetermined values. + * @param language desired translation. + */ + String getVoidReplacement(@Nullable Language language); +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatsHolder.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatsHolder.java new file mode 100644 index 000000000..aa5f588da --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/GameStatsHolder.java @@ -0,0 +1,96 @@ +package com.andrei1058.bedwars.api.arena.stats; + +import com.andrei1058.bedwars.api.arena.IArena; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +@SuppressWarnings("unused") +public interface GameStatsHolder { + + IArena getArena(); + + /** + * Register statistic. + * Throws a runtime exception if statistic is already registered. + * @param statistic new statistic. + */ + void register(@NotNull GameStatisticProvider statistic); + + /** + * Initialize game session stats for given player. + * @param player stats holder. + */ + PlayerGameStats init(Player player); + + /** + * Remove player tracked data. + * @param uuid holder. + */ + void unregisterPlayer(UUID uuid); + + /** + * Get existing or initialize statistic for given player. + * @param holder player holder. + * @return Existing or new statistic. + */ + @NotNull PlayerGameStats getCreate(@NotNull Player holder); + + /** + * Get existing or initialize statistic for given player. + * @param holder player holder. + * @return Existing or new statistic. + */ + Optional get(@NotNull UUID holder); + + /** + * Get existing or initialize statistic for given player. + * @param holder player holder. + * @return Existing or new statistic. + */ + default Optional get(@NotNull Player holder) { + return get(holder.getUniqueId()); + } + + /** + * Get tracked players. + * + * @return Unmodifiable list of tracked players. + */ + Collection> getTrackedPlayers(); + + + /** + * @param statistic Order collection by given statistic. + * @return top list. + */ + default Collection> getOrderedBy(@NotNull DefaultStatistics statistic) { + return getOrderedBy(statistic.toString()); + } + + /** + * @param statistic Order collection by given statistic. + * @return top list. + */ + List> getOrderedBy(@NotNull String statistic); + + /** + * Check if given statistic is registered. + */ + boolean hasStatistic(String orderBy); + + /** + * @return unmodifiable list of registered game statistics. + */ + List getRegistered(); + + /** + * Get statistic provider. + */ + @Nullable GameStatisticProvider getProvider(String registered); +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/Incrementable.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/Incrementable.java new file mode 100644 index 000000000..615e6d067 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/Incrementable.java @@ -0,0 +1,6 @@ +package com.andrei1058.bedwars.api.arena.stats; + +public interface Incrementable { + + void increment(); +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/PlayerGameStats.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/PlayerGameStats.java new file mode 100644 index 000000000..1b80736f9 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/stats/PlayerGameStats.java @@ -0,0 +1,39 @@ +package com.andrei1058.bedwars.api.arena.stats; + +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +/** + * Player stats container for a game. + */ +public interface PlayerGameStats { + + @NotNull UUID getPlayer(); + + /** + * @return player display name. + */ + @NotNull String getDisplayPlayer(); + + /** + * @return player username. + */ + @NotNull String getUsername(); + + void registerStatistic(@NotNull String id, @NotNull GameStatistic defaultValue); + + Optional> getStatistic(@NotNull String id); + + default Optional> getStatistic(@NotNull DefaultStatistics id) { + return getStatistic(id.toString()); + } + + /** + * List of registered statistics. + */ + @SuppressWarnings("unused") + List getRegistered(); +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/team/ITeam.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/team/ITeam.java index f55abf2e9..e0aefbea7 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/team/ITeam.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/arena/team/ITeam.java @@ -38,6 +38,11 @@ public interface ITeam { + /** + * Runtime identifier. + */ + UUID getIdentity(); + /** * Get team color. */ @@ -345,4 +350,17 @@ public interface ITeam { * @param location x,y,z. */ void setKillDropsLocation(Vector location); + + /** + * Check if bed is placed at given location. + * Or partial. + */ + boolean isBed(Location location); + + /** + * What happens when one of team beds is destroyed at given location. + */ + default void onBedDestroy(Location location) { + throw new RuntimeException("Not implemented yet"); + } } diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigManager.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigManager.java index 17bcbfa38..b1f9d9f6f 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigManager.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigManager.java @@ -47,6 +47,7 @@ public class ConfigManager { */ public ConfigManager(Plugin plugin, String name, String dir) { File d = new File(dir); + if (!d.exists()) { if (!d.mkdirs()) { plugin.getLogger().log(Level.SEVERE, "Could not create " + d.getPath()); @@ -208,6 +209,10 @@ public int getInt(String path) { return yml.getInt(path); } + public double getDouble(String path) { + return yml.getDouble(path); + } + /** * Get string at given path diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigPath.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigPath.java index a867601e3..54c381226 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigPath.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/ConfigPath.java @@ -23,6 +23,20 @@ @SuppressWarnings("WeakerAccess") public class ConfigPath { + public static final String GAME_END_PATH = "game-end"; + @GameMainOverridable + public static final String GENERAL_GAME_END_SHOW_ELIMINATED = GAME_END_PATH+".show-eliminated"; + @GameMainOverridable + public static final String GENERAL_GAME_END_TELEPORT_ELIMINATED = GAME_END_PATH+".teleport-eliminated"; + @GameMainOverridable + public static final String GENERAL_GAME_END_CHAT_TOP_STATISTIC = GAME_END_PATH+".chat-top.order-by"; + @GameMainOverridable + public static final String GENERAL_GAME_END_CHAT_TOP_HIDE_MISSING = GAME_END_PATH+".chat-top.hide-missing"; + @GameMainOverridable + public static final String GENERAL_GAME_END_SB_TOP_STATISTIC = GAME_END_PATH+".sb-top.order-by"; + @GameMainOverridable + public static final String GENERAL_GAME_END_SB_TOP_HIDE_MISSING = GAME_END_PATH+".sb-top.hide-missing"; + public static final String GENERATOR_STACK_ITEMS = "stack-items"; public static final String GENERATOR_IRON_DELAY = "iron.delay"; @@ -136,8 +150,13 @@ public class ConfigPath { public static final String SB_CONFIG_SIDEBAR_LIST_FORMAT_PLAYING = "scoreboard-settings.player-list.format-playing-list"; public static final String SB_CONFIG_SIDEBAR_LIST_FORMAT_RESTARTING = "scoreboard-settings.player-list.format-restarting-list"; public static final String SB_CONFIG_SIDEBAR_LIST_REFRESH = "scoreboard-settings.player-list.names-refresh-interval"; + public static final String SB_CONFIG_SIDEBAR_HEALTH_ENABLE = "scoreboard-settings.health.enable"; public static final String SB_CONFIG_SIDEBAR_HEALTH_IN_TAB = "scoreboard-settings.health.display-in-tab"; public static final String SB_CONFIG_SIDEBAR_HEALTH_REFRESH = "scoreboard-settings.health.animation-refresh-interval"; + + public static final String SB_CONFIG_TAB_HEADER_FOOTER_ENABLE = "scoreboard-settings.tab-header-footer.enable"; + public static final String SB_CONFIG_TAB_HEADER_FOOTER_REFRESH_INTERVAL = "scoreboard-settings.tab-header-footer.refresh-interval"; + public static final String GENERAL_CONFIGURATION_DISABLED_LANGUAGES = "disabled-languages"; public static final String GENERAL_CONFIGURATION_ARENA_SELECTOR_PATH = "arena-gui"; @@ -156,6 +175,7 @@ public class ConfigPath { public static final String GENERAL_CONFIGURATION_ENABLE_GEN_SPLIT = "enable-gen-split"; public static final String GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP = "server-ip"; + public static final String GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_POWERED_BY = "powered-by"; private static final String GENERAL_CHAT = "chat-settings."; public static final String GENERAL_CHAT_FORMATTING = GENERAL_CHAT+"format"; @@ -211,6 +231,15 @@ public class ConfigPath { public static final String GENERAL_TNT_JUMP_DAMAGE_TEAMMATES = GENERAL_TNT_JUMP_PATH + ".damage-teammates"; public static final String GENERAL_TNT_JUMP_DAMAGE_OTHERS = GENERAL_TNT_JUMP_PATH + ".damage-others"; + public static final String GENERAL_TNT_BLAST_PROTECTION = "blast-protection"; + public static final String GENERAL_TNT_PROTECTION_END_STONE_BLAST = GENERAL_TNT_BLAST_PROTECTION+".end-stone"; + public static final String GENERAL_TNT_PROTECTION_GLASS_BLAST = GENERAL_TNT_BLAST_PROTECTION+".glass"; + public static final String GENERAL_TNT_RAY_BLOCKED_BY_GLASS = GENERAL_TNT_BLAST_PROTECTION+".ray-blocked-by-glass"; + + public static final String GENERAL_TNT_PRIME = "tnt-prime-settings"; + public static final String GENERAL_TNT_AUTO_IGNITE = GENERAL_TNT_PRIME+".auto-ignite"; + public static final String GENERAL_TNT_FUSE_TICKS = GENERAL_TNT_PRIME+".fuse-ticks"; + private static final String GENERAL_FIREBALL_PATH = "fireball"; public static final String GENERAL_FIREBALL_EXPLOSION_SIZE = GENERAL_FIREBALL_PATH + ".explosion-size"; public static final String GENERAL_FIREBALL_SPEED_MULTIPLIER = GENERAL_FIREBALL_PATH + ".speed-multiplier"; @@ -233,7 +262,7 @@ public class ConfigPath { private static final String GENERAL_CONFIGURATION_HEAL_POOL = GENERAL_CONFIGURATION_PERFORMANCE_PATH+".heal-pool"; public static final String GENERAL_CONFIGURATION_HEAL_POOL_ENABLE = GENERAL_CONFIGURATION_HEAL_POOL+".enable"; - public static final String GENERAL_CONFIGURATION_HEAL_POOL_SEEN_TEAM_ONLY = GENERAL_CONFIGURATION_HEAL_POOL_ENABLE+".seen-by-team-only"; + public static final String GENERAL_CONFIGURATION_HEAL_POOL_SEEN_TEAM_ONLY = GENERAL_CONFIGURATION_HEAL_POOL+".seen-by-team-only"; public static final String SHOP_SETTINGS_PATH = "shop-settings"; public static final String SHOP_SPECIALS_PATH = "shop-specials"; public static final String SHOP_QUICK_DEFAULTS_PATH = "quick-buy-defaults"; diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/GameMainOverridable.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/GameMainOverridable.java new file mode 100644 index 000000000..7627e2293 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/configuration/GameMainOverridable.java @@ -0,0 +1,8 @@ +package com.andrei1058.bedwars.api.configuration; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface GameMainOverridable { +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/events/player/PlayerKillEvent.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/events/player/PlayerKillEvent.java index 40198608d..d1e836114 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/events/player/PlayerKillEvent.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/events/player/PlayerKillEvent.java @@ -21,18 +21,24 @@ package com.andrei1058.bedwars.api.events.player; import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.team.ITeam; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.function.Function; +@SuppressWarnings("unused") public class PlayerKillEvent extends Event { private static final HandlerList HANDLERS = new HandlerList(); private final IArena arena; private final Player victim; + private ITeam victimTeam; private final Player killer; + private ITeam killerTeam; private final PlayerKillCause cause; private Function message; private boolean playSound = true; @@ -42,12 +48,46 @@ public class PlayerKillEvent extends Event { * * @param killer can be NULL. */ - public PlayerKillEvent(IArena arena, Player victim, Player killer, Function message, PlayerKillCause cause) { + @Deprecated() + public PlayerKillEvent( + @NotNull IArena arena, + Player victim, + Player killer, + Function message, + PlayerKillCause cause) { + victimTeam = arena.getTeam(victim); + if (null == victimTeam) { + victimTeam = arena.getExTeam(victim.getUniqueId()); + } + + if (null != killer) { + killerTeam = arena.getTeam(killer); + if (null == killerTeam) { + killerTeam = arena.getExTeam(killer.getUniqueId()); + } + } + this.arena = arena; + this.victim = victim; + this.killer = killer; + this.message = message; + this.cause = cause; + } + + public PlayerKillEvent( + @NotNull IArena arena, + @NotNull Player victim, + @Nullable ITeam victimTeam, + @Nullable Player killer, + @Nullable ITeam killerTeam, + @Nullable Function message, + @NotNull PlayerKillCause cause) { this.arena = arena; this.victim = victim; this.killer = killer; this.message = message; this.cause = cause; + this.victimTeam = victimTeam; + this.killerTeam = killerTeam; } public enum PlayerKillCause { @@ -109,14 +149,14 @@ public Player getKiller() { /** * Get kill chat message. */ - public Function getMessage() { + public @Nullable Function getMessage() { return message; } /** * Set chat message. */ - public void setMessage(Function message) { + public void setMessage(@Nullable Function message) { this.message = message; } @@ -152,6 +192,23 @@ public void setPlaySound(boolean playSound) { this.playSound = playSound; } + + public ITeam getKillerTeam() { + return killerTeam; + } + + public ITeam getVictimTeam() { + return victimTeam; + } + + public void setKillerTeam(ITeam killerTeam) { + this.killerTeam = killerTeam; + } + + public void setVictimTeam(ITeam victimTeam) { + this.victimTeam = victimTeam; + } + public HandlerList getHandlers() { return HANDLERS; } diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Language.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Language.java index 4bf69bede..46d7ed201 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Language.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Language.java @@ -24,11 +24,12 @@ import com.andrei1058.bedwars.api.configuration.ConfigManager; import com.andrei1058.bedwars.api.configuration.ConfigPath; import com.andrei1058.bedwars.api.events.player.PlayerLangChangeEvent; +import net.md_5.bungee.api.ChatColor; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -45,6 +46,57 @@ public class Language extends ConfigManager { public Language(Plugin plugin, String iso) { super(plugin, "messages_" + iso, plugin.getDataFolder().getPath() + "/Languages"); this.iso = iso; + + // replace old placeholders + List oldMsg = getYml().getStringList(Messages.GAME_END_TOP_PLAYER_CHAT); + if (!oldMsg.isEmpty()) { + String[] oldTop1 = new String[]{"{firstName}", "{secondName}", "{thirdName}"}; + String[] oldTop2 = new String[]{"{firstKills}", "{secondKills}", "{thirdKills}"}; + + List newMsg = new ArrayList<>(); + for (String oldString : oldMsg) { + for (String oldPlaceholder : oldTop1) { + oldString = oldString.replace(oldPlaceholder, "{topPlayerName}"); + } + for (String oldPlaceholder : oldTop2) { + oldString = oldString.replace(oldPlaceholder, "{topValue}"); + } + newMsg.add(oldString); + } + + getYml().set(Messages.GAME_END_TOP_PLAYER_CHAT, newMsg); + } + + if (null != getYml().get("scoreboard")) { + for (String group : getYml().getConfigurationSection("scoreboard").getKeys(false)) { + if (group.equalsIgnoreCase("lobby")) { + relocate("scoreboard." + group, "sidebar." + group); + } else { + Map stages = new HashMap<>(); + stages.put("waiting", new String[]{Messages.SCOREBOARD_DEFAULT_WAITING, Messages.SCOREBOARD_DEFAULT_WAITING_SPEC}); + stages.put("starting", new String[]{Messages.SCOREBOARD_DEFAULT_STARTING, Messages.SCOREBOARD_DEFAULT_STARTING_SPEC}); + + for (Map.Entry stage : stages.entrySet()) { + if (exists("scoreboard." + group + "." + stage.getKey() + ".player")) { + relocate("scoreboard." + group + "." + stage.getKey() + ".player", stage.getValue()[0].replace("Default", group)); + } else { + relocate("scoreboard." + group + "." + stage.getKey(), stage.getValue()[0].replace("Default", group)); + } + if (exists("scoreboard." + group + "." + stage.getKey() + ".spectator")) { + relocate("scoreboard." + group + "." + stage.getKey() + ".spectator", stage.getValue()[1].replace("Default", group)); + } + } + if (exists("scoreboard." + group + ".playing.alive")) { + relocate("scoreboard." + group + ".playing.alive", Messages.SCOREBOARD_DEFAULT_PLAYING.replace("Default", group)); + relocate("scoreboard." + group + ".playing.spectator", Messages.SCOREBOARD_DEFAULT_PLAYING.replace("Default", group)); + } else { + relocate("scoreboard." + group + ".playing", Messages.SCOREBOARD_DEFAULT_PLAYING.replace("Default", group)); + } + } + } + getYml().set("scoreboard", null); + } + languages.add(this); } @@ -62,8 +114,8 @@ public void setPrefixStatic(String prefix) { /** * Get scoreboard strings. */ - public static List getScoreboard(Player p, String path, String alternative) { - Language language = getPlayerLanguage(p); + public static List getScoreboard(Player player, String path, String alternative) { + Language language = getPlayerLanguage(player); if (language.exists(path)) { return language.l(path); } else { @@ -92,16 +144,19 @@ public String getLangName() { /** * Get message in player's language. */ - public static String getMsg(Player p, String path) { - if (p == null) return getDefaultLanguage().m(path); - return langByPlayer.getOrDefault(p.getUniqueId(), getDefaultLanguage()).m(path).replace("{prefix}", (prefixStatic == null ? "" : prefixStatic)); + public static String getMsg(Player player, String path) { + if (player == null) { + return getDefaultLanguage().m(path); + } + return langByPlayer.getOrDefault(player.getUniqueId(), getDefaultLanguage()) + .m(path).replace("{prefix}", (prefixStatic == null ? "" : prefixStatic)); } /** * Retrieve a player language. */ - public static Language getPlayerLanguage(Player p) { - return langByPlayer.getOrDefault(p.getUniqueId(), getDefaultLanguage()); + public static Language getPlayerLanguage(@NotNull Player player) { + return langByPlayer.getOrDefault(player.getUniqueId(), getDefaultLanguage()); } public static Language getPlayerLanguage(UUID p) { @@ -118,8 +173,17 @@ public boolean exists(String path) { /** * Get a string list in player's language. */ - public static List getList(Player p, String path) { - return langByPlayer.getOrDefault(p.getUniqueId(), getDefaultLanguage()).l(path); + public static List getList(@NotNull Player player, String path) { + return langByPlayer.getOrDefault(player.getUniqueId(), getDefaultLanguage()).l(path); + } + + @SuppressWarnings("unused") + public void relocate(String from, String to) { + Object fromData = getYml().get(from); + if (null != fromData) { + this.getYml().set(to, fromData); + this.getYml().set(from, null); + } } /** @@ -153,8 +217,6 @@ public String m(String path) { return ChatColor.translateAlternateColorCodes('&', message .replace("{prefix}", (prefix == null ? "" : prefix)) .replace("{serverIp}", serverIp == null ? "" : serverIp) - // deprecated - .replace("{server_ip}", serverIp == null ? "" : serverIp) ); } @@ -193,7 +255,7 @@ public static boolean isLanguageExist(String iso) { /** * Get language with given info. * - * @return null if could not find. + * @return null if you could not find. */ public static Language getLang(String iso) { for (Language l : languages) { @@ -241,7 +303,7 @@ public static void setupCustomStatsMessages() { } @SuppressWarnings("WeakerAccess") - public void addDefaultStatsMsg(YamlConfiguration yml, String path, String name, String... lore) { + public void addDefaultStatsMsg(@NotNull YamlConfiguration yml, String path, String name, String... lore) { if (yml.getDefaults() == null || !yml.getDefaults().contains(Messages.PLAYER_STATS_GUI_PATH + "-" + path + "-name")) yml.addDefault(Messages.PLAYER_STATS_GUI_PATH + "-" + path + "-name", name); if (yml.getDefaults() == null || !yml.getDefaults().contains(Messages.PLAYER_STATS_GUI_PATH + "-" + path + "-lore")) @@ -328,7 +390,7 @@ public void setupUnSetCategories() { /** * Add required messages for a shop category to the given yml */ - public static void addCategoryMessages(YamlConfiguration yml, String categoryName, String invName, String itemName, List itemLore) { + public static void addCategoryMessages(@NotNull YamlConfiguration yml, String categoryName, String invName, String itemName, List itemLore) { if (yml.getDefaults() == null || !yml.getDefaults().contains(Messages.SHOP_CATEGORY_INVENTORY_NAME.replace("%category%", categoryName))) yml.addDefault(Messages.SHOP_CATEGORY_INVENTORY_NAME.replace("%category%", categoryName), invName); if (yml.getDefaults() == null || !yml.getDefaults().contains(Messages.SHOP_CATEGORY_ITEM_NAME.replace("%category%", categoryName))) @@ -340,7 +402,7 @@ public static void addCategoryMessages(YamlConfiguration yml, String categoryNam /** * Add required messages for a shop category to the given yml */ - public static void addContentMessages(YamlConfiguration yml, String contentName, String categoryName, String itemName, List itemLore) { + public static void addContentMessages(@NotNull YamlConfiguration yml, String contentName, String categoryName, String itemName, List itemLore) { final String path1 = Messages.SHOP_CONTENT_TIER_ITEM_NAME.replace("%category%", categoryName).replace("%content%", contentName), path2 = Messages.SHOP_CONTENT_TIER_ITEM_LORE.replace("%category%", categoryName).replace("%content%", contentName); if (yml.getDefaults() == null || !yml.getDefaults().contains(path1)) yml.addDefault(path1, itemName); @@ -391,7 +453,7 @@ public static boolean setPlayerLanguage(UUID uuid, String iso) { return true; } - public static String[] getCountDownTitle(Language playerLang, int second) { + public static String @NotNull [] getCountDownTitle(@NotNull Language playerLang, int second) { String[] result = new String[2]; result[0] = ChatColor.translateAlternateColorCodes('&', playerLang.getYml().get(Messages.ARENA_STATUS_START_COUNTDOWN_TITLE + "-" + second, playerLang.getString(Messages.ARENA_STATUS_START_COUNTDOWN_TITLE)).toString().replace("{second}", String.valueOf(second))); if (result[0].isEmpty()) { diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Messages.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Messages.java index 97e4759e9..17c8679d0 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Messages.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/language/Messages.java @@ -27,7 +27,9 @@ public class Messages { public static String PREFIX = "prefix"; - /** next event related */ + /** + * next event related + */ public static String NEXT_EVENT_DIAMOND_UPGRADE_II = "next-event-diamondII"; public static String NEXT_EVENT_DIAMOND_UPGRADE_III = "next-event-diamondIII"; public static String NEXT_EVENT_EMERALD_UPGRADE_II = "next-event-emeraldII"; @@ -42,7 +44,9 @@ public class Messages { public static String NEXT_EVENT_SUBTITLE_ANNOUNCE_SUDDEN_DEATH = "next-event-sudden-death-sub-title"; public static String NEXT_EVENT_CHAT_ANNOUNCE_SUDDEN_DEATH = "next-event-sudden-death-chat"; - /** General commands reply */ + /** + * General commands reply + */ public static String COMMAND_MAIN = "cmd-main-list"; public static String COMMAND_LANG_LIST_HEADER = "cmd-lang-list-header"; public static String COMMAND_LANG_LIST_FORMAT = "cmd-lang-list-format"; @@ -101,7 +105,9 @@ public class Messages { public static String COMMAND_FORCESTART_NO_PERM = "cmd-start-no-perm"; public static String COMMAND_COOLDOWN = "cmd-cooldown"; - /** Arena join/ leave related */ + /** + * Arena join/ leave related + */ public static String ARENA_JOIN_VIP_KICK = "arena-kicked-by-vip"; public static String ARENA_START_COUNTDOWN_STOPPED_INSUFF_PLAYERS_CHAT = "arena-countdown-stopped"; //public static String ARENA_PLAYER_QUIT = "player.quit"; @@ -111,7 +117,9 @@ public class Messages { public static String ARENA_SPECTATE_DENIED_SELECTOR = "arena-spectate-denied-selector"; public static String ARENA_LEAVE_PARTY_DISBANDED = "arena-leave-party-disbanded"; - /** Arena status/ status change related */ + /** + * Arena status/ status change related + */ public static String ARENA_STATUS_WAITING_NAME = "arena-status-waiting"; public static String ARENA_STATUS_STARTING_NAME = "arena-status-starting"; public static String ARENA_STATUS_PLAYING_NAME = "arena-status-playing"; @@ -125,14 +133,18 @@ public class Messages { public static String ARENA_STATUS_START_COUNTDOWN_CANCELLED_SUB_TITLE = "arena-countdown-stopped-subtitle"; public static String ARENA_DISPLAY_GROUP_PATH = "display-group-"; - /** Arena GUI related */ + /** + * Arena GUI related + */ public static String ARENA_GUI_INV_NAME = "arena-selector-gui-name"; public static String ARENA_GUI_ARENA_CONTENT_NAME = "arena-selector-content-name"; public static String ARENA_GUI_ARENA_CONTENT_LORE = "arena-selector-content-lore"; public static String ARENA_GUI_SKIPPED_ITEM_NAME = "arena-selector-skipped-item-name"; public static String ARENA_GUI_SKIPPED_ITEM_LORE = "arena-selector-skipped-item-lore"; - /** Spectator related */ + /** + * Spectator related + */ public static String ARENA_SPECTATOR_TELEPORTER_GUI_NAME = "spectator-tp-gui-name"; //{player} - returns display name, {prefix} - returns the player rank public static String ARENA_SPECTATOR_TELEPORTER_GUI_HEAD_NAME = "spectator-tp-gui-head-name"; @@ -147,18 +159,24 @@ public class Messages { public static String ARENA_SPECTATOR_FIRST_PERSON_LEAVE_TITLE = "spectator-first-person-quit-title"; public static String ARENA_SPECTATOR_FIRST_PERSON_LEAVE_SUBTITLE = "spectator-first-person-quit-subtitle"; - /** Stats related */ + /** + * Stats related + */ public static String PLAYER_STATS_GUI_PATH = "stats"; - public static String PLAYER_STATS_GUI_INV_NAME = PLAYER_STATS_GUI_PATH+"-inv-name"; + public static String PLAYER_STATS_GUI_INV_NAME = PLAYER_STATS_GUI_PATH + "-inv-name"; - /** Arena generators related */ + /** + * Arena generators related + */ public static String GENERATOR_HOLOGRAM_TIER = "generator-tier"; public static String GENERATOR_HOLOGRAM_TYPE_DIAMOND = "generator-diamond"; public static String GENERATOR_HOLOGRAM_TYPE_EMERALD = "generator-emerald"; public static String GENERATOR_HOLOGRAM_TIMER = "generator-timer"; public static String GENERATOR_UPGRADE_CHAT_ANNOUNCEMENT = "generator-upgrade-announce"; - /** General formatting */ + /** + * General formatting + */ public static String FORMATTING_CHAT_LOBBY = "format-chat-lobby"; public static String FORMATTING_CHAT_WAITING = "format-chat-waiting"; public static String FORMATTING_CHAT_SHOUT = "format-chat-global"; @@ -167,39 +185,80 @@ public class Messages { public static String FORMATTING_SCOREBOARD_DATE = "format-sb-date"; public static String FORMATTING_SCOREBOARD_TEAM_GENERIC = "format-sb-team-generic"; public static String FORMATTING_SCOREBOARD_HEALTH = "format-sb-health"; - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY = "format-sb-tab-prefix.lobby"; - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY = "format-sb-tab-suffix.lobby"; - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING = "format-sb-tab-prefix.waiting"; - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING = "format-sb-tab-suffix.waiting"; - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING = "format-sb-tab-prefix.starting"; - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING = "format-sb-tab-suffix.starting"; - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING = "format-sb-tab-prefix.playing"; - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING = "format-sb-tab-suffix.playing"; - - public static String FORMATTING_SIDEBAR_TAB_HEADER_LOBBY = "format-sb-tab-header.lobby"; - public static String FORMATTING_SIDEBAR_TAB_HEADER_WAITING = "format-sb-tab-header.waiting"; - public static String FORMATTING_SIDEBAR_TAB_HEADER_STARTING = "format-sb-tab-header.starting"; - public static String FORMATTING_SIDEBAR_TAB_HEADER_PLAYING = "format-sb-tab-header.playing"; - public static String FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING = "format-sb-tab-header.restarting"; - public static String FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR = "format-sb-tab-header.spectator"; - - public static String FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY = "format-sb-tab-footer.lobby"; - public static String FORMATTING_SIDEBAR_TAB_FOOTER_WAITING = "format-sb-tab-footer.waiting"; - public static String FORMATTING_SIDEBAR_TAB_FOOTER_STARTING = "format-sb-tab-footer.starting"; - public static String FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING = "format-sb-tab-footer.playing"; - public static String FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING = "format-sb-tab-footer.restarting"; - public static String FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR = "format-sb-tab-footer.spectator"; - @Deprecated - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_PRESTARTING = "format-sb-tab-prefix.restarting"; - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING = "format-sb-tab-prefix.restarting"; - @Deprecated - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_PRESTARTING = "format-sb-tab-suffix.restarting"; - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING = "format-sb-tab-suffix.restarting"; - public static String FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR = "format-sb-tab-prefix.spectator"; - public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR = "format-sb-tab-suffix.spectator"; - public static String FORMATTING_SPECTATOR_TEAM = "format-spectator-team"; - @Deprecated - public static String FORMATTING_SPECTATOR_COLOR = "format-spectator-color"; + + // TAB + public static String FORMATTING_SB_TAB_BASE = "format-tab"; + + // TAB LOBBY + public static String FORMATTING_SB_TAB_LOBBY_HEADER = FORMATTING_SB_TAB_BASE + ".lobby.header"; + public static String FORMATTING_SB_TAB_LOBBY_FOOTER = FORMATTING_SB_TAB_BASE + ".lobby.footer"; + public static String FORMATTING_SB_TAB_LOBBY_PREFIX = FORMATTING_SB_TAB_BASE + ".lobby.prefix"; + public static String FORMATTING_SB_TAB_LOBBY_SUFFIX = FORMATTING_SB_TAB_BASE + ".lobby.suffix"; + + // TAB WAITING + public static String FORMATTING_SB_TAB_WAITING_HEADER = FORMATTING_SB_TAB_BASE+".waiting.player.header"; + public static String FORMATTING_SB_TAB_WAITING_FOOTER = FORMATTING_SB_TAB_BASE+".waiting.player.footer"; + public static String FORMATTING_SB_TAB_WAITING_PREFIX = FORMATTING_SB_TAB_BASE+".waiting.player.prefix"; + public static String FORMATTING_SB_TAB_WAITING_SUFFIX = FORMATTING_SB_TAB_BASE+".waiting.player.suffix"; + // TAB WAITING FOR SPECTATORS + public static String FORMATTING_SB_TAB_WAITING_HEADER_SPEC = FORMATTING_SB_TAB_BASE+".waiting.spectator.header"; + public static String FORMATTING_SB_TAB_WAITING_FOOTER_SPEC = FORMATTING_SB_TAB_BASE+".waiting.spectator.footer"; + public static String FORMATTING_SB_TAB_WAITING_PREFIX_SPEC = FORMATTING_SB_TAB_BASE+".waiting.spectator.prefix"; + public static String FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC = FORMATTING_SB_TAB_BASE+".waiting.spectator.suffix"; + + // TAB STARTING + public static String FORMATTING_SB_TAB_STARTING_HEADER = FORMATTING_SB_TAB_BASE+".starting.player.header"; + public static String FORMATTING_SB_TAB_STARTING_FOOTER = FORMATTING_SB_TAB_BASE+".starting.player.footer"; + public static String FORMATTING_SB_TAB_STARTING_PREFIX = FORMATTING_SB_TAB_BASE+".starting.player.prefix"; + public static String FORMATTING_SB_TAB_STARTING_SUFFIX = FORMATTING_SB_TAB_BASE+".starting.player.suffix"; + // TAB STARTING FOR SPECTATORS + public static String FORMATTING_SB_TAB_STARTING_HEADER_SPEC = FORMATTING_SB_TAB_BASE+".starting.spectator.header"; + public static String FORMATTING_SB_TAB_STARTING_FOOTER_SPEC = FORMATTING_SB_TAB_BASE+".starting.spectator.footer"; + public static String FORMATTING_SB_TAB_STARTING_PREFIX_SPEC = FORMATTING_SB_TAB_BASE+".starting.player.prefix"; + public static String FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC = FORMATTING_SB_TAB_BASE+".starting.player.suffix"; + + // TAB PLAYING + public static String FORMATTING_SB_TAB_PLAYING_HEADER = FORMATTING_SB_TAB_BASE+".playing.alive.header"; + public static String FORMATTING_SB_TAB_PLAYING_FOOTER = FORMATTING_SB_TAB_BASE+".playing.alive.footer"; + public static String FORMATTING_SB_TAB_PLAYING_PREFIX = FORMATTING_SB_TAB_BASE+".playing.alive.prefix"; + public static String FORMATTING_SB_TAB_PLAYING_SUFFIX = FORMATTING_SB_TAB_BASE+".playing.alive.suffix"; + + // TAB PLAYING-ELIMINATED + public static String FORMATTING_SB_TAB_PLAYING_ELM_HEADER = FORMATTING_SB_TAB_BASE+".playing.eliminated.header"; + public static String FORMATTING_SB_TAB_PLAYING_ELM_FOOTER = FORMATTING_SB_TAB_BASE+".playing.eliminated.footer"; + public static String FORMATTING_SB_TAB_PLAYING_ELM_PREFIX = FORMATTING_SB_TAB_BASE+".playing.eliminated.prefix"; + public static String FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX = FORMATTING_SB_TAB_BASE+".playing.eliminated.suffix"; + + // TAB PLAYING FOR SPECTATORS + public static String FORMATTING_SB_TAB_PLAYING_SPEC_HEADER = FORMATTING_SB_TAB_BASE+".playing.spectator.header"; + public static String FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER = FORMATTING_SB_TAB_BASE+".playing.spectator.footer"; + public static String FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX = FORMATTING_SB_TAB_BASE+".playing.spectator.prefix"; + public static String FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX = FORMATTING_SB_TAB_BASE+".playing.spectator.suffix"; + + // TAB RESTARTING FOR WINNERS ALIVE + public static String FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER = FORMATTING_SB_TAB_BASE+".restarting.winner-alive.header"; + public static String FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER = FORMATTING_SB_TAB_BASE+".restarting.winner-alive.footer"; + public static String FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX = FORMATTING_SB_TAB_BASE+".restarting.winner-alive.prefix"; + public static String FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX = FORMATTING_SB_TAB_BASE+".restarting.winner-alive.suffix"; + + // TAB RESTARTING FOR WINNERS DEAD + public static String FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER = FORMATTING_SB_TAB_BASE+".restarting.winner-dead.header"; + public static String FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER = FORMATTING_SB_TAB_BASE+".restarting.winner-dead.footer"; + public static String FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX = FORMATTING_SB_TAB_BASE+".restarting.winner-dead.prefix"; + public static String FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX = FORMATTING_SB_TAB_BASE+".restarting.winner-dead.suffix"; + + + // TAB RESTARTING FOR LOSERS + public static String FORMATTING_SB_TAB_RESTARTING_ELM_HEADER = FORMATTING_SB_TAB_BASE+".restarting.loser.header"; + public static String FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER = FORMATTING_SB_TAB_BASE+".restarting.loser.footer"; + public static String FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX = FORMATTING_SB_TAB_BASE+".restarting.loser.prefix"; + public static String FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX = FORMATTING_SB_TAB_BASE+".restarting.loser.suffix"; + + // TAB RESTARTING FOR SPECTATORS + public static String FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER = FORMATTING_SB_TAB_BASE+".restarting.spectator.header"; + public static String FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER = FORMATTING_SB_TAB_BASE+".restarting.spectator.footer"; + public static String FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX = FORMATTING_SB_TAB_BASE+".restarting.spectator.prefix"; + public static String FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX = FORMATTING_SB_TAB_BASE+".restarting.spectator.suffix"; public static String FORMATTING_SCOREBOARD_TEAM_ELIMINATED = "format-sb-team-eliminated"; public static String FORMATTING_SCOREBOARD_BED_DESTROYED = "format-sb-bed-destroyed"; @@ -224,8 +283,11 @@ public class Messages { public static String FORMAT_UPGRADE_COLOR_CAN_AFFORD = "format-upgrade-color-can-afford"; public static String FORMAT_UPGRADE_COLOR_UNLOCKED = "format-upgrade-color-unlocked"; public static String FORMAT_UPGRADE_TRAP_COST = "format-upgrade-trap-cost"; + public static String FORMAT_SPECTATOR_TARGET = "format-spectator-target"; - /** Meaning/ Translations */ + /** + * Meaning/ Translations + */ public static String MEANING_FULL = "meaning-full"; public static String MEANING_SHOUT = "meaning-shout"; public static String MEANING_NEVER = "meaning-never"; @@ -242,13 +304,24 @@ public class Messages { public static String MEANING_VAULT_PLURAL = "meaning-vault-plural"; public static String MEANING_NO_TRAP = "meaning-no-trap"; - /** Scoreboard related */ - public static String SCOREBOARD_DEFAULT_WAITING = "scoreboard.Default.waiting"; - public static String SCOREBOARD_DEFAULT_STARTING = "scoreboard.Default.starting"; - public static String SCOREBOARD_DEFAULT_PLAYING = "scoreboard.Default.playing"; - public static String SCOREBOARD_LOBBY = "scoreboard.lobby"; - - /** Player interact related */ + /** + * Scoreboard related + */ + public static String SCOREBOARD_LOBBY = "sidebar.lobby"; + public static String SCOREBOARD_DEFAULT_WAITING = "sidebar.Default.waiting.player"; + public static String SCOREBOARD_DEFAULT_WAITING_SPEC = "sidebar.Default.waiting.spectator"; + public static String SCOREBOARD_DEFAULT_STARTING = "sidebar.Default.starting.player"; + public static String SCOREBOARD_DEFAULT_STARTING_SPEC = "sidebar.Default.starting.spectator"; + public static String SCOREBOARD_DEFAULT_PLAYING = "sidebar.Default.playing.alive"; + public static String SCOREBOARD_DEFAULT_PLAYING_SPEC = "sidebar.Default.playing.spectator"; + public static String SCOREBOARD_DEFAULT_RESTARTING_SPEC = "sidebar.Default.restarting.spectator"; + public static String SCOREBOARD_DEFAULT_RESTARTING_WIN1 = "sidebar.Default.restarting.winner-alive"; + public static String SCOREBOARD_DEFAULT_RESTARTING_WIN2 = "sidebar.Default.restarting.winner-eliminated"; + public static String SCOREBOARD_DEFAULT_RESTARTING_LOSER = "sidebar.Default.restarting.loser"; + + /** + * Player interact related + */ public static String INTERACT_CANNOT_PLACE_BLOCK = "interact-cant-place"; public static String INTERACT_CANNOT_BREAK_BLOCK = "interact-cant-break"; public static String INTERACT_CANNOT_BREAK_OWN_BED = "interact-cant-destroy-bed"; @@ -259,7 +332,9 @@ public class Messages { public static String INTERACT_CHEST_CANT_OPEN_TEAM_ELIMINATED = "interact-cant-open-chest"; public static String INTERACT_INVISIBILITY_REMOVED_DAMGE_TAKEN = "interact-invisibility-removed-damaged"; - /** PvP related */ + /** + * PvP related + */ public static String PLAYER_DIE_RESPAWN_TITLE = "player-respawn-title"; public static String PLAYER_DIE_RESPAWN_SUBTITLE = "player-respawn-subtitle"; public static String PLAYER_DIE_RESPAWN_CHAT = "player-respawn-timer-chat"; @@ -267,7 +342,7 @@ public class Messages { public static String PLAYER_DIE_ELIMINATED_CHAT = "player-eliminated-chat"; public static String PLAYER_DIE_VOID_FALL_REGULAR_KILL = "player-die-void-regular"; - public static String PLAYER_DIE_VOID_FALL_FINAL_KILL = "player-die-void-final"; + public static String PLAYER_DIE_VOID_FALL_FINAL_KILL = "player-die-void-final"; public static String PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL = "player-die-knocked-void-regular"; public static String PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL = "player-die-knocked-void-final"; public static String PLAYER_DIE_KNOCKED_BY_REGULAR_KILL = "player-die-knocked-fall-regular"; @@ -296,7 +371,9 @@ public class Messages { public static String PLAYER_HIT_BOW = "player-hit-bow"; - /** Misc */ + /** + * Misc + */ public static String GAME_END_GAME_OVER_PLAYER_TITLE = "game-end-game-over-title"; public static String GAME_END_VICTORY_PLAYER_TITLE = "game-end-victory-title"; public static String GAME_END_TOP_PLAYER_CHAT = "game-end-top-chat"; @@ -320,7 +397,9 @@ public class Messages { public static String TEAM_ELIMINATED_CHAT = "team-eliminated"; - /** Upgrades/ Shop*/ + /** + * Upgrades/ Shop + */ public static String NPC_NAME_TEAM_UPGRADES = "npc-team-upgrades"; public static String NPC_NAME_TEAM_SHOP = "npc-team-shop"; public static String NPC_NAME_SOLO_UPGRADES = "npc-solo-upgrades"; @@ -361,10 +440,10 @@ public class Messages { public static final String SHOP_PATH = "shop-items-messages"; public static final String SHOP_LORE_STATUS_CANT_AFFORD = "shop-lore-status-cant-afford"; public static final String SHOP_LORE_STATUS_CAN_BUY = "shop-lore-status-can-buy"; - public static final String SHOP_LORE_STATUS_MAXED = "shop-lore-status-tier-maxed"; + public static final String SHOP_LORE_STATUS_MAXED = "shop-lore-status-tier-maxed"; public static final String SHOP_LORE_STATUS_ARMOR = "shop-lore-status-armor"; - public static final String SHOP_LORE_QUICK_ADD = "shop-lore-quick-add"; - public static final String SHOP_LORE_QUICK_REMOVE = "shop-lore-quick-remove"; + public static final String SHOP_LORE_QUICK_ADD = "shop-lore-quick-add"; + public static final String SHOP_LORE_QUICK_REMOVE = "shop-lore-quick-remove"; public static final String SHOP_INDEX_NAME = SHOP_PATH + ".inventory-name"; public static final String SHOP_QUICK_ADD_NAME = SHOP_PATH + ".quick-buy-add-inventory-name"; public static final String SHOP_SEPARATOR_NAME = SHOP_PATH + ".separator-item-name"; @@ -379,18 +458,86 @@ public class Messages { public static final String SHOP_CATEGORY_ITEM_LORE = SHOP_PATH + ".%category%.category-item-lore"; public static final String SHOP_CONTENT_TIER_ITEM_NAME = SHOP_PATH + ".%category%.content-item-%content%-name"; public static final String SHOP_CONTENT_TIER_ITEM_LORE = SHOP_PATH + ".%category%.content-item-%content%-lore"; - public static final String SHOP_CAN_BUY_COLOR = SHOP_PATH+ ".can-buy-color"; - public static final String SHOP_CANT_BUY_COLOR = SHOP_PATH+ ".cant-buy-color"; + public static final String SHOP_CAN_BUY_COLOR = SHOP_PATH + ".can-buy-color"; + public static final String SHOP_CANT_BUY_COLOR = SHOP_PATH + ".cant-buy-color"; /* MultiArena Lobby Item Messages */ - public static final String GENERAL_CONFIGURATION_LOBBY_ITEMS_NAME = ConfigPath.GENERAL_CONFIGURATION_LOBBY_ITEMS_PATH+"-%path%-name"; - public static final String GENERAL_CONFIGURATION_LOBBY_ITEMS_LORE = ConfigPath.GENERAL_CONFIGURATION_LOBBY_ITEMS_PATH+"-%path%-lore"; + public static final String GENERAL_CONFIGURATION_LOBBY_ITEMS_NAME = ConfigPath.GENERAL_CONFIGURATION_LOBBY_ITEMS_PATH + "-%path%-name"; + public static final String GENERAL_CONFIGURATION_LOBBY_ITEMS_LORE = ConfigPath.GENERAL_CONFIGURATION_LOBBY_ITEMS_PATH + "-%path%-lore"; /* Spectator Items Messages */ - public static final String GENERAL_CONFIGURATION_SPECTATOR_ITEMS_NAME = ConfigPath.GENERAL_CONFIGURATION_SPECTATOR_ITEMS_PATH+"-%path%-name"; - public static final String GENERAL_CONFIGURATION_SPECTATOR_ITEMS_LORE = ConfigPath.GENERAL_CONFIGURATION_SPECTATOR_ITEMS_PATH+"-%path%-lore"; + public static final String GENERAL_CONFIGURATION_SPECTATOR_ITEMS_NAME = ConfigPath.GENERAL_CONFIGURATION_SPECTATOR_ITEMS_PATH + "-%path%-name"; + public static final String GENERAL_CONFIGURATION_SPECTATOR_ITEMS_LORE = ConfigPath.GENERAL_CONFIGURATION_SPECTATOR_ITEMS_PATH + "-%path%-lore"; /* Arena waiting Items Messages */ - public static final String GENERAL_CONFIGURATION_WAITING_ITEMS_NAME = ConfigPath.GENERAL_CONFIGURATION_PRE_GAME_ITEMS_PATH+"-%path%-name"; - public static final String GENERAL_CONFIGURATION_WAITING_ITEMS_LORE = ConfigPath.GENERAL_CONFIGURATION_PRE_GAME_ITEMS_PATH+"-%path%-lore"; + public static final String GENERAL_CONFIGURATION_WAITING_ITEMS_NAME = ConfigPath.GENERAL_CONFIGURATION_PRE_GAME_ITEMS_PATH + "-%path%-name"; + public static final String GENERAL_CONFIGURATION_WAITING_ITEMS_LORE = ConfigPath.GENERAL_CONFIGURATION_PRE_GAME_ITEMS_PATH + "-%path%-lore"; + + + + // DEPRECATIONS FOR REMOVAL + + // LOBBY TAB + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_HEADER_LOBBY = FORMATTING_SB_TAB_LOBBY_HEADER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY = FORMATTING_SB_TAB_LOBBY_FOOTER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY = FORMATTING_SB_TAB_LOBBY_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY = FORMATTING_SB_TAB_LOBBY_SUFFIX; + // WAITING TAB + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_HEADER_WAITING = FORMATTING_SB_TAB_WAITING_HEADER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_FOOTER_WAITING = FORMATTING_SB_TAB_WAITING_FOOTER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING = FORMATTING_SB_TAB_WAITING_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING = FORMATTING_SB_TAB_WAITING_SUFFIX; + // STARTING TAB + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_HEADER_STARTING = FORMATTING_SB_TAB_STARTING_HEADER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_FOOTER_STARTING = FORMATTING_SB_TAB_STARTING_FOOTER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING = FORMATTING_SB_TAB_STARTING_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING = FORMATTING_SB_TAB_STARTING_SUFFIX; + // PLAYING TAB + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_HEADER_PLAYING = FORMATTING_SB_TAB_PLAYING_HEADER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING = FORMATTING_SB_TAB_PLAYING_FOOTER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING = FORMATTING_SB_TAB_PLAYING_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING = FORMATTING_SB_TAB_PLAYING_SUFFIX; + // SPECTATING TAB + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR = FORMATTING_SB_TAB_PLAYING_SPEC_HEADER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR = FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR = FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR = FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX; + // RESTARTING TAB + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_PRESTARTING = FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING = FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_PRESTARTING = FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING = FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING = FORMATTING_SB_TAB_RESTARTING_ELM_HEADER; + @Deprecated(forRemoval = true) + public static String FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING = FORMATTING_SB_TAB_PLAYING_SPEC_HEADER; + + @Deprecated(forRemoval = true) + public static String FORMATTING_SPECTATOR_TEAM = "format-spectator-team"; + @Deprecated(forRemoval = true) + public static String FORMATTING_SPECTATOR_COLOR = FORMATTING_SPECTATOR_TEAM; } diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/RestoreAdapter.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/RestoreAdapter.java index 8bcdc6fe7..bd8831a52 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/RestoreAdapter.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/RestoreAdapter.java @@ -101,4 +101,6 @@ public Plugin getOwner() { * Let them load on BedWars1058 main Thread so they will be converted before getting loaded. */ public abstract void convertWorlds(); + + public abstract String getDisplayName(); } diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/VersionSupport.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/VersionSupport.java index 0c0647ad8..873ef2fe9 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/VersionSupport.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/VersionSupport.java @@ -25,9 +25,7 @@ import com.andrei1058.bedwars.api.arena.team.TeamColor; import com.andrei1058.bedwars.api.entity.Despawnable; import com.andrei1058.bedwars.api.exceptions.InvalidEffectException; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.command.Command; @@ -39,12 +37,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.Plugin; -import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; import org.jetbrains.annotations.Nullable; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; public abstract class VersionSupport { @@ -55,8 +51,8 @@ public abstract class VersionSupport { private Effect eggBridge; - private static ConcurrentHashMap despawnables = new ConcurrentHashMap<>(); - private Plugin plugin; + private static final ConcurrentHashMap despawnables = new ConcurrentHashMap<>(); + private final Plugin plugin; public VersionSupport(Plugin plugin, String versionName) { name2 = versionName; @@ -137,6 +133,13 @@ protected void loadDefaultEffects() { */ public abstract boolean isInvisibilityPotion(ItemStack itemStack); + /** + * Check if type is a Glass type material + */ + public boolean isGlass(Material type) { + return type != Material.AIR && (type == Material.GLASS || type.toString().contains("_GLASS")); + } + /** * Register custom entities */ @@ -205,9 +208,9 @@ public boolean isDespawnable(Entity e) { public abstract void colorBed(ITeam team); /** - * Register tnt whitelist + * Modify block blast resistance. */ - public abstract void registerTntWhitelist(); + public abstract void registerTntWhitelist(float endStoneBlast, float glassBlast); /** * Egg bridge particles @@ -245,8 +248,10 @@ public void setEggBridgeEffect(String eggBridge) throws InvalidEffectException { /** * Get a custom item tag. + * * @return null if not present. */ + @SuppressWarnings("unused") public abstract String getTag(ItemStack itemStack, String key); /** @@ -266,8 +271,6 @@ public void setEggBridgeEffect(String eggBridge) throws InvalidEffectException { public abstract ItemStack createItemStack(String material, int amount, short data); - public abstract void teamCollideRule(Team team); - /** * Check if is a player head */ diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/sidebar/ISidebar.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/sidebar/ISidebar.java index 201030526..403bd782b 100644 --- a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/sidebar/ISidebar.java +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/sidebar/ISidebar.java @@ -48,13 +48,25 @@ public interface ISidebar { * * @param player format given player on current holder's sidebar. * @param skipStateCheck will skip checking if tab formatting is disabled. + * @param spectator when you already know the player is a spectator. E.g. on join. Null will let the plugin whether the player is spectator or not. */ - void giveUpdateTabFormat(@NotNull Player player, boolean skipStateCheck); + void giveUpdateTabFormat(@NotNull Player player, boolean skipStateCheck, @Nullable Boolean spectator); + + /** + * Will update tab prefix and suffix for the given player on current sidebar. + * + * @param player format given player on current holder's sidebar. + * @param skipStateCheck will skip checking if tab formatting is disabled. + */ + default void giveUpdateTabFormat(@NotNull Player player, boolean skipStateCheck) { + giveUpdateTabFormat(player, skipStateCheck, null); + } /** - * @return true if tab formatting is disabled for current sidebar/ arena stage + * @return true if tab formatting is disabled for current sidebar/ arena stage. */ + @Deprecated(forRemoval = true) boolean isTabFormattingDisabled(); /** diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlastProtectionUtil.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlastProtectionUtil.java new file mode 100644 index 000000000..538173b88 --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlastProtectionUtil.java @@ -0,0 +1,99 @@ +package com.andrei1058.bedwars.api.util; + +import com.andrei1058.bedwars.api.BedWars; +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.configuration.ConfigPath; +import com.andrei1058.bedwars.api.server.VersionSupport; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; + +import java.util.LinkedList; +import java.util.concurrent.atomic.AtomicInteger; + +public class BlastProtectionUtil { + + private final VersionSupport versionSupport; + private final BedWars api; + + public BlastProtectionUtil(VersionSupport versionSupport, BedWars api) { + this.versionSupport = versionSupport; + this.api = api; + } + + + /** + * Check if block is protected by blast-proof glass or an unbreakable block from a point of view + *

+ * if pov is null, block is checked by {@link VersionSupport#isGlass(Material)} and {@link IArena#isBlockPlaced(Block)} instead. + * Otherwise, a ray tracing is performed to check whether there is any glass block or an unbreakable block. + *

+ * If arena is null, then glass only be checked. + * + * @param arena Arena instance. + * @param pov the point of view. + * @param block the block instance. + * @param step how frequent to check the ray (0.25 - 0.5 recommended). + * @return whether there's unbreakable block between the pov and the block + */ + public boolean isProtected(@NotNull IArena arena, Location pov, @NotNull Block block, double step) { + + if (arena.isProtected(block.getLocation()) || arena.isTeamBed(block.getLocation())) { + return true; + } + + boolean rayBlockedByGlass = api.getConfigs().getMainConfig().getBoolean(ConfigPath.GENERAL_TNT_RAY_BLOCKED_BY_GLASS); + + // Trace blocks from pov to the block location + final Location target = block.getLocation(); + + LinkedList targetVectors = new LinkedList<>(); + + double alteredRayStep = 0.73; + // x + for (double XrayRadius = alteredRayStep * -1; XrayRadius <= alteredRayStep; XrayRadius+= alteredRayStep) { + // y + for (double YrayRadius = alteredRayStep * -1; YrayRadius <= alteredRayStep; YrayRadius+= alteredRayStep) { + // z + for (double ZrayRadius = alteredRayStep * -1; ZrayRadius <= alteredRayStep; ZrayRadius+= alteredRayStep) { + targetVectors.add(pov.clone().toVector().toBlockVector().add(new Vector(XrayRadius, YrayRadius, ZrayRadius))); + } + } + } + + AtomicInteger protectedTimes = new AtomicInteger(); + int totalRays = targetVectors.size(); + + targetVectors.forEach(targetVector -> { + BlockRay ray; + try { + ray = new BlockRay(block.getWorld(), targetVector, target.toVector(), step); + } catch (IllegalArgumentException ignored) { + return; + } + + while (ray.hasNext()) { + Block nextBlock = ray.next(); + + if (nextBlock.getType() == Material.AIR) { + continue; + } + + if (rayBlockedByGlass && versionSupport.isGlass(nextBlock.getType())) { + // If a block is a glass + protectedTimes.getAndIncrement(); + return; + } + + if (!arena.isBlockPlaced(nextBlock) && !arena.isAllowMapBreak()) { + protectedTimes.getAndIncrement(); + return; + } + } + }); + + return totalRays - protectedTimes.get() < 6; + } +} diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlockRay.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlockRay.java new file mode 100644 index 000000000..77ab8cc7a --- /dev/null +++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/util/BlockRay.java @@ -0,0 +1,187 @@ +package com.andrei1058.bedwars.api.util; + +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.util.NumberConversions; +import org.bukkit.util.Vector; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +/* + Used for tracing blocks between two vectors. + Note: this could return the same blocks multiple times. +*/ +public class BlockRay implements Iterator { + private final World world; + + private final Vector delta; + + private final double multiple; + private final int parts; + private int consumed; + + private final double xOffset; + private final double yOffset; + private final double zOffset; + + private double lcx; + private double lcy; + private double lcz; + + private int currentBlock; + + private final Block[] blockQueue; + + /** + * Constructs a BlockRay instance. + * + * @param world bukkit world to get the blocks from. + * @param src the source vector (where we shoot the ray). + * @param dst the destination vector. + * @param step how frequent to check the ray (0.25 - 0.5 recommended). + */ + public BlockRay(World world, Vector src, Vector dst, double step) { + + // How much `pov` needs to change in order to reach the target + this.delta = new Vector( + dst.getBlockX() - src.getBlockX(), + dst.getBlockY() - src.getBlockY(), + dst.getBlockZ() - src.getBlockZ() + ); + + if (delta.lengthSquared() == 0) { + throw new IllegalArgumentException("The source vector is the same as the destination vector"); + } + + this.world = world; + + // Coordinates for where we should shoot our ray + // Exactly from the center. + this.xOffset = src.getBlockX() + 0.5; + this.yOffset = src.getBlockY() + 0.5; + this.zOffset = src.getBlockZ() + 0.5; + + // The last vector components (last offset) + this.lcx = 0; + this.lcy = 0; + this.lcz = 0; + + // How much one part is worth + this.multiple = (1 / (delta.length() / step)); + + // How many sections `delta` could be split up to + this.parts = NumberConversions.ceil(delta.length() / step); + + // Where we hold our components per step + // 0 -> X component + // 1 -> Y component + // 2 -> Z component + // 3 -> XY component + // 4 -> XZ component + // 5 -> ZY component + // 6 -> Resultant + this.blockQueue = new Block[7]; + + // The current component (gets decremented whenever next() is called) + this.currentBlock = 6; + + scan(); + } + + @Override + public boolean hasNext() { + return consumed <= parts || currentBlock >= 0; + } + + /** + * This could return similar blocks multiple times. + * + * @return Current block at the ray's position. + */ + @Override + public Block next() { + if (!hasNext()) { + throw new NoSuchElementException("No more blocks"); + } + + if (currentBlock < 0) { + scan(); + currentBlock = 6; + } + + return blockQueue[currentBlock--]; + + } + + private void scan() { + double cx = (multiple * delta.getX() * consumed); + double cy = (multiple * delta.getY() * consumed); + double cz = (multiple * delta.getZ() * consumed); + + int lastXFloor = NumberConversions.floor(xOffset + lcx); + int lastYFloor = NumberConversions.floor(yOffset + lcy); + int lastZFloor = NumberConversions.floor(zOffset + lcz); + + int currentXFloor = NumberConversions.floor(xOffset + cx); + int currentYFloor = NumberConversions.floor(yOffset + cy); + int currentZFloor = NumberConversions.floor(zOffset + cz); + + + // Get the X component separately + blockQueue[0] = world.getBlockAt( + currentXFloor, + lastYFloor, + lastZFloor + ); + + // Get the Y component separately + blockQueue[1] = world.getBlockAt( + lastXFloor, + currentYFloor, + lastZFloor + ); + + // Get the Z component separately + blockQueue[2] = world.getBlockAt( + lastXFloor, + lastYFloor, + currentZFloor + ); + + // Get the XY separately + blockQueue[3] = world.getBlockAt( + currentXFloor, + currentYFloor, + lastZFloor + ); + + // Get the XZ separately + blockQueue[4] = world.getBlockAt( + currentXFloor, + lastYFloor, + currentZFloor + ); + + // Get the ZY separately + blockQueue[5] = world.getBlockAt( + lastXFloor, + currentYFloor, + currentZFloor + ); + + // Get the resultant (cx, cy, cz) together + blockQueue[6] = world.getBlockAt( + currentXFloor, + currentYFloor, + currentZFloor + ); + + lcx = cx; + lcy = cy; + lcz = cz; + + consumed += 1; + } + +} diff --git a/bedwars-plugin/pom.xml b/bedwars-plugin/pom.xml index 366e9f5ac..07104ed6c 100644 --- a/bedwars-plugin/pom.xml +++ b/bedwars-plugin/pom.xml @@ -5,7 +5,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT 4.0.0 bedwars-plugin @@ -94,13 +94,13 @@ org.bstats bstats-bukkit - 3.0.1 + 3.0.2 true de.simonsator DevelopmentPAFSpigot - 1.0.67 + 1.0.239 provided @@ -177,6 +177,21 @@ versionsupport_v1_19_R2 ${project.version} + + com.andrei1058.bedwars + versionsupport_v1_19_R3 + ${project.version} + + + com.andrei1058.bedwars + versionsupport_v1_20_R1 + ${project.version} + + + com.andrei1058.bedwars + versionsupport_v1_20_R2 + ${project.version} + com.andrei1058.bedwars versionsupport-common @@ -191,7 +206,7 @@ me.clip placeholderapi - 2.11.2 + 2.11.3 provided @@ -204,7 +219,7 @@ commons-io commons-io - 2.11.0 + 2.13.0 true @@ -224,7 +239,7 @@ org.slf4j slf4j-simple - 2.0.6 + 2.0.7 true @@ -232,46 +247,84 @@ com.andrei1058.spigot.sidebar sidebar-base - 23.3 + 23.10 + compile + + + com.andrei1058.spigot.sidebar + sidebar-v1_8_R3 + 23.10 + compile + + + com.andrei1058.spigot.sidebar + sidebar-v1_12_R1 + 23.10 compile com.andrei1058.spigot.sidebar - sidebar-eight - 23.3 + sidebar-v1_16_R1 + 23.10 compile com.andrei1058.spigot.sidebar - sidebar-twelve - 23.3 + sidebar-v1_17_R1 + 23.10 compile com.andrei1058.spigot.sidebar - sidebar-sixteen - 23.3 + sidebar-v1_18_R2 + 23.10 compile com.andrei1058.spigot.sidebar - sidebar-seventeen - 23.3 + sidebar-v1_19_R2 + 23.10 compile com.andrei1058.spigot.sidebar - sidebar-eighteen - 23.3 + sidebar-v1_19_R3 + 23.10 compile com.andrei1058.spigot.sidebar - sidebar-nineteen - 23.3 + sidebar-v1_20_R1 + 23.10 + compile + + + com.andrei1058.spigot.sidebar + sidebar-v1_20_R2 + 23.10 compile + + + com.andrei1058.bedwars + resetadapter-slimepaper + ${project.version} + + + + com.andrei1058.bedwars + resetadapter-aswm + ${project.version} + + + + + net.md-5 + bungeecord-chat + 1.18-R0.1-SNAPSHOT + provided + @@ -288,7 +341,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.5.0 diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java index ecc69ff9e..6f351c6b1 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/BedWars.java @@ -35,6 +35,7 @@ import com.andrei1058.bedwars.arena.despawnables.TargetListener; import com.andrei1058.bedwars.arena.feature.SpoilPlayerTNTFeature; import com.andrei1058.bedwars.arena.spectator.SpectatorListeners; +import com.andrei1058.bedwars.arena.stats.DefaultStatsHandler; import com.andrei1058.bedwars.arena.tasks.OneTick; import com.andrei1058.bedwars.arena.tasks.Refresh; import com.andrei1058.bedwars.arena.upgrades.BaseListener; @@ -64,10 +65,7 @@ import com.andrei1058.bedwars.money.internal.MoneyListeners; import com.andrei1058.bedwars.shop.ShopManager; import com.andrei1058.bedwars.sidebar.*; -import com.andrei1058.bedwars.sidebar.thread.RefreshTitleTask; -import com.andrei1058.bedwars.sidebar.thread.RefreshPlaceholdersTask; -import com.andrei1058.bedwars.sidebar.thread.RefreshLifeTask; -import com.andrei1058.bedwars.sidebar.thread.RefreshTabListTask; +import com.andrei1058.bedwars.sidebar.thread.*; import com.andrei1058.bedwars.stats.StatsManager; import com.andrei1058.bedwars.support.citizens.CitizensListener; import com.andrei1058.bedwars.support.citizens.JoinNPC; @@ -97,6 +95,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; @@ -221,44 +220,9 @@ public void onEnable() { nms.registerVersionListeners(); - if (Bukkit.getPluginManager().getPlugin("Enhanced-SlimeWorldManager") != null) { - try { - //noinspection rawtypes - Constructor constructor = Class.forName("com.andrei1058.bedwars.arena.mapreset.eswm.ESlimeAdapter").getConstructor(Plugin.class); - try { - api.setRestoreAdapter((RestoreAdapter) constructor.newInstance(this)); - this.getLogger().info("Hook into Enhanced-SlimeWorldManager support!"); - } catch (InstantiationException e) { - e.printStackTrace(); - api.setRestoreAdapter(new InternalAdapter(this)); - this.getLogger().info("Failed to hook into Enhanced-SlimeWorldManager support! Using the internal reset adapter."); - } - } catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | - InvocationTargetException e) { - e.printStackTrace(); - api.setRestoreAdapter(new InternalAdapter(this)); - this.getLogger().info("Failed to hook into Enhanced-SlimeWorldManager support! Using the internal reset adapter."); - } - } else if (checkSWM()) { - try { - //noinspection rawtypes - Constructor constructor = Class.forName("com.andrei1058.bedwars.arena.mapreset.slime.SlimeAdapter").getConstructor(Plugin.class); - try { - api.setRestoreAdapter((RestoreAdapter) constructor.newInstance(this)); - this.getLogger().info("Hook into SlimeWorldManager support!"); - } catch (InstantiationException e) { - e.printStackTrace(); - api.setRestoreAdapter(new InternalAdapter(this)); - this.getLogger().info("Failed to hook into SlimeWorldManager support! Using internal reset adapter."); - } - } catch (NoSuchMethodException | ClassNotFoundException | IllegalAccessException | - InvocationTargetException e) { - e.printStackTrace(); - api.setRestoreAdapter(new InternalAdapter(this)); - this.getLogger().info("Failed to hook into SlimeWorldManager support! Using internal reset adapter."); - } - } else { + if (!this.handleWorldAdapter()) { api.setRestoreAdapter(new InternalAdapter(this)); + getLogger().info("Using internal world restore system."); } /* Register commands */ @@ -307,8 +271,13 @@ public void onEnable() { }, 1L); // Register events - registerEvents(new EnderPearlLanded(), new QuitAndTeleportListener(), new BreakPlace(), new DamageDeathMove(), new Inventory(), new Interact(), new RefreshGUI(), new HungerWeatherSpawn(), new CmdProcess(), - new FireballListener(), new EggBridge(), new SpectatorListeners(), new BaseListener(), new TargetListener(), new LangListener(), new Warnings(this), new ChatAFK(), new GameEndListener()); + registerEvents( + new EnderPearlLanded(), new QuitAndTeleportListener(), new BreakPlace(), new DamageDeathMove(), + new Inventory(), new Interact(), new RefreshGUI(), new HungerWeatherSpawn(), new CmdProcess(), + new FireballListener(), new EggBridge(), new SpectatorListeners(), new BaseListener(), + new TargetListener(), new LangListener(), new Warnings(this), new ChatAFK(), + new GameEndListener(), new DefaultStatsHandler() + ); if (config.getBoolean(ConfigPath.GENERAL_CONFIGURATION_HEAL_POOL_ENABLE)) { registerEvents(new HealPoolListner()); @@ -428,7 +397,7 @@ public void onEnable() { ArenaSocket.sendMessage(Arena.getArenas().get(0)); } }*/ - }, 40L); + }, 5L); /* Save messages for stats gui items if custom items added, for each language */ Language.setupCustomStatsMessages(); @@ -487,7 +456,10 @@ public void onEnable() { } /* Protect glass walls from tnt explosion */ - nms.registerTntWhitelist(); + nms.registerTntWhitelist( + (float) config.getDouble(ConfigPath.GENERAL_TNT_PROTECTION_END_STONE_BLAST), + (float) config.getDouble(ConfigPath.GENERAL_TNT_PROTECTION_GLASS_BLAST) + ); /* Prevent issues on reload */ for (Player p : Bukkit.getOnlinePlayers()) { @@ -551,49 +523,61 @@ public void onEnable() { int playerListRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_LIST_REFRESH); if (playerListRefreshInterval < 1) { - Bukkit.getLogger().info("Scoreboard names list refresh is disabled. (Is set to " + playerListRefreshInterval + ")."); + Bukkit.getLogger().info("Scoreboard names list refresh is disabled. (It is set to " + playerListRefreshInterval + ")."); } else { if (playerListRefreshInterval < 20) { Bukkit.getLogger().warning("Scoreboard names list refresh interval is set to: " + playerListRefreshInterval); Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks."); Bukkit.getLogger().warning("If you expect performance issues please increase its timer."); } - Bukkit.getScheduler().runTaskTimer(this, new RefreshTabListTask(), 23L, playerListRefreshInterval); + Bukkit.getScheduler().runTaskTimer(this, new RefreshPlayerListTask(), 1L, playerListRefreshInterval); } int placeholdersRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_PLACEHOLDERS_REFRESH_INTERVAL); if (placeholdersRefreshInterval < 1) { - Bukkit.getLogger().info("Scoreboard placeholders refresh is disabled. (Is set to " + placeholdersRefreshInterval + ")."); + Bukkit.getLogger().info("Scoreboard placeholders refresh is disabled. (It is set to " + placeholdersRefreshInterval + ")."); } else { if (placeholdersRefreshInterval < 20) { Bukkit.getLogger().warning("Scoreboard placeholders refresh interval is set to: " + placeholdersRefreshInterval); Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks."); Bukkit.getLogger().warning("If you expect performance issues please increase its timer."); } - Bukkit.getScheduler().runTaskTimer(this, new RefreshPlaceholdersTask(), 28L, placeholdersRefreshInterval); + Bukkit.getScheduler().runTaskTimer(this, new RefreshPlaceholdersTask(), 1L, placeholdersRefreshInterval); } int titleRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_TITLE_REFRESH_INTERVAL); if (titleRefreshInterval < 1) { - Bukkit.getLogger().info("Scoreboard title refresh is disabled. (Is set to " + titleRefreshInterval + ")."); + Bukkit.getLogger().info("Scoreboard title refresh is disabled. (It is set to " + titleRefreshInterval + ")."); } else { if (titleRefreshInterval < 4) { Bukkit.getLogger().warning("Scoreboard title refresh interval is set to: " + titleRefreshInterval); Bukkit.getLogger().warning("If you expect performance issues please increase its timer."); } - Bukkit.getScheduler().runTaskTimerAsynchronously(this, new RefreshTitleTask(), 32L, titleRefreshInterval); + Bukkit.getScheduler().runTaskTimerAsynchronously(this, new RefreshTitleTask(), 1L, titleRefreshInterval); } int healthAnimationInterval = config.getInt(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_REFRESH); if (healthAnimationInterval < 1) { - Bukkit.getLogger().info("Scoreboard health animation refresh is disabled. (Is set to " + healthAnimationInterval + ")."); + Bukkit.getLogger().info("Scoreboard health animation refresh is disabled. (It is set to " + healthAnimationInterval + ")."); } else { if (healthAnimationInterval < 20) { Bukkit.getLogger().warning("Scoreboard health animation refresh interval is set to: " + healthAnimationInterval); Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks."); Bukkit.getLogger().warning("If you expect performance issues please increase its timer."); } - Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new RefreshLifeTask(), 40L, healthAnimationInterval); + Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new RefreshLifeTask(), 1L, healthAnimationInterval); + } + + int tabHeaderFooterRefreshInterval = config.getInt(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_REFRESH_INTERVAL); + if (tabHeaderFooterRefreshInterval < 1 || !config.getBoolean(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_ENABLE)) { + Bukkit.getLogger().info("Scoreboard Tab header-footer refresh is disabled."); + } else { + if (tabHeaderFooterRefreshInterval < 20) { + Bukkit.getLogger().warning("Scoreboard tab header-footer refresh interval is set to: " + tabHeaderFooterRefreshInterval); + Bukkit.getLogger().warning("It is not recommended to use a value under 20 ticks."); + Bukkit.getLogger().warning("If you expect performance issues please increase its timer."); + } + Bukkit.getScheduler().runTaskTimer(this, new RefreshTabHeaderFooterTask(), 1L, tabHeaderFooterRefreshInterval); } registerEvents(new ScoreboardListener()); @@ -606,6 +590,54 @@ public void onEnable() { SpoilPlayerTNTFeature.init(); } + /** + * Try loading custom adapter support. + * @return true when custom adapter was registered. + */ + private boolean handleWorldAdapter() { + Plugin swmPlugin = Bukkit.getPluginManager().getPlugin("SlimeWorldManager"); + + if (null == swmPlugin){ + return false; + } + PluginDescriptionFile pluginDescription = swmPlugin.getDescription(); + if (null == pluginDescription) { + return false; + } + + String[] versionString = pluginDescription.getVersion().split("\\."); + + + try { + int major = Integer.parseInt(versionString[0]); + int minor = Integer.parseInt(versionString[1]); + int release = versionString.length > 2 ? Integer.parseInt(versionString[2]) : 0; + + String adapterPath; + if (major == 2 && minor == 2 && release == 1) { + adapterPath = "com.andrei1058.bedwars.arena.mapreset.slime.SlimeAdapter"; + } else if (major == 2 && minor == 8 && release == 0) { + adapterPath = "com.andrei1058.bedwars.arena.mapreset.slime.AdvancedSlimeAdapter"; + } else if (major > 2 || major == 2 && minor >= 10) { + adapterPath = "com.andrei1058.bedwars.arena.mapreset.slime.SlimePaperAdapter"; + } else { + return false; + } + + Constructor constructor = Class.forName(adapterPath).getConstructor(Plugin.class); + getLogger().info("Loading restore adapter: "+adapterPath+" ..."); + + RestoreAdapter candidate = (RestoreAdapter) constructor.newInstance(this); + api.setRestoreAdapter(candidate); + getLogger().info("Hook into "+candidate.getDisplayName()+" as restore adapter."); + return true; + } catch (Exception e) { + e.printStackTrace(); + this.getLogger().info("Something went wrong! Using internal reset adapter..."); + } + return false; + } + private void registerDelayedCommands() { if (!nms.isBukkitCommandRegistered("shout")) { nms.registerCommand("shout", new ShoutCommand("shout")); @@ -784,41 +816,6 @@ public static com.andrei1058.bedwars.api.BedWars getAPI() { return api; } - /** - * This is used to check if can hook in SlimeWorldManager support. - * - * @return true if can load swm support. - */ - private boolean checkSWM() { - Plugin plugin = Bukkit.getPluginManager().getPlugin("SlimeWorldManager"); - if (plugin == null) return false; - switch (plugin.getDescription().getVersion()) { - case "2.2.0": - case "2.1.3": - case "2.1.2": - case "2.1.1": - case "2.1.0": - case "2.0.5": - case "2.0.4": - case "2.0.3": - case "2.0.2": - case "2.0.1": - case "2.0.0": - case "1.1.4": - case "1.1.3": - case "1.1.2": - case "1.1.1": - case "1.1.0": - case "1.0.2": - case "1.0.1": - case "1.0.0-BETA": - getLogger().warning("Could not hook into SlimeWorldManager support! You are running an unsupported version"); - return false; - default: - return true; - } - } - public static boolean isShuttingDown() { return shuttingDown; } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Arena.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Arena.java index 8af06c959..9b1236040 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Arena.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Arena.java @@ -27,6 +27,7 @@ import com.andrei1058.bedwars.api.arena.generator.GeneratorType; import com.andrei1058.bedwars.api.arena.generator.IGenerator; import com.andrei1058.bedwars.api.arena.shop.ShopHolo; +import com.andrei1058.bedwars.api.arena.stats.*; import com.andrei1058.bedwars.api.arena.team.ITeam; import com.andrei1058.bedwars.api.arena.team.ITeamAssigner; import com.andrei1058.bedwars.api.arena.team.TeamColor; @@ -46,9 +47,12 @@ import com.andrei1058.bedwars.api.language.Messages; import com.andrei1058.bedwars.api.region.Region; import com.andrei1058.bedwars.api.server.ServerType; +import com.andrei1058.bedwars.api.sidebar.ISidebar; import com.andrei1058.bedwars.api.tasks.PlayingTask; import com.andrei1058.bedwars.api.tasks.RestartingTask; import com.andrei1058.bedwars.api.tasks.StartingTask; +import com.andrei1058.bedwars.arena.stats.GameStatsManager; +import com.andrei1058.bedwars.arena.stats.StatisticsOrdered; import com.andrei1058.bedwars.arena.tasks.GamePlayingTask; import com.andrei1058.bedwars.arena.tasks.GameRestartingTask; import com.andrei1058.bedwars.arena.tasks.GameStartingTask; @@ -63,9 +67,10 @@ import com.andrei1058.bedwars.listeners.dropshandler.PlayerDrops; import com.andrei1058.bedwars.money.internal.MoneyPerMinuteTask; import com.andrei1058.bedwars.shop.ShopCache; +import com.andrei1058.bedwars.sidebar.BwSidebar; import com.andrei1058.bedwars.sidebar.SidebarService; import com.andrei1058.bedwars.support.citizens.JoinNPC; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import com.andrei1058.bedwars.support.papi.SupportPAPI; import com.andrei1058.bedwars.support.vault.WithEconomy; import net.md_5.bungee.api.chat.ClickEvent; @@ -85,6 +90,7 @@ import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.time.Instant; @@ -149,15 +155,7 @@ public class Arena implements IArena { */ private static final HashMap playerLocation = new HashMap<>(); - /** - * temp stats. some of them use player name as key to keep names of players who left. at checkWinners for example. - * Those maps are not used for db stats but is for internal use only. - */ - private HashMap playerKills = new HashMap<>(); - private HashMap playerBedsDestroyed = new HashMap<>(); - private HashMap playerFinalKills = new HashMap<>(); - private HashMap playerDeaths = new HashMap<>(); - private HashMap playerFinalKillDeaths = new HashMap<>(); + private final GameStatsManager gameStats = new GameStatsManager(this); /* ARENA TASKS */ @@ -179,6 +177,9 @@ public class Arena implements IArena { private Instant startTime; private ITeamAssigner teamAssigner = new TeamAssigner(); + private boolean allowMapBreak = false; + private @Nullable ITeam winner; + /** * Load an arena. * This will check if it was set up right. @@ -212,11 +213,6 @@ public Arena(String name, Player p) { cm = new ArenaConfig(BedWars.plugin, name, plugin.getDataFolder().getPath() + "/Arenas"); - //if (mapManager.isLevelWorld()) { - // Main.plugin.getLogger().severe("COULD NOT LOAD ARENA: " + name); - // //return; - //} - yml = cm.getYml(); if (yml.get("Team") == null) { if (p != null) p.sendMessage("You didn't set any team for arena: " + name); @@ -233,6 +229,7 @@ public Arena(String name, Player p) { minPlayers = yml.getInt("minPlayers"); allowSpectate = yml.getBoolean("allowSpectate"); islandRadius = yml.getInt(ConfigPath.ARENA_ISLAND_RADIUS); + allowMapBreak = yml.getBoolean(ConfigPath.ARENA_ALLOW_MAP_BREAK); if (config.getYml().get("arenaGroups") != null) { if (config.getYml().getStringList("arenaGroups").contains(yml.getString("group"))) { group = yml.getString("group"); @@ -501,12 +498,12 @@ public boolean addPlayer(Player p, boolean skipOwnerCheck) { for (Player on : players) { on.sendMessage( getMsg(on, Messages.COMMAND_JOIN_PLAYER_JOIN_MSG) - .replace("{vPrefix}", getChatSupport().getPrefix(p)) - .replace("{vSuffix}", getChatSupport().getSuffix(p)) - .replace("{playername}", p.getName()) - .replace("{player}", p.getDisplayName()) - .replace("{on}", String.valueOf(getPlayers().size())) - .replace("{max}", String.valueOf(getMaxPlayers())) + .replace("{vPrefix}", getChatSupport().getPrefix(p)) + .replace("{vSuffix}", getChatSupport().getSuffix(p)) + .replace("{playername}", p.getName()) + .replace("{player}", p.getDisplayName()) + .replace("{on}", String.valueOf(getPlayers().size())) + .replace("{max}", String.valueOf(getMaxPlayers())) ); } setArenaByPlayer(p, this); @@ -548,9 +545,9 @@ public boolean addPlayer(Player p, boolean skipOwnerCheck) { new PlayerGoods(p, true); playerLocation.put(p, p.getLocation()); } - PaperSupport.teleportC(p, getWaitingLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, getWaitingLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); - if (!isStatusChange){ + if (!isStatusChange) { SidebarService.getInstance().giveSidebar(p, this, false); } sendPreGameCommandItems(p); @@ -655,16 +652,16 @@ public boolean addSpectator(@NotNull Player p, boolean playerBefore, Location st if (!playerBefore) { if (staffTeleport == null) { - PaperSupport.teleportC(p, getSpectatorLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, getSpectatorLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); } else { - PaperSupport.teleportC(p, staffTeleport, PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, staffTeleport, PlayerTeleportEvent.TeleportCause.PLUGIN); } } p.setGameMode(GameMode.ADVENTURE); Bukkit.getScheduler().runTaskLater(plugin, () -> { - if(leaving.contains(p)) return; + if (leaving.contains(p)) return; p.setAllowFlight(true); p.setFlying(true); }, 5L); @@ -673,7 +670,7 @@ public boolean addSpectator(@NotNull Player p, boolean playerBefore, Location st p.getPassenger().remove(); Bukkit.getScheduler().runTask(plugin, () -> { - if(leaving.contains(p)) return; + if (leaving.contains(p)) return; for (Player on : Bukkit.getOnlinePlayers()) { if (on == p) continue; if (getSpectators().contains(on)) { @@ -691,12 +688,12 @@ public boolean addSpectator(@NotNull Player p, boolean playerBefore, Location st if (!playerBefore) { if (staffTeleport == null) { - PaperSupport.teleportC(p, getSpectatorLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, getSpectatorLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); } else { - PaperSupport.teleport(p, staffTeleport); + TeleportManager.teleport(p, staffTeleport); } } else { - PaperSupport.teleport(p, getSpectatorLocation()); + TeleportManager.teleport(p, getSpectatorLocation()); } p.setAllowFlight(true); @@ -748,7 +745,7 @@ public boolean addSpectator(@NotNull Player p, boolean playerBefore, Location st * @param disconnect True if the player was disconnected */ public void removePlayer(@NotNull Player p, boolean disconnect) { - if(leaving.contains(p)) { + if (leaving.contains(p)) { return; } else { leaving.add(p); @@ -761,7 +758,7 @@ public void removePlayer(@NotNull Player p, boolean disconnect) { Arena.afkCheck.remove(p.getUniqueId()); BedWars.getAPI().getAFKUtil().setPlayerAFK(p, false); - if (getStatus() == GameState.playing) { + if (status == GameState.playing) { for (ITeam t : getTeams()) { if (t.isMember(p)) { team = t; @@ -835,7 +832,7 @@ public void removePlayer(@NotNull Player p, boolean disconnect) { } } else if (alive_teams == 0 && !BedWars.isShuttingDown()) { Bukkit.getScheduler().runTaskLater(BedWars.plugin, () -> changeStatus(GameState.restarting), 10L); - } else if(!BedWars.isShuttingDown()) { + } else if (!BedWars.isShuttingDown()) { //ReJoin feature new ReJoin(p, this, team, cacheList); } @@ -853,24 +850,34 @@ public void removePlayer(@NotNull Player p, boolean disconnect) { message = Messages.PLAYER_DIE_PVP_LOG_OUT_REGULAR; cause = PlayerKillEvent.PlayerKillCause.PLAYER_DISCONNECT; } - PlayerKillEvent event = new PlayerKillEvent(this, p, lastDamager, player -> Language.getMsg(player, message), cause); - for (Player inGame : getPlayers()) { - Language lang = Language.getPlayerLanguage(inGame); - inGame.sendMessage(event.getMessage().apply(inGame) - .replace("{PlayerTeamName}", team.getDisplayName(lang)) - .replace("{PlayerColor}", team.getColor().chat().toString()).replace("{PlayerName}", p.getDisplayName()) - .replace("{KillerColor}", killerTeam.getColor().chat().toString()) - .replace("{KillerName}", lastDamager.getDisplayName()) - .replace("{KillerTeamName}", killerTeam.getDisplayName(lang))); + + PlayerKillEvent event = new PlayerKillEvent(this, p, team, lastDamager, killerTeam, + player -> Language.getMsg(player, message), cause + ); + Bukkit.getPluginManager().callEvent(event); + + if (null != event.getMessage()) { + for (Player inGame : getPlayers()) { + Language lang = Language.getPlayerLanguage(inGame); + inGame.sendMessage(event.getMessage().apply(inGame) + .replace("{PlayerTeamName}", team.getDisplayName(lang)) + .replace("{PlayerColor}", team.getColor().chat().toString()).replace("{PlayerName}", p.getDisplayName()) + .replace("{KillerColor}", killerTeam.getColor().chat().toString()) + .replace("{KillerName}", lastDamager.getDisplayName()) + .replace("{KillerTeamName}", killerTeam.getDisplayName(lang))); + } } - for (Player inGame : getSpectators()) { - Language lang = Language.getPlayerLanguage(inGame); - inGame.sendMessage(event.getMessage().apply(inGame) - .replace("{PlayerTeamName}", team.getDisplayName(lang)) - .replace("{PlayerColor}", team.getColor().chat().toString()).replace("{PlayerName}", p.getDisplayName()) - .replace("{KillerColor}", killerTeam.getColor().chat().toString()) - .replace("{KillerName}", lastDamager.getDisplayName()) - .replace("{KillerTeamName}", killerTeam.getDisplayName(lang))); + + if (null != event.getMessage()) { + for (Player inGame : getSpectators()) { + Language lang = Language.getPlayerLanguage(inGame); + inGame.sendMessage(event.getMessage().apply(inGame) + .replace("{PlayerTeamName}", team.getDisplayName(lang)) + .replace("{PlayerColor}", team.getColor().chat().toString()).replace("{PlayerName}", p.getDisplayName()) + .replace("{KillerColor}", killerTeam.getColor().chat().toString()) + .replace("{KillerName}", lastDamager.getDisplayName()) + .replace("{KillerTeamName}", killerTeam.getDisplayName(lang))); + } } PlayerDrops.handlePlayerDrops(this, p, lastDamager, team, killerTeam, cause, new ArrayList<>(Arrays.asList(p.getInventory().getContents()))); } @@ -917,7 +924,7 @@ public void removePlayer(@NotNull Player p, boolean disconnect) { p.removePotionEffect(pf.getType()); } - if(!BedWars.isShuttingDown()) { + if (!BedWars.isShuttingDown()) { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> { for (Player on : Bukkit.getOnlinePlayers()) { if (on.equals(p)) continue; @@ -989,7 +996,7 @@ public void removePlayer(@NotNull Player p, boolean disconnect) { // fix #340 // remove player from party if leaves and the owner is still in the arena while waiting or starting - if (getStatus() == GameState.waiting || getStatus() == GameState.starting) { + if (status == GameState.waiting || status == GameState.starting) { if (BedWars.getParty().hasParty(p) && !BedWars.getParty().isOwner(p)) { for (Player pl : BedWars.getParty().getMembers(p)) { if (BedWars.getParty().isOwner(pl) && pl.getWorld().getName().equalsIgnoreCase(getArenaName())) { @@ -1014,7 +1021,7 @@ public void removePlayer(@NotNull Player p, boolean disconnect) { public void removeSpectator(@NotNull Player p, boolean disconnect) { debug("Spectator removed: " + p.getName() + " arena: " + getArenaName()); - if(leaving.contains(p)) { + if (leaving.contains(p)) { return; } else { leaving.add(p); @@ -1058,7 +1065,7 @@ public void removeSpectator(@NotNull Player p, boolean disconnect) { } playerLocation.remove(p); - if(!BedWars.isShuttingDown()) { + if (!BedWars.isShuttingDown()) { Bukkit.getScheduler().runTask(plugin, () -> { for (Player on : Bukkit.getOnlinePlayers()) { if (on.equals(p)) continue; @@ -1152,7 +1159,7 @@ public boolean reJoin(Player p) { //new PlayerGoods(p, true, true); playerLocation.put(p, p.getLocation()); } - PaperSupport.teleportC(p, getSpectatorLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, getSpectatorLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); p.getInventory().clear(); //restore items before re-spawning in team @@ -1200,7 +1207,7 @@ public void restart() { if (getRestartingTask() != null) getRestartingTask().cancel(); if (getStartingTask() != null) getStartingTask().cancel(); if (getPlayingTask() != null) getPlayingTask().cancel(); - if (null != moneyperMinuteTask){ + if (null != moneyperMinuteTask) { moneyperMinuteTask.cancel(); } if (null != perMinuteTask) { @@ -1378,22 +1385,47 @@ public boolean isBlockPlaced(Block block) { /** * Get a player kills count. * - * @param p Target player + * @param player Target player * @param finalKills True if you want to get the Final Kills. False for regular kills. */ - public int getPlayerKills(Player p, boolean finalKills) { - if (finalKills) return playerFinalKills.getOrDefault(p, 0); - return playerKills.getOrDefault(p.getName(), 0); + @Deprecated(forRemoval = true) + public int getPlayerKills(Player player, boolean finalKills) { + if (null == player || null == getStatsHolder()) { + return 0; + } + + Optional> st = getStatsHolder().get(player).flatMap(stats -> + stats.getStatistic(finalKills ? DefaultStatistics.KILLS_FINAL : DefaultStatistics.BEDS_DESTROYED) + ); + + if (st.isEmpty()) { + return 0; + } + + GameStatistic gs = st.get(); + return gs instanceof Incrementable ? (int) gs.getValue() : 0; } /** * Get the player beds destroyed count * - * @param p Target player + * @param player Target player */ - public int getPlayerBedsDestroyed(Player p) { - if (playerBedsDestroyed.containsKey(p)) return playerBedsDestroyed.get(p); - return 0; + @Deprecated(forRemoval = true) + public int getPlayerBedsDestroyed(Player player) { + if (null == player || null == getStatsHolder()) { + return 0; + } + + Optional> st = getStatsHolder().get(player) + .flatMap(stats -> stats.getStatistic(DefaultStatistics.BEDS_DESTROYED)); + + if (st.isEmpty()) { + return 0; + } + + GameStatistic gs = st.get(); + return gs instanceof Incrementable ? (int) gs.getValue() : 0; } /** @@ -1458,6 +1490,12 @@ public void setStatus(GameState status) { * Change game status starting tasks. */ public void changeStatus(GameState status) { + + // prevent called twice #https://github.com/andrei1058/BedWars1058/issues/774 + if (status == this.status) { + return; + } + if (this.status != GameState.playing && status == GameState.playing) { startTime = Instant.now(); } @@ -1473,6 +1511,9 @@ public void changeStatus(GameState status) { Arena.afkCheck.remove(p.getUniqueId()); BedWars.getAPI().getAFKUtil().setPlayerAFK(p, false); } + + // Initialize game stats + getPlayers().forEach(gameStats::init); } //Stop active tasks to prevent issues @@ -1494,7 +1535,7 @@ public void changeStatus(GameState status) { restartingTask.cancel(); } restartingTask = null; - if (null != moneyperMinuteTask){ + if (null != moneyperMinuteTask) { moneyperMinuteTask.cancel(); } if (null != perMinuteTask) { @@ -1622,32 +1663,15 @@ public List getSpectators() { /** * Add a kill point to the game stats. */ - public void addPlayerKill(Player p, boolean finalKill, Player victim) { - if (p == null) return; - if (playerKills.containsKey(p.getName())) { - playerKills.replace(p.getName(), playerKills.get(p.getName()) + 1); - } else { - playerKills.put(p.getName(), 1); - } - if (finalKill) { - if (playerFinalKills.containsKey(p)) { - playerFinalKills.replace(p, playerFinalKills.get(p) + 1); - } else { - playerFinalKills.put(p, 1); - } - playerFinalKillDeaths.put(victim, 1); - } + @Deprecated(forRemoval = true) + public void addPlayerKill(Player player, boolean finalKill, Player victim) { } /** * Add a destroyed bed point to the player temp stats. */ - public void addPlayerBedDestroyed(Player p) { - if (playerBedsDestroyed.containsKey(p)) { - playerBedsDestroyed.replace(p, playerBedsDestroyed.get(p) + 1); - return; - } - playerBedsDestroyed.put(p, 1); + @Deprecated(forRemoval = true) + public void addPlayerBedDestroyed(Player player) { } /** @@ -1833,9 +1857,8 @@ public ITeam getPlayerTeam(String playerCache) { * It will manage the arena restart and the needed stuff. */ public void checkWinner() { - if (getStatus() != GameState.restarting) { + if (status != GameState.restarting) { int max = getTeams().size(), eliminated = 0; - ITeam winner = null; for (ITeam t : getTeams()) { if (t.getMembers().isEmpty()) { eliminated++; @@ -1851,15 +1874,9 @@ public void checkWinner() { p.getInventory().clear(); } } - String firstName = ""; - String secondName = ""; - String thirdName = ""; StringBuilder winners = new StringBuilder(); //noinspection deprecation for (Player p : winner.getMembersCache()) { - if (p.getWorld().equals(getWorld())) { - nms.sendTitle(p, getMsg(p, Messages.GAME_END_VICTORY_PLAYER_TITLE), null, 0, 70, 20); - } if (!winners.toString().contains(p.getDisplayName())) { winners.append(p.getDisplayName()).append(" "); } @@ -1867,61 +1884,81 @@ public void checkWinner() { if (winners.toString().endsWith(" ")) { winners = new StringBuilder(winners.substring(0, winners.length() - 1)); } - int first = 0, second = 0, third = 0; - if (!playerKills.isEmpty()) { + StatisticsOrdered topInChat = null; - LinkedHashMap reverseSortedMap = new LinkedHashMap<>(); + if (null != getStatsHolder()) { + topInChat = new StatisticsOrdered( + this, getConfig().getGameOverridableString(ConfigPath.GENERAL_GAME_END_CHAT_TOP_STATISTIC) + ); + // hide stats row completely when placeholders cannot be replaced + if (getConfig().getGameOverridableBoolean(ConfigPath.GENERAL_GAME_END_CHAT_TOP_HIDE_MISSING)) { + topInChat.setBoundsPolicy(StatisticsOrdered.BoundsPolicy.SKIP); + } + } - //Use Comparator.reverseOrder() for reverse ordering - playerKills.entrySet() - .stream() - .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) - .forEachOrdered(x -> reverseSortedMap.put(x.getKey(), x.getValue())); + // this is assigned to scoreboards + StatisticsOrdered topInSidebar = new StatisticsOrdered( + this, getConfig().getGameOverridableString(ConfigPath.GENERAL_GAME_END_SB_TOP_STATISTIC) + ); - int entry = 0; - for (Map.Entry e : reverseSortedMap.entrySet()) { - if (entry == 0) { - firstName = e.getKey(); - Player onlinePlayer = Bukkit.getPlayerExact(e.getKey()); - if (onlinePlayer != null) { - firstName = onlinePlayer.getDisplayName(); - } - first = e.getValue(); - } else if (entry == 1) { - secondName = e.getKey(); - Player onlinePlayer = Bukkit.getPlayerExact(e.getKey()); - if (onlinePlayer != null) { - secondName = onlinePlayer.getDisplayName(); - } - second = e.getValue(); - } else if (entry == 2) { - thirdName = e.getKey(); - Player onlinePlayer = Bukkit.getPlayerExact(e.getKey()); - if (onlinePlayer != null) { - thirdName = onlinePlayer.getDisplayName(); + // hide stats row completely when placeholders cannot be replaced + if (getConfig().getGameOverridableBoolean(ConfigPath.GENERAL_GAME_END_SB_TOP_HIDE_MISSING)) { + topInSidebar.setBoundsPolicy(StatisticsOrdered.BoundsPolicy.SKIP); + } + + List receivers = new ArrayList<>(getPlayers().size() + getSpectators().size()); + receivers.addAll(getPlayers()); + receivers.addAll(getSpectators()); + + if (null != topInChat) { + StatisticsOrdered.StringParser statParser = topInChat.newParser(); + + for (Player receiver : receivers) { + + Language playerLang = Language.getPlayerLanguage(receiver); + + String winnerTeamChat = playerLang.m(Messages.GAME_END_TEAM_WON_CHAT); + // check if message disabled + if (null != winnerTeamChat && !winnerTeamChat.isBlank()) { + receiver.sendMessage(winnerTeamChat.replace("{TeamColor}", winner.getColor().chat().toString()) + .replace("{TeamName}", winner.getDisplayName(playerLang))); + } + + if (winner.getMembers().contains(receiver) || winner.wasMember(receiver.getUniqueId())) { + nms.sendTitle(receiver, getMsg(receiver, Messages.GAME_END_VICTORY_PLAYER_TITLE), null, 0, 70, 20); + } else { + nms.sendTitle(receiver, playerLang.m(Messages.GAME_END_GAME_OVER_PLAYER_TITLE), null, 0, 70, 20); + } + + statParser.resetIndex(); + + // check if message is disabled + List topChat = getList(receiver, Messages.GAME_END_TOP_PLAYER_CHAT); + if (topChat.isEmpty() || topChat.size() == 1 && topChat.get(0).isEmpty()) { + continue; + } + + for (String s : topChat) { + + String msg = statParser.parseString(s, playerLang, playerLang.m(Messages.MEANING_NOBODY)); + if (null == msg) { + continue; } - third = e.getValue(); - break; + + msg = msg.replace("{winnerFormat}", getMaxInTeam() > 1 ? playerLang.m(Messages.FORMATTING_TEAM_WINNER_FORMAT).replace("{members}", winners.toString()) : playerLang.m(Messages.FORMATTING_SOLO_WINNER_FORMAT).replace("{members}", winners.toString())) + .replace("{TeamColor}", winner.getColor().chat().toString()).replace("{TeamName}", winner.getDisplayName(playerLang)); + + receiver.sendMessage(SupportPAPI.getSupportPAPI().replace(receiver, msg)); + } + + ISidebar sidebar = SidebarService.getInstance().getSidebar(receiver); + if (sidebar instanceof BwSidebar) { + ((BwSidebar) sidebar).setTopStatistics(topInSidebar); } - entry++; - } - } - for (Player p : world.getPlayers()) { - p.sendMessage(getMsg(p, Messages.GAME_END_TEAM_WON_CHAT).replace("{TeamColor}", winner.getColor().chat().toString()) - .replace("{TeamName}", winner.getDisplayName(Language.getPlayerLanguage(p)))); - if (!winner.getMembers().contains(p)) { - nms.sendTitle(p, getMsg(p, Messages.GAME_END_GAME_OVER_PLAYER_TITLE), null, 0, 70, 20); - } - for (String s : getList(p, Messages.GAME_END_TOP_PLAYER_CHAT)) { - String message = s.replace("{firstName}", firstName.isEmpty() ? getMsg(p, Messages.MEANING_NOBODY) : firstName).replace("{firstKills}", String.valueOf(first)) - .replace("{secondName}", secondName.isEmpty() ? getMsg(p, Messages.MEANING_NOBODY) : secondName).replace("{secondKills}", String.valueOf(second)) - .replace("{thirdName}", thirdName.isEmpty() ? getMsg(p, Messages.MEANING_NOBODY) : thirdName).replace("{thirdKills}", String.valueOf(third)) - .replace("{winnerFormat}", getMaxInTeam() > 1 ? getMsg(p, Messages.FORMATTING_TEAM_WINNER_FORMAT).replace("{members}", winners.toString()) : getMsg(p, Messages.FORMATTING_SOLO_WINNER_FORMAT).replace("{members}", winners.toString())) - .replace("{TeamColor}", winner.getColor().chat().toString()).replace("{TeamName}", winner.getDisplayName(Language.getPlayerLanguage(p))); - p.sendMessage(SupportPAPI.getSupportPAPI().replace(p, message)); } } + } changeStatus(GameState.restarting); @@ -1946,10 +1983,9 @@ public void checkWinner() { } } Bukkit.getPluginManager().callEvent(new GameEndEvent(this, winners, losers, winner, aliveWinners)); - // } - if (players.size() == 0 && getStatus() != GameState.restarting) { + if (players.isEmpty() && status != GameState.restarting) { changeStatus(GameState.restarting); } } @@ -1958,12 +1994,8 @@ public void checkWinner() { /** * Add a kill to the player temp stats. */ - public void addPlayerDeath(Player p) { - if (playerDeaths.containsKey(p)) { - playerDeaths.replace(p, playerDeaths.get(p) + 1); - } else { - playerDeaths.put(p, 1); - } + @Deprecated(forRemoval = true) + public void addPlayerDeath(Player player) { } @@ -2057,44 +2089,7 @@ public void updateNextEvent() { setNextEvent(NextEvent.GAME_END); } - //if (nextEvent.getValue(this) > 0) return; - - //nextEvents.remove(nextEvent.toString()); - - //for (String s : nextEvents) { - // debug(s); - //} - - //if (nextEvents.isEmpty()) return; - - //NextEvent next = NextEvent.valueOf(nextEvents.get(0)); - //int lowest = next.getValue(this); - - //for (String ne : nextEvents) { - // int value = NextEvent.valueOf(ne).getValue(this); - // if (value == -1) continue; - // if (lowest > value) next = NextEvent.valueOf(ne); - //} - debug("---"); - - /*if (nextEvent == NextEvent.DIAMOND_GENERATOR_TIER_II) { - setNextEvent(NextEvent.DIAMOND_GENERATOR_TIER_III); - } else if (nextEvent == NextEvent.DIAMOND_GENERATOR_TIER_III) { - if (emeraldTier == 1) { - setNextEvent(NextEvent.EMERALD_GENERATOR_TIER_II); - } else if (emeraldTier == 2) { - setNextEvent(NextEvent.EMERALD_GENERATOR_TIER_III); - } else { - setNextEvent(NextEvent.BEDS_DESTROY); - } - } else if (emeraldTier >= 3 && diamondTier >= 3 && (playingTask != null && playingTask.getBedsDestroyCountdown() == 0)) { - setNextEvent(NextEvent.BEDS_DESTROY); - } else if (nextEvent == NextEvent.BEDS_DESTROY && (playingTask != null && playingTask.getDragonSpawnCountdown() >= 0)) { - setNextEvent(NextEvent.ENDER_DRAGON); - } else if (nextEvent == NextEvent.ENDER_DRAGON && (playingTask != null && playingTask.getBedsDestroyCountdown() == 0) && (playingTask != null && playingTask.getDragonSpawnCountdown() == 0)) { - setNextEvent(NextEvent.GAME_END); - }*/ debug(nextEvent.toString()); } @@ -2314,9 +2309,22 @@ public List getNextEvents() { /** * Get player deaths. */ - public int getPlayerDeaths(Player p, boolean finalDeaths) { - if (finalDeaths) return playerFinalKillDeaths.getOrDefault(p, 0); - return playerDeaths.getOrDefault(p, 0); + @Deprecated(forRemoval = true) + public int getPlayerDeaths(Player player, boolean finalDeaths) { + if (null == player || null == getStatsHolder()) { + return 0; + } + + Optional> st = getStatsHolder().get(player).flatMap(stats -> + stats.getStatistic(finalDeaths ? DefaultStatistics.DEATHS_FINAL : DefaultStatistics.DEATHS) + ); + + if (st.isEmpty()) { + return 0; + } + + GameStatistic gs = st.get(); + return gs instanceof Incrementable ? (int) gs.getValue() : 0; } /** @@ -2412,11 +2420,6 @@ public void destroyData() { regionsList = null; respawnSessions = null; showTime = null; - playerKills = null; - playerBedsDestroyed = null; - playerFinalKills = null; - playerDeaths = null; - playerFinalKillDeaths = null; startingTask = null; playingTask = null; restartingTask = null; @@ -2504,7 +2507,7 @@ public boolean startReSpawnSession(Player player, int seconds) { if (playing.equals(player)) continue; BedWars.nms.spigotHidePlayer(player, playing); } - PaperSupport.teleportC(player, getReSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(player, getReSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); player.setAllowFlight(true); player.setFlying(true); @@ -2520,7 +2523,7 @@ public boolean startReSpawnSession(Player player, int seconds) { } updateSpectatorCollideRule(player, false); - PaperSupport.teleportC(player, getReSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(player, getReSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); }, 10L); } else { ITeam team = getTeam(player); @@ -2546,16 +2549,18 @@ public static boolean canAutoScale(String arenaName) { if (ar.getArenaName().equalsIgnoreCase(arenaName)) return false; } - if (Arena.getGamesBeforeRestart() != -1 && Arena.getArenas().size() >= Arena.getGamesBeforeRestart()) return false; + if (Arena.getGamesBeforeRestart() != -1 && Arena.getArenas().size() >= Arena.getGamesBeforeRestart()) + return false; int activeClones = 0; for (IArena ar : Arena.getArenas()) { if (ar.getArenaName().equalsIgnoreCase(arenaName)) { // clone this arena only if there aren't available arena of the same kind - if (ar.getStatus() == GameState.waiting || ar.getStatus() == GameState.starting) return false; + GameState status = ar.getStatus(); + if (status == GameState.waiting || status == GameState.starting) return false; } // count active clones - if (ar.getArenaName().equals(arenaName)){ + if (ar.getArenaName().equals(arenaName)) { activeClones++; } } @@ -2589,13 +2594,9 @@ public boolean isProtected(Location location) { @Override public void abandonGame(Player player) { - if (player == null) return; - - //this.playerKills.remove(player.getName()); - this.playerBedsDestroyed.remove(player); - this.playerFinalKills.remove(player); - this.playerDeaths.remove(player); - this.playerFinalKillDeaths.remove(player); + if (player == null) { + return; + } ITeam team = getTeams().stream().filter(team1 -> team1.wasMember(player.getUniqueId())).findFirst().orElse(null); if (team != null) { @@ -2647,18 +2648,59 @@ private void sendToMainLobby(Player player) { if (BedWars.getServerType() == ServerType.SHARED) { Location loc = playerLocation.get(player); if (loc == null) { - PaperSupport.teleportC(player, Bukkit.getWorlds().get(0).getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(player, Bukkit.getWorlds().get(0).getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); plugin.getLogger().log(Level.SEVERE, player.getName() + " was teleported to the main world because lobby location is not set!"); } else { - player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(player, loc, PlayerTeleportEvent.TeleportCause.PLUGIN); } } else if (BedWars.getServerType() == ServerType.MULTIARENA) { if (BedWars.getLobbyWorld().isEmpty()) { - PaperSupport.teleportC(player, Bukkit.getWorlds().get(0).getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(player, Bukkit.getWorlds().get(0).getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); plugin.getLogger().log(Level.SEVERE, player.getName() + " was teleported to the main world because lobby location is not set!"); } else { - PaperSupport.teleportC(player, config.getConfigLoc("lobbyLoc"), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(player, config.getConfigLoc("lobbyLoc"), PlayerTeleportEvent.TeleportCause.PLUGIN); + } + } + } + + public boolean isAllowMapBreak() { + return allowMapBreak; + } + + public void setAllowMapBreak(boolean allowMapBreak) { + this.allowMapBreak = allowMapBreak; + } + + @Override + public @Nullable ITeam getBedsTeam(@NotNull Location location) { + if (!location.getWorld().getName().equals(this.worldName)) { + throw new RuntimeException("Given location is not on this game world."); + } + + if (!nms.isBed(location.getBlock().getType())) { + return null; + } + + for (ITeam team : this.teams) { + if (team.isBed(location)) { + return team; } } + return null; + } + + @Override + public @Nullable ITeam getWinner() { + return winner; + } + + @Override + public boolean isTeamBed(Location location) { + return null != getBedsTeam(location); + } + + @Override + public GameStatsHolder getStatsHolder() { + return gameStats; } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaGUI.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaGUI.java index c185ecf93..a3f43bf6d 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaGUI.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaGUI.java @@ -111,7 +111,7 @@ public static void refreshInv(Player p, IArena arena, int players) { for (String s : Language.getList(p, Messages.ARENA_GUI_ARENA_CONTENT_LORE)) { if (!(s.contains("{group}") && arenas.get(arenaKey).getGroup().equalsIgnoreCase("default"))) { lore.add(s.replace("{on}", String.valueOf(arena != null ? arena == arenas.get(arenaKey) ? players : arenas.get(arenaKey).getPlayers().size() : arenas.get(arenaKey).getPlayers().size())).replace("{max}", - String.valueOf(arenas.get(arenaKey).getMaxPlayers())).replace("{status}", arenas.get(arenaKey).getDisplayStatus(Language.getPlayerLanguage(p))) + String.valueOf(arenas.get(arenaKey).getMaxPlayers())).replace("{status}", arenas.get(arenaKey).getDisplayStatus(Language.getPlayerLanguage(p))) .replace("{group}", arenas.get(arenaKey).getDisplayGroup(p))); } } @@ -135,7 +135,7 @@ public static void openGui(Player p, String group) { //ash.setInv(inv); String skippedSlotMaterial = BedWars.config.getString(ConfigPath.GENERAL_CONFIGURATION_ARENA_SELECTOR_STATUS_MATERIAL.replace("%path%", "skipped-slot")); - if(!skippedSlotMaterial.equalsIgnoreCase("none") && !skippedSlotMaterial.equalsIgnoreCase("air")) { + if (!skippedSlotMaterial.equalsIgnoreCase("none") && !skippedSlotMaterial.equalsIgnoreCase("air")) { ItemStack i = BedWars.nms.createItemStack(skippedSlotMaterial, 1, (byte) BedWars.config.getInt(ConfigPath.GENERAL_CONFIGURATION_ARENA_SELECTOR_STATUS_DATA.replace("%path%", "skipped-slot"))); i = BedWars.nms.addCustomData(i, "RUNCOMMAND_bw join random"); @@ -144,16 +144,29 @@ public static void openGui(Player p, String group) { im.setDisplayName(ChatColor.translateAlternateColorCodes( '&', Language.getMsg(p, Messages.ARENA_GUI_SKIPPED_ITEM_NAME) - .replaceAll("\\{serverIp}", BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP)) + .replaceAll( + "\\{serverIp}", + BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP) + ) + .replaceAll( + "\\{poweredBy}", + BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_POWERED_BY) + ) )); List lore = new ArrayList<>(); - for(String s : Language.getList(p, Messages.ARENA_GUI_SKIPPED_ITEM_LORE)) { - lore.add( - s - .replaceAll("\\{serverIp}", BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP)) - ); + for (String line : Language.getList(p, Messages.ARENA_GUI_SKIPPED_ITEM_LORE)) { + line = line + .replaceAll( + "\\{serverIp}", + BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP) + ) + .replaceAll( + "\\{poweredBy}", + BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_POWERED_BY) + ); + lore.add(line); } - if(lore.size() > 0) { + if (lore.size() > 0) { im.setLore(lore); } im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); @@ -177,7 +190,7 @@ public static class ArenaSelectorHolder implements InventoryHolder { private String group; //private Inventory inv; - public ArenaSelectorHolder(String group){ + public ArenaSelectorHolder(String group) { this.group = group; } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Misc.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Misc.java index bc0546818..f560643ff 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Misc.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/Misc.java @@ -391,13 +391,13 @@ public static boolean isBuildProtected(Location l, IArena a) { } for (ITeam t : a.getTeams()) { for (IGenerator o : t.getGenerators()) { - if (o.getLocation().distance(l) <= 1) { + if (o.getLocation().distance(l) <= a.getConfig().getInt(ConfigPath.ARENA_GENERATOR_PROTECTION)) { return true; } } } for (IGenerator o : a.getOreGenerators()) { - if (o.getLocation().distance(l) <= 1) { + if (o.getLocation().distance(l) <= a.getConfig().getInt(ConfigPath.ARENA_GENERATOR_PROTECTION)) { return true; } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/OreGenerator.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/OreGenerator.java index 1bcf63020..95e217033 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/OreGenerator.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/OreGenerator.java @@ -82,7 +82,7 @@ public OreGenerator(Location location, IArena arena, GeneratorType type, ITeam b loadDefaults(); BedWars.debug("Initializing new generator at: " + location + " - " + type + " - " + (bwt == null ? "NOTEAM" : bwt.getName())); - Cuboid c = new Cuboid(location, 1, true); + Cuboid c = new Cuboid(location, getArena().getConfig().getInt(ConfigPath.ARENA_GENERATOR_PROTECTION), true); c.setMaxY(c.getMaxY() + 5); c.setMinY(c.getMinY() - 2); arena.getRegionsList().add(c); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java index 721380505..a7d750551 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java @@ -30,7 +30,7 @@ import com.andrei1058.bedwars.api.server.SetupType; import com.andrei1058.bedwars.commands.bedwars.MainCommand; import com.andrei1058.bedwars.configuration.ArenaConfig; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.*; import org.bukkit.configuration.ConfigurationSection; @@ -167,9 +167,9 @@ public void done() { getSetupSessions().remove(this); if (BedWars.getServerType() != ServerType.BUNGEE) { try { - PaperSupport.teleportC(getPlayer(), config.getConfigLoc("lobbyLoc"), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(getPlayer(), config.getConfigLoc("lobbyLoc"), PlayerTeleportEvent.TeleportCause.PLUGIN); } catch (Exception ex) { - PaperSupport.teleportC(getPlayer(), Bukkit.getWorlds().get(0).getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(getPlayer(), Bukkit.getWorlds().get(0).getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); } } getPlayer().removePotionEffect(PotionEffectType.SPEED); @@ -211,7 +211,7 @@ public ArenaConfig getConfig() { @Override public void teleportPlayer() { player.getInventory().clear(); - PaperSupport.teleport(player, Bukkit.getWorld(getWorldName()).getSpawnLocation()); + TeleportManager.teleport(player, Bukkit.getWorld(getWorldName()).getSpawnLocation()); player.setGameMode(GameMode.CREATIVE); Bukkit.getScheduler().runTaskLater(plugin, ()->{ player.setAllowFlight(true); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/feature/SpoilPlayerTNTFeature.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/feature/SpoilPlayerTNTFeature.java index de71788ea..7bce58bdd 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/feature/SpoilPlayerTNTFeature.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/feature/SpoilPlayerTNTFeature.java @@ -122,14 +122,23 @@ public void onPlace(BlockPlaceEvent event) { public void inventorySwitch(InventoryCloseEvent event) { Player player = (Player) event.getPlayer(); IArena arena = Arena.getArenaByPlayer(player); - if (arena == null || !arena.isPlayer(player) || arena.isSpectator(player)) return; + + // Ensure the player is in an arena, is not a spectator, and is indeed a player + if (arena == null || !arena.isPlayer(player) || arena.isSpectator(player)) { + return; + } + + boolean hasTnt = player.getInventory().contains(Material.TNT); + if (instance.playersWithTnt.contains(player)) { - if (player.getInventory().contains(Material.TNT)) return; - instance.playersWithTnt.remove(player); - } else if (!instance.playersWithTnt.contains(player)) { - if (!player.getInventory().contains(Material.TNT)) return; - instance.playersWithTnt.add(player); + if (!hasTnt) { + instance.playersWithTnt.remove(player); + } + } else { + if (hasTnt) { + instance.playersWithTnt.add(player); + } } } } -} +} \ No newline at end of file diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/spectator/TeleporterGUI.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/spectator/TeleporterGUI.java index cd5d47087..64897370c 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/spectator/TeleporterGUI.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/spectator/TeleporterGUI.java @@ -22,6 +22,8 @@ import com.andrei1058.bedwars.BedWars; import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; import com.andrei1058.bedwars.api.language.Messages; import com.andrei1058.bedwars.arena.Arena; import org.bukkit.Bukkit; @@ -74,20 +76,14 @@ public static void refreshInv(Player p, Inventory inv) { public static void openGUI(Player p) { IArena arena = Arena.getArenaByPlayer(p); if (arena == null) return; - int size = arena.getPlayers().size(); - if (size <= 9) { - size = 9; - } else if (size <= 18) { - size = 18; - } else if (size > 19 && size <= 27) { - size = 27; - } else if (size > 27 && size <= 36) { - size = 36; - } else if (size > 36 && size <= 45) { - size = 45; - } else { + + int playerCount = arena.getPlayers().size(); + int size = (playerCount % 9) == 0 ? playerCount : ((int) Math.ceil(playerCount / 9.0)) * 9; + + if (size > 54) { size = 54; } + Inventory inv = Bukkit.createInventory(p, size, getMsg(p, Messages.ARENA_SPECTATOR_TELEPORTER_GUI_NAME)); refreshInv(p, inv); refresh.put(p, inv); @@ -117,9 +113,14 @@ private static ItemStack createHead(Player targetPlayer, Player GUIholder) { ItemStack i = nms.getPlayerHead(targetPlayer, null); ItemMeta im = i.getItemMeta(); assert im != null; + IArena currentArena = Arena.getArenaByPlayer(targetPlayer); + ITeam targetPlayerTeam = currentArena.getTeam(targetPlayer); + im.setDisplayName(getMsg(GUIholder, Messages.ARENA_SPECTATOR_TELEPORTER_GUI_HEAD_NAME) .replace("{vPrefix}", BedWars.getChatSupport().getPrefix(targetPlayer)) .replace("{vSuffix}", BedWars.getChatSupport().getSuffix(targetPlayer)) + .replace("{team}", targetPlayerTeam.getDisplayName(Language.getPlayerLanguage(GUIholder))) + .replace("{teamColor}", String.valueOf(targetPlayerTeam.getColor().chat())) .replace("{player}", targetPlayer.getDisplayName()) .replace("{playername}", targetPlayer.getName())); List lore = new ArrayList<>(); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/DefaultStatsHandler.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/DefaultStatsHandler.java new file mode 100644 index 000000000..53220202b --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/DefaultStatsHandler.java @@ -0,0 +1,79 @@ +package com.andrei1058.bedwars.arena.stats; + +import com.andrei1058.bedwars.api.arena.stats.*; +import com.andrei1058.bedwars.api.events.player.PlayerBedBreakEvent; +import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; + +/** + * Used to increase default session stats. + */ +public class DefaultStatsHandler implements Listener { + + @EventHandler(ignoreCancelled = true) + public void onBedWarsKill(@NotNull PlayerKillEvent event) { + + GameStatsHolder statsHolder = event.getArena().getStatsHolder(); + if (null == statsHolder) { + return; + } + + Player killer = event.getKiller(); + Player victim = event.getVictim(); + + // INCREMENT KILLER STATS + if ((killer != null && !event.getVictimTeam().equals(event.getKillerTeam())) && !victim.equals(killer)) { + Optional killerStats = statsHolder.get(killer); + + killerStats.flatMap(stats -> stats.getStatistic(DefaultStatistics.KILLS)).ifPresent(gameStatistic -> { + if (gameStatistic instanceof Incrementable) { + ((Incrementable) gameStatistic).increment(); + } + }); + + if (event.getCause().isFinalKill()) { + killerStats.flatMap(stats -> stats.getStatistic(DefaultStatistics.KILLS_FINAL)).ifPresent(gameStatistic -> { + if (gameStatistic instanceof Incrementable) { + ((Incrementable) gameStatistic).increment(); + } + }); + } + } + + // INCREMENT VICTIM STATS + Optional victimStats = statsHolder.get(victim); + + victimStats.flatMap(stats -> stats.getStatistic(DefaultStatistics.DEATHS)).ifPresent(gameStatistic -> { + if (gameStatistic instanceof Incrementable) { + ((Incrementable) gameStatistic).increment(); + } + }); + + if (event.getCause().isFinalKill()) { + victimStats.flatMap(stats -> stats.getStatistic(DefaultStatistics.DEATHS_FINAL)).ifPresent(gameStatistic -> { + if (gameStatistic instanceof Incrementable) { + ((Incrementable) gameStatistic).increment(); + } + }); + } + } + + @EventHandler(ignoreCancelled = true) + public void onBedWarsBedBreak(@NotNull PlayerBedBreakEvent event) { + if (null == event.getArena().getStatsHolder()) { + return; + } + + event.getArena().getStatsHolder().get(event.getPlayer()).flatMap(stats -> + stats.getStatistic(DefaultStatistics.BEDS_DESTROYED)).ifPresent(st -> { + if (st instanceof Incrementable) { + ((Incrementable) st).increment(); + } + }); + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GameStatsManager.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GameStatsManager.java new file mode 100644 index 000000000..43bb7c7ff --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GameStatsManager.java @@ -0,0 +1,124 @@ +package com.andrei1058.bedwars.arena.stats; + +import com.andrei1058.bedwars.BedWars; +import com.andrei1058.bedwars.api.arena.GameState; +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.stats.*; +import com.andrei1058.bedwars.arena.stats.defaults.PlayerGameStatsContainer; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.*; +import java.util.stream.Collectors; + +public class GameStatsManager implements GameStatsHolder { + + private final HashMap> registeredStats = new HashMap<>(); + private final HashMap> playerSessionStats = new HashMap<>(); + + private final IArena arena; + + public GameStatsManager(IArena arena) { + this.arena = arena; + + for (DefaultStatistics statistic : DefaultStatistics.values()) { + if (statistic.isIncrementable()) { + register(new GenericStatistic(){ + @Override + public String getIdentifier() { + return statistic.toString(); + } + }); + } + } + } + + public void register(@NotNull GameStatisticProvider statistic) { + if (statistic.getIdentifier().isBlank()) { + throw new RuntimeException("Identifier cannot be blank: "+ statistic.getClass().getName()); + } + if (!statistic.getIdentifier().trim().equals(statistic.getIdentifier())) { + throw new RuntimeException("Identifier should not start/end with white spaces: "+statistic.getClass().getName()); + } + if (null != registeredStats.getOrDefault(statistic.getIdentifier(), null)) { + throw new RuntimeException("Statistic already registered: "+statistic.getIdentifier()); + } + registeredStats.put(statistic.getIdentifier(), statistic); + BedWars.debug("Registered new game statistic: "+statistic.getIdentifier()); + } + + + @Override + public IArena getArena() { + return arena; + } + + public PlayerGameStats init(@NotNull Player player) { + if (playerSessionStats.containsKey(player.getUniqueId())) { + throw new RuntimeException(player.getName()+" is already registered for game stats!"); + } + + PlayerGameStats stats = new PlayerGameStatsContainer(player); + this.registeredStats.forEach((id, provider) -> stats.registerStatistic(id, provider.getDefault())); + + playerSessionStats.put(player.getUniqueId(), Optional.of(stats)); + return stats; + } + + @Override + public void unregisterPlayer(UUID uuid) { + if (getArena().getStatus() == GameState.restarting) { + throw new RuntimeException("You cannot unregister player stats during restarting phase!"); + } + this.playerSessionStats.remove(uuid); + } + + @Override + public @NotNull PlayerGameStats getCreate(@NotNull Player holder) { + Optional ps = playerSessionStats.getOrDefault(holder.getUniqueId(), Optional.empty()); + if (ps.isEmpty()) { + PlayerGameStats stats = init(holder); + playerSessionStats.put(holder.getUniqueId(), Optional.of(stats)); + return stats; + } + return ps.get(); + } + + @Override + public Optional get(@NotNull UUID holder) { + return playerSessionStats.getOrDefault(holder, Optional.empty()); + } + + @Override + public Collection> getTrackedPlayers() { + return Collections.unmodifiableCollection(playerSessionStats.values()); + } + + @Override + public List> getOrderedBy(@NotNull String statistic) { + + //noinspection OptionalGetWithoutIsPresent + List> list = playerSessionStats.values().stream().filter(Optional::isPresent) + .filter(st -> st.get().getStatistic(statistic).isPresent()) + .sorted(Comparator.comparing(a -> a.get().getStatistic(statistic).get())) + .collect(Collectors.toList()); + Collections.reverse(list); + return list; + } + + @Override + public boolean hasStatistic(String orderBy) { + return registeredStats.containsKey(orderBy); + } + + @Override + public List getRegistered() { + return registeredStats.keySet().stream().collect(Collectors.toUnmodifiableList()); + } + + @Override + public @Nullable GameStatisticProvider getProvider(String statistic) { + return registeredStats.getOrDefault(statistic, null); + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GenericStatistic.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GenericStatistic.java new file mode 100644 index 000000000..62e38cfa3 --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/GenericStatistic.java @@ -0,0 +1,52 @@ +package com.andrei1058.bedwars.arena.stats; + +import com.andrei1058.bedwars.BedWars; +import com.andrei1058.bedwars.api.arena.stats.Incrementable; +import com.andrei1058.bedwars.api.arena.stats.GameStatistic; +import com.andrei1058.bedwars.api.arena.stats.GameStatisticProvider; +import com.andrei1058.bedwars.api.language.Language; +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public abstract class GenericStatistic implements GameStatisticProvider { + + @Override + public GenericStatistic.Value getDefault() { + return new Value(); + } + + @Override + public String getVoidReplacement(@Nullable Language language) { + return "0"; + } + + @Override + public Plugin getOwner() { + return BedWars.plugin; + } + + public static class Value implements GameStatistic, Incrementable, Comparable> { + private int count = 0; + + @Override + public Integer getValue() { + return count; + } + + @Override + public String getDisplayValue(Language language) { + return String.valueOf(getValue()); + } + + @Override + public int compareTo(@NotNull GameStatistic o) { + return Integer.compare(this.count, o.getValue()); + } + + @Override + public void increment() { + count++; + } + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/StatisticsOrdered.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/StatisticsOrdered.java new file mode 100644 index 000000000..e28145df4 --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/StatisticsOrdered.java @@ -0,0 +1,176 @@ +package com.andrei1058.bedwars.arena.stats; + +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.stats.GameStatisticProvider; +import com.andrei1058.bedwars.api.arena.stats.PlayerGameStats; +import com.andrei1058.bedwars.api.arena.stats.GameStatistic; +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Optional; + +/** + * This cannot be used for live tops. + */ +public class StatisticsOrdered { + + private final List> ordered; + private final IArena arena; + private BoundsPolicy boundsPolicy = BoundsPolicy.EMPTY; + private final String orderBy; + + public StatisticsOrdered(@NotNull IArena arena, String orderBy) { + this.arena = arena; + if (null == arena.getStatsHolder()) { + throw new RuntimeException("Arena stats holder is null."); + } + if (!arena.getStatsHolder().hasStatistic(orderBy)) { + throw new RuntimeException("Invalid order by. Provided: " + orderBy); + } + ordered = arena.getStatsHolder().getOrderedBy(orderBy); + this.orderBy = orderBy; + } + + public StringParser newParser() { + return new StringParser(); + } + + public class StringParser { + private int index = 0; + + /** + * @param string string to be placeholder replaced. + * @param emptyReplacement replace empty top position with this string. + */ + public @Nullable String parseString(String string, @Nullable Language lang, String emptyReplacement) { + if (null == arena.getStatsHolder()) { + return null; + } + + if (index >= ordered.size()) { + if (boundsPolicy == BoundsPolicy.SKIP) { + if (string.isBlank()){ + return string; + } + + boolean hasPlaceholders = false; + + for (String placeholder : new String[]{ + "{topPlayerName}", "{topPlayerDisplayName}", "{topTeamColor}", "{topTeamName}", "{topValue}" + }) { + if (string.contains(placeholder)) { + hasPlaceholders = true; + break; + } + } + + if (!hasPlaceholders) { + for (String registered : arena.getStatsHolder().getRegistered()) { + if (string.contains("{topValue-" + registered + "}")) { + hasPlaceholders = true; + break; + } + } + } + return hasPlaceholders ? null : string; + } + + string = string + .replace("{topPlayerName}", emptyReplacement) + .replace("{topPlayerDisplayName}", emptyReplacement) + .replace("{topTeamColor}", "") + .replace("{topTeamName}", "") + .replace("{topValue}", "{topValue-"+orderBy+"}"); + + for (String registered : arena.getStatsHolder().getRegistered()) { + String displayValue = "null"; + GameStatisticProvider provider = arena.getStatsHolder().getProvider(registered); + if (null != provider) { + displayValue = provider.getVoidReplacement(lang); + } + string = string.replace("{topValue-" + registered + "}", displayValue); + } + + return string; + } + + Optional statsOptional = ordered.get(index); + + if (statsOptional.isEmpty()) { + return string; + } + + PlayerGameStats stats = statsOptional.get(); + + boolean increment = string.contains("{topPlayerName}") || string.contains("{topPlayerDisplayName}"); + + Player online = Bukkit.getPlayer(stats.getPlayer()); + ITeam team = null == online ? arena.getExTeam(stats.getPlayer()) : arena.getTeam(online); + if (null == team) { + // if player online but eliminated + team = arena.getExTeam(stats.getPlayer()); + } + + string = string.replace("{topPlayerName}", stats.getUsername()) + .replace("{topPlayerDisplayName}", stats.getDisplayPlayer()) + .replace("{topTeamColor}", null == team ? "" : team.getColor().chat().toString()) + .replace("{topTeamName}", null == team ? "" : team.getDisplayName(lang)) + .replace("{topValue}", "{topValue-"+orderBy+"}"); + + for (String registered : arena.getStatsHolder().getRegistered()) { + Optional> statistic = stats.getStatistic(registered); + + if (!increment && string.contains("{topValue-" + registered + "}")) { + increment = true; + } + + String displayValue = statistic.map(gameStatistic -> gameStatistic.getDisplayValue(lang)).orElse(null); + if (null == displayValue) { + GameStatisticProvider provider = arena.getStatsHolder().getProvider(registered); + if (null == provider) { + displayValue = "null"; + } else { + displayValue = provider.getVoidReplacement(lang); + } + } + + string = string.replace("{topValue-" + registered + "}", displayValue); + } + + if (increment) { + index++; + } + return string; + } + + public void resetIndex() { + index = 0; + } + + } + + public void setBoundsPolicy(BoundsPolicy boundsPolicy) { + this.boundsPolicy = boundsPolicy; + } + + /** + * What to do when iterating stats line and there are no more players to show. + * This is used when there are more placeholders used than the actual player count. + */ + + public enum BoundsPolicy { + /** + * Skip line. Do not send it to receivers. + */ + SKIP, + /** + * Send empty line to receivers. + */ + EMPTY + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/defaults/PlayerGameStatsContainer.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/defaults/PlayerGameStatsContainer.java new file mode 100644 index 000000000..36a211505 --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/stats/defaults/PlayerGameStatsContainer.java @@ -0,0 +1,66 @@ +package com.andrei1058.bedwars.arena.stats.defaults; + +import com.andrei1058.bedwars.api.arena.stats.PlayerGameStats; +import com.andrei1058.bedwars.api.arena.stats.GameStatistic; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; + +public class PlayerGameStatsContainer implements PlayerGameStats { + + private final UUID player; + private final String username; + // last tracked display name + private final String lastDisplayName; + private final HashMap>> statsById = new HashMap<>(); + + public PlayerGameStatsContainer(@NotNull Player player) { + this.player = player.getUniqueId(); + this.username = player.getName(); + this.lastDisplayName = player.getDisplayName(); + } + + @Override + public @NotNull UUID getPlayer() { + return player; + } + + @Override + public @NotNull String getDisplayPlayer() { + Player online = Bukkit.getPlayer(getPlayer()); + if (null == online) { + return lastDisplayName; + } + return online.getDisplayName(); + } + + @Override + public @NotNull String getUsername() { + return username; + } + + @Override + public void registerStatistic(@NotNull String id, @NotNull GameStatistic defaultValue) { + if (statsById.containsKey(id)) { + throw new RuntimeException("Statistic "+id+" already registered for player "+ getPlayer()); + } + statsById.put(id, Optional.of(defaultValue)); + } + + @Override + public @Nullable Optional> getStatistic(@NotNull String id) { + return statsById.getOrDefault(id, Optional.empty()); + } + + @Override + public List getRegistered() { + return statsById.keySet().stream().collect(Collectors.toUnmodifiableList()); + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameRestartingTask.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameRestartingTask.java index dbff3ef70..3c7fc3e30 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameRestartingTask.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameRestartingTask.java @@ -30,19 +30,24 @@ import com.andrei1058.bedwars.arena.Arena; import com.andrei1058.bedwars.arena.Misc; import com.andrei1058.bedwars.configuration.Sounds; +import com.andrei1058.bedwars.support.paper.TeleportManager; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitTask; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.Random; public class GameRestartingTask implements Runnable, RestartingTask { private Arena arena; - private int restarting = BedWars.config.getInt(ConfigPath.GENERAL_CONFIGURATION_RESTART) + 3; + private int restarting = BedWars.config.getInt(ConfigPath.GENERAL_CONFIGURATION_RESTART) + 5; private final BukkitTask task; public GameRestartingTask(@NotNull Arena arena) { @@ -50,6 +55,36 @@ public GameRestartingTask(@NotNull Arena arena) { task = Bukkit.getScheduler().runTaskTimer(BedWars.plugin, this, 0, 20L); Sounds.playSound("game-end", arena.getPlayers()); Sounds.playSound("game-end", arena.getSpectators()); + + // teleport to alive players + if (arena.getConfig().getGameOverridableBoolean(ConfigPath.GENERAL_GAME_END_TELEPORT_ELIMINATED)) { + if (!arena.getPlayers().isEmpty()) { + Random r = new Random(); + for (Player spectator : arena.getSpectators()) { + Player target = arena.getPlayers().get(r.nextInt(arena.getPlayers().size())); + Location loc = target.getLocation().clone(); + loc.setDirection(target.getLocation().getDirection().multiply(-1)); + loc.add(0,2,0); + + TeleportManager.teleportC(spectator, loc, PlayerTeleportEvent.TeleportCause.PLUGIN); + } + } + } + + // show eliminated players + if (arena.getConfig().getGameOverridableBoolean(ConfigPath.GENERAL_GAME_END_SHOW_ELIMINATED)) { + for (Player spectator : arena.getSpectators()) { + ITeam exTeam = arena.getExTeam(spectator.getUniqueId()); + if (null == exTeam) { + continue; + } + spectator.removePotionEffect(PotionEffectType.INVISIBILITY); + for (Player player : arena.getPlayers()) { + BedWars.nms.spigotShowPlayer(player, spectator); + BedWars.nms.spigotShowPlayer(spectator, player); + } + } + } } /** diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameStartingTask.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameStartingTask.java index 999f23874..919762c6c 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameStartingTask.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/tasks/GameStartingTask.java @@ -92,13 +92,13 @@ public BukkitTask getBukkitTask() { @Override public void run() { if (countdown == 0) { + if (BedWars.config.getBoolean(ConfigPath.GENERAL_CONFIGURATION_EXPERIMENTAL_TEAM_ASSIGNER)) { getArena().getTeamAssigner().assignTeams(getArena()); } else { LegacyTeamAssigner.assignTeams(getArena()); } - //Color bed block if possible //Destroy bed if team is empty //Spawn shops and upgrades diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/team/BedWarsTeam.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/team/BedWarsTeam.java index a33a99aba..d25d62c93 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/team/BedWarsTeam.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/team/BedWarsTeam.java @@ -37,7 +37,7 @@ import com.andrei1058.bedwars.arena.OreGenerator; import com.andrei1058.bedwars.configuration.Sounds; import com.andrei1058.bedwars.shop.ShopCache; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import org.bukkit.*; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.ArmorStand; @@ -97,6 +97,7 @@ public class BedWarsTeam implements ITeam { // Invulnerability at re-spawn // Fall invulnerability when teammates respawn public static HashMap reSpawnInvulnerability = new HashMap<>(); + private UUID identity; public BedWarsTeam(String name, TeamColor color, Location spawn, Location bed, Location shop, Location teamUpgrades, Arena arena) { if (arena == null) return; @@ -114,6 +115,7 @@ public BedWarsTeam(String name, TeamColor color, Location spawn, Location bed, L if (drops != null) { setKillDropsLocation(drops); } + this.identity = UUID.randomUUID(); } public int getSize() { @@ -142,7 +144,7 @@ public void addPlayers(Player... players) { */ public void firstSpawn(Player p) { if (p == null) return; - PaperSupport.teleportC(p, spawn, PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, spawn, PlayerTeleportEvent.TeleportCause.PLUGIN); p.setGameMode(GameMode.SURVIVAL); p.setCanPickupItems(true); nms.setCollide(p, getArena(), true); @@ -163,12 +165,12 @@ public void spawnNPCs() { nms.spawnShop(getArena().getConfig().getArenaLoc("Team." + getName() + ".Shop"), (getArena().getMaxInTeam() > 1 ? Messages.NPC_NAME_TEAM_SHOP : Messages.NPC_NAME_SOLO_SHOP), getArena().getPlayers(), getArena()); }, 20L); - Cuboid c1 = new Cuboid(getArena().getConfig().getArenaLoc("Team." + getName() + ".Upgrade"), 1, true); + Cuboid c1 = new Cuboid(getArena().getConfig().getArenaLoc("Team." + getName() + ".Upgrade"), getArena().getConfig().getInt(ConfigPath.ARENA_UPGRADES_PROTECTION), true); c1.setMinY(c1.getMinY() - 1); c1.setMaxY(c1.getMaxY() + 4); getArena().getRegionsList().add(c1); - Cuboid c2 = new Cuboid(getArena().getConfig().getArenaLoc("Team." + getName() + ".Shop"), 1, true); + Cuboid c2 = new Cuboid(getArena().getConfig().getArenaLoc("Team." + getName() + ".Shop"), getArena().getConfig().getInt(ConfigPath.ARENA_SHOP_PROTECTION), true); c2.setMinY(c2.getMinY() - 1); c2.setMaxY(c2.getMaxY() + 4); getArena().getRegionsList().add(c2); @@ -340,7 +342,7 @@ public void respawnMember(@NotNull Player p) { } else { reSpawnInvulnerability.put(p.getUniqueId(), System.currentTimeMillis() + config.getInt(ConfigPath.GENERAL_CONFIGURATION_RE_SPAWN_INVULNERABILITY)); } - PaperSupport.teleportC(p, getSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, getSpawn(), PlayerTeleportEvent.TeleportCause.PLUGIN); p.setVelocity(new Vector(0, 0, 0)); p.removePotionEffect(PotionEffectType.INVISIBILITY); nms.setCollide(p, arena, true); @@ -348,15 +350,15 @@ public void respawnMember(@NotNull Player p) { p.setFlying(false); p.setHealth(20); - Bukkit.getScheduler().runTaskLater(plugin, ()-> { + Bukkit.getScheduler().runTaskLater(plugin, () -> { getArena().getRespawnSessions().remove(p); //Fixes https://github.com/andrei1058/BedWars1058/issues/669 - for (Player inGame : arena.getPlayers()){ + for (Player inGame : arena.getPlayers()) { if (inGame.equals(p)) continue; BedWars.nms.spigotShowPlayer(p, inGame); BedWars.nms.spigotShowPlayer(inGame, p); } - for (Player spectator : arena.getSpectators()){ + for (Player spectator : arena.getSpectators()) { BedWars.nms.spigotShowPlayer(p, spectator); } }, 8L); @@ -480,6 +482,11 @@ public void sendArmor(Player p) { if (p.getInventory().getBoots() == null) p.getInventory().setBoots(createArmor(Material.LEATHER_BOOTS)); } + @Override + public UUID getIdentity() { + return identity; + } + /** * Creates a hologram on the team bed's per player */ @@ -601,7 +608,7 @@ public void addSwordEnchantment(Enchantment e, int a) { for (Player p : getMembers()) { for (ItemStack i : p.getInventory().getContents()) { if (i == null) continue; - if (nms.isSword(i)) { + if (nms.isSword(i) || nms.isAxe(i)) { ItemMeta im = i.getItemMeta(); im.addEnchant(e, a, true); i.setItemMeta(im); @@ -869,6 +876,18 @@ public void setKillDropsLocation(Vector loc) { this.killDropsLoc = new Vector(loc.getBlockX() + 0.5, loc.getBlockY(), loc.getBlockZ() + 0.5); } + @Override + public boolean isBed(@NotNull Location location) { + for (int x = location.getBlockX() - 1; x < location.getBlockX() + 1; x++) { + for (int z = location.getBlockZ() - 1; z < location.getBlockZ() + 1; z++) { + if (getBed().getBlockX() == x && getBed().getBlockY() == location.getBlockY() && getBed().getBlockZ() == z) { + return true; + } + } + } + return false; + } + public void setKillDropsLocation(Location loc) { if (loc == null) { this.killDropsLoc = null; diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/upgrades/HealPoolListner.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/upgrades/HealPoolListner.java index c27da4a08..cbd9370fd 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/upgrades/HealPoolListner.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/upgrades/HealPoolListner.java @@ -13,7 +13,7 @@ public class HealPoolListner implements Listener { @EventHandler public void onTeamUpgrade(UpgradeBuyEvent e){ - if (e.getTeamUpgrade().getName().equalsIgnoreCase("upgrade-heal-pool")){ + if (e.getTeamUpgrade().getName().contains("heal-pool")){ IArena a = e.getArena(); if (a == null) return; ITeam bwt = a.getTeam(e.getPlayer()); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/Misc.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/Misc.java index 8ddbd5a43..29133ed24 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/Misc.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/Misc.java @@ -22,7 +22,7 @@ import com.andrei1058.bedwars.BedWars; import com.andrei1058.bedwars.arena.SetupSession; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -106,7 +106,7 @@ public static void autoSetGen(Player p, String command, SetupSession setupSessio Bukkit.getScheduler().runTaskLater(BedWars.plugin, () -> { for (Location l : setupSession.getSkipAutoCreateGen()) { Bukkit.getScheduler().runTaskLater(BedWars.plugin, () -> { - PaperSupport.teleport(p, l); + TeleportManager.teleport(p, l); Bukkit.dispatchCommand(p, command + (l.add(0, -1, 0).getBlock().getType() == Material.EMERALD_BLOCK ? "emerald" : "diamond")); }, 20); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdStart.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdStart.java index 260a322c9..00cede074 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdStart.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdStart.java @@ -25,6 +25,7 @@ import com.andrei1058.bedwars.api.arena.IArena; import com.andrei1058.bedwars.api.command.ParentCommand; import com.andrei1058.bedwars.api.command.SubCommand; +import com.andrei1058.bedwars.api.configuration.ConfigPath; import com.andrei1058.bedwars.api.language.Messages; import com.andrei1058.bedwars.arena.Arena; import com.andrei1058.bedwars.arena.SetupSession; @@ -94,7 +95,8 @@ public boolean canSee(CommandSender s, com.andrei1058.bedwars.api.BedWars api) { IArena a = Arena.getArenaByPlayer(p); if (a != null){ - if (a.getStatus() == GameState.waiting || a.getStatus() == GameState.starting){ + GameState status = a.getStatus(); + if (status == GameState.waiting || status == GameState.starting){ if (!a.isPlayer(p)) return false; } else { return false; diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdTpStaff.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdTpStaff.java index b20291688..658d89e3a 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdTpStaff.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/regular/CmdTpStaff.java @@ -27,7 +27,7 @@ import com.andrei1058.bedwars.api.language.Language; import com.andrei1058.bedwars.api.language.Messages; import com.andrei1058.bedwars.arena.Arena; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -76,7 +76,7 @@ public boolean execute(String[] args, CommandSender s) { if (a2.isPlayer(p2)) a2.removePlayer(p2, false); if (a2.isSpectator(p2)) { if (a2.getArenaName().equals(a.getArenaName())) { - PaperSupport.teleport(p2, p.getLocation()); + TeleportManager.teleport(p2, p.getLocation()); return true; } else a2.removeSpectator(p2, false); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/DisableArena.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/DisableArena.java index 34e9a3a0a..d7b9e55f0 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/DisableArena.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/DisableArena.java @@ -21,6 +21,7 @@ package com.andrei1058.bedwars.commands.bedwars.subcmds.sensitive; import com.andrei1058.bedwars.BedWars; +import com.andrei1058.bedwars.api.arena.GameState; import com.andrei1058.bedwars.api.arena.IArena; import com.andrei1058.bedwars.api.command.ParentCommand; import com.andrei1058.bedwars.api.command.SubCommand; @@ -66,6 +67,10 @@ public boolean execute(String[] args, CommandSender s) { p.sendMessage("§c▪ §7This arena is disabled yet!"); return true; } + if (a.getStatus() == GameState.playing) { + p.sendMessage("§6 ▪ §7There is a game running on this Arena, please disable after the game!"); + return true; + } p.sendMessage("§6 ▪ §7Disabling arena..."); a.disable(); return true; diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/Save.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/Save.java index 121955706..1627e8bf2 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/Save.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/Save.java @@ -26,7 +26,7 @@ import com.andrei1058.bedwars.arena.Misc; import com.andrei1058.bedwars.arena.SetupSession; import com.andrei1058.bedwars.configuration.Permissions; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -64,9 +64,9 @@ public boolean execute(String[] args, CommandSender s) { } if (Bukkit.getWorld(BedWars.getLobbyWorld()) != null) { - PaperSupport.teleport(p, Bukkit.getWorld(BedWars.getLobbyWorld()).getSpawnLocation()); + TeleportManager.teleport(p, Bukkit.getWorld(BedWars.getLobbyWorld()).getSpawnLocation()); } else { - PaperSupport.teleport(p, Bukkit.getWorlds().get(0).getSpawnLocation()); + TeleportManager.teleport(p, Bukkit.getWorlds().get(0).getSpawnLocation()); } ss.done(); p.sendMessage(ss.getPrefix() + "Arena changes saved!"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/SetSpawn.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/SetSpawn.java index 5d4c7a97d..45c2a9bb9 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/SetSpawn.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/commands/bedwars/subcmds/sensitive/setup/SetSpawn.java @@ -27,7 +27,7 @@ import com.andrei1058.bedwars.arena.Misc; import com.andrei1058.bedwars.arena.SetupSession; import com.andrei1058.bedwars.configuration.Permissions; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -94,7 +94,7 @@ public boolean execute(String[] args, CommandSender s) { for (int z = -radius; z < radius; z++) { Block b = l.clone().add(x, y, z).getBlock(); if (BedWars.nms.isBed(b.getType())) { - PaperSupport.teleport(p, b.getLocation()); + TeleportManager.teleport(p, b.getLocation()); Bukkit.dispatchCommand(p, getParent().getName() + " setBed " + args[0]); return true; } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/ArenaConfig.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/ArenaConfig.java index 6d54c7713..569211a7d 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/ArenaConfig.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/ArenaConfig.java @@ -20,15 +20,23 @@ package com.andrei1058.bedwars.configuration; +import com.andrei1058.bedwars.BedWars; import com.andrei1058.bedwars.api.configuration.ConfigManager; import com.andrei1058.bedwars.api.configuration.ConfigPath; +import com.andrei1058.bedwars.api.configuration.GameMainOverridable; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.List; public class ArenaConfig extends ConfigManager { + @SuppressWarnings({"SpellCheckingInspection"}) + private List cachedGameOverridables = new ArrayList<>(); + public ArenaConfig(Plugin plugin, String name, String dir) { super(plugin, name, dir); @@ -81,9 +89,55 @@ public ArenaConfig(Plugin plugin, String name, String dir) { if (yml.get("islandRadius") != null) { set(ConfigPath.ARENA_ISLAND_RADIUS, yml.getInt("islandRadius")); } - if (yml.get("voidKill") != null){ + if (yml.get("voidKill") != null) { set("voidKill", null); } set(ConfigPath.GENERAL_CONFIGURATION_ENABLE_GEN_SPLIT, null); + + cachedGameOverridables = getGameOverridables(); + } + + @SuppressWarnings({"SpellCheckingInspection"}) + private @NotNull List getGameOverridables() { + List paths = new ArrayList<>(); + for (Field field : ConfigPath.class.getDeclaredFields()) { + if (field.isAnnotationPresent(GameMainOverridable.class)) { + try { + Object value = field.get(field); + if (value instanceof String) { + paths.add((String) value); + } + } catch (IllegalAccessException ignored) { + } + } + } + + return paths; + } + + public boolean isGameOverridable(String path) { + return cachedGameOverridables.contains(path); + } + + public Object getGameOverridableValue(String path) { + if (!isGameOverridable(path)) { + throw new RuntimeException("Given path is not game-overridable: "+path); + } + + Object value = getYml().get(path, null); + if (null == value){ + return BedWars.config.getYml().get(path); + } + return value; + } + + public Boolean getGameOverridableBoolean(String path) { + Object value = getGameOverridableValue(path); + return value instanceof Boolean ? (Boolean) value : false; + } + + public String getGameOverridableString(String path) { + Object value = getGameOverridableValue(path); + return value instanceof String ? (String) value : "invalid"; } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/MainConfig.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/MainConfig.java index 14718f90d..ddf3733f8 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/MainConfig.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/MainConfig.java @@ -21,6 +21,7 @@ package com.andrei1058.bedwars.configuration; import com.andrei1058.bedwars.BedWars; +import com.andrei1058.bedwars.api.arena.stats.DefaultStatistics; import com.andrei1058.bedwars.api.configuration.ConfigManager; import com.andrei1058.bedwars.api.configuration.ConfigPath; import com.andrei1058.bedwars.api.language.Language; @@ -71,8 +72,12 @@ public MainConfig(Plugin plugin, String name) { yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_PLAYING, true); yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_RESTARTING, true); yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_LIST_REFRESH, 1200); + yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_ENABLE, true); yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_IN_TAB, true); yml.addDefault(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_REFRESH, 300); + yml.addDefault(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_ENABLE, true); + yml.addDefault(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_REFRESH_INTERVAL, 10); + yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_REJOIN_TIME, 60 * 5); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_RE_SPAWN_INVULNERABILITY, 4000); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_MODE_GAMES_BEFORE_RESTART, 30); @@ -82,13 +87,14 @@ public MainConfig(Plugin plugin, String name) { yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_START_COUNTDOWN_REGULAR, 40); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_START_COUNTDOWN_HALF, 25); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_START_COUNTDOWN_SHORTENED, 5); - yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_RESTART, 15); + yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_RESTART, 45); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_RE_SPAWN_COUNTDOWN, 5); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_BEDS_DESTROY_COUNTDOWN, 360); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_DRAGON_SPAWN_COUNTDOWN, 600); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_GAME_END_COUNTDOWN, 120); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_SHOUT_COOLDOWN, 30); yml.addDefault(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP, "yourServer.Com"); + yml.addDefault(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_POWERED_BY, "BedWars1058"); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_SERVER_ID, "bw1"); yml.addDefault(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_BWP_TIME_OUT, 5000); @@ -108,6 +114,16 @@ public MainConfig(Plugin plugin, String name) { yml.addDefault(ConfigPath.GENERAL_TNT_JUMP_DAMAGE_SELF, 1); yml.addDefault(ConfigPath.GENERAL_TNT_JUMP_DAMAGE_TEAMMATES, 5); yml.addDefault(ConfigPath.GENERAL_TNT_JUMP_DAMAGE_OTHERS, 10); + + // tnd block blast resistance + yml.addDefault(ConfigPath.GENERAL_TNT_PROTECTION_END_STONE_BLAST, 12f); + yml.addDefault(ConfigPath.GENERAL_TNT_PROTECTION_GLASS_BLAST, 300f); + yml.addDefault(ConfigPath.GENERAL_TNT_RAY_BLOCKED_BY_GLASS, true); + + // tnt prime settings + yml.addDefault(ConfigPath.GENERAL_TNT_AUTO_IGNITE, true); + yml.addDefault(ConfigPath.GENERAL_TNT_FUSE_TICKS, 45); + // fireball category yml.addDefault(ConfigPath.GENERAL_FIREBALL_EXPLOSION_SIZE, 3); yml.addDefault(ConfigPath.GENERAL_FIREBALL_SPEED_MULTIPLIER, 10); @@ -188,6 +204,13 @@ public MainConfig(Plugin plugin, String name) { yml.addDefault(ConfigPath.LOBBY_VOID_TELEPORT_ENABLED, true); yml.addDefault(ConfigPath.LOBBY_VOID_TELEPORT_HEIGHT, 0); + yml.addDefault(ConfigPath.GENERAL_GAME_END_SHOW_ELIMINATED, true); + yml.addDefault(ConfigPath.GENERAL_GAME_END_TELEPORT_ELIMINATED, true); + yml.addDefault(ConfigPath.GENERAL_GAME_END_CHAT_TOP_STATISTIC, DefaultStatistics.KILLS.toString()); + yml.addDefault(ConfigPath.GENERAL_GAME_END_CHAT_TOP_HIDE_MISSING, true); + + yml.addDefault(ConfigPath.GENERAL_GAME_END_SB_TOP_STATISTIC, DefaultStatistics.KILLS.toString()); + yml.addDefault(ConfigPath.GENERAL_GAME_END_SB_TOP_HIDE_MISSING, true); yml.options().copyDefaults(true); save(); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/UpgradesConfig.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/UpgradesConfig.java index 1c255b592..abe056d35 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/UpgradesConfig.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/configuration/UpgradesConfig.java @@ -28,6 +28,7 @@ import java.util.Collections; import java.util.List; +import static com.andrei1058.bedwars.BedWars.getForCurrentVersion; import static com.andrei1058.bedwars.BedWars.plugin; public class UpgradesConfig extends ConfigManager { @@ -73,13 +74,12 @@ public UpgradesConfig(String name, String dir) { yml.addDefault("upgrade-miner.tier-1.currency", "diamond"); yml.addDefault("upgrade-miner.tier-1.cost", 2); - addDefaultDisplayItem("upgrade-miner.tier-1", "GOLD_PICKAXE", 0, 1, false); + addDefaultDisplayItem("upgrade-miner.tier-1", getForCurrentVersion("GOLD_PICKAXE", "GOLD_PICKAXE", "GOLDEN_PICKAXE"), 0, 1, false); yml.addDefault("upgrade-miner.tier-1.receive", Collections.singletonList("player-effect: FAST_DIGGING,0,0,team")); yml.addDefault("upgrade-miner.tier-2.currency", "diamond"); yml.addDefault("upgrade-miner.tier-2.cost", 4); - addDefaultDisplayItem("upgrade-miner.tier-2", "GOLD_PICKAXE", 0, 2, false); - yml.addDefault("upgrade-miner.tier-2.receive", Collections.singletonList("player-effect: FAST_DIGGING,1,0,team")); + addDefaultDisplayItem("upgrade-miner.tier-2", getForCurrentVersion("GOLD_PICKAXE", "GOLD_PICKAXE", "GOLDEN_PICKAXE"), 0, 2, false); yml.addDefault("upgrade-miner.tier-2.receive", Collections.singletonList("player-effect: FAST_DIGGING,1,0,team")); yml.addDefault("upgrade-forge.tier-1.currency", "diamond"); yml.addDefault("upgrade-forge.tier-1.cost", 2); @@ -118,17 +118,17 @@ public UpgradesConfig(String name, String dir) { "base-trap-3,12", "base-trap-4,13", "separator-back,31")); yml.addDefault("separator-glass.on-click", ""); - addDefaultDisplayItem("separator-glass", BedWars.getForCurrentVersion("STAINED_GLASS_PANE", "STAINED_GLASS_PANE", + addDefaultDisplayItem("separator-glass", getForCurrentVersion("STAINED_GLASS_PANE", "STAINED_GLASS_PANE", "GRAY_STAINED_GLASS_PANE"), 7, 1, false); yml.addDefault("trap-slot-first.trap", 1); - addDefaultDisplayItem("trap-slot-first", BedWars.getForCurrentVersion("STAINED_GLASS", "STAINED_GLASS", + addDefaultDisplayItem("trap-slot-first", getForCurrentVersion("STAINED_GLASS", "STAINED_GLASS", "GRAY_STAINED_GLASS"), 8, 1, false); yml.addDefault("trap-slot-second.trap", 2); - addDefaultDisplayItem("trap-slot-second", BedWars.getForCurrentVersion("STAINED_GLASS", "STAINED_GLASS", + addDefaultDisplayItem("trap-slot-second", getForCurrentVersion("STAINED_GLASS", "STAINED_GLASS", "GRAY_STAINED_GLASS"), 8, 2, false); yml.addDefault("trap-slot-third.trap", 3); - addDefaultDisplayItem("trap-slot-third", BedWars.getForCurrentVersion("STAINED_GLASS", "STAINED_GLASS", + addDefaultDisplayItem("trap-slot-third", getForCurrentVersion("STAINED_GLASS", "STAINED_GLASS", "GRAY_STAINED_GLASS"), 8, 3, false); addDefaultDisplayItem("base-trap-1", "TRIPWIRE_HOOK", 0, 1, false); @@ -137,7 +137,7 @@ public UpgradesConfig(String name, String dir) { addDefaultDisplayItem("base-trap-2", "FEATHER", 0, 1, false); yml.addDefault("base-trap-2.receive", Collections.singletonList("player-effect: SPEED,1,15,base")); - addDefaultDisplayItem("base-trap-3", BedWars.getForCurrentVersion("REDSTONE_TORCH_ON", "REDSTONE_TORCH", "REDSTONE_TORCH"), 0, 1, false); + addDefaultDisplayItem("base-trap-3", getForCurrentVersion("REDSTONE_TORCH_ON", "REDSTONE_TORCH", "REDSTONE_TORCH"), 0, 1, false); yml.addDefault("base-trap-3.custom-announce", true); yml.addDefault("base-trap-3.receive", Collections.singletonList("remove-effect: INVISIBILITY,enemy")); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Bangla.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Bangla.java index bac183ab1..33fdd4a17 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Bangla.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Bangla.java @@ -54,20 +54,6 @@ public Bangla() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); - yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_LANG_LIST_HEADER, "{prefix} &2Upolopdho Bhasa:"); yml.addDefault(Messages.COMMAND_LANG_LIST_FORMAT, "&a▪ &7{iso} - &f{name}"); @@ -191,19 +177,6 @@ public Bangla() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aHealth")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -283,9 +256,10 @@ public Bangla() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &ateam khela jitlen!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &lPrhthom Killer &7- {firstName} - {firstKills}", - "&6 &lDitio Killer &7- {secondName} - {secondKills}", - "&c &lTritio Killer &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &lPrhthom Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &lDitio Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &lCaturtha Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lApnar Bichana rokkha korun!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lApnar Bichana dhongso hoye giyeche!"); @@ -351,20 +325,529 @@ public Bangla() { addDefaultStatsMsg(yml, "last-play", "&6Last Play", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Games Played", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fWaiting...", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fStarting in &a{time}s", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fYour Level: {level}", + "", + "&fProgress: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fCoins: &a{money}" , + "", + "&fTotal Wins: &a{wins}", + "&fTotal Kills: &a{kills}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "§fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "§fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fYour Level: {level}", "", "&fProgress: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fCoins: &a{money}" - , "", "&fTotal Wins: &a{wins}", "&fTotal Kills: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Quick Buy"); @@ -462,6 +945,7 @@ public Bangla() { // yml.addDefault(Messages.MEANING_NO_TRAP, "No trap!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Cost: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/English.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/English.java index 0648d5c7d..2cdcbc76a 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/English.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/English.java @@ -176,33 +176,6 @@ public English() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aHealth")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}\n"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING, "&a{serverIp}\n"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}\n"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}\n"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}\n"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR, "&9{serverIp}\n"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "\n&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "\n&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING, "\n&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "\n&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "\n&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR, "\n&9{serverIp}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -280,11 +253,13 @@ public English() { yml.addDefault(Messages.GAME_END_GAME_OVER_PLAYER_TITLE, "&c&lGAME OVER!"); yml.addDefault(Messages.GAME_END_VICTORY_PLAYER_TITLE, "&6&lVICTORY!"); yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &ahas won the game!"); - yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", + yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("", + "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &l1st Killer &7- {firstName} - {firstKills}", - "&6 &l2nd Killer &7- {secondName} - {secondKills}", - "&c &l3rd Killer &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &l1st Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &l2nd Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &l3rd Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lDefend your bed!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lYour bed was destroyed!"); @@ -350,21 +325,544 @@ public English() { addDefaultStatsMsg(yml, "last-play", "&6Last Play", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Games Played", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fWaiting...", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fStarting in &a{time}s", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fYour Level: {level}", + "", + "&fProgress: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fCoins: &a{money}" , + "", + "&fTotal Wins: &a{wins}", + "&fTotal Kills: &a{kills}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "§fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "§fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", - "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&7&oYou are spectating" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oYou are spectating" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fYour Level: {level}", "", "&fProgress: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fCoins: &a{money}" - , "", "&fTotal Wins: &a{wins}", "&fTotal Kills: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Quick Buy"); @@ -464,6 +962,7 @@ public English() { // yml.addDefault(Messages.MEANING_NO_TRAP, "No trap!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Cost: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Hindi.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Hindi.java index a8b9925c8..08daf4bb7 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Hindi.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Hindi.java @@ -53,19 +53,6 @@ public Hindi() { yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL, yml.getString("player-die-knocked-final")); yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_LANG_LIST_HEADER, "{prefix} &2Upalabdh bhaasa:"); @@ -189,19 +176,6 @@ public Hindi() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aHealth")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -281,9 +255,9 @@ public Hindi() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &ateam game jeete!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &lPehla Killer &7- {firstName} - {firstKills}", - "&6 &lDusra Killer &7- {secondName} - {secondKills}", - "&c &lTeesra Killer &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &lPehla Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &lDusra Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &lTeesra Killer &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lApke bistar ko rakhsha kare!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lApka bistar tut gaya!"); @@ -349,28 +323,541 @@ public Hindi() { addDefaultStatsMsg(yml, "last-play", "&6Last Play", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Games Played", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fWaiting...", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fStarting in &a{time}s", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{TeamRedColor}R&f {TeamRedName}&f&f: {TeamRedStatus}", - "{TeamBlueColor}B&f {TeamBlueName}&f: {TeamBlueStatus}", "{TeamGreenColor}G&f {TeamGreenName}&f: {TeamGreenStatus}", "{TeamYellowColor}Y &f{TeamYellowName}&f: {TeamYellowStatus}", - "{TeamAquaColor}A &f{TeamAquaName}&f: {TeamAquaStatus}", "{TeamWhiteColor}W &f{TeamWhiteName}&f: {TeamWhiteStatus}", "{TeamPinkColor}P &f{TeamPinkName}&f: {TeamPinkStatus}", - "{TeamGrayColor}S &f{TeamGrayName}&f: {TeamGrayStatus}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fYour Level: {level}", + "", + "&fProgress: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fCoins: &a{money}" , + "", + "&fTotal Wins: &a{wins}", + "&fTotal Kills: &a{kills}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + + "&7{date} &8{server}", + "&o&lSpectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "§fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "§fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{TeamRedColor}R&f {TeamRedName}&f&f: {TeamRedStatus}", - "{TeamBlueColor}B&f {TeamBlueName}&f: {TeamBlueStatus}", "{TeamGreenColor}G&f {TeamGreenName}&f: {TeamGreenStatus}", "{TeamYellowColor}Y &f{TeamYellowName}&f: {TeamYellowStatus}", - "{TeamAquaColor}A &f{TeamAquaName}&f: {TeamAquaStatus}", "{TeamWhiteColor}W &f{TeamWhiteName}&f: {TeamWhiteStatus}", "{TeamPinkColor}P &f{TeamPinkName}&f: {TeamPinkStatus}", - "{TeamGrayColor}S &f{TeamGrayName}&f: {TeamGrayStatus}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{TeamRedColor}R&f {TeamRedName}&f&f: {TeamRedStatus}", - "{TeamBlueColor}B&f {TeamBlueName}&f: {TeamBlueStatus}", "{TeamGreenColor}G&f {TeamGreenName}&f: {TeamGreenStatus}", "{TeamYellowColor}Y &f{TeamYellowName}&f: {TeamYellowStatus}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&e&lBED WARS", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&e&lBED WARS", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{TeamRedColor}R&f {TeamRedName}&f&f: {TeamRedStatus}", - "{TeamBlueColor}B&f {TeamBlueName}&f: {TeamBlueStatus}", "{TeamGreenColor}G&f {TeamGreenName}&f: {TeamGreenStatus}", "{TeamYellowColor}Y &f{TeamYellowName}&f: {TeamYellowStatus}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fYour Level: {level}", "", "&fProgress: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fCoins: &a{money}" - , "", "&fTotal Wins: &a{wins}", "&fTotal Kills: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Quick Buy"); @@ -467,6 +954,7 @@ public Hindi() { // yml.addDefault(Messages.MEANING_NO_TRAP, "No trap!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Cost: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Indonesia.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Indonesia.java index ff5d58025..4e44c86cf 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Indonesia.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Indonesia.java @@ -53,19 +53,6 @@ public Indonesia() { yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL, yml.getString("player-die-knocked-final")); yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_LANG_LIST_HEADER, "{prefix} &2Bahasa Tersedia:"); @@ -189,19 +176,6 @@ public Indonesia() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "&f{team} {level}{vPrefix}&7{player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "&7[PENONTON] {level}{vPrefix}{player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, List.of("&c❤")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "PENONTON"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -281,9 +255,9 @@ public Indonesia() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &atelah memenangkan permainan!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lPerang Kasur", "", "{winnerFormat}", "", "", - "&e &lPembunuh Pertama &7- {firstName} - {firstKills}", - "&6 &lPembunuh Kedua &7- {secondName} - {secondKills}", - "&c &lPembunuh Ketiga &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &lPembunuh Pertama &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &lPembunuh Kedua &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &lPembunuh Ketiga &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lPertahankan Kasur Anda!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lKasur anda telah dihancurkan!"); @@ -349,21 +323,538 @@ public Indonesia() { addDefaultStatsMsg(yml, "last-play", "&6Terakhir Kali Bermain", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Pertandingan Dimainkan", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&fPERANG KASUR", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fWaiting...", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lPERANG KASUR", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayers: &a{on}/{max}", "", "&fStarting in &a{time}s", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lPERANG KASUR", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fLevel Anda: {level}", + "", + "&fProgres: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fKoin: &a{money}", + "", + "&fTotal Kemenangan: &a{wins}", + "&fTotal Membunuh: &a{kills}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fWaiting,&fWaiting.,&fWaiting..,&fWaiting...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayers: &a{on}/{max}", + "", + "&fStarting in &a{time}s", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lPERANG KASUR", "&7{date}", "", "&f{nextEvent} in &a{time}", "", - "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fPembunuhan Terakhir: &a{finalKills}", + "&fBed Dihancurkan: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fPembunuhan Terakhir: &a{finalKills}", + "&fBed Dihancurkan: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lPERANG KASUR", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lPERANG KASUR", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fPembunuhan Terakhir: &a{finalKills}", "&fBed Dihancurkan: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fLevel Anda: {level}", "", "&fProgres: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fKoin: &a{money}" - , "", "&fTotal Kemenangan: &a{wins}", "&fTotal Membunuh: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Quick Buy"); @@ -461,6 +952,7 @@ public Indonesia() { // yml.addDefault(Messages.MEANING_NO_TRAP, "Tidak ada Perangkap!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Biaya: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Italian.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Italian.java index 62a092616..9d9cc0ddb 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Italian.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Italian.java @@ -54,19 +54,6 @@ public Italian() { yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL, yml.getString("player-die-knocked-final")); yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_JOIN_USAGE, "§a▪ §7Utilizzo: /" + mainCmd + " join §o"); @@ -191,19 +178,6 @@ public Italian() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aVita")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_ELIMINATED, "&c&l✘"); @@ -279,9 +253,9 @@ public Italian() { yml.addDefault(Messages.GAME_END_VICTORY_PLAYER_TITLE, "&6&lVITTORIA!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &l1° Uccisore &7- {firstName} - {firstKills}", - "&6 &l2° Uccisore &7- {secondName} - {secondKills}", - "&c &l3° Uccisore &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &l1° Uccisore &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &l2° Uccisore &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &l3° Uccisore &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &aha vinto il gioco!"); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lDifendi il tuo letto!"); @@ -338,21 +312,539 @@ public Italian() { addDefaultStatsMsg(yml, "last-play", "&6Ultima partita", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Partite giocate", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMappa: &a{map}", "", "&fGiocatori: &a{on}/{max}", "", "&fIn attesa...", "", "§fMode: &a{group}", "&fVersione: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMappa: &a{map}", "", "&fGiocatori: &a{on}/{max}", "", "&fInizio in &a{time}s", "", "§fMode: &a{group}", "&fVersione: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMappa: &a{map}", + "", + "&fGiocatori: &a{on}/{max}", + "", + "&fIn attesa&fIn attesa.,&fIn attesa..,&fIn attesa...", + "", + "&fMode: &a{group}", + "&fVersione: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Guardando", + "&fMappa: &a{map}", + "", + "&fGiocatori: &a{on}/{max}", + "", + "&fIn attesa&fIn attesa.,&fIn attesa..,&fIn attesa...", + "", + "&fMode: &a{group}", + "&fVersione: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMappa: &a{map}", + "", + "&fGiocatori: &a{on}/{max}", + "", + "&fInizio in &a{time}s", + "", + "&fMode: &a{group}", + "&fVersione: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Guardando", + "&fMappa: &a{map}", + "", + "&fGiocatori: &a{on}/{max}", + "", + "&fInizio in &a{time}s", + "", + "&fMode: &a{group}", + "&fVersione: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Guardando {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fUccisioni: &a{kills}", "&fUccisioni Finali: &a{finalKills}", "&fLetti Distrutti: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fUccisioni: &a{kills}", "&fUccisioni Finali: &a{finalKills}", "&fLetti Distrutti: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars", "&fLivello: {level}", "", "&fProgresso: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fSoldi: &a{money}" - , "", "&fVittorie: &a{wins}", "&fUccisioni: &a{kills}", "", "&e{serverIp}")); + yml.addDefault(SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Guardando {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUccisioni: &a{kills}", + "&fUccisioni Finali: &a{finalKills}", + "&fLetti Distrutti: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Guardando {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUccisioni: &a{kills}", + "&fUccisioni Finali: &a{finalKills}", + "&fLetti Distrutti: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUccisioni: &a{kills}", + "&fUccisioni Finali: &a{finalKills}", + "&fLetti Distrutti: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Guardando {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUccisioni: &a{kills}", + "&fUccisioni Finali: &a{finalKills}", + "&fLetti Distrutti: &a{beds}", + "", + "&e{serverIp}") + ); + // End of Sidebar + + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab + + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fLivello: {level}", + "", + "&fProgresso: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fSoldi: &a{money}", + "", + "&fVittorie: &a{wins}", + "&fUccisioni: &a{kills}", + "", "&e{serverIp}") + ); yml.addDefault(Messages.TEAM_ELIMINATED_CHAT, "\n&f&lTEAM ELIMINATO > Il team {TeamColor}{TeamName} &cè stato eliminato\n"); yml.addDefault(Messages.XP_REWARD_PER_MINUTE, "{prefix}&6+{xp} Esperienza BedWars ricevuta (Tempo di Gioco)."); yml.addDefault(Messages.XP_REWARD_WIN, "{prefix}&6+{xp} Esperienza BedWars ricevuta (Vittoria)."); @@ -446,6 +938,7 @@ public Italian() { addContentMessages(yml, "Compact Pop-up Tower", ConfigPath.SHOP_PATH_CATEGORY_UTILITY, "{color}Torre Pop-up Compatta", Arrays.asList("&7Costo: {cost} {currency}", "", "&7Piazza una Torre Pop-up", "&7compatta per difenderti!", "", "{quick_buy}", "{buy_status}")); yml.addDefault(Messages.MEANING_NO_TRAP, "Nessuna Trappola!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Costo: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Persian.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Persian.java index 70e2dbf2a..660ad0a1d 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Persian.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Persian.java @@ -55,20 +55,6 @@ public Persian() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR, "&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR, "&9{serverIp}"); - yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_LANG_LIST_HEADER, "{prefix} &2Zaban haye mojood:"); yml.addDefault(Messages.COMMAND_LANG_LIST_FORMAT, "&a▪ &7{iso} - &f{name}"); @@ -191,19 +177,6 @@ public Persian() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aHealth")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -283,9 +256,9 @@ public Persian() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &abarande bazi shodan!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &lMagham #1 &7- {firstName} - {firstKills}", - "&6 &lMagham #2 &7- {secondName} - {secondKills}", - "&c &lMagham #3 &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &lMagham #1 &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &lMagham #2 &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &lMagham #3 &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lAz Bed khodetoon hefazat konid!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lBed shoma az bein raft!"); @@ -351,20 +324,548 @@ public Persian() { addDefaultStatsMsg(yml, "last-play", "&6Akharin Bazi Anjam Shode", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Tedad Bazi Anjam Shode", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayer Ha: &a{on}/{max}", "", "&fDar Entezar...", "", "§fNo: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fPlayer Ha: &a{on}/{max}", "", "&fShoroo dar &a{time}s", "", "§fNo: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fLevel Shoma: {level}", + "", + "&fPishraft: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fCoins: &a{money}", + "", + "&fMajmoo Win: &a{wins}", + "&fMajmoo Kill: &a{kills}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayer Ha: &a{on}/{max}", + "", + "&fDar Entezar,&fDar Entezar.,&fDar Entezar..,&fDar Entezar...", + "", + "&fNo: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayer Ha: &a{on}/{max}", + "", + "&fDar Entezar,&fDar Entezar.,&fDar Entezar..,&fDar Entezar...", + "", + "&fNo: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fPlayer Ha: &a{on}/{max}", + "", + "&fShoroo dar &a{time}s", + "", + "&fNo: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMap: &a{map}", + "", + "&fPlayer Ha: &a{on}/{max}", + "", + "&fShoroo dar &a{time}s", + "", + "&fNo: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} dar &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} dar &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} dar &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} dar &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} dar &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} dar &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} dar &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} dar &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} dar &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fLevel Shoma: {level}", "", "&fPishraft: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fCoins: &a{money}" - , "", "&fMajmoo Win: &a{wins}", "&fMajmoo Kill: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Kharid Sari"); @@ -462,6 +963,7 @@ public Persian() { // yml.addDefault(Messages.MEANING_NO_TRAP, "Hich tale i nadarid!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Gheimat: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Polish.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Polish.java index 527f2d20b..818434441 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Polish.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Polish.java @@ -54,20 +54,6 @@ public Polish() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); - yml.addDefault(Messages.COMMAND_JOIN_USAGE, "§a▪ §7Uzyj: /" + mainCmd + " join §o"); yml.addDefault(Messages.COMMAND_NOT_ALLOWED_IN_GAME, "{prefix}&cNie mozesz tego zrobic."); yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); @@ -190,19 +176,6 @@ public Polish() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aZYCIA")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_ELIMINATED, "&c&l✘"); @@ -280,9 +253,9 @@ public Polish() { yml.addDefault(Messages.GAME_END_VICTORY_PLAYER_TITLE, "&6&lWYGRANA!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &lTOP 1 Zabojca &7- {firstName} - {firstKills}", - "&6 &lTOP 2 Zabojca &7- {secondName} - {secondKills}", - "&c &lTOP 3 Zabojca &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &lTOP 1 Zabojca &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &lTOP 2 Zabojca &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &lTOP 3 Zabojca &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &awygral gre!"); yml.addDefault(Messages.NEXT_EVENT_BEDS_DESTROY, "&dZniszczenie lozek&f:"); @@ -317,20 +290,539 @@ public Polish() { yml.addDefault(Messages.GENERAL_CONFIGURATION_SPECTATOR_ITEMS_NAME.replace("%path%", "leave"), "&eWroc do lobby"); yml.addDefault(Messages.GENERAL_CONFIGURATION_SPECTATOR_ITEMS_LORE.replace("%path%", "leave"), Collections.singletonList("&fPPM aby wyjsc do lobby!")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMapa: &a{map}", "", "&fGracze: &a{on}/{max}", "", "&fOczekiwanie...", "", "§fTryb: &a{group}", "&fWersja: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMapa: &a{map}", "", "&fGracze: &a{on}/{max}", "", "&fRozpoczecie &a{time}s", "", "§fTryb: &a{group}", "&fWersja: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fTwoj poziom: {level}", + "", + "&fProgress: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fMonety: &a{money}", + "", + "&fWygrane: &a{wins}", + "&fZabojstwa: &a{kills}", + "", "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMapa: &a{map}", + "", + "&fGracze: &a{on}/{max}", + "", + "&fOczekiwanie,&fOczekiwanie.,&fOczekiwanie..,&fOczekiwanie...", + "", + "&fTryb: &a{group}", + "&fWersja: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMapa: &a{map}", + "", + "&fGracze: &a{on}/{max}", + "", + "&fOczekiwanie,&fOczekiwanie.,&fOczekiwanie..,&fOczekiwanie...", + "", + "&fTryb: &a{group}", + "&fWersja: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMapa: &a{map}", + "", + "&fGracze: &a{on}/{max}", + "", + "&fRozpoczecie &a{time}s", + "", + "&fTryb: &a{group}", + "&fWersja: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMapa: &a{map}", + "", + "&fGracze: &a{on}/{max}", + "", + "&fRozpoczecie &a{time}s", + "", + "&fTryb: &a{group}", + "&fWersja: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fZabojstwa: &a{kills}", + "&fOstateczne Zabojstwa: &a{finalKills}", + "&fZniszczone Lozka: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fZabojstwa: &a{kills}", + "&fOstateczne Zabojstwa: &a{finalKills}", + "&fZniszczone Lozka: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fZabojstwa: &a{kills}", + "&fOstateczne Zabojstwa: &a{finalKills}", + "&fZniszczone Lozka: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fZabojstwa: &a{kills}", + "&fOstateczne Zabojstwa: &a{finalKills}", + "&fZniszczone Lozka: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fZabojstwa: &a{kills}", "&fOstateczne Zabojstwa: &a{finalKills}", "&fZniszczone Lozka: &a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fZabojstwa: &a{kills}", "&fOstateczne Zabojstwa: &a{finalKills}", "&fZniszczone Lozka: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars", "&fTwoj poziom: {level}", "", "&fProgress: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fMonety: &a{money}" - , "", "&fWygrane: &a{wins}", "&fZabojstwa: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab yml.addDefault(Messages.XP_REWARD_PER_MINUTE, "{prefix}&6+{xp} Otrzymano doswiedczenie BedWars (Czas grania)."); yml.addDefault(Messages.XP_REWARD_WIN, "{prefix}&6+{xp} Otrzymano doswiedczenie BedWars (Wygrana gra)."); @@ -484,6 +976,7 @@ public Polish() { yml.addDefault(Messages.REJOIN_ALLOWED, "{prefix}&eDołączasz do &a{arena}&e!"); yml.addDefault(Messages.MEANING_NO_TRAP, "No trap!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Cost: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Portuguese.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Portuguese.java index a7fad27bf..ba5ff5daf 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Portuguese.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Portuguese.java @@ -53,20 +53,6 @@ public Portuguese() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); - yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_LANG_LIST_HEADER, "{prefix} &2Idiomas disponíveis:"); yml.addDefault(Messages.COMMAND_LANG_LIST_FORMAT, "&a▪ &7{iso} - &f{name}"); @@ -189,19 +175,6 @@ public Portuguese() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aVida")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "ESPEC"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -281,9 +254,9 @@ public Portuguese() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &aganhou o jogo!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &l1º Assassino &7- {firstName} - {firstKills}", - "&6 &l2º Assassino &7- {secondName} - {secondKills}", - "&c &l3º Assassino &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &l1º Assassino &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &l2º Assassino &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &l3º Assassino &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lDefenda sua cama!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lSua cama foi destruída!"); @@ -349,21 +322,539 @@ public Portuguese() { addDefaultStatsMsg(yml, "last-play", "&6Última Partida", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Partidas", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMapa: &a{map}", "", "&fJogadores: &a{on}/{max}", "", "&fEsperando...", "", "§fModo: &a{group}", "&fVersão: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMapa: &a{map}", "", "&fJogadores: &a{on}/{max}", "", "&fInicio em &a{time}s", "", "§fModo: &a{group}", "&fVersão: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} em &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fSeu nivel: {level}", + "", + "&fProgresso: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fMoedas: &a{money}", + "", + "&fTotal de vitórias: &a{wins}", + "&fTotal de abates: &a{kills}", + "", "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMapa: &a{map}", + "", + "&fJogadores: &a{on}/{max}", + "", + "&fEsperando,&fEsperando.,&fEsperando..,&fEsperando...", + "", + "&fModo: &a{group}", + "&fVersão: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMapa: &a{map}", + "", + "&fJogadores: &a{on}/{max}", + "", + "&fEsperando,&fEsperando.,&fEsperando..,&fEsperando...", + "", + "&fModo: &a{group}", + "&fVersão: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMapa: &a{map}", + "", + "&fJogadores: &a{on}/{max}", + "", + "&fInicio em &a{time}s", + "", + "&fModo: &a{group}", + "&fVersão: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMapa: &a{map}", + "", + "&fJogadores: &a{on}/{max}", + "", + "&fInicio em &a{time}s", + "", + "&fModo: &a{group}", + "&fVersão: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} em &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} em &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} em &a{time}", "", - "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fKills: &a{kills}", + "&fFinal Kills: &a{finalKills}", + "&fBeds Broken: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} em &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} em &a{time}", "", "{team}", "{team}", "{team}", "{team}", - "", "&fKills: &a{kills}", "&fFinal Kills: &a{finalKills}", "&fBeds Broken: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fSeu nivel: {level}", "", "&fProgresso: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fMoedas: &a{money}" - , "", "&fTotal de vitórias: &a{wins}", "&fTotal de abates: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Compra rápida"); @@ -461,6 +952,7 @@ public Portuguese() { // yml.addDefault(Messages.MEANING_NO_TRAP, "Sem armadilha!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Preço: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Romanian.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Romanian.java index 558f5f6a2..6d8677ae3 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Romanian.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Romanian.java @@ -43,30 +43,17 @@ public Romanian() { // this must stay here // move message to new path - if (yml.get("player-die-knocked-regular") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL) == null){ + if (yml.get("player-die-knocked-regular") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL) == null) { yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_REGULAR_KILL, yml.getString("player-die-knocked-regular")); yml.set("player-die-knocked-regular", null); } - if (yml.get("player-die-knocked-final") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL) == null){ + if (yml.get("player-die-knocked-final") != null && yml.get(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL) == null) { yml.set(Messages.PLAYER_DIE_KNOCKED_IN_VOID_FINAL_KILL, yml.getString("player-die-knocked-final")); yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); - yml.options().copyDefaults(true); + yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_JOIN_DENIED_IS_FULL, "{prefix}&cArena este plina!\n&aAi putea lua in considerare donarea pentru mai multe facilitati. &7&o(click)"); yml.addDefault(Messages.COMMAND_JOIN_DENIED_IS_FULL_OF_VIPS, "{prefix}&cNe pare rau dar arena este plina.\n&cStim ca esti donator dar arena este deja plina cu persoane care au prioritate."); @@ -123,7 +110,7 @@ public Romanian() { yml.addDefault(Messages.COMMAND_PARTY_PROMOTE_OWNER, "{prefix}&eAi fost promovat ca proprietar al petrecerii"); yml.addDefault(Messages.COMMAND_PARTY_PROMOTE_NEW_OWNER, "{prefix}&7 &e{player} a fost promovat ca proprietar"); yml.addDefault(Messages.COMMAND_PARTY_INFO_OWNER, "\n{prefix}&eProprietarul petrecerii este: &7{owner}"); - yml.addDefault(Messages.COMMAND_PARTY_INFO_PLAYERS,"{prefix}&eMembrii sunt:"); + yml.addDefault(Messages.COMMAND_PARTY_INFO_PLAYERS, "{prefix}&eMembrii sunt:"); yml.addDefault(Messages.COMMAND_PARTY_INFO_PLAYER, "&7{player}"); yml.addDefault(Messages.COMMAND_NOT_FOUND_OR_INSUFF_PERMS, "{prefix}&cComanda nu a fost gasita sau nu ai permisiunea!"); yml.addDefault(Messages.COMMAND_FORCESTART_NOT_IN_GAME, "§c▪ §7Nu esti in joc!"); @@ -191,19 +178,7 @@ public Romanian() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aViață")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); + yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_ELIMINATED, "&c&l✘"); @@ -276,9 +251,9 @@ public Romanian() { yml.addDefault(Messages.GAME_END_VICTORY_PLAYER_TITLE, "&6&lVICTORIE!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &lPrimul Ucigas &7- {firstName} - {firstKills}", - "&6 &lAl 2-lea Ucigas &7- {secondName} - {secondKills}", - "&c &lAl 3-lea Ucigas &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &lPrimul Ucigas &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &lAl 2-lea Ucigas &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &lAl 3-lea Ucigas &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}Echipa {TeamName} &aa castigat!"); yml.addDefault(Messages.NPC_NAME_TEAM_UPGRADES, "&bTEAM UPGRADES,&e&lCLICK DREAPTA"); @@ -337,21 +312,549 @@ public Romanian() { addDefaultStatsMsg(yml, "last-play", "&6Ultimul Meci", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Partide Jucate", "&f{gamesPlayed}"); + // start of sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fNivelul tau: {level}", + "", + "&fProgres: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fBani: &a{money}", + "", + "&fVictorii: &a{wins}", + "&fUcideri: &a{kills}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fHarta: &a{map}", + "", + "&fJucatori: &a{on}/{max}", + "", + "&fIn asteptare,&fIn asteptare.,&fIn asteptare..,&fIn asteptare...", + "", + "&fMod: &a{group}", + "&fVersiune: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Esti spectator", + "&fHarta: &a{map}", + "", + "&fJucatori: &a{on}/{max}", + "", + "&fIn asteptare,&fIn asteptare.,&fIn asteptare..,&fIn asteptare...", + "", + "&fMod: &a{group}", + "&fVersiune: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMap: &a{map}", + "", + "&fJucatori: &a{on}/{max}", + "", + "&fIncepe in &a{time}s", + "", + "§fMod: &a{group}", + "&fVersiune: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Esti spectator", + "&fMap: &a{map}", + "", + "&fJucatori: &a{on}/{max}", + "", + "&fIncepe in &a{time}s", + "", + "§fMod: &a{group}", + "&fVersiune: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fHarta: &a{map}", "", "&fJucatori: &a{on}/{max}", "", "&fIn asteptare...", "", "§fMod: &a{group}", "&fVersiune: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMap: &a{map}", "", "&fJucatori: &a{on}/{max}", "", "&fIncepe in &a{time}s", "", "§fMod: &a{group}", "&fVersiune: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUcideri: &a{kills}", + "&fUcideri Finale: &a{finalKills}", + "&fPaturi Distruse: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUcideri: &a{kills}", + "&fUcideri Finale: &a{finalKills}", + "&fPaturi Distruse: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUcideri: &a{kills}", + "&fUcideri Finale: &a{finalKills}", + "&fPaturi Distruse: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fUcideri: &a{kills}", + "&fUcideri Finale: &a{finalKills}", + "&fPaturi Distruse: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // end of sidebar - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fUcideri: &a{kills}", "&fUcideri Finale: &a{finalKills}", "&fPaturi Distruse: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fUcideri: &a{kills}", "&fUcideri Finale: &a{finalKills}", "&fPaturi Distruse: &a{beds}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars", "&fNivelul tau: {level}", "", "&fProgres: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fBani: &a{money}" - , "", "&fVictorii: &a{wins}", "&fUcideri: &a{kills}", "", "&e{serverIp}")); yml.addDefault(Messages.XP_REWARD_PER_MINUTE, "{prefix}&6+{xp} BedWars Experience Received (Play Time)."); yml.addDefault(Messages.XP_REWARD_WIN, "{prefix}&6+{xp} BedWars Experience Received (Game Win)."); yml.addDefault(Messages.XP_REWARD_PER_TEAMMATE, "{prefix}&6+{xp} BedWars Experience Received (Team Support)."); @@ -479,6 +982,7 @@ public Romanian() { yml.addDefault(Messages.UPGRADES_UPGRADE_BOUGHT_CHAT, "&a{player} a cumparat &6{upgradeName}"); yml.addDefault(Messages.MEANING_NO_TRAP, "No trap!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Cost: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Russian.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Russian.java index 79311a77b..0a375a7c7 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Russian.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Russian.java @@ -52,20 +52,6 @@ public Russian() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); - yml.options().copyDefaults(true); yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o<арена/тип>", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.ARENA_JOIN_VIP_KICK, "{prefix}&cИзвините, но вас выгнали, потому что к арене присоединился донатер.\n&aЧтобы иметь больше возможностей - купите донат. &7&o(жми)"); @@ -130,32 +116,525 @@ public Russian() { yml.addDefault(Messages.MEANING_SHOUT, "shout"); yml.addDefault(Messages.ARENA_STATUS_START_PLAYER_TITLE, "&aПОГНАЛИ"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fКарта: &a{map}", "", "&fИгроков: &a{on}/{max}", "", "&fОжидание...", "", "§fТип: &a{group}", "&fВерсия: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fКарта: &a{map}", "", "&fИгроков: &a{on}/{max}", "", "&fСтарт через &a{time}s", "", "§fТип: &a{group}", "&fВерсия: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fКарта: &a{map}", + "", + "&fИгроков: &a{on}/{max}", + "", + "&fОжидание,&fОжидание.,&fОжидание..,&fОжидание...", + "", + "&fТип: &a{group}", + "&fВерсия: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fКарта: &a{map}", + "", + "&fИгроков: &a{on}/{max}", + "", + "&fОжидание,&fОжидание.,&fОжидание..,&fОжидание...", + "", + "&fТип: &a{group}", + "&fВерсия: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fКарта: &a{map}", + "", + "&fИгроков: &a{on}/{max}", + "", + "&fСтарт через &a{time}s", + "", + "&fТип: &a{group}", + "&fВерсия: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fКарта: &a{map}", + "", + "&fИгроков: &a{on}/{max}", + "", + "&fСтарт через &a{time}s", + "", + "&fТип: &a{group}", + "&fВерсия: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fУбийств: &a{kills}", "&fФинальных убийств: &a{finalKills}", "&fКроватей уничтожено: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fУбийств: &a{kills}", "&fФинальных убийств: &a{finalKills}", "&fКроватей уничтожено: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&e&lBED WARS", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fУбийств: &a{kills}", + "&fФинальных убийств: &a{finalKills}", + "&fКроватей уничтожено: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&e&lBED WARS", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fУбийств: &a{kills}", + "&fФинальных убийств: &a{finalKills}", + "&fКроватей уничтожено: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fУбийств: &a{kills}", + "&fФинальных убийств: &a{finalKills}", + "&fКроватей уничтожено: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fУбийств: &a{kills}", + "&fФинальных убийств: &a{finalKills}", + "&fКроватей уничтожено: &a{beds}", + "", + "&e{serverIp}") + ); + // End of Sidebar + + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aЗдоровье")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_ELIMINATED, "&c&l✘"); @@ -199,9 +678,9 @@ public Russian() { yml.addDefault(Messages.GAME_END_VICTORY_PLAYER_TITLE, "&6&lПОБЕДА!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &l1-1 Убийца &7- {firstName} - {firstKills}", - "&6 &l2-й Убийца &7- {secondName} - {secondKills}", - "&c &l3-й Убийца &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &l1-1 Убийца &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &l2-й Убийца &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &l3-й Убийца &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); //yml.addDefault(gameOverReward, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", // "&f &lReward Summary", "", "", @@ -397,8 +876,22 @@ public Russian() { yml.addDefault(Messages.FORMATTING_STATS_DATE_FORMAT, "yyyy/MM/dd HH:mm"); yml.addDefault(Messages.MEANING_NEVER, "Никогда"); - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars", "&fВаш уровень: {level}", "", "&fПрогресс: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fМонет: &a{money}" - , "", "&fВсего побед: &a{wins}", "&fВсего убйиств: &a{kills}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fВаш уровень: {level}", + "", + "&fПрогресс: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fМонет: &a{money}", + "", + "&fВсего побед: &a{wins}", + "&fВсего убйиств: &a{kills}", + "", + "&e{serverIp}") + ); /* party commands */ yml.addDefault(Messages.COMMAND_PARTY_HELP, Arrays.asList("&6▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", @@ -499,6 +992,7 @@ public Russian() { yml.addDefault(Messages.MEANING_NO_TRAP, "Ловушки отсутствуют!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Цена: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/SimplifiedChinese.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/SimplifiedChinese.java index f9fa5d535..4489826dc 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/SimplifiedChinese.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/SimplifiedChinese.java @@ -176,33 +176,6 @@ public SimplifiedChinese() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[旁观者] {player}{vSuffix}:{message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&a生命值")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "旁观者"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR, "&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR, "&9{serverIp}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "yy/MM/dd"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}:{TeamStatus}"); @@ -282,9 +255,9 @@ public SimplifiedChinese() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName}&a赢得了这场游戏!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &l起床战争", "", "{winnerFormat}", "", "", - "&e &l击杀第一名 &7- {firstName} - {firstKills}", - "&6 &l击杀第二名 &7- {secondName} - {secondKills}", - "&c &l击杀第三名 &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &l击杀第一名 &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &l击杀第二名 &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &l击杀第三名 &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&l保护你的床!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&l你的床被破坏了!"); @@ -350,21 +323,540 @@ public SimplifiedChinese() { addDefaultStatsMsg(yml, "last-play", "&6上次游玩", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6总游玩场数", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&l起床战争", "&7{date} &8{server}", "", "&f地图:&a{map}", "", "&f玩家数:&a{on}/{max}", "", "&f等待中...", "", "&f模式:&a{group}", "&f版本:&7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&l起床战争", "&7{date} &8{server}", "", "&f地图:&a{map}", "", "&f玩家数:&a{on}/{max}", "", "&f &a{time} &f秒后开始", "", "&f模式:&a{group}", "&f模式:&7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&l起床战争", "&7{date}", "", "&f{nextEvent} - &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&6&l起床战争,&4&l起&6&l床战争,&6&l起&4&l床&6&l战争,&6&l起床&4&l战&6&l争,&6&l起床战&4&l争,&6&l起床战争", + "&f等级:{level}", + "", + "&f进度:&a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&f金币:&a{money}", + "", + "&f总胜场:&a{wins}", + "&f总击杀:&a{kills}", + "", "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&l起床战争", + "&7{date} &8{server}", + "", + "&f地图:&a{map}", + "", + "&f玩家数:&a{on}/{max}", + "", + "&f等待中,&f等待中.,&f等待中..,&f等待中...", + "", + "&f模式:&a{group}", + "&f版本:&7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&l起床战争", + "&7{date} &8{server}", + "&o&7Spectating", + "&f地图:&a{map}", + "", + "&f玩家数:&a{on}/{max}", + "", + "&f等待中,&f等待中.,&f等待中..,&f等待中...", + "", + "&f模式:&a{group}", + "&f版本:&7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&l起床战争", + "&7{date} &8{server}", + "", + "&f地图:&a{map}", + "", + "&f玩家数:&a{on}/{max}", + "", + "&f &a{time} &f秒后开始", + "", + "&f模式:&a{group}", + "&f模式:&7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&l起床战争", + "&7{date} &8{server}", + "&o&7Spectating", + "&f地图:&a{map}", + "", + "&f玩家数:&a{on}/{max}", + "", + "&f &a{time} &f秒后开始", + "", + "&f模式:&a{group}", + "&f模式:&7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&e&l起床战争", + "&7{date}", + "", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&e&l起床战争", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&e&l起床战争", + "&7{date}", + "", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&e&l起床战争", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&e&l起床战争", + "&7{date}", + "", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&f击杀:&a{kills}", + "&f最终击杀:&a{finalKills}", + "&f破坏床:&a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&e&l起床战争", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&f击杀:&a{kills}", + "&f最终击杀:&a{finalKills}", + "&f破坏床:&a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&e&l起床战争", + "&7{date}", + "", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&f击杀:&a{kills}", + "&f最终击杀:&a{finalKills}", + "&f破坏床:&a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&e&l起床战争", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} - &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&f击杀:&a{kills}", + "&f最终击杀:&a{finalKills}", + "&f破坏床:&a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&l起床战争", "&7{date}", "", "&f{nextEvent} - &a{time}", "", - "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&l起床战争", "&7{date}", "", "&f{nextEvent} - &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&f击杀:&a{kills}", "&f最终击杀:&a{finalKills}", "&f破坏床:&a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&l起床战争", "&7{date}", "", "&f{nextEvent} - &a{time}", "", "{team}", "{team}", "{team}", "{team}", - "", "&f击杀:&a{kills}", "&f最终击杀:&a{finalKills}", "&f破坏床:&a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&l起床战争,&4&l起&6&l床战争,&6&l起&4&l床&6&l战争,&6&l起床&4&l战&6&l争,&6&l起床战&4&l争,&6&l起床战争", - "&f等级:{level}", "", "&f进度:&a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&f金币:&a{money}", "", "&f总胜场:&a{wins}", "&f总击杀:&a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab yml.addDefault(Messages.SHOP_INDEX_NAME, "&8快速购买"); yml.addDefault(Messages.SHOP_QUICK_ADD_NAME, "&8添加到快速购买..."); @@ -463,6 +955,7 @@ public SimplifiedChinese() { "&7放置一个袖珍弹出塔", "&7塔防!", "", "{quick_buy}", "{buy_status}")); yml.addDefault(Messages.MEANING_NO_TRAP, "无陷阱!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7花费:{currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Spanish.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Spanish.java index 8600bedb1..20b4a2753 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Spanish.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Spanish.java @@ -53,20 +53,6 @@ public Spanish() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR, "&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR, "&9{serverIp}"); - yml.options().copyDefaults(true); yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.ARENA_JOIN_VIP_KICK, "{prefix}&cHas sido expulsado ya que un VIP se ha unido a la partida.\n&aConsidere hacer una donación para obtener más funciones. &7&o(click)"); @@ -131,34 +117,508 @@ public Spanish() { yml.addDefault(Messages.MEANING_SHOUT, "grita"); yml.addDefault(Messages.ARENA_STATUS_START_PLAYER_TITLE, "&aVAMOS"); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMapa: &a{map}", + "", + "&fJugador: &a{on}/{max}", + "", + "&fEsperando,&fEsperando.,&fEsperando..,&fEsperando...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMapa: &a{map}", + "", + "&fJugador: &a{on}/{max}", + "", + "&fEsperando,&fEsperando.,&fEsperando..,&fEsperando...", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fMapa: &a{map}", + "", + "&fJugador: &a{on}/{max}", + "", + "&fomenzando en &a{time}s", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fMapa: &a{map}", + "", + "&fJugador: &a{on}/{max}", + "", + "&fomenzando en &a{time}s", + "", + "&fMode: &a{group}", + "&fVersion: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMapa: &a{map}", "", "&fJugador: &a{on}/{max}", "", "&fEsperando...", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fMapa: &a{map}", "", "&fJugador: &a{on}/{max}", "", "&fomenzando en &a{time}s", "", "§fMode: &a{group}", "&fVersion: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&finalKills: &a{kills}", "&fAsesinatos Finales: &a{finalKills}", "&fCamas Destruidas: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&f{nextEvent} in &a{time}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fAsesinatos: &a{kills}", "&fAsesinatos Finales: &a{finalKills}", "&fCamas Destruidas: &a{beds}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&finalKills: &a{kills}", + "&fAsesinatos Finales: &a{finalKills}", + "&fCamas Destruidas: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&finalKills: &a{kills}", + "&fAsesinatos Finales: &a{finalKills}", + "&fCamas Destruidas: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&f{nextEvent} in &a{time}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fAsesinatos: &a{kills}", + "&fAsesinatos Finales: &a{finalKills}", + "&fCamas Destruidas: &a{beds}", + "", + "&e{serverIp}") + ); + // End of Sidebar + + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aSalud")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SPECT"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_ELIMINATED, "&c&l✘"); @@ -200,9 +660,9 @@ public Spanish() { yml.addDefault(Messages.GAME_END_VICTORY_PLAYER_TITLE, "&6&lVICTORIA!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &lBedWars", "", "{winnerFormat}", "", "", - "&e &l1er Asesino &7- {firstName} - {firstKills}", - "&6 &l2do Asesino &7- {secondName} - {secondKills}", - "&c &l3er Asesino &7- {thirdName} - {thirdKills}", "", + "&6 &6⭐ &l1er Asesino &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&e &l2do Asesino &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", + "&c &l3er Asesino &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue}", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); //yml.addDefault(gameOverReward, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", // "&f &lReward Summary", "", "", @@ -290,8 +750,22 @@ public Spanish() { yml.addDefault(Messages.FORMATTING_STATS_DATE_FORMAT, "yyyy/MM/dd HH:mm"); yml.addDefault(Messages.MEANING_NEVER, "Nunca"); - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars", "&fTu nivel: {level}", "", "&fProgreso: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fDinero: &a{money}" - , "", "&fVictorias totales: &a{wins}", "&fAsesinatos totales: &a{kills}", "", "&e{serverIp}")); + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fTu nivel: {level}", + "", + "&fProgreso: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fDinero: &a{money}", + "", + "&fVictorias totales: &a{wins}", + "&fAsesinatos totales: &a{kills}", + "", + "&e{serverIp}") + ); /* party commands */ yml.addDefault(Messages.COMMAND_PARTY_HELP, Arrays.asList("&6▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", @@ -487,9 +961,6 @@ public Spanish() { addContentMessages(yml, "sponge", ConfigPath.SHOP_PATH_CATEGORY_UTILITY, "{color}Esponja", Arrays.asList("&7Precio: {cost} {currency}", "", "&7Genial para absorber agua.", "", "{quick_buy}", "{buy_status}")); - - - /* Lobby Command Items */ yml.addDefault(Messages.GENERAL_CONFIGURATION_LOBBY_ITEMS_NAME.replace("%path%", "stats"), "&lEstadistícas"); yml.addDefault(Messages.GENERAL_CONFIGURATION_LOBBY_ITEMS_LORE.replace("%path%", "stats"), Arrays.asList("&7Utiliza este objeto para", "&7ver tus estadísticas.")); @@ -521,6 +992,7 @@ public Spanish() { yml.addDefault(Messages.REJOIN_ALLOWED, "{prefix}&eHas ingresado nuevamente a &a{arena}&e!"); yml.addDefault(Messages.MEANING_NO_TRAP, "Sin trampa!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Precio: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Turkish.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Turkish.java index ddc57c5f2..9a38acec7 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Turkish.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/language/Turkish.java @@ -55,20 +55,6 @@ public Turkish() { yml.set("player-die-knocked-final", null); } - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING,"&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR,"&9{serverIp}"); - - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY, "&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING, "&a{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING,"&6{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING, "&d{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING, "&c{serverIp}"); - yml.addDefault(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR,"&9{serverIp}"); - yml.addDefault(Messages.COMMAND_MAIN, Arrays.asList("", "&2▪ &7/" + mainCmd + " stats", "&2▪ &7/" + mainCmd + " join &o", "&2▪ &7/" + mainCmd + " leave", "&2▪ &7/" + mainCmd + " lang", "&2▪ &7/" + mainCmd + " gui", "&2▪ &7/" + mainCmd + " start &3(vip)")); yml.addDefault(Messages.COMMAND_LANG_LIST_HEADER, "{prefix} &2Mevcut diller:"); yml.addDefault(Messages.COMMAND_LANG_LIST_FORMAT, "&a▪ &7{iso} - &f{name}"); @@ -191,19 +177,6 @@ public Turkish() { yml.addDefault(Messages.FORMATTING_CHAT_TEAM, "{level}{vPrefix}&f{team}&7 {player}{vSuffix} {message}"); yml.addDefault(Messages.FORMATTING_CHAT_SPECTATOR, "{level}{vPrefix}&7[SPECTATOR] {player}{vSuffix}: {message}"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_HEALTH, Arrays.asList("&c❤", "&aCan")); - yml.addDefault(Messages.FORMATTING_SPECTATOR_TEAM, "SEYIRCI"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, "&7"); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, ""); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, Arrays.asList("{teamColor}&l{teamLetter} &r{teamColor}", "{team} ", "{vPrefix} {teamColor}&l{teamLetter} &r{teamColor}")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, new ArrayList<>()); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, List.of("{vPrefix} ")); - yml.addDefault(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, new ArrayList<>()); yml.addDefault(Messages.FORMATTING_SCOREBOARD_DATE, "dd/MM/yyyy"); yml.addDefault(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC, "{TeamColor}{TeamLetter}&f {TeamName}: {TeamStatus}"); @@ -283,9 +256,9 @@ public Turkish() { yml.addDefault(Messages.GAME_END_TEAM_WON_CHAT, "{prefix}{TeamColor}{TeamName} &aoyunu kazandı!"); yml.addDefault(Messages.GAME_END_TOP_PLAYER_CHAT, Arrays.asList("&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬", "&f &l&cBed&r&lWars", "", "{winnerFormat}", "", "", - "&e &l1. Oyuncu &7- {firstName} - {firstKills} öldürme", - "&6 &l2. Oyuncu &7- {secondName} - {secondKills} öldürme", - "&c &l3. Oyuncu &7- {thirdName} - {thirdKills} öldürme", "", + "&6 &6⭐ &l1. Oyuncu &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue} &7öldürme", + "&e &l2. Oyuncu &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue} &7öldürme", + "&c &l3. Oyuncu &7- {topTeamColor}{topPlayerDisplayName} &7- &l{topValue} &7öldürme", "", "&a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬")); yml.addDefault(Messages.BED_HOLOGRAM_DEFEND, "&c&lYatağını savun!"); yml.addDefault(Messages.BED_HOLOGRAM_DESTROYED, "&c&lYatağın kırıldı!"); @@ -351,21 +324,541 @@ public Turkish() { addDefaultStatsMsg(yml, "last-play", "&6Son Oyun", "&f{lastPlay}"); addDefaultStatsMsg(yml, "games-played", "&6Oynanan Oyun", "&f{gamesPlayed}"); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fHarita: &a{map}", "", "&fOyuncular: &a{on}/{max}", "", "&fBekleniyor...", "", "§fTür: &a{group}", "&fSürüm: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList("&f&lBED WARS", "&7{date} &8{server}", "", "&fHarita: &a{map}", "", "&fOyuncular: &a{on}/{max}", "", "&f&a{time}s sonra başlatılıyor", "", "§fTür: &a{group}", "&fSürüm: &7{version}", "", "&e{serverIp}")); - yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList("&e&lBED WARS", "&7{date}", "", "&a{time} sonra &f{nextEvent}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); + // Start of Sidebar + yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&fSeviyen: {level}", + "", + "&fİlerleme: &a{currentXp}&7/&b{requiredXp}", + "{progress}", + "", + "&7{player}", + "", + "&fPara: &a{money}", + "", + "&fGalibiyet: &a{wins}", + "&fToplam Öldürme: &a{kills}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fHarita: &a{map}", + "", + "&fOyuncular: &a{on}/{max}", + "", + "&fBekleniyor,&fBekleniyor.,&fBekleniyor..,&fBekleniyor...", + "", + "&fTür: &a{group}", + "&fSürüm: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_WAITING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fHarita: &a{map}", + "", + "&fOyuncular: &a{on}/{max}", + "", + "&fBekleniyor,&fBekleniyor.,&fBekleniyor..,&fBekleniyor...", + "", + "&fTür: &a{group}", + "&fSürüm: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "", + "&fHarita: &a{map}", + "", + "&fOyuncular: &a{on}/{max}", + "", + "&f&a{time}s sonra başlatılıyor", + "", + "&fTür: &a{group}", + "&fSürüm: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_STARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date} &8{server}", + "&o&7Spectating", + "&fHarita: &a{map}", + "", + "&fOyuncular: &a{on}/{max}", + "", + "&f&a{time}s sonra başlatılıyor", + "", + "&fTür: &a{group}", + "&fSürüm: &7{version}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER, Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&6Winner: {winnerTeamColor}{winnerTeamName} &6⭐", + "", + "&7&lTop Kills:", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "&f{topTeamColor}{topPlayerDisplayName}&7 - &l{topValue}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "Doubles"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fÖldürme: &a{kills}", + "&fFinal Öldürme: &a{finalKills}", + "&fYatak Kırma: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "3v3v3v3"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fÖldürme: &a{kills}", + "&fFinal Öldürme: &a{finalKills}", + "&fYatak Kırma: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fÖldürme: &a{kills}", + "&fFinal Öldürme: &a{finalKills}", + "&fYatak Kırma: &a{beds}", + "", + "&e{serverIp}") + ); + + yml.addDefault(Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC.replaceFirst("Default", "4v4v4v4"), Arrays.asList( + "&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&lBED WARS,&f&l{poweredBy},&f&l{poweredBy},&f&l{poweredBy},&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&lBED WARS,&e&l{poweredBy},&e&l{poweredBy},&e&l{poweredBy}", + "&7{date}", + "&o&7Spectating {spectatorTarget}", + "&a{time} sonra &f{nextEvent}", + "", + "{team}", + "{team}", + "{team}", + "{team}", + "", + "&fÖldürme: &a{kills}", + "&fFinal Öldürme: &a{finalKills}", + "&fYatak Kırma: &a{beds}", + "", + "&e{serverIp}") + ); - yml.addDefault("scoreboard.Doubles.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&a{time} sonra &f{nextEvent}", "", - "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "", "&e{serverIp}")); - yml.addDefault("scoreboard.3v3v3v3.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&a{time} sonra &f{nextEvent}", "", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", "{team}", - "", "&fÖldürme: &a{kills}", "&fFinal Öldürme: &a{finalKills}", "&fYatak Kırma: &a{beds}", "", "&e{serverIp}")); + // End of Sidebar - yml.addDefault("scoreboard.4v4v4v4.playing", Arrays.asList("&e&lBED WARS", "&7{date}", "", "&a{time} sonra &f{nextEvent}", "", "{team}", "{team}", "{team}", "{team}", - "", "&fÖldürme: &a{kills}", "&fFinal Öldürme: &a{finalKills}", "&fYatak Kırma: &a{beds}", "", "&e{serverIp}")); + // start of TAB + // main lobby tab format + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_FOOTER, List.of( + "", + "&fThere are {on} players on this lobby", + "Powered by {poweredBy},&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, List.of(" {level}")); + // player waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER, List.of( + "", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, List.of(" {level}")); + // spectator waiting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC, List.of( + "", + "&7&oYou are spectating", + "Waiting for more players,Waiting for more players.,Waiting for more players.., Waiting for more players...", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, List.of("{vPrefix}")); + yml.addDefault(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, List.of(" {level}")); + // player starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, List.of(" {level}")); + // spectator starting lobby + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC, List.of( + "", + "&fStarting in &a{time} &fseconds,&fStarting in &a{time} &fseconds.,&fStarting in &a{time} &fseconds..,&fStarting in &a{time} &fseconds..", + "&f{on}&a/&f{max}", + "", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, List.of("{vPrefix} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, List.of(" {level}")); + // player playing + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_FOOTER, List.of( + "", + "&fYou are playing on the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, List.of(" {vPrefix}", " {level}")); + // player eliminated - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "", + "&7&oAYou've been eliminated,&f&oAYou've been eliminated" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER, List.of( + "", + "&fYou have played in the {teamColor}{teamName} Team", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, List.of(" &c&oEliminated {teamColor}&o{teamName}", " {teamColor}&oEliminated {vPrefix}", "{teamColor}&oEliminated {level}")); + // spectator - playing state + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "{nextEvent} in {time}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner alive - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&lYour team won the game! &6⭐", + "&7{date}", "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, List.of(" {vPrefix}", " {level}")); + // winner dead - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER, List.of( + "", + "&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&6&lYou won in the {teamColor}&l{teamName} Team&6&l!,&f&lYou won in the {teamColor}&l{teamName} Team&f&l!", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", - yml.addDefault(Messages.SCOREBOARD_LOBBY, Arrays.asList("&6&lBedWars,&4&lB&6edWars,&6&lB&4e&6dWars,&6&lBe&4d&6Wars,&6&lBed&4W&6ars,&6&lBedW&4a&6rs,&6&lBedWa&4r&6s,&6&lBedWar&4s,&6&lBedWars", "&fSeviyen: {level}", "", "&fİlerleme: &a{currentXp}&7/&b{requiredXp}", "{progress}", "", "&7{player}", "", "&fPara: &a{money}" - , "", "&fGalibiyet: &a{wins}", "&fToplam Öldürme: &a{kills}", "", "&e{serverIp}")); + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, List.of("&6&l⭐ {teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // loser - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER, List.of( + " ", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER, List.of( + "", + "&fYou have lost in the {teamColor}{teamName} Team", + "&7Statistics from this match", + "&eKills: &f{kills} &8| &eFinal Kills: &f{finalKills} &8| &eBeds Destroyed: &f{beds} &8| &eDeaths: &f{deaths},&eKills: &7{kills} &8| &eFinal Kills: &7{finalKills} &8| &eBeds Destroyed: &7{beds} &8| &eDeaths: &7{deaths}", + "&fThanks for playing {player}!", + "&a{serverIp}", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, List.of("{teamColor}{teamName} ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, List.of(" {vPrefix}", " &c&oEliminated", " {level}", " &c&oEliminated")); + // spectator - restarting state + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER, List.of( + " ", + "&a{serverIp}", + "&6⭐ {winnerTeamColor}&l{winnerTeamName} Team won the game! &6⭐", + "&7{date}", + "&7Map: &f{map} &7Mode: &f{group}", + "", + "&fThanks for playing {player}!", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER, List.of( + "", + "&fPowered by {poweredBy}", + "" + )); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, List.of("&f&oSpectator ")); + yml.addDefault(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, List.of(" {vPrefix}", " {level}")); + // end of tab // yml.addDefault(Messages.SHOP_INDEX_NAME, "&8Hızlı Alım"); @@ -463,6 +956,7 @@ public Turkish() { // yml.addDefault(Messages.MEANING_NO_TRAP, "Tuzak yok!"); + yml.addDefault(Messages.FORMAT_SPECTATOR_TARGET, "{targetTeamColor}{targetDisplayName}"); yml.addDefault(Messages.FORMAT_UPGRADE_TRAP_COST, "&7Ücret: {currencyColor}{cost} {currency}"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CAN_AFFORD, "&e"); yml.addDefault(Messages.FORMAT_UPGRADE_COLOR_CANT_AFFORD, "&c"); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/BreakPlace.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/BreakPlace.java index 277ece85d..e6fbd79f0 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/BreakPlace.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/BreakPlace.java @@ -33,10 +33,10 @@ import com.andrei1058.bedwars.api.language.Messages; import com.andrei1058.bedwars.api.region.Region; import com.andrei1058.bedwars.api.server.ServerType; +import com.andrei1058.bedwars.api.util.BlastProtectionUtil; import com.andrei1058.bedwars.arena.Arena; -import com.andrei1058.bedwars.commands.bedwars.subcmds.sensitive.setup.AutoCreateTeams; import com.andrei1058.bedwars.configuration.Sounds; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import com.andrei1058.bedwars.popuptower.TowerEast; import com.andrei1058.bedwars.popuptower.TowerNorth; import com.andrei1058.bedwars.popuptower.TowerSouth; @@ -44,7 +44,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; import org.bukkit.entity.EntityType; @@ -61,11 +60,10 @@ import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.jetbrains.annotations.NotNull; import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import java.util.*; import static com.andrei1058.bedwars.BedWars.*; import static com.andrei1058.bedwars.api.language.Language.getMsg; @@ -74,9 +72,11 @@ public class BreakPlace implements Listener { private static final List buildSession = new ArrayList<>(); private final boolean allowFireBreak; + private final BlastProtectionUtil blastProtection; public BreakPlace() { allowFireBreak = config.getBoolean(ConfigPath.GENERAL_CONFIGURATION_ALLOW_FIRE_EXTINGUISH); + blastProtection = new BlastProtectionUtil(nms, BedWars.getAPI()); } @EventHandler @@ -101,29 +101,15 @@ public void onCactus(BlockPhysicsEvent e) { @EventHandler(ignoreCancelled = true) - public void onBurn(BlockBurnEvent event) { + public void onBurn(@NotNull BlockBurnEvent event) { IArena arena = Arena.getArenaByIdentifier(event.getBlock().getWorld().getName()); if (arena == null) return; - if (!arena.getConfig().getBoolean(ConfigPath.ARENA_ALLOW_MAP_BREAK)) { + if (!arena.isAllowMapBreak()) { event.setCancelled(true); return; } - // check if bed if allow map break - if (nms.isBed(event.getBlock().getType())) { - for (ITeam t : arena.getTeams()) { - for (int x = event.getBlock().getX() - 2; x < event.getBlock().getX() + 2; x++) { - for (int y = event.getBlock().getY() - 2; y < event.getBlock().getY() + 2; y++) { - for (int z = event.getBlock().getZ() - 2; z < event.getBlock().getZ() + 2; z++) { - if (t.getBed().getBlockX() == x && t.getBed().getBlockY() == y && t.getBed().getBlockZ() == z) { - if (!t.isBedDestroyed()) { - event.setCancelled(true); - break; - } - } - } - } - } - } + if (arena.isTeamBed(event.getBlock().getLocation())){ + event.setCancelled(true); } } @@ -173,7 +159,7 @@ public void onBlockPlace(BlockPlaceEvent e) { // prevent modifying wood if protected // issue #531 if (e.getBlockPlaced().getType().toString().contains("STRIPPED_") && e.getBlock().getType().toString().contains("_WOOD")) { - if (!a.getConfig().getBoolean(ConfigPath.ARENA_ALLOW_MAP_BREAK)) { + if (null != arena && !arena.isAllowMapBreak()) { e.setCancelled(true); return; } @@ -181,11 +167,13 @@ public void onBlockPlace(BlockPlaceEvent e) { a.addPlacedBlock(e.getBlock()); if (e.getBlock().getType() == Material.TNT) { - e.getBlockPlaced().setType(Material.AIR); - TNTPrimed tnt = Objects.requireNonNull(e.getBlock().getLocation().getWorld()).spawn(e.getBlock().getLocation().add(0.5, 0, 0.5), TNTPrimed.class); - tnt.setFuseTicks(45); - nms.setSource(tnt, p); - return; + if (config.getBoolean(ConfigPath.GENERAL_TNT_AUTO_IGNITE)) { + e.getBlockPlaced().setType(Material.AIR); + TNTPrimed tnt = Objects.requireNonNull(e.getBlock().getLocation().getWorld()).spawn(e.getBlock().getLocation().add(0.5, 0, 0.5), TNTPrimed.class); + tnt.setFuseTicks(config.getInt(ConfigPath.GENERAL_TNT_FUSE_TICKS)); + nms.setSource(tnt, p); + return; + } } else if (BedWars.shop.getBoolean(ConfigPath.SHOP_SPECIAL_TOWER_ENABLE)) { if (e.getBlock().getType() == Material.valueOf(shop.getString(ConfigPath.SHOP_SPECIAL_TOWER_MATERIAL))) { @@ -315,12 +303,11 @@ public void onBlockBreak(BlockBreakEvent e) { p.sendMessage(getMsg(p, Messages.INTERACT_CANNOT_BREAK_OWN_BED)); e.setCancelled(true); if (e.getPlayer().getLocation().getBlock().getType().toString().contains("BED")) { - PaperSupport.teleport(e.getPlayer(), e.getPlayer().getLocation().add(0, 0.5, 0)); + TeleportManager.teleport(e.getPlayer(), e.getPlayer().getLocation().add(0, 0.5, 0)); } } else { e.setCancelled(false); t.setBedDestroyed(true); - a.addPlayerBedDestroyed(p); PlayerBedBreakEvent breakEvent; Bukkit.getPluginManager().callEvent(breakEvent = new PlayerBedBreakEvent(e.getPlayer(), a.getTeam(p), t, a, player -> { @@ -376,7 +363,7 @@ public void onBlockBreak(BlockBreakEvent e) { } } - if (!a.getConfig().getBoolean(ConfigPath.ARENA_ALLOW_MAP_BREAK)) { + if (!a.isAllowMapBreak()) { if (!a.isBlockPlaced(e.getBlock())) { p.sendMessage(getMsg(p, Messages.INTERACT_CANNOT_BREAK_BLOCK)); e.setCancelled(true); @@ -528,41 +515,29 @@ public void onBucketEmpty(PlayerBucketEmptyEvent e) { } } - @EventHandler - public void onBlow(EntityExplodeEvent e) { + public void onBlow(@NotNull EntityExplodeEvent e) { if (e.isCancelled()) return; - if (e.blockList().isEmpty()) return; - IArena a = Arena.getArenaByIdentifier(e.blockList().get(0).getWorld().getName()); + + IArena a = Arena.getArenaByIdentifier(e.getLocation().getWorld().getName()); if (a != null) { - if (a.getNextEvent() != NextEvent.GAME_END) { - List destroyed = e.blockList(); - for (Block block : new ArrayList<>(destroyed)) { - if (!a.isBlockPlaced(block)) { - e.blockList().remove(block); - } else if (AutoCreateTeams.is13Higher()) { - if (block.getType().toString().contains("_GLASS")) e.blockList().remove(block); - } - } + if (a.getStatus() == GameState.playing) { + e.blockList().removeIf((b) -> blastProtection.isProtected(a, e.getLocation(), b, 0.3)); + return; } + e.blockList().clear(); } } @EventHandler - public void onBlockExplode(BlockExplodeEvent e) { + public void onBlockExplode(@NotNull BlockExplodeEvent e) { if (e.isCancelled()) return; if (e.blockList().isEmpty()) return; + IArena a = Arena.getArenaByIdentifier(e.blockList().get(0).getWorld().getName()); if (a != null) { if (a.getNextEvent() != NextEvent.GAME_END) { - List destroyed = e.blockList(); - for (Block block : new ArrayList<>(destroyed)) { - if (!a.isBlockPlaced(block)) { - e.blockList().remove(block); - } else if (AutoCreateTeams.is13Higher()) { - if (block.getType().toString().contains("_GLASS")) e.blockList().remove(block); - } - } + e.blockList().removeIf((b) -> blastProtection.isProtected(a, e.getBlock().getLocation(), b, 0.3)); } } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/DamageDeathMove.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/DamageDeathMove.java index e741331a8..5d6241907 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/DamageDeathMove.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/DamageDeathMove.java @@ -40,7 +40,7 @@ import com.andrei1058.bedwars.arena.team.BedWarsTeam; import com.andrei1058.bedwars.configuration.Sounds; import com.andrei1058.bedwars.listeners.dropshandler.PlayerDrops; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -56,6 +56,7 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; import java.text.DecimalFormat; import java.util.Map; @@ -124,9 +125,8 @@ public void onDamage(EntityDamageEvent e) { } // show player health on bow hit - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBowHit(EntityDamageByEntityEvent e) { - if(e.isCancelled()) return; if (e.getEntity().getType() != EntityType.PLAYER) return; if (!(e.getDamager() instanceof Projectile)) return; Projectile projectile = (Projectile) e.getDamager(); @@ -325,7 +325,7 @@ public void onDamageByEntity(EntityDamageByEntityEvent e) { } @EventHandler - public void onDeath(PlayerDeathEvent e) { + public void onDeath(@NotNull PlayerDeathEvent e) { Player victim = e.getEntity(), killer = e.getEntity().getKiller(); ITeam killersTeam = null; IArena a = Arena.getArenaByPlayer(victim); @@ -438,39 +438,44 @@ public void onDeath(PlayerDeathEvent e) { if (killer != null) killersTeam = a.getTeam(killer); String finalMessage = message; - PlayerKillEvent playerKillEvent = new PlayerKillEvent(a, victim, killer, player -> Language.getMsg(player, finalMessage), cause); + + PlayerKillEvent playerKillEvent = new PlayerKillEvent(a, victim, victimsTeam, killer, killersTeam, + player -> Language.getMsg(player, finalMessage), cause + ); Bukkit.getPluginManager().callEvent(playerKillEvent); - if(killer != null && playerKillEvent.playSound()) { + + if (killer != null && playerKillEvent.playSound()) { Sounds.playSound(ConfigPath.SOUNDS_KILL, killer); } - for (Player on : a.getPlayers()) { - Language lang = Language.getPlayerLanguage(on); - on.sendMessage(playerKillEvent.getMessage().apply(on). - replace("{PlayerColor}", victimsTeam.getColor().chat().toString()) - .replace("{PlayerName}", victim.getDisplayName()) - .replace("{PlayerNameUnformatted}", victim.getName()) - .replace("{PlayerTeamName}", victimsTeam.getDisplayName(lang)) - .replace("{KillerColor}", killersTeam == null ? "" : killersTeam.getColor().chat().toString()) - .replace("{KillerName}", killer == null ? "" : killer.getDisplayName()) - .replace("{KillerNameUnformatted}", killer == null ? "" : killer.getName()) - .replace("{KillerTeamName}", killersTeam == null ? "" : killersTeam.getDisplayName(lang))); - } - for (Player on : a.getSpectators()) { - Language lang = Language.getPlayerLanguage(on); - on.sendMessage(playerKillEvent.getMessage().apply(on). - replace("{PlayerColor}", victimsTeam.getColor().chat().toString()) - .replace("{PlayerName}", victim.getDisplayName()) - .replace("{PlayerNameUnformatted}", victim.getName()) - .replace("{KillerColor}", killersTeam == null ? "" : killersTeam.getColor().chat().toString()) - .replace("{PlayerTeamName}", victimsTeam.getDisplayName(lang)) - .replace("{KillerName}", killer == null ? "" : killer.getDisplayName()) - .replace("{KillerNameUnformatted}", killer == null ? "" : killer.getName()) - .replace("{KillerTeamName}", killersTeam == null ? "" : killersTeam.getDisplayName(lang))); + + if (null != playerKillEvent.getMessage()) { + for (Player on : a.getPlayers()) { + Language lang = Language.getPlayerLanguage(on); + on.sendMessage(playerKillEvent.getMessage().apply(on). + replace("{PlayerColor}", victimsTeam.getColor().chat().toString()) + .replace("{PlayerName}", victim.getDisplayName()) + .replace("{PlayerNameUnformatted}", victim.getName()) + .replace("{PlayerTeamName}", victimsTeam.getDisplayName(lang)) + .replace("{KillerColor}", killersTeam == null ? "" : killersTeam.getColor().chat().toString()) + .replace("{KillerName}", killer == null ? "" : killer.getDisplayName()) + .replace("{KillerNameUnformatted}", killer == null ? "" : killer.getName()) + .replace("{KillerTeamName}", killersTeam == null ? "" : killersTeam.getDisplayName(lang))); + } } - // increase stats to killer - if ((killer != null && !victimsTeam.equals(killersTeam)) && !victim.equals(killer)) { - a.addPlayerKill(killer, cause.isFinalKill(), victim); + if (null != playerKillEvent.getMessage()) { + for (Player on : a.getSpectators()) { + Language lang = Language.getPlayerLanguage(on); + on.sendMessage(playerKillEvent.getMessage().apply(on). + replace("{PlayerColor}", victimsTeam.getColor().chat().toString()) + .replace("{PlayerName}", victim.getDisplayName()) + .replace("{PlayerNameUnformatted}", victim.getName()) + .replace("{KillerColor}", killersTeam == null ? "" : killersTeam.getColor().chat().toString()) + .replace("{PlayerTeamName}", victimsTeam.getDisplayName(lang)) + .replace("{KillerName}", killer == null ? "" : killer.getDisplayName()) + .replace("{KillerNameUnformatted}", killer == null ? "" : killer.getName()) + .replace("{KillerTeamName}", killersTeam == null ? "" : killersTeam.getDisplayName(lang))); + } } // handle drops @@ -480,7 +485,6 @@ public void onDeath(PlayerDeathEvent e) { // send respawn packet Bukkit.getScheduler().runTaskLater(plugin, () -> victim.spigot().respawn(), 3L); - a.addPlayerDeath(victim); // reset last damager LastHit lastHit = LastHit.getLastHit(victim); @@ -489,7 +493,7 @@ public void onDeath(PlayerDeathEvent e) { } - if (victimsTeam.isBedDestroyed() && victimsTeam.getSize() == 1 && a.getConfig().getBoolean(ConfigPath.ARENA_DISABLE_GENERATOR_FOR_EMPTY_TEAMS)) { + if (victimsTeam.isBedDestroyed() && victimsTeam.getSize() == 1 && a.getConfig().getBoolean(ConfigPath.ARENA_DISABLE_GENERATOR_FOR_EMPTY_TEAMS)) { for (IGenerator g : victimsTeam.getGenerators()) { g.disable(); } @@ -608,7 +612,7 @@ public void onMove(PlayerMoveEvent e) { if (a.isSpectator(e.getPlayer()) || a.isReSpawning(e.getPlayer())) { if (e.getTo().getY() < 0) { - PaperSupport.teleportC(e.getPlayer(), a.isSpectator(e.getPlayer()) ? a.getSpectatorLocation() : a.getReSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(e.getPlayer(), a.isSpectator(e.getPlayer()) ? a.getSpectatorLocation() : a.getReSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); e.getPlayer().setAllowFlight(true); e.getPlayer().setFlying(true); // how to remove fall velocity? @@ -643,9 +647,9 @@ public void onMove(PlayerMoveEvent e) { if (e.getPlayer().getLocation().getBlockY() <= 0) { ITeam bwt = a.getTeam(e.getPlayer()); if (bwt != null) { - PaperSupport.teleport(e.getPlayer(), bwt.getSpawn()); + TeleportManager.teleport(e.getPlayer(), bwt.getSpawn()); } else { - PaperSupport.teleport(e.getPlayer(), a.getSpectatorLocation()); + TeleportManager.teleport(e.getPlayer(), a.getSpectatorLocation()); } } } @@ -653,7 +657,7 @@ public void onMove(PlayerMoveEvent e) { } else { if (config.getBoolean(ConfigPath.LOBBY_VOID_TELEPORT_ENABLED) && e.getPlayer().getWorld().getName().equalsIgnoreCase(config.getLobbyWorldName()) && BedWars.getServerType() == ServerType.MULTIARENA) { if (e.getTo().getY() < config.getInt(ConfigPath.LOBBY_VOID_TELEPORT_HEIGHT)) { - PaperSupport.teleportC(e.getPlayer(), config.getConfigLoc("lobbyLoc"), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(e.getPlayer(), config.getConfigLoc("lobbyLoc"), PlayerTeleportEvent.TeleportCause.PLUGIN); } } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/QuitAndTeleportListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/QuitAndTeleportListener.java index 68f70380c..2afbcc221 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/QuitAndTeleportListener.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/QuitAndTeleportListener.java @@ -21,7 +21,6 @@ package com.andrei1058.bedwars.listeners; import com.andrei1058.bedwars.BedWars; -import com.andrei1058.bedwars.api.arena.GameState; import com.andrei1058.bedwars.api.arena.IArena; import com.andrei1058.bedwars.api.configuration.ConfigPath; import com.andrei1058.bedwars.api.language.Language; @@ -35,10 +34,11 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerTeleportEvent; +import org.jetbrains.annotations.NotNull; import java.util.UUID; @@ -47,7 +47,7 @@ public class QuitAndTeleportListener implements Listener { @EventHandler - public void onLeave(PlayerQuitEvent e) { + public void onLeave(@NotNull PlayerQuitEvent e) { Player p = e.getPlayer(); // Remove from arena IArena a = Arena.getArenaByPlayer(p); @@ -100,54 +100,31 @@ public void onLeave(PlayerQuitEvent e) { CmdStats.getStatsCoolDown().remove(e.getPlayer().getUniqueId()); } - @EventHandler - public void onTeleport(PlayerTeleportEvent e) { - if (e == null) return; - if (e.isCancelled()) return; - if (e.getTo() == null) return; - if (e.getTo().getWorld() == null) return; - IArena a = Arena.getArenaByPlayer(e.getPlayer()); - if (a != null) { - IArena a1 = Arena.getArenaByIdentifier(e.getTo().getWorld().getName()); - if (a1 != null) { - if (!a1.equals(a)) { - if (a.isSpectator(e.getPlayer())) a.removeSpectator(e.getPlayer(), false); - if (a.isPlayer(e.getPlayer())) a.removePlayer(e.getPlayer(), false); - e.getPlayer().sendMessage("PlayerTeleportEvent something went wrong. You have joined an arena world while playing on a different map."); - } - } + /** + * Handle players teleported outside. + */ + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onWorldChange(@NotNull PlayerChangedWorldEvent e) { + + // if player was teleported outside arena + IArena arena = Arena.getArenaByPlayer(e.getPlayer()); + + if (null == arena) { + return; } - } - @EventHandler - public void onWorldChange(PlayerChangedWorldEvent e) { - // I think this for shared mode should be removed - if (BedWars.getServerType() == ServerType.SHARED) { - if (BedWars.config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_USE_LOBBY_SIDEBAR)) { - //Bukkit.getScheduler().runTaskLater(plugin, ()-> { - if (e.getPlayer().getWorld().getName().equalsIgnoreCase(BedWars.getLobbyWorld())) { - SidebarService.getInstance().giveSidebar(e.getPlayer(), null, true); - } else { - SidebarService.getInstance().remove(e.getPlayer()); - } - //}, 2L); - } - } else if (BedWars.getServerType() == ServerType.MULTIARENA) { - if (BedWars.config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_USE_LOBBY_SIDEBAR)) { - if (e.getPlayer().getWorld().getName().equalsIgnoreCase(BedWars.getLobbyWorld())) { - SidebarService.getInstance().giveSidebar(e.getPlayer(), null, true); - } - } + if (e.getPlayer().getWorld().getName().equals(arena.getWorldName())) { + return; } - IArena a = Arena.getArenaByPlayer(e.getPlayer()); - if (a != null) { - if (a.isPlayer(e.getPlayer())) { - if (a.getStatus() == GameState.waiting || a.getStatus() == GameState.starting) return; - if (!e.getPlayer().getWorld().getName().equalsIgnoreCase(a.getWorld().getName())) { - a.removePlayer(e.getPlayer(), BedWars.getServerType() == ServerType.BUNGEE); - debug(e.getPlayer().getName() + " was removed from " + a.getDisplayName() + " because he was teleported outside the arena."); - } - } + + if (arena.isPlayer(e.getPlayer())) { + // it will teleport you to the lobby world or cached location + arena.removePlayer(e.getPlayer(), false); + } + + if (arena.isSpectator(e.getPlayer())) { + // it will teleport you to the lobby world or cached location + arena.removeSpectator(e.getPlayer(), false); } } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/Warnings.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/Warnings.java index 15df75e18..55a394cd9 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/Warnings.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/Warnings.java @@ -4,6 +4,7 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; @@ -14,6 +15,7 @@ public Warnings(BedWars plugin) { this.plugin = plugin; } + @EventHandler public void onJoin(PlayerJoinEvent e) { Player player = e.getPlayer(); if(!player.isOp()) return; @@ -26,7 +28,7 @@ public void onJoin(PlayerJoinEvent e) { if(Bukkit.getServer().getSpawnRadius() > 0) { Bukkit.getScheduler().runTaskLater(plugin, () -> { - player.sendMessage(ChatColor.RED + "[BedWars1058] Your spawn-protection in server.properties is enabled. "+ChatColor.YELLOW+"This might mess with BedWars arenas!"+ChatColor.GRAY+" I highly reccomend setting it to 0."); + player.sendMessage(ChatColor.RED + "[BedWars1058] Your spawn-protection in server.properties is enabled. "+ChatColor.YELLOW+"This might mess with BedWars arenas!"+ChatColor.GRAY+" It is highly reccomend setting it to 0."); }, 5); } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/arenaselector/ArenaSelectorListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/arenaselector/ArenaSelectorListener.java index 231032c98..8ac6346a9 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/arenaselector/ArenaSelectorListener.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/arenaselector/ArenaSelectorListener.java @@ -63,21 +63,25 @@ public void onArenaSelectorClick(InventoryClickEvent event) { String arenaName = data.split("=")[1]; IArena arena = Arena.getArenaByName(arenaName); if (arena == null) return; + GameState status = arena.getStatus(); if (event.getClick() == ClickType.LEFT) { - if ((arena.getStatus() == GameState.waiting || arena.getStatus() == GameState.starting) && arena.addPlayer(player, false)) { + if ((status == GameState.waiting || status == GameState.starting) && arena.addPlayer(player, false)) { Sounds.playSound("join-allowed", player); } else { Sounds.playSound("join-denied", player); player.sendMessage(Language.getMsg(player, Messages.ARENA_JOIN_DENIED_SELECTOR)); } } else if (event.getClick() == ClickType.RIGHT) { - if (arena.getStatus() == GameState.playing && arena.addSpectator(player, false, null)) { + if (status == GameState.playing && arena.addSpectator(player, false, null)) { Sounds.playSound("spectate-allowed", player); } else { player.sendMessage(Language.getMsg(player, Messages.ARENA_SPECTATE_DENIED_SELECTOR)); Sounds.playSound("spectate-denied", player); } + } else { + // Incorrect click + return; } player.closeInventory(); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/blockstatus/BlockStatusListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/blockstatus/BlockStatusListener.java index 6345d3374..b3873da83 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/blockstatus/BlockStatusListener.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/blockstatus/BlockStatusListener.java @@ -70,6 +70,8 @@ public static void updateBlock(Arena a) { path = ConfigPath.SIGNS_STATUS_BLOCK_RESTARTING_MATERIAL; data = ConfigPath.SIGNS_STATUS_BLOCK_RESTARTING_DATA; break; + default: + throw new IllegalStateException("Unhandled game status!"); } BedWars.nms.setJoinSignBackground(s.getState(), Material.valueOf(BedWars.signs.getString(path))); BedWars.nms.setJoinSignBackgroundBlockData(s.getState(), (byte) BedWars.signs.getInt(data)); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerBungee.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerBungee.java index a25fb8d45..1262b0779 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerBungee.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerBungee.java @@ -30,7 +30,7 @@ import com.andrei1058.bedwars.configuration.Permissions; import com.andrei1058.bedwars.configuration.Sounds; import com.andrei1058.bedwars.lobbysocket.LoadedUser; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import com.andrei1058.bedwars.support.preloadedparty.PreLoadedParty; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -74,34 +74,42 @@ public void onLogin(PlayerLoginEvent e) { } IArena arena = Arena.getArenaByIdentifier(proxyUser.getArenaIdentifier()); + GameState status = arena != null ? arena.getStatus() : null; + // check if arena is not available, time out etc. - if (arena == null || proxyUser.isTimedOut() || arena.getStatus() == GameState.restarting) { + if (arena == null || proxyUser.isTimedOut() || status == GameState.restarting) { e.disallow(PlayerLoginEvent.Result.KICK_OTHER, playerLang.m(Messages.ARENA_STATUS_RESTARTING_NAME)); proxyUser.destroy("Time out or game unavailable at PlayerLoginEvent"); return; } // Player logic - if (arena.getStatus() == GameState.starting || arena.getStatus() == GameState.waiting) { - // Vip join/ kick feature - if (arena.getPlayers().size() >= arena.getMaxPlayers() && Arena.isVip(p)) { - boolean canJoin = false; - for (Player inGame : arena.getPlayers()) { - if (!Arena.isVip(inGame)) { - canJoin = true; - inGame.kickPlayer(getMsg(inGame, Messages.ARENA_JOIN_VIP_KICK)); - break; + switch (status) { + case starting: + case waiting: + // Vip join/ kick feature + if (arena.getPlayers().size() >= arena.getMaxPlayers() && Arena.isVip(p)) { + boolean canJoin = false; + for (Player inGame : arena.getPlayers()) { + if (!Arena.isVip(inGame)) { + canJoin = true; + inGame.kickPlayer(getMsg(inGame, Messages.ARENA_JOIN_VIP_KICK)); + break; + } + } + if (!canJoin) { + e.disallow(PlayerLoginEvent.Result.KICK_FULL, playerLang.m(Messages.COMMAND_JOIN_DENIED_IS_FULL_OF_VIPS)); } } - if (!canJoin) { - e.disallow(PlayerLoginEvent.Result.KICK_FULL, playerLang.m(Messages.COMMAND_JOIN_DENIED_IS_FULL_OF_VIPS)); + break; + case playing: + // Spectator logic + if (!arena.isAllowSpectate()) { + e.disallow(PlayerLoginEvent.Result.KICK_OTHER, playerLang.m(Messages.COMMAND_JOIN_SPECTATOR_DENIED_MSG)); } - } - } else if (arena.getStatus() == GameState.playing) { - // Spectator logic - if (!arena.isAllowSpectate()){ - e.disallow(PlayerLoginEvent.Result.KICK_OTHER, playerLang.m(Messages.COMMAND_JOIN_SPECTATOR_DENIED_MSG)); - } + break; + default: + throw new IllegalStateException("Unhandled game status!"); } } @@ -123,7 +131,7 @@ public void onPlayerJoin(PlayerJoinEvent e) { Bukkit.dispatchCommand(p, "bw"); World mainWorld = Bukkit.getWorlds().get(0); if (mainWorld != null) { - PaperSupport.teleportC(p, mainWorld.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + TeleportManager.teleportC(p, mainWorld.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); } // hide admin to in game users for (Player inGame : Bukkit.getOnlinePlayers()){ @@ -160,9 +168,10 @@ public void onPlayerJoin(PlayerJoinEvent e) { // There's nothing to re-join, so he might want to join an arena IArena arena = Arena.getArenaByIdentifier(proxyUser.getArenaIdentifier()); + GameState status = arena != null ? arena.getStatus() : null; // Check if the arena is still available or request time-out etc. - if (arena == null || proxyUser.isTimedOut() || arena.getStatus() == GameState.restarting) { + if (arena == null || proxyUser.isTimedOut() || status == GameState.restarting) { p.kickPlayer(playerLang.m(Messages.ARENA_STATUS_RESTARTING_NAME)); proxyUser.destroy("Time out or game unavailable at PlayerLoginEvent"); return; @@ -173,58 +182,64 @@ public void onPlayerJoin(PlayerJoinEvent e) { JoinHandlerCommon.displayCustomerDetails(p); // Join as player - if (arena.getStatus() == GameState.starting || arena.getStatus() == GameState.waiting) { - Sounds.playSound("join-allowed", p); - - // If has no party - if (proxyUser.getPartyOwnerOrSpectateTarget() == null) { - // Add to arena - if (!arena.addPlayer(p, true)){ - p.kickPlayer(Language.getMsg(p, Messages.ARENA_JOIN_DENIED_NO_PROXY)); - } - } else { - // If is member or owner of a remote party - - Player partyOwner = Bukkit.getPlayer(proxyUser.getPartyOwnerOrSpectateTarget()); - // If party owner is connected - if (partyOwner != null && partyOwner.isOnline()) { - // If joiner is the party owner create the party - if (partyOwner.equals(p)) { - BedWars.getParty().createParty(p); - - // Handle to-be-teamed-up players. A list used if some party members join before the party owner. - PreLoadedParty preLoadedParty = PreLoadedParty.getPartyByOwner(partyOwner.getName()); - if (preLoadedParty != null) { - preLoadedParty.teamUp(); + switch (status) { + case starting: + case waiting: + Sounds.playSound("join-allowed", p); + + // If has no party + if (proxyUser.getPartyOwnerOrSpectateTarget() == null) { + // Add to arena + if (!arena.addPlayer(p, true)) { + p.kickPlayer(Language.getMsg(p, Messages.ARENA_JOIN_DENIED_NO_PROXY)); + } + } else { + // If is member or owner of a remote party + + Player partyOwner = Bukkit.getPlayer(proxyUser.getPartyOwnerOrSpectateTarget()); + // If party owner is connected + if (partyOwner != null && partyOwner.isOnline()) { + // If joiner is the party owner create the party + if (partyOwner.equals(p)) { + BedWars.getParty().createParty(p); + + // Handle to-be-teamed-up players. A list used if some party members join before the party owner. + PreLoadedParty preLoadedParty = PreLoadedParty.getPartyByOwner(partyOwner.getName()); + if (preLoadedParty != null) { + preLoadedParty.teamUp(); + } + } else { + // Add to a existing party + BedWars.getParty().addMember(partyOwner, p); } } else { - // Add to a existing party - BedWars.getParty().addMember(partyOwner, p); + // If a party member joined before the party owner create a waiting list + // to-be-teamed-up players, when the owner will join + PreLoadedParty preLoadedParty = PreLoadedParty.getPartyByOwner(proxyUser.getPartyOwnerOrSpectateTarget()); + if (preLoadedParty == null) { + preLoadedParty = new PreLoadedParty(proxyUser.getPartyOwnerOrSpectateTarget()); + } + preLoadedParty.addMember(p); } - } else { - // If a party member joined before the party owner create a waiting list - // to-be-teamed-up players, when the owner will join - PreLoadedParty preLoadedParty = PreLoadedParty.getPartyByOwner(proxyUser.getPartyOwnerOrSpectateTarget()); - if (preLoadedParty == null) { - preLoadedParty = new PreLoadedParty(proxyUser.getPartyOwnerOrSpectateTarget()); + if (!arena.addPlayer(p, true)) { + p.kickPlayer(Language.getMsg(p, Messages.ARENA_JOIN_DENIED_NO_PROXY)); } - preLoadedParty.addMember(p); - } - if (!arena.addPlayer(p, true)){ - p.kickPlayer(Language.getMsg(p, Messages.ARENA_JOIN_DENIED_NO_PROXY)); } - } - } else { - // Join as spectator - Sounds.playSound("spectate-allowed", p); - Location spectatorTarget = null; - if (proxyUser.getPartyOwnerOrSpectateTarget() != null) { - Player targetPlayer = Bukkit.getPlayer(proxyUser.getPartyOwnerOrSpectateTarget()); - if (targetPlayer != null) { - spectatorTarget = targetPlayer.getLocation(); + break; + case playing: + // Join as spectator + Sounds.playSound("spectate-allowed", p); + Location spectatorTarget = null; + if (proxyUser.getPartyOwnerOrSpectateTarget() != null) { + Player targetPlayer = Bukkit.getPlayer(proxyUser.getPartyOwnerOrSpectateTarget()); + if (targetPlayer != null) { + spectatorTarget = targetPlayer.getLocation(); + } } - } - arena.addSpectator(p, false, spectatorTarget); + arena.addSpectator(p, false, spectatorTarget); + break; + default: + throw new IllegalStateException("Unhandled game status!"); } proxyUser.destroy("Joined as player or spectator. PreLoaded user no longer needed."); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerMultiArena.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerMultiArena.java index 0d2b5832e..98b568145 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerMultiArena.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/joinhandler/JoinListenerMultiArena.java @@ -24,7 +24,7 @@ import com.andrei1058.bedwars.arena.Arena; import com.andrei1058.bedwars.arena.ReJoin; import com.andrei1058.bedwars.sidebar.SidebarService; -import com.andrei1058.bedwars.support.paper.PaperSupport; +import com.andrei1058.bedwars.support.paper.TeleportManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -82,7 +82,7 @@ public void onJoin(PlayerJoinEvent e) { // Teleport to lobby location Location lobbyLocation = config.getConfigLoc("lobbyLoc"); if (lobbyLocation != null && lobbyLocation.getWorld() != null) { - PaperSupport.teleport(p, lobbyLocation); + TeleportManager.teleport(p, lobbyLocation); } // Send items diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/maprestore/internal/InternalAdapter.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/maprestore/internal/InternalAdapter.java index 7fb324c2b..20fab597e 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/maprestore/internal/InternalAdapter.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/maprestore/internal/InternalAdapter.java @@ -322,6 +322,11 @@ public void convertWorlds() { }); } + @Override + public String getDisplayName() { + return "Internal Restore Adapter"; + } + private void deleteWorldTrash(String world) { for (File f : new File[]{new File(Bukkit.getWorldContainer(), world + "/level.dat"), new File(Bukkit.getWorldContainer(), world + "/level.dat_mcr"), diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/ShopManager.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/ShopManager.java index 06a85e418..3df402c44 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/ShopManager.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/ShopManager.java @@ -352,7 +352,7 @@ private void saveDefaults() { adCategoryContentTier(ConfigPath.SHOP_PATH_CATEGORY_UTILITY, "tower", 31, "tier1", BedWars.getForCurrentVersion("CHEST", "CHEST", "CHEST"), 0, 1, false, 24, "iron", false, false); - addBuyItem(ConfigPath.SHOP_PATH_CATEGORY_UTILITY, "tower", "tier1", "tower", BedWars.getForCurrentVersion("TOWER", "TOWER", "TOWER"), + addBuyItem(ConfigPath.SHOP_PATH_CATEGORY_UTILITY, "tower", "tier1", "tower", BedWars.getForCurrentVersion("CHEST", "CHEST", "CHEST"), 0, 1, "", "", "", false); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/listeners/SpecialsListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/listeners/SpecialsListener.java index 6e806985a..09c28a0b8 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/listeners/SpecialsListener.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/shop/listeners/SpecialsListener.java @@ -29,7 +29,9 @@ import com.andrei1058.bedwars.arena.Arena; import com.andrei1058.bedwars.arena.Misc; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -52,6 +54,10 @@ public void onSpecialInteract(PlayerInteractEvent e) { if (a == null) return; if (a.getRespawnSessions().containsKey(e.getPlayer())) return; if (!a.isPlayer(p)) return; + Block b = e.getClickedBlock(); + if (b == null) return; + Location l = b.getLocation(); + if (BedWars.shop.getYml().getBoolean(ConfigPath.SHOP_SPECIAL_SILVERFISH_ENABLE)) { if (!Misc.isProjectile(Material.valueOf(BedWars.shop.getYml().getString(ConfigPath.SHOP_SPECIAL_SILVERFISH_MATERIAL)))) { if (i.getType() == Material.valueOf(BedWars.shop.getYml().getString(ConfigPath.SHOP_SPECIAL_SILVERFISH_MATERIAL)) @@ -59,7 +65,7 @@ public void onSpecialInteract(PlayerInteractEvent e) { e.setCancelled(true); ITeam playerTeam = a.getTeam(p); PlayerBedBugSpawnEvent event = new PlayerBedBugSpawnEvent(p, playerTeam, a); - nms.spawnSilverfish(p.getLocation().add(0, 1, 0), playerTeam, BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_SILVERFISH_SPEED), + nms.spawnSilverfish(l.add(0, 1, 0), playerTeam, BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_SILVERFISH_SPEED), BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_SILVERFISH_HEALTH), BedWars.shop.getInt(ConfigPath.SHOP_SPECIAL_SILVERFISH_DESPAWN), BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_SILVERFISH_DAMAGE)); Bukkit.getPluginManager().callEvent(event); @@ -77,7 +83,7 @@ public void onSpecialInteract(PlayerInteractEvent e) { e.setCancelled(true); ITeam playerTeam = a.getTeam(p); PlayerDreamDefenderSpawnEvent event = new PlayerDreamDefenderSpawnEvent(p, playerTeam, a); - nms.spawnIronGolem(p.getLocation().add(0, 1, 0), playerTeam, BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_IRON_GOLEM_SPEED), + nms.spawnIronGolem(l.add(0, 1, 0), playerTeam, BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_IRON_GOLEM_SPEED), BedWars.shop.getYml().getDouble(ConfigPath.SHOP_SPECIAL_IRON_GOLEM_HEALTH), BedWars.shop.getInt(ConfigPath.SHOP_SPECIAL_IRON_GOLEM_DESPAWN)); Bukkit.getPluginManager().callEvent(event); if (!nms.isProjectile(i)) { diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwSidebar.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwSidebar.java index dce146f14..a8deb3fd9 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwSidebar.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwSidebar.java @@ -3,6 +3,7 @@ import com.andrei1058.bedwars.BedWars; import com.andrei1058.bedwars.api.arena.GameState; import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.stats.DefaultStatistics; import com.andrei1058.bedwars.api.arena.team.ITeam; import com.andrei1058.bedwars.api.configuration.ConfigPath; import com.andrei1058.bedwars.api.language.Language; @@ -10,24 +11,23 @@ import com.andrei1058.bedwars.api.server.ServerType; import com.andrei1058.bedwars.api.sidebar.ISidebar; import com.andrei1058.bedwars.arena.Arena; +import com.andrei1058.bedwars.arena.stats.StatisticsOrdered; import com.andrei1058.bedwars.levels.internal.PlayerLevel; import com.andrei1058.bedwars.stats.PlayerStats; import com.andrei1058.spigot.sidebar.*; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.World; import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.ConcurrentLinkedQueue; import static com.andrei1058.bedwars.BedWars.*; -import static com.andrei1058.bedwars.api.language.Language.getMsg; +import static com.andrei1058.bedwars.api.language.Language.*; public class BwSidebar implements ISidebar { @@ -38,31 +38,40 @@ public class BwSidebar implements ISidebar { } }; - private static final String SPECTATOR_TAB = "spectators010101"; - private static final String TEAM_PREFIX = "?_"; - private final Player player; private IArena arena; private Sidebar handle; + private TabHeaderFooter headerFooter; private final SimpleDateFormat dateFormat; private final SimpleDateFormat nextEventDateFormat; - private final HashMap tabList = new HashMap<>(); - private final List persistentProviders = new ArrayList<>(); + private final ConcurrentLinkedQueue persistentProviders = new ConcurrentLinkedQueue<>(); + + private final BwTabList tabList; + public @Nullable StatisticsOrdered topStatistics; protected BwSidebar(Player player) { this.player = player; nextEventDateFormat = new SimpleDateFormat(getMsg(player, Messages.FORMATTING_SCOREBOARD_NEXEVENT_TIMER)); nextEventDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); dateFormat = new SimpleDateFormat(getMsg(player, Messages.FORMATTING_SCOREBOARD_DATE)); + this.tabList = new BwTabList(this); + + // Persistent placeholders + String poweredBy = BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_POWERED_BY); + this.registerPersistentPlaceholder(new PlaceholderProvider("{poweredBy}", () -> poweredBy)); + String serverId = config.getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_SERVER_ID); + this.registerPersistentPlaceholder(new PlaceholderProvider("{server}", () -> serverId)); + String serverIp = BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP); + this.registerPersistentPlaceholder(new PlaceholderProvider("{serverIp}", () -> serverIp)); } public void remove() { if (handle == null) { return; } - tabList.forEach((k, v) -> handle.removeTab(k)); + tabList.onSidebarRemoval(); handle.remove(player); } @@ -71,7 +80,12 @@ public void setContent(List titleArray, List lineArray, @Nullabl SidebarLine title = this.normalizeTitle(titleArray); List lines = this.normalizeLines(lineArray); - List placeholders = this.getPlaceholders(); + if (null == arena) { + // clean up + setTopStatistics(null); + } + + ConcurrentLinkedQueue placeholders = this.getPlaceholders(this.getPlayer()); placeholders.addAll(this.persistentProviders); // if it is the first time setting content we create the handle @@ -79,9 +93,7 @@ public void setContent(List titleArray, List lineArray, @Nullabl handle = SidebarService.getInstance().getSidebarHandler().createSidebar(title, lines, placeholders); handle.add(player); } else { - while (handle.lineCount() > 0) { - handle.removeLine(0); - } + handle.clearLines(); Bukkit.getScheduler().runTaskLater(plugin, () -> { new ArrayList<>(handle.getPlaceholders()).forEach(p -> handle.removePlaceholder(p.getPlaceholder())); placeholders.forEach(p -> handle.addPlaceholder(p)); @@ -89,8 +101,8 @@ public void setContent(List titleArray, List lineArray, @Nullabl lines.forEach(l -> handle.addLine(l)); }, 2L); } - handlePlayerList(); - setHeaderFooter(); + tabList.handlePlayerList(); + assignTabHeaderFooter(); } public Player getPlayer() { @@ -99,38 +111,46 @@ public Player getPlayer() { @SuppressWarnings("ConstantConditions") public SidebarLine normalizeTitle(@Nullable List titleArray) { - String[] aolo = new String[titleArray.size()]; + String[] data = new String[titleArray.size()]; for (int x = 0; x < titleArray.size(); x++) { - aolo[x] = titleArray.get(x); + data[x] = titleArray.get(x); } return null == titleArray || titleArray.isEmpty() ? EMPTY_TITLE : - new SidebarLineAnimated(aolo); + new SidebarLineAnimated(data); } + /** + * Normalize lines where subject player is sidebar holder. + */ @Contract(pure = true) - public @NotNull List normalizeLines(@NotNull List lineArray) { - List lines = new ArrayList<>(); + public @NotNull LinkedList normalizeLines(@NotNull List lineArray) { + LinkedList lines = new LinkedList<>(); int teamCount = 0; Language language = Language.getPlayerLanguage(player); String genericTeamFormat = language.m(Messages.FORMATTING_SCOREBOARD_TEAM_GENERIC); + StatisticsOrdered.StringParser statParser = null == topStatistics ? null : topStatistics.newParser(); + for (String line : lineArray) { // convert old placeholders line = line.replace("{server_ip}", "{serverIp}"); // generic team placeholder {team} - if (arena != null) { + if (null != arena) { if (line.trim().equals("{team}")) { if (arena.getTeams().size() > teamCount) { ITeam team = arena.getTeams().get(teamCount++); String teamName = team.getDisplayName(language); + String teamLetter = String.valueOf(!teamName.isEmpty() ? teamName.charAt(0) : ""); + line = genericTeamFormat - .replace("{TeamLetter}", String.valueOf(teamName.length() != 0 ? teamName.charAt(0) : "")) + .replace("{TeamLetter}", teamLetter) .replace("{TeamColor}", team.getColor().chat().toString()) .replace("{TeamName}", teamName) .replace("{TeamStatus}", "{Team" + team.getName() + "Status}"); + } else { // skip line continue; @@ -144,48 +164,106 @@ public SidebarLine normalizeTitle(@Nullable List titleArray) { for (ITeam currentTeam : arena.getTeams()) { final ChatColor color = currentTeam.getColor().chat(); + final String teamName = currentTeam.getDisplayName(language); + final String teamLetter = String.valueOf(!teamName.isEmpty() ? teamName.charAt(0) : ""); + // Static team placeholders line = line .replace("{Team" + currentTeam.getName() + "Color}", color.toString()) - .replace("{Team" + currentTeam.getName() + "Name}", currentTeam.getDisplayName(language)); + .replace("{Team" + currentTeam.getName() + "Name}", teamName) + .replace("{Team" + currentTeam.getName() + "Letter}", teamLetter); + + boolean isMember = currentTeam.isMember(getPlayer()) || currentTeam.wasMember(getPlayer().getUniqueId()); + if (isMember) { + HashMap replacements = tabList.getTeamReplacements(currentTeam); + for (Map.Entry entry : replacements.entrySet()) { + line = line.replace(entry.getKey(), entry.getValue()); + } + } + } + if (arena.getWinner() != null) { + String winnerDisplayName = arena.getWinner().getDisplayName(Language.getPlayerLanguage(getPlayer())); + line = line + .replace( + "{winnerTeamName}", + winnerDisplayName + ).replace( + "{winnerTeamLetter}", + arena.getWinner().getColor().chat() + (winnerDisplayName.substring(0, 1)) + ).replace( + "{winnerTeamColor}", + arena.getWinner().getColor().chat().toString() + ); + } + + if (null != this.topStatistics && null != statParser) { + line = statParser.parseString(line, language, language.m(Messages.MEANING_NOBODY)); + if (null == line) { + continue; + } } } // General static placeholders line = line .replace("{serverIp}", BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP)) + .replace("{poweredBy}", BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_POWERED_BY)) .replace("{version}", plugin.getDescription().getVersion()) .replace("{server}", config.getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_SERVER_ID)) - .replace("{playername}", player.getName()) - .replace("{player}", player.getDisplayName()) - .replace("{money}", String.valueOf(getEconomy().getMoney(player))); + ; // Add the line to the sidebar String finalTemp = line; - lines.add(new SidebarLine() { - @Override - public @NotNull String getLine() { - return finalTemp; - } - }); + String[] divided = finalTemp.split(","); + + SidebarLine sidebarLine; + + if (divided.length > 1) { + sidebarLine = normalizeTitle(Arrays.asList(divided)); + } else { + sidebarLine = new SidebarLine() { + @Override + public @NotNull String getLine() { + return finalTemp; + } + }; + } + + lines.add(sidebarLine); } return lines; } - @Contract(pure = true) - private @NotNull List getPlaceholders() { - List providers = new ArrayList<>(); + @Override + public void giveUpdateTabFormat(@NotNull Player player, boolean skipStateCheck, @Nullable Boolean spectator) { + tabList.giveUpdateTabFormat(player, skipStateCheck, spectator); + } + @SuppressWarnings("removal") + @Override + public boolean isTabFormattingDisabled() { + return tabList.isTabFormattingDisabled(); + } + + /** + * Get placeholders for given player. + * + * @param player subject. + * @return placeholders. + */ + @Contract(pure = true) + @NotNull ConcurrentLinkedQueue getPlaceholders(@NotNull Player player) { + ConcurrentLinkedQueue providers = new ConcurrentLinkedQueue<>(); providers.add(new PlaceholderProvider("{player}", player::getDisplayName)); - providers.add(new PlaceholderProvider("{playerName}", player::getCustomName)); providers.add(new PlaceholderProvider("{money}", () -> String.valueOf(getEconomy().getMoney(player)))); + providers.add(new PlaceholderProvider("{playerName}", player::getCustomName)); providers.add(new PlaceholderProvider("{date}", () -> dateFormat.format(new Date(System.currentTimeMillis())))); - providers.add(new PlaceholderProvider("{serverIp}", () -> BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP))); + // fixme 29/08/2023: disabled for now because this is not a dynamic placeholder. Let's see what's the impact. +// providers.add(new PlaceholderProvider("{serverIp}", () -> BedWars.config.getString(ConfigPath.GENERAL_CONFIG_PLACEHOLDERS_REPLACEMENTS_SERVER_IP))); providers.add(new PlaceholderProvider("{version}", () -> plugin.getDescription().getVersion())); - providers.add(new PlaceholderProvider("{server}", () -> config.getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_SERVER_ID))); - PlayerLevel level = PlayerLevel.getLevelByPlayer(getPlayer().getUniqueId()); + PlayerLevel level = PlayerLevel.getLevelByPlayer(player.getUniqueId()); if (null != level) { providers.add(new PlaceholderProvider("{progress}", level::getProgress)); providers.add(new PlaceholderProvider("{level}", () -> String.valueOf(level.getLevelName()))); @@ -194,47 +272,70 @@ public SidebarLine normalizeTitle(@Nullable List titleArray) { providers.add(new PlaceholderProvider("{requiredXp}", level::getFormattedRequiredXp)); } - if (noArena()) { + if (hasNoArena()) { providers.add(new PlaceholderProvider("{on}", () -> String.valueOf(Bukkit.getOnlinePlayers().size())) ); - PlayerStats stats = BedWars.getStatsManager().get(getPlayer().getUniqueId()); + PlayerStats persistentStats = BedWars.getStatsManager().get(player.getUniqueId()); //noinspection ConstantConditions - if (null != stats) { + if (null != persistentStats) { providers.add(new PlaceholderProvider("{kills}", () -> - String.valueOf(stats.getKills())) + String.valueOf(persistentStats.getKills())) ); providers.add(new PlaceholderProvider("{finalKills}", () -> - String.valueOf(stats.getFinalKills())) + String.valueOf(persistentStats.getFinalKills())) ); providers.add(new PlaceholderProvider("{beds}", () -> - String.valueOf(stats.getBedsDestroyed())) + String.valueOf(persistentStats.getBedsDestroyed())) ); providers.add(new PlaceholderProvider("{deaths}", () -> - String.valueOf(stats.getDeaths())) + String.valueOf(persistentStats.getDeaths())) ); providers.add(new PlaceholderProvider("{finalDeaths}", () -> - String.valueOf(stats.getFinalDeaths())) + String.valueOf(persistentStats.getFinalDeaths())) ); providers.add(new PlaceholderProvider("{wins}", () -> - String.valueOf(stats.getWins())) + String.valueOf(persistentStats.getWins())) ); providers.add(new PlaceholderProvider("{losses}", () -> - String.valueOf(stats.getLosses())) + String.valueOf(persistentStats.getLosses())) ); providers.add(new PlaceholderProvider("{gamesPlayed}", () -> - String.valueOf(stats.getGamesPlayed())) + String.valueOf(persistentStats.getGamesPlayed())) ); } } else { providers.add(new PlaceholderProvider("{on}", () -> String.valueOf(arena.getPlayers().size()))); providers.add(new PlaceholderProvider("{max}", () -> String.valueOf(arena.getMaxPlayers()))); providers.add(new PlaceholderProvider("{nextEvent}", this::getNextEventName)); + + if (arena.isSpectator(player)) { + Language lang = getPlayerLanguage(player); + String targetFormat = lang.m(Messages.FORMAT_SPECTATOR_TARGET); + + providers.add(new PlaceholderProvider("{spectatorTarget}", () -> { + if (null == player.getSpectatorTarget() || !(player.getSpectatorTarget() instanceof Player)) { + return ""; + } + Player target = (Player) player.getSpectatorTarget(); + ITeam targetTeam = arena.getTeam(target); + + if (null == targetTeam) { + return ""; + } + return targetFormat.replace("{targetTeamColor}", targetTeam.getColor().chat().toString()) + .replace("{targetDisplayName}", target.getDisplayName()) + .replace("{targetName}", target.getDisplayName()) + .replace("{targetTeamName}", targetTeam.getDisplayName(lang)); + })); + } + providers.add(new PlaceholderProvider("{time}", () -> { - if (this.arena.getStatus() == GameState.playing || this.arena.getStatus() == GameState.restarting) { + GameState status = this.arena.getStatus(); + if (status == GameState.playing || status == GameState.restarting) { return getNextEventTime(); } else { - if (this.arena.getStatus() == GameState.starting) { + if (status == GameState.starting) { if (arena.getStartingTask() != null) { return String.valueOf(arena.getStartingTask().getCountdown() + 1); } @@ -242,21 +343,36 @@ public SidebarLine normalizeTitle(@Nullable List titleArray) { return dateFormat.format(new Date(System.currentTimeMillis())); } })); - providers.add(new PlaceholderProvider("{kills}", () -> - String.valueOf(arena.getPlayerKills(player, false)) - )); - providers.add(new PlaceholderProvider("{finalKills}", () -> - String.valueOf(arena.getPlayerKills(player, true)) - )); - providers.add(new PlaceholderProvider("{beds}", () -> - String.valueOf(arena.getPlayerBedsDestroyed(player)) - )); - providers.add(new PlaceholderProvider("{deaths}", () -> - String.valueOf(arena.getPlayerDeaths(player, false)) - )); + + if (null != arena.getStatsHolder()) { + + arena.getStatsHolder().get(player).ifPresent(holder -> { + holder.getStatistic(DefaultStatistics.KILLS).ifPresent(st -> + providers.add(new PlaceholderProvider("{kills}", () -> + String.valueOf(st.getDisplayValue(null)) + ))); + + holder.getStatistic(DefaultStatistics.KILLS_FINAL).ifPresent(st -> + providers.add(new PlaceholderProvider("{finalKills}", () -> + String.valueOf(st.getDisplayValue(null)) + ))); + + holder.getStatistic(DefaultStatistics.BEDS_DESTROYED).ifPresent(st -> + providers.add(new PlaceholderProvider("{beds}", () -> + String.valueOf(st.getDisplayValue(null)) + ))); + + holder.getStatistic(DefaultStatistics.DEATHS).ifPresent(st -> + providers.add(new PlaceholderProvider("{deaths}", () -> + String.valueOf(st.getDisplayValue(null)) + ))); + }); + } // Dynamic team placeholders for (ITeam currentTeam : arena.getTeams()) { + boolean isMember = currentTeam.isMember(player) || currentTeam.wasMember(player.getUniqueId()); + providers.add(new PlaceholderProvider("{Team" + currentTeam.getName() + "Status}", () -> { String result; if (currentTeam.isBedDestroyed()) { @@ -269,11 +385,24 @@ public SidebarLine normalizeTitle(@Nullable List titleArray) { } else { result = getMsg(getPlayer(), Messages.FORMATTING_SCOREBOARD_TEAM_ALIVE); } - if (currentTeam.isMember(getPlayer())) { + if (isMember) { result += getMsg(getPlayer(), Messages.FORMATTING_SCOREBOARD_YOUR_TEAM); } return result; })); + + if (isMember) { + providers.add(new PlaceholderProvider("{teamStatus}", () -> { + if (currentTeam.isBedDestroyed()) { + if (currentTeam.getSize() > 0) { + return getMsg(getPlayer(), Messages.FORMATTING_SCOREBOARD_BED_DESTROYED) + .replace("{remainingPlayers}", String.valueOf(currentTeam.getSize())); + } + return getMsg(getPlayer(), Messages.FORMATTING_SCOREBOARD_TEAM_ELIMINATED); + } + return getMsg(getPlayer(), Messages.FORMATTING_SCOREBOARD_TEAM_ALIVE); + })); + } } } @@ -339,321 +468,101 @@ private String getNextEventTime() { return time == 0 ? "0" : nextEventDateFormat.format(new Date(time)); } - private boolean noArena() { + private boolean hasNoArena() { return null == arena; } - private void handlePlayerList() { - if (null != handle) { - tabList.forEach((k, v) -> handle.removeTab(k)); - } - - handleHealthIcon(); - - if (this.isTabFormattingDisabled()) { - return; - } - - if (noArena()) { - // if tab formatting is enabled in lobby world - if (config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_LOBBY) && - !config.getLobbyWorldName().trim().isEmpty()) { - - World lobby = Bukkit.getWorld(config.getLobbyWorldName()); - if (null == lobby) { - return; - } - lobby.getPlayers().forEach(inLobby -> giveUpdateTabFormat(inLobby, true)); - } - return; - } - - handleHealthIcon(); - - arena.getPlayers().forEach(playing -> giveUpdateTabFormat(playing, true)); - arena.getSpectators().forEach(spectating -> giveUpdateTabFormat(spectating, true)); - } - - /** - * Handle given player in sidebar owner tab list. - * Will remove existing tab and give a new one based on game conditions list like spectator, team red, etc. - * Will handle invisibility potion as well. - */ - public void giveUpdateTabFormat(@NotNull Player player, boolean skipStateCheck) { - // if sidebar was not created - if (handle == null) { + // Provide header and footer for current game state + private void assignTabHeaderFooter() { + if (!config.getBoolean(ConfigPath.SB_CONFIG_TAB_HEADER_FOOTER_ENABLE)) { return; } - // unique tab list name - String tabListName = player.getName(); + Language lang = Language.getPlayerLanguage(player); - if (tabList.containsKey(tabListName)) { - handle.removeTab(tabListName); - tabList.remove(tabListName); - // SidebarManager.getInstance().sendHeaderFooter(player, "", ""); - } + String headerPath; + String footerPath; - if (!skipStateCheck) { - if (this.isTabFormattingDisabled()) { + if (hasNoArena()) { + if (getServerType() == ServerType.SHARED) { + this.headerFooter = null; return; } - } - - SidebarLine prefix; - SidebarLine suffix; - - if (noArena()) { - prefix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_LOBBY, player, null); - suffix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_LOBBY, player, null); - - PlayerTab tab = handle.playerTabCreate( - tabListName, player, prefix, suffix, PlayerTab.PushingRule.NEVER - ); - tab.add(player); - tabList.put(tabListName, tab); - return; - } - - // in-game tab has a special treatment - if (arena.isSpectator(player)) { - PlayerTab tab = tabList.get(SPECTATOR_TAB); - if (null == tab) { - prefix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_SPECTATOR, player, null); - suffix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_SPECTATOR, player, null); - tab = handle.playerTabCreate(SPECTATOR_TAB, null, prefix, suffix, PlayerTab.PushingRule.NEVER); - tabList.put(SPECTATOR_TAB, tab); - } - tab.add(player); - - return; - } - - if (arena.getStatus() != GameState.playing) { - if (arena.getStatus() == GameState.waiting) { - prefix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_WAITING, player, null); - suffix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_WAITING, player, null); - } else if (arena.getStatus() == GameState.starting) { - prefix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_STARTING, player, null); - suffix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_STARTING, player, null); - } else if (arena.getStatus() == GameState.restarting) { - - ITeam team = arena.getTeam(player); - if (null == team) { - team = arena.getExTeam(player.getUniqueId()); + headerPath = Messages.FORMATTING_SB_TAB_LOBBY_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_LOBBY_FOOTER; + } else { + if (arena.isSpectator(player)) { + + ITeam exTeam = arena.getExTeam(player.getUniqueId()); + if (null == exTeam) { + switch (arena.getStatus()) { + case waiting: + headerPath = Messages.FORMATTING_SB_TAB_WAITING_HEADER_SPEC; + footerPath = Messages.FORMATTING_SB_TAB_WAITING_FOOTER_SPEC; + break; + case starting: + headerPath = Messages.FORMATTING_SB_TAB_STARTING_HEADER_SPEC; + footerPath = Messages.FORMATTING_SB_TAB_STARTING_FOOTER_SPEC; + break; + case playing: + headerPath = Messages.FORMATTING_SB_TAB_PLAYING_SPEC_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_PLAYING_SPEC_FOOTER; + break; + case restarting: + headerPath = Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_FOOTER; + break; + default: + throw new IllegalStateException("Unhandled arena status"); + } + } else { + // eliminated player + if (arena.getStatus() == GameState.restarting) { + if (null != arena.getWinner() && arena.getWinner().equals(exTeam)) { + headerPath = Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_FOOTER; + } else { + headerPath = Messages.FORMATTING_SB_TAB_RESTARTING_ELM_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_RESTARTING_ELM_FOOTER; + } + } else { + headerPath = Messages.FORMATTING_SB_TAB_PLAYING_ELM_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_PLAYING_ELM_FOOTER; + } } - String displayName = null == team ? "" : team.getDisplayName(Language.getPlayerLanguage(this.player)); - - HashMap replacements = new HashMap<>(); - replacements.put("{team}", null == team ? "" : team.getColor().chat() + displayName); - replacements.put("{teamLetter}", null == team ? "" : team.getColor().chat() + (displayName.substring(0, 1))); - replacements.put("{teamColor}", null == team ? "" : team.getColor().chat().toString()); - - - prefix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_RESTARTING, player, replacements); - suffix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_RESTARTING, player, replacements); } else { - throw new RuntimeException("Unhandled game status!"); - } - PlayerTab t = handle.playerTabCreate(tabListName, player, prefix, suffix, PlayerTab.PushingRule.NEVER); - t.add(player); - tabList.put(tabListName, t); - return; - } - - ITeam team = arena.getTeam(player); - if (null == team) { - team = arena.getExTeam(player.getUniqueId()); - } - if (null == team) { - throw new RuntimeException("Wtf dude"); - } - - String tabName = this.getTabName(team); - String tabNameInvisible = tabName = tabName.substring(0, tabName.length() >= 16 ? 15 : tabName.length()); - tabNameInvisible += "^!"; - - if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { - if (!team.isMember(getPlayer())) { - // remove player from its tab group (if team tab group) - PlayerTab teamTab = tabList.getOrDefault(tabName, null); - if (null != teamTab) { - teamTab.remove(player); - - // create or get tab group for the invisible players in that team - // set tab group name visibility to false - // identifier for invisibility - tabName = tabNameInvisible; + switch (arena.getStatus()) { + case waiting: + headerPath = Messages.FORMATTING_SB_TAB_WAITING_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_WAITING_FOOTER; + break; + case starting: + headerPath = Messages.FORMATTING_SB_TAB_STARTING_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_STARTING_FOOTER; + break; + case playing: + headerPath = Messages.FORMATTING_SB_TAB_PLAYING_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_PLAYING_FOOTER; + break; + case restarting: + headerPath = Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_HEADER; + footerPath = Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_FOOTER; + break; + default: + throw new IllegalStateException("Unhandled arena status"); } } - } else { - PlayerTab invTab = tabList.getOrDefault(tabNameInvisible, null); - if (null != invTab) { - invTab.remove(player); - } - } - - PlayerTab teamTab = tabList.get(tabName); - if (null == teamTab) { - String displayName = team.getDisplayName(Language.getPlayerLanguage(this.player)); - HashMap replacements = new HashMap<>(); - replacements.put("{team}", team.getColor().chat() + displayName); - replacements.put("{teamLetter}", team.getColor().chat() + (displayName.substring(0, 1))); - replacements.put("{teamColor}", team.getColor().chat().toString()); - - prefix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_PREFIX_PLAYING, player, replacements); - suffix = getTabText(Messages.FORMATTING_SCOREBOARD_TAB_SUFFIX_PLAYING, player, replacements); - - teamTab = handle.playerTabCreate(tabName, null, prefix, suffix, PlayerTab.PushingRule.PUSH_OTHER_TEAMS); - tabList.put(tabName, teamTab); - if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { - teamTab.setNameTagVisibility(PlayerTab.NameTagVisibility.NEVER); - } } - teamTab.add(player); - } - - // Provide header and footer for current game state - private void setHeaderFooter() { -// if (isTabFormattingDisabled()) { -// return; -// } - Language lang = Language.getPlayerLanguage(player); - - if (noArena()) { - SidebarManager.getInstance().sendHeaderFooter( - player, lang.m(Messages.FORMATTING_SIDEBAR_TAB_HEADER_LOBBY), - lang.m(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_LOBBY) - ); - return; - } - if (arena.isSpectator(player)) { - SidebarManager.getInstance().sendHeaderFooter( - player, lang.m(Messages.FORMATTING_SIDEBAR_TAB_HEADER_SPECTATOR), - lang.m(Messages.FORMATTING_SIDEBAR_TAB_FOOTER_SPECTATOR) - ); - return; - } - - - String headerPath = null; - String footerPath = null; - - switch (arena.getStatus()) { - case waiting: - headerPath = Messages.FORMATTING_SIDEBAR_TAB_HEADER_WAITING; - footerPath = Messages.FORMATTING_SIDEBAR_TAB_FOOTER_WAITING; - break; - case starting: - headerPath = Messages.FORMATTING_SIDEBAR_TAB_HEADER_STARTING; - footerPath = Messages.FORMATTING_SIDEBAR_TAB_FOOTER_STARTING; - break; - case playing: - headerPath = Messages.FORMATTING_SIDEBAR_TAB_HEADER_PLAYING; - footerPath = Messages.FORMATTING_SIDEBAR_TAB_FOOTER_PLAYING; - break; - case restarting: - headerPath = Messages.FORMATTING_SIDEBAR_TAB_HEADER_RESTARTING; - footerPath = Messages.FORMATTING_SIDEBAR_TAB_FOOTER_RESTARTING; - break; - } - - SidebarManager.getInstance().sendHeaderFooter( - player, lang.m(headerPath), - lang.m(footerPath) + this.headerFooter = new TabHeaderFooter( + this.normalizeLines(lang.l(headerPath)), + this.normalizeLines(lang.l(footerPath)), + getPlaceholders(this.getPlayer()) ); - } - private @NotNull String getTabName(@NotNull ITeam team) { - String tabName = TEAM_PREFIX + Base64.getEncoder().encodeToString((team.getName()).getBytes(StandardCharsets.UTF_8)); - if (tabName.length() > 16) { - tabName = tabName.substring(0, 16); - } - return tabName; - } - - @NotNull - private SidebarLine getTabText(String path, Player targetPlayer, @Nullable HashMap replacements) { - List strings = Language.getList(getPlayer(), path); - if (strings.isEmpty()) { - return new SidebarLine() { - @NotNull - @Override - public String getLine() { - return ""; - } - }; - } - - strings = new ArrayList<>(); - for (String string : Language.getList(getPlayer(), path)) { - String parsed = string.replace("{vPrefix}", BedWars.getChatSupport().getPrefix(targetPlayer)) - .replace("{vSuffix}", BedWars.getChatSupport().getSuffix(targetPlayer)); - - if (null != replacements) { - for (Map.Entry entry : replacements.entrySet()) { - parsed = parsed.replace(entry.getKey(), entry.getValue()); - } - } - - strings.add(parsed); - } - - if (strings.size() == 1) { - final String line = strings.get(0); - return new SidebarLine() { - @NotNull - @Override - public String getLine() { - return line; - } - }; - } - - final String[] lines = new String[strings.size()]; - for (int i = 0; i < lines.length; i++) { - lines[i] = strings.get(i); - } - return new SidebarLineAnimated(lines); - } - - /** - * @return true if tab formatting is disabled for current sidebar/ arena stage - */ - public boolean isTabFormattingDisabled() { - if (noArena()) { - - if (getServerType() == ServerType.SHARED) { - if (config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_LOBBY) && - !config.getLobbyWorldName().trim().isEmpty()) { - - World lobby = Bukkit.getWorld(config.getLobbyWorldName()); - return null != lobby; - } - } - - return !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_LOBBY); - } - // if tab formatting is disabled in game - if (arena.getStatus() == GameState.playing && config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_PLAYING)) { - return false; - } - - // if tab formatting is disabled in starting - if (arena.getStatus() == GameState.starting && config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_STARTING)) { - return false; - } - - // if tab formatting is disabled in waiting - if (arena.getStatus() == GameState.waiting && config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_WAITING)) { - return false; - } - - // if tab formatting is disabled in restarting - return arena.getStatus() != GameState.restarting || !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_RESTARTING); + SidebarManager.getInstance().sendHeaderFooter(player, headerFooter); } @Override @@ -662,53 +571,6 @@ public boolean registerPersistentPlaceholder(PlaceholderProvider placeholderProv return true; } - public void handleHealthIcon() { - if (null == handle) { - return; - } - - if (noArena()) { - handle.hidePlayersHealth(); - return; - } else if (arena.getStatus() != GameState.playing) { - handle.hidePlayersHealth(); - return; - } - - List animation = Language.getList(player, Messages.FORMATTING_SCOREBOARD_HEALTH); - if (animation.isEmpty()) return; - SidebarLine line; - if (animation.size() > 1) { - String[] lines = new String[animation.size()]; - for (int i = 0; i < animation.size(); i++) { - lines[i] = animation.get(i); - } - line = new SidebarLineAnimated(lines); - } else { - final String text = animation.get(0); - line = new SidebarLine() { - @NotNull - @Override - public String getLine() { - return text; - } - }; - } - - if (config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_IN_TAB)) { - handle.showPlayersHealth(line, true); - } - - Bukkit.getScheduler().runTaskLater(plugin, () -> { - if (arena != null && handle != null) { - arena.getPlayers().forEach(player -> handle.setPlayerHealth(player, (int) Math.ceil(player.getHealth()))); - if (arena.isSpectator(getPlayer())) { - arena.getSpectators().forEach(player -> handle.setPlayerHealth(player, (int) Math.ceil(player.getHealth()))); - } - } - }, 20L); - } - /** * Hide player name tag on head when he drinks an invisibility potion. * This is required because not all clients hide it automatically. @@ -729,4 +591,18 @@ public Sidebar getHandle() { public IArena getArena() { return arena; } + + @Nullable + public TabHeaderFooter getHeaderFooter() { + return headerFooter; + } + + @SuppressWarnings("unused") + public void setHeaderFooter(@Nullable TabHeaderFooter headerFooter) { + this.headerFooter = headerFooter; + } + + public void setTopStatistics(@Nullable StatisticsOrdered topStatistics) { + this.topStatistics = topStatistics; + } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwTabList.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwTabList.java new file mode 100644 index 000000000..08a5af309 --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/BwTabList.java @@ -0,0 +1,508 @@ +/* + * BedWars1058 - A bed wars mini-game. + * Copyright (C) 2023 Andrei Dascălu + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Contact e-mail: andrew.dascalu@gmail.com + */ + +package com.andrei1058.bedwars.sidebar; + +import com.andrei1058.bedwars.BedWars; +import com.andrei1058.bedwars.api.arena.GameState; +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.configuration.ConfigPath; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.ServerType; +import com.andrei1058.spigot.sidebar.PlayerTab; +import com.andrei1058.spigot.sidebar.Sidebar; +import com.andrei1058.spigot.sidebar.SidebarLine; +import com.andrei1058.spigot.sidebar.SidebarLineAnimated; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.*; + +import static com.andrei1058.bedwars.BedWars.*; + +public class BwTabList { + + private static final char SPECTATOR_PREFIX = 'z'; + private static final char ELIMINATED_FROM_TEAM_PREFIX = 'z'; + + // Player list container. Used to manipulate deployed player tab: lines ecc. + // Key is player uuid. + private final HashMap deployedPerPlayerTabList = new HashMap<>(); + // playing-restarting team order prefix for tab + // this is concatenated to player identifier to keep tab-list ordered + // and still let players have individual placeholders + private final HashMap teamOrderPrefix = new HashMap<>(); + private int teamOrderIndex = 0; + // unique string used for tab ordering. Does not track team here. + private final HashMap playerTabIdentifier = new HashMap<>(); + // used to prevent tab identifier duplication. Keeps an index of concurrent identifiers + // concatenated later to playerTabIdentifier + private final HashMap playerTabIdentifierDuplication = new HashMap<>(); + + private final BwSidebar sidebar; + + public BwTabList(BwSidebar sidebar) { + this.sidebar = sidebar; + } + + /** + * Triggered when sidebar context changes. + * Arena/ game state change. + */ + void handlePlayerList() { + + // clear existing formatted player tab-lists + if (null != sidebar.getHandle()) { + deployedPerPlayerTabList.clear(); + sidebar.getHandle().removeTabs(); + } + + handleHealthIcon(); + + if (this.isTabFormattingDisabled()) { + return; + } + + if (null == sidebar.getArena()) { + // if tab formatting is enabled in lobby world + if (config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_LOBBY) && + !config.getLobbyWorldName().trim().isEmpty()) { + + World lobby = Bukkit.getWorld(config.getLobbyWorldName()); + if (null == lobby) { + return; + } + lobby.getPlayers().forEach(inLobby -> giveUpdateTabFormat(inLobby, true, null)); + } + // sometimes due to timing issues player is not listed yet in lobby players + giveUpdateTabFormat(sidebar.getPlayer(), true, null); + return; + } + + handleHealthIcon(); + + sidebar.getArena().getPlayers().forEach(playing -> giveUpdateTabFormat(playing, true, null)); + sidebar.getArena().getSpectators().forEach(spectating -> giveUpdateTabFormat(spectating, true, null)); + } + + public void handleHealthIcon() { + if (null == sidebar.getHandle()) { + return; + } + + if (null == sidebar.getArena()) { + sidebar.getHandle().hidePlayersHealth(); + return; + } else if (sidebar.getArena().getStatus() != GameState.playing) { + sidebar.getHandle().hidePlayersHealth(); + return; + } + + List animation = Language.getList(sidebar.getPlayer(), Messages.FORMATTING_SCOREBOARD_HEALTH); + if (animation.isEmpty()) return; + SidebarLine line; + if (animation.size() > 1) { + String[] lines = new String[animation.size()]; + for (int i = 0; i < animation.size(); i++) { + lines[i] = animation.get(i); + } + line = new SidebarLineAnimated(lines); + } else { + final String text = animation.get(0); + line = new SidebarLine() { + @NotNull + @Override + public String getLine() { + return text; + } + }; + } + + if (config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_ENABLE)) { + sidebar.getHandle().showPlayersHealth(line, config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_HEALTH_IN_TAB)); + } + + Bukkit.getScheduler().runTaskLater(plugin, () -> { + if (null != sidebar.getArena() && null != sidebar.getHandle()) { + sidebar.getArena().getPlayers().forEach(player -> sidebar.getHandle().setPlayerHealth(player, (int) Math.ceil(player.getHealth()))); + if (sidebar.getArena().isSpectator(sidebar.getPlayer())) { + sidebar.getArena().getSpectators().forEach(player -> sidebar.getHandle().setPlayerHealth(player, (int) Math.ceil(player.getHealth()))); + } + } + }, 10L); + } + + /** + * @return true if tab formatting is disabled for current sidebar/ arena stage + */ + public boolean isTabFormattingDisabled() { + if (null == sidebar.getArena()) { + + if (getServerType() == ServerType.SHARED) { + if (config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_LOBBY) && + !config.getLobbyWorldName().trim().isEmpty()) { + + World lobby = Bukkit.getWorld(config.getLobbyWorldName()); + return null == lobby || !sidebar.getPlayer().getWorld().getName().equals(lobby.getName()); + } + } + + return !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_LOBBY); + } + GameState status = sidebar.getArena().getStatus(); + + // if tab formatting is disabled in game + if (status == GameState.playing) { + return !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_PLAYING); + } + + // if tab formatting is disabled in starting + if (status == GameState.starting) { + return !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_STARTING); + } + + // if tab formatting is disabled in waiting + if (status == GameState.waiting) { + return !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_WAITING); + } + + // if tab formatting is disabled in restarting + return status != GameState.restarting || !config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_RESTARTING); + } + + /** + * Handle given player in sidebar owner tab list. + * Will remove existing tab and give a new one based on game conditions list like spectator, team red, etc. + * Will handle invisibility potion as well. + */ + public void giveUpdateTabFormat(@NotNull Player player, boolean skipStateCheck, @Nullable Boolean spectator) { + // if sidebar was not created + if (sidebar.getHandle() == null) { + return; + } + + // unique tab list name + String playerTabId = getCreatePlayerTabIdentifier(player); + + // clear existing tab formatting for given player + PlayerTab playerTab = deployedPerPlayerTabList.getOrDefault(player.getUniqueId(), null); + if (null != playerTab) { + sidebar.getHandle().removeTab(playerTab.getIdentifier()); + deployedPerPlayerTabList.remove(player.getUniqueId()); + } + + if (!skipStateCheck) { + if (this.isTabFormattingDisabled()) { + return; + } + } + + SidebarLine prefix; + SidebarLine suffix; + IArena arena = sidebar.getArena(); + Sidebar handle = sidebar.getHandle(); + + if (null == arena) { + prefix = getTabText(Messages.FORMATTING_SB_TAB_LOBBY_PREFIX, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_LOBBY_SUFFIX, player, null); + + PlayerTab tab = handle.playerTabCreate( + playerTabId, player, prefix, suffix, PlayerTab.PushingRule.NEVER, + this.sidebar.getPlaceholders(player) + ); + deployedPerPlayerTabList.put(player.getUniqueId(), tab); + return; + } + + // in-game tab has a special treatment + if (arena.isSpectator(player) || (spectator != null && spectator)) { + + // if has been eliminated from a team + ITeam exTeam = arena.getExTeam(player.getUniqueId()); + + // when player leaves but decides to join to spectate later + if (null != exTeam) { + + HashMap replacements = getTeamReplacements(exTeam); + + if (arena.getStatus() == GameState.restarting && null != arena.getWinner()) { + if (arena.getWinner().equals(exTeam)) { + prefix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_PREFIX, player, replacements); + suffix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_WIN2_SUFFIX, player, replacements); + } else { + prefix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_PREFIX, player, replacements); + suffix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_ELM_SUFFIX, player, replacements); + } + } else { + prefix = getTabText(Messages.FORMATTING_SB_TAB_PLAYING_ELM_PREFIX, player, replacements); + suffix = getTabText(Messages.FORMATTING_SB_TAB_PLAYING_ELM_SUFFIX, player, replacements); + } + + PlayerTab tab = handle.playerTabCreate( + getPlayerTabIdentifierEliminatedInTeam(exTeam, playerTabId), + player, prefix, suffix, PlayerTab.PushingRule.NEVER, + this.sidebar.getPlaceholders(player) + ); + deployedPerPlayerTabList.put(player.getUniqueId(), tab); + return; + } + + switch (arena.getStatus()) { + case waiting: + prefix = getTabText(Messages.FORMATTING_SB_TAB_WAITING_PREFIX_SPEC, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX_SPEC, player, null); + break; + case starting: + prefix = getTabText(Messages.FORMATTING_SB_TAB_STARTING_PREFIX_SPEC, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX_SPEC, player, null); + break; + case playing: + prefix = getTabText(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_PREFIX, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_PLAYING_SPEC_SUFFIX, player, null); + break; + case restarting: + prefix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_PREFIX, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_SPEC_SUFFIX, player, null); + break; + default: + throw new RuntimeException("Unhandled game state.."); + } + + PlayerTab tab = handle.playerTabCreate( + getPlayerTabIdentifierSpectator(null, playerTabId), + player, prefix, suffix, PlayerTab.PushingRule.NEVER, + this.sidebar.getPlaceholders(player) + ); + deployedPerPlayerTabList.put(player.getUniqueId(), tab); + return; + } + + // this is reached only by alive players + GameState status = arena.getStatus(); + if (status != GameState.playing) { + + String currentTabId = playerTabId; + + switch (status) { + case waiting: + prefix = getTabText(Messages.FORMATTING_SB_TAB_WAITING_PREFIX, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_WAITING_SUFFIX, player, null); + break; + case starting: + prefix = getTabText(Messages.FORMATTING_SB_TAB_STARTING_PREFIX, player, null); + suffix = getTabText(Messages.FORMATTING_SB_TAB_STARTING_SUFFIX, player, null); + break; + case restarting: + ITeam team = arena.getTeam(player); + currentTabId = getPlayerTabIdentifierAliveInTeam(team, playerTabId); + + HashMap replacements = getTeamReplacements(team); + + prefix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_PREFIX, player, replacements); + suffix = getTabText(Messages.FORMATTING_SB_TAB_RESTARTING_WIN1_SUFFIX, player, replacements); + break; + default: + throw new IllegalStateException("Unhandled game status!"); + } + PlayerTab t = handle.playerTabCreate( + currentTabId, player, prefix, suffix, PlayerTab.PushingRule.NEVER, this.sidebar.getPlaceholders(player) + ); + deployedPerPlayerTabList.put(player.getUniqueId(), t); + return; + } + + // if status is playing and player is alive + + ITeam team = arena.getTeam(player); + // tab list of playing state + HashMap replacements = getTeamReplacements(team); + + prefix = getTabText(Messages.FORMATTING_SB_TAB_PLAYING_PREFIX, player, replacements); + suffix = getTabText(Messages.FORMATTING_SB_TAB_PLAYING_SUFFIX, player, replacements); + + PlayerTab teamTab = handle.playerTabCreate( + getPlayerTabIdentifierAliveInTeam(team, playerTabId), + player, prefix, suffix, PlayerTab.PushingRule.PUSH_OTHER_TEAMS, + this.sidebar.getPlaceholders(player) + ); + deployedPerPlayerTabList.put(player.getUniqueId(), teamTab); + if (player.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + teamTab.setNameTagVisibility(PlayerTab.NameTagVisibility.NEVER); + } + } + + @NotNull + private SidebarLine getTabText(String path, Player targetPlayer, @Nullable HashMap replacements) { + List strings = Language.getList(sidebar.getPlayer(), path); + if (strings.isEmpty()) { + return new SidebarLine() { + @NotNull + @Override + public String getLine() { + return ""; + } + }; + } + + strings = new ArrayList<>(); + for (String string : Language.getList(sidebar.getPlayer(), path)) { + String parsed = string.replace("{vPrefix}", BedWars.getChatSupport().getPrefix(targetPlayer)) + .replace("{vSuffix}", BedWars.getChatSupport().getSuffix(targetPlayer)); + + if (null != replacements) { + for (Map.Entry entry : replacements.entrySet()) { + parsed = parsed.replace(entry.getKey(), entry.getValue()); + } + } + + strings.add(parsed); + } + + if (strings.size() == 1) { + final String line = strings.get(0); + return new SidebarLine() { + @NotNull + @Override + public String getLine() { + return line; + } + }; + } + + final String[] lines = new String[strings.size()]; + for (int i = 0; i < lines.length; i++) { + lines[i] = strings.get(i); + } + return new SidebarLineAnimated(lines); + } + + /** + * Gets/generates a prefix string to be concatenated to the player tab-list identifier, it keeps tab-list ordered by team. + * + * @param team target. + * @return prefix string. + */ + private String getCreateTeamTabOrderPrefix(@NotNull ITeam team) { + String prefix = teamOrderPrefix.getOrDefault(team.getIdentity(), null); + if (null == prefix) { + teamOrderIndex++; + prefix = teamOrderIndex + ""; + teamOrderPrefix.put(team.getIdentity(), prefix); + if (prefix.length() > 3) { + throw new RuntimeException("Could not generate new order prefixes. Char limit exceeded. Max value is 999."); + } + + // todo how do we clean up index? when arena became null? + } + return prefix; + } + + /** + * Get existing or create player unique identifier for tab ordering + * + * @param player target. + * @return unique tab identifier for given player. + */ + private String getCreatePlayerTabIdentifier(@NotNull Player player) { + String id = playerTabIdentifier.getOrDefault(player.getUniqueId(), null); + if (null == id) { + id = player.getName().substring(0, Math.min(player.getName().length(), 9)); + + if (hasPlayerIdentifier(id)) { + Integer lastDuplicationIndex = playerTabIdentifierDuplication.getOrDefault(id, 0); + + lastDuplicationIndex++; + id += lastDuplicationIndex.toString(); + playerTabIdentifierDuplication.put(id, lastDuplicationIndex); + } + + playerTabIdentifier.put(player.getUniqueId(), id); + } + return id; + } + + + private boolean hasPlayerIdentifier(@NotNull String id) { + for (String string : playerTabIdentifier.values()) { + if (string.equals(id)) { + return true; + } + } + return false; + } + + @SuppressWarnings("unused") + private @NotNull String getPlayerTabIdentifierAliveInTeam(ITeam team, Player player) { + return getPlayerTabIdentifierAliveInTeam(team, getCreatePlayerTabIdentifier(player)); + } + + private @NotNull String getPlayerTabIdentifierAliveInTeam(ITeam team, String playerId) { + return getCreateTeamTabOrderPrefix(team) + playerId; + } + + @SuppressWarnings("unused") + private @NotNull String getPlayerTabIdentifierEliminatedInTeam(ITeam team, Player player) { + return getPlayerTabIdentifierEliminatedInTeam(team, getCreatePlayerTabIdentifier(player)); + } + + private @NotNull String getPlayerTabIdentifierEliminatedInTeam(ITeam team, String playerId) { + return ELIMINATED_FROM_TEAM_PREFIX + getCreateTeamTabOrderPrefix(team) + playerId; + } + + @SuppressWarnings("unused") + private @NotNull String getPlayerTabIdentifierSpectator(@Nullable ITeam team, Player player) { + return getPlayerTabIdentifierSpectator(team, getCreatePlayerTabIdentifier(player)); + } + + private @NotNull String getPlayerTabIdentifierSpectator(@Nullable ITeam team, String playerId) { + if (null == team) { + return SPECTATOR_PREFIX + playerId; + } + return getPlayerTabIdentifierEliminatedInTeam(team, playerId); + } + + @NotNull HashMap getTeamReplacements(@Nullable ITeam team) { + HashMap replacements = new HashMap<>(); + String displayName = null == team ? "" : team.getDisplayName(Language.getPlayerLanguage(sidebar.getPlayer())); + replacements.put("{teamName}", displayName); + replacements.put("{teamLetter}", null == team ? "" : team.getColor().chat() + (displayName.substring(0, 1))); + replacements.put("{teamColor}", null == team ? "" : team.getColor().chat().toString()); + + return replacements; + } + + /** + * Clear tab lines from instance. + */ + public void onSidebarRemoval() { + sidebar.getHandle().clearLines(); + deployedPerPlayerTabList.clear(); + playerTabIdentifier.clear(); + playerTabIdentifierDuplication.clear(); + teamOrderPrefix.clear(); + teamOrderIndex = 0; + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/ScoreboardListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/ScoreboardListener.java index b50b9aa63..2bf53f8d3 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/ScoreboardListener.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/ScoreboardListener.java @@ -22,11 +22,8 @@ import com.andrei1058.bedwars.BedWars; import com.andrei1058.bedwars.api.arena.IArena; -import com.andrei1058.bedwars.api.configuration.ConfigPath; -import com.andrei1058.bedwars.api.events.player.PlayerBedBreakEvent; -import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; -import com.andrei1058.bedwars.api.events.player.PlayerReJoinEvent; -import com.andrei1058.bedwars.api.events.player.PlayerReSpawnEvent; +import com.andrei1058.bedwars.api.events.player.*; +import com.andrei1058.bedwars.api.server.ServerType; import com.andrei1058.bedwars.arena.Arena; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -34,73 +31,91 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.jetbrains.annotations.NotNull; public class ScoreboardListener implements Listener { - @EventHandler(priority = EventPriority.MONITOR) - public void onPlayerDamage(EntityDamageEvent e) { - if (e == null) return; - if (e.isCancelled()) return; - if (!(e.getEntity() instanceof Player)) return; + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onPlayerDamage(@NotNull EntityDamageEvent e) { + if (!(e.getEntity() instanceof Player)) { + return; + } + final Player player = (Player) e.getEntity(); final IArena arena = Arena.getArenaByPlayer(player); - int health = (int) Math.ceil((player.getHealth() - e.getFinalDamage())); - if (arena == null) return; + if (arena == null) { + return; + } + int health = (int) Math.ceil((player.getHealth() - e.getFinalDamage())); SidebarService.getInstance().refreshHealth(arena, player, health); } - @EventHandler(priority = EventPriority.MONITOR) - public void onRegain(EntityRegainHealthEvent e) { - if (e == null) return; - if (e.isCancelled()) return; - if (!(e.getEntity() instanceof Player)) return; + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onRegain(@NotNull EntityRegainHealthEvent e) { + if (!(e.getEntity() instanceof Player)) { + return; + } + final Player player = (Player) e.getEntity(); final IArena arena = Arena.getArenaByPlayer(player); - if (arena == null) return; + if (arena == null) { + return; + } int health = (int) Math.ceil(player.getHealth() + e.getAmount()); - SidebarService.getInstance().refreshHealth(arena, player, health); } @EventHandler(priority = EventPriority.MONITOR) - public void onReSpawn(PlayerReSpawnEvent e) { - if (e == null) return; + public void onReSpawn(@NotNull PlayerReSpawnEvent e) { final IArena arena = e.getArena(); SidebarService.getInstance().refreshHealth(arena, e.getPlayer(), (int) Math.ceil(e.getPlayer().getHealth())); } - @EventHandler(priority = EventPriority.LOWEST) - public void reJoin(PlayerReJoinEvent e) { - if (e == null) return; - if (e.isCancelled()) return; - if (!BedWars.config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_LIST_FORMAT_PLAYING)) return; - final IArena arena = e.getArena(); - final Player player = e.getPlayer(); - + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void reJoin(@NotNull PlayerReJoinEvent e) { // re-add player to scoreboard tab list - SidebarService.getInstance().handleReJoin(arena, player); + SidebarService.getInstance().handleReJoin(e.getArena(), e.getPlayer()); } - @EventHandler - public void onBedDestroy(PlayerBedBreakEvent e) { - if (e == null) return; - final IArena arena = e.getArena(); + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void arenaJoin(@NotNull PlayerJoinArenaEvent e) { + // add player to scoreboard tab list + SidebarService.getInstance().handleJoin(e.getArena(), e.getPlayer(), e.isSpectator()); + } - // refresh placeholders in case placeholders refresh is disabled - SidebarService.getInstance().refreshPlaceholders(arena); + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void serverJoin(@NotNull PlayerJoinEvent e) { + if (BedWars.getServerType() == ServerType.MULTIARENA || BedWars.getServerType() == ServerType.SHARED) { + // add player to scoreboard tab list + SidebarService.getInstance().applyLobbyTab(e.getPlayer()); + } } - @EventHandler - public void onFinalKill(PlayerKillEvent e) { - if (e == null) return; - if (!e.getCause().isFinalKill()) return; - final IArena arena = e.getArena(); + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void arenaLeave(@NotNull PlayerLeaveArenaEvent e) { + if (BedWars.getServerType() == ServerType.MULTIARENA || BedWars.getServerType() == ServerType.SHARED) { + // add player to scoreboard tab list + SidebarService.getInstance().applyLobbyTab(e.getPlayer()); + } + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onBedDestroy(@NotNull PlayerBedBreakEvent e) { + // refresh placeholders in case placeholders refresh is disabled + SidebarService.getInstance().refreshPlaceholders(e.getArena()); + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onFinalKill(@NotNull PlayerKillEvent e) { + if (!e.getCause().isFinalKill()) { + return; + } // refresh placeholders in case placeholders refresh is disabled - SidebarService.getInstance().refreshPlaceholders(arena); + SidebarService.getInstance().refreshPlaceholders(e.getArena()); } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/SidebarService.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/SidebarService.java index fbc54206a..a1dbeda84 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/SidebarService.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/SidebarService.java @@ -47,8 +47,9 @@ public void giveSidebar(@NotNull Player player, @Nullable IArena arena, boolean // check if we might need to remove the existing sidebar if (null != sidebar) { if (null == arena) { - // if sidebar is disabled in lobby on shared mode - if (!config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_USE_LOBBY_SIDEBAR)) { + // if sidebar is disabled in lobby on shared or multi-arena mode + if (!config.getBoolean(ConfigPath.SB_CONFIG_SIDEBAR_USE_LOBBY_SIDEBAR) || + BedWars.getServerType() == ServerType.SHARED) { this.remove(sidebar); return; } @@ -79,11 +80,39 @@ public void giveSidebar(@NotNull Player player, @Nullable IArena arena, boolean } } else { if (arena.getStatus() == GameState.waiting) { - lines = getScoreboard(player, "scoreboard." + arena.getGroup() + ".waiting", Messages.SCOREBOARD_DEFAULT_WAITING); + if (arena.isSpectator(player)) { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".waiting.spectator", Messages.SCOREBOARD_DEFAULT_WAITING_SPEC); + } else { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".waiting.player", Messages.SCOREBOARD_DEFAULT_WAITING); + } } else if (arena.getStatus() == GameState.starting) { - lines = getScoreboard(player, "scoreboard." + arena.getGroup() + ".starting", Messages.SCOREBOARD_DEFAULT_STARTING); - } else if (arena.getStatus() == GameState.playing || arena.getStatus() == GameState.restarting) { - lines = getScoreboard(player, "scoreboard." + arena.getGroup() + ".playing", Messages.SCOREBOARD_DEFAULT_PLAYING); + if (arena.isSpectator(player)) { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".starting.spectator", Messages.SCOREBOARD_DEFAULT_STARTING_SPEC); + } else { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".starting.player", Messages.SCOREBOARD_DEFAULT_STARTING); + } + } else if (arena.getStatus() == GameState.playing) { + if (arena.isSpectator(player)) { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".playing.spectator", Messages.SCOREBOARD_DEFAULT_PLAYING_SPEC); + } else { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".playing.alive", Messages.SCOREBOARD_DEFAULT_PLAYING); + } + } else if (arena.getStatus() == GameState.restarting) { + + ITeam holderTeam = arena.getTeam(player); + ITeam holderExTeam = null == holderTeam ? arena.getExTeam(player.getUniqueId()) : null; + + if (null == holderTeam && null == holderExTeam) { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".restarting.spectator", Messages.SCOREBOARD_DEFAULT_RESTARTING_SPEC); + } else { + if (null == holderTeam && holderExTeam.equals(arena.getWinner())) { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".restarting.winner-eliminated", Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN2); + } else if (null == holderExTeam && holderTeam.equals(arena.getWinner())) { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".restarting.winner-alive", Messages.SCOREBOARD_DEFAULT_RESTARTING_WIN1); + } else { + lines = getScoreboard(player, "sidebar." + arena.getGroup() + ".restarting.loser", Messages.SCOREBOARD_DEFAULT_RESTARTING_LOSER); + } + } } } @@ -154,9 +183,10 @@ public void refreshPlaceholders() { public void refreshPlaceholders(IArena arena) { this.sidebars.forEach((k, v) -> { - if (v.getArena().equals(arena)) { - v.getHandle().refreshPlaceholders(); - } + if (v.getArena() != null) + if (v.getArena().equals(arena)) { + v.getHandle().refreshPlaceholders(); + } }); } @@ -164,11 +194,19 @@ public void refreshTabList() { this.sidebars.forEach((k, v) -> v.getHandle().playerTabRefreshAnimation()); } + public void refreshTabHeaderFooter() { + this.sidebars.forEach((k, v) -> { + if (null != v && null != v.getHeaderFooter()) { + this.sidebarHandler.sendHeaderFooter(v.getPlayer(), v.getHeaderFooter()); + } + }); + } + public void refreshHealth() { this.sidebars.forEach((k, v) -> { if (null != v.getArena()) { v.getHandle().playerHealthRefreshAnimation(); - for (Player player : v.getArena().getPlayers()){ + for (Player player : v.getArena().getPlayers()) { v.getHandle().setPlayerHealth(player, (int) Math.ceil(player.getHealth())); } } @@ -181,7 +219,7 @@ public void refreshHealth() { } public void refreshHealth(IArena arena, Player player, int health) { - this.sidebars.forEach((k,v) -> { + this.sidebars.forEach((k, v) -> { if (null != v.getArena() && v.getArena().equals(arena)) { v.getHandle().setPlayerHealth(player, health); } @@ -189,15 +227,35 @@ public void refreshHealth(IArena arena, Player player, int health) { } public void handleReJoin(IArena arena, Player player) { - this.sidebars.forEach((k,v) -> { + this.sidebars.forEach((k, v) -> { if (null != v.getArena() && v.getArena().equals(arena)) { v.giveUpdateTabFormat(player, false); } }); } + public void handleJoin(IArena arena, Player player, @Nullable Boolean spectator) { + this.sidebars.forEach((k, v) -> { + if (null != v.getArena() && v.getArena().equals(arena)) { + if (!v.getPlayer().equals(player)) { + v.giveUpdateTabFormat(player, false, spectator); + } + } + }); + } + + public void applyLobbyTab(Player player) { + this.sidebars.forEach((k, v) -> { + if (null == v.getArena()) { + if (!v.getPlayer().equals(player)) { + v.giveUpdateTabFormat(player, false); + } + } + }); + } + public void handleInvisibility(ITeam team, Player player, boolean toggle) { - this.sidebars.forEach((k,v) -> { + this.sidebars.forEach((k, v) -> { if (null != v.getArena() && v.getArena().equals(team.getArena())) { v.handleInvisibilityPotion(player, toggle); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabListTask.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshPlayerListTask.java similarity index 94% rename from bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabListTask.java rename to bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshPlayerListTask.java index cbd61ac76..64d257f0e 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabListTask.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshPlayerListTask.java @@ -22,7 +22,7 @@ import com.andrei1058.bedwars.sidebar.SidebarService; -public class RefreshTabListTask implements Runnable { +public class RefreshPlayerListTask implements Runnable { @Override public void run() { SidebarService.getInstance().refreshTabList(); diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabHeaderFooterTask.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabHeaderFooterTask.java new file mode 100644 index 000000000..c198e33b2 --- /dev/null +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/sidebar/thread/RefreshTabHeaderFooterTask.java @@ -0,0 +1,33 @@ +/* + * BedWars1058 - A bed wars mini-game. + * Copyright (C) 2023 Andrei Dascălu + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Contact e-mail: andrew.dascalu@gmail.com + */ + +package com.andrei1058.bedwars.sidebar.thread; + +import com.andrei1058.bedwars.sidebar.SidebarService; + +/** + * Refresh TAB header and footer. + */ +public class RefreshTabHeaderFooterTask implements Runnable { + @Override + public void run() { + SidebarService.getInstance().refreshTabHeaderFooter(); + } +} diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/stats/StatsListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/stats/StatsListener.java index c6563f22b..54c255f3a 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/stats/StatsListener.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/stats/StatsListener.java @@ -37,6 +37,7 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.jetbrains.annotations.NotNull; import java.time.Instant; import java.util.UUID; @@ -117,7 +118,7 @@ public void onGameEnd(GameEndEvent event) { } @EventHandler - public void onArenaLeave(PlayerLeaveArenaEvent event) { + public void onArenaLeave(@NotNull PlayerLeaveArenaEvent event) { final Player player = event.getPlayer(); ITeam team = event.getArena().getExTeam(player.getUniqueId()); @@ -129,9 +130,11 @@ public void onArenaLeave(PlayerLeaveArenaEvent event) { return; // Game didn't start } - PlayerStats playerStats = BedWars.getStatsManager().get(player.getUniqueId()); + PlayerStats playerStats = BedWars.getStatsManager().getUnsafe(player.getUniqueId()); // sometimes can be null due to scheduling delays - if (playerStats == null) return; + if (playerStats == null) { + return; + } // Update last play and first play (if required) Instant now = Instant.now(); @@ -140,56 +143,57 @@ public void onArenaLeave(PlayerLeaveArenaEvent event) { playerStats.setFirstPlay(now); } + // 28/10/2023 this should be handled by PlayerKillEvent now. It wasn't called for pvp log out before. // Check quit abuse - if (event.getArena().getStatus() == GameState.playing) { - // Only if the player left the arena while the game was running - if (team.isBedDestroyed()) { - // Only if the team had the bed destroyed - - // Punish player if bed is destroyed and he disconnects without getting killed - // if he is not in the spectators list it means he did not pass trough player kill event and he did not receive - // the penalty bellow. - if (event.getArena().isPlayer(player)) { - playerStats.setFinalDeaths(playerStats.getFinalDeaths() + 1); - playerStats.setLosses(playerStats.getLosses() + 1); - } - - // Reward attacker - // if attacker is not null it means the victim did pvp log out - Player damager = event.getLastDamager(); - ITeam killerTeam = event.getArena().getTeam(damager); - if (damager != null && event.getArena().isPlayer(damager) && killerTeam != null) { - PlayerStats damagerStats = BedWars.getStatsManager().get(damager.getUniqueId()); - damagerStats.setFinalKills(damagerStats.getFinalKills() + 1); - event.getArena().addPlayerKill(damager, true, player); - } - } else { - // Prevent pvp log out abuse - Player damager = event.getLastDamager(); - ITeam killerTeam = event.getArena().getTeam(damager); - - // killer is null if if he already received kill point. - // LastHit damager is set to null at PlayerDeathEvent so this part is not duplicated for sure. - // damager is not null if the victim disconnected during pvp only. - if (event.getLastDamager() != null && event.getArena().isPlayer(damager) && killerTeam != null) { - // Punish player - playerStats.setDeaths(playerStats.getDeaths() + 1); - event.getArena().addPlayerDeath(player); - - // Reward attacker - event.getArena().addPlayerKill(damager, false, player); - PlayerStats damagerStats = BedWars.getStatsManager().get(damager.getUniqueId()); - damagerStats.setKills(damagerStats.getKills() + 1); - } - } - } - - //save or replace stats for player - Bukkit.getScheduler().runTaskAsynchronously(BedWars.plugin, () -> BedWars.getRemoteDatabase().saveStats(playerStats)); +// if (event.getArena().getStatus() == GameState.playing) { +// // Only if the player left the arena while the game was running +// if (team.isBedDestroyed()) { +// // Only if the team had the bed destroyed +// +// // Punish player if bed is destroyed and he disconnects without getting killed +// // if he is not in the spectators list it means he did not pass trough player kill event and he did not receive +// // the penalty bellow. +// if (event.getArena().isPlayer(player)) { +// playerStats.setFinalDeaths(playerStats.getFinalDeaths() + 1); +// playerStats.setLosses(playerStats.getLosses() + 1); +// } +// +// // Reward attacker +// // if attacker is not null it means the victim did pvp log out +// Player damager = event.getLastDamager(); +// ITeam killerTeam = event.getArena().getTeam(damager); +// if (damager != null && event.getArena().isPlayer(damager) && killerTeam != null) { +// PlayerStats damagerStats = BedWars.getStatsManager().get(damager.getUniqueId()); +// damagerStats.setFinalKills(damagerStats.getFinalKills() + 1); +// event.getArena().addPlayerKill(damager, true, player); +// } +// } else { +// // Prevent pvp log out abuse +// Player damager = event.getLastDamager(); +// ITeam killerTeam = event.getArena().getTeam(damager); +// +// // killer is null if if he already received kill point. +// // LastHit damager is set to null at PlayerDeathEvent so this part is not duplicated for sure. +// // damager is not null if the victim disconnected during pvp only. +// if (event.getLastDamager() != null && event.getArena().isPlayer(damager) && killerTeam != null) { +// // Punish player +// playerStats.setDeaths(playerStats.getDeaths() + 1); +// event.getArena().addPlayerDeath(player); +// +// // Reward attacker +// event.getArena().addPlayerKill(damager, false, player); +// PlayerStats damagerStats = BedWars.getStatsManager().get(damager.getUniqueId()); +// damagerStats.setKills(damagerStats.getKills() + 1); +// } +// } +// } + + //save or replace stats for player - run later because PlayerKillEvent is triggered after PlayerLeaveArenaEvent + Bukkit.getScheduler().runTaskLaterAsynchronously(BedWars.plugin, () -> BedWars.getRemoteDatabase().saveStats(playerStats), 10L); } @EventHandler(priority = EventPriority.MONITOR) - public void onQuit(PlayerQuitEvent event) { + public void onQuit(@NotNull PlayerQuitEvent event) { BedWars.getStatsManager().remove(event.getPlayer().getUniqueId()); } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/PaperSupport.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/TeleportManager.java similarity index 64% rename from bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/PaperSupport.java rename to bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/TeleportManager.java index 6f3a0e0b0..d4f9c50dc 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/PaperSupport.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/paper/TeleportManager.java @@ -9,26 +9,18 @@ import static com.andrei1058.bedwars.BedWars.config; import static com.andrei1058.bedwars.BedWars.isPaper; -public final class PaperSupport { +public final class TeleportManager { - public static void teleport(Entity entity, Location location){ - if (isPaper && config.getBoolean(ConfigPath.GENERAL_CONFIGURATION_PERFORMANCE_PAPER_FEATURES)){ - PaperLib.teleportAsync(entity, location); - } - else - { - entity.teleport(location); - } + public static void teleport(Entity entity, Location location) { + teleportC(entity, location, PlayerTeleportEvent.TeleportCause.PLUGIN); } - public static void teleportC(Entity entity, Location location, PlayerTeleportEvent.TeleportCause cause){ - if (isPaper){ + public static void teleportC(Entity entity, Location location, PlayerTeleportEvent.TeleportCause cause) { + if (isPaper && config.getBoolean(ConfigPath.GENERAL_CONFIGURATION_PERFORMANCE_PAPER_FEATURES)) { PaperLib.teleportAsync(entity, location, cause); + return; } - else - { - entity.teleport(location, cause); - } + entity.teleport(location, cause); } } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAF.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAF.java index 0cb8765fd..d4f14a042 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAF.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAF.java @@ -14,6 +14,7 @@ public class PAF implements Party { //Party and Friends for Spigot Support by JT122406 private PlayerParty getPAFParty(Player p) { + if (PAFPlayerManager.getInstance() == null) return null; return PartyManager.getInstance().getParty(PAFPlayerManager.getInstance().getPlayer(p)); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAFBungeecordRedisApi.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAFBungeecordRedisApi.java index b6fd5ed77..fb1c93468 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAFBungeecordRedisApi.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PAFBungeecordRedisApi.java @@ -16,6 +16,7 @@ public class PAFBungeecordRedisApi implements Party { //Party and Friends Extended for BungeeCord Support by JT122406 private PlayerParty getPAFParty(Player p) { + if (PAFPlayerManager.getInstance() == null) return null; return PartyManager.getInstance().getParty(PAFPlayerManager.getInstance().getPlayer(p.getUniqueId())); } diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PartiesAdapter.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PartiesAdapter.java index db3b3579b..feb978347 100644 --- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PartiesAdapter.java +++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/support/party/PartiesAdapter.java @@ -91,14 +91,17 @@ public List getMembers(Player p) { public void createParty(Player owner, Player... members) { //party creation handled on bungee side if (!api.isBungeeCordEnabled()) { - boolean created = api.createParty(null, api.getPartyPlayer(owner.getUniqueId())); - if (created) { - com.alessiodp.parties.api.interfaces.Party party = api.getParty(owner.getUniqueId()); - if (null != party) { - for (Player player1 : members) { - PartyPlayer partyPlayer = api.getPartyPlayer(player1.getUniqueId()); - if (null != partyPlayer) { - party.addMember(partyPlayer); + PartyPlayer partyOwner = api.getPartyPlayer(owner.getUniqueId()); + if (null != partyOwner && !partyOwner.isInParty()) { + boolean created = api.createParty(null, partyOwner); + if (created && null != partyOwner.getPartyId()) { + com.alessiodp.parties.api.interfaces.Party party = api.getParty(partyOwner.getPartyId()); + if (null != party) { + for (Player player1 : members) { + PartyPlayer partyPlayer = api.getPartyPlayer(player1.getUniqueId()); + if (null != partyPlayer && !partyPlayer.isInParty()) { + party.addMember(partyPlayer); + } } } } @@ -178,7 +181,8 @@ public void removePlayer(Player owner, Player target) { @Override public Player getOwner(Player member) { - return Bukkit.getPlayer(Objects.requireNonNull(api.getParty(member.getUniqueId())).getLeader()); + PartyPlayer partyPlayer = api.getPartyPlayer(member.getUniqueId()); + return Bukkit.getPlayer(Objects.requireNonNull(api.getParty(Objects.requireNonNull(partyPlayer).getPartyId())).getLeader()); } @Override diff --git a/bedwars-plugin/src/main/resources/plugin.yml b/bedwars-plugin/src/main/resources/plugin.yml index 1818b4e3c..407b439c2 100644 --- a/bedwars-plugin/src/main/resources/plugin.yml +++ b/bedwars-plugin/src/main/resources/plugin.yml @@ -5,4 +5,4 @@ author: andrei1058 description: BedWars minigame by andrei1058 main: com.andrei1058.bedwars.BedWars softdepend: [Vault,PlaceholderAPI,Citizens,Parties,SlimeWorldManager,VipFeatures,Enhanced-SlimeWorldManager,PartyAndFriends,Spigot-Party-API-PAF] -load: STARTUP +#load: STARTUP diff --git a/pom.xml b/pom.xml index 58991cba1..f60d95297 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.andrei1058.bedwars BedWars1058 pom - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT UTF-8 @@ -21,14 +21,14 @@ bungeecord-repo https://oss.sonatype.org/content/repositories/snapshots - - gitlab-maven - https://gitlab.com/api/v4/groups/4800570/-/packages/maven - - - vipfeatures-maven - https://gitlab.com/api/v4/projects/6491858/packages/maven - + + + + + + + + codemc-nms https://repo.codemc.io/repository/nms/ @@ -46,7 +46,7 @@ commons-io commons-io - 2.11.0 + 2.13.0 provided @@ -100,7 +100,9 @@ bedwars-plugin bedwars-api + resetadapter_aswm resetadapter_slime + resetadapter_slimepaper versionsupport_1_8_R3 versionsupport_1_12_R1 versionsupport_common @@ -108,6 +110,9 @@ versionsupport_v1_17_R1 versionsupport_v1_18_R2 versionsupport_v1_19_R2 + versionsupport_v1_19_R3 + versionsupport_v1_20_R1 + versionsupport_v1_20_R2 diff --git a/resetadapter_aswm/pom.xml b/resetadapter_aswm/pom.xml new file mode 100644 index 000000000..6725d96a6 --- /dev/null +++ b/resetadapter_aswm/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + + BedWars1058 + com.andrei1058.bedwars + 23.10.1-SNAPSHOT + + + resetadapter-aswm + ${project.parent.version} + + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + flow-nbt + https://repo.glaremasters.me/repository/concuncan/ + + + legacy-aswm + https://repo.rapture.pw/repository/maven-snapshots/ + + + + + + com.andrei1058.bedwars + bedwars-api + ${project.version} + provided + + + org.spigotmc + spigot-api + 1.8.8-R0.1-SNAPSHOT + provided + + + com.grinderwolf + slimeworldmanager-api + 2.2.1 + provided + + + com.flowpowered + flow-nbt + 2.0.0 + compile + + + + + + + maven-deploy-plugin + + true + + + + + \ No newline at end of file diff --git a/resetadapter_aswm/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/AdvancedSlimeAdapter.java b/resetadapter_aswm/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/AdvancedSlimeAdapter.java new file mode 100644 index 000000000..4c0e07bdd --- /dev/null +++ b/resetadapter_aswm/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/AdvancedSlimeAdapter.java @@ -0,0 +1,484 @@ +/* + * BedWars1058 - A bed wars mini-game. + * Copyright (C) 2021 Andrei Dascălu + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Contact e-mail: andrew.dascalu@gmail.com + */ + +package com.andrei1058.bedwars.arena.mapreset.slime; + +import com.andrei1058.bedwars.api.BedWars; +import com.andrei1058.bedwars.api.arena.GameState; +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.configuration.ConfigPath; +import com.andrei1058.bedwars.api.server.ISetupSession; +import com.andrei1058.bedwars.api.server.RestoreAdapter; +import com.andrei1058.bedwars.api.server.ServerType; +import com.andrei1058.bedwars.api.util.FileUtil; +import com.andrei1058.bedwars.api.util.ZipFileUtil; +import com.flowpowered.nbt.CompoundMap; +import com.flowpowered.nbt.CompoundTag; +import com.flowpowered.nbt.IntTag; +import com.flowpowered.nbt.stream.NBTInputStream; +import com.flowpowered.nbt.stream.NBTOutputStream; +import com.grinderwolf.swm.api.SlimePlugin; +import com.grinderwolf.swm.api.exceptions.*; +import com.grinderwolf.swm.api.loaders.SlimeLoader; +import com.grinderwolf.swm.api.world.SlimeWorld; +import com.grinderwolf.swm.api.world.properties.SlimeProperties; +import com.grinderwolf.swm.api.world.properties.SlimePropertyMap; +import org.apache.commons.io.FileUtils; +import org.bukkit.*; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.world.WorldInitEvent; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.*; +import java.util.logging.Level; + +@SuppressWarnings("unused") +public class AdvancedSlimeAdapter extends RestoreAdapter { + + private final SlimePlugin slime; + private final BedWars api; + + public AdvancedSlimeAdapter(Plugin plugin) { + super(plugin); + slime = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager"); + api = Objects.requireNonNull(Bukkit.getServer().getServicesManager().getRegistration(BedWars.class)).getProvider(); + } + + @Override + public void onEnable(IArena a) { + if (api.getVersionSupport().getMainLevel().equalsIgnoreCase(a.getWorldName())) { + if (!(api.getServerType() == ServerType.BUNGEE && api.getArenaUtil().getGamesBeforeRestart() == 1)) { + FileUtil.setMainLevel("ignore_main_level", api.getVersionSupport()); + getOwner().getLogger().log(Level.SEVERE, "Cannot use level-name as arenas. Automatically creating a new void map for level-name."); + getOwner().getLogger().log(Level.SEVERE, "The server is restarting..."); + Bukkit.getServer().spigot().restart(); + return; + } + } + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + if (Bukkit.getWorld(a.getWorldName()) != null) { + Bukkit.getScheduler().runTask(getOwner(), () -> { + World w = Bukkit.getWorld(a.getWorldName()); + a.init(w); + }); + return; + } + + SlimeLoader flat = slime.getLoader("file"); + String[] spawn = a.getConfig().getString("waiting.Loc").split(","); + + try { + // Note that this method should be called asynchronously + SlimeWorld world = slime.loadWorld( + flat, + a.getArenaName(), + true, + getCreateProperties( + (int) Double.parseDouble(spawn[0]), + (int) Double.parseDouble(spawn[1]), + (int) Double.parseDouble(spawn[2]) + ) + ); + + if (api.getServerType() == ServerType.BUNGEE && api.isAutoScale()) { + world = world.clone(a.getWorldName()); + } + + // This method must be called synchronously + SlimeWorld finalWorld = world; + Bukkit.getScheduler().runTask(getOwner(), () -> { + slime.generateWorld(finalWorld); + + World w = Bukkit.getWorld(a.getArenaName()); + if (w == null) { + api.getArenaUtil().removeFromEnableQueue(a); + getOwner().getLogger().severe("Something wrong... removing arena " + a.getArenaName() + " from queue."); + return; + } + Bukkit.getPluginManager().callEvent(new WorldInitEvent(w)); + Bukkit.getScheduler().runTask( + getOwner(), () -> Bukkit.getPluginManager().callEvent(new WorldLoadEvent(w)) + ); + }); + } catch (UnknownWorldException | IOException | CorruptedWorldException | NewerFormatException | + WorldInUseException ex) { + api.getArenaUtil().removeFromEnableQueue(a); + ex.printStackTrace(); + } catch (ConcurrentModificationException thisShouldNotHappenSWM) { + // this should not happen since they say to use #load async + // https://github.com/Grinderwolf/Slime-World-Manager/blob/develop/.docs/api/load-world.md + thisShouldNotHappenSWM.printStackTrace(); + api.getArenaUtil().removeFromEnableQueue(a); + getOwner().getLogger().severe("This is a SlimeWorldManager issue!"); + getOwner().getLogger().severe("I've submitted a bug report: https://github.com/Grinderwolf/Slime-World-Manager/issues/174"); + getOwner().getLogger().severe("Trying again to load arena: " + a.getArenaName()); + + // hope not to get an overflow + onEnable(a); + } + }); + } + + @Override + public void onRestart(IArena a) { + if (api.getServerType() == ServerType.BUNGEE) { + if (api.getArenaUtil().getGamesBeforeRestart() == 0) { + if (api.getArenaUtil().getArenas().size() == 1 && api.getArenaUtil().getArenas().get(0).getStatus() == GameState.restarting) { + getOwner().getLogger().info("Dispatching command: " + api.getConfigs().getMainConfig().getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_RESTART_CMD)); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), api.getConfigs().getMainConfig().getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_RESTART_CMD)); + } + } else { + if (api.getArenaUtil().getGamesBeforeRestart() != -1) { + api.getArenaUtil().setGamesBeforeRestart(api.getArenaUtil().getGamesBeforeRestart() - 1); + } + Bukkit.getScheduler().runTask(getOwner(), () -> { + Bukkit.unloadWorld(a.getWorldName(), false); + if (api.getArenaUtil().canAutoScale(a.getArenaName())) { + Bukkit.getScheduler().runTaskLater(getOwner(), () -> api.getArenaUtil().loadArena(a.getArenaName(), null), 80L); + } + }); + } + } else { + Bukkit.getScheduler().runTask(getOwner(), () -> { + Bukkit.unloadWorld(a.getWorldName(), false); + Bukkit.getScheduler().runTaskLater(getOwner(), () -> api.getArenaUtil().loadArena(a.getArenaName(), null), 80L); + }); + } + } + + @Override + public void onDisable(IArena a) { + if (api.isShuttingDown()) { + Bukkit.unloadWorld(a.getWorldName(), false); + return; + } + Bukkit.getScheduler().runTask(getOwner(), () -> Bukkit.unloadWorld(a.getWorldName(), false)); + } + + @Override + public void onSetupSessionStart(ISetupSession s) { + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + SlimeLoader sLoader = slime.getLoader("file"); + String[] spawn = new String[]{"0", "50", "0"}; + if (s.getConfig().getYml().getString("waiting.Loc") != null) { + spawn = s.getConfig().getString("waiting.Loc").split(","); + } + SlimePropertyMap spm = getCreateProperties( + (int) Double.parseDouble(spawn[0]), + (int) Double.parseDouble(spawn[1]), + (int) Double.parseDouble(spawn[2]) + ); + + try { + + if (Bukkit.getWorld(s.getWorldName()) != null) { + Bukkit.getScheduler().runTask(getOwner(), () -> Bukkit.unloadWorld(s.getWorldName(), false)); + } + + SlimeWorld world; + if (sLoader.worldExists(s.getWorldName())) { + world = slime.loadWorld(sLoader, s.getWorldName(), false, spm); + Bukkit.getScheduler().runTask(getOwner(), () -> s.getPlayer().sendMessage(ChatColor.GREEN + "Loading world from SlimeWorldManager container.")); + } else { + if (new File(Bukkit.getWorldContainer(), s.getWorldName() + "/level.dat").exists()) { + Bukkit.getScheduler().runTask(getOwner(), () -> s.getPlayer().sendMessage(ChatColor.GREEN + "Importing world to the SlimeWorldManager container.")); + slime.importWorld(new File(Bukkit.getWorldContainer(), s.getWorldName()), s.getWorldName().toLowerCase(), sLoader); + world = slime.loadWorld(sLoader, s.getWorldName(), false, spm); + } else { + Bukkit.getScheduler().runTask(getOwner(), () -> s.getPlayer().sendMessage(ChatColor.GREEN + "Creating anew void map.")); + world = slime.createEmptyWorld(sLoader, s.getWorldName(), false, spm); + } + } + + SlimeWorld sw = world; + // This method must be called synchronously + Bukkit.getScheduler().runTask(getOwner(), () -> { + slime.generateWorld(sw); + + World w = Bukkit.getWorld(s.getWorldName()); + if (w == null) { + return; + } + Bukkit.getPluginManager().callEvent(new WorldInitEvent(w)); + Bukkit.getScheduler().runTask( + getOwner(), () -> Bukkit.getPluginManager().callEvent(new WorldLoadEvent(w)) + ); + s.teleportPlayer(); + }); + } catch (UnknownWorldException | IOException | CorruptedWorldException | NewerFormatException | + WorldInUseException | WorldAlreadyExistsException | InvalidWorldException | WorldTooBigException | + WorldLoadedException ex) { + s.getPlayer().sendMessage(ChatColor.RED + "An error occurred! Please check console."); + ex.printStackTrace(); + s.close(); + } + }); + } + + @Override + public void onSetupSessionClose(@NotNull ISetupSession s) { + Objects.requireNonNull(Bukkit.getWorld(s.getWorldName())).save(); + Bukkit.getScheduler().runTask(getOwner(), () -> Bukkit.unloadWorld(s.getWorldName(), true)); + } + + @Override + public void onLobbyRemoval(IArena a) { + Location loc1 = a.getConfig().getArenaLoc(ConfigPath.ARENA_WAITING_POS1), + loc2 = a.getConfig().getArenaLoc(ConfigPath.ARENA_WAITING_POS2); + if (loc1 == null || loc2 == null) return; + Bukkit.getScheduler().runTask(getOwner(), () -> { + int minX, minY, minZ; + int maxX, maxY, maxZ; + minX = Math.min(loc1.getBlockX(), loc2.getBlockX()); + maxX = Math.max(loc1.getBlockX(), loc2.getBlockX()); + minY = Math.min(loc1.getBlockY(), loc2.getBlockY()); + maxY = Math.max(loc1.getBlockY(), loc2.getBlockY()); + minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ()); + maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ()); + + for (int x = minX; x < maxX; x++) { + for (int y = minY; y < maxY; y++) { + for (int z = minZ; z < maxZ; z++) { + Objects.requireNonNull(loc1.getWorld()).getBlockAt(x, y, z).setType(Material.AIR); + } + } + } + + Bukkit.getScheduler().runTaskLater(getOwner(), () -> + Objects.requireNonNull(loc1.getWorld()).getEntities().forEach(e -> { + if (e instanceof Item) e.remove(); + }), 15L); + }); + } + + @Override + public boolean isWorld(String name) { + try { + return slime.getLoader("file").worldExists(name); + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + + @Override + public void deleteWorld(String name) { + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + try { + slime.getLoader("file").deleteWorld(name); + } catch (UnknownWorldException | IOException e) { + e.printStackTrace(); + } + }); + } + + @Override + public void cloneArena(String name1, String name2) { + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + + try { + // Note that this method should be called asynchronously + SlimeWorld world = slime.loadWorld( + slime.getLoader("file"), + name1, + true, + getCreateProperties(0, 118, 0) + ); + world.clone(name2, slime.getLoader("file")); + + } catch ( + UnknownWorldException | IOException | CorruptedWorldException | NewerFormatException | + WorldInUseException | WorldAlreadyExistsException ex + ) { + ex.printStackTrace(); + } + + }); + } + + @Override + public List getWorldsList() { + try { + return slime.getLoader("file").listWorlds(); + } catch (IOException e) { + e.printStackTrace(); + } + return new ArrayList<>(); + } + + /** + * Convert vanilla worlds to the slime format. + */ + public void convertWorlds() { + File dir = new File(getOwner().getDataFolder(), "/Arenas"); + File ff; + SlimeLoader sl = slime.getLoader("file"); + if (dir.exists()) { + File[] fls = dir.listFiles(); + if (fls != null) { + for (File fl : fls) { + if (fl.isFile()) { + if (fl.getName().endsWith(".yml")) { + final String name = fl.getName().replace(".yml", "").toLowerCase(); + ff = new File(Bukkit.getWorldContainer(), fl.getName().replace(".yml", "")); + try { + if (!sl.worldExists(name)) { + if (!fl.getName().equals(name)) { + if (!fl.renameTo(new File(dir, name + ".yml"))) { + getOwner().getLogger().log(Level.WARNING, "Could not rename " + fl.getName() + ".yml to " + name + ".yml"); + } + } + File bc = new File(getOwner().getDataFolder() + "/Cache", ff.getName() + ".zip"); + if (ff.exists() && bc.exists()) { + FileUtil.delete(ff); + ZipFileUtil.unzipFileIntoDirectory(bc, new File(Bukkit.getWorldContainer(), name)); + } + deleteWorldTrash(name); + handleLevelDat(name); + + convertWorld(name, null); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + } + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + File[] files = Bukkit.getWorldContainer().listFiles(); + if (files != null) { + for (File f : files) { + if (f != null && f.isDirectory()) { + if (f.getName().contains("bw_temp_")) { + try { + FileUtils.deleteDirectory(f); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + }); + } + + @Override + public String getDisplayName() { + return "Advanced Slime World Manager by Paul19988"; + } + + @SuppressWarnings("SameParameterValue") + private void convertWorld(String name, @Nullable Player player) { + SlimeLoader sl = slime.getLoader("file"); + try { + getOwner().getLogger().log(Level.INFO, "Converting " + name + " to the Slime format."); + slime.importWorld(new File(Bukkit.getWorldContainer(), name), name, sl); + } catch (WorldAlreadyExistsException | InvalidWorldException | WorldLoadedException | WorldTooBigException | + IOException e) { + if (null != player) { + player.sendMessage(ChatColor.RED + "Could not convert " + name + " to the Slime format."); + player.sendMessage(ChatColor.RED + "Check the console for details."); + ISetupSession s = api.getSetupSession(player.getUniqueId()); + if (s != null) { + s.close(); + } + } + getOwner().getLogger().log(Level.WARNING, "Could not convert " + name + " to the Slime format."); + e.printStackTrace(); + } + } + + private void deleteWorldTrash(String world) { + for (File f : new File[]{/*new File(Bukkit.getWorldContainer(), world+"/level.dat"),*/ + new File(Bukkit.getWorldContainer(), world + "/level.dat_mcr"), + new File(Bukkit.getWorldContainer(), world + "/level.dat_old"), + new File(Bukkit.getWorldContainer(), world + "/session.lock"), + new File(Bukkit.getWorldContainer(), world + "/uid.dat")}) { + if (f.exists()) { + if (!f.delete()) { + getOwner().getLogger().warning("Could not delete: " + f.getPath()); + getOwner().getLogger().warning("This may cause issues!"); + } + } + } + } + + private void handleLevelDat(String world) throws IOException { + + File level = new File(Bukkit.getWorldContainer(), world + "/level.dat"); + + if (!level.exists()) { + if (level.createNewFile()) { + File regions = new File(Bukkit.getWorldContainer(), "world/region"); + if (regions.exists() && Objects.requireNonNull(regions.list()).length > 0) { + if (Arrays.stream(Objects.requireNonNull(regions.list())).filter(p -> p.endsWith(".mca")).toArray().length > 0) { + File region = new File(Bukkit.getWorldContainer(), world + "/" + Arrays.stream(Objects.requireNonNull(regions.list())).filter(p -> p.endsWith(".mca")).toArray()[0]); + NBTInputStream inputStream = new NBTInputStream(new FileInputStream(region)); + Optional tag = inputStream.readTag().getAsCompoundTag(); + inputStream.close(); + if (tag.isPresent()) { + Optional dataTag = tag.get().getAsCompoundTag("Chunk"); + if (dataTag.isPresent()) { + int dataVersion = dataTag.get().getIntValue("DataVersion").orElse(-1); + + NBTOutputStream outputStream = new NBTOutputStream(new FileOutputStream(level)); + + CompoundMap cm = new CompoundMap(); + cm.put(new IntTag("SpawnX", 0)); + cm.put(new IntTag("SpawnY", 255)); + cm.put(new IntTag("SpawnZ", 0)); + if (dataVersion != -1) { + cm.put(new IntTag("DataVersion", dataVersion)); + } + CompoundTag root = new CompoundTag("Data", cm); + outputStream.writeTag(root); + outputStream.flush(); + outputStream.close(); + } + } + } + } + } + } + } + + private @NotNull SlimePropertyMap getCreateProperties(int spawnX, int spawnY, int spawnZ) { + SlimePropertyMap spm = new SlimePropertyMap(); + spm.setString(SlimeProperties.WORLD_TYPE, "flat"); + spm.setInt(SlimeProperties.SPAWN_X, spawnX); + spm.setInt(SlimeProperties.SPAWN_Y, spawnY); + spm.setInt(SlimeProperties.SPAWN_Z, spawnZ); + spm.setBoolean(SlimeProperties.ALLOW_ANIMALS, false); + spm.setBoolean(SlimeProperties.ALLOW_MONSTERS, false); + spm.setString(SlimeProperties.DIFFICULTY, "easy"); + spm.setBoolean(SlimeProperties.PVP, true); + return spm; + } +} diff --git a/resetadapter_slime/pom.xml b/resetadapter_slime/pom.xml index 5f318fa21..f551ca914 100644 --- a/resetadapter_slime/pom.xml +++ b/resetadapter_slime/pom.xml @@ -7,7 +7,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT resetadapter-slime @@ -40,7 +40,7 @@ com.grinderwolf slimeworldmanager-api - [2.2.1,) + 2.2.1 provided diff --git a/resetadapter_slime/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimeAdapter.java b/resetadapter_slime/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimeAdapter.java index a5539718b..b137082a9 100644 --- a/resetadapter_slime/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimeAdapter.java +++ b/resetadapter_slime/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimeAdapter.java @@ -362,6 +362,11 @@ public void convertWorlds() { }); } + @Override + public String getDisplayName() { + return "Slime World Manager by Grinderwolf"; + } + private void convertWorld(String name, Player player) { SlimeLoader sl = slime.getLoader("file"); try { diff --git a/resetadapter_slimepaper/pom.xml b/resetadapter_slimepaper/pom.xml new file mode 100644 index 000000000..5a7422179 --- /dev/null +++ b/resetadapter_slimepaper/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + + BedWars1058 + com.andrei1058.bedwars + 23.10.1-SNAPSHOT + + + resetadapter-slimepaper + ${project.parent.version} + + + + 11 + 11 + + + + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + is-snapshots + https://repo.infernalsuite.com/repository/maven-snapshots/ + + + flow-nbt + https://repo.glaremasters.me/repository/concuncan/ + + + + + + com.andrei1058.bedwars + bedwars-api + ${project.version} + provided + + + org.spigotmc + spigot-api + 1.8.8-R0.1-SNAPSHOT + provided + + + com.infernalsuite.aswm + api + 1.20-R0.1-SNAPSHOT + provided + + + com.flowpowered + flow-nbt + 2.0.0 + compile + + + + + + + maven-deploy-plugin + + true + + + + + \ No newline at end of file diff --git a/resetadapter_slimepaper/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimePaperAdapter.java b/resetadapter_slimepaper/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimePaperAdapter.java new file mode 100644 index 000000000..78ca5eef7 --- /dev/null +++ b/resetadapter_slimepaper/src/main/java/com/andrei1058/bedwars/arena/mapreset/slime/SlimePaperAdapter.java @@ -0,0 +1,478 @@ +/* + * BedWars1058 - A bed wars mini-game. + * Copyright (C) 2023 Andrei Dascălu + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Contact e-mail: andrew.dascalu@gmail.com + */ + +package com.andrei1058.bedwars.arena.mapreset.slime; + +import com.andrei1058.bedwars.api.BedWars; +import com.andrei1058.bedwars.api.arena.GameState; +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.configuration.ConfigPath; +import com.andrei1058.bedwars.api.server.ISetupSession; +import com.andrei1058.bedwars.api.server.RestoreAdapter; +import com.andrei1058.bedwars.api.server.ServerType; +import com.andrei1058.bedwars.api.util.FileUtil; +import com.andrei1058.bedwars.api.util.ZipFileUtil; +import com.flowpowered.nbt.CompoundMap; +import com.flowpowered.nbt.CompoundTag; +import com.flowpowered.nbt.IntTag; +import com.flowpowered.nbt.stream.NBTInputStream; +import com.flowpowered.nbt.stream.NBTOutputStream; +import com.infernalsuite.aswm.api.SlimePlugin; +import com.infernalsuite.aswm.api.exceptions.*; +import com.infernalsuite.aswm.api.loaders.SlimeLoader; +import com.infernalsuite.aswm.api.world.SlimeWorld; +import com.infernalsuite.aswm.api.world.properties.SlimeProperties; +import com.infernalsuite.aswm.api.world.properties.SlimePropertyMap; +import org.apache.commons.io.FileUtils; +import org.bukkit.*; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.world.WorldInitEvent; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.*; +import java.util.logging.Level; + +public class SlimePaperAdapter extends RestoreAdapter { + + private final SlimePlugin slime; + private final BedWars api; + + public SlimePaperAdapter(Plugin plugin) { + super(plugin); + slime = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager"); + api = Objects.requireNonNull(Bukkit.getServer().getServicesManager().getRegistration(BedWars.class)).getProvider(); + } + + @Override + public void onEnable(@NotNull IArena a) { + if (api.getVersionSupport().getMainLevel().equalsIgnoreCase(a.getWorldName())) { + if (!(api.getServerType() == ServerType.BUNGEE && api.getArenaUtil().getGamesBeforeRestart() == 1)) { + FileUtil.setMainLevel("ignore_main_level", api.getVersionSupport()); + getOwner().getLogger().log(Level.SEVERE, "Cannot use level-name as arenas. Automatically creating a new void map for level-name."); + getOwner().getLogger().log(Level.SEVERE, "The server is restarting..."); + Bukkit.getServer().spigot().restart(); + return; + } + } + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + if (Bukkit.getWorld(a.getWorldName()) != null) { + Bukkit.getScheduler().runTask(getOwner(), () -> { + World w = Bukkit.getWorld(a.getWorldName()); + a.init(w); + }); + return; + } + + SlimeLoader flat = slime.getLoader("file"); + String[] spawn = a.getConfig().getString("waiting.Loc").split(","); + + SlimePropertyMap spm = getCreateProperties( + (int) Double.parseDouble(spawn[0]), + (int) Double.parseDouble(spawn[1]), + (int) Double.parseDouble(spawn[2]) + ); + + try { + // Note that this method should be called asynchronously + SlimeWorld world = slime.loadWorld(flat, a.getArenaName(), true, spm); + if (api.getServerType() == ServerType.BUNGEE && api.isAutoScale()) { + world = world.clone(a.getWorldName()); + } + + // This method must be called synchronously + SlimeWorld finalWorld = world; + Bukkit.getScheduler().runTask(getOwner(), () -> { + SlimeWorld loaded = slime.loadWorld(finalWorld); + if (null == loaded) { + api.getArenaUtil().removeFromEnableQueue(a); + getOwner().getLogger().severe("Something wrong... removing arena " + a.getArenaName() + " from queue."); + return; + } + World w = Bukkit.getWorld(loaded.getName()); + if (w == null) { + api.getArenaUtil().removeFromEnableQueue(a); + getOwner().getLogger().severe("Something wrong... removing arena " + a.getArenaName() + " from queue."); + return; + } + Bukkit.getPluginManager().callEvent(new WorldInitEvent(w)); + Bukkit.getScheduler().runTask(getOwner(), () -> { + Bukkit.getPluginManager().callEvent(new WorldLoadEvent(w)); + }); + }); + } catch (UnknownWorldException | IOException | CorruptedWorldException | NewerFormatException | + WorldLockedException ex) { + api.getArenaUtil().removeFromEnableQueue(a); + ex.printStackTrace(); + } catch (ConcurrentModificationException thisShouldNotHappenSWM) { + // this should not happen since they say to use #load async + // https://github.com/Grinderwolf/Slime-World-Manager/blob/develop/.docs/api/load-world.md + thisShouldNotHappenSWM.printStackTrace(); + api.getArenaUtil().removeFromEnableQueue(a); + getOwner().getLogger().severe("This is a AdvancedSlimePaper issue!"); + getOwner().getLogger().severe("I've submitted a bug report: https://github.com/Grinderwolf/Slime-World-Manager/issues/174"); + getOwner().getLogger().severe("Trying again to load arena: " + a.getArenaName()); + + // hope not to get an overflow + onEnable(a); + } + }); + } + + @Override + public void onRestart(IArena a) { + if (api.getServerType() == ServerType.BUNGEE) { + if (api.getArenaUtil().getGamesBeforeRestart() == 0) { + if (api.getArenaUtil().getArenas().size() == 1 && api.getArenaUtil().getArenas().get(0).getStatus() == GameState.restarting) { + getOwner().getLogger().info("Dispatching command: " + api.getConfigs().getMainConfig().getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_RESTART_CMD)); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), api.getConfigs().getMainConfig().getString(ConfigPath.GENERAL_CONFIGURATION_BUNGEE_OPTION_RESTART_CMD)); + } + } else { + if (api.getArenaUtil().getGamesBeforeRestart() != -1) { + api.getArenaUtil().setGamesBeforeRestart(api.getArenaUtil().getGamesBeforeRestart() - 1); + } + Bukkit.getScheduler().runTask(getOwner(), () -> { + Bukkit.unloadWorld(a.getWorldName(), false); + if (api.getArenaUtil().canAutoScale(a.getArenaName())) { + Bukkit.getScheduler().runTaskLater(getOwner(), () -> api.getArenaUtil().loadArena(a.getArenaName(), null), 80L); + } + }); + } + } else { + Bukkit.getScheduler().runTask(getOwner(), () -> { + Bukkit.unloadWorld(a.getWorldName(), false); + Bukkit.getScheduler().runTaskLater(getOwner(), () -> api.getArenaUtil().loadArena(a.getArenaName(), null), 80L); + }); + } + } + + @Override + public void onDisable(IArena a) { + if (api.isShuttingDown()) { + Bukkit.unloadWorld(a.getWorldName(), false); + return; + } + Bukkit.getScheduler().runTask(getOwner(), () -> Bukkit.unloadWorld(a.getWorldName(), false)); + } + + @Override + public void onSetupSessionStart(ISetupSession s) { + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + SlimeLoader sLoader = slime.getLoader("file"); + String[] spawn = new String[]{"0", "50", "0"}; + if (s.getConfig().getYml().getString("waiting.Loc") != null) { + spawn = s.getConfig().getString("waiting.Loc").split(","); + } + SlimePropertyMap spm = getCreateProperties( + (int) Double.parseDouble(spawn[0]), + (int) Double.parseDouble(spawn[1]), + (int) Double.parseDouble(spawn[2]) + ); + + try { + + if (Bukkit.getWorld(s.getWorldName()) != null) { + Bukkit.getScheduler().runTask(getOwner(), () -> Bukkit.unloadWorld(s.getWorldName(), false)); + } + + SlimeWorld world; + if (sLoader.worldExists(s.getWorldName())) { + world = slime.loadWorld(sLoader, s.getWorldName(), false, spm); + Bukkit.getScheduler().runTask(getOwner(), () -> s.getPlayer().sendMessage(ChatColor.GREEN + "Loading world from SlimeWorldManager container.")); + } else { + if (new File(Bukkit.getWorldContainer(), s.getWorldName() + "/level.dat").exists()) { + Bukkit.getScheduler().runTask(getOwner(), () -> s.getPlayer().sendMessage(ChatColor.GREEN + "Importing world to the SlimeWorldManager container.")); + slime.importWorld(new File(Bukkit.getWorldContainer(), s.getWorldName()), s.getWorldName().toLowerCase(), sLoader); + world = slime.loadWorld(sLoader, s.getWorldName(), false, spm); + } else { + Bukkit.getScheduler().runTask(getOwner(), () -> s.getPlayer().sendMessage(ChatColor.GREEN + "Creating anew void map.")); + world = slime.createEmptyWorld(sLoader, s.getWorldName(), false, spm); + } + } + + SlimeWorld sw = world; + // This method must be called synchronously + Bukkit.getScheduler().runTask(getOwner(), () -> { + if (null == sw) { + return; + } + World w = Bukkit.getWorld(sw.getName()); + if (w == null) { + return; + } + Bukkit.getPluginManager().callEvent(new WorldInitEvent(w)); + Bukkit.getScheduler().runTask(getOwner(), () -> { + Bukkit.getPluginManager().callEvent(new WorldLoadEvent(w)); + }); + s.teleportPlayer(); + }); + } catch (UnknownWorldException | IOException | CorruptedWorldException | NewerFormatException | + WorldAlreadyExistsException | InvalidWorldException | WorldTooBigException | WorldLoadedException | + WorldLockedException ex) { + s.getPlayer().sendMessage(ChatColor.RED + "An error occurred! Please check console."); + ex.printStackTrace(); + s.close(); + } + }); + } + + @Override + public void onSetupSessionClose(ISetupSession s) { + Objects.requireNonNull(Bukkit.getWorld(s.getWorldName())).save(); + Bukkit.getScheduler().runTask(getOwner(), () -> Bukkit.unloadWorld(s.getWorldName(), true)); + } + + @Override + public void onLobbyRemoval(IArena a) { + Location loc1 = a.getConfig().getArenaLoc(ConfigPath.ARENA_WAITING_POS1), + loc2 = a.getConfig().getArenaLoc(ConfigPath.ARENA_WAITING_POS2); + if (loc1 == null || loc2 == null) return; + Bukkit.getScheduler().runTask(getOwner(), () -> { + int minX, minY, minZ; + int maxX, maxY, maxZ; + minX = Math.min(loc1.getBlockX(), loc2.getBlockX()); + maxX = Math.max(loc1.getBlockX(), loc2.getBlockX()); + minY = Math.min(loc1.getBlockY(), loc2.getBlockY()); + maxY = Math.max(loc1.getBlockY(), loc2.getBlockY()); + minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ()); + maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ()); + + for (int x = minX; x < maxX; x++) { + for (int y = minY; y < maxY; y++) { + for (int z = minZ; z < maxZ; z++) { + Objects.requireNonNull(loc1.getWorld()).getBlockAt(x, y, z).setType(Material.AIR); + } + } + } + + Bukkit.getScheduler().runTaskLater(getOwner(), () -> + Objects.requireNonNull(loc1.getWorld()).getEntities().forEach(e -> { + if (e instanceof Item) e.remove(); + }), 15L); + }); + } + + @Override + public boolean isWorld(String name) { + try { + return slime.getLoader("file").worldExists(name); + } catch (IOException e) { + e.printStackTrace(); + } + return false; + } + + @Override + public void deleteWorld(String name) { + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + try { + slime.getLoader("file").deleteWorld(name); + } catch (UnknownWorldException | IOException e) { + e.printStackTrace(); + } + }); + } + + @Override + public void cloneArena(String name1, String name2) { + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + try { + // Note that this method should be called asynchronously + SlimeWorld world = slime.loadWorld( + slime.getLoader("file"), + name1, + true, + getCreateProperties(0, 118, 0) + ); + world.clone(name2, slime.getLoader("file")); + } catch (UnknownWorldException | IOException | CorruptedWorldException | NewerFormatException | + WorldLockedException | WorldAlreadyExistsException ex) { + ex.printStackTrace(); + } + }); + } + + @Override + public List getWorldsList() { + try { + return slime.getLoader("file").listWorlds(); + } catch (IOException e) { + e.printStackTrace(); + } + return new ArrayList<>(); + } + + /** + * Convert vanilla worlds to the slime format. + */ + public void convertWorlds() { + File dir = new File(getOwner().getDataFolder(), "/Arenas"); + File ff; + SlimeLoader sl = slime.getLoader("file"); + if (dir.exists()) { + File[] fls = dir.listFiles(); + if (fls != null) { + for (File fl : fls) { + if (fl.isFile()) { + if (fl.getName().endsWith(".yml")) { + final String name = fl.getName().replace(".yml", "").toLowerCase(); + ff = new File(Bukkit.getWorldContainer(), fl.getName().replace(".yml", "")); + try { + if (!sl.worldExists(name)) { + if (!fl.getName().equals(name)) { + if (!fl.renameTo(new File(dir, name + ".yml"))) { + getOwner().getLogger().log(Level.WARNING, "Could not rename " + fl.getName() + ".yml to " + name + ".yml"); + } + } + File bc = new File(getOwner().getDataFolder() + "/Cache", ff.getName() + ".zip"); + if (ff.exists() && bc.exists()) { + FileUtil.delete(ff); + ZipFileUtil.unzipFileIntoDirectory(bc, new File(Bukkit.getWorldContainer(), name)); + } + deleteWorldTrash(name); + handleLevelDat(name); + + convertWorld(name, null); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + } + Bukkit.getScheduler().runTaskAsynchronously(getOwner(), () -> { + File[] files = Bukkit.getWorldContainer().listFiles(); + if (files != null) { + for (File f : files) { + if (f != null && f.isDirectory()) { + if (f.getName().contains("bw_temp_")) { + try { + FileUtils.deleteDirectory(f); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + }); + } + + @Override + public String getDisplayName() { + return "Advanced Slime Paper by InfernalSuite"; + } + + @SuppressWarnings("SameParameterValue") + private void convertWorld(String name, Player player) { + SlimeLoader sl = slime.getLoader("file"); + try { + getOwner().getLogger().log(Level.INFO, "Converting " + name + " to the Slime format."); + slime.importWorld(new File(Bukkit.getWorldContainer(), name), name, sl); + } catch (WorldAlreadyExistsException | InvalidWorldException | WorldLoadedException | WorldTooBigException | + IOException e) { + if (player != null) { + player.sendMessage(ChatColor.RED + "Could not convert " + name + " to the Slime format."); + player.sendMessage(ChatColor.RED + "Check the console for details."); + ISetupSession s = api.getSetupSession(player.getUniqueId()); + if (s != null) { + s.close(); + } + } + getOwner().getLogger().log(Level.WARNING, "Could not convert " + name + " to the Slime format."); + e.printStackTrace(); + } + } + + private void deleteWorldTrash(String world) { + for (File f : new File[]{/*new File(Bukkit.getWorldContainer(), world+"/level.dat"),*/ + new File(Bukkit.getWorldContainer(), world + "/level.dat_mcr"), + new File(Bukkit.getWorldContainer(), world + "/level.dat_old"), + new File(Bukkit.getWorldContainer(), world + "/session.lock"), + new File(Bukkit.getWorldContainer(), world + "/uid.dat")}) { + if (f.exists()) { + if (!f.delete()) { + getOwner().getLogger().warning("Could not delete: " + f.getPath()); + getOwner().getLogger().warning("This may cause issues!"); + } + } + } + } + + private void handleLevelDat(String world) throws IOException { + + File level = new File(Bukkit.getWorldContainer(), world + "/level.dat"); + + if (!level.exists()) { + if (level.createNewFile()) { + File regions = new File(Bukkit.getWorldContainer(), "world/region"); + if (regions.exists() && Objects.requireNonNull(regions.list()).length > 0) { + if (Arrays.stream(Objects.requireNonNull(regions.list())).filter(p -> p.endsWith(".mca")).toArray().length > 0) { + File region = new File(Bukkit.getWorldContainer(), world + "/" + Arrays.stream(Objects.requireNonNull(regions.list())).filter(p -> p.endsWith(".mca")).toArray()[0]); + NBTInputStream inputStream = new NBTInputStream(new FileInputStream(region)); + Optional tag = inputStream.readTag().getAsCompoundTag(); + inputStream.close(); + if (tag.isPresent()) { + Optional dataTag = tag.get().getAsCompoundTag("Chunk"); + if (dataTag.isPresent()) { + int dataVersion = dataTag.get().getIntValue("DataVersion").orElse(-1); + + NBTOutputStream outputStream = new NBTOutputStream(new FileOutputStream(level)); + + CompoundMap cm = new CompoundMap(); + cm.put(new IntTag("SpawnX", 0)); + cm.put(new IntTag("SpawnY", 255)); + cm.put(new IntTag("SpawnZ", 0)); + if (dataVersion != -1) { + cm.put(new IntTag("DataVersion", dataVersion)); + } + CompoundTag root = new CompoundTag("Data", cm); + outputStream.writeTag(root); + outputStream.flush(); + outputStream.close(); + } + } + } + } + } + } + } + + private @NotNull SlimePropertyMap getCreateProperties(int spawnX, int spawnY, int spawnZ) { + SlimePropertyMap spm = new SlimePropertyMap(); + spm.setValue(SlimeProperties.WORLD_TYPE, "flat"); + spm.setValue(SlimeProperties.SPAWN_X, spawnX); + spm.setValue(SlimeProperties.SPAWN_Y, spawnY); + spm.setValue(SlimeProperties.SPAWN_Z, spawnZ); + spm.setValue(SlimeProperties.ALLOW_ANIMALS, false); + spm.setValue(SlimeProperties.ALLOW_MONSTERS, false); + spm.setValue(SlimeProperties.DIFFICULTY, "easy"); + spm.setValue(SlimeProperties.PVP, true); + return spm; + } +} diff --git a/versionsupport_1_12_R1/pom.xml b/versionsupport_1_12_R1/pom.xml index a6174c3ec..d0bf8ca1f 100644 --- a/versionsupport_1_12_R1/pom.xml +++ b/versionsupport_1_12_R1/pom.xml @@ -10,7 +10,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT diff --git a/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/Silverfish.java b/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/Silverfish.java index 16fb7265b..c9e1c5f11 100644 --- a/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/Silverfish.java +++ b/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/Silverfish.java @@ -143,7 +143,7 @@ public static LivingEntity spawn(Location loc, ITeam team, double speed, double customEnt.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(speed); customEnt.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(damage); ((CraftLivingEntity)customEnt.getBukkitEntity()).setRemoveWhenFarAway(false); - customEnt.setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME) + customEnt.setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME) .replace("{despawn}", String.valueOf(despawn) .replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH)+" ", 10)) .replace("{TeamColor}", team.getColor().chat().toString()))); diff --git a/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/v1_12_R1.java b/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/v1_12_R1.java index 6536622dc..86bec8d55 100644 --- a/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/v1_12_R1.java +++ b/versionsupport_1_12_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_12_R1/v1_12_R1.java @@ -346,13 +346,13 @@ public void colorBed(ITeam bwt) { } @Override - public void registerTntWhitelist() { + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { try { Field field = Block.class.getDeclaredField("durability"); field.setAccessible(true); - field.set(Block.getByName("glass"), 300f); - field.set(Block.getByName("stained_glass"), 300f); - field.set(Block.getByName("end_stone"), 69f); + field.set(Block.getByName("glass"), glassBlast); + field.set(Block.getByName("stained_glass"), glassBlast); + field.set(Block.getByName("end_stone"), endStoneBlast); } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } @@ -440,12 +440,6 @@ public org.bukkit.inventory.ItemStack createItemStack(String material, int amoun return i; } - @Override - public void teamCollideRule(Team team) { - team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); - team.setCanSeeFriendlyInvisibles(true); - } - @Override public boolean isPlayerHead(String material, int data) { return material.equals("SKULL_ITEM") && data == 3; @@ -726,6 +720,7 @@ public void placeTowerBlocks(org.bukkit.block.Block b, IArena a, TeamColor color @Override public void placeLadder(org.bukkit.block.Block b, int x, int y, int z, IArena a, int ladderdata){ b.getRelative(x, y, z).setType(Material.LADDER); + //noinspection deprecation b.getRelative(x, y, z).setData((byte)ladderdata); a.addPlacedBlock(b.getRelative(x, y, z)); } @@ -734,4 +729,5 @@ public void placeLadder(org.bukkit.block.Block b, int x, int y, int z, IArena a, public void playVillagerEffect(Player player, Location location){ player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); } + } diff --git a/versionsupport_1_8_R3/pom.xml b/versionsupport_1_8_R3/pom.xml index e1d9d05d4..d2800299b 100644 --- a/versionsupport_1_8_R3/pom.xml +++ b/versionsupport_1_8_R3/pom.xml @@ -7,7 +7,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT versionsupport_1_8_R3 diff --git a/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/Silverfish.java b/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/Silverfish.java index 19ff5ddb4..e9e79bb22 100644 --- a/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/Silverfish.java +++ b/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/Silverfish.java @@ -87,7 +87,7 @@ public static LivingEntity spawn(Location loc, ITeam team, double speed, double customEnt.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(speed); customEnt.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(damage); ((CraftLivingEntity)customEnt.getBukkitEntity()).setRemoveWhenFarAway(false); - customEnt.setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME) + customEnt.setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME) .replace("{despawn}", String.valueOf(despawn) .replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH)+" ", 10)) .replace("{TeamColor}", team.getColor().chat().toString()))); diff --git a/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/v1_8_R3.java b/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/v1_8_R3.java index dcde4de8d..7a3335db6 100644 --- a/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/v1_8_R3.java +++ b/versionsupport_1_8_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_8_R3/v1_8_R3.java @@ -49,7 +49,6 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.plugin.Plugin; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; import java.lang.reflect.Field; @@ -190,6 +189,12 @@ public boolean isInvisibilityPotion(org.bukkit.inventory.ItemStack itemStack) { return type.getEffectType().equals(org.bukkit.potion.PotionEffectType.INVISIBILITY); } + @Override + public boolean isGlass(Material type) { + // Avoids string search + return type == Material.GLASS || type == Material.STAINED_GLASS; + } + @Override public void registerEntities() { registerEntity("Silverfish2", 60, Silverfish.class); @@ -388,13 +393,13 @@ public void colorBed(ITeam bwt) { } @Override - public void registerTntWhitelist() { + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { try { Field field = Block.class.getDeclaredField("durability"); field.setAccessible(true); - field.set(Block.getByName("glass"), 300f); - field.set(Block.getByName("stained_glass"), 300f); - field.set(Block.getByName("end_stone"), 69f); + field.set(Block.getByName("glass"), glassBlast); + field.set(Block.getByName("stained_glass"), glassBlast); + field.set(Block.getByName("end_stone"), endStoneBlast); } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } @@ -483,11 +488,6 @@ public org.bukkit.inventory.ItemStack createItemStack(String material, int amoun return i; } - @Override - public void teamCollideRule(Team team) { - - } - @Override public boolean isPlayerHead(String material, int data) { return material.equals("SKULL_ITEM") && data == 3; @@ -761,6 +761,7 @@ public void placeTowerBlocks(org.bukkit.block.Block b, IArena a, TeamColor color @Override public void placeLadder(org.bukkit.block.Block b, int x, int y, int z, IArena a, int ladderdata){ b.getRelative(x, y, z).setType(Material.LADDER); + //noinspection deprecation b.getRelative(x, y, z).setData((byte)ladderdata); a.addPlacedBlock(b.getRelative(x, y, z)); } @@ -770,4 +771,5 @@ public void playVillagerEffect(Player player, Location location){ PacketPlayOutWorldParticles pwp = new PacketPlayOutWorldParticles(EnumParticle.VILLAGER_HAPPY, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), (float) 0, (float) 0, (float) 0, (float) 0, 1); ((CraftPlayer) player).getHandle().playerConnection.sendPacket(pwp); } + } diff --git a/versionsupport_common/pom.xml b/versionsupport_common/pom.xml index 185f49df8..a5b5a4003 100644 --- a/versionsupport_common/pom.xml +++ b/versionsupport_common/pom.xml @@ -5,7 +5,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT 4.0.0 diff --git a/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/ItemDropPickListener.java b/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/ItemDropPickListener.java index 441c7a001..4873d27c1 100644 --- a/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/ItemDropPickListener.java +++ b/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/ItemDropPickListener.java @@ -92,7 +92,7 @@ public void onArrowPick(PlayerPickupArrowEvent e){ */ private static boolean managePickup(Item item, LivingEntity player) { if (!(player instanceof Player)) return false; - if (api.getServerType() != ServerType.BUNGEE) { + if (api.getServerType() == ServerType.MULTIARENA) { //noinspection ConstantConditions if (player.getLocation().getWorld().getName().equalsIgnoreCase(api.getLobbyWorld())) { return true; @@ -145,7 +145,7 @@ private static boolean managePickup(Item item, LivingEntity player) { */ private static boolean manageDrop(Entity player, Item item) { if (!(player instanceof Player)) return false; - if (api.getServerType() != ServerType.BUNGEE) { + if (api.getServerType() == ServerType.MULTIARENA) { //noinspection ConstantConditions if (player.getLocation().getWorld().getName().equalsIgnoreCase(api.getLobbyWorld())) { return true; diff --git a/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/PlayerDropPick_1_11Minus.java b/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/PlayerDropPick_1_11Minus.java index eb32d70a3..fa1fd5749 100644 --- a/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/PlayerDropPick_1_11Minus.java +++ b/versionsupport_common/src/main/java/com/andrei1058/bedwars/listeners/PlayerDropPick_1_11Minus.java @@ -49,7 +49,7 @@ public PlayerDropPick_1_11Minus(BedWars bedWars){ @SuppressWarnings("deprecation") @EventHandler public void onPickup(PlayerPickupItemEvent e) { - if (api.getServerType() != ServerType.BUNGEE) { + if (api.getServerType() == ServerType.MULTIARENA) { //noinspection ConstantConditions if (e.getPlayer().getLocation().getWorld().getName().equalsIgnoreCase(api.getLobbyWorld())) { e.setCancelled(true); @@ -111,7 +111,7 @@ public void onPickup(PlayerPickupItemEvent e) { @EventHandler public void onDrop(PlayerDropItemEvent e) { - if (api.getServerType() != ServerType.BUNGEE) { + if (api.getServerType() == ServerType.MULTIARENA) { //noinspection ConstantConditions if (e.getPlayer().getLocation().getWorld().getName().equalsIgnoreCase(api.getLobbyWorld())) { e.setCancelled(true); diff --git a/versionsupport_v1_16_R3/pom.xml b/versionsupport_v1_16_R3/pom.xml index 26c2b0971..9e1d04258 100644 --- a/versionsupport_v1_16_R3/pom.xml +++ b/versionsupport_v1_16_R3/pom.xml @@ -5,7 +5,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT 4.0.0 diff --git a/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/Silverfish.java b/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/Silverfish.java index 883c1a880..4b5b7dce9 100644 --- a/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/Silverfish.java +++ b/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/Silverfish.java @@ -79,7 +79,7 @@ public static LivingEntity spawn(Location loc, ITeam team, double speed, double ((CraftLivingEntity)customEnt.getBukkitEntity()).setRemoveWhenFarAway(false); customEnt.setCustomNameVisible(true); mcWorld.addEntity(customEnt, CreatureSpawnEvent.SpawnReason.CUSTOM); - customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME) + customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME) .replace("{despawn}", String.valueOf(despawn) .replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH)+" ", 10)) .replace("{TeamColor}", team.getColor().chat().toString()))); diff --git a/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/v1_16_R3.java b/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/v1_16_R3.java index 54294f25c..cbf392e89 100644 --- a/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/v1_16_R3.java +++ b/versionsupport_v1_16_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_16_R3/v1_16_R3.java @@ -57,7 +57,6 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.plugin.Plugin; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; @@ -327,12 +326,32 @@ public void colorBed(ITeam bwt) { } @Override - public void registerTntWhitelist() { + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { try { Field field = net.minecraft.server.v1_16_R3.BlockBase.class.getDeclaredField("durability"); field.setAccessible(true); - field.set(Blocks.END_STONE, 12f); - field.set(Blocks.GLASS, 300f); + for (net.minecraft.server.v1_16_R3.Block glass : new net.minecraft.server.v1_16_R3.Block[]{ + Blocks.WHITE_STAINED_GLASS, + Blocks.ORANGE_STAINED_GLASS, + Blocks.MAGENTA_STAINED_GLASS, + Blocks.LIGHT_BLUE_STAINED_GLASS, + Blocks.YELLOW_STAINED_GLASS, + Blocks.LIME_STAINED_GLASS, + Blocks.PINK_STAINED_GLASS, + Blocks.GRAY_STAINED_GLASS, + Blocks.LIGHT_GRAY_STAINED_GLASS, + Blocks.CYAN_STAINED_GLASS, + Blocks.PURPLE_STAINED_GLASS, + Blocks.BLUE_STAINED_GLASS, + Blocks.BROWN_STAINED_GLASS, + Blocks.GREEN_STAINED_GLASS, + Blocks.RED_STAINED_GLASS, + Blocks.BLACK_STAINED_GLASS, + Blocks.GLASS, + }) { + field.set(glass, glassBlast); + } + field.set(Blocks.END_STONE, endStoneBlast); } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } @@ -428,12 +447,6 @@ public org.bukkit.inventory.ItemStack createItemStack(String material, int amoun return i; } - @Override - public void teamCollideRule(Team team) { - team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); - team.setCanSeeFriendlyInvisibles(true); - } - @Override public org.bukkit.Material materialFireball() { return org.bukkit.Material.FIRE_CHARGE; @@ -720,4 +733,5 @@ public void placeLadder(Block b, int x, int y,int z, IArena a, int ladderdata){ public void playVillagerEffect(@NotNull Player player, Location location){ player.spawnParticle(org.bukkit.Particle.VILLAGER_HAPPY, location, 1); } + } diff --git a/versionsupport_v1_17_R1/pom.xml b/versionsupport_v1_17_R1/pom.xml index 9d758b14b..7ca5af14c 100644 --- a/versionsupport_v1_17_R1/pom.xml +++ b/versionsupport_v1_17_R1/pom.xml @@ -5,7 +5,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT 4.0.0 diff --git a/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/Silverfish.java b/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/Silverfish.java index f11cf0ee6..615fd31f6 100644 --- a/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/Silverfish.java +++ b/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/Silverfish.java @@ -90,7 +90,7 @@ public static LivingEntity spawn(Location loc, ITeam team, double speed, double ((CraftLivingEntity)customEnt.getBukkitEntity()).setRemoveWhenFarAway(false); customEnt.setCustomNameVisible(true); mcWorld.addEntity(customEnt, CreatureSpawnEvent.SpawnReason.CUSTOM); - customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME) + customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME) .replace("{despawn}", String.valueOf(despawn) .replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH)+" ", 10)) .replace("{TeamColor}", team.getColor().chat().toString()))); diff --git a/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/v1_17_R1.java b/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/v1_17_R1.java index 26df79a8b..654a9f238 100644 --- a/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/v1_17_R1.java +++ b/versionsupport_v1_17_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_17_R1/v1_17_R1.java @@ -179,7 +179,6 @@ public void setSource(TNTPrimed tnt, Player owner) { EntityLiving nmsEntityLiving = (((CraftLivingEntity) owner).getHandle()); EntityTNTPrimed nmsTNT = (((CraftTNTPrimed) tnt).getHandle()); try { - //noinspection JavaReflectionMemberAccess Field sourceField = EntityTNTPrimed.class.getDeclaredField("d"); sourceField.setAccessible(true); sourceField.set(nmsTNT, nmsEntityLiving); @@ -354,12 +353,34 @@ public void colorBed(ITeam bwt) { } @Override - public void registerTntWhitelist() { + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { try { Field field = BlockBase.class.getDeclaredField("aI"); field.setAccessible(true); - field.set(Blocks.eq, 12f); - field.set(Blocks.au, 300f); + + for (net.minecraft.world.level.block.Block glass : new net.minecraft.world.level.block.Block[]{ + Blocks.au, + Blocks.dg, + Blocks.dh, + Blocks.di, + Blocks.dj, + Blocks.dk, + Blocks.dl, + Blocks.dm, + Blocks.dn, + Blocks.do_, + Blocks.dp, + Blocks.dq, + Blocks.dr, + Blocks.ds, + Blocks.dt, + Blocks.du, + Blocks.dv, + }) { + field.set(glass, glassBlast); + } + field.set(Blocks.eq, endStoneBlast); + } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } @@ -455,12 +476,6 @@ public org.bukkit.inventory.ItemStack createItemStack(String material, int amoun return i; } - @Override - public void teamCollideRule(Team team) { - team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); - team.setCanSeeFriendlyInvisibles(true); - } - @Override public org.bukkit.Material materialFireball() { return org.bukkit.Material.FIRE_CHARGE; @@ -752,4 +767,5 @@ public void placeLadder(Block b, int x, int y,int z, IArena a, int ladderdata){ public void playVillagerEffect(Player player, Location location){ player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); } + } diff --git a/versionsupport_v1_18_R2/pom.xml b/versionsupport_v1_18_R2/pom.xml index df95ac88e..def00468f 100644 --- a/versionsupport_v1_18_R2/pom.xml +++ b/versionsupport_v1_18_R2/pom.xml @@ -5,7 +5,7 @@ BedWars1058 com.andrei1058.bedwars - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT 4.0.0 diff --git a/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/Silverfish.java b/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/Silverfish.java index 4a28f6aae..465502faf 100644 --- a/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/Silverfish.java +++ b/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/Silverfish.java @@ -98,7 +98,7 @@ public static LivingEntity spawn(Location loc, ITeam team, double speed, double ((CraftLivingEntity) customEnt.getBukkitEntity()).setRemoveWhenFarAway(true); ((CraftLivingEntity) customEnt.getBukkitEntity()).setPersistent(true); - customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME) + customEnt.getBukkitEntity().setCustomName(Language.getDefaultLanguage().m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME) .replace("{despawn}", String.valueOf(despawn) .replace("{health}", StringUtils.repeat(Language.getDefaultLanguage().m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) .replace("{TeamColor}", team.getColor().chat().toString()))); diff --git a/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/v1_18_R2.java b/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/v1_18_R2.java index b66f00516..b0b29c190 100644 --- a/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/v1_18_R2.java +++ b/versionsupport_v1_18_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_18_R2/v1_18_R2.java @@ -334,12 +334,34 @@ public void colorBed(ITeam bwt) { } @Override - public void registerTntWhitelist() { + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { try { Field field = BlockBase.class.getDeclaredField("aH"); field.setAccessible(true); - field.set(Blocks.eq, 300f); - field.set(Blocks.bQ, 300f); + + for (net.minecraft.world.level.block.Block glass : new net.minecraft.world.level.block.Block[]{ + Blocks.bQ, + Blocks.dg, + Blocks.dh, + Blocks.di, + Blocks.dj, + Blocks.dk, + Blocks.dl, + Blocks.dm, + Blocks.dn, +// Blocks.do, + Blocks.dp, + Blocks.dq, + Blocks.dr, + Blocks.ds, + Blocks.dt, + Blocks.du, + Blocks.dv, + }) { + field.set(glass, glassBlast); + } + field.set(Blocks.eq, endStoneBlast); + } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } @@ -435,12 +457,6 @@ public org.bukkit.inventory.ItemStack createItemStack(String material, int amoun return i; } - @Override - public void teamCollideRule(Team team) { - team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); - team.setCanSeeFriendlyInvisibles(true); - } - @Override public org.bukkit.Material materialFireball() { return org.bukkit.Material.FIRE_CHARGE; @@ -720,4 +736,5 @@ public void placeLadder(@NotNull Block b, int x, int y, int z, @NotNull IArena a public void playVillagerEffect(@NotNull Player player, Location location){ player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); } + } diff --git a/versionsupport_v1_19_R2/pom.xml b/versionsupport_v1_19_R2/pom.xml index 6e91e2e5d..354b6ea9d 100644 --- a/versionsupport_v1_19_R2/pom.xml +++ b/versionsupport_v1_19_R2/pom.xml @@ -6,7 +6,7 @@ com.andrei1058.bedwars BedWars1058 - 22.9-SNAPSHOT + 23.10.1-SNAPSHOT versionsupport_v1_19_R2 diff --git a/versionsupport_v1_19_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R2/v1_19_R2.java b/versionsupport_v1_19_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R2/v1_19_R2.java index 575b0a06c..04f57d23a 100644 --- a/versionsupport_v1_19_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R2/v1_19_R2.java +++ b/versionsupport_v1_19_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R2/v1_19_R2.java @@ -334,18 +334,17 @@ public void colorBed(ITeam bwt) { } @Override - public void registerTntWhitelist() { + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { try { - var protection = 300f; // blast resistance Field field = BlockBase.class.getDeclaredField("aH"); field.setAccessible(true); // end stone - field.set(Blocks.fj, protection); + field.set(Blocks.fj, endStoneBlast); // obsidian - field.set(Blocks.ce, protection); + field.set(Blocks.ce, glassBlast); // standard glass - field.set(Blocks.aH, protection); + field.set(Blocks.aH, glassBlast); var coloredGlass = new net.minecraft.world.level.block.Block[]{ Blocks.dU, Blocks.dV, Blocks.dW, Blocks.dX, @@ -358,7 +357,7 @@ public void registerTntWhitelist() { Arrays.stream(coloredGlass).forEach( glass -> { try { - field.set(glass, protection); + field.set(glass, glassBlast); } catch (IllegalAccessException e) { throw new RuntimeException(e); } @@ -441,12 +440,6 @@ public org.bukkit.inventory.ItemStack createItemStack(String material, int amoun return i; } - @Override - public void teamCollideRule(@NotNull Team team) { - team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); - team.setCanSeeFriendlyInvisibles(true); - } - @Override public org.bukkit.Material materialFireball() { return org.bukkit.Material.FIRE_CHARGE; @@ -831,4 +824,5 @@ public void placeLadder(@NotNull Block b, int x, int y, int z, @NotNull IArena a public void playVillagerEffect(@NotNull Player player, Location location){ player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); } + } \ No newline at end of file diff --git a/versionsupport_v1_19_R3/pom.xml b/versionsupport_v1_19_R3/pom.xml new file mode 100644 index 000000000..f0bcac348 --- /dev/null +++ b/versionsupport_v1_19_R3/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.andrei1058.bedwars + BedWars1058 + 23.10.1-SNAPSHOT + + + versionsupport_v1_19_R3 + + + 1.19 + 1.19 + UTF-8 + + + + + com.andrei1058.bedwars + bedwars-api + ${project.version} + jar + provided + + + com.andrei1058.bedwars + versionsupport-common + ${project.version} + jar + provided + + + org.spigotmc + spigot + 1.19.4-R0.1-SNAPSHOT + jar + provided + + + + + + + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 17 + 17 + + + + + + \ No newline at end of file diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableAttributes.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableAttributes.java new file mode 100644 index 000000000..cbabe1d59 --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableAttributes.java @@ -0,0 +1,5 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3.despawnable; + +public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) { + +} diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableFactory.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableFactory.java new file mode 100644 index 000000000..60cd226ff --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableFactory.java @@ -0,0 +1,27 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.server.VersionSupport; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class DespawnableFactory { + + private final VersionSupport versionSupport; + private final List> providers = new ArrayList<>(); + + public DespawnableFactory(VersionSupport versionSupport) { + this.versionSupport = versionSupport; + providers.add(new TeamIronGolem()); + providers.add(new TeamSilverfish()); + } + + public LivingEntity spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team){ + return providers.stream().filter(provider -> provider.getType() == attr.type()) + .findFirst().orElseThrow().spawn(attr, location,team, versionSupport); + } +} diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableProvider.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableProvider.java new file mode 100644 index 000000000..fd63ab2a4 --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableProvider.java @@ -0,0 +1,71 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityCreature; +import net.minecraft.world.entity.EntityInsentient; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.ai.attributes.GenericAttributes; +import net.minecraft.world.entity.ai.goal.PathfinderGoal; +import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget; +import net.minecraft.world.entity.player.EntityHuman; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEntity; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public abstract class DespawnableProvider { + + abstract DespawnableType getType(); + + abstract String getDisplayName(DespawnableAttributes attr, ITeam team); + + abstract T spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api); + + protected boolean notSameTeam(@NotNull Entity entity, ITeam team, @NotNull VersionSupport api) { + var despawnable = api.getDespawnablesList().getOrDefault(entity.getBukkitEntity().getUniqueId(), null); + return null == despawnable || despawnable.getTeam() != team; + } + + protected PathfinderGoalSelector getTargetSelector(@NotNull EntityCreature entityLiving) { + return entityLiving.bO; + } + + protected PathfinderGoalSelector getGoalSelector(@NotNull EntityCreature entityLiving) { + return entityLiving.bN; + } + + protected void clearSelectors(@NotNull EntityCreature entityLiving) { + entityLiving.bO.b().clear(); + entityLiving.bN.b().clear(); + } + + protected PathfinderGoal getTargetGoal(EntityInsentient entity, ITeam team, VersionSupport api) { + return new PathfinderGoalNearestAttackableTarget<>(entity, EntityLiving.class, 20, true, false, + entityLiving -> { + if (entityLiving instanceof EntityHuman) { + return !((EntityHuman) entityLiving).getBukkitEntity().isDead() && + !team.wasMember(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()) && + !team.getArena().isReSpawning(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()) + && !team.getArena().isSpectator(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()); + } + return notSameTeam(entityLiving, team, api); + }); + } + + protected void applyDefaultSettings(org.bukkit.entity.@NotNull LivingEntity bukkitEntity, DespawnableAttributes attr, + ITeam team) { + bukkitEntity.setRemoveWhenFarAway(false); + bukkitEntity.setPersistent(true); + bukkitEntity.setCustomNameVisible(true); + bukkitEntity.setCustomName(getDisplayName(attr, team)); + + var entity = ((EntityInsentient)((CraftEntity)bukkitEntity).getHandle()); + Objects.requireNonNull(entity.a(GenericAttributes.a)).a(attr.health()); + Objects.requireNonNull(entity.a(GenericAttributes.d)).a(attr.speed()); + Objects.requireNonNull(entity.a(GenericAttributes.f)).a(attr.damage()); + } +} diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableType.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableType.java new file mode 100644 index 000000000..f72749991 --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/DespawnableType.java @@ -0,0 +1,6 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3.despawnable; + +public enum DespawnableType { + IRON_GOLEM, + SILVERFISH +} diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamIronGolem.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamIronGolem.java new file mode 100644 index 000000000..5e13b72b0 --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamIronGolem.java @@ -0,0 +1,58 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat; +import net.minecraft.world.entity.ai.goal.PathfinderGoalMeleeAttack; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStroll; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalHurtByTarget; +import net.minecraft.world.entity.animal.EntityIronGolem; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.IronGolem; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class TeamIronGolem extends DespawnableProvider { + + @Override + public DespawnableType getType() { + return DespawnableType.IRON_GOLEM; + } + + @Override + String getDisplayName(@NotNull DespawnableAttributes attr, @NotNull ITeam team) { + Language lang = Language.getDefaultLanguage(); + return lang.m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME).replace("{despawn}", String.valueOf(attr.despawnSeconds()) + .replace("{health}", StringUtils.repeat(lang.m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) + .replace("{TeamColor}", team.getColor().chat().toString()) + ); + } + + public @NotNull IronGolem spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api) { + + var bukkitEntity = (IronGolem) Objects.requireNonNull(location.getWorld()).spawnEntity(location, EntityType.IRON_GOLEM); + applyDefaultSettings(bukkitEntity, attr, team); + + var entity = (EntityIronGolem) ((CraftEntity) bukkitEntity).getHandle(); + + clearSelectors(entity); + var goalSelector = getGoalSelector(entity); + var targetSelector = getTargetSelector(entity); + + goalSelector.a(1, new PathfinderGoalFloat(entity)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(entity, 1.5D, false)); + goalSelector.a(3, new PathfinderGoalRandomStroll(entity, 1D)); + goalSelector.a(4, new PathfinderGoalRandomLookaround(entity)); + targetSelector.a(1, new PathfinderGoalHurtByTarget(entity)); + targetSelector.a(2, getTargetGoal(entity, team, api)); + + return bukkitEntity; + } +} diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamSilverfish.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamSilverfish.java new file mode 100644 index 000000000..9db8307d9 --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/despawnable/TeamSilverfish.java @@ -0,0 +1,56 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat; +import net.minecraft.world.entity.ai.goal.PathfinderGoalMeleeAttack; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStroll; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalHurtByTarget; +import net.minecraft.world.entity.monster.EntitySilverfish; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_19_R3.entity.CraftEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Silverfish; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class TeamSilverfish extends DespawnableProvider { + @Override + public DespawnableType getType() { + return DespawnableType.SILVERFISH; + } + + @Override + String getDisplayName(@NotNull DespawnableAttributes attr, @NotNull ITeam team) { + Language lang = Language.getDefaultLanguage(); + return lang.m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME).replace("{despawn}", String.valueOf(attr.despawnSeconds()) + .replace("{health}", StringUtils.repeat(lang.m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) + .replace("{TeamColor}", team.getColor().chat().toString()) + ); + } + + @Override + public Silverfish spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api) { + var bukkitEntity = (Silverfish) Objects.requireNonNull(location.getWorld()).spawnEntity(location, EntityType.SILVERFISH); + applyDefaultSettings(bukkitEntity, attr, team); + + var entity = (EntitySilverfish) ((CraftEntity) bukkitEntity).getHandle(); + clearSelectors(entity); + + var goalSelector = getGoalSelector(entity); + var targetSelector = getTargetSelector(entity); + goalSelector.a(1, new PathfinderGoalFloat(entity)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(entity, 1.9D, false)); + goalSelector.a(3, new PathfinderGoalRandomStroll(entity, 2D)); + goalSelector.a(4, new PathfinderGoalRandomLookaround(entity)); + targetSelector.a(1, new PathfinderGoalHurtByTarget(entity)); + targetSelector.a(2, getTargetGoal(entity, team, api)); + + return bukkitEntity; + } +} diff --git a/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/v1_19_R3.java b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/v1_19_R3.java new file mode 100644 index 000000000..62d570bce --- /dev/null +++ b/versionsupport_v1_19_R3/src/main/java/com/andrei1058/bedwars/support/version/v1_19_R3/v1_19_R3.java @@ -0,0 +1,824 @@ +package com.andrei1058.bedwars.support.version.v1_19_R3; + +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.shop.ShopHolo; +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.arena.team.TeamColor; +import com.andrei1058.bedwars.api.entity.Despawnable; +import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import com.andrei1058.bedwars.support.version.common.VersionCommon; +import com.andrei1058.bedwars.support.version.v1_19_R3.despawnable.DespawnableAttributes; +import com.andrei1058.bedwars.support.version.v1_19_R3.despawnable.DespawnableFactory; +import com.andrei1058.bedwars.support.version.v1_19_R3.despawnable.DespawnableType; +import com.mojang.datafixers.util.Pair; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; +import net.minecraft.core.particles.ParticleParamRedstone; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.protocol.game.*; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.level.EntityPlayer; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.EnumItemSlot; +import net.minecraft.world.entity.item.EntityTNTPrimed; +import net.minecraft.world.entity.projectile.EntityFireball; +import net.minecraft.world.entity.projectile.IProjectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBase; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.data.type.Bed; +import org.bukkit.block.data.type.Ladder; +import org.bukkit.block.data.type.WallSign; +import org.bukkit.command.Command; +import org.bukkit.craftbukkit.v1_19_R3.CraftServer; +import org.bukkit.craftbukkit.v1_19_R3.entity.*; +import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack; +import org.bukkit.entity.*; +import org.bukkit.event.inventory.InventoryEvent; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.joml.Vector3f; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.logging.Level; + +@SuppressWarnings("unused") +public class v1_19_R3 extends VersionSupport { + + private final DespawnableFactory despawnableFactory; + + public v1_19_R3(Plugin plugin, String name) { + super(plugin, name); + loadDefaultEffects(); + this.despawnableFactory = new DespawnableFactory(this); + } + + @Override + public void registerVersionListeners() { + new VersionCommon(this); + } + + @Override + public void registerCommand(String name, Command cmd) { + ((CraftServer) getPlugin().getServer()).getCommandMap().register(name, cmd); + } + + @Override + public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) { + var tag = getTag(itemStack); + return tag == null ? null : tag.e(key) ? tag.l(key) : null; + } + + @Override + public void sendTitle(@NotNull Player p, String title, String subtitle, int fadeIn, int stay, int fadeOut) { + p.sendTitle(title == null ? " " : title, subtitle == null ? " " : subtitle, fadeIn, stay, fadeOut); + } + + public void spawnSilverfish(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn, double damage) { + var attr = new DespawnableAttributes(DespawnableType.SILVERFISH, speed, health, damage, despawn); + var entity = despawnableFactory.spawn(attr, loc, bedWarsTeam); + + new Despawnable( + entity, + bedWarsTeam, despawn, + Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME, + PlayerKillEvent.PlayerKillCause.SILVERFISH_FINAL_KILL, + PlayerKillEvent.PlayerKillCause.SILVERFISH + ); + } + + @Override + public void spawnIronGolem(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn) { + var attr = new DespawnableAttributes(DespawnableType.IRON_GOLEM, speed, health, 4, despawn); + var entity = despawnableFactory.spawn(attr, loc, bedWarsTeam); + new Despawnable( + entity, + bedWarsTeam, despawn, + Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME, + PlayerKillEvent.PlayerKillCause.IRON_GOLEM_FINAL_KILL, + PlayerKillEvent.PlayerKillCause.IRON_GOLEM + ); + } + + @Override + public void playAction(@NotNull Player p, String text) { + p.spigot().sendMessage( + ChatMessageType.ACTION_BAR, + new TextComponent(ChatColor.translateAlternateColorCodes('&', text) + ) + ); + } + + @Override + public boolean isBukkitCommandRegistered(String name) { + return ((CraftServer) getPlugin().getServer()).getCommandMap().getCommand(name) != null; + } + + @Override + public org.bukkit.inventory.ItemStack getItemInHand(@NotNull Player p) { + return p.getInventory().getItemInMainHand(); + } + + @Override + public void hideEntity(@NotNull Entity e, Player p) { + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(e.getEntityId()); + ((CraftPlayer) p).getHandle().b.a(packet); + + } + + @Override + public void minusAmount(Player p, org.bukkit.inventory.@NotNull ItemStack i, int amount) { + if (i.getAmount() - amount <= 0) { + if (p.getInventory().getItemInOffHand().equals(i)) { + p.getInventory().setItemInOffHand(null); + } else { + p.getInventory().removeItem(i); + } + return; + } + i.setAmount(i.getAmount() - amount); + p.updateInventory(); + } + + @Override + public void setSource(TNTPrimed tnt, Player owner) { + EntityLiving nmsEntityLiving = (((CraftLivingEntity) owner).getHandle()); + EntityTNTPrimed nmsTNT = (((CraftTNTPrimed) tnt).getHandle()); + try { + Field sourceField = EntityTNTPrimed.class.getDeclaredField("d"); + sourceField.setAccessible(true); + sourceField.set(nmsTNT, nmsEntityLiving); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Override + public boolean isArmor(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemArmor || i instanceof ItemElytra; + + } + + @Override + public boolean isTool(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemTool; + } + + @Override + public boolean isSword(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemSword; + } + + @Override + public boolean isAxe(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemAxe; + } + + @Override + public boolean isBow(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemBow; + } + + @Override + public boolean isProjectile(org.bukkit.inventory.ItemStack itemStack) { + var entity = getEntity(itemStack); + if (null == entity) return false; + return entity instanceof IProjectile; + } + + @Override + public boolean isInvisibilityPotion(org.bukkit.inventory.@NotNull ItemStack itemStack) { + if (!itemStack.getType().equals(org.bukkit.Material.POTION)) return false; + + org.bukkit.inventory.meta.PotionMeta pm = (org.bukkit.inventory.meta.PotionMeta) itemStack.getItemMeta(); + + return pm != null && pm.hasCustomEffects() && pm.hasCustomEffect(org.bukkit.potion.PotionEffectType.INVISIBILITY); + } + + @Override + public void registerEntities() { + } + + @Override + public void spawnShop(@NotNull Location loc, String name1, List players, IArena arena) { + Location l = loc.clone(); + + if (l.getWorld() == null) return; + Villager vlg = (Villager) l.getWorld().spawnEntity(loc, EntityType.VILLAGER); + vlg.setAI(false); + vlg.setRemoveWhenFarAway(false); + vlg.setCollidable(false); + vlg.setInvulnerable(true); + vlg.setSilent(true); + + for (Player p : players) { + String[] name = Language.getMsg(p, name1).split(","); + if (name.length == 1) { + ArmorStand a = createArmorStand(name[0], l.clone().add(0, 1.85, 0)); + new ShopHolo(Language.getPlayerLanguage(p).getIso(), a, null, l, arena); + } else { + ArmorStand a = createArmorStand(name[0], l.clone().add(0, 2.1, 0)); + ArmorStand b = createArmorStand(name[1], l.clone().add(0, 1.85, 0)); + new ShopHolo(Language.getPlayerLanguage(p).getIso(), a, b, l, arena); + } + } + for (ShopHolo sh : ShopHolo.getShopHolo()) { + if (sh.getA() == arena) { + sh.update(); + } + } + } + + @Override + public double getDamage(org.bukkit.inventory.ItemStack i) { + var tag = getTag(i); + if (null == tag) { + throw new RuntimeException("Provided item has no Tag"); + } + return tag.k("generic.attackDamage"); + } + + private static ArmorStand createArmorStand(String name, Location loc) { + if (loc == null) return null; + if (loc.getWorld() == null) return null; + ArmorStand a = loc.getWorld().spawn(loc, ArmorStand.class); + a.setGravity(false); + a.setVisible(false); + a.setCustomNameVisible(true); + a.setCustomName(name); + return a; + } + + @Override + public void voidKill(Player p) { + EntityPlayer player = getPlayer(p); + player.a(player.dG().l(), 1000); + } + + @Override + public void hideArmor(@NotNull Player victim, Player receiver) { + List> items = new ArrayList<>(); + items.add(new Pair<>(EnumItemSlot.f, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.e, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.d, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.c, new ItemStack(Item.b(0)))); + PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items); + EntityPlayer pc = getPlayer(receiver); + pc.b.a(packet1); + } + + @Override + public void showArmor(@NotNull Player victim, Player receiver) { + List> items = new ArrayList<>(); + items.add(new Pair<>(EnumItemSlot.f, CraftItemStack.asNMSCopy(victim.getInventory().getHelmet()))); + items.add(new Pair<>(EnumItemSlot.e, CraftItemStack.asNMSCopy(victim.getInventory().getChestplate()))); + items.add(new Pair<>(EnumItemSlot.d, CraftItemStack.asNMSCopy(victim.getInventory().getLeggings()))); + items.add(new Pair<>(EnumItemSlot.c, CraftItemStack.asNMSCopy(victim.getInventory().getBoots()))); + PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items); + EntityPlayer pc = getPlayer(receiver); + pc.b.a(packet1); + } + + @Override + public void spawnDragon(Location l, ITeam bwt) { + if (l == null || l.getWorld() == null) { + getPlugin().getLogger().log(Level.WARNING, "Could not spawn Dragon. Location is null"); + return; + } + EnderDragon ed = (EnderDragon) l.getWorld().spawnEntity(l, EntityType.ENDER_DRAGON); + ed.setPhase(EnderDragon.Phase.CIRCLING); + } + + @Override + public void colorBed(ITeam bwt) { + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + BlockState bed = bwt.getBed().clone().add(x, 0, z).getBlock().getState(); + if (bed instanceof Bed) { + bed.setType(bwt.getColor().bedMaterial()); + bed.update(); + } + } + } + } + + @Override + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { + try { + var protection = 300f; + // blast resistance + Field field = BlockBase.class.getDeclaredField("aH"); + field.setAccessible(true); + // end stone + field.set(Blocks.fj, endStoneBlast); + // obsidian + field.set(Blocks.ce, glassBlast); + // standard glass + field.set(Blocks.aH, glassBlast); + + var coloredGlass = new net.minecraft.world.level.block.Block[]{ + Blocks.dU, Blocks.dV, Blocks.dW, Blocks.dX, + Blocks.dY, Blocks.dZ, Blocks.dZ, Blocks.ea, + Blocks.eb, Blocks.ec, Blocks.ed, Blocks.ee, + Blocks.ef, Blocks.eg, Blocks.eh, Blocks.ei, + Blocks.ej, + }; + + Arrays.stream(coloredGlass).forEach( + glass -> { + try { + field.set(glass, protection); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + ); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + @Override + public void setBlockTeamColor(@NotNull Block block, TeamColor teamColor) { + if (block.getType().toString().contains("STAINED_GLASS") || block.getType().toString().equals("GLASS")) { + block.setType(teamColor.glassMaterial()); + } else if (block.getType().toString().contains("_TERRACOTTA")) { + block.setType(teamColor.glazedTerracottaMaterial()); + } else if (block.getType().toString().contains("_WOOL")) { + block.setType(teamColor.woolMaterial()); + } + } + + @Override + public void setCollide(@NotNull Player p, IArena a, boolean value) { + p.setCollidable(value); + if (a == null) return; + a.updateSpectatorCollideRule(p, value); + } + + @Override + public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemStack i, String data) { + var tag = getCreateTag(i); + tag.a(VersionSupport.PLUGIN_TAG_GENERIC_KEY, data); + return applyTag(i, tag); + } + + @Override + public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) { + var tag = getCreateTag(itemStack); + tag.a(key, value); + return applyTag(itemStack, tag); + } + + @Override + public boolean isCustomBedWarsItem(org.bukkit.inventory.ItemStack i) { + return getCreateTag(i).e(VersionSupport.PLUGIN_TAG_GENERIC_KEY); + } + + @Override + public String getCustomData(org.bukkit.inventory.ItemStack i) { + return getCreateTag(i).l(VersionSupport.PLUGIN_TAG_GENERIC_KEY); + } + + @Override + public org.bukkit.inventory.ItemStack colourItem(org.bukkit.inventory.ItemStack itemStack, ITeam bedWarsTeam) { + if (itemStack == null) return null; + String type = itemStack.getType().toString(); + if (isBed(itemStack.getType())) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().bedMaterial(), itemStack.getAmount()); + } else if (type.contains("_STAINED_GLASS_PANE")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glassPaneMaterial(), itemStack.getAmount()); + } else if (type.contains("STAINED_GLASS") || type.equals("GLASS")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glassMaterial(), itemStack.getAmount()); + } else if (type.contains("_TERRACOTTA")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glazedTerracottaMaterial(), itemStack.getAmount()); + } else if (type.contains("_WOOL")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().woolMaterial(), itemStack.getAmount()); + } + return itemStack; + } + + @Override + public org.bukkit.inventory.ItemStack createItemStack(String material, int amount, short data) { + org.bukkit.inventory.ItemStack i; + try { + i = new org.bukkit.inventory.ItemStack(org.bukkit.Material.valueOf(material), amount); + } catch (Exception ex) { + getPlugin().getLogger().log(Level.WARNING, material + " is not a valid " + getName() + " material!"); + i = new org.bukkit.inventory.ItemStack(org.bukkit.Material.BEDROCK); + } + return i; + } + + @Override + public org.bukkit.Material materialFireball() { + return org.bukkit.Material.FIRE_CHARGE; + } + + @Override + public org.bukkit.Material materialPlayerHead() { + return org.bukkit.Material.PLAYER_HEAD; + } + + @Override + public org.bukkit.Material materialSnowball() { + return org.bukkit.Material.SNOWBALL; + } + + @Override + public org.bukkit.Material materialGoldenHelmet() { + return org.bukkit.Material.GOLDEN_HELMET; + } + + @Override + public org.bukkit.Material materialGoldenChestPlate() { + return org.bukkit.Material.GOLDEN_CHESTPLATE; + } + + @Override + public org.bukkit.Material materialGoldenLeggings() { + return org.bukkit.Material.GOLDEN_LEGGINGS; + } + + @Override + public org.bukkit.Material materialNetheriteHelmet() { + return Material.NETHERITE_HELMET; + } + + @Override + public org.bukkit.Material materialNetheriteChestPlate() { + return Material.NETHERITE_CHESTPLATE; + } + + @Override + public org.bukkit.Material materialNetheriteLeggings() { + return Material.NETHERITE_LEGGINGS; + } + + @Override + public org.bukkit.Material materialElytra() { + return Material.ELYTRA; + } + + @Override + public org.bukkit.Material materialCake() { + return org.bukkit.Material.CAKE; + } + + @Override + public org.bukkit.Material materialCraftingTable() { + return org.bukkit.Material.CRAFTING_TABLE; + } + + @Override + public org.bukkit.Material materialEnchantingTable() { + return org.bukkit.Material.ENCHANTING_TABLE; + } + + @Override + public org.bukkit.Material woolMaterial() { + return org.bukkit.Material.WHITE_WOOL; + } + + @Override + public String getShopUpgradeIdentifier(org.bukkit.inventory.ItemStack itemStack) { + var tag = getCreateTag(itemStack); + return tag.e(VersionSupport.PLUGIN_TAG_TIER_KEY) ? tag.l(VersionSupport.PLUGIN_TAG_TIER_KEY) : "null"; + } + + @Override + public org.bukkit.inventory.ItemStack setShopUpgradeIdentifier(org.bukkit.inventory.ItemStack itemStack, String identifier) { + var tag = getCreateTag(itemStack); + tag.a(VersionSupport.PLUGIN_TAG_TIER_KEY, identifier); + return applyTag(itemStack, tag); + } + + @Override + public org.bukkit.inventory.ItemStack getPlayerHead(Player player, org.bukkit.inventory.ItemStack copyTagFrom) { + org.bukkit.inventory.ItemStack head = new org.bukkit.inventory.ItemStack(materialPlayerHead()); + + if (copyTagFrom != null) { + var tag = getTag(copyTagFrom); + head = applyTag(head, tag); + } + + var meta = head.getItemMeta(); + if (meta instanceof SkullMeta) { + ((SkullMeta) meta).setOwnerProfile(player.getPlayerProfile()); + } + head.setItemMeta(meta); + return head; + } + + @Override + public void sendPlayerSpawnPackets(Player respawned, IArena arena) { + if (respawned == null) return; + if (arena == null) return; + if (!arena.isPlayer(respawned)) return; + + // if method was used when the player was still in re-spawning screen + if (arena.getRespawnSessions().containsKey(respawned)) return; + + EntityPlayer entityPlayer = getPlayer(respawned); + PacketPlayOutNamedEntitySpawn show = new PacketPlayOutNamedEntitySpawn(entityPlayer); + PacketPlayOutEntityVelocity playerVelocity = new PacketPlayOutEntityVelocity(entityPlayer); + // we send head rotation packet because sometimes on respawn others see him with bad rotation + PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw())); + + // retrieve current armor and in-hand items + // we send a packet later for timing issues where other players do not see them + List> list = getPlayerEquipment(entityPlayer); + + + for (Player p : arena.getPlayers()) { + if (p == null) continue; + if (p.equals(respawned)) continue; + // if p is in re-spawning screen continue + if (arena.getRespawnSessions().containsKey(p)) continue; + + EntityPlayer boundTo = getPlayer(p); + if (p.getWorld().equals(respawned.getWorld())) { + if (respawned.getLocation().distance(p.getLocation()) <= arena.getRenderDistance()) { + + // send respawned player to regular players + boundTo.b.a(show); + boundTo.b.a(head); + boundTo.b.a(playerVelocity); + boundTo.b.a(new PacketPlayOutEntityEquipment(respawned.getEntityId(), list)); + + // send nearby players to respawned player + // if the player has invisibility hide armor + if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + hideArmor(p, respawned); + } else { + PacketPlayOutNamedEntitySpawn show2 = new PacketPlayOutNamedEntitySpawn(boundTo); + PacketPlayOutEntityVelocity playerVelocity2 = new PacketPlayOutEntityVelocity(boundTo); + PacketPlayOutEntityHeadRotation head2 = new PacketPlayOutEntityHeadRotation(boundTo, getCompressedAngle(boundTo.getBukkitYaw())); + entityPlayer.b.a(show2); + entityPlayer.b.a(playerVelocity2); + entityPlayer.b.a(head2); + showArmor(p, respawned); + } + } + } + } + + for (Player spectator : arena.getSpectators()) { + if (spectator == null) continue; + if (spectator.equals(respawned)) continue; + EntityPlayer boundTo = ((CraftPlayer) spectator).getHandle(); + respawned.hidePlayer(getPlugin(), spectator); + if (spectator.getWorld().equals(respawned.getWorld())) { + if (respawned.getLocation().distance(spectator.getLocation()) <= arena.getRenderDistance()) { + + // send respawned player to spectator + boundTo.b.a(show); + boundTo.b.a(playerVelocity); + boundTo.b.a(new PacketPlayOutEntityEquipment(respawned.getEntityId(), list)); + boundTo.b.a(new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw()))); + } + } + } + } + + @Override + public String getInventoryName(@NotNull InventoryEvent e) { + return e.getView().getTitle(); + } + + @Override + public void setUnbreakable(@NotNull ItemMeta itemMeta) { + itemMeta.setUnbreakable(true); + } + + @Override + public String getMainLevel() { + //noinspection deprecation + return ((DedicatedServer) MinecraftServer.getServer()).a().m; + } + + @Override + public int getVersion() { + return 9; + } + + @Override + public void setJoinSignBackground(@NotNull BlockState b, org.bukkit.Material material) { + if (b.getBlockData() instanceof WallSign) { + b.getBlock().getRelative(((WallSign) b.getBlockData()).getFacing().getOppositeFace()).setType(material); + } + } + + @Override + public void spigotShowPlayer(Player victim, @NotNull Player receiver) { + receiver.showPlayer(getPlugin(), victim); + } + + @Override + public void spigotHidePlayer(Player victim, @NotNull Player receiver) { + receiver.hidePlayer(getPlugin(), victim); + } + + @Override + public Fireball setFireballDirection(Fireball fireball, @NotNull Vector vector) { + EntityFireball fb = ((CraftFireball) fireball).getHandle(); + fb.b = vector.getX() * 0.1D; + fb.c = vector.getY() * 0.1D; + fb.d = vector.getZ() * 0.1D; + return (Fireball) fb.getBukkitEntity(); + } + + @Override + public void playRedStoneDot(@NotNull Player player) { + Color color = Color.RED; + PacketPlayOutWorldParticles particlePacket = new PacketPlayOutWorldParticles( + new ParticleParamRedstone( + new Vector3f((float) color.getRed(), + (float) color.getGreen(), + (float) color.getBlue()), (float) 1 + ), + true, + player.getLocation().getX(), + player.getLocation().getY() + 2.6, + player.getLocation().getZ(), + 0, 0, 0, 0, 0 + ); + for (Player inWorld : player.getWorld().getPlayers()) { + if (inWorld.equals(player)) continue; + getPlayer(inWorld).b.a(particlePacket); + } + } + + @Override + public void clearArrowsFromPlayerBody(Player player) { + // minecraft clears them on death on newer version + } + + /** + * Gets the NMS Item from ItemStack + */ + private @Nullable Item getItem(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.c(); + } + + /** + * Gets the NMS Entity from ItemStack + */ + private @Nullable net.minecraft.world.entity.Entity getEntity(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.G(); + } + + private @Nullable NBTTagCompound getTag(@NotNull org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.u(); + } + + private @Nullable NBTTagCompound getTag(@NotNull ItemStack itemStack) { + return itemStack.u(); + } + + private @NotNull NBTTagCompound initializeTag(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return initializeTag(i); + } + + private @NotNull NBTTagCompound initializeTag(ItemStack itemStack) { + + var tag = getTag(itemStack); + if (null != tag) { + throw new RuntimeException("Provided item already has a Tag"); + } + tag = new NBTTagCompound(); + itemStack.c(tag); + + return tag; + } + + public NBTTagCompound getCreateTag(ItemStack itemStack) { + var tag = getTag(itemStack); + return null == tag ? initializeTag(itemStack) : tag; + } + + public NBTTagCompound getCreateTag(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return getCreateTag(i); + } + + public org.bukkit.inventory.ItemStack applyTag(org.bukkit.inventory.ItemStack itemStack, NBTTagCompound tag) { + return CraftItemStack.asBukkitCopy(applyTag(getNmsItemCopy(itemStack), tag)); + } + + public ItemStack applyTag(@NotNull ItemStack itemStack, NBTTagCompound tag) { + itemStack.c(tag); + return itemStack; + } + + public ItemStack getNmsItemCopy(org.bukkit.inventory.ItemStack itemStack) { + ItemStack i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return i; + } + + public EntityPlayer getPlayer(Player player) { + return ((CraftPlayer) player).getHandle(); + } + + public List> getPlayerEquipment(@NotNull Player player) { + return getPlayerEquipment(getPlayer(player)); + } + + public List> getPlayerEquipment(@NotNull EntityPlayer entityPlayer) { + List> list = new ArrayList<>(); + list.add(new Pair<>(EnumItemSlot.a, entityPlayer.c(EnumItemSlot.a))); + list.add(new Pair<>(EnumItemSlot.b, entityPlayer.c(EnumItemSlot.b))); + list.add(new Pair<>(EnumItemSlot.f, entityPlayer.c(EnumItemSlot.f))); + list.add(new Pair<>(EnumItemSlot.e, entityPlayer.c(EnumItemSlot.e))); + list.add(new Pair<>(EnumItemSlot.d, entityPlayer.c(EnumItemSlot.d))); + list.add(new Pair<>(EnumItemSlot.c, entityPlayer.c(EnumItemSlot.c))); + + return list; + } + + @Override + public void placeTowerBlocks(@NotNull Block b, @NotNull IArena a, @NotNull TeamColor color, int x, int y, int z) { + b.getRelative(x, y, z).setType(color.woolMaterial()); + a.addPlacedBlock(b.getRelative(x, y, z)); + } + + @Override + public void placeLadder(@NotNull Block b, int x, int y, int z, @NotNull IArena a, int ladderData) { + Block block = b.getRelative(x, y, z); //ladder block + block.setType(Material.LADDER); + Ladder ladder = (Ladder) block.getBlockData(); + a.addPlacedBlock(block); + switch (ladderData) { + case 2 -> { + ladder.setFacing(BlockFace.NORTH); + block.setBlockData(ladder); + } + case 3 -> { + ladder.setFacing(BlockFace.SOUTH); + block.setBlockData(ladder); + } + case 4 -> { + ladder.setFacing(BlockFace.WEST); + block.setBlockData(ladder); + } + case 5 -> { + ladder.setFacing(BlockFace.EAST); + block.setBlockData(ladder); + } + } + } + + @Override + public void playVillagerEffect(@NotNull Player player, Location location) { + player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); + } + +} \ No newline at end of file diff --git a/versionsupport_v1_20_R1/pom.xml b/versionsupport_v1_20_R1/pom.xml new file mode 100644 index 000000000..e8fdf7c71 --- /dev/null +++ b/versionsupport_v1_20_R1/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.andrei1058.bedwars + BedWars1058 + 23.10.1-SNAPSHOT + + + versionsupport_v1_20_R1 + + + 1.19 + 1.19 + UTF-8 + + + + + com.andrei1058.bedwars + bedwars-api + ${project.version} + jar + provided + + + com.andrei1058.bedwars + versionsupport-common + ${project.version} + jar + provided + + + org.spigotmc + spigot + 1.20.1-R0.1-SNAPSHOT + jar + provided + + + + + + + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 19 + 19 + + + + + + \ No newline at end of file diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableAttributes.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableAttributes.java new file mode 100644 index 000000000..01be791d0 --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableAttributes.java @@ -0,0 +1,5 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable; + +public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) { + +} diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableFactory.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableFactory.java new file mode 100644 index 000000000..e72b00e0f --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableFactory.java @@ -0,0 +1,27 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.server.VersionSupport; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class DespawnableFactory { + + private final VersionSupport versionSupport; + private final List> providers = new ArrayList<>(); + + public DespawnableFactory(VersionSupport versionSupport) { + this.versionSupport = versionSupport; + providers.add(new TeamIronGolem()); + providers.add(new TeamSilverfish()); + } + + public LivingEntity spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team){ + return providers.stream().filter(provider -> provider.getType() == attr.type()) + .findFirst().orElseThrow().spawn(attr, location,team, versionSupport); + } +} diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableProvider.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableProvider.java new file mode 100644 index 000000000..3b363d791 --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableProvider.java @@ -0,0 +1,71 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityCreature; +import net.minecraft.world.entity.EntityInsentient; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.ai.attributes.GenericAttributes; +import net.minecraft.world.entity.ai.goal.PathfinderGoal; +import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget; +import net.minecraft.world.entity.player.EntityHuman; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public abstract class DespawnableProvider { + + abstract DespawnableType getType(); + + abstract String getDisplayName(DespawnableAttributes attr, ITeam team); + + abstract T spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api); + + protected boolean notSameTeam(@NotNull Entity entity, ITeam team, @NotNull VersionSupport api) { + var despawnable = api.getDespawnablesList().getOrDefault(entity.getBukkitEntity().getUniqueId(), null); + return null == despawnable || despawnable.getTeam() != team; + } + + protected PathfinderGoalSelector getTargetSelector(@NotNull EntityCreature entityLiving) { + return entityLiving.bP; + } + + protected PathfinderGoalSelector getGoalSelector(@NotNull EntityCreature entityLiving) { + return entityLiving.bO; + } + + protected void clearSelectors(@NotNull EntityCreature entityLiving) { + entityLiving.bO.b().clear(); + entityLiving.bP.b().clear(); + } + + protected PathfinderGoal getTargetGoal(EntityInsentient entity, ITeam team, VersionSupport api) { + return new PathfinderGoalNearestAttackableTarget<>(entity, EntityLiving.class, 20, true, false, + entityLiving -> { + if (entityLiving instanceof EntityHuman) { + return !((EntityHuman) entityLiving).getBukkitEntity().isDead() && + !team.wasMember(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()) && + !team.getArena().isReSpawning(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()) + && !team.getArena().isSpectator(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()); + } + return notSameTeam(entityLiving, team, api); + }); + } + + protected void applyDefaultSettings(org.bukkit.entity.@NotNull LivingEntity bukkitEntity, DespawnableAttributes attr, + ITeam team) { + bukkitEntity.setRemoveWhenFarAway(false); + bukkitEntity.setPersistent(true); + bukkitEntity.setCustomNameVisible(true); + bukkitEntity.setCustomName(getDisplayName(attr, team)); + + var entity = ((EntityInsentient)((CraftEntity)bukkitEntity).getHandle()); + Objects.requireNonNull(entity.a(GenericAttributes.a)).a(attr.health()); + Objects.requireNonNull(entity.a(GenericAttributes.d)).a(attr.speed()); + Objects.requireNonNull(entity.a(GenericAttributes.f)).a(attr.damage()); + } +} diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableType.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableType.java new file mode 100644 index 000000000..3c3097ed9 --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/DespawnableType.java @@ -0,0 +1,6 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable; + +public enum DespawnableType { + IRON_GOLEM, + SILVERFISH +} diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamIronGolem.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamIronGolem.java new file mode 100644 index 000000000..060e90ccc --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamIronGolem.java @@ -0,0 +1,58 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat; +import net.minecraft.world.entity.ai.goal.PathfinderGoalMeleeAttack; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStroll; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalHurtByTarget; +import net.minecraft.world.entity.animal.EntityIronGolem; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.IronGolem; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class TeamIronGolem extends DespawnableProvider { + + @Override + public DespawnableType getType() { + return DespawnableType.IRON_GOLEM; + } + + @Override + String getDisplayName(@NotNull DespawnableAttributes attr, @NotNull ITeam team) { + Language lang = Language.getDefaultLanguage(); + return lang.m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME).replace("{despawn}", String.valueOf(attr.despawnSeconds()) + .replace("{health}", StringUtils.repeat(lang.m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) + .replace("{TeamColor}", team.getColor().chat().toString()) + ); + } + + public @NotNull IronGolem spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api) { + + var bukkitEntity = (IronGolem) Objects.requireNonNull(location.getWorld()).spawnEntity(location, EntityType.IRON_GOLEM); + applyDefaultSettings(bukkitEntity, attr, team); + + var entity = (EntityIronGolem) ((CraftEntity) bukkitEntity).getHandle(); + + clearSelectors(entity); + var goalSelector = getGoalSelector(entity); + var targetSelector = getTargetSelector(entity); + + goalSelector.a(1, new PathfinderGoalFloat(entity)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(entity, 1.5D, false)); + goalSelector.a(3, new PathfinderGoalRandomStroll(entity, 1D)); + goalSelector.a(4, new PathfinderGoalRandomLookaround(entity)); + targetSelector.a(1, new PathfinderGoalHurtByTarget(entity)); + targetSelector.a(2, getTargetGoal(entity, team, api)); + + return bukkitEntity; + } +} diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamSilverfish.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamSilverfish.java new file mode 100644 index 000000000..f749de1ed --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/despawnable/TeamSilverfish.java @@ -0,0 +1,56 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat; +import net.minecraft.world.entity.ai.goal.PathfinderGoalMeleeAttack; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStroll; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalHurtByTarget; +import net.minecraft.world.entity.monster.EntitySilverfish; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Silverfish; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class TeamSilverfish extends DespawnableProvider { + @Override + public DespawnableType getType() { + return DespawnableType.SILVERFISH; + } + + @Override + String getDisplayName(@NotNull DespawnableAttributes attr, @NotNull ITeam team) { + Language lang = Language.getDefaultLanguage(); + return lang.m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME).replace("{despawn}", String.valueOf(attr.despawnSeconds()) + .replace("{health}", StringUtils.repeat(lang.m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) + .replace("{TeamColor}", team.getColor().chat().toString()) + ); + } + + @Override + public Silverfish spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api) { + var bukkitEntity = (Silverfish) Objects.requireNonNull(location.getWorld()).spawnEntity(location, EntityType.SILVERFISH); + applyDefaultSettings(bukkitEntity, attr, team); + + var entity = (EntitySilverfish) ((CraftEntity) bukkitEntity).getHandle(); + clearSelectors(entity); + + var goalSelector = getGoalSelector(entity); + var targetSelector = getTargetSelector(entity); + goalSelector.a(1, new PathfinderGoalFloat(entity)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(entity, 1.9D, false)); + goalSelector.a(3, new PathfinderGoalRandomStroll(entity, 2D)); + goalSelector.a(4, new PathfinderGoalRandomLookaround(entity)); + targetSelector.a(1, new PathfinderGoalHurtByTarget(entity)); + targetSelector.a(2, getTargetGoal(entity, team, api)); + + return bukkitEntity; + } +} diff --git a/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/v1_20_R1.java b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/v1_20_R1.java new file mode 100644 index 000000000..4d36c66f2 --- /dev/null +++ b/versionsupport_v1_20_R1/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R1/v1_20_R1.java @@ -0,0 +1,837 @@ +package com.andrei1058.bedwars.support.version.v1_20_R1; + +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.shop.ShopHolo; +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.arena.team.TeamColor; +import com.andrei1058.bedwars.api.entity.Despawnable; +import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import com.andrei1058.bedwars.support.version.common.VersionCommon; +import com.andrei1058.bedwars.support.version.v1_20_R1.despawnable.DespawnableAttributes; +import com.andrei1058.bedwars.support.version.v1_20_R1.despawnable.DespawnableFactory; +import com.andrei1058.bedwars.support.version.v1_20_R1.despawnable.DespawnableType; +import com.mojang.datafixers.util.Pair; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; +import net.minecraft.core.particles.ParticleParamRedstone; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.*; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.level.EntityPlayer; +import net.minecraft.server.network.PlayerConnection; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.EnumItemSlot; +import net.minecraft.world.entity.item.EntityTNTPrimed; +import net.minecraft.world.entity.projectile.EntityFireball; +import net.minecraft.world.entity.projectile.IProjectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBase; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.data.type.Bed; +import org.bukkit.block.data.type.Ladder; +import org.bukkit.block.data.type.WallSign; +import org.bukkit.command.Command; +import org.bukkit.craftbukkit.v1_20_R1.CraftServer; +import org.bukkit.craftbukkit.v1_20_R1.entity.*; +import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack; +import org.bukkit.entity.*; +import org.bukkit.event.inventory.InventoryEvent; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.joml.Vector3f; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.logging.Level; + +@SuppressWarnings("unused") +public class v1_20_R1 extends VersionSupport { + + private final DespawnableFactory despawnableFactory; + + public v1_20_R1(Plugin plugin, String name) { + super(plugin, name); + loadDefaultEffects(); + this.despawnableFactory = new DespawnableFactory(this); + } + + @Override + public void registerVersionListeners() { + new VersionCommon(this); + } + + @Override + public void registerCommand(String name, Command cmd) { + ((CraftServer) getPlugin().getServer()).getCommandMap().register(name, cmd); + } + + @Override + public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) { + var tag = getTag(itemStack); + return tag == null ? null : tag.e(key) ? tag.l(key) : null; + } + + @Override + public void sendTitle(@NotNull Player p, String title, String subtitle, int fadeIn, int stay, int fadeOut) { + p.sendTitle(title == null ? " " : title, subtitle == null ? " " : subtitle, fadeIn, stay, fadeOut); + } + + public void spawnSilverfish(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn, double damage) { + var attr = new DespawnableAttributes(DespawnableType.SILVERFISH, speed, health, damage, despawn); + var entity = despawnableFactory.spawn(attr, loc, bedWarsTeam); + + new Despawnable( + entity, + bedWarsTeam, despawn, + Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME, + PlayerKillEvent.PlayerKillCause.SILVERFISH_FINAL_KILL, + PlayerKillEvent.PlayerKillCause.SILVERFISH + ); + } + + @Override + public void spawnIronGolem(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn) { + var attr = new DespawnableAttributes(DespawnableType.IRON_GOLEM, speed, health, 4, despawn); + var entity = despawnableFactory.spawn(attr, loc, bedWarsTeam); + new Despawnable( + entity, + bedWarsTeam, despawn, + Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME, + PlayerKillEvent.PlayerKillCause.IRON_GOLEM_FINAL_KILL, + PlayerKillEvent.PlayerKillCause.IRON_GOLEM + ); + } + + @Override + public void playAction(@NotNull Player p, String text) { + p.spigot().sendMessage( + ChatMessageType.ACTION_BAR, + new TextComponent(ChatColor.translateAlternateColorCodes('&', text) + ) + ); + } + + @Override + public boolean isBukkitCommandRegistered(String name) { + return ((CraftServer) getPlugin().getServer()).getCommandMap().getCommand(name) != null; + } + + @Override + public org.bukkit.inventory.ItemStack getItemInHand(@NotNull Player p) { + return p.getInventory().getItemInMainHand(); + } + + @Override + public void hideEntity(@NotNull Entity e, Player p) { + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(e.getEntityId()); + this.sendPacket(p, packet); + } + + @Override + public void minusAmount(Player p, org.bukkit.inventory.@NotNull ItemStack i, int amount) { + if (i.getAmount() - amount <= 0) { + if (p.getInventory().getItemInOffHand().equals(i)) { + p.getInventory().setItemInOffHand(null); + } else { + p.getInventory().removeItem(i); + } + return; + } + i.setAmount(i.getAmount() - amount); + + // todo this is marked as unstable on 1.20 for some reason + p.updateInventory(); + } + + @Override + public void setSource(TNTPrimed tnt, Player owner) { + EntityLiving nmsEntityLiving = (((CraftLivingEntity) owner).getHandle()); + EntityTNTPrimed nmsTNT = (((CraftTNTPrimed) tnt).getHandle()); + try { + Field sourceField = EntityTNTPrimed.class.getDeclaredField("d"); + sourceField.setAccessible(true); + sourceField.set(nmsTNT, nmsEntityLiving); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Override + public boolean isArmor(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemArmor || i instanceof ItemElytra; + + } + + @Override + public boolean isTool(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemTool; + } + + @Override + public boolean isSword(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemSword; + } + + @Override + public boolean isAxe(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemAxe; + } + + @Override + public boolean isBow(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemBow; + } + + @Override + public boolean isProjectile(org.bukkit.inventory.ItemStack itemStack) { + var entity = getEntity(itemStack); + if (null == entity) return false; + return entity instanceof IProjectile; + } + + @Override + public boolean isInvisibilityPotion(org.bukkit.inventory.@NotNull ItemStack itemStack) { + if (!itemStack.getType().equals(org.bukkit.Material.POTION)) return false; + + org.bukkit.inventory.meta.PotionMeta pm = (org.bukkit.inventory.meta.PotionMeta) itemStack.getItemMeta(); + + return pm != null && pm.hasCustomEffects() && pm.hasCustomEffect(org.bukkit.potion.PotionEffectType.INVISIBILITY); + } + + @Override + public void registerEntities() { + } + + @Override + public void spawnShop(@NotNull Location loc, String name1, List players, IArena arena) { + Location l = loc.clone(); + + if (l.getWorld() == null) return; + Villager vlg = (Villager) l.getWorld().spawnEntity(loc, EntityType.VILLAGER); + vlg.setAI(false); + vlg.setRemoveWhenFarAway(false); + vlg.setCollidable(false); + vlg.setInvulnerable(true); + vlg.setSilent(true); + + for (Player p : players) { + String[] name = Language.getMsg(p, name1).split(","); + if (name.length == 1) { + ArmorStand a = createArmorStand(name[0], l.clone().add(0, 1.85, 0)); + new ShopHolo(Language.getPlayerLanguage(p).getIso(), a, null, l, arena); + } else { + ArmorStand a = createArmorStand(name[0], l.clone().add(0, 2.1, 0)); + ArmorStand b = createArmorStand(name[1], l.clone().add(0, 1.85, 0)); + new ShopHolo(Language.getPlayerLanguage(p).getIso(), a, b, l, arena); + } + } + for (ShopHolo sh : ShopHolo.getShopHolo()) { + if (sh.getA() == arena) { + sh.update(); + } + } + } + + @Override + public double getDamage(org.bukkit.inventory.ItemStack i) { + var tag = getTag(i); + if (null == tag) { + throw new RuntimeException("Provided item has no Tag"); + } + return tag.k("generic.attackDamage"); + } + + private static ArmorStand createArmorStand(String name, Location loc) { + if (loc == null) return null; + if (loc.getWorld() == null) return null; + ArmorStand a = loc.getWorld().spawn(loc, ArmorStand.class); + a.setGravity(false); + a.setVisible(false); + a.setCustomNameVisible(true); + a.setCustomName(name); + return a; + } + + @Override + public void voidKill(Player p) { + EntityPlayer player = getPlayer(p); + player.a(player.dJ().l(), 1000); + } + + @Override + public void hideArmor(@NotNull Player victim, Player receiver) { + List> items = new ArrayList<>(); + items.add(new Pair<>(EnumItemSlot.f, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.e, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.d, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.c, new ItemStack(Item.b(0)))); + PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items); + sendPacket(receiver, packet1); + } + + @Override + public void showArmor(@NotNull Player victim, Player receiver) { + List> items = new ArrayList<>(); + items.add(new Pair<>(EnumItemSlot.f, CraftItemStack.asNMSCopy(victim.getInventory().getHelmet()))); + items.add(new Pair<>(EnumItemSlot.e, CraftItemStack.asNMSCopy(victim.getInventory().getChestplate()))); + items.add(new Pair<>(EnumItemSlot.d, CraftItemStack.asNMSCopy(victim.getInventory().getLeggings()))); + items.add(new Pair<>(EnumItemSlot.c, CraftItemStack.asNMSCopy(victim.getInventory().getBoots()))); + PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items); + sendPacket(receiver, packet1); + } + + @Override + public void spawnDragon(Location l, ITeam bwt) { + if (l == null || l.getWorld() == null) { + getPlugin().getLogger().log(Level.WARNING, "Could not spawn Dragon. Location is null"); + return; + } + EnderDragon ed = (EnderDragon) l.getWorld().spawnEntity(l, EntityType.ENDER_DRAGON); + ed.setPhase(EnderDragon.Phase.CIRCLING); + } + + @Override + public void colorBed(ITeam bwt) { + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + BlockState bed = bwt.getBed().clone().add(x, 0, z).getBlock().getState(); + if (bed instanceof Bed) { + bed.setType(bwt.getColor().bedMaterial()); + bed.update(); + } + } + } + } + + @Override + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { + try { + // blast resistance + Field field = BlockBase.class.getDeclaredField("aF"); + field.setAccessible(true); + // end stone + field.set(Blocks.fz, endStoneBlast); + // obsidian +// field.set(Blocks.co, glassBlast); + // standard glass + field.set(Blocks.aQ, glassBlast); + + var coloredGlass = new net.minecraft.world.level.block.Block[]{ + Blocks.ej, Blocks.ek, Blocks.el, Blocks.em, + Blocks.en, Blocks.eo, Blocks.ep, Blocks.eq, + Blocks.er, Blocks.es, Blocks.et, Blocks.eu, + Blocks.ev, Blocks.ew, Blocks.ex, Blocks.ey, + + // tinted glass + Blocks.qB, + }; + + Arrays.stream(coloredGlass).forEach( + glass -> { + try { + field.set(glass, glassBlast); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + ); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + @Override + public void setBlockTeamColor(@NotNull Block block, TeamColor teamColor) { + if (block.getType().toString().contains("STAINED_GLASS") || block.getType().toString().equals("GLASS")) { + block.setType(teamColor.glassMaterial()); + } else if (block.getType().toString().contains("_TERRACOTTA")) { + block.setType(teamColor.glazedTerracottaMaterial()); + } else if (block.getType().toString().contains("_WOOL")) { + block.setType(teamColor.woolMaterial()); + } + } + + @Override + public void setCollide(@NotNull Player p, IArena a, boolean value) { + p.setCollidable(value); + if (a == null) return; + a.updateSpectatorCollideRule(p, value); + } + + @Override + public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemStack i, String data) { + var tag = getCreateTag(i); + tag.a(VersionSupport.PLUGIN_TAG_GENERIC_KEY, data); + return applyTag(i, tag); + } + + @Override + public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) { + var tag = getCreateTag(itemStack); + tag.a(key, value); + return applyTag(itemStack, tag); + } + + @Override + public boolean isCustomBedWarsItem(org.bukkit.inventory.ItemStack i) { + return getCreateTag(i).e(VersionSupport.PLUGIN_TAG_GENERIC_KEY); + } + + @Override + public String getCustomData(org.bukkit.inventory.ItemStack i) { + return getCreateTag(i).l(VersionSupport.PLUGIN_TAG_GENERIC_KEY); + } + + @Override + public org.bukkit.inventory.ItemStack colourItem(org.bukkit.inventory.ItemStack itemStack, ITeam bedWarsTeam) { + if (itemStack == null) return null; + String type = itemStack.getType().toString(); + if (isBed(itemStack.getType())) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().bedMaterial(), itemStack.getAmount()); + } else if (type.contains("_STAINED_GLASS_PANE")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glassPaneMaterial(), itemStack.getAmount()); + } else if (type.contains("STAINED_GLASS") || type.equals("GLASS")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glassMaterial(), itemStack.getAmount()); + } else if (type.contains("_TERRACOTTA")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glazedTerracottaMaterial(), itemStack.getAmount()); + } else if (type.contains("_WOOL")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().woolMaterial(), itemStack.getAmount()); + } + return itemStack; + } + + @Override + public org.bukkit.inventory.ItemStack createItemStack(String material, int amount, short data) { + org.bukkit.inventory.ItemStack i; + try { + i = new org.bukkit.inventory.ItemStack(org.bukkit.Material.valueOf(material), amount); + } catch (Exception ex) { + getPlugin().getLogger().log(Level.WARNING, material + " is not a valid " + getName() + " material!"); + i = new org.bukkit.inventory.ItemStack(org.bukkit.Material.BEDROCK); + } + return i; + } + + @Override + public org.bukkit.Material materialFireball() { + return org.bukkit.Material.FIRE_CHARGE; + } + + @Override + public org.bukkit.Material materialPlayerHead() { + return org.bukkit.Material.PLAYER_HEAD; + } + + @Override + public org.bukkit.Material materialSnowball() { + return org.bukkit.Material.SNOWBALL; + } + + @Override + public org.bukkit.Material materialGoldenHelmet() { + return org.bukkit.Material.GOLDEN_HELMET; + } + + @Override + public org.bukkit.Material materialGoldenChestPlate() { + return org.bukkit.Material.GOLDEN_CHESTPLATE; + } + + @Override + public org.bukkit.Material materialGoldenLeggings() { + return org.bukkit.Material.GOLDEN_LEGGINGS; + } + + @Override + public org.bukkit.Material materialNetheriteHelmet() { + return Material.NETHERITE_HELMET; + } + + @Override + public org.bukkit.Material materialNetheriteChestPlate() { + return Material.NETHERITE_CHESTPLATE; + } + + @Override + public org.bukkit.Material materialNetheriteLeggings() { + return Material.NETHERITE_LEGGINGS; + } + + @Override + public org.bukkit.Material materialElytra() { + return Material.ELYTRA; + } + + @Override + public org.bukkit.Material materialCake() { + return org.bukkit.Material.CAKE; + } + + @Override + public org.bukkit.Material materialCraftingTable() { + return org.bukkit.Material.CRAFTING_TABLE; + } + + @Override + public org.bukkit.Material materialEnchantingTable() { + return org.bukkit.Material.ENCHANTING_TABLE; + } + + @Override + public org.bukkit.Material woolMaterial() { + return org.bukkit.Material.WHITE_WOOL; + } + + @Override + public String getShopUpgradeIdentifier(org.bukkit.inventory.ItemStack itemStack) { + var tag = getCreateTag(itemStack); + return tag.e(VersionSupport.PLUGIN_TAG_TIER_KEY) ? tag.l(VersionSupport.PLUGIN_TAG_TIER_KEY) : "null"; + } + + @Override + public org.bukkit.inventory.ItemStack setShopUpgradeIdentifier(org.bukkit.inventory.ItemStack itemStack, String identifier) { + var tag = getCreateTag(itemStack); + tag.a(VersionSupport.PLUGIN_TAG_TIER_KEY, identifier); + return applyTag(itemStack, tag); + } + + @Override + public org.bukkit.inventory.ItemStack getPlayerHead(Player player, org.bukkit.inventory.ItemStack copyTagFrom) { + org.bukkit.inventory.ItemStack head = new org.bukkit.inventory.ItemStack(materialPlayerHead()); + + if (copyTagFrom != null) { + var tag = getTag(copyTagFrom); + head = applyTag(head, tag); + } + + var meta = head.getItemMeta(); + if (meta instanceof SkullMeta) { + ((SkullMeta) meta).setOwnerProfile(player.getPlayerProfile()); + } + head.setItemMeta(meta); + return head; + } + + @Override + public void sendPlayerSpawnPackets(Player respawned, IArena arena) { + if (respawned == null) return; + if (arena == null) return; + if (!arena.isPlayer(respawned)) return; + + // if method was used when the player was still in re-spawning screen + if (arena.getRespawnSessions().containsKey(respawned)) return; + + EntityPlayer entityPlayer = getPlayer(respawned); + PacketPlayOutNamedEntitySpawn show = new PacketPlayOutNamedEntitySpawn(entityPlayer); + PacketPlayOutEntityVelocity playerVelocity = new PacketPlayOutEntityVelocity(entityPlayer); + // we send head rotation packet because sometimes on respawn others see him with bad rotation + PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw())); + + // retrieve current armor and in-hand items + // we send a packet later for timing issues where other players do not see them + List> list = getPlayerEquipment(entityPlayer); + + + for (Player p : arena.getPlayers()) { + if (p == null) continue; + if (p.equals(respawned)) continue; + // if p is in re-spawning screen continue + if (arena.getRespawnSessions().containsKey(p)) continue; + + EntityPlayer boundTo = getPlayer(p); + if (p.getWorld().equals(respawned.getWorld())) { + if (respawned.getLocation().distance(p.getLocation()) <= arena.getRenderDistance()) { + + // send respawned player to regular players + this.sendPackets( + p, show, head, playerVelocity, + new PacketPlayOutEntityEquipment(respawned.getEntityId(), list) + ); + + // send nearby players to respawned player + // if the player has invisibility hide armor + if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + hideArmor(p, respawned); + } else { + + PacketPlayOutNamedEntitySpawn show2 = new PacketPlayOutNamedEntitySpawn(boundTo); + PacketPlayOutEntityVelocity playerVelocity2 = new PacketPlayOutEntityVelocity(boundTo); + PacketPlayOutEntityHeadRotation head2 = new PacketPlayOutEntityHeadRotation(boundTo, getCompressedAngle(boundTo.getBukkitYaw())); + this.sendPackets(respawned, show2, playerVelocity2, head2); + + showArmor(p, respawned); + } + } + } + } + + for (Player spectator : arena.getSpectators()) { + if (spectator == null) continue; + if (spectator.equals(respawned)) continue; + EntityPlayer boundTo = ((CraftPlayer) spectator).getHandle(); + respawned.hidePlayer(getPlugin(), spectator); + if (spectator.getWorld().equals(respawned.getWorld())) { + if (respawned.getLocation().distance(spectator.getLocation()) <= arena.getRenderDistance()) { + + // send respawned player to spectator + this.sendPackets( + spectator, show, playerVelocity, + new PacketPlayOutEntityEquipment(respawned.getEntityId(), list), + new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw())) + ); + } + } + } + } + + @Override + public String getInventoryName(@NotNull InventoryEvent e) { + return e.getView().getTitle(); + } + + @Override + public void setUnbreakable(@NotNull ItemMeta itemMeta) { + itemMeta.setUnbreakable(true); + } + + @Override + public String getMainLevel() { + //noinspection deprecation + return ((DedicatedServer) MinecraftServer.getServer()).a().m; + } + + @Override + public int getVersion() { + return 9; + } + + @Override + public void setJoinSignBackground(@NotNull BlockState b, org.bukkit.Material material) { + if (b.getBlockData() instanceof WallSign) { + b.getBlock().getRelative(((WallSign) b.getBlockData()).getFacing().getOppositeFace()).setType(material); + } + } + + @Override + public void spigotShowPlayer(Player victim, @NotNull Player receiver) { + receiver.showPlayer(getPlugin(), victim); + } + + @Override + public void spigotHidePlayer(Player victim, @NotNull Player receiver) { + receiver.hidePlayer(getPlugin(), victim); + } + + @Override + public Fireball setFireballDirection(Fireball fireball, @NotNull Vector vector) { + EntityFireball fb = ((CraftFireball) fireball).getHandle(); + fb.b = vector.getX() * 0.1D; + fb.c = vector.getY() * 0.1D; + fb.d = vector.getZ() * 0.1D; + return (Fireball) fb.getBukkitEntity(); + } + + @Override + public void playRedStoneDot(@NotNull Player player) { + Color color = Color.RED; + PacketPlayOutWorldParticles particlePacket = new PacketPlayOutWorldParticles( + new ParticleParamRedstone( + new Vector3f((float) color.getRed(), + (float) color.getGreen(), + (float) color.getBlue()), (float) 1 + ), + true, + player.getLocation().getX(), + player.getLocation().getY() + 2.6, + player.getLocation().getZ(), + 0, 0, 0, 0, 0 + ); + for (Player inWorld : player.getWorld().getPlayers()) { + if (inWorld.equals(player)) continue; + this.sendPacket(inWorld, particlePacket); + } + } + + @Override + public void clearArrowsFromPlayerBody(Player player) { + // minecraft clears them on death on newer version + } + + /** + * Gets the NMS Item from ItemStack + */ + private @Nullable Item getItem(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.d(); + } + + /** + * Gets the NMS Entity from ItemStack + */ + private @Nullable net.minecraft.world.entity.Entity getEntity(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.H(); + } + + private @Nullable NBTTagCompound getTag(@NotNull org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.v(); + } + + private @Nullable NBTTagCompound getTag(@NotNull ItemStack itemStack) { + return itemStack.v(); + } + + private @NotNull NBTTagCompound initializeTag(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return initializeTag(i); + } + + private @NotNull NBTTagCompound initializeTag(ItemStack itemStack) { + + var tag = getTag(itemStack); + if (null != tag) { + throw new RuntimeException("Provided item already has a Tag"); + } + tag = new NBTTagCompound(); + itemStack.c(tag); + + return tag; + } + + public NBTTagCompound getCreateTag(ItemStack itemStack) { + var tag = getTag(itemStack); + return null == tag ? initializeTag(itemStack) : tag; + } + + public NBTTagCompound getCreateTag(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return getCreateTag(i); + } + + public org.bukkit.inventory.ItemStack applyTag(org.bukkit.inventory.ItemStack itemStack, NBTTagCompound tag) { + return CraftItemStack.asBukkitCopy(applyTag(getNmsItemCopy(itemStack), tag)); + } + + public ItemStack applyTag(@NotNull ItemStack itemStack, NBTTagCompound tag) { + itemStack.c(tag); + return itemStack; + } + + public ItemStack getNmsItemCopy(org.bukkit.inventory.ItemStack itemStack) { + ItemStack i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return i; + } + + public EntityPlayer getPlayer(Player player) { + return ((CraftPlayer) player).getHandle(); + } + + public List> getPlayerEquipment(@NotNull Player player) { + return getPlayerEquipment(getPlayer(player)); + } + + public List> getPlayerEquipment(@NotNull EntityPlayer entityPlayer) { + List> list = new ArrayList<>(); + list.add(new Pair<>(EnumItemSlot.a, entityPlayer.c(EnumItemSlot.a))); + list.add(new Pair<>(EnumItemSlot.b, entityPlayer.c(EnumItemSlot.b))); + list.add(new Pair<>(EnumItemSlot.f, entityPlayer.c(EnumItemSlot.f))); + list.add(new Pair<>(EnumItemSlot.e, entityPlayer.c(EnumItemSlot.e))); + list.add(new Pair<>(EnumItemSlot.d, entityPlayer.c(EnumItemSlot.d))); + list.add(new Pair<>(EnumItemSlot.c, entityPlayer.c(EnumItemSlot.c))); + + return list; + } + + @Override + public void placeTowerBlocks(@NotNull Block b, @NotNull IArena a, @NotNull TeamColor color, int x, int y, int z) { + b.getRelative(x, y, z).setType(color.woolMaterial()); + a.addPlacedBlock(b.getRelative(x, y, z)); + } + + @Override + public void placeLadder(@NotNull Block b, int x, int y, int z, @NotNull IArena a, int ladderData) { + Block block = b.getRelative(x, y, z); //ladder block + block.setType(Material.LADDER); + Ladder ladder = (Ladder) block.getBlockData(); + a.addPlacedBlock(block); + switch (ladderData) { + case 2 -> { + ladder.setFacing(BlockFace.NORTH); + block.setBlockData(ladder); + } + case 3 -> { + ladder.setFacing(BlockFace.SOUTH); + block.setBlockData(ladder); + } + case 4 -> { + ladder.setFacing(BlockFace.WEST); + block.setBlockData(ladder); + } + case 5 -> { + ladder.setFacing(BlockFace.EAST); + block.setBlockData(ladder); + } + } + } + + @Override + public void playVillagerEffect(@NotNull Player player, Location location) { + player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); + } + + private void sendPacket(Player player, Packet packet) { + ((CraftPlayer) player).getHandle().c.a(packet); + } + + private void sendPackets(Player player, Packet @NotNull ... packets) { + PlayerConnection connection = ((CraftPlayer) player).getHandle().c; + for (Packet p : packets) { + connection.a(p); + } + } +} \ No newline at end of file diff --git a/versionsupport_v1_20_R2/pom.xml b/versionsupport_v1_20_R2/pom.xml new file mode 100644 index 000000000..881cb95ad --- /dev/null +++ b/versionsupport_v1_20_R2/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + com.andrei1058.bedwars + BedWars1058 + 23.10.1-SNAPSHOT + + + versionsupport_v1_20_R2 + + + 1.19 + 1.19 + UTF-8 + + + + + com.andrei1058.bedwars + bedwars-api + ${project.version} + jar + provided + + + com.andrei1058.bedwars + versionsupport-common + ${project.version} + jar + provided + + + org.spigotmc + spigot + 1.20.2-R0.1-SNAPSHOT + jar + provided + + + + + + + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 19 + 19 + + + + + + \ No newline at end of file diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableAttributes.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableAttributes.java new file mode 100644 index 000000000..2ca63287f --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableAttributes.java @@ -0,0 +1,5 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable; + +public record DespawnableAttributes(DespawnableType type, double speed, double health, double damage, int despawnSeconds) { + +} diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableFactory.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableFactory.java new file mode 100644 index 000000000..34124d3f4 --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableFactory.java @@ -0,0 +1,27 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.server.VersionSupport; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class DespawnableFactory { + + private final VersionSupport versionSupport; + private final List> providers = new ArrayList<>(); + + public DespawnableFactory(VersionSupport versionSupport) { + this.versionSupport = versionSupport; + providers.add(new TeamIronGolem()); + providers.add(new TeamSilverfish()); + } + + public LivingEntity spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team){ + return providers.stream().filter(provider -> provider.getType() == attr.type()) + .findFirst().orElseThrow().spawn(attr, location,team, versionSupport); + } +} diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableProvider.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableProvider.java new file mode 100644 index 000000000..a8dffa4a4 --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableProvider.java @@ -0,0 +1,71 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityCreature; +import net.minecraft.world.entity.EntityInsentient; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.ai.attributes.GenericAttributes; +import net.minecraft.world.entity.ai.goal.PathfinderGoal; +import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalNearestAttackableTarget; +import net.minecraft.world.entity.player.EntityHuman; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public abstract class DespawnableProvider { + + abstract DespawnableType getType(); + + abstract String getDisplayName(DespawnableAttributes attr, ITeam team); + + abstract T spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api); + + protected boolean notSameTeam(@NotNull Entity entity, ITeam team, @NotNull VersionSupport api) { + var despawnable = api.getDespawnablesList().getOrDefault(entity.getBukkitEntity().getUniqueId(), null); + return null == despawnable || despawnable.getTeam() != team; + } + + protected PathfinderGoalSelector getTargetSelector(@NotNull EntityCreature entityLiving) { + return entityLiving.bP; + } + + protected PathfinderGoalSelector getGoalSelector(@NotNull EntityCreature entityLiving) { + return entityLiving.bO; + } + + protected void clearSelectors(@NotNull EntityCreature entityLiving) { + entityLiving.bO.b().clear(); + entityLiving.bP.b().clear(); + } + + protected PathfinderGoal getTargetGoal(EntityInsentient entity, ITeam team, VersionSupport api) { + return new PathfinderGoalNearestAttackableTarget<>(entity, EntityLiving.class, 20, true, false, + entityLiving -> { + if (entityLiving instanceof EntityHuman) { + return !((EntityHuman) entityLiving).getBukkitEntity().isDead() && + !team.wasMember(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()) && + !team.getArena().isReSpawning(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()) + && !team.getArena().isSpectator(((EntityHuman) entityLiving).getBukkitEntity().getUniqueId()); + } + return notSameTeam(entityLiving, team, api); + }); + } + + protected void applyDefaultSettings(org.bukkit.entity.@NotNull LivingEntity bukkitEntity, DespawnableAttributes attr, + ITeam team) { + bukkitEntity.setRemoveWhenFarAway(false); + bukkitEntity.setPersistent(true); + bukkitEntity.setCustomNameVisible(true); + bukkitEntity.setCustomName(getDisplayName(attr, team)); + + var entity = ((EntityInsentient)((CraftEntity)bukkitEntity).getHandle()); + Objects.requireNonNull(entity.a(GenericAttributes.a)).a(attr.health()); + Objects.requireNonNull(entity.a(GenericAttributes.d)).a(attr.speed()); + Objects.requireNonNull(entity.a(GenericAttributes.f)).a(attr.damage()); + } +} diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableType.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableType.java new file mode 100644 index 000000000..fe6f773df --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/DespawnableType.java @@ -0,0 +1,6 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable; + +public enum DespawnableType { + IRON_GOLEM, + SILVERFISH +} diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamIronGolem.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamIronGolem.java new file mode 100644 index 000000000..f4e732d67 --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamIronGolem.java @@ -0,0 +1,58 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat; +import net.minecraft.world.entity.ai.goal.PathfinderGoalMeleeAttack; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStroll; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalHurtByTarget; +import net.minecraft.world.entity.animal.EntityIronGolem; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.IronGolem; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class TeamIronGolem extends DespawnableProvider { + + @Override + public DespawnableType getType() { + return DespawnableType.IRON_GOLEM; + } + + @Override + String getDisplayName(@NotNull DespawnableAttributes attr, @NotNull ITeam team) { + Language lang = Language.getDefaultLanguage(); + return lang.m(Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME).replace("{despawn}", String.valueOf(attr.despawnSeconds()) + .replace("{health}", StringUtils.repeat(lang.m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) + .replace("{TeamColor}", team.getColor().chat().toString()) + ); + } + + public @NotNull IronGolem spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api) { + + var bukkitEntity = (IronGolem) Objects.requireNonNull(location.getWorld()).spawnEntity(location, EntityType.IRON_GOLEM); + applyDefaultSettings(bukkitEntity, attr, team); + + var entity = (EntityIronGolem) ((CraftEntity) bukkitEntity).getHandle(); + + clearSelectors(entity); + var goalSelector = getGoalSelector(entity); + var targetSelector = getTargetSelector(entity); + + goalSelector.a(1, new PathfinderGoalFloat(entity)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(entity, 1.5D, false)); + goalSelector.a(3, new PathfinderGoalRandomStroll(entity, 1D)); + goalSelector.a(4, new PathfinderGoalRandomLookaround(entity)); + targetSelector.a(1, new PathfinderGoalHurtByTarget(entity)); + targetSelector.a(2, getTargetGoal(entity, team, api)); + + return bukkitEntity; + } +} diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamSilverfish.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamSilverfish.java new file mode 100644 index 000000000..45477e35b --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/despawnable/TeamSilverfish.java @@ -0,0 +1,56 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2.despawnable; + +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat; +import net.minecraft.world.entity.ai.goal.PathfinderGoalMeleeAttack; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomLookaround; +import net.minecraft.world.entity.ai.goal.PathfinderGoalRandomStroll; +import net.minecraft.world.entity.ai.goal.target.PathfinderGoalHurtByTarget; +import net.minecraft.world.entity.monster.EntitySilverfish; +import org.apache.commons.lang.StringUtils; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_20_R2.entity.CraftEntity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Silverfish; +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +public class TeamSilverfish extends DespawnableProvider { + @Override + public DespawnableType getType() { + return DespawnableType.SILVERFISH; + } + + @Override + String getDisplayName(@NotNull DespawnableAttributes attr, @NotNull ITeam team) { + Language lang = Language.getDefaultLanguage(); + return lang.m(Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME).replace("{despawn}", String.valueOf(attr.despawnSeconds()) + .replace("{health}", StringUtils.repeat(lang.m(Messages.FORMATTING_DESPAWNABLE_UTILITY_NPC_HEALTH) + " ", 10)) + .replace("{TeamColor}", team.getColor().chat().toString()) + ); + } + + @Override + public Silverfish spawn(@NotNull DespawnableAttributes attr, @NotNull Location location, @NotNull ITeam team, VersionSupport api) { + var bukkitEntity = (Silverfish) Objects.requireNonNull(location.getWorld()).spawnEntity(location, EntityType.SILVERFISH); + applyDefaultSettings(bukkitEntity, attr, team); + + var entity = (EntitySilverfish) ((CraftEntity) bukkitEntity).getHandle(); + clearSelectors(entity); + + var goalSelector = getGoalSelector(entity); + var targetSelector = getTargetSelector(entity); + goalSelector.a(1, new PathfinderGoalFloat(entity)); + goalSelector.a(2, new PathfinderGoalMeleeAttack(entity, 1.9D, false)); + goalSelector.a(3, new PathfinderGoalRandomStroll(entity, 2D)); + goalSelector.a(4, new PathfinderGoalRandomLookaround(entity)); + targetSelector.a(1, new PathfinderGoalHurtByTarget(entity)); + targetSelector.a(2, getTargetGoal(entity, team, api)); + + return bukkitEntity; + } +} diff --git a/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/v1_20_R2.java b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/v1_20_R2.java new file mode 100644 index 000000000..31ce34f5f --- /dev/null +++ b/versionsupport_v1_20_R2/src/main/java/com/andrei1058/bedwars/support/version/v1_20_R2/v1_20_R2.java @@ -0,0 +1,836 @@ +package com.andrei1058.bedwars.support.version.v1_20_R2; + +import com.andrei1058.bedwars.api.arena.IArena; +import com.andrei1058.bedwars.api.arena.shop.ShopHolo; +import com.andrei1058.bedwars.api.arena.team.ITeam; +import com.andrei1058.bedwars.api.arena.team.TeamColor; +import com.andrei1058.bedwars.api.entity.Despawnable; +import com.andrei1058.bedwars.api.events.player.PlayerKillEvent; +import com.andrei1058.bedwars.api.language.Language; +import com.andrei1058.bedwars.api.language.Messages; +import com.andrei1058.bedwars.api.server.VersionSupport; +import com.andrei1058.bedwars.support.version.common.VersionCommon; +import com.andrei1058.bedwars.support.version.v1_20_R2.despawnable.DespawnableAttributes; +import com.andrei1058.bedwars.support.version.v1_20_R2.despawnable.DespawnableFactory; +import com.andrei1058.bedwars.support.version.v1_20_R2.despawnable.DespawnableType; +import com.mojang.datafixers.util.Pair; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; +import net.minecraft.core.particles.ParticleParamRedstone; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.*; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.level.EntityPlayer; +import net.minecraft.server.network.PlayerConnection; +import net.minecraft.world.entity.EntityLiving; +import net.minecraft.world.entity.EnumItemSlot; +import net.minecraft.world.entity.item.EntityTNTPrimed; +import net.minecraft.world.entity.projectile.EntityFireball; +import net.minecraft.world.entity.projectile.IProjectile; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.*; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBase; +import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; +import org.bukkit.block.data.type.Bed; +import org.bukkit.block.data.type.Ladder; +import org.bukkit.block.data.type.WallSign; +import org.bukkit.command.Command; +import org.bukkit.craftbukkit.v1_20_R2.CraftServer; +import org.bukkit.craftbukkit.v1_20_R2.entity.*; +import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack; +import org.bukkit.entity.*; +import org.bukkit.event.inventory.InventoryEvent; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.joml.Vector3f; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.logging.Level; + +@SuppressWarnings("unused") +public class v1_20_R2 extends VersionSupport { + + private final DespawnableFactory despawnableFactory; + + public v1_20_R2(Plugin plugin, String name) { + super(plugin, name); + loadDefaultEffects(); + this.despawnableFactory = new DespawnableFactory(this); + } + + @Override + public void registerVersionListeners() { + new VersionCommon(this); + } + + @Override + public void registerCommand(String name, Command cmd) { + ((CraftServer) getPlugin().getServer()).getCommandMap().register(name, cmd); + } + + @Override + public String getTag(org.bukkit.inventory.ItemStack itemStack, String key) { + var tag = getTag(itemStack); + return tag == null ? null : tag.e(key) ? tag.l(key) : null; + } + + @Override + public void sendTitle(@NotNull Player p, String title, String subtitle, int fadeIn, int stay, int fadeOut) { + p.sendTitle(title == null ? " " : title, subtitle == null ? " " : subtitle, fadeIn, stay, fadeOut); + } + + public void spawnSilverfish(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn, double damage) { + var attr = new DespawnableAttributes(DespawnableType.SILVERFISH, speed, health, damage, despawn); + var entity = despawnableFactory.spawn(attr, loc, bedWarsTeam); + + new Despawnable( + entity, + bedWarsTeam, despawn, + Messages.SHOP_UTILITY_NPC_SILVERFISH_NAME, + PlayerKillEvent.PlayerKillCause.SILVERFISH_FINAL_KILL, + PlayerKillEvent.PlayerKillCause.SILVERFISH + ); + } + + @Override + public void spawnIronGolem(Location loc, ITeam bedWarsTeam, double speed, double health, int despawn) { + var attr = new DespawnableAttributes(DespawnableType.IRON_GOLEM, speed, health, 4, despawn); + var entity = despawnableFactory.spawn(attr, loc, bedWarsTeam); + new Despawnable( + entity, + bedWarsTeam, despawn, + Messages.SHOP_UTILITY_NPC_IRON_GOLEM_NAME, + PlayerKillEvent.PlayerKillCause.IRON_GOLEM_FINAL_KILL, + PlayerKillEvent.PlayerKillCause.IRON_GOLEM + ); + } + + @Override + public void playAction(@NotNull Player p, String text) { + p.spigot().sendMessage( + ChatMessageType.ACTION_BAR, + new TextComponent(ChatColor.translateAlternateColorCodes('&', text) + ) + ); + } + + @Override + public boolean isBukkitCommandRegistered(String name) { + return ((CraftServer) getPlugin().getServer()).getCommandMap().getCommand(name) != null; + } + + @Override + public org.bukkit.inventory.ItemStack getItemInHand(@NotNull Player p) { + return p.getInventory().getItemInMainHand(); + } + + @Override + public void hideEntity(@NotNull Entity e, Player p) { + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(e.getEntityId()); + this.sendPacket(p, packet); + } + + @Override + public void minusAmount(Player p, org.bukkit.inventory.@NotNull ItemStack i, int amount) { + if (i.getAmount() - amount <= 0) { + if (p.getInventory().getItemInOffHand().equals(i)) { + p.getInventory().setItemInOffHand(null); + } else { + p.getInventory().removeItem(i); + } + return; + } + i.setAmount(i.getAmount() - amount); + + // todo this is marked as unstable on 1.20 for some reason + p.updateInventory(); + } + + @Override + public void setSource(TNTPrimed tnt, Player owner) { + EntityLiving nmsEntityLiving = (((CraftLivingEntity) owner).getHandle()); + EntityTNTPrimed nmsTNT = (((CraftTNTPrimed) tnt).getHandle()); + try { + Field sourceField = EntityTNTPrimed.class.getDeclaredField("d"); + sourceField.setAccessible(true); + sourceField.set(nmsTNT, nmsEntityLiving); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Override + public boolean isArmor(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemArmor || i instanceof ItemElytra; + + } + + @Override + public boolean isTool(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemTool; + } + + @Override + public boolean isSword(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemSword; + } + + @Override + public boolean isAxe(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemAxe; + } + + @Override + public boolean isBow(org.bukkit.inventory.ItemStack itemStack) { + var i = getItem(itemStack); + if (null == i) return false; + return i instanceof ItemBow; + } + + @Override + public boolean isProjectile(org.bukkit.inventory.ItemStack itemStack) { + var entity = getEntity(itemStack); + if (null == entity) return false; + return entity instanceof IProjectile; + } + + @Override + public boolean isInvisibilityPotion(org.bukkit.inventory.@NotNull ItemStack itemStack) { + if (!itemStack.getType().equals(org.bukkit.Material.POTION)) return false; + + org.bukkit.inventory.meta.PotionMeta pm = (org.bukkit.inventory.meta.PotionMeta) itemStack.getItemMeta(); + + return pm != null && pm.hasCustomEffects() && pm.hasCustomEffect(org.bukkit.potion.PotionEffectType.INVISIBILITY); + } + + @Override + public void registerEntities() { + } + + @Override + public void spawnShop(@NotNull Location loc, String name1, List players, IArena arena) { + Location l = loc.clone(); + + if (l.getWorld() == null) return; + Villager vlg = (Villager) l.getWorld().spawnEntity(loc, EntityType.VILLAGER); + vlg.setAI(false); + vlg.setRemoveWhenFarAway(false); + vlg.setCollidable(false); + vlg.setInvulnerable(true); + vlg.setSilent(true); + + for (Player p : players) { + String[] name = Language.getMsg(p, name1).split(","); + if (name.length == 1) { + ArmorStand a = createArmorStand(name[0], l.clone().add(0, 1.85, 0)); + new ShopHolo(Language.getPlayerLanguage(p).getIso(), a, null, l, arena); + } else { + ArmorStand a = createArmorStand(name[0], l.clone().add(0, 2.1, 0)); + ArmorStand b = createArmorStand(name[1], l.clone().add(0, 1.85, 0)); + new ShopHolo(Language.getPlayerLanguage(p).getIso(), a, b, l, arena); + } + } + for (ShopHolo sh : ShopHolo.getShopHolo()) { + if (sh.getA() == arena) { + sh.update(); + } + } + } + + @Override + public double getDamage(org.bukkit.inventory.ItemStack i) { + var tag = getTag(i); + if (null == tag) { + throw new RuntimeException("Provided item has no Tag"); + } + return tag.k("generic.attackDamage"); + } + + private static ArmorStand createArmorStand(String name, Location loc) { + if (loc == null) return null; + if (loc.getWorld() == null) return null; + ArmorStand a = loc.getWorld().spawn(loc, ArmorStand.class); + a.setGravity(false); + a.setVisible(false); + a.setCustomNameVisible(true); + a.setCustomName(name); + return a; + } + + @Override + public void voidKill(Player p) { + EntityPlayer player = getPlayer(p); + player.a(player.dM().m(), 1000); + } + + @Override + public void hideArmor(@NotNull Player victim, Player receiver) { + List> items = new ArrayList<>(); + items.add(new Pair<>(EnumItemSlot.f, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.e, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.d, new ItemStack(Item.b(0)))); + items.add(new Pair<>(EnumItemSlot.c, new ItemStack(Item.b(0)))); + PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items); + sendPacket(receiver, packet1); + } + + @Override + public void showArmor(@NotNull Player victim, Player receiver) { + List> items = new ArrayList<>(); + items.add(new Pair<>(EnumItemSlot.f, CraftItemStack.asNMSCopy(victim.getInventory().getHelmet()))); + items.add(new Pair<>(EnumItemSlot.e, CraftItemStack.asNMSCopy(victim.getInventory().getChestplate()))); + items.add(new Pair<>(EnumItemSlot.d, CraftItemStack.asNMSCopy(victim.getInventory().getLeggings()))); + items.add(new Pair<>(EnumItemSlot.c, CraftItemStack.asNMSCopy(victim.getInventory().getBoots()))); + PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items); + sendPacket(receiver, packet1); + } + + @Override + public void spawnDragon(Location l, ITeam bwt) { + if (l == null || l.getWorld() == null) { + getPlugin().getLogger().log(Level.WARNING, "Could not spawn Dragon. Location is null"); + return; + } + EnderDragon ed = (EnderDragon) l.getWorld().spawnEntity(l, EntityType.ENDER_DRAGON); + ed.setPhase(EnderDragon.Phase.CIRCLING); + } + + @Override + public void colorBed(ITeam bwt) { + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + BlockState bed = bwt.getBed().clone().add(x, 0, z).getBlock().getState(); + if (bed instanceof Bed) { + bed.setType(bwt.getColor().bedMaterial()); + bed.update(); + } + } + } + } + + @Override + public void registerTntWhitelist(float endStoneBlast, float glassBlast) { + try { + // blast resistance + Field field = BlockBase.class.getDeclaredField("aF"); + field.setAccessible(true); + // end stone + field.set(Blocks.fz, endStoneBlast); + // obsidian +// field.set(Blocks.co, glassBlast); + // standard glass + field.set(Blocks.aQ, glassBlast); + + var coloredGlass = new net.minecraft.world.level.block.Block[]{ + Blocks.ej, Blocks.ek, Blocks.el, Blocks.em, + Blocks.en, Blocks.eo, Blocks.ep, Blocks.eq, + Blocks.er, Blocks.es, Blocks.et, Blocks.eu, + Blocks.ev, Blocks.ew, Blocks.ex, Blocks.ey, + + // tinted glass + Blocks.qB, + }; + + Arrays.stream(coloredGlass).forEach( + glass -> { + try { + field.set(glass, glassBlast); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + ); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + @Override + public void setBlockTeamColor(@NotNull Block block, TeamColor teamColor) { + if (block.getType().toString().contains("STAINED_GLASS") || block.getType().toString().equals("GLASS")) { + block.setType(teamColor.glassMaterial()); + } else if (block.getType().toString().contains("_TERRACOTTA")) { + block.setType(teamColor.glazedTerracottaMaterial()); + } else if (block.getType().toString().contains("_WOOL")) { + block.setType(teamColor.woolMaterial()); + } + } + + @Override + public void setCollide(@NotNull Player p, IArena a, boolean value) { + p.setCollidable(value); + if (a == null) return; + a.updateSpectatorCollideRule(p, value); + } + + @Override + public org.bukkit.inventory.ItemStack addCustomData(org.bukkit.inventory.ItemStack i, String data) { + var tag = getCreateTag(i); + tag.a(VersionSupport.PLUGIN_TAG_GENERIC_KEY, data); + return applyTag(i, tag); + } + + @Override + public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) { + var tag = getCreateTag(itemStack); + tag.a(key, value); + return applyTag(itemStack, tag); + } + + @Override + public boolean isCustomBedWarsItem(org.bukkit.inventory.ItemStack i) { + return getCreateTag(i).e(VersionSupport.PLUGIN_TAG_GENERIC_KEY); + } + + @Override + public String getCustomData(org.bukkit.inventory.ItemStack i) { + return getCreateTag(i).l(VersionSupport.PLUGIN_TAG_GENERIC_KEY); + } + + @Override + public org.bukkit.inventory.ItemStack colourItem(org.bukkit.inventory.ItemStack itemStack, ITeam bedWarsTeam) { + if (itemStack == null) return null; + String type = itemStack.getType().toString(); + if (isBed(itemStack.getType())) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().bedMaterial(), itemStack.getAmount()); + } else if (type.contains("_STAINED_GLASS_PANE")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glassPaneMaterial(), itemStack.getAmount()); + } else if (type.contains("STAINED_GLASS") || type.equals("GLASS")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glassMaterial(), itemStack.getAmount()); + } else if (type.contains("_TERRACOTTA")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().glazedTerracottaMaterial(), itemStack.getAmount()); + } else if (type.contains("_WOOL")) { + return new org.bukkit.inventory.ItemStack(bedWarsTeam.getColor().woolMaterial(), itemStack.getAmount()); + } + return itemStack; + } + + @Override + public org.bukkit.inventory.ItemStack createItemStack(String material, int amount, short data) { + org.bukkit.inventory.ItemStack i; + try { + i = new org.bukkit.inventory.ItemStack(org.bukkit.Material.valueOf(material), amount); + } catch (Exception ex) { + getPlugin().getLogger().log(Level.WARNING, material + " is not a valid " + getName() + " material!"); + i = new org.bukkit.inventory.ItemStack(org.bukkit.Material.BEDROCK); + } + return i; + } + + @Override + public org.bukkit.Material materialFireball() { + return org.bukkit.Material.FIRE_CHARGE; + } + + @Override + public org.bukkit.Material materialPlayerHead() { + return org.bukkit.Material.PLAYER_HEAD; + } + + @Override + public org.bukkit.Material materialSnowball() { + return org.bukkit.Material.SNOWBALL; + } + + @Override + public org.bukkit.Material materialGoldenHelmet() { + return org.bukkit.Material.GOLDEN_HELMET; + } + + @Override + public org.bukkit.Material materialGoldenChestPlate() { + return org.bukkit.Material.GOLDEN_CHESTPLATE; + } + + @Override + public org.bukkit.Material materialGoldenLeggings() { + return org.bukkit.Material.GOLDEN_LEGGINGS; + } + + @Override + public org.bukkit.Material materialNetheriteHelmet() { + return Material.NETHERITE_HELMET; + } + + @Override + public org.bukkit.Material materialNetheriteChestPlate() { + return Material.NETHERITE_CHESTPLATE; + } + + @Override + public org.bukkit.Material materialNetheriteLeggings() { + return Material.NETHERITE_LEGGINGS; + } + + @Override + public org.bukkit.Material materialElytra() { + return Material.ELYTRA; + } + + @Override + public org.bukkit.Material materialCake() { + return org.bukkit.Material.CAKE; + } + + @Override + public org.bukkit.Material materialCraftingTable() { + return org.bukkit.Material.CRAFTING_TABLE; + } + + @Override + public org.bukkit.Material materialEnchantingTable() { + return org.bukkit.Material.ENCHANTING_TABLE; + } + + @Override + public org.bukkit.Material woolMaterial() { + return org.bukkit.Material.WHITE_WOOL; + } + + @Override + public String getShopUpgradeIdentifier(org.bukkit.inventory.ItemStack itemStack) { + var tag = getCreateTag(itemStack); + return tag.e(VersionSupport.PLUGIN_TAG_TIER_KEY) ? tag.l(VersionSupport.PLUGIN_TAG_TIER_KEY) : "null"; + } + + @Override + public org.bukkit.inventory.ItemStack setShopUpgradeIdentifier(org.bukkit.inventory.ItemStack itemStack, String identifier) { + var tag = getCreateTag(itemStack); + tag.a(VersionSupport.PLUGIN_TAG_TIER_KEY, identifier); + return applyTag(itemStack, tag); + } + + @Override + public org.bukkit.inventory.ItemStack getPlayerHead(Player player, org.bukkit.inventory.ItemStack copyTagFrom) { + org.bukkit.inventory.ItemStack head = new org.bukkit.inventory.ItemStack(materialPlayerHead()); + + if (copyTagFrom != null) { + var tag = getTag(copyTagFrom); + head = applyTag(head, tag); + } + + var meta = head.getItemMeta(); + if (meta instanceof SkullMeta) { + ((SkullMeta) meta).setOwnerProfile(player.getPlayerProfile()); + } + head.setItemMeta(meta); + return head; + } + + @Override + public void sendPlayerSpawnPackets(Player respawned, IArena arena) { + if (respawned == null) return; + if (arena == null) return; + if (!arena.isPlayer(respawned)) return; + + // if method was used when the player was still in re-spawning screen + if (arena.getRespawnSessions().containsKey(respawned)) return; + + EntityPlayer entityPlayer = getPlayer(respawned); + PacketPlayOutSpawnEntity show = new PacketPlayOutSpawnEntity(entityPlayer); + PacketPlayOutEntityVelocity playerVelocity = new PacketPlayOutEntityVelocity(entityPlayer); + // we send head rotation packet because sometimes on respawn others see him with bad rotation + PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw())); + + // retrieve current armor and in-hand items + // we send a packet later for timing issues where other players do not see them + List> list = getPlayerEquipment(entityPlayer); + + + for (Player p : arena.getPlayers()) { + if (p == null) continue; + if (p.equals(respawned)) continue; + // if p is in re-spawning screen continue + if (arena.getRespawnSessions().containsKey(p)) continue; + + EntityPlayer boundTo = getPlayer(p); + if (p.getWorld().equals(respawned.getWorld())) { + if (respawned.getLocation().distance(p.getLocation()) <= arena.getRenderDistance()) { + + // send respawned player to regular players + this.sendPackets( + p, show, head, playerVelocity, + new PacketPlayOutEntityEquipment(respawned.getEntityId(), list) + ); + + // send nearby players to respawned player + // if the player has invisibility hide armor + if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + hideArmor(p, respawned); + } else { + + PacketPlayOutSpawnEntity show2 = new PacketPlayOutSpawnEntity(boundTo); + PacketPlayOutEntityVelocity playerVelocity2 = new PacketPlayOutEntityVelocity(boundTo); + PacketPlayOutEntityHeadRotation head2 = new PacketPlayOutEntityHeadRotation(boundTo, getCompressedAngle(boundTo.getBukkitYaw())); + this.sendPackets(respawned, show2, playerVelocity2, head2); + + showArmor(p, respawned); + } + } + } + } + + for (Player spectator : arena.getSpectators()) { + if (spectator == null) continue; + if (spectator.equals(respawned)) continue; + EntityPlayer boundTo = ((CraftPlayer) spectator).getHandle(); + respawned.hidePlayer(getPlugin(), spectator); + if (spectator.getWorld().equals(respawned.getWorld())) { + if (respawned.getLocation().distance(spectator.getLocation()) <= arena.getRenderDistance()) { + + // send respawned player to spectator + this.sendPackets( + spectator, show, playerVelocity, + new PacketPlayOutEntityEquipment(respawned.getEntityId(), list), + new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw())) + ); + } + } + } + } + + @Override + public String getInventoryName(@NotNull InventoryEvent e) { + return e.getView().getTitle(); + } + + @Override + public void setUnbreakable(@NotNull ItemMeta itemMeta) { + itemMeta.setUnbreakable(true); + } + + @Override + public String getMainLevel() { + //noinspection deprecation + return ((DedicatedServer) MinecraftServer.getServer()).a().m; + } + + @Override + public int getVersion() { + return 9; + } + + @Override + public void setJoinSignBackground(@NotNull BlockState b, org.bukkit.Material material) { + if (b.getBlockData() instanceof WallSign) { + b.getBlock().getRelative(((WallSign) b.getBlockData()).getFacing().getOppositeFace()).setType(material); + } + } + + @Override + public void spigotShowPlayer(Player victim, @NotNull Player receiver) { + receiver.showPlayer(getPlugin(), victim); + } + + @Override + public void spigotHidePlayer(Player victim, @NotNull Player receiver) { + receiver.hidePlayer(getPlugin(), victim); + } + + @Override + public Fireball setFireballDirection(Fireball fireball, @NotNull Vector vector) { + EntityFireball fb = ((CraftFireball) fireball).getHandle(); + fb.b = vector.getX() * 0.1D; + fb.c = vector.getY() * 0.1D; + fb.d = vector.getZ() * 0.1D; + return (Fireball) fb.getBukkitEntity(); + } + + @Override + public void playRedStoneDot(@NotNull Player player) { + Color color = Color.RED; + PacketPlayOutWorldParticles particlePacket = new PacketPlayOutWorldParticles( + new ParticleParamRedstone( + new Vector3f((float) color.getRed(), + (float) color.getGreen(), + (float) color.getBlue()), (float) 1 + ), + true, + player.getLocation().getX(), + player.getLocation().getY() + 2.6, + player.getLocation().getZ(), + 0, 0, 0, 0, 0 + ); + for (Player inWorld : player.getWorld().getPlayers()) { + if (inWorld.equals(player)) continue; + this.sendPacket(inWorld, particlePacket); + } + } + + @Override + public void clearArrowsFromPlayerBody(Player player) { + // minecraft clears them on death on newer version + } + + /** + * Gets the NMS Item from ItemStack + */ + private @Nullable Item getItem(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.d(); + } + + /** + * Gets the NMS Entity from ItemStack + */ + private @Nullable net.minecraft.world.entity.Entity getEntity(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.H(); + } + + private @Nullable NBTTagCompound getTag(@NotNull org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + return null; + } + return i.v(); + } + + private @Nullable NBTTagCompound getTag(@NotNull ItemStack itemStack) { + return itemStack.v(); + } + + private @NotNull NBTTagCompound initializeTag(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return initializeTag(i); + } + + private @NotNull NBTTagCompound initializeTag(ItemStack itemStack) { + + var tag = getTag(itemStack); + if (null != tag) { + throw new RuntimeException("Provided item already has a Tag"); + } + tag = new NBTTagCompound(); + itemStack.c(tag); + + return tag; + } + + public NBTTagCompound getCreateTag(ItemStack itemStack) { + var tag = getTag(itemStack); + return null == tag ? initializeTag(itemStack) : tag; + } + + public NBTTagCompound getCreateTag(org.bukkit.inventory.ItemStack itemStack) { + var i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return getCreateTag(i); + } + + public org.bukkit.inventory.ItemStack applyTag(org.bukkit.inventory.ItemStack itemStack, NBTTagCompound tag) { + return CraftItemStack.asBukkitCopy(applyTag(getNmsItemCopy(itemStack), tag)); + } + + public ItemStack applyTag(@NotNull ItemStack itemStack, NBTTagCompound tag) { + itemStack.c(tag); + return itemStack; + } + + public ItemStack getNmsItemCopy(org.bukkit.inventory.ItemStack itemStack) { + ItemStack i = CraftItemStack.asNMSCopy(itemStack); + if (null == i) { + throw new RuntimeException("Cannot convert given item to a NMS item"); + } + return i; + } + + public EntityPlayer getPlayer(Player player) { + return ((CraftPlayer) player).getHandle(); + } + + public List> getPlayerEquipment(@NotNull Player player) { + return getPlayerEquipment(getPlayer(player)); + } + + public List> getPlayerEquipment(@NotNull EntityPlayer entityPlayer) { + List> list = new ArrayList<>(); + list.add(new Pair<>(EnumItemSlot.a, entityPlayer.c(EnumItemSlot.a))); + list.add(new Pair<>(EnumItemSlot.b, entityPlayer.c(EnumItemSlot.b))); + list.add(new Pair<>(EnumItemSlot.f, entityPlayer.c(EnumItemSlot.f))); + list.add(new Pair<>(EnumItemSlot.e, entityPlayer.c(EnumItemSlot.e))); + list.add(new Pair<>(EnumItemSlot.d, entityPlayer.c(EnumItemSlot.d))); + list.add(new Pair<>(EnumItemSlot.c, entityPlayer.c(EnumItemSlot.c))); + + return list; + } + + @Override + public void placeTowerBlocks(@NotNull Block b, @NotNull IArena a, @NotNull TeamColor color, int x, int y, int z) { + b.getRelative(x, y, z).setType(color.woolMaterial()); + a.addPlacedBlock(b.getRelative(x, y, z)); + } + + @Override + public void placeLadder(@NotNull Block b, int x, int y, int z, @NotNull IArena a, int ladderData) { + Block block = b.getRelative(x, y, z); //ladder block + block.setType(Material.LADDER); + Ladder ladder = (Ladder) block.getBlockData(); + a.addPlacedBlock(block); + switch (ladderData) { + case 2 -> { + ladder.setFacing(BlockFace.NORTH); + block.setBlockData(ladder); + } + case 3 -> { + ladder.setFacing(BlockFace.SOUTH); + block.setBlockData(ladder); + } + case 4 -> { + ladder.setFacing(BlockFace.WEST); + block.setBlockData(ladder); + } + case 5 -> { + ladder.setFacing(BlockFace.EAST); + block.setBlockData(ladder); + } + } + } + + @Override + public void playVillagerEffect(@NotNull Player player, Location location) { + player.spawnParticle(Particle.VILLAGER_HAPPY, location, 1); + } + + private void sendPacket(Player player, Packet packet) { + ((CraftPlayer) player).getHandle().c.a(packet); + } + + private void sendPackets(Player player, Packet @NotNull ... packets) { + PlayerConnection connection = ((CraftPlayer) player).getHandle().c; + for (Packet p : packets) { + connection.a(p); + } + } +} \ No newline at end of file