├── .gitignore ├── libs └── RealPermissions.jar ├── realskywars-plugin ├── src │ └── main │ │ ├── resources │ │ ├── sql.yml │ │ ├── plugin.yml │ │ ├── achievements.yml │ │ ├── kits.yml │ │ └── config.yml │ │ └── java │ │ └── joserodpt │ │ └── realskywars │ │ └── plugin │ │ ├── commands │ │ ├── WrongUsage.java │ │ ├── BaseCommandWA.java │ │ └── SairCMD.java │ │ ├── UpdateChecker.java │ │ ├── managers │ │ ├── HologramManager.java │ │ ├── LeaderboardManager.java │ │ ├── AchievementsManager.java │ │ ├── LobbyManager.java │ │ └── PartiesManager.java │ │ ├── currency │ │ ├── LocalCurrencyAdapter.java │ │ └── VaultCurrencyAdapter.java │ │ └── listeners │ │ └── EventListener.java └── RealSkywarsPlugin.iml ├── realskywars-api ├── src │ └── main │ │ ├── resources │ │ └── plugin.yml │ │ └── java │ │ └── joserodpt │ │ └── realskywars │ │ └── api │ │ ├── utils │ │ ├── TeamColorLoop.java │ │ ├── Pair.java │ │ ├── Demolition.java │ │ ├── Pagination.java │ │ ├── BungeecordUtils.java │ │ ├── MathUtils.java │ │ ├── FireworkUtils.java │ │ ├── CountdownTimer.java │ │ └── Itens.java │ │ ├── player │ │ ├── tab │ │ │ ├── RSWPlayerTabInterface.java │ │ │ └── RSWPlayerTabNoStyle.java │ │ └── RSWGameLog.java │ │ ├── effects │ │ ├── RSWTrail.java │ │ ├── RSWBowTrail.java │ │ └── RSWBlockWinTrail.java │ │ ├── managers │ │ ├── HologramManagerAPI.java │ │ ├── world │ │ │ ├── SWWorldEngine.java │ │ │ ├── RSWWorld.java │ │ │ └── engines │ │ │ │ ├── SWWorldDefaultEngine.java │ │ │ │ └── SWWorldSchematicEngine.java │ │ ├── AchievementsManagerAPI.java │ │ ├── ShopManagerAPI.java │ │ ├── holograms │ │ │ ├── support │ │ │ │ ├── NoHologram.java │ │ │ │ ├── DHHologram.java │ │ │ │ └── HDHologram.java │ │ │ └── RSWHologram.java │ │ ├── LobbyManagerAPI.java │ │ ├── KitManagerAPI.java │ │ ├── PartiesManagerAPI.java │ │ ├── LeaderboardManagerAPI.java │ │ ├── LanguageManagerAPI.java │ │ ├── PlayerManagerAPI.java │ │ ├── DatabaseManagerAPI.java │ │ ├── WorldManagerAPI.java │ │ └── MapManagerAPI.java │ │ ├── nms │ │ ├── RSWnms.java │ │ ├── NMS118R2andUP.java │ │ ├── ReflectionHelper.java │ │ ├── NMS117R1.java │ │ └── NMS114R1tov116R3.java │ │ ├── RSWEventsAPI.java │ │ ├── currency │ │ └── CurrencyAdapterAPI.java │ │ ├── achievements │ │ ├── RSWAchievement.java │ │ └── types │ │ │ └── RSWAchievementRCoin.java │ │ ├── shop │ │ └── items │ │ │ ├── RSWParticleItem.java │ │ │ └── RSWSpectatorShopItem.java │ │ ├── Debugger.java │ │ ├── leaderboards │ │ ├── RSWLeaderboardRow.java │ │ └── RSWLeaderboard.java │ │ ├── events │ │ └── RSWRoomStateChangeEvent.java │ │ ├── chests │ │ └── RSWChestItem.java │ │ ├── config │ │ ├── RSWSQLConfig.java │ │ ├── RSWMapsConfig.java │ │ ├── RSWKitsConfig.java │ │ ├── RSWLanguagesOldConfig.java │ │ ├── RSWShopsConfig.java │ │ ├── chests │ │ │ ├── EPICChestConfig.java │ │ │ ├── BasicChestConfig.java │ │ │ └── NormalChestConfig.java │ │ ├── RSWAchievementsConfig.java │ │ ├── RSWConfig.java │ │ └── TranslatableList.java │ │ ├── cages │ │ ├── RSWCage.java │ │ └── RSWSoloCage.java │ │ ├── kits │ │ └── KitInventory.java │ │ ├── database │ │ ├── PlayerBoughtItemsRow.java │ │ └── PlayerGameHistoryRow.java │ │ ├── map │ │ ├── modes │ │ │ └── PlaceholderMode.java │ │ ├── RSWSign.java │ │ └── RSWBossbar.java │ │ ├── party │ │ └── RSWParty.java │ │ └── RealSkywarsAPI.java ├── RealSkywarsAPI.iml └── dependency-reduced-pom.xml ├── .github └── workflows │ └── build.yml ├── LICENSE └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | target/ 3 | /RealSkywars.iml 4 | -------------------------------------------------------------------------------- /libs/RealPermissions.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joserodpt/RealSkywars/HEAD/libs/RealPermissions.jar -------------------------------------------------------------------------------- /realskywars-plugin/src/main/resources/sql.yml: -------------------------------------------------------------------------------- 1 | driver: "SQLITE" 2 | host: "localhost" 3 | database: "RealSkywars" 4 | username: "" 5 | password: "" 6 | port: 3306 -------------------------------------------------------------------------------- /realskywars-api/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: RealSkywarsAPI 2 | version: '${project.version}' 3 | main: joserodpt.realskywars.api.RealSkywarsAPI 4 | api-version: '1.14' 5 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: RealSkywars 2 | version: '${project.version}' 3 | main: joserodpt.realskywars.plugin.RealSkywarsPlugin 4 | api-version: '1.14' 5 | depend: [WorldEdit] 6 | softdepend: [My_Worlds, Multiverse-Core, HolographicDisplays, PlaceholderAPI, DecentHolograms, RealRegions, RealPermissions] 7 | authors: [JoseGamer_PT] 8 | description: Responsive and Efficient GUI Based Skywars Minigame Plugin 9 | load: POSTWORLD -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/TeamColorLoop.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | import org.bukkit.ChatColor; 4 | 5 | public class TeamColorLoop { 6 | 7 | static int loop = 15; 8 | 9 | public static ChatColor getTeamColor() { 10 | --loop; 11 | if (loop < 0) { 12 | loop = 15; 13 | } 14 | 15 | return ChatColor.values()[loop]; 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/commands/WrongUsage.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.commands; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface WrongUsage { 11 | String value(); 12 | } -------------------------------------------------------------------------------- /realskywars-api/RealSkywarsAPI.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SPIGOT 8 | 9 | 1 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /realskywars-plugin/RealSkywarsPlugin.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | SPIGOT 8 | 9 | 1 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/player/tab/RSWPlayerTabInterface.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.player.tab; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | import java.util.List; 6 | 7 | public interface RSWPlayerTabInterface { 8 | void addPlayers(Player p); 9 | 10 | void addPlayers(List p); 11 | 12 | void removePlayers(Player p); 13 | 14 | void reset(); 15 | 16 | void clear(); 17 | 18 | void setHeaderFooter(String h, String f); 19 | 20 | void updateRoomTAB(); 21 | } 22 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/resources/achievements.yml: -------------------------------------------------------------------------------- 1 | Version: 1 2 | Coins: 3 | Kills: 4 | 20: 50 5 | 50: 100 6 | 100: 200 7 | 200: 300 8 | 500: 1000 9 | 1000: 2000 10 | 2000: 5000 11 | Wins-Solo: 12 | 20: 500 13 | 50: 1000 14 | 100: 2000 15 | 200: 3000 16 | 500: 10000 17 | 1000: 20000 18 | 2000: 50000 19 | Wins-Teams: 20 | 20: 500 21 | 50: 1000 22 | 100: 2000 23 | 200: 3000 24 | 500: 10000 25 | 1000: 20000 26 | 2000: 50000 27 | Games-Played: 28 | 20: 500 29 | 50: 1000 30 | 100: 2000 31 | 200: 3000 32 | 500: 10000 33 | 1000: 20000 34 | 2000: 50000 -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: 📦 Build Minecraft Plugin 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - master 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Checkout repository 15 | uses: actions/checkout@v4 16 | 17 | - name: Set up JDK 23 18 | uses: actions/setup-java@v3 19 | with: 20 | distribution: temurin 21 | java-version: '23' 22 | 23 | - run: mvn --batch-mode --update-snapshots verify 24 | 25 | - name: Upload plugin artifact 26 | uses: actions/upload-artifact@v4 27 | with: 28 | name: RealSkywars 29 | path: realskywars-plugin/target/*.jar 30 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/effects/RSWTrail.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.effects; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | public interface RSWTrail { 19 | void startTask(); 20 | 21 | void cancelTask(); 22 | 23 | TrailType getType(); 24 | 25 | enum TrailType {BOW, WINBLOCK} 26 | } 27 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/HologramManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.managers.holograms.RSWHologram; 19 | 20 | public abstract class HologramManagerAPI { 21 | public abstract RSWHologram getHologramInstance(); 22 | } 23 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/nms/RSWnms.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.nms; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import org.bukkit.Material; 19 | import org.bukkit.block.Block; 20 | 21 | public interface RSWnms { 22 | void playChestAnimation(Block block, boolean open); 23 | 24 | String getItemName(Material material); 25 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/RSWEventsAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.events.RSWRoomStateChangeEvent; 19 | import joserodpt.realskywars.api.map.RSWMap; 20 | import org.bukkit.Bukkit; 21 | 22 | public class RSWEventsAPI { 23 | public void callRoomStateChange(RSWMap g) { 24 | Bukkit.getPluginManager().callEvent(new RSWRoomStateChangeEvent(g)); 25 | g.updateSigns(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 José Rodrigues 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/world/SWWorldEngine.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.world; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.map.RSWMap; 19 | import org.bukkit.World; 20 | 21 | public interface SWWorldEngine { 22 | 23 | World getWorld(); 24 | 25 | void resetWorld(RSWMap.OperationReason rr); 26 | 27 | void deleteWorld(RSWMap.OperationReason rr); 28 | 29 | void setTime(long l); 30 | 31 | String getName(); 32 | 33 | RSWWorld.WorldType getType(); 34 | 35 | void save(); 36 | } 37 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/currency/CurrencyAdapterAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.currency; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.player.RSWPlayer; 19 | 20 | public interface CurrencyAdapterAPI { 21 | void transferCoins(RSWPlayer toPlayer, RSWPlayer fromPLayer, double amount); 22 | 23 | void addCoins(RSWPlayer p, double amount); 24 | 25 | boolean removeCoins(RSWPlayer p, double amount); 26 | 27 | void setCoins(RSWPlayer p, double amount); 28 | 29 | double getCoins(RSWPlayer p); 30 | 31 | String getCoinsFormatted(RSWPlayer p); 32 | } 33 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/AchievementsManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.achievements.RSWAchievement; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | 21 | import java.util.List; 22 | 23 | public abstract class AchievementsManagerAPI { 24 | public abstract void loadAchievements(); 25 | 26 | public abstract List getAchievements(RSWPlayer.PlayerStatistics ds); 27 | 28 | public abstract RSWAchievement getAchievement(RSWPlayer.PlayerStatistics ps, int meta); 29 | } 30 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/ShopManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.player.RSWPlayer; 19 | import joserodpt.realskywars.api.shop.RSWBuyableItem; 20 | 21 | import java.util.Collection; 22 | 23 | public abstract class ShopManagerAPI { 24 | public abstract Collection getCategoryContents(RSWBuyableItem.ItemCategory t); 25 | 26 | public abstract Collection getBoughtItems(RSWBuyableItem.ItemCategory t, RSWPlayer p); 27 | 28 | public abstract void loadShopItems(); 29 | } 30 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/holograms/support/NoHologram.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.holograms.support; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.managers.holograms.RSWHologram; 19 | import org.bukkit.Location; 20 | 21 | public class NoHologram implements RSWHologram { 22 | @Override 23 | public void spawnHologram(Location loc) { 24 | } 25 | 26 | @Override 27 | public void setTime(int seconds) { 28 | } 29 | 30 | @Override 31 | public void deleteHologram() { 32 | } 33 | 34 | @Override 35 | public HType getType() { 36 | return HType.NONE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/achievements/RSWAchievement.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.achievements; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | import org.bukkit.inventory.ItemStack; 21 | 22 | public interface RSWAchievement { 23 | String getAchievementName(); 24 | 25 | String getRewardName(); 26 | 27 | void giveAchievement(RSWPlayer rswPlayer); 28 | 29 | RSWPlayer.PlayerStatistics getType(); 30 | 31 | RSWAchievement.RewardType getRewardType(); 32 | 33 | int getGoal(); 34 | 35 | Object getReward(); 36 | 37 | ItemStack getItem(RSWPlayer p); 38 | 39 | enum RewardType {COINS} 40 | } 41 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | joserodpt.realskywars 8 | realskywars-parent 9 | 1.2.1 10 | pom 11 | 12 | 13 | 1.7 14 | 15 | 16 | realskywars-plugin 17 | realskywars-api 18 | 19 | 20 | RealSkywars-Parent 21 | Parent project for all RealSkywars modules. 22 | 23 | 24 | 25 | JoseGamerPT 26 | 27 | 28 | joserodpt 29 | 30 | 31 | 32 | 33 | GitHub 34 | https://github.com/joserodpt/RealSkywars/issues 35 | 36 | 37 | 38 | clean install 39 | 40 | 41 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/nms/NMS118R2andUP.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.nms; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.utils.Text; 19 | import org.bukkit.Material; 20 | import org.bukkit.block.Block; 21 | import org.bukkit.block.Chest; 22 | 23 | public class NMS118R2andUP implements RSWnms { 24 | 25 | @Override 26 | public void playChestAnimation(Block block, boolean open) { 27 | final Chest chest = (Chest) block.getState(); 28 | if (open) { 29 | chest.open(); 30 | } else { 31 | chest.close(); 32 | } 33 | chest.update(); 34 | } 35 | 36 | @Override 37 | public String getItemName(Material m) { 38 | return Text.beautifyEnumName(m.name()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/shop/items/RSWParticleItem.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.shop.items; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.shop.RSWBuyableItem; 19 | import org.bukkit.Material; 20 | import org.bukkit.Particle; 21 | 22 | import java.util.Map; 23 | 24 | public class RSWParticleItem extends RSWBuyableItem { 25 | 26 | public RSWParticleItem(String configKey, String displayName, Material material, Double price, String permission, String particleName) { 27 | super(configKey, displayName, material, price, permission, ItemCategory.BOW_PARTICLE, Map.of("Particle", particleName)); 28 | } 29 | 30 | public Particle getParticle() { 31 | return Particle.valueOf((String) this.getExtrasMap().get("Particle")); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/LobbyManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.player.RSWPlayer; 19 | import org.bukkit.Location; 20 | import org.bukkit.World; 21 | import org.bukkit.entity.Player; 22 | 23 | public abstract class LobbyManagerAPI { 24 | public abstract void loadLobby(); 25 | 26 | public abstract void tpToLobby(RSWPlayer p); 27 | 28 | public abstract Location getLobbyLocation(); 29 | 30 | public abstract boolean scoreboardInLobby(); 31 | 32 | public abstract void setLobbyLoc(Location location); 33 | 34 | public abstract boolean tpLobbyOnJoin(); 35 | 36 | public abstract boolean isInLobby(World w); 37 | 38 | public abstract void tpToLobby(Player player); 39 | } 40 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/KitManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.database.PlayerBoughtItemsRow; 19 | import joserodpt.realskywars.api.kits.RSWKit; 20 | import joserodpt.realskywars.api.shop.RSWBuyableItem; 21 | 22 | import java.util.Collection; 23 | 24 | public abstract class KitManagerAPI { 25 | public abstract void loadKits(); 26 | 27 | public abstract void registerKit(RSWKit k); 28 | 29 | public abstract void unregisterKit(RSWKit k); 30 | 31 | public abstract Collection getKits(); 32 | 33 | public abstract Collection getKitsAsBuyables(); 34 | 35 | public abstract RSWKit getKit(String string); 36 | 37 | public abstract RSWKit getKit(PlayerBoughtItemsRow playerBoughtItemsRow); 38 | } 39 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/PartiesManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.map.RSWMap; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | 24 | public abstract class PartiesManagerAPI { 25 | public Map invites = new HashMap<>(); 26 | 27 | public Boolean hasInvite(RSWPlayer p) { 28 | return invites.containsKey(p); 29 | } 30 | 31 | public RSWPlayer getInvite(RSWPlayer p) { 32 | return invites.get(p); 33 | } 34 | 35 | public abstract void sendInvite(RSWPlayer emissor, RSWPlayer recetor); 36 | 37 | public abstract void acceptInvite(RSWPlayer p); 38 | 39 | public abstract boolean checkForParties(RSWPlayer p, RSWMap swgm); 40 | } 41 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/commands/BaseCommandWA.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.commands; 2 | 3 | import dev.triumphteam.cmd.core.BaseCommand; 4 | import dev.triumphteam.cmd.core.annotation.SubCommand; 5 | import joserodpt.realskywars.api.utils.Text; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import java.lang.reflect.Method; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | public class BaseCommandWA extends BaseCommand { 13 | 14 | private final Map commandUsages = new HashMap<>(); 15 | 16 | public BaseCommandWA() { 17 | for (Method method : this.getClass().getMethods()) { 18 | if (method.isAnnotationPresent(WrongUsage.class) && method.isAnnotationPresent(SubCommand.class)) { 19 | String usage = method.getAnnotation(WrongUsage.class).value(); 20 | 21 | SubCommand subCommand = method.getAnnotation(SubCommand.class); 22 | 23 | String commandName = subCommand.value(); 24 | commandUsages.put(commandName, usage); 25 | for (String alias : subCommand.alias()) { 26 | commandUsages.put(alias, usage); 27 | } 28 | } 29 | } 30 | } 31 | 32 | public String getWrongUsage(@NotNull String subCommand) { 33 | return this.commandUsages.getOrDefault(subCommand, Text.color("&cWrong usage for the command!")); 34 | } 35 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/LeaderboardManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.database.PlayerDataRow; 19 | import joserodpt.realskywars.api.leaderboards.RSWLeaderboard; 20 | import org.jetbrains.annotations.NotNull; 21 | 22 | import java.sql.SQLException; 23 | import java.util.List; 24 | 25 | public abstract class LeaderboardManagerAPI { 26 | public abstract void refreshLeaderboards(); 27 | 28 | public abstract void refreshLeaderboard(RSWLeaderboard.RSWLeaderboardCategories l) throws SQLException; 29 | 30 | @NotNull 31 | protected abstract RSWLeaderboard getLeaderboard(RSWLeaderboard.RSWLeaderboardCategories l, List expansions); 32 | 33 | public abstract RSWLeaderboard getLeaderboard(RSWLeaderboard.RSWLeaderboardCategories l); 34 | } 35 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/Debugger.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import org.bukkit.Bukkit; 19 | 20 | import java.util.Objects; 21 | import java.util.logging.Level; 22 | 23 | public class Debugger { 24 | public static Boolean debug = false; 25 | 26 | public static void printerr(Class a, String b) { 27 | print(Level.SEVERE, a, b); 28 | } 29 | 30 | public static void print(Class a, String b) { 31 | print(Level.WARNING, a, b); 32 | } 33 | 34 | private static void print(Level l, Class a, String b) { 35 | if (debug) { 36 | Bukkit.getLogger().log(l, "[RSW:DEBUG] " + getName(a).replace("joserodpt.realskywars.", "") + " > " + b); 37 | } 38 | } 39 | 40 | static String getName(Class a) { 41 | Class enclosingClass = a.getEnclosingClass(); 42 | return Objects.requireNonNullElse(enclosingClass, a).getName(); 43 | } 44 | 45 | public static void execute() { 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/holograms/RSWHologram.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.holograms; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.managers.holograms.support.DHHologram; 19 | import joserodpt.realskywars.api.managers.holograms.support.HDHologram; 20 | import joserodpt.realskywars.api.managers.holograms.support.NoHologram; 21 | import org.bukkit.Location; 22 | 23 | public interface RSWHologram { 24 | enum HType { 25 | DECENT_HOLOGRAMS, HOLOGRAPHIC_DISPLAYS, NONE; 26 | 27 | public RSWHologram getHologramInstance() { 28 | switch (this) { 29 | case DECENT_HOLOGRAMS: 30 | return new DHHologram(); 31 | case HOLOGRAPHIC_DISPLAYS: 32 | return new HDHologram(); 33 | default: 34 | return new NoHologram(); 35 | } 36 | } 37 | } 38 | 39 | void spawnHologram(Location loc); 40 | 41 | void setTime(int seconds); 42 | 43 | void deleteHologram(); 44 | 45 | HType getType(); 46 | } 47 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/leaderboards/RSWLeaderboardRow.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.leaderboards; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import java.util.UUID; 19 | 20 | public class RSWLeaderboardRow { 21 | 22 | private final UUID uuid; 23 | private final String player; 24 | private final int total; 25 | private int place; 26 | 27 | public RSWLeaderboardRow(UUID uuid, String player, int statistic) { 28 | this.uuid = uuid; 29 | this.player = player; 30 | this.total = statistic; 31 | } 32 | 33 | public RSWLeaderboardRow() { 34 | this.uuid = UUID.randomUUID(); 35 | this.player = "?"; 36 | this.total = 0; 37 | } 38 | 39 | public String getPlayer() { 40 | return this.player; 41 | } 42 | 43 | public String getText() { 44 | return "&a" + this.place + ". &b" + this.player + " &f- &b" + this.total; 45 | } 46 | 47 | public RSWLeaderboardRow setPlace(int i) { 48 | this.place = i; 49 | return this; 50 | } 51 | 52 | public UUID getUuid() { 53 | return uuid; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/nms/ReflectionHelper.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.nms; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import org.bukkit.Bukkit; 20 | 21 | public class ReflectionHelper { 22 | private static final String CRAFTBUKKIT_PACKAGE = Bukkit.getServer().getClass().getPackage().getName(); 23 | 24 | public static Class getNMSClass(final String str) { 25 | return getClass("net.minecraft.server." + RealSkywarsAPI.getInstance().getServerVersion() + "." + str); 26 | } 27 | 28 | public static Class getCraftBukkitClass(final String str) { 29 | return getClass(CRAFTBUKKIT_PACKAGE + "." + str); 30 | } 31 | 32 | public static Class getClass(final String className) { 33 | try { 34 | return Class.forName(className); 35 | } catch (Exception ex) { 36 | RealSkywarsAPI.getInstance().getLogger().severe("Error while executing reflection (getClass) nms."); 37 | RealSkywarsAPI.getInstance().getLogger().severe(ex.toString()); 38 | return null; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/events/RSWRoomStateChangeEvent.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.events; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.map.RSWMap; 19 | import org.bukkit.event.Cancellable; 20 | import org.bukkit.event.Event; 21 | import org.bukkit.event.HandlerList; 22 | 23 | public class RSWRoomStateChangeEvent extends Event implements Cancellable { 24 | private final RSWMap room; 25 | private static final HandlerList HANDLERS_LIST = new HandlerList(); 26 | private boolean isCancelled; 27 | 28 | public RSWRoomStateChangeEvent(RSWMap gm) { 29 | this.room = gm; 30 | } 31 | 32 | @Override 33 | public boolean isCancelled() { 34 | return isCancelled; 35 | } 36 | 37 | @Override 38 | public void setCancelled(boolean cancelled) { 39 | this.isCancelled = cancelled; 40 | } 41 | 42 | @Override 43 | public HandlerList getHandlers() { 44 | return HANDLERS_LIST; 45 | } 46 | 47 | public static HandlerList getHandlerList() { 48 | return HANDLERS_LIST; 49 | } 50 | 51 | public RSWMap getRoom() { 52 | return this.room; 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/chests/RSWChestItem.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.chests; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.utils.Itens; 19 | import org.bukkit.inventory.ItemStack; 20 | 21 | import java.util.Arrays; 22 | 23 | public class RSWChestItem { 24 | 25 | private final ItemStack itemstack; 26 | private int chance; 27 | 28 | public RSWChestItem(ItemStack i, int chance) { 29 | this.itemstack = i; 30 | this.chance = chance; 31 | } 32 | 33 | public ItemStack getItemStack() { 34 | return this.itemstack; 35 | } 36 | 37 | public int getChance() { 38 | return this.chance; 39 | } 40 | 41 | public ItemStack getDisplayItemStack() { 42 | return Itens.addLore(this.getItemStack(), Arrays.asList("&fChance: &b" + this.chance + "%", "&7Click here to change the percentage.")); 43 | } 44 | 45 | public void setChance(int val) { 46 | this.chance = val; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "SWChestItem{" + 52 | "itemstack=" + itemstack + 53 | ", chance=" + chance + 54 | '}'; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/shop/items/RSWSpectatorShopItem.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.shop.items; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.config.TranslatableLine; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | import joserodpt.realskywars.api.shop.RSWBuyableItem; 21 | import joserodpt.realskywars.api.utils.Itens; 22 | import org.bukkit.Material; 23 | import org.bukkit.inventory.ItemStack; 24 | 25 | import java.util.Arrays; 26 | 27 | public class RSWSpectatorShopItem extends RSWBuyableItem { 28 | 29 | public RSWSpectatorShopItem(String configKey, String displayName, Material material, Double price, String permission) { 30 | super(configKey, displayName, material, price, permission, ItemCategory.SPEC_SHOP); 31 | } 32 | 33 | @Override 34 | public ItemStack getIcon(RSWPlayer p) { 35 | return Itens.createItem(this.getMaterial(), this.getAmount(), "&f" + this.getAmount() + "x " + this.getDisplayName(), Arrays.asList(TranslatableLine.SHOP_CLICK_2_BUY.get(p).replace("%price%", this.getPriceFormatted()), "", "&a&nF (Swap hand)&r&f to increase the item amount.", "&c&nQ (Drop)&r&f to decrease the item amount.")); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWSQLConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import org.bukkit.configuration.file.FileConfiguration; 20 | import org.bukkit.configuration.file.YamlConfiguration; 21 | import org.bukkit.plugin.Plugin; 22 | 23 | import java.io.File; 24 | import java.io.IOException; 25 | 26 | public class RSWSQLConfig { 27 | 28 | private static final String name = "sql.yml"; 29 | private static File file; 30 | private static FileConfiguration customFile; 31 | 32 | public static void setup(Plugin p) { 33 | file = new File(p.getDataFolder(), name); 34 | 35 | if (!file.exists()) { 36 | p.saveResource("sql.yml", false); 37 | } 38 | customFile = YamlConfiguration.loadConfiguration(file); 39 | } 40 | 41 | public static FileConfiguration file() { 42 | return customFile; 43 | } 44 | 45 | public static void save() { 46 | try { 47 | customFile.save(file); 48 | } catch (IOException e) { 49 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 50 | } 51 | } 52 | 53 | public static void reload() { 54 | customFile = YamlConfiguration.loadConfiguration(file); 55 | } 56 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/LanguageManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.config.RSWLanguage; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | import org.bukkit.Material; 21 | import org.bukkit.enchantments.Enchantment; 22 | import org.bukkit.entity.EntityType; 23 | 24 | import java.util.Collection; 25 | import java.util.HashMap; 26 | import java.util.Map; 27 | 28 | public abstract class LanguageManagerAPI { 29 | protected final Map langList = new HashMap<>(); 30 | 31 | public abstract void loadLanguages(); 32 | 33 | public abstract String getDefaultLanguage(); 34 | 35 | public abstract boolean areLanguagesEmpty(); 36 | 37 | public abstract Collection getLanguages(); 38 | 39 | public abstract Map getLanguagesMap(); 40 | 41 | public abstract String getPrefix(); 42 | 43 | public abstract String getMaterialName(RSWPlayer p, Material mat); 44 | 45 | public abstract String getMaterialName(Material mat); 46 | 47 | public abstract String getEnchantmentName(RSWPlayer p, Enchantment ench); 48 | 49 | public abstract String getEntityName(RSWPlayer p, EntityType type); 50 | 51 | public abstract RSWLanguage getLanguage(String language); 52 | } 53 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/PlayerManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.config.RSWLanguage; 19 | import joserodpt.realskywars.api.map.RSWMap; 20 | import joserodpt.realskywars.api.player.RSWPlayer; 21 | import org.bukkit.entity.Player; 22 | 23 | import java.util.Collection; 24 | import java.util.List; 25 | import java.util.Map; 26 | import java.util.UUID; 27 | 28 | public abstract class PlayerManagerAPI { 29 | public abstract void loadPlayer(Player p); 30 | 31 | public abstract RSWPlayer getPlayer(Player p); 32 | 33 | public abstract void savePlayer(RSWPlayer p, RSWPlayer.PlayerData pd); 34 | 35 | public abstract void setLanguage(RSWPlayer player, RSWLanguage lang); 36 | 37 | public abstract void loadPlayers(); 38 | 39 | public abstract int getPlayingPlayers(MapManagerAPI.MapGamemodes pt); 40 | 41 | public abstract void stopScoreboards(); 42 | 43 | public abstract Collection getPlayers(); 44 | 45 | public abstract void addPlayer(RSWPlayer rswPlayer); 46 | 47 | public abstract void removePlayer(RSWPlayer rswPlayer); 48 | 49 | public abstract void trackPlayer(RSWPlayer gp); 50 | 51 | public abstract List getTeleporting(); 52 | 53 | public abstract Map getFastJoin(); 54 | } 55 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/Pair.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | public class Pair { 19 | private K key; 20 | private V value; 21 | 22 | public Pair(K key, V value) { 23 | this.key = key; 24 | this.value = value; 25 | } 26 | 27 | public K getKey() { 28 | return key; 29 | } 30 | 31 | public void setKey(K key) { 32 | this.key = key; 33 | } 34 | 35 | public V getValue() { 36 | return value; 37 | } 38 | 39 | public void setValue(V value) { 40 | this.value = value; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "Pair{" + 46 | "key=" + key + 47 | ", value=" + value + 48 | '}'; 49 | } 50 | 51 | @Override 52 | public boolean equals(Object o) { 53 | if (this == o) return true; 54 | if (o == null || getClass() != o.getClass()) return false; 55 | 56 | Pair pair = (Pair) o; 57 | 58 | if (!key.equals(pair.key)) return false; 59 | return value.equals(pair.value); 60 | } 61 | 62 | @Override 63 | public int hashCode() { 64 | int result = key.hashCode(); 65 | result = 31 * result + value.hashCode(); 66 | return result; 67 | } 68 | } -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/UpdateChecker.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import org.bukkit.Bukkit; 19 | import org.bukkit.plugin.java.JavaPlugin; 20 | 21 | import java.io.BufferedReader; 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | import java.io.InputStreamReader; 25 | import java.net.URL; 26 | import java.util.Scanner; 27 | import java.util.function.Consumer; 28 | 29 | public class UpdateChecker { 30 | 31 | private final JavaPlugin plugin; 32 | private final int resourceId; 33 | 34 | public UpdateChecker(final JavaPlugin plugin, final int resourceId) { 35 | this.plugin = plugin; 36 | this.resourceId = resourceId; 37 | } 38 | 39 | public void getVersion(final Consumer consumer) { 40 | Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> { 41 | try (final InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); final Scanner ignored = new Scanner(inputStream)) { 42 | consumer.accept(new BufferedReader(new InputStreamReader(inputStream)).readLine()); 43 | } catch (final IOException exception) { 44 | this.plugin.getLogger().info("Cannot look for updates: " + exception.getMessage()); 45 | } 46 | }); 47 | } 48 | } -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/managers/HologramManager.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.managers.HologramManagerAPI; 20 | import joserodpt.realskywars.api.managers.holograms.RSWHologram; 21 | import org.bukkit.Bukkit; 22 | 23 | public class HologramManager extends HologramManagerAPI { 24 | 25 | private RSWHologram.HType selected = RSWHologram.HType.NONE; 26 | 27 | public HologramManager(RealSkywarsAPI rsa) { 28 | 29 | //select scoreboard plugin 30 | if (Bukkit.getPluginManager().isPluginEnabled("HolographicDisplays")) { 31 | this.selected = RSWHologram.HType.HOLOGRAPHIC_DISPLAYS; 32 | } 33 | if (Bukkit.getPluginManager().isPluginEnabled("DecentHolograms")) { 34 | this.selected = RSWHologram.HType.DECENT_HOLOGRAMS; 35 | } 36 | 37 | switch (this.selected) { 38 | case DECENT_HOLOGRAMS: 39 | rsa.getLogger().info("Hooked on Decent Holograms!"); 40 | break; 41 | case HOLOGRAPHIC_DISPLAYS: 42 | rsa.getLogger().info("Hooked on Holographic Displays!"); 43 | break; 44 | } 45 | } 46 | 47 | @Override 48 | public RSWHologram getHologramInstance() { 49 | return this.selected.getHologramInstance(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/commands/SairCMD.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.commands; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.triumphteam.cmd.bukkit.annotation.Permission; 19 | import dev.triumphteam.cmd.core.annotation.Command; 20 | import dev.triumphteam.cmd.core.annotation.Default; 21 | import joserodpt.realskywars.api.RealSkywarsAPI; 22 | import joserodpt.realskywars.api.config.TranslatableLine; 23 | import joserodpt.realskywars.api.player.RSWPlayer; 24 | import org.bukkit.command.CommandSender; 25 | import org.bukkit.entity.Player; 26 | 27 | @Command(value = "leave", alias = {"sair", "ragequit"}) 28 | public class SairCMD extends BaseCommandWA { 29 | 30 | public RealSkywarsAPI rs; 31 | 32 | public SairCMD(RealSkywarsAPI rs) { 33 | this.rs = rs; 34 | } 35 | 36 | @Default 37 | @Permission("rsw.leave") 38 | @SuppressWarnings("unused") 39 | public void defaultCommand(final CommandSender commandSender) { 40 | if (commandSender instanceof Player) { 41 | RSWPlayer p = rs.getPlayerManagerAPI().getPlayer((Player) commandSender); 42 | if (p.isInMatch()) { 43 | p.getMatch().removePlayer(p); 44 | } else { 45 | TranslatableLine.CMD_CNO_MATCH.send(p, true); 46 | } 47 | } else { 48 | commandSender.sendMessage("[RealSkywars] Only players can run this command."); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/Demolition.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.Debugger; 19 | import joserodpt.realskywars.api.cages.RSWCage; 20 | import org.bukkit.Bukkit; 21 | import org.bukkit.Location; 22 | import org.bukkit.plugin.Plugin; 23 | 24 | public class Demolition { 25 | 26 | private final Location laserloc1; 27 | private final RSWCage cage; 28 | private final int laserTime, delayExplosion; 29 | 30 | public Demolition(Location laserloc1, RSWCage cage, int laserTime, int delayExplosion) { 31 | this.laserloc1 = laserloc1; 32 | this.cage = cage; 33 | this.laserTime = laserTime; 34 | this.delayExplosion = delayExplosion; 35 | } 36 | 37 | public void start(Plugin plugin) { 38 | try { 39 | Location sploc = laserloc1; 40 | sploc.setY(255); 41 | Location cage = this.cage.getLocation(); 42 | 43 | cage.add(0.5, 0, 0.5); 44 | Laser laser = new Laser.GuardianLaser(sploc, cage, this.laserTime, (int) sploc.distance(cage)); 45 | laser.start(plugin); 46 | 47 | Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, this.cage::clearCage, this.delayExplosion * 20L); 48 | } catch (Exception e) { 49 | Debugger.print(Demolition.class, "Could not show win laser for " + this.cage.getLocation().toString() + "\n" + e.getMessage()); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWMapsConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class RSWMapsConfig { 26 | 27 | private static final String name = "maps.yml"; 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | document = YamlDocument.create(new File(rm.getDataFolder(), name)); 33 | } catch (final IOException e) { 34 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 35 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 36 | } 37 | } 38 | 39 | public static YamlDocument file() { 40 | return document; 41 | } 42 | 43 | public static void save() { 44 | try { 45 | document.save(); 46 | } catch (final IOException e) { 47 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 48 | } 49 | } 50 | 51 | public static void reload() { 52 | try { 53 | document.reload(); 54 | } catch (final IOException e) { 55 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/holograms/support/DHHologram.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.holograms.support; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import eu.decentsoftware.holograms.api.DHAPI; 19 | import eu.decentsoftware.holograms.api.holograms.Hologram; 20 | import joserodpt.realskywars.api.managers.holograms.RSWHologram; 21 | import joserodpt.realskywars.api.utils.Text; 22 | import org.bukkit.Location; 23 | import org.bukkit.Material; 24 | 25 | public class DHHologram implements RSWHologram { 26 | private Hologram holo; 27 | 28 | @Override 29 | public void spawnHologram(Location loc) { 30 | if (this.holo == null) { 31 | this.holo = DHAPI.createHologram("RSW-" + loc.getWorld().getName() + "-X" + loc.getBlockX() + "Y" + loc.getBlockY() + "Z" + loc.getBlockZ(), loc.add(0.5, 2, 0.5)); 32 | DHAPI.addHologramLine(this.holo, Material.CLOCK); 33 | DHAPI.addHologramLine(this.holo, "~"); 34 | } 35 | } 36 | 37 | @Override 38 | public void setTime(int seconds) { 39 | if (this.holo != null) { 40 | DHAPI.setHologramLine(this.holo, 1, Text.formatSeconds(seconds)); 41 | } 42 | } 43 | 44 | @Override 45 | public void deleteHologram() { 46 | if (this.holo != null) { 47 | this.holo.delete(); 48 | } 49 | this.holo = null; 50 | } 51 | 52 | 53 | @Override 54 | public HType getType() { 55 | return HType.DECENT_HOLOGRAMS; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWKitsConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class RSWKitsConfig { 26 | 27 | private static final String name = "kits.yml"; 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | document = YamlDocument.create(new File(rm.getDataFolder(), name), rm.getResource(name)); 33 | } catch (final IOException e) { 34 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 35 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 36 | } 37 | } 38 | 39 | public static YamlDocument file() { 40 | return document; 41 | } 42 | 43 | public static void save() { 44 | try { 45 | document.save(); 46 | } catch (final IOException e) { 47 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 48 | } 49 | } 50 | 51 | public static void reload() { 52 | try { 53 | document.reload(); 54 | } catch (final IOException e) { 55 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWLanguagesOldConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class RSWLanguagesOldConfig { 26 | 27 | private static final String name = "languages.yml"; 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | document = YamlDocument.create(new File(rm.getDataFolder(), name)); 33 | } catch (final IOException e) { 34 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 35 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 36 | } 37 | } 38 | 39 | public static YamlDocument file() { 40 | return document; 41 | } 42 | 43 | public static void save() { 44 | try { 45 | document.save(); 46 | } catch (final IOException e) { 47 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 48 | } 49 | } 50 | 51 | public static void reload() { 52 | try { 53 | document.reload(); 54 | } catch (final IOException e) { 55 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 56 | } 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWShopsConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class RSWShopsConfig { 26 | private static final String name = "shops.yml"; 27 | 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | document = YamlDocument.create(new File(rm.getDataFolder(), name), rm.getResource(name)); 33 | } catch (final IOException e) { 34 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 35 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 36 | } 37 | } 38 | 39 | public static YamlDocument file() { 40 | return document; 41 | } 42 | 43 | public static void save() { 44 | try { 45 | document.save(); 46 | } catch (final IOException e) { 47 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 48 | } 49 | } 50 | 51 | public static void reload() { 52 | try { 53 | document.reload(); 54 | } catch (final IOException e) { 55 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 56 | } 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/effects/RSWBowTrail.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.effects; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import joserodpt.realskywars.api.player.RSWPlayer; 21 | import org.bukkit.Bukkit; 22 | import org.bukkit.Particle; 23 | import org.bukkit.entity.Arrow; 24 | import org.bukkit.entity.Projectile; 25 | import org.bukkit.scheduler.BukkitTask; 26 | 27 | public class RSWBowTrail implements RSWTrail { 28 | private final Particle pa; 29 | private final Arrow a; 30 | private final RSWPlayer p; 31 | private BukkitTask task; 32 | 33 | public RSWBowTrail(Particle bowParticle, Projectile entity, RSWPlayer gp) { 34 | this.pa = bowParticle; 35 | this.a = (Arrow) entity; 36 | this.p = gp; 37 | startTask(); 38 | } 39 | 40 | @Override 41 | public void startTask() { 42 | this.task = Bukkit.getServer().getScheduler().runTaskTimer(RealSkywarsAPI.getInstance().getPlugin(), () -> { 43 | if (this.a == null || this.a.isOnGround() || this.a.isDead()) { 44 | cancelTask(); 45 | return; 46 | } 47 | this.a.getLocation().getWorld().spawnParticle(this.pa, this.a.getLocation(), 1); 48 | }, 1, 1); 49 | } 50 | 51 | @Override 52 | public void cancelTask() { 53 | this.task.cancel(); 54 | this.p.removeTrail(this); 55 | } 56 | 57 | @Override 58 | public TrailType getType() { 59 | return TrailType.BOW; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/holograms/support/HDHologram.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.holograms.support; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import com.gmail.filoghost.holographicdisplays.api.Hologram; 19 | import com.gmail.filoghost.holographicdisplays.api.HologramsAPI; 20 | import joserodpt.realskywars.api.RealSkywarsAPI; 21 | import joserodpt.realskywars.api.managers.holograms.RSWHologram; 22 | import joserodpt.realskywars.api.utils.Text; 23 | import org.bukkit.Location; 24 | import org.bukkit.Material; 25 | import org.bukkit.inventory.ItemStack; 26 | 27 | public class HDHologram implements RSWHologram { 28 | 29 | private Hologram holo; 30 | 31 | @Override 32 | public void spawnHologram(Location loc) { 33 | if (this.holo == null || this.holo.isDeleted()) { 34 | this.holo = HologramsAPI.createHologram(RealSkywarsAPI.getInstance().getPlugin(), loc.add(0.5, 2, 0.5)); 35 | this.holo.clearLines(); 36 | this.holo.appendItemLine(new ItemStack(Material.CLOCK)); 37 | } 38 | } 39 | 40 | @Override 41 | public void setTime(int time) { 42 | if (this.holo == null || this.holo.isDeleted()) { 43 | this.holo.insertTextLine(1, Text.formatSeconds(time)); 44 | } 45 | } 46 | 47 | @Override 48 | public void deleteHologram() { 49 | if (this.holo != null && !this.holo.isDeleted()) { 50 | this.holo.delete(); 51 | } 52 | this.holo = null; 53 | } 54 | 55 | @Override 56 | public HType getType() { 57 | return HType.HOLOGRAPHIC_DISPLAYS; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/currency/LocalCurrencyAdapter.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.currency; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | 19 | import joserodpt.realskywars.api.currency.CurrencyAdapterAPI; 20 | import joserodpt.realskywars.api.player.RSWPlayer; 21 | import joserodpt.realskywars.api.utils.Text; 22 | 23 | public class LocalCurrencyAdapter implements CurrencyAdapterAPI { 24 | @Override 25 | public void transferCoins(RSWPlayer toPlayer, RSWPlayer fromPlayer, double amount) { 26 | removeCoins(fromPlayer, amount); 27 | addCoins(toPlayer, amount); 28 | } 29 | 30 | @Override 31 | public void addCoins(RSWPlayer p, double amount) { 32 | p.setLocalCoins(getCoins(p) + amount); 33 | p.saveData(RSWPlayer.PlayerData.COINS); 34 | } 35 | 36 | @Override 37 | public boolean removeCoins(RSWPlayer p, double amount) { 38 | if (getCoins(p) >= amount) { 39 | setCoins(p, getCoins(p) - amount); 40 | //p.sendMessage(TranslatableLine.REMOVED_COINS.get(p, true).replace("%coins%", "" + amount)); 41 | return true; 42 | } 43 | 44 | return false; 45 | } 46 | 47 | @Override 48 | public void setCoins(RSWPlayer p, double amount) { 49 | p.setLocalCoins(amount); 50 | p.saveData(RSWPlayer.PlayerData.COINS); 51 | } 52 | 53 | @Override 54 | public double getCoins(RSWPlayer p) { 55 | return p.getLocalCoins(); 56 | } 57 | 58 | @Override 59 | public String getCoinsFormatted(RSWPlayer p) { 60 | return Text.formatDouble(this.getCoins(p)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/cages/RSWCage.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.cages; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.map.RSWMap; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | import org.bukkit.Location; 21 | import org.bukkit.Material; 22 | 23 | import java.util.Collection; 24 | 25 | public abstract class RSWCage { 26 | protected final int id; 27 | protected final int x, y, z; 28 | protected RSWMap map; 29 | 30 | public RSWCage(int id, int x, int y, int z) { 31 | this.id = id; 32 | this.x = x; 33 | this.y = y; 34 | this.z = z; 35 | } 36 | 37 | public RSWCage(int id, Location l) { 38 | this(id, l.getBlockX(), l.getBlockY(), l.getBlockZ()); 39 | } 40 | 41 | public int getID() { 42 | return this.id; 43 | } 44 | 45 | public Location getLocation() { 46 | return new Location(this.map.getRSWWorld().getWorld(), this.x, this.y, this.z).add(0.5, 0, 0.5); 47 | } 48 | 49 | public RSWMap getMap() { 50 | return this.map; 51 | } 52 | 53 | public void setMap(RSWMap map) { 54 | this.map = map; 55 | } 56 | 57 | public abstract boolean isEmpty(); 58 | 59 | public abstract void setCage(); 60 | 61 | public abstract void addPlayer(RSWPlayer p); 62 | 63 | public abstract void removePlayer(RSWPlayer p); 64 | 65 | public abstract void tpPlayer(RSWPlayer p); 66 | 67 | public abstract Collection getPlayers(); 68 | 69 | public abstract void clearCage(); 70 | 71 | public abstract void setCage(Material m); 72 | 73 | public abstract void open(); 74 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/chests/EPICChestConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config.chests; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class EPICChestConfig { 26 | 27 | private static final String name = "epic.yml"; 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | File folder = new File(RealSkywarsAPI.getInstance().getPlugin().getDataFolder(), "chests"); 33 | File file = new File(folder, name); 34 | document = YamlDocument.create(file, rm.getResource(name)); 35 | } catch (final IOException e) { 36 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 37 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 38 | } 39 | } 40 | 41 | public static YamlDocument file() { 42 | return document; 43 | } 44 | 45 | public static void save() { 46 | try { 47 | document.save(); 48 | } catch (final IOException e) { 49 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 50 | } 51 | } 52 | 53 | public static void reload() { 54 | try { 55 | document.reload(); 56 | } catch (final IOException e) { 57 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/currency/VaultCurrencyAdapter.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.currency; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import joserodpt.realskywars.api.currency.CurrencyAdapterAPI; 21 | import joserodpt.realskywars.api.player.RSWPlayer; 22 | 23 | public class VaultCurrencyAdapter implements CurrencyAdapterAPI { 24 | 25 | @Override 26 | public void transferCoins(RSWPlayer toPlayer, RSWPlayer fromPlayer, double amount) { 27 | removeCoins(fromPlayer, amount); 28 | addCoins(toPlayer, amount); 29 | } 30 | 31 | @Override 32 | public void addCoins(RSWPlayer p, double amount) { 33 | RealSkywarsAPI.getInstance().getVaultEconomy().depositPlayer(p.getPlayer(), amount); 34 | } 35 | 36 | @Override 37 | public boolean removeCoins(RSWPlayer p, double amount) { 38 | return RealSkywarsAPI.getInstance().getVaultEconomy().withdrawPlayer(p.getPlayer(), amount).transactionSuccess(); 39 | } 40 | 41 | @Override 42 | public void setCoins(RSWPlayer p, double amount) { 43 | RealSkywarsAPI.getInstance().getVaultEconomy().withdrawPlayer(p.getPlayer(), getCoins(p)); 44 | RealSkywarsAPI.getInstance().getVaultEconomy().depositPlayer(p.getPlayer(), amount); 45 | } 46 | 47 | @Override 48 | public double getCoins(RSWPlayer p) { 49 | return RealSkywarsAPI.getInstance().getVaultEconomy().getBalance(p.getPlayer()); 50 | } 51 | 52 | @Override 53 | public String getCoinsFormatted(RSWPlayer p) { 54 | return RealSkywarsAPI.getInstance().getVaultEconomy().format(getCoins(p)); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/chests/BasicChestConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config.chests; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class BasicChestConfig { 26 | 27 | private static final String name = "basic.yml"; 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | File folder = new File(RealSkywarsAPI.getInstance().getPlugin().getDataFolder(), "chests"); 33 | File file = new File(folder, name); 34 | document = YamlDocument.create(file, rm.getResource(name)); 35 | } catch (final IOException e) { 36 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 37 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 38 | } 39 | } 40 | 41 | public static YamlDocument file() { 42 | return document; 43 | } 44 | 45 | public static void save() { 46 | try { 47 | document.save(); 48 | } catch (final IOException e) { 49 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 50 | } 51 | } 52 | 53 | public static void reload() { 54 | try { 55 | document.reload(); 56 | } catch (final IOException e) { 57 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/chests/NormalChestConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config.chests; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import org.bukkit.plugin.java.JavaPlugin; 21 | 22 | import java.io.File; 23 | import java.io.IOException; 24 | 25 | public class NormalChestConfig { 26 | 27 | private static final String name = "normal.yml"; 28 | private static YamlDocument document; 29 | 30 | public static void setup(final JavaPlugin rm) { 31 | try { 32 | File folder = new File(RealSkywarsAPI.getInstance().getPlugin().getDataFolder(), "chests"); 33 | File file = new File(folder, name); 34 | document = YamlDocument.create(file, rm.getResource(name)); 35 | } catch (final IOException e) { 36 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 37 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 38 | } 39 | } 40 | 41 | public static YamlDocument file() { 42 | return document; 43 | } 44 | 45 | public static void save() { 46 | try { 47 | document.save(); 48 | } catch (final IOException e) { 49 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 50 | } 51 | } 52 | 53 | public static void reload() { 54 | try { 55 | document.reload(); 56 | } catch (final IOException e) { 57 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/kits/KitInventory.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.kits; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.player.RSWPlayer; 19 | import joserodpt.realskywars.api.utils.ItemStackSpringer; 20 | import org.bukkit.inventory.ItemStack; 21 | 22 | import java.util.Arrays; 23 | import java.util.Collections; 24 | import java.util.List; 25 | import java.util.Map; 26 | import java.util.Objects; 27 | import java.util.stream.Collectors; 28 | 29 | public class KitInventory { 30 | 31 | private final ItemStack[] inventory; 32 | 33 | public KitInventory(ItemStack[] inventory) { 34 | this.inventory = inventory; 35 | } 36 | 37 | public boolean hasItems() { 38 | return !this.getListInventory().isEmpty(); 39 | } 40 | 41 | public void giveToPlayer(RSWPlayer p) { 42 | if (this.getInventory() != null) { 43 | p.getInventory().clear(); 44 | p.getInventory().setContents(this.getInventory()); 45 | } 46 | } 47 | 48 | public ItemStack[] getInventory() { 49 | return this.inventory; 50 | } 51 | 52 | public List getListInventory() { 53 | return this.getInventory() == null ? Collections.emptyList() : Arrays.stream(this.getInventory().clone()) 54 | .filter(Objects::nonNull) 55 | .collect(Collectors.toList()); 56 | } 57 | 58 | public List> getSerialized() { 59 | return ItemStackSpringer.getItemsSerialized(this.getInventory().clone()); 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return "KitInventory{" + 65 | "inventory=" + Arrays.toString(inventory) + 66 | '}'; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/Pagination.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import java.util.ArrayList; 19 | import java.util.Arrays; 20 | import java.util.List; 21 | 22 | public class Pagination extends ArrayList { 23 | 24 | private int pageSize; 25 | 26 | public Pagination(int pageSize) { 27 | this(pageSize, new ArrayList<>()); 28 | } 29 | 30 | @SafeVarargs 31 | public Pagination(int pageSize, T... objects) { 32 | this(pageSize, Arrays.asList(objects)); 33 | } 34 | 35 | public Pagination(int pageSize, List objects) { 36 | this.pageSize = pageSize; 37 | addAll(objects); 38 | } 39 | 40 | public int pageSize() { 41 | return pageSize; 42 | } 43 | 44 | public int totalPages() { 45 | return (int) Math.ceil((double) size() / pageSize); 46 | } 47 | 48 | public boolean exists(int page) { 49 | return !(page < 0) && page < totalPages(); 50 | } 51 | 52 | public List getPage(int page) { 53 | if (page < 0 || page >= totalPages()) 54 | throw new IndexOutOfBoundsException("Page: " + page + ", Size: " + totalPages()); 55 | 56 | List objects = new ArrayList<>(); 57 | 58 | int min = page * pageSize; 59 | int max = ((page * pageSize) + pageSize); 60 | 61 | if (max > size()) max = size(); 62 | 63 | for (int i = min; max > i; ++i) 64 | objects.add(get(i)); 65 | 66 | return objects; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "Pagination{" + 72 | "pageSize=" + pageSize + 73 | ", modCount=" + modCount + 74 | ", size=" + size() + 75 | '}'; 76 | } 77 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/player/tab/RSWPlayerTabNoStyle.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.player.tab; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | import org.bukkit.Bukkit; 21 | import org.bukkit.entity.Player; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | public class RSWPlayerTabNoStyle implements RSWPlayerTabInterface { 27 | 28 | private final RSWPlayer player; 29 | private final List show = new ArrayList<>(); 30 | 31 | public RSWPlayerTabNoStyle(RSWPlayer player) { 32 | this.player = player; 33 | clear(); 34 | updateRoomTAB(); 35 | } 36 | 37 | @Override 38 | public void addPlayers(Player p) { 39 | if (p.getUniqueId() != this.player.getUUID() && !this.show.contains(p)) { 40 | this.show.add(p); 41 | } 42 | } 43 | 44 | @Override 45 | public void addPlayers(List p) { 46 | this.show.addAll(p); 47 | } 48 | 49 | @Override 50 | public void removePlayers(Player p) { 51 | this.show.remove(p); 52 | } 53 | 54 | @Override 55 | public void reset() { 56 | this.show.addAll(Bukkit.getOnlinePlayers()); 57 | } 58 | 59 | @Override 60 | public void clear() { 61 | this.show.clear(); 62 | } 63 | 64 | @Override 65 | public void setHeaderFooter(String h, String f) { 66 | } 67 | 68 | 69 | @Override 70 | public void updateRoomTAB() { 71 | if (!this.player.isBot()) { 72 | Bukkit.getOnlinePlayers().forEach(pl -> this.player.hidePlayer(RealSkywarsAPI.getInstance().getPlugin(), pl)); 73 | this.show.forEach(rswPlayer -> this.player.showPlayer(RealSkywarsAPI.getInstance().getPlugin(), rswPlayer)); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/BungeecordUtils.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import group.aelysium.rustyconnector.RC; 19 | import group.aelysium.rustyconnector.common.magic_link.MagicLinkCore; 20 | import group.aelysium.rustyconnector.server.ServerKernel; 21 | 22 | import eu.cloudnetservice.driver.inject.InjectionLayer; 23 | import eu.cloudnetservice.driver.registry.ServiceRegistry; 24 | import eu.cloudnetservice.modules.bridge.player.PlayerManager; 25 | import eu.cloudnetservice.modules.bridge.player.executor.ServerSelectorType; 26 | 27 | import com.google.common.io.ByteArrayDataOutput; 28 | import com.google.common.io.ByteStreams; 29 | import org.bukkit.Bukkit; 30 | import org.bukkit.entity.Player; 31 | import org.bukkit.plugin.java.JavaPlugin; 32 | 33 | import java.util.Set; 34 | 35 | public class BungeecordUtils { 36 | public static void connect(String name, Player player, JavaPlugin jp) { 37 | if (player == null) { 38 | return; 39 | } 40 | if (Bukkit.getPluginManager().isPluginEnabled("CloudNet-Bridge")) { 41 | ServiceRegistry registry = InjectionLayer.ext().instance(ServiceRegistry.class); 42 | PlayerManager playerManager = registry.firstProvider(PlayerManager.class); 43 | playerManager.playerExecutor(player.getUniqueId()).connectToTask(name, ServerSelectorType.LOWEST_PLAYERS); 44 | return; 45 | } 46 | 47 | if (Bukkit.getPluginManager().isPluginEnabled("rustyconnector-paper")) { 48 | ServerKernel kernel = RC.S.Kernel(); 49 | kernel.sendID( 50 | player.getUniqueId().toString(), 51 | name, 52 | Set.of( 53 | MagicLinkCore.Packets.SendPlayer.Flag.FAMILY // 54 | )); 55 | return; 56 | } 57 | 58 | ByteArrayDataOutput out = ByteStreams.newDataOutput(); 59 | out.writeUTF("Connect"); 60 | out.writeUTF(name); 61 | player.sendPluginMessage(jp, "BungeeCord", out.toByteArray()); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/DatabaseManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import com.j256.ormlite.dao.Dao; 19 | import joserodpt.realskywars.api.database.PlayerBoughtItemsRow; 20 | import joserodpt.realskywars.api.database.PlayerDataRow; 21 | import joserodpt.realskywars.api.database.PlayerGameHistoryRow; 22 | import joserodpt.realskywars.api.player.RSWGameHistoryStats; 23 | import joserodpt.realskywars.api.player.RSWPlayer; 24 | import joserodpt.realskywars.api.shop.RSWBuyableItem; 25 | import joserodpt.realskywars.api.utils.Pair; 26 | import org.bukkit.OfflinePlayer; 27 | import org.bukkit.entity.Player; 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import java.util.Collection; 31 | import java.util.List; 32 | import java.util.UUID; 33 | 34 | public abstract class DatabaseManagerAPI { 35 | @NotNull 36 | protected abstract String getDatabaseURL(); 37 | 38 | protected abstract void getPlayerData(); 39 | 40 | public abstract Pair, RSWGameHistoryStats> getPlayerGameHistory(Player p); 41 | 42 | public abstract List getPlayerBoughtItems(Player p); 43 | 44 | public abstract List getPlayerBoughtItemsCategory(Player p, RSWBuyableItem.ItemCategory cat); 45 | 46 | public abstract PlayerDataRow getPlayerData(OfflinePlayer p); 47 | 48 | public abstract void savePlayerData(PlayerDataRow playerDataRow, boolean async); 49 | 50 | public abstract void saveNewGameHistory(PlayerGameHistoryRow playerGameHistoryRow, boolean async); 51 | 52 | public abstract void saveNewBoughtItem(PlayerBoughtItemsRow playerBoughtItemsRow, boolean async); 53 | 54 | public abstract void deletePlayerData(UUID playerUUID, boolean async); 55 | 56 | public abstract void deletePlayerGameHistory(UUID playerUUID, boolean async); 57 | 58 | public abstract void deletePlayerBoughtItems(UUID playerUUID, boolean async); 59 | 60 | public abstract Dao getQueryDao(); 61 | 62 | public abstract Pair didPlayerBoughtItem(RSWPlayer p, RSWBuyableItem item); 63 | } 64 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/world/RSWWorld.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.world; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.managers.world.engines.SWWorldDefaultEngine; 19 | import joserodpt.realskywars.api.managers.world.engines.SWWorldSchematicEngine; 20 | import joserodpt.realskywars.api.map.RSWMap; 21 | import org.bukkit.GameRule; 22 | import org.bukkit.World; 23 | import org.bukkit.entity.Entity; 24 | import org.bukkit.entity.EntityType; 25 | 26 | public class RSWWorld { 27 | 28 | private final SWWorldEngine engine; 29 | 30 | public RSWWorld(RSWMap gameRoom, World w, WorldType wt) { 31 | this.engine = (wt == WorldType.DEFAULT ? new SWWorldDefaultEngine(w, gameRoom) : new SWWorldSchematicEngine(w, gameRoom.getShematicName(), gameRoom)); 32 | this.getWorld().setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false); 33 | this.getWorld().setGameRule(GameRule.DO_WEATHER_CYCLE, false); 34 | this.getWorld().setGameRule(GameRule.DO_MOB_SPAWNING, false); 35 | this.getWorld().setGameRule(GameRule.DO_INSOMNIA, false); 36 | this.getWorld().setGameRule(GameRule.DO_PATROL_SPAWNING, false); 37 | } 38 | 39 | public World getWorld() { 40 | return this.engine.getWorld(); 41 | } 42 | 43 | public void resetWorld(RSWMap.OperationReason rr) { 44 | if (rr != RSWMap.OperationReason.SHUTDOWN) { 45 | this.engine.getWorld().getEntities().stream().filter(entity -> entity.getType() != EntityType.PLAYER).forEach(Entity::remove); 46 | } 47 | this.engine.resetWorld(rr); 48 | } 49 | 50 | public void deleteWorld(RSWMap.OperationReason rr) { 51 | this.engine.deleteWorld(rr); 52 | } 53 | 54 | public void setTime(long l) { 55 | this.engine.setTime(l); 56 | } 57 | 58 | public String getName() { 59 | return this.engine.getName(); 60 | } 61 | 62 | public RSWWorld.WorldType getType() { 63 | return this.engine.getType(); 64 | } 65 | 66 | public void save() { 67 | this.engine.save(); 68 | } 69 | 70 | public enum WorldType {DEFAULT, SCHEMATIC} 71 | } 72 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWAchievementsConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import dev.dejvokep.boostedyaml.dvs.versioning.BasicVersioning; 20 | import dev.dejvokep.boostedyaml.settings.dumper.DumperSettings; 21 | import dev.dejvokep.boostedyaml.settings.general.GeneralSettings; 22 | import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings; 23 | import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings; 24 | import joserodpt.realskywars.api.RealSkywarsAPI; 25 | import org.bukkit.plugin.java.JavaPlugin; 26 | 27 | import java.io.File; 28 | import java.io.IOException; 29 | 30 | public class RSWAchievementsConfig { 31 | 32 | private static final String name = "achievements.yml"; 33 | private static YamlDocument document; 34 | 35 | public static void setup(final JavaPlugin rm) { 36 | try { 37 | document = YamlDocument.create(new File(rm.getDataFolder(), name), rm.getResource(name), 38 | GeneralSettings.DEFAULT, 39 | LoaderSettings.builder().setAutoUpdate(true).build(), 40 | DumperSettings.DEFAULT, 41 | UpdaterSettings.builder().setVersioning(new BasicVersioning("Version")).build()); 42 | } catch (final IOException e) { 43 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 44 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 45 | } 46 | } 47 | 48 | public static YamlDocument file() { 49 | return document; 50 | } 51 | 52 | public static void save() { 53 | try { 54 | document.save(); 55 | } catch (final IOException e) { 56 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 57 | } 58 | } 59 | 60 | public static void reload() { 61 | try { 62 | document.reload(); 63 | } catch (final IOException e) { 64 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/MathUtils.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import org.bukkit.Location; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | public class MathUtils { 24 | 25 | public static E mostFrequentElement(Iterable iterable) { 26 | Map freqMap = new HashMap<>(); 27 | E mostFreq = null; 28 | int mostFreqCount = -1; 29 | for (E e : iterable) { 30 | Integer count = freqMap.get(e); 31 | freqMap.put(e, count = (count == null ? 1 : count + 1)); 32 | 33 | if (count > mostFreqCount) { 34 | mostFreq = e; 35 | mostFreqCount = count; 36 | } 37 | } 38 | return mostFreq; 39 | } 40 | 41 | // CREDIT open source spigot 42 | public static Location lookAt(Location loc, Location lookat) { 43 | // Clone the loc to prevent applied changes to the input loc 44 | loc = loc.clone(); 45 | 46 | // Values of change in distance (make it relative) 47 | double dx = lookat.getX() - loc.getX(); 48 | double dy = lookat.getY() - loc.getY(); 49 | double dz = lookat.getZ() - loc.getZ(); 50 | 51 | // Set yaw 52 | if (dx != 0) { 53 | // Set yaw start value based on dx 54 | if (dx < 0) { 55 | loc.setYaw((float) (1.5 * Math.PI)); 56 | } else { 57 | loc.setYaw((float) (0.5 * Math.PI)); 58 | } 59 | loc.setYaw(loc.getYaw() - (float) Math.atan(dz / dx)); 60 | } else if (dz < 0) { 61 | loc.setYaw((float) Math.PI); 62 | } 63 | 64 | // Get the distance from dx/dz 65 | double dxz = Math.sqrt(Math.pow(dx, 2) + Math.pow(dz, 2)); 66 | 67 | // Set pitch 68 | loc.setPitch((float) -Math.atan(dy / dxz)); 69 | 70 | // Set values, convert to degrees (invert the yaw since Bukkit uses a different yaw dimension format) 71 | loc.setYaw(-loc.getYaw() * 180f / (float) Math.PI); 72 | loc.setPitch(loc.getPitch() * 180f / (float) Math.PI); 73 | 74 | return loc; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/WorldManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.managers.world.RSWWorld; 19 | import org.bukkit.Location; 20 | import org.bukkit.World; 21 | import org.bukkit.entity.EntityType; 22 | import org.bukkit.entity.Player; 23 | import org.bukkit.generator.ChunkGenerator; 24 | 25 | import java.io.File; 26 | import java.io.IOException; 27 | import java.util.Random; 28 | 29 | public abstract class WorldManagerAPI { 30 | public abstract File[] verifiedListFiles(File directory) throws IOException; 31 | 32 | public abstract boolean isSymlink(File file); 33 | 34 | public abstract World createEmptyWorld(String name, World.Environment environment); 35 | 36 | public abstract boolean loadWorld(String worldName, World.Environment environment); 37 | 38 | public abstract void unloadWorld(String w, boolean save); 39 | 40 | protected abstract void tpToLobby(Player p); 41 | 42 | public abstract void copyWorld(String name, CopyTo t); 43 | 44 | public abstract void copyWorld(String name, File source, File target); 45 | 46 | public abstract void deleteWorld(String name, boolean removeFile); 47 | 48 | public abstract void deleteDirectory(File directory) throws IOException; 49 | 50 | protected abstract void cleanDirectory(File directory) throws IOException; 51 | 52 | public abstract void forceDelete(File file) throws IOException; 53 | 54 | public void clearDroppedItems(World world) { 55 | world.getEntities().stream().filter(e -> e.getType() == EntityType.DROPPED_ITEM).forEach(org.bukkit.entity.Entity::remove); 56 | } 57 | 58 | public abstract World duplicateWorld(RSWWorld original, String newName); 59 | 60 | public enum CopyTo {ROOT, RSW_FOLDER} 61 | 62 | public class VoidWorld extends ChunkGenerator { 63 | @Override 64 | public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) { 65 | return createChunkData(world); 66 | } 67 | 68 | public Location getFixedSpawnLocation(World world, Random random) { 69 | return new Location(world, 0.0D, 128.0D, 0.0D); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/player/RSWGameLog.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.player; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.config.TranslatableLine; 19 | import joserodpt.realskywars.api.config.TranslatableList; 20 | import joserodpt.realskywars.api.map.RSWMap; 21 | import joserodpt.realskywars.api.utils.Itens; 22 | import joserodpt.realskywars.api.utils.Text; 23 | import org.bukkit.Material; 24 | import org.bukkit.inventory.ItemStack; 25 | 26 | import java.util.List; 27 | 28 | public class RSWGameLog { 29 | 30 | private String map; 31 | private int players, seconds, kills; 32 | private boolean ranked, win; 33 | private RSWMap.GameMode gameMode; 34 | private String dayandtime; 35 | 36 | private boolean dummy = false; 37 | 38 | public RSWGameLog(String map, String gameMode, boolean ranked, int players, int kills, boolean win, int seconds, String dayandtime) { 39 | this.map = map; 40 | this.gameMode = RSWMap.GameMode.valueOf(gameMode); 41 | this.ranked = ranked; 42 | this.players = players; 43 | this.win = win; 44 | this.kills = kills; 45 | this.seconds = seconds; 46 | this.dayandtime = dayandtime; 47 | } 48 | 49 | public RSWGameLog() { 50 | this.dummy = true; 51 | } 52 | 53 | public ItemStack getItem(RSWPlayer p) { 54 | if (this.dummy) { 55 | return Itens.createItem(Material.BUCKET, 1, TranslatableLine.SEARCH_NOTFOUND_NAME.getSingle()); 56 | } 57 | 58 | List list = TranslatableList.GAME_LOG_LIST.get(p); 59 | 60 | for (String s : list) { 61 | list.set(list.indexOf(s), s.replace("%players%", String.valueOf(this.players)) 62 | .replace("%map%", this.map + " &7[&f" + this.gameMode.getDisplayName(p) + "&7]") 63 | .replace("%ranked%", this.ranked ? "&a&l✔" : "&c&l❌") 64 | .replace("%win%", this.win ? "&a&l✔" : "&c&l❌") 65 | .replace("%kills%", String.valueOf(this.kills)) 66 | .replace("%time%", Text.formatSeconds(this.seconds))); 67 | } 68 | 69 | return Itens.createItem(Material.FILLED_MAP, 1, "&f&l" + this.dayandtime, list); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/nms/NMS117R1.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.nms; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.utils.Text; 20 | import org.bukkit.Location; 21 | import org.bukkit.Material; 22 | import org.bukkit.block.Block; 23 | 24 | import java.lang.reflect.InvocationTargetException; 25 | 26 | public class NMS117R1 implements RSWnms { 27 | private final Class world = ReflectionHelper.getClass("net.minecraft.world.level.World"); 28 | private final Class craft_world = ReflectionHelper.getCraftBukkitClass("CraftWorld"); 29 | private final Class block_pos = ReflectionHelper.getClass("net.minecraft.core.BlockPosition"); 30 | private final Class i_block_data = ReflectionHelper.getClass("net.minecraft.world.level.block.state.IBlockData"); 31 | private final Class block_class = ReflectionHelper.getClass("net.minecraft.world.level.block.Block"); 32 | 33 | @Override 34 | public void playChestAnimation(Block block, boolean open) { 35 | final Location location = block.getLocation(); 36 | try { 37 | final Object invoke = craft_world.getMethod("getHandle").invoke(location.getWorld()); 38 | assert block_pos != null; 39 | final Object instance = block_pos.getConstructor(Double.TYPE, Double.TYPE, Double.TYPE).newInstance(location.getX(), location.getY(), location.getZ()); 40 | assert world != null; 41 | assert i_block_data != null; 42 | world.getMethod("playBlockAction", block_pos, block_class, Integer.TYPE, Integer.TYPE).invoke(invoke, instance, i_block_data.getMethod("getBlock").invoke(world.getMethod("getType", block_pos).invoke(invoke, instance)), 1, open ? 1 : 0); 43 | } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | 44 | InstantiationException ex) { 45 | RealSkywarsAPI.getInstance().getLogger().severe("Error while executing chest animation nms."); 46 | RealSkywarsAPI.getInstance().getLogger().severe(ex.toString()); 47 | } 48 | } 49 | 50 | @Override 51 | public String getItemName(Material mat) { 52 | return Text.beautifyEnumName(mat.name()); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/RSWConfig.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import dev.dejvokep.boostedyaml.YamlDocument; 19 | import dev.dejvokep.boostedyaml.dvs.versioning.BasicVersioning; 20 | import dev.dejvokep.boostedyaml.route.Route; 21 | import dev.dejvokep.boostedyaml.settings.dumper.DumperSettings; 22 | import dev.dejvokep.boostedyaml.settings.general.GeneralSettings; 23 | import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings; 24 | import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings; 25 | import joserodpt.realskywars.api.RealSkywarsAPI; 26 | import org.bukkit.plugin.java.JavaPlugin; 27 | 28 | import java.io.File; 29 | import java.io.IOException; 30 | 31 | public class RSWConfig { 32 | 33 | private static final String name = "config.yml"; 34 | private static YamlDocument document; 35 | 36 | public static void setup(final JavaPlugin rm) { 37 | try { 38 | document = YamlDocument.create(new File(rm.getDataFolder(), name), rm.getResource(name), 39 | GeneralSettings.DEFAULT, 40 | LoaderSettings.builder().setAutoUpdate(true).build(), 41 | DumperSettings.DEFAULT, 42 | UpdaterSettings.builder().addIgnoredRoute( 43 | "1", Route.fromString("Lobby") 44 | ).setVersioning(new BasicVersioning("Version")).build()); 45 | } catch (final IOException e) { 46 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't setup " + name + "!"); 47 | RealSkywarsAPI.getInstance().getLogger().severe(e.getMessage()); 48 | } 49 | } 50 | 51 | public static YamlDocument file() { 52 | return document; 53 | } 54 | 55 | public static void save() { 56 | try { 57 | document.save(); 58 | } catch (final IOException e) { 59 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't save " + name + "!"); 60 | } 61 | } 62 | 63 | public static void reload() { 64 | try { 65 | document.reload(); 66 | } catch (final IOException e) { 67 | RealSkywarsAPI.getInstance().getLogger().severe("Couldn't reload " + name + "!"); 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/config/TranslatableList.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.config; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | import joserodpt.realskywars.api.utils.Text; 21 | 22 | import java.util.List; 23 | 24 | public enum TranslatableList { 25 | 26 | MAP_START(".Messages.Map.Start"), 27 | MAP_END_LOG(".Messages.Map.End-Log"), 28 | EDIT_MAP(".Messages.Map.Edit-Map"), 29 | SCOREBOARD_LOBBY_LINES(".Scoreboards.Lobby.Lines"), 30 | SCOREBOARD_CAGE_LINES(".Scoreboards.Cage.Lines"), 31 | SCOREBOARD_PLAYING_LINES(".Scoreboards.Game.Lines"), 32 | SCOREBOARD_SPECTATOR_LINES(".Scoreboards.Spectate.Lines"), 33 | ITEMS_MAP_DESCRIPTION(".Itens.Map.Description"), 34 | TITLE_ROOMJOIN(".Titles.Join-Room"), 35 | STATS_ITEM_LORE(".Itens.Statistics.Lore"), 36 | REFILL_EVENT_TITLE(".Messages.Map.Events.Refill"), 37 | TNTRAIN_EVENT_TITLE(".Messages.Map.Events.TNTRain"), 38 | STATISTIC_PLAYER_LIST(".Statistics.Player-List"), 39 | STATISTIC_GAMES_LIST(".Statistics.Games-List"), 40 | TAB_HEADER_MATCH(".Tab.In-Game.Header"), 41 | TAB_FOOTER_MATCH(".Tab.In-Game.Footer"), 42 | TAB_HEADER_OTHER(".Tab.Other.Header"), 43 | TAB_FOOTER_OTHER(".Tab.Other.Footer"), GAME_LOG_LIST(".Statistics.Game-Log-List"); 44 | 45 | private final String configPath; 46 | 47 | TranslatableList(String configPath) { 48 | this.configPath = configPath; 49 | } 50 | 51 | public List getInLanguage(String lang) { 52 | return Text.color(RealSkywarsAPI.getInstance().getLanguageManagerAPI().getLanguage(lang).getStringList(this.configPath)); 53 | } 54 | 55 | public List get(RSWPlayer player) { 56 | if (this == TITLE_ROOMJOIN) { 57 | List list = getInLanguage(player.getLanguage()); 58 | if (list.size() != 2) { 59 | RealSkywarsAPI.getInstance().getLogger().warning("Title RoomJoin must have 2 lines, but has " + list.size()); 60 | 61 | while (list.size() != 2) { 62 | list.add("SEE CONSOLE"); 63 | } 64 | } 65 | return list; 66 | } 67 | return getInLanguage(player.getLanguage()); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/database/PlayerBoughtItemsRow.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.database; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import com.j256.ormlite.field.DatabaseField; 19 | import com.j256.ormlite.table.DatabaseTable; 20 | import joserodpt.realskywars.api.config.RSWConfig; 21 | import joserodpt.realskywars.api.player.RSWPlayer; 22 | import joserodpt.realskywars.api.utils.Text; 23 | import org.bukkit.ChatColor; 24 | import org.jetbrains.annotations.NotNull; 25 | 26 | import java.text.DateFormat; 27 | import java.text.SimpleDateFormat; 28 | import java.util.Date; 29 | import java.util.UUID; 30 | 31 | @DatabaseTable(tableName = "realscoreboard_player_bought_items") 32 | public class PlayerBoughtItemsRow { 33 | @DatabaseField(columnName = "id", canBeNull = false, allowGeneratedIdInsert = true, generatedId = true) 34 | private @NotNull UUID id; 35 | 36 | @DatabaseField(columnName = "player_uuid") 37 | private @NotNull UUID player_uuid; 38 | 39 | @DatabaseField(columnName = "player_name") 40 | private String player_name; 41 | 42 | @DatabaseField(columnName = "item_id") 43 | private String itemID; 44 | 45 | @DatabaseField(columnName = "category") 46 | private String category; 47 | 48 | @DatabaseField(columnName = "bought_date") 49 | private String date; 50 | 51 | public PlayerBoughtItemsRow(RSWPlayer p, String itemID, String category) { 52 | this.player_uuid = p.getUUID(); 53 | this.player_name = p.getName(); 54 | this.itemID = ChatColor.stripColor(itemID); 55 | this.category = category; 56 | this.date = Text.getDateAndTime(); 57 | } 58 | 59 | public PlayerBoughtItemsRow() { 60 | //for ORMLite 61 | } 62 | 63 | public String getPlayerName() { 64 | return this.player_name; 65 | } 66 | 67 | @NotNull 68 | public UUID getId() { 69 | return this.id; 70 | } 71 | 72 | public UUID getPlayerUUID() { 73 | return this.player_uuid; 74 | } 75 | 76 | public String getItemID() { 77 | return itemID; 78 | } 79 | 80 | public String getCategory() { 81 | return category; 82 | } 83 | 84 | public String getDate() { 85 | return date; 86 | } 87 | 88 | public Date getFormattedDateObject() { 89 | DateFormat dateFormat = new SimpleDateFormat(RSWConfig.file().getString("Config.Time.Formatting")); 90 | try { 91 | return dateFormat.parse(date); 92 | } catch (Exception e) { 93 | return new Date(); 94 | } 95 | } 96 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/achievements/types/RSWAchievementRCoin.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.achievements.types; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.achievements.RSWAchievement; 19 | import joserodpt.realskywars.api.config.TranslatableLine; 20 | import joserodpt.realskywars.api.managers.TransactionManager; 21 | import joserodpt.realskywars.api.player.RSWPlayer; 22 | import joserodpt.realskywars.api.utils.Itens; 23 | import org.bukkit.Material; 24 | import org.bukkit.inventory.ItemStack; 25 | 26 | import java.util.Collections; 27 | 28 | public class RSWAchievementRCoin implements RSWAchievement { 29 | 30 | private final RSWPlayer.PlayerStatistics at; 31 | private final int goal; 32 | private final Double reward; 33 | 34 | public RSWAchievementRCoin(RSWPlayer.PlayerStatistics at, int goal, Double reward) { 35 | this.at = at; 36 | this.goal = goal; 37 | this.reward = reward; 38 | } 39 | 40 | @Override 41 | public String getAchievementName() { 42 | return this.at.name().replace("_", " "); 43 | } 44 | 45 | @Override 46 | public String getRewardName() { 47 | return this.getReward() + " " + this.getRewardType().name().toLowerCase(); 48 | } 49 | 50 | @Override 51 | public void giveAchievement(RSWPlayer p) { 52 | new TransactionManager(p, (Double) this.getReward(), TransactionManager.Operations.ADD, true); 53 | p.sendMessage(TranslatableLine.ACHIEVEMENT_GET.get(p, true).replace("%achievement%", this.goal + " - " + this.getAchievementName()).replace("%reward%", this.getRewardName())); 54 | } 55 | 56 | @Override 57 | public RSWPlayer.PlayerStatistics getType() { 58 | return this.at; 59 | } 60 | 61 | @Override 62 | public RewardType getRewardType() { 63 | return RewardType.COINS; 64 | } 65 | 66 | @Override 67 | public int getGoal() { 68 | return this.goal; 69 | } 70 | 71 | @Override 72 | public Object getReward() { 73 | return this.reward; 74 | } 75 | 76 | @Override 77 | public ItemStack getItem(RSWPlayer p) { 78 | return Itens.createItem(p.getStatistics(this.getType(), false) >= this.getGoal() ? Material.GREEN_CONCRETE : Material.RED_CONCRETE 79 | , 1, TranslatableLine.ACHIEVEMENT_GOAL.get(p).replace("%goal%", String.valueOf(this.getGoal())), Collections.singletonList(TranslatableLine.ACHIEVEMENT_REWARD.get(p).replace("%reward%", this.getReward().toString()) + " " + TranslatableLine.ACHIEVEMENT_NAME_COINS.get(p))); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/FireworkUtils.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import org.bukkit.Color; 20 | import org.bukkit.FireworkEffect; 21 | import org.bukkit.FireworkEffect.Type; 22 | import org.bukkit.Location; 23 | import org.bukkit.entity.EntityType; 24 | import org.bukkit.entity.Firework; 25 | import org.bukkit.inventory.meta.FireworkMeta; 26 | 27 | import java.util.Objects; 28 | import java.util.Random; 29 | 30 | public class FireworkUtils { 31 | 32 | public static void spawnRandomFirework(final Location loc) { 33 | final Firework firework = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK); 34 | final FireworkMeta fireworkMeta = firework.getFireworkMeta(); 35 | final Random random = RealSkywarsAPI.getInstance().getRandom(); 36 | final FireworkEffect effect = FireworkEffect.builder().flicker(random.nextBoolean()).withColor(Objects.requireNonNull(getColor(random.nextInt(17) + 1))).withFade(Objects.requireNonNull(getColor(random.nextInt(17) + 1))).with(Type.values()[random.nextInt(Type.values().length)]).trail(random.nextBoolean()).build(); 37 | fireworkMeta.addEffect(effect); 38 | fireworkMeta.setPower(random.nextInt(2) + 1); 39 | firework.setFireworkMeta(fireworkMeta); 40 | } 41 | 42 | private static Color getColor(final int i) { 43 | switch (i) { 44 | case 1: 45 | return Color.AQUA; 46 | case 2: 47 | return Color.BLACK; 48 | case 3: 49 | return Color.BLUE; 50 | case 4: 51 | return Color.FUCHSIA; 52 | case 5: 53 | return Color.GRAY; 54 | case 6: 55 | return Color.GREEN; 56 | case 7: 57 | return Color.LIME; 58 | case 8: 59 | return Color.MAROON; 60 | case 9: 61 | return Color.NAVY; 62 | case 10: 63 | return Color.OLIVE; 64 | case 11: 65 | return Color.ORANGE; 66 | case 12: 67 | return Color.PURPLE; 68 | case 13: 69 | return Color.RED; 70 | case 14: 71 | return Color.SILVER; 72 | case 15: 73 | return Color.TEAL; 74 | case 16: 75 | return Color.WHITE; 76 | case 17: 77 | return Color.YELLOW; 78 | } 79 | return null; 80 | } 81 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/map/modes/PlaceholderMode.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.map.modes; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.cages.RSWCage; 19 | import joserodpt.realskywars.api.config.TranslatableLine; 20 | import joserodpt.realskywars.api.map.RSWMap; 21 | import joserodpt.realskywars.api.map.modes.teams.RSWTeam; 22 | import joserodpt.realskywars.api.player.RSWPlayer; 23 | import joserodpt.realskywars.api.utils.Itens; 24 | import org.bukkit.Location; 25 | import org.bukkit.Material; 26 | import org.bukkit.inventory.ItemStack; 27 | 28 | import java.util.Collection; 29 | 30 | public class PlaceholderMode extends RSWMap { 31 | public PlaceholderMode(String nome) { 32 | super(nome); 33 | } 34 | 35 | @Override 36 | public String forceStart(RSWPlayer p) { 37 | return null; 38 | } 39 | 40 | @Override 41 | public boolean canStartMap() { 42 | return false; 43 | } 44 | 45 | @Override 46 | public void removePlayer(RSWPlayer p) { 47 | } 48 | 49 | @Override 50 | public void addPlayer(RSWPlayer gp) { 51 | } 52 | 53 | @Override 54 | public void resetArena(OperationReason rr) { 55 | } 56 | 57 | @Override 58 | public void checkWin() { 59 | } 60 | 61 | @Override 62 | public GameMode getGameMode() { 63 | return null; 64 | } 65 | 66 | @Override 67 | public Collection getCages() { 68 | return null; 69 | } 70 | 71 | @Override 72 | public Collection getTeams() { 73 | return null; 74 | } 75 | 76 | @Override 77 | public int getMaxTeamsNumber() { 78 | return 0; 79 | } 80 | 81 | @Override 82 | public int getMaxTeamsMembers() { 83 | return 0; 84 | } 85 | 86 | @Override 87 | public int getMaxGameTime() { 88 | return 0; 89 | } 90 | 91 | @Override 92 | public void forceStartMap() { 93 | } 94 | 95 | @Override 96 | public int minimumPlayersToStartMap() { 97 | return 0; 98 | } 99 | 100 | @Override 101 | public void removeCage(Location loc) { 102 | } 103 | 104 | @Override 105 | public void addCage(Location location) { 106 | } 107 | 108 | @Override 109 | public ItemStack getIconForPlayer(RSWPlayer p) { 110 | return Itens.createItem(Material.DEAD_BUSH, 1, TranslatableLine.ITEM_MAP_NOTFOUND_NAME.get(p)); 111 | } 112 | 113 | @Override 114 | public RSWMap duplicate(String newName) { 115 | return null; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/MapManagerAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.cages.RSWCage; 19 | import joserodpt.realskywars.api.chests.RSWChest; 20 | import joserodpt.realskywars.api.managers.world.RSWWorld; 21 | import joserodpt.realskywars.api.map.RSWMap; 22 | import joserodpt.realskywars.api.player.RSWPlayer; 23 | import org.bukkit.Location; 24 | import org.bukkit.World; 25 | 26 | import java.util.Collection; 27 | import java.util.List; 28 | import java.util.Map; 29 | import java.util.Optional; 30 | 31 | public abstract class MapManagerAPI { 32 | public Boolean shutdown = false; 33 | 34 | public abstract void loadMaps(); 35 | 36 | public abstract void deleteMap(RSWMap map); 37 | 38 | public abstract RSWMap getMap(World w); 39 | 40 | public abstract RSWMap getMap(String s); 41 | 42 | public abstract void endMaps(boolean shutdown); 43 | 44 | public abstract List getMapsForPlayer(RSWPlayer rswPlayer); 45 | 46 | public abstract Collection getMaps(MapGamemodes pt); 47 | 48 | protected abstract Map getMapCages(String s, World w); 49 | 50 | protected abstract Map getMapChests(String worldName, String section); 51 | 52 | public abstract void setupSolo(RSWPlayer p, String mapname, String displayName, RSWWorld.WorldType wt, int maxP); 53 | 54 | public abstract void setupTeams(RSWPlayer p, String mapname, String displayName, RSWWorld.WorldType wt, int teams, int pperteam); 55 | 56 | public abstract void finishMap(RSWPlayer p); 57 | 58 | protected abstract RSWWorld.WorldType getWorldType(String s); 59 | 60 | protected abstract Boolean isInstantEndingEnabled(String s); 61 | 62 | protected abstract Location getPOS1(World w, String s); 63 | 64 | protected abstract Location getPOS2(World w, String s); 65 | 66 | public abstract Boolean isSpecEnabled(String s); 67 | 68 | public abstract Location getSpecLoc(String nome); 69 | 70 | protected abstract Boolean isRanked(String s); 71 | 72 | public abstract void findNextMap(RSWPlayer player, RSWMap.GameMode type); 73 | 74 | public abstract Optional findSuitableGame(RSWMap.GameMode type); 75 | 76 | public abstract void clearMaps(); 77 | 78 | public abstract void addMap(RSWMap s); 79 | 80 | public abstract Collection getMapNames(); 81 | 82 | public abstract void editMap(RSWPlayer p, RSWMap sw); 83 | 84 | public abstract void duplicateMap(RSWMap original, String newName); 85 | 86 | public enum MapGamemodes {SOLO, SOLO_RANKED, TEAMS, TEAMS_RANKED, RANKED, ALL} 87 | } 88 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/managers/LeaderboardManager.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import com.j256.ormlite.stmt.QueryBuilder; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import joserodpt.realskywars.api.database.PlayerDataRow; 21 | import joserodpt.realskywars.api.leaderboards.RSWLeaderboard; 22 | import joserodpt.realskywars.api.managers.LeaderboardManagerAPI; 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | import java.sql.SQLException; 26 | import java.util.HashMap; 27 | import java.util.List; 28 | import java.util.Map; 29 | import java.util.UUID; 30 | 31 | public class LeaderboardManager extends LeaderboardManagerAPI { 32 | private final RealSkywarsAPI rs; 33 | 34 | public LeaderboardManager(RealSkywarsAPI rs) { 35 | this.rs = rs; 36 | } 37 | 38 | public Map leaderboards = new HashMap<>(); 39 | 40 | @Override 41 | public void refreshLeaderboards() { 42 | for (RSWLeaderboard.RSWLeaderboardCategories value : RSWLeaderboard.RSWLeaderboardCategories.values()) { 43 | try { 44 | this.refreshLeaderboard(value); 45 | } catch (Exception e) { 46 | RealSkywarsAPI.getInstance().getLogger().severe("Error while loading Leaderboard for " + value.name() + " -> " + e.getMessage()); 47 | } 48 | } 49 | } 50 | 51 | @Override 52 | public void refreshLeaderboard(RSWLeaderboard.RSWLeaderboardCategories l) throws SQLException { 53 | QueryBuilder qb = rs.getDatabaseManagerAPI().getQueryDao().queryBuilder(); 54 | qb.orderBy(l.getDBName(), false); 55 | RSWLeaderboard lb = getLeaderboard(l, rs.getDatabaseManagerAPI().getQueryDao().query(qb.prepare())); 56 | this.leaderboards.put(l, lb); 57 | } 58 | 59 | @Override 60 | @NotNull 61 | protected RSWLeaderboard getLeaderboard(RSWLeaderboard.RSWLeaderboardCategories l, List expansions) { 62 | RSWLeaderboard lb = new RSWLeaderboard(); 63 | for (int i = 1; i < 11; ++i) { 64 | PlayerDataRow p; 65 | try { 66 | p = expansions.get(i - 1); 67 | 68 | if (p != null) { 69 | lb.addRow(p.getUUID(), p.getName(), l.getValue(p)); 70 | } 71 | } catch (Exception ignored) { 72 | } 73 | } 74 | return lb; 75 | } 76 | 77 | @Override 78 | public RSWLeaderboard getLeaderboard(RSWLeaderboard.RSWLeaderboardCategories l) { 79 | return this.leaderboards.get(l); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /realskywars-api/dependency-reduced-pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | joserodpt 6 | RealSkywarsAPI 7 | RealSkywarsAPI 8 | 1.2.1 9 | 10 | 11 | 12 | true 13 | src/main/resources 14 | 15 | 16 | 17 | 18 | maven-compiler-plugin 19 | 3.8.1 20 | 21 | 9 22 | 9 23 | 24 | 25 | 26 | maven-shade-plugin 27 | 3.2.4 28 | 29 | 30 | package 31 | 32 | shade 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | spigotmc-repo 42 | https://hub.spigotmc.org/nexus/content/repositories/snapshots/ 43 | 44 | 45 | enginehub-maven 46 | https://maven.enginehub.org/repo/ 47 | 48 | 49 | placeholderapi 50 | https://repo.extendedclip.com/content/repositories/placeholderapi/ 51 | 52 | 53 | codemc-repo 54 | https://repo.codemc.io/repository/maven-public/ 55 | 56 | 57 | jitpack.io 58 | https://jitpack.io 59 | 60 | 61 | 62 | 63 | org.spigotmc 64 | spigot-api 65 | 1.18.2-R0.1-SNAPSHOT 66 | provided 67 | 68 | 69 | com.sk89q.worldedit 70 | worldedit-bukkit 71 | 7.2.10 72 | provided 73 | 74 | 75 | com.github.MilkBowl 76 | VaultAPI 77 | 1.7.1 78 | provided 79 | 80 | 81 | 82 | 1.8 83 | UTF-8 84 | 85 | 86 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/party/RSWParty.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.party; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.config.TranslatableLine; 19 | import joserodpt.realskywars.api.player.RSWPlayer; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | public class RSWParty { 25 | 26 | private final RSWPlayer owner; 27 | private final List members = new ArrayList<>(); 28 | private boolean allowJoin; 29 | 30 | public RSWParty(RSWPlayer owner) { 31 | this.owner = owner; 32 | } 33 | 34 | public void playerJoin(RSWPlayer p) { 35 | p.joinParty(this.owner); 36 | this.members.add(p); 37 | 38 | this.owner.sendMessage(TranslatableLine.PARTY_JOIN.get(this.owner).replace("%player%", p.getDisplayName())); 39 | this.members.forEach(rswPlayer -> rswPlayer.sendMessage(TranslatableLine.PARTY_JOIN.get(rswPlayer).replace("%player%", p.getDisplayName()))); 40 | } 41 | 42 | public void playerLeave(RSWPlayer p) { 43 | this.owner.sendMessage(TranslatableLine.PARTY_LEAVE.get(this.owner).replace("%player%", p.getDisplayName())); 44 | this.members.forEach(rswPlayer -> rswPlayer.sendMessage(TranslatableLine.PARTY_LEAVE.get(rswPlayer).replace("%player%", p.getDisplayName()))); 45 | } 46 | 47 | public void kick(RSWPlayer p) { 48 | this.members.remove(p); 49 | this.owner.sendMessage(TranslatableLine.PARTY_KICK.get(this.owner).replace("%player%", p.getDisplayName())); 50 | this.members.forEach(rswPlayer -> rswPlayer.sendMessage(TranslatableLine.PARTY_KICK.get(rswPlayer).replace("%player%", p.getDisplayName()))); 51 | } 52 | 53 | public void disband() { 54 | this.members.forEach(rswPlayer -> rswPlayer.sendMessage(TranslatableLine.PARTY_DISBAND.get(rswPlayer).replace("%player%", this.owner.getDisplayName()))); 55 | this.members.forEach(RSWPlayer::leaveParty); 56 | this.members.clear(); 57 | this.owner.sendMessage(TranslatableLine.PARTY_DISBAND.get(this.owner).replace("%player%", this.owner.getDisplayName())); 58 | this.owner.leaveParty(); 59 | } 60 | 61 | public boolean isOwner(RSWPlayer p) { 62 | return this.owner == p; 63 | } 64 | 65 | public List getMembers() { 66 | return this.members; 67 | } 68 | 69 | public void setAllowJoin(boolean b) { 70 | this.allowJoin = b; 71 | } 72 | 73 | public boolean allowJoin() { 74 | return this.allowJoin; 75 | } 76 | 77 | public void sendMessage(RSWPlayer p, String s) { 78 | this.owner.sendMessage("&3[PARTY] " + p.getDisplayName() + " - " + s); 79 | this.members.forEach(rswPlayer -> rswPlayer.sendMessage("&3[PARTY] " + p.getDisplayName() + " - " + s)); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/leaderboards/RSWLeaderboard.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.leaderboards; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.database.PlayerDataRow; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | import java.util.UUID; 23 | 24 | public class RSWLeaderboard { 25 | 26 | private final List lbr = new ArrayList<>(); 27 | 28 | public RSWLeaderboard() { 29 | } 30 | 31 | public void addRow(UUID uuid, String name, int o) { 32 | this.lbr.add(new RSWLeaderboardRow(uuid, name, o)); 33 | } 34 | 35 | public String getIndex(int i) { 36 | if (i <= this.lbr.size()) { 37 | RSWLeaderboardRow lbr = this.lbr.get(i - 1); 38 | lbr.setPlace(i); 39 | return lbr.getText(); 40 | } else { 41 | return new RSWLeaderboardRow().setPlace(i).getText(); 42 | } 43 | } 44 | 45 | public enum RSWLeaderboardCategories { 46 | SOLO_WINS, SOLO_RANKED_WINS, TEAMS_WINS, TEAMS_RANKED_WINS, 47 | KILLS, DEATHS, KILLS_RANKED, DEATHS_RANKED; 48 | 49 | public String getDBName() { 50 | switch (this) { 51 | case SOLO_WINS: 52 | return "stats_wins_solo"; 53 | case KILLS: 54 | return "kills"; 55 | case DEATHS: 56 | return "deaths"; 57 | case KILLS_RANKED: 58 | return "ranked_kills"; 59 | case TEAMS_WINS: 60 | return "stats_wins_teams"; 61 | case TEAMS_RANKED_WINS: 62 | return "stats_wins_ranked_teams"; 63 | case DEATHS_RANKED: 64 | return "ranked_deaths"; 65 | case SOLO_RANKED_WINS: 66 | return "stats_wins_ranked_solo"; 67 | default: 68 | return "err"; 69 | } 70 | } 71 | 72 | public int getValue(PlayerDataRow p) { 73 | switch (this) { 74 | case SOLO_WINS: 75 | return p.getStats_wins_solo(); 76 | case KILLS: 77 | return p.getKills(); 78 | case DEATHS: 79 | return p.getDeaths(); 80 | case KILLS_RANKED: 81 | return p.getRanked_kills(); 82 | case TEAMS_WINS: 83 | return p.getStats_wins_teams(); 84 | case TEAMS_RANKED_WINS: 85 | return p.getStats_wins_ranked_teams(); 86 | case DEATHS_RANKED: 87 | return p.getRanked_deaths(); 88 | case SOLO_RANKED_WINS: 89 | return p.getStats_wins_ranked_solo(); 90 | default: 91 | return -1; 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/utils/CountdownTimer.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.utils; 2 | 3 | import org.bukkit.Bukkit; 4 | import org.bukkit.plugin.java.JavaPlugin; 5 | 6 | import java.util.function.Consumer; 7 | 8 | /** 9 | * A simple countdown timer using the Runnable interface in seconds! Great 10 | * for minigames and other shiz? 11 | *

12 | * Project created by 13 | * 14 | * @author ExpDev 15 | */ 16 | public class CountdownTimer implements Runnable { 17 | 18 | // Main class for bukkit scheduling 19 | private final JavaPlugin plugin; 20 | // Seconds and shiz 21 | private final int seconds; 22 | // Actions to perform while counting down, before and after 23 | private final Consumer everySecond; 24 | private final Runnable beforeTimer; 25 | private final Runnable afterTimer; 26 | // Our scheduled task's assigned id, needed for canceling 27 | private Integer assignedTaskId; 28 | private int secondsLeft; 29 | 30 | // Construct a timer, you could create multiple so for example if 31 | // you do not want these "actions" 32 | public CountdownTimer(JavaPlugin plugin, int seconds, Runnable beforeTimer, Runnable afterTimer, Consumer everySecond) { 33 | // Initializing fields 34 | this.plugin = plugin; 35 | 36 | this.seconds = seconds; 37 | this.secondsLeft = seconds; 38 | 39 | this.beforeTimer = beforeTimer; 40 | this.afterTimer = afterTimer; 41 | this.everySecond = everySecond; 42 | } 43 | 44 | /** 45 | * Runs the timer once, decrements seconds etc... Really wish we could make it 46 | * protected/private so you couldn't access it 47 | */ 48 | @Override 49 | public void run() { 50 | // Is the timer up? 51 | if (this.secondsLeft < 1) { 52 | // Do what was supposed to happen after the timer 53 | this.afterTimer.run(); 54 | 55 | // Cancel timer 56 | if (this.assignedTaskId != null) Bukkit.getScheduler().cancelTask(this.assignedTaskId); 57 | return; 58 | } 59 | 60 | // Are we just starting? 61 | if (this.secondsLeft == this.seconds) this.beforeTimer.run(); 62 | 63 | // Do what's supposed to happen every second 64 | this.everySecond.accept(this); 65 | 66 | // Decrement the seconds left 67 | --this.secondsLeft; 68 | } 69 | 70 | /** 71 | * Gets the total seconds this timer was set to run for 72 | * 73 | * @return Total seconds timer should run 74 | */ 75 | public int getTotalSeconds() { 76 | return this.seconds; 77 | } 78 | 79 | public int getPassedSeconds() { 80 | return this.getTotalSeconds() - this.secondsLeft; 81 | } 82 | 83 | /** 84 | * Gets the seconds left this timer should run 85 | * 86 | * @return Seconds left timer should run 87 | */ 88 | public int getSecondsLeft() { 89 | return this.secondsLeft; 90 | } 91 | 92 | public void killTask() { 93 | Bukkit.getScheduler().cancelTask(this.assignedTaskId); 94 | } 95 | 96 | /** 97 | * Schedules this instance to "run" every second 98 | */ 99 | public void scheduleTimer() { 100 | // Initialize our assigned task's id, for later use so we can cancel 101 | this.assignedTaskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, this, 0L, 20L); 102 | } 103 | } -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/map/RSWSign.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.map; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.utils.Text; 20 | import org.bukkit.Bukkit; 21 | import org.bukkit.Location; 22 | import org.bukkit.Material; 23 | import org.bukkit.block.Block; 24 | import org.bukkit.block.BlockFace; 25 | import org.bukkit.block.Sign; 26 | import org.bukkit.block.data.type.WallSign; 27 | 28 | public class RSWSign { 29 | 30 | private final RSWMap game; 31 | private final Block b; 32 | 33 | public RSWSign(RSWMap gm, Block b) { 34 | this.game = gm; 35 | this.b = b; 36 | 37 | this.update(); 38 | } 39 | 40 | public void update() { 41 | if (this.game == null || RealSkywarsAPI.getInstance().getMapManagerAPI().shutdown) { 42 | return; 43 | } 44 | 45 | Bukkit.getScheduler().scheduleSyncDelayedTask(RealSkywarsAPI.getInstance().getPlugin(), () -> { 46 | if (this.getBlock().getType().name().contains("SIGN")) { 47 | Sign s = (Sign) this.getBlock().getState(); 48 | 49 | s.setLine(0, RealSkywarsAPI.getInstance().getLanguageManagerAPI().getPrefix()); 50 | s.setLine(1, Text.color("&b" + this.getGame().getName())); 51 | s.setLine(2, Text.color("&f" + this.getGame().getGameMode().getDefaultTranslation() + "&r&f | " + this.getGame().getPlayerCount() + "&7/&f" + this.getGame().getMaxPlayers())); 52 | s.setLine(3, Text.color("&b&l" + this.getGame().getState().getDefaultTranslation())); 53 | s.update(); 54 | 55 | this.b.getWorld().getBlockAt(this.getBehindBlock().getLocation()).setType(this.getGame().getState().getStateMaterial(this.getGame().isRanked())); 56 | } 57 | }); 58 | } 59 | 60 | private Block getGlass(Block b) { 61 | if (b.getState().getBlockData() instanceof WallSign) { 62 | WallSign signData = (WallSign) b.getState().getBlockData(); 63 | BlockFace attached = signData.getFacing().getOppositeFace(); 64 | 65 | return b.getRelative(attached); 66 | } else { 67 | return b.getRelative(BlockFace.DOWN); 68 | } 69 | } 70 | 71 | public Block getBlock() { 72 | return this.b; 73 | } 74 | 75 | public RSWMap getGame() { 76 | return this.game; 77 | } 78 | 79 | public Block getBehindBlock() { 80 | return this.getGlass(this.b); 81 | } 82 | 83 | public Location getLocation() { 84 | return this.b.getLocation(); 85 | } 86 | 87 | public String getLocationSerialized() { 88 | return this.getLocation().getWorld().getName() + "<" + 89 | this.getLocation().getBlockX() + "<" + 90 | this.getLocation().getBlockY() + "<" + 91 | this.getLocation().getBlockZ(); 92 | } 93 | 94 | public void delete() { 95 | Bukkit.getScheduler().scheduleSyncDelayedTask(RealSkywarsAPI.getInstance().getPlugin(), () -> { 96 | if (this.b.getType().name().contains("SIGN")) { 97 | this.b.setType(Material.AIR); 98 | } 99 | }); 100 | } 101 | } -------------------------------------------------------------------------------- /realskywars-plugin/src/main/resources/kits.yml: -------------------------------------------------------------------------------- 1 | Kits: 2 | Default: 3 | Display-Name: Default 4 | Price: 0.0 5 | Icon: LEATHER_CHESTPLATE 6 | Permission: RealSkywars.Kit 7 | Contents: 8 | - AMOUNT: 1 9 | SLOT: 0 10 | MATERIAL: WOODEN_SWORD 11 | - AMOUNT: 1 12 | SLOT: 1 13 | MATERIAL: WOODEN_SHOVEL 14 | - AMOUNT: 1 15 | SLOT: 2 16 | MATERIAL: WOODEN_PICKAXE 17 | - AMOUNT: 1 18 | SLOT: 3 19 | MATERIAL: WOODEN_AXE 20 | Ecologist: 21 | Display-Name: Ecologist 22 | Price: 10.0 23 | Icon: OAK_SAPLING 24 | Permission: RealSkywars.Kit 25 | Contents: 26 | - AMOUNT: 8 27 | SLOT: 0 28 | MATERIAL: STRIPPED_OAK_WOOD 29 | - AMOUNT: 1 30 | SLOT: 1 31 | MATERIAL: IRON_AXE 32 | - AMOUNT: 32 33 | SLOT: 2 34 | MATERIAL: OAK_SAPLING 35 | - AMOUNT: 32 36 | SLOT: 3 37 | MATERIAL: BONE_MEAL 38 | Life: 39 | Display-Name: '&aLife' 40 | Price: 10.0 41 | Icon: TOTEM_OF_UNDYING 42 | Permission: RealSkywars.Kit 43 | Contents: 44 | - AMOUNT: 1 45 | SLOT: 0 46 | MATERIAL: TOTEM_OF_UNDYING 47 | Enderman: 48 | Display-Name: '&5Enderman' 49 | Price: 10.0 50 | Icon: ENDER_EYE 51 | Permission: RealSkywars.Kit 52 | Perks: 53 | - ENDER 54 | Contents: 55 | - AMOUNT: 1 56 | SLOT: 0 57 | MATERIAL: ENDER_EYE 58 | - AMOUNT: 1 59 | SLOT: 1 60 | MATERIAL: ENDERMAN_SPAWN_EGG 61 | - AMOUNT: 1 62 | SLOT: 2 63 | MATERIAL: ENDER_CHEST 64 | - AMOUNT: 32 65 | SLOT: 3 66 | MATERIAL: END_STONE 67 | - AMOUNT: 1 68 | SLOT: 4 69 | MATERIAL: CLOCK 70 | - AMOUNT: 1 71 | SLOT: 39 72 | MATERIAL: DRAGON_HEAD 73 | Warrior: 74 | Display-Name: '&9Warrior' 75 | Price: 10.0 76 | Icon: IRON_SWORD 77 | Permission: RealSkywars.Kit 78 | Contents: 79 | - AMOUNT: 1 80 | SLOT: 0 81 | MATERIAL: IRON_SWORD 82 | - AMOUNT: 1 83 | SLOT: 1 84 | MATERIAL: BOW 85 | - AMOUNT: 32 86 | SLOT: 8 87 | MATERIAL: ARROW 88 | - AMOUNT: 1 89 | SLOT: 36 90 | MATERIAL: IRON_BOOTS 91 | - AMOUNT: 1 92 | SLOT: 37 93 | MATERIAL: GOLDEN_LEGGINGS 94 | - AMOUNT: 1 95 | SLOT: 38 96 | MATERIAL: GOLDEN_CHESTPLATE 97 | - AMOUNT: 1 98 | SLOT: 39 99 | MATERIAL: IRON_HELMET 100 | - AMOUNT: 32 101 | SLOT: 40 102 | MATERIAL: ARROW 103 | DJ: 104 | Display-Name: '&eDJ' 105 | Price: 20.0 106 | Icon: JUKEBOX 107 | Permission: RealSkywars.Kit 108 | Contents: 109 | - AMOUNT: 1 110 | SLOT: 0 111 | MATERIAL: JUKEBOX 112 | - AMOUNT: 1 113 | SLOT: 1 114 | MATERIAL: MUSIC_DISC_CAT 115 | - AMOUNT: 1 116 | SLOT: 2 117 | MATERIAL: MUSIC_DISC_BLOCKS 118 | - AMOUNT: 1 119 | SLOT: 3 120 | MATERIAL: MUSIC_DISC_CHIRP 121 | - AMOUNT: 1 122 | SLOT: 4 123 | MATERIAL: MUSIC_DISC_FAR 124 | - AMOUNT: 1 125 | SLOT: 5 126 | MATERIAL: MUSIC_DISC_MALL 127 | - AMOUNT: 1 128 | SLOT: 6 129 | MATERIAL: MUSIC_DISC_MELLOHI 130 | - AMOUNT: 1 131 | SLOT: 7 132 | MATERIAL: MUSIC_DISC_STAL 133 | - AMOUNT: 1 134 | SLOT: 8 135 | MATERIAL: MUSIC_DISC_STRAD 136 | - AMOUNT: 1 137 | SLOT: 9 138 | MATERIAL: MUSIC_DISC_WARD 139 | - AMOUNT: 1 140 | SLOT: 10 141 | MATERIAL: MUSIC_DISC_11 142 | - AMOUNT: 1 143 | SLOT: 11 144 | MATERIAL: MUSIC_DISC_WAIT 145 | - AMOUNT: 1 146 | SLOT: 12 147 | MATERIAL: MUSIC_DISC_13 -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/managers/AchievementsManager.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.achievements.RSWAchievement; 20 | import joserodpt.realskywars.api.achievements.types.RSWAchievementRCoin; 21 | import joserodpt.realskywars.api.config.RSWAchievementsConfig; 22 | import joserodpt.realskywars.api.managers.AchievementsManagerAPI; 23 | import joserodpt.realskywars.api.player.RSWPlayer; 24 | 25 | import java.util.ArrayList; 26 | import java.util.HashMap; 27 | import java.util.List; 28 | import java.util.Map; 29 | import java.util.Optional; 30 | import java.util.stream.Collectors; 31 | 32 | public class AchievementsManager extends AchievementsManagerAPI { 33 | private final RealSkywarsAPI rs; 34 | 35 | public AchievementsManager(RealSkywarsAPI rs) { 36 | this.rs = rs; 37 | } 38 | 39 | public Map> achievements = new HashMap<>(); 40 | 41 | @Override 42 | public void loadAchievements() { 43 | int cats = 0, achi = 0; 44 | this.achievements.clear(); 45 | //load coin achievements 46 | for (String dir : RSWAchievementsConfig.file().getSection("Coins").getRoutesAsStrings(false).stream() 47 | .map(Object::toString) 48 | .collect(Collectors.toSet())) { 49 | ++cats; 50 | RSWPlayer.PlayerStatistics t = null; 51 | 52 | switch (dir) { 53 | case "Kills": 54 | t = RSWPlayer.PlayerStatistics.KILLS; 55 | break; 56 | case "Wins-Solo": 57 | t = RSWPlayer.PlayerStatistics.WINS_SOLO; 58 | break; 59 | case "Wins-Teams": 60 | t = RSWPlayer.PlayerStatistics.WINS_TEAMS; 61 | break; 62 | case "Games-Played": 63 | t = RSWPlayer.PlayerStatistics.GAMES_PLAYED; 64 | break; 65 | } 66 | 67 | List achiv = new ArrayList<>(); 68 | 69 | String path = "Coins." + dir; 70 | for (String meta : RSWAchievementsConfig.file().getSection(path).getRoutesAsStrings(false)) { 71 | ++achi; 72 | Double value = RSWAchievementsConfig.file().getDouble(path + "." + meta); 73 | achiv.add(new RSWAchievementRCoin(t, Integer.parseInt(meta), value)); 74 | } 75 | 76 | this.achievements.put(t, achiv); 77 | } 78 | 79 | rs.getLogger().info("Loaded " + achi + " rewards for " + cats + " coin categories."); 80 | } 81 | 82 | @Override 83 | public List getAchievements(RSWPlayer.PlayerStatistics ds) { 84 | return this.achievements.get(ds); 85 | } 86 | 87 | @Override 88 | public RSWAchievement getAchievement(RSWPlayer.PlayerStatistics ps, int meta) { 89 | List list = this.achievements.get(ps); 90 | if (list != null) { 91 | Optional o = list.stream().filter(c -> c.getGoal() == meta).findFirst(); 92 | if (o.isPresent()) { 93 | return o.get(); 94 | } 95 | } 96 | return null; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/managers/world/engines/SWWorldDefaultEngine.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.managers.world.engines; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.Debugger; 19 | import joserodpt.realskywars.api.RealSkywarsAPI; 20 | import joserodpt.realskywars.api.managers.WorldManagerAPI; 21 | import joserodpt.realskywars.api.managers.world.RSWWorld; 22 | import joserodpt.realskywars.api.managers.world.SWWorldEngine; 23 | import joserodpt.realskywars.api.map.RSWMap; 24 | import org.bukkit.World; 25 | import org.bukkit.WorldBorder; 26 | 27 | import java.util.Objects; 28 | 29 | public class SWWorldDefaultEngine implements SWWorldEngine { 30 | 31 | private final WorldManagerAPI wm = RealSkywarsAPI.getInstance().getWorldManagerAPI(); 32 | private World world; 33 | private final RSWMap gameRoom; 34 | private final String worldName; 35 | 36 | public SWWorldDefaultEngine(World w, RSWMap gameMode) { 37 | this.worldName = w.getName(); 38 | this.world = w; 39 | this.world.setAutoSave(false); 40 | this.gameRoom = gameMode; 41 | } 42 | 43 | @Override 44 | public World getWorld() { 45 | return this.world; 46 | } 47 | 48 | @Override 49 | public void resetWorld(RSWMap.OperationReason rr) { 50 | Debugger.print(SWWorldDefaultEngine.class, "Resetting " + this.getName() + " - type: " + this.getType().name()); 51 | 52 | if (Objects.requireNonNull(rr) == RSWMap.OperationReason.SHUTDOWN) {//delete world 53 | this.deleteWorld(RSWMap.OperationReason.SHUTDOWN); 54 | } else { 55 | this.deleteWorld(RSWMap.OperationReason.RESET); 56 | //Copy world 57 | this.wm.copyWorld(this.getName(), WorldManagerAPI.CopyTo.ROOT); 58 | 59 | //Load world 60 | this.world = this.wm.createEmptyWorld(this.getName(), World.Environment.NORMAL); 61 | if (this.world != null) { 62 | this.world.setTime(0); 63 | this.world.setStorm(false); 64 | WorldBorder wb = this.world.getWorldBorder(); 65 | 66 | wb.setCenter(this.gameRoom.getMapCuboid().getCenter()); 67 | wb.setSize(this.gameRoom.getBorderSize()); 68 | 69 | this.gameRoom.setState(RSWMap.MapState.AVAILABLE); 70 | } else { 71 | RealSkywarsAPI.getInstance().getLogger().severe("ERROR! Could not load " + this.getName()); 72 | } 73 | } 74 | } 75 | 76 | @Override 77 | public void deleteWorld(RSWMap.OperationReason rr) { 78 | switch (rr) { 79 | case LOAD: 80 | break; 81 | case SHUTDOWN: 82 | case RESET: 83 | this.wm.deleteWorld(this.getName(), true); 84 | break; 85 | } 86 | } 87 | 88 | @Override 89 | public void setTime(long l) { 90 | this.world.setTime(l); 91 | } 92 | 93 | @Override 94 | public String getName() { 95 | return this.world != null ? this.world.getName() : this.worldName; 96 | } 97 | 98 | @Override 99 | public RSWWorld.WorldType getType() { 100 | return RSWWorld.WorldType.DEFAULT; 101 | } 102 | 103 | @Override 104 | public void save() { 105 | this.world.save(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/RealSkywarsAPI.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import com.google.common.base.Preconditions; 19 | import joserodpt.realskywars.api.currency.CurrencyAdapterAPI; 20 | import joserodpt.realskywars.api.managers.AchievementsManagerAPI; 21 | import joserodpt.realskywars.api.managers.DatabaseManagerAPI; 22 | import joserodpt.realskywars.api.managers.HologramManagerAPI; 23 | import joserodpt.realskywars.api.managers.KitManagerAPI; 24 | import joserodpt.realskywars.api.managers.LanguageManagerAPI; 25 | import joserodpt.realskywars.api.managers.LeaderboardManagerAPI; 26 | import joserodpt.realskywars.api.managers.LobbyManagerAPI; 27 | import joserodpt.realskywars.api.managers.MapManagerAPI; 28 | import joserodpt.realskywars.api.managers.PartiesManagerAPI; 29 | import joserodpt.realskywars.api.managers.PlayerManagerAPI; 30 | import joserodpt.realskywars.api.managers.ShopManagerAPI; 31 | import joserodpt.realskywars.api.managers.WorldManagerAPI; 32 | import joserodpt.realskywars.api.nms.RSWnms; 33 | import net.milkbowl.vault.economy.Economy; 34 | import org.bukkit.plugin.java.JavaPlugin; 35 | 36 | import java.util.Random; 37 | import java.util.logging.Logger; 38 | 39 | public abstract class RealSkywarsAPI { 40 | 41 | private static RealSkywarsAPI instance; 42 | 43 | /** 44 | * Gets instance of this API 45 | * 46 | * @return RealSkywarsAPI API instance 47 | */ 48 | public static RealSkywarsAPI getInstance() { 49 | return instance; 50 | } 51 | 52 | /** 53 | * Sets the RealMinesAPI instance. 54 | * Note! This method may only be called once 55 | * 56 | * @param instance the new instance to set 57 | */ 58 | public static void setInstance(RealSkywarsAPI instance) { 59 | Preconditions.checkNotNull(instance, "instance"); 60 | Preconditions.checkArgument(RealSkywarsAPI.instance == null, "Instance already set"); 61 | RealSkywarsAPI.instance = instance; 62 | } 63 | 64 | public abstract Logger getLogger(); 65 | 66 | public abstract String getVersion(); 67 | 68 | public abstract RSWnms getNMS(); 69 | 70 | public abstract WorldManagerAPI getWorldManagerAPI(); 71 | 72 | public abstract RSWEventsAPI getEventsAPI(); 73 | 74 | public abstract LanguageManagerAPI getLanguageManagerAPI(); 75 | 76 | public abstract PlayerManagerAPI getPlayerManagerAPI(); 77 | 78 | public abstract MapManagerAPI getMapManagerAPI(); 79 | 80 | public abstract LobbyManagerAPI getLobbyManagerAPI(); 81 | 82 | public abstract ShopManagerAPI getShopManagerAPI(); 83 | 84 | public abstract KitManagerAPI getKitManagerAPI(); 85 | 86 | public abstract PartiesManagerAPI getPartiesManagerAPI(); 87 | 88 | public abstract Random getRandom(); 89 | 90 | public abstract DatabaseManagerAPI getDatabaseManagerAPI(); 91 | 92 | public abstract LeaderboardManagerAPI getLeaderboardManagerAPI(); 93 | 94 | public abstract AchievementsManagerAPI getAchievementsManagerAPI(); 95 | 96 | public abstract HologramManagerAPI getHologramManagerAPI(); 97 | 98 | public abstract CurrencyAdapterAPI getCurrencyAdapterAPI(); 99 | 100 | public abstract JavaPlugin getPlugin(); 101 | 102 | public abstract String getServerVersion(); 103 | 104 | public abstract String getSimpleServerVersion(); 105 | 106 | public abstract boolean hasNewUpdate(); 107 | 108 | public abstract void reload(); 109 | 110 | public abstract Economy getVaultEconomy(); 111 | } 112 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/java/joserodpt/realskywars/plugin/managers/LobbyManager.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.plugin.managers; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import joserodpt.realskywars.api.config.RSWConfig; 20 | import joserodpt.realskywars.api.config.TranslatableLine; 21 | import joserodpt.realskywars.api.managers.LobbyManagerAPI; 22 | import joserodpt.realskywars.api.player.RSWPlayer; 23 | import joserodpt.realskywars.api.player.RSWPlayerItems; 24 | import org.bukkit.Bukkit; 25 | import org.bukkit.Location; 26 | import org.bukkit.World; 27 | import org.bukkit.entity.Player; 28 | 29 | public class LobbyManager extends LobbyManagerAPI { 30 | 31 | public RealSkywarsAPI rsa; 32 | 33 | public LobbyManager(RealSkywarsAPI rsa) { 34 | this.rsa = rsa; 35 | } 36 | 37 | private Location lobbyLOC; 38 | private Boolean loginTP = true; 39 | 40 | @Override 41 | public void loadLobby() { 42 | this.loginTP = RSWConfig.file().getBoolean("Config.Auto-Teleport-To-Lobby"); 43 | if (RSWConfig.file().isSection("Lobby")) { 44 | double x = RSWConfig.file().getDouble("Lobby.X"); 45 | double y = RSWConfig.file().getDouble("Lobby.Y"); 46 | double z = RSWConfig.file().getDouble("Lobby.Z"); 47 | float yaw = RSWConfig.file().getFloat("Lobby.Yaw"); 48 | float pitch = RSWConfig.file().getFloat("Lobby.Pitch"); 49 | World world = Bukkit.getServer().getWorld(RSWConfig.file().getString("Lobby.World")); 50 | this.lobbyLOC = new Location(world, x, y, z, yaw, pitch); 51 | } 52 | } 53 | 54 | @Override 55 | public void tpToLobby(Player player) { 56 | if (this.lobbyLOC != null && player != null) { 57 | try { 58 | player.teleport(this.lobbyLOC); 59 | } catch (Exception e) { 60 | rsa.getLogger().warning("Error while teleporting player to lobby: " + e.getMessage()); 61 | } 62 | } 63 | } 64 | 65 | @Override 66 | public void tpToLobby(RSWPlayer p) { 67 | if (this.lobbyLOC != null && p != null) { 68 | tpToLobby(p.getPlayer()); 69 | TranslatableLine.LOBBY_TELEPORT.send(p, true); 70 | RSWPlayerItems.LOBBY.giveSet(p); 71 | } else { 72 | TranslatableLine.LOBBY_NOT_SET.send(p, true); 73 | } 74 | } 75 | 76 | @Override 77 | public Location getLobbyLocation() { 78 | return this.lobbyLOC; 79 | } 80 | 81 | @Override 82 | public boolean scoreboardInLobby() { 83 | return RSWConfig.file().getBoolean("Config.Scoreboard-In-Lobby"); 84 | } 85 | 86 | @Override 87 | public void setLobbyLoc(Location location) { 88 | this.lobbyLOC = location; 89 | //give everyone items again 90 | 91 | for (Player p : location.getWorld().getPlayers()) { 92 | RSWPlayer rswPlayer = rsa.getPlayerManagerAPI().getPlayer(p); 93 | if (rswPlayer != null) { 94 | RSWPlayerItems.LOBBY.giveSet(rswPlayer); 95 | } 96 | } 97 | } 98 | 99 | @Override 100 | public boolean tpLobbyOnJoin() { 101 | return loginTP && this.lobbyLOC != null; 102 | } 103 | 104 | @Override 105 | public boolean isInLobby(World w) { 106 | if (w == null || this.lobbyLOC == null || this.lobbyLOC.getWorld() == null) { 107 | return false; 108 | } 109 | return this.lobbyLOC != null && this.lobbyLOC.getWorld().equals(w); 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /realskywars-api/src/main/java/joserodpt/realskywars/api/nms/NMS114R1tov116R3.java: -------------------------------------------------------------------------------- 1 | package joserodpt.realskywars.api.nms; 2 | 3 | /* 4 | * _____ _ _____ _ 5 | * | __ \ | |/ ____| | 6 | * | |__) |___ __ _| | (___ | | ___ ___ ____ _ _ __ ___ 7 | * | _ // _ \/ _` | |\___ \| |/ / | | \ \ /\ / / _` | '__/ __| 8 | * | | \ \ __/ (_| | |____) | <| |_| |\ V V / (_| | | \__ \ 9 | * |_| \_\___|\__,_|_|_____/|_|\_\\__, | \_/\_/ \__,_|_| |___/ 10 | * __/ | 11 | * |___/ 12 | * 13 | * Licensed under the MIT License 14 | * @author José Rodrigues © 2019-2025 15 | * @link https://github.com/joserodpt/RealSkywars 16 | */ 17 | 18 | import joserodpt.realskywars.api.RealSkywarsAPI; 19 | import org.bukkit.Location; 20 | import org.bukkit.Material; 21 | import org.bukkit.block.Block; 22 | import org.bukkit.inventory.ItemStack; 23 | 24 | import java.lang.reflect.InvocationTargetException; 25 | import java.lang.reflect.Method; 26 | 27 | public class NMS114R1tov116R3 implements RSWnms { 28 | private final Class world = ReflectionHelper.getNMSClass("World"); 29 | private final Class craft_world = ReflectionHelper.getCraftBukkitClass("CraftWorld"); 30 | private final Class block_pos = ReflectionHelper.getNMSClass("BlockPosition"); 31 | private final Class i_block_data = ReflectionHelper.getNMSClass("IBlockData"); 32 | private final Class block_class = ReflectionHelper.getNMSClass("Block"); 33 | 34 | @Override 35 | public void playChestAnimation(Block block, boolean open) { 36 | final Location location = block.getLocation(); 37 | try { 38 | final Object invoke = craft_world.getMethod("getHandle").invoke(location.getWorld()); 39 | assert block_pos != null; 40 | final Object instance = block_pos.getConstructor(Double.TYPE, Double.TYPE, Double.TYPE).newInstance(location.getX(), location.getY(), location.getZ()); 41 | assert world != null; 42 | assert i_block_data != null; 43 | world.getMethod("playBlockAction", block_pos, block_class, Integer.TYPE, Integer.TYPE).invoke(invoke, instance, i_block_data.getMethod("getBlock").invoke(world.getMethod("getType", block_pos).invoke(invoke, instance)), 1, open ? 1 : 0); 44 | } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | 45 | InstantiationException ex) { 46 | RealSkywarsAPI.getInstance().getLogger().severe("Error while executing chest animation nms."); 47 | RealSkywarsAPI.getInstance().getLogger().severe(ex.toString()); 48 | } 49 | } 50 | 51 | private final Class craft_item_stack = ReflectionHelper.getCraftBukkitClass("inventory.CraftItemStack"); 52 | private final Class nms_item_stack = ReflectionHelper.getNMSClass("ItemStack"); 53 | private final Class locale_language = ReflectionHelper.getNMSClass("LocaleLanguage"); 54 | private final Class i_chat_base_component = ReflectionHelper.getNMSClass("IChatBaseComponent"); 55 | private final Class chat_serializer = ReflectionHelper.getNMSClass("IChatBaseComponent$ChatSerializer"); 56 | 57 | @Override 58 | public String getItemName(Material mat) { 59 | try { 60 | Object nmsStack = craft_item_stack.getMethod("asNMSCopy", ItemStack.class).invoke(null, new ItemStack(mat)); 61 | Object itemName = nms_item_stack.getMethod("getItem").invoke(nmsStack); 62 | 63 | Method getNameMethod = locale_language.getMethod("a", i_chat_base_component); 64 | 65 | Object json = nms_item_stack.getMethod("C").invoke(itemName); 66 | Object localeLanguageInstance = locale_language.getMethod("a").invoke(null); 67 | 68 | String jsonString = chat_serializer.getMethod("a", i_chat_base_component).invoke(null, json).toString(); 69 | return (String) getNameMethod.invoke(localeLanguageInstance, jsonString); 70 | } catch (Exception ex) { 71 | RealSkywarsAPI.getInstance().getLogger().severe("Error while executing getItemName nms."); 72 | RealSkywarsAPI.getInstance().getLogger().severe(ex.toString()); 73 | return "-"; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /realskywars-plugin/src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | Version: 13 2 | Debug-Mode: false 3 | Config: 4 | Prefix: "&fReal&bSkywars &7> &r" 5 | Languages: 6 | Default-Language: en_us 7 | Strings: 8 | Events: 9 | REFILL: "&aRefill" 10 | TNTRAIN: "&cTNT &fRain" 11 | BORDERSHRINK: "&5End" 12 | Boss-Bar: 13 | Wait: "&fWaiting players." 14 | End: "&fThe match ended." 15 | DeathMatch: "&5Deathmatch" 16 | Run-Time: "&fTime left : &b%time%" 17 | Starting: "&fStarting in &b%time% &fsecond(s)" 18 | Admin-Shutdown: "&cAn admin shutdown all games." 19 | BungeeCord: 20 | Full: "&cThis map is full. &7Please try another one." 21 | No-Available-Maps: "&cThere are currently no available maps. &7Please try again later." 22 | Kick-Message: "&7Connecting to the lobby..." 23 | Resetting: "&cThis map is resetting. &7Please try again later." 24 | Search: 25 | Not-Found: "&aEmpty" 26 | Menus: 27 | Filter-Button: 28 | Title: "&bFilter" 29 | Description: "&fClick here to filter itens on this page." 30 | Next-Button: 31 | Title: "&aNext" 32 | Description: "&fClick here to go next." 33 | Back-Button: 34 | Title: "&ePrevious" 35 | Description: "&fClick here to go back." 36 | Main-Menu-Button: 37 | Title: "&9Menu" 38 | Description: "&fClick here to go to the main menu." 39 | Bungeecord: 40 | Enabled: false 41 | Kick-Player: true 42 | Lobby-Server: lobby 43 | Map-State-As-Motd: false 44 | Use-Vault-As-Currency: false 45 | Invincibility-Seconds: 3 46 | Auto-Teleport-To-Lobby: true 47 | Scoreboard-In-Lobby: true 48 | Enable-Tab-Formatting: true 49 | Enable-Chat-Per-Map: false 50 | Disable-Chest-Animation: false 51 | Shops: 52 | Enable-Shop: true 53 | Enable-Spectator-Shop: true 54 | Enable-Kit-Shop: true 55 | Only-Buy-Kits-Per-Match: false 56 | Enable-Cage-Block-Shop: true 57 | Enable-Win-Block-Shop: true 58 | Enable-Bow-Particles-Shop: true 59 | Right-Click-Player-Info: true 60 | PlaceholderAPI-In-Scoreboard: false 61 | PlaceholderAPI-In-Tab: false 62 | Disable-Player-Reset: false 63 | Disable-Language-Selection: false 64 | Disable-Lobby-Items: false 65 | Disable-Lobby-Void-Teleport: false 66 | Disable-Map-Starting-Countdown: 67 | Message: false 68 | Actionbar: false 69 | Item-Slots: 70 | Lobby: 71 | Profile: 0 72 | Maps: 4 73 | Shop: 8 74 | Cage: 75 | Kit: 1 76 | Vote: 4 77 | Leave: 7 78 | Spectator: 79 | Spectate: 1 80 | Play-Again: 2 81 | Shop: 4 82 | Leave: 7 83 | Setup: 84 | Cage: 1 85 | Chest1: 3 86 | Chest2: 4 87 | Settings: 6 88 | Save: 7 89 | # Time in seconds 90 | Time: 91 | Formatting: dd-MM-yyyy HH:mm:ss 92 | Offset: 0 93 | Time-To-Start: 10 94 | Min-Players-ToStart: 2 95 | Time-EndGame: 10 96 | Refresh-Leaderboards: 600 97 | Vote-Before-Seconds: 3 98 | Death-Match-Shrink-Factor: 2 99 | Maximum-Game-Time: 100 | Solo: 300 101 | Teams: 500 102 | Shuffle-Items-In-Chest: true 103 | Kits: 104 | Ender-Pearl-Perk-Give-Interval: 120 105 | Default-Refill-Time: 180 106 | # Events: REFILL, TNTRAIN 107 | # REFILL refills the chests. 108 | # TNTRAIN, when executed, summons a TNT above all game players. 109 | # Event Config: @