├── LICENSE └── src └── fr └── neutronstars └── sands_city └── api ├── IElementCity.java ├── display ├── Display.java ├── DisplayManager.java └── DisplayType.java ├── entities ├── ICustomPlayer.java ├── IPlayerManager.java └── IVillager.java ├── events ├── ICustomPlayerEvent.java └── ICustomPlayerTransferBankEvent.java ├── inventory ├── IInventory.java ├── IInventoryManager.java ├── IItem.java ├── InventoryType.java ├── ItemBuilder.java └── ItemClick.java ├── json ├── JSONReader.java └── JSONWriter.java ├── money ├── IMoneyManager.java ├── ITransaction.java ├── MoneyType.java └── TransactionType.java ├── sql ├── IColumn.java ├── ISQLManager.java ├── ISave.java └── ITable.java ├── team ├── ITeam.java ├── ITeamManager.java └── TeamType.java ├── utils ├── IArticle.java ├── IConfiguration.java ├── MessageBuilder.java └── VillagerManager.java └── zone ├── House.java ├── HouseManager.java ├── ZoneArea.java ├── ZoneManager.java └── ZoneType.java /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2019 Cité des Éléments, NeutronStars - Siphano - Team Endorah 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/IElementCity.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api; 2 | 3 | import fr.neutronstars.sands_city.api.display.DisplayManager; 4 | import fr.neutronstars.sands_city.api.entities.IPlayerManager; 5 | import fr.neutronstars.sands_city.api.inventory.*; 6 | import fr.neutronstars.sands_city.api.money.IMoneyManager; 7 | import fr.neutronstars.sands_city.api.sql.ISQLManager; 8 | import fr.neutronstars.sands_city.api.team.ITeamManager; 9 | import fr.neutronstars.sands_city.api.utils.IConfiguration; 10 | import fr.neutronstars.sands_city.api.utils.MessageBuilder; 11 | import fr.neutronstars.sands_city.api.utils.VillagerManager; 12 | import fr.neutronstars.sands_city.api.zone.HouseManager; 13 | import fr.neutronstars.sands_city.api.zone.ZoneArea; 14 | import fr.neutronstars.sands_city.api.zone.ZoneManager; 15 | import net.md_5.bungee.api.ChatColor; 16 | import net.md_5.bungee.api.chat.BaseComponent; 17 | import org.bukkit.Location; 18 | import org.bukkit.Material; 19 | import org.bukkit.block.Block; 20 | import org.bukkit.entity.Player; 21 | import org.bukkit.inventory.ItemStack; 22 | import org.bukkit.plugin.java.JavaPlugin; 23 | import org.json.JSONObject; 24 | 25 | import java.io.File; 26 | import java.io.IOException; 27 | import java.util.Optional; 28 | import java.util.logging.Logger; 29 | 30 | /** 31 | Cette class sert de point de relais entre toutes les autres. 32 | */ 33 | 34 | public abstract class IElementCity 35 | { 36 | private static IElementCity elementCity; 37 | 38 | /** 39 | * Récupére l'instance principal de la class. 40 | * @return sandsCity 41 | */ 42 | public static IElementCity getElementCity() 43 | { 44 | return elementCity; 45 | } 46 | 47 | /** 48 | * Permet d'inialiser sandsCity lors du démarrage du server. Il ne dois pas être utiliser dans les projets. 49 | * @param elementCity 50 | */ 51 | public static void setElementCity(IElementCity elementCity) 52 | { 53 | if(IElementCity.elementCity != null) 54 | throw new IllegalArgumentException("Cannot be set new Instance of IElementCity !"); 55 | IElementCity.elementCity = elementCity; 56 | } 57 | 58 | public abstract String getPrefix(); 59 | 60 | /** 61 | * Retourne le logger principal du plugin. 62 | * @return logger 63 | */ 64 | public abstract Logger getLogger(); 65 | 66 | public abstract JavaPlugin getPlugin(); 67 | 68 | /** 69 | * Retourne le dossier principal de l'API. 70 | * @return folder 71 | */ 72 | public abstract File getFolder(); 73 | 74 | /** 75 | * Retourne le fichier de configuration de l'api. 76 | * @return configuration 77 | */ 78 | public abstract IConfiguration getConfiguration(); 79 | 80 | /** 81 | * Retourne La gestion de la base de donnée. 82 | * @return sqlManager 83 | */ 84 | public abstract ISQLManager getSQLManager(); 85 | 86 | /** 87 | * Retourne la gestion de money 88 | * @return moneyManager 89 | */ 90 | public abstract IMoneyManager getMoneyManager(); 91 | 92 | /** 93 | * Retourne une configuration JSON qui s'appelle "name". Si celle ci n'existe pas, elle créer un fichier vide. 94 | * @param name 95 | * @return iConfiguration 96 | */ 97 | public abstract IConfiguration getConfiguration(String name) throws IOException; 98 | 99 | /** 100 | * Retourne la gestion des joueurs du serveur. 101 | * @return iPlayerManager 102 | */ 103 | public abstract IPlayerManager getPlayerManager(); 104 | 105 | /** 106 | * Retourne la gestion des teams du serveur. 107 | * @return iTeamManager 108 | */ 109 | public abstract ITeamManager getTeamManager(); 110 | 111 | public abstract IInventoryManager getInventoryManager(); 112 | 113 | public abstract Optional getArgsDetect(String arg, String... args); 114 | 115 | public abstract Location parseLocation(String location); 116 | 117 | public abstract MessageBuilder createMessageBuilder(String text); 118 | 119 | public abstract MessageBuilder createMessageBuilder(ChatColor color, String text); 120 | 121 | public abstract MessageBuilder createMessageBuilder(BaseComponent component); 122 | 123 | public abstract MessageBuilder createMessageBuilder(MessageBuilder builder); 124 | 125 | public abstract ItemBuilder createItemBuilder(ItemStack itemStack); 126 | 127 | public abstract ItemBuilder createItemBuilder(Material material); 128 | 129 | public abstract ItemBuilder createItemBuilder(Material material, int count); 130 | 131 | public abstract ItemBuilder createItemBuilder(Material material, int count, int data); 132 | 133 | public abstract ItemBuilder createItemBuilder(ItemBuilder builder); 134 | 135 | public abstract IInventory createInventory(String title, int slotCount); 136 | 137 | public abstract IItem createItem(ItemBuilder itemBuilder, IInventory inventory, ItemClick click); 138 | 139 | public abstract ZoneManager getZoneManager(); 140 | 141 | public abstract ZoneArea createQuadZone(String name, Location a, Location b); 142 | 143 | public abstract ZoneArea createCircleZone(String name, Location center, int height, int radius); 144 | 145 | public abstract HouseManager getHouseManager(); 146 | 147 | public abstract Optional parseZoneArea(JSONObject object); 148 | 149 | public abstract VillagerManager getVillagerManager(); 150 | 151 | public abstract Block getTargetBlock(Player player, int range); 152 | 153 | public abstract DisplayManager getDisplayManager(); 154 | 155 | public abstract boolean hasTeamInfoCredit(); 156 | 157 | public abstract void setTeamInfoCredit(boolean teamInfoCredit); 158 | 159 | public abstract boolean canEnteredHouse(); 160 | 161 | public abstract void setEnteredHouse(boolean enteredHouse); 162 | 163 | public abstract boolean hasPVPActive(); 164 | 165 | public abstract void setPVPActive(boolean active); 166 | 167 | public abstract boolean hasHomeActive(); 168 | 169 | public abstract void setHomeActive(boolean active); 170 | 171 | public abstract boolean canEnteredServer(); 172 | 173 | public abstract void setEnteredServer(boolean enteredServer); 174 | 175 | public abstract boolean hasFrendlyFire(); 176 | 177 | public abstract void setFrendlyFire(boolean frendlyFire); 178 | 179 | public abstract boolean hasBankActive(); 180 | 181 | public abstract void setBankActive(boolean bankActive); 182 | 183 | public abstract boolean hasSpleef(); 184 | 185 | public abstract void setSpleef(boolean spleef); 186 | 187 | public abstract boolean canKillPig(); 188 | 189 | public abstract void setKillPig(boolean killPig); 190 | 191 | public abstract boolean hasDisplay(); 192 | 193 | public abstract void setDisplay(boolean display); 194 | } 195 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/display/Display.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.display; 17 | 18 | public interface Display 19 | { 20 | DisplayType getType(); 21 | void update(); 22 | } 23 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/display/DisplayManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.display; 17 | 18 | public interface DisplayManager 19 | { 20 | Display getDisplay(DisplayType displayType); 21 | void update(); 22 | } 23 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/display/DisplayType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.display; 17 | 18 | import fr.neutronstars.sands_city.api.team.TeamType; 19 | 20 | public enum DisplayType 21 | { 22 | TEAM("§6§lClassement des équipes", "%1$s: §6%2$s §2Emeraudes"), 23 | PLAYER("§6§lTOP JOUEURS", "%1$s: §6%2$s §2Emeraudes"), 24 | FIRE_1("FIRE", "§6Classement de l'équipe "+ TeamType.FIRE.getColor()+ TeamType.FIRE.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 25 | WIND_1("WIND", "§6Classement de l'équipe "+ TeamType.WIND.getColor()+ TeamType.WIND.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 26 | WATER_1("WATER", "§6Classement de l'équipe "+ TeamType.WATER.getColor()+ TeamType.WATER.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 27 | GROUND_1("GROUND", "§6Classement de l'équipe "+ TeamType.GROUND.getColor()+ TeamType.GROUND.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 28 | FIRE_2("FIRE", "§6Classement de l'équipe "+ TeamType.FIRE.getColor()+ TeamType.FIRE.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 29 | WIND_2("WIND", "§6Classement de l'équipe "+ TeamType.WIND.getColor()+ TeamType.WIND.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 30 | WATER_2("WATER", "§6Classement de l'équipe "+ TeamType.WATER.getColor()+ TeamType.WATER.getName(), "%1$s§f: §6%2$s §2Emeraudes"), 31 | GROUND_2("GROUND", "§6Classement de l'équipe "+ TeamType.GROUND.getColor()+ TeamType.GROUND.getName(), "%1$s§f: §6%2$s §2Emeraudes"); 32 | 33 | private final String titleFormat, lineFormat, team; 34 | 35 | DisplayType(String titleFormat, String lineFormat){ 36 | this("", titleFormat, lineFormat); 37 | } 38 | 39 | DisplayType(String team, String titleFormat, String lineFormat){ 40 | this.team = team; 41 | this.titleFormat = titleFormat; 42 | this.lineFormat = lineFormat; 43 | } 44 | 45 | public String getTeam() 46 | { 47 | return team; 48 | } 49 | 50 | public String getTitleFormat() 51 | { 52 | return titleFormat; 53 | } 54 | 55 | public String getLineFormat() 56 | { 57 | return lineFormat; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/entities/ICustomPlayer.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.entities; 2 | 3 | import fr.neutronstars.sands_city.api.inventory.IInventory; 4 | import fr.neutronstars.sands_city.api.team.ITeam; 5 | import fr.neutronstars.sands_city.api.zone.House; 6 | import fr.neutronstars.sands_city.api.zone.ZoneArea; 7 | 8 | import java.util.Optional; 9 | import java.util.UUID; 10 | 11 | /** 12 | * Permet de stoquer les donnée du joueur et d'interagir avec. 13 | */ 14 | public interface ICustomPlayer 15 | { 16 | /** 17 | * Récupère l'identifiant unique d'un joueur. 18 | * @return uuid 19 | */ 20 | UUID getUniqueId(); 21 | 22 | /** 23 | * Récupere le nom du joueur. 24 | * @return name 25 | */ 26 | String getName(); 27 | 28 | /** 29 | * Récupère la team du joueur. 30 | * 31 | * @return iTeam 32 | */ 33 | ITeam getTeam(); 34 | 35 | Optional getZoneArea(); 36 | 37 | void setZoneArea(ZoneArea zoneArea); 38 | 39 | Optional getHouse(); 40 | 41 | void setHouse(House house); 42 | 43 | Optional getInventory(); 44 | 45 | void setInventory(IInventory inventory); 46 | 47 | /** 48 | * Sauvegarder les données du joueur dans la base de donnée. 49 | */ 50 | 51 | boolean hasCyberNeutronSecurity(); 52 | 53 | void setCyberNeutronSecurity(boolean cyberNeutronSecurity); 54 | 55 | void save(); 56 | } 57 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/entities/IPlayerManager.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.entities; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | import java.util.List; 6 | import java.util.function.Consumer; 7 | 8 | /** 9 | * Gére la liste des joueurs connecté. 10 | */ 11 | 12 | public interface IPlayerManager 13 | { 14 | List getPlayers(); 15 | void getPlayers(Consumer player); 16 | 17 | ICustomPlayer getPlayer(Player player); 18 | } 19 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/entities/IVillager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.entities; 17 | 18 | import fr.neutronstars.sands_city.api.utils.IArticle; 19 | import org.bukkit.Location; 20 | 21 | import java.util.List; 22 | import java.util.UUID; 23 | 24 | public interface IVillager 25 | { 26 | UUID getUniqueId(); 27 | String getName(); 28 | 29 | Location getLocation(); 30 | 31 | List getArticles(); 32 | void addArticle(IArticle article); 33 | void removeArticle(IArticle article); 34 | 35 | void openInventory(ICustomPlayer player); 36 | 37 | void destroy(); 38 | 39 | void save(); 40 | } 41 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/events/ICustomPlayerEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.events; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import org.bukkit.event.Event; 20 | 21 | public abstract class ICustomPlayerEvent extends Event 22 | { 23 | private final ICustomPlayer player; 24 | 25 | protected ICustomPlayerEvent(ICustomPlayer player) 26 | { 27 | this.player = player; 28 | } 29 | 30 | public ICustomPlayer getPlayer() 31 | { 32 | return player; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/events/ICustomPlayerTransferBankEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.events; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import fr.neutronstars.sands_city.api.team.ITeam; 20 | import org.bukkit.event.Cancellable; 21 | import org.bukkit.event.HandlerList; 22 | 23 | public class ICustomPlayerTransferBankEvent extends ICustomPlayerEvent implements Cancellable 24 | { 25 | private static final HandlerList HANDLER_LIST = new HandlerList(); 26 | 27 | private final ITeam team; 28 | 29 | private long money; 30 | private boolean cancelled; 31 | 32 | public ICustomPlayerTransferBankEvent(ICustomPlayer player, ITeam team, long money) 33 | { 34 | super(player); 35 | this.team = team; 36 | this.money = money; 37 | } 38 | 39 | public ITeam getTeam() 40 | { 41 | return team; 42 | } 43 | 44 | public long getMoney() 45 | { 46 | return money; 47 | } 48 | 49 | public void setMoney(long money) 50 | { 51 | this.money = money; 52 | } 53 | 54 | @Override 55 | public boolean isCancelled() 56 | { 57 | return this.cancelled; 58 | } 59 | 60 | @Override 61 | public void setCancelled(boolean cancelled) 62 | { 63 | this.cancelled = cancelled; 64 | } 65 | 66 | @Override 67 | public HandlerList getHandlers() 68 | { 69 | return HANDLER_LIST; 70 | } 71 | 72 | public static HandlerList getHandlerList() { 73 | return HANDLER_LIST; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/inventory/IInventory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.inventory; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import org.bukkit.event.inventory.ClickType; 20 | import org.bukkit.inventory.Inventory; 21 | import org.bukkit.inventory.ItemStack; 22 | 23 | import java.util.Optional; 24 | 25 | public interface IInventory 26 | { 27 | String getName(); 28 | 29 | Optional getItem(int slot); 30 | 31 | void addItem(IItem item, int slot); 32 | 33 | void addItem(ItemBuilder builder, int slot); 34 | 35 | void addItem(ItemStack itemStack, int slot); 36 | 37 | boolean is(Inventory inventory); 38 | 39 | Inventory getInventory(); 40 | 41 | void removeItem(int slot); 42 | 43 | void clear(); 44 | 45 | void updateItems(); 46 | 47 | void onClick(ICustomPlayer player, int slot, ClickType clickType); 48 | } 49 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/inventory/IInventoryManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.inventory; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import org.bukkit.event.inventory.ClickType; 20 | import org.bukkit.inventory.Inventory; 21 | 22 | public interface IInventoryManager 23 | { 24 | IInventory getInventory(InventoryType type); 25 | 26 | void registerInventory(InventoryType type, IInventory inventory); 27 | 28 | void openInventory(InventoryType type, ICustomPlayer player); 29 | 30 | boolean onClick(ICustomPlayer player, Inventory inventory, int slot, ClickType clickType); 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/inventory/IItem.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.inventory; 17 | 18 | import org.bukkit.inventory.ItemStack; 19 | 20 | public interface IItem 21 | { 22 | String getName(); 23 | 24 | ItemBuilder getItem(); 25 | 26 | IInventory getInventory(); 27 | 28 | ItemClick getItemClick(); 29 | 30 | void setItem(ItemStack itemStack); 31 | 32 | void setItem(ItemBuilder builder); 33 | } 34 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/inventory/InventoryType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.inventory; 17 | 18 | public interface InventoryType 19 | { 20 | T get(); 21 | 22 | default boolean equals(InventoryType type){ 23 | return type == this || type.get().equals(get()); 24 | } 25 | 26 | static InventoryType of(T t){ 27 | return () -> t; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/inventory/ItemBuilder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.inventory; 17 | 18 | import org.bukkit.block.banner.Pattern; 19 | import org.bukkit.enchantments.Enchantment; 20 | import org.bukkit.entity.Player; 21 | import org.bukkit.inventory.ItemFlag; 22 | import org.bukkit.inventory.ItemStack; 23 | 24 | import java.util.Collection; 25 | import java.util.List; 26 | 27 | public interface ItemBuilder 28 | { 29 | 30 | String getName(); 31 | 32 | ItemBuilder setName(String name); 33 | 34 | List getLore(); 35 | 36 | ItemBuilder setLore(String... lores); 37 | 38 | ItemBuilder setLore(List lore); 39 | 40 | ItemBuilder setData(int data); 41 | 42 | ItemBuilder setDurability(int data); 43 | 44 | ItemBuilder setCount(int count); 45 | 46 | ItemBuilder addEnchant(Enchantment enchantment, int lvl, boolean param); 47 | 48 | ItemBuilder addItemFlags(ItemFlag... flags); 49 | 50 | ItemBuilder removeEnchant(Enchantment enchantment); 51 | 52 | ItemBuilder removeItemFlags(ItemFlag... flags); 53 | 54 | ItemBuilder setOwner(String name); 55 | 56 | ItemBuilder setGlowing(boolean glowing); 57 | 58 | ItemBuilder setUnbreakable(boolean unbreakable); 59 | 60 | ItemBuilder addPattern(Pattern pattern); 61 | 62 | ItemStack toItemStack(); 63 | 64 | ItemBuilder clone(); 65 | 66 | ItemBuilder give(Collection players); 67 | 68 | ItemBuilder give(Player... players); 69 | 70 | ItemBuilder give(Player player); 71 | 72 | ItemBuilder give(Collection players, int slot); 73 | 74 | ItemBuilder give(int slot, Player... players); 75 | 76 | ItemBuilder give(Player player, int slot); 77 | } 78 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/inventory/ItemClick.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.inventory; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import org.bukkit.event.inventory.ClickType; 20 | 21 | public interface ItemClick 22 | { 23 | void onClick(ICustomPlayer player, ClickType clickType); 24 | } 25 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/json/JSONReader.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.json; 2 | 3 | import fr.neutronstars.sands_city.api.IElementCity; 4 | import org.json.JSONArray; 5 | import org.json.JSONObject; 6 | 7 | import java.io.*; 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | import java.util.logging.Level; 13 | 14 | /** 15 | * Created by NeutronStars on 14/07/2017 16 | * 17 | */ 18 | public final class JSONReader 19 | { 20 | private final String json; 21 | 22 | public JSONReader(String path) throws IOException 23 | { 24 | this(new File(path)); 25 | } 26 | 27 | public JSONReader(File file) throws IOException 28 | { 29 | this(new InputStreamReader(new FileInputStream(file))); 30 | } 31 | 32 | public JSONReader(Reader reader) throws IOException 33 | { 34 | this(new BufferedReader(reader)); 35 | } 36 | 37 | public JSONReader(BufferedReader reader) throws IOException 38 | { 39 | json = load(reader); 40 | } 41 | 42 | private String load(BufferedReader reader) throws IOException 43 | { 44 | StringBuilder builder = new StringBuilder(); 45 | 46 | while(reader.ready()) builder.append(reader.readLine()); 47 | 48 | reader.close(); 49 | 50 | return builder.length() == 0 ? "[]" : builder.toString(); 51 | } 52 | 53 | public static List toList(String path) 54 | { 55 | return toList(new File(path)); 56 | } 57 | 58 | public static List toList(File file) 59 | { 60 | try 61 | { 62 | return toList(new InputStreamReader(new FileInputStream(file))); 63 | } 64 | catch(IOException e) 65 | { 66 | IElementCity.getSandsCity().getLogger().log(Level.SEVERE, e.getMessage(), e); 67 | } 68 | return new ArrayList<>(); 69 | } 70 | 71 | public static List toList(Reader reader) 72 | { 73 | return toList(new BufferedReader(reader)); 74 | } 75 | 76 | public static List toList(BufferedReader bufferedReader) 77 | { 78 | List list= new ArrayList<>(); 79 | 80 | try 81 | { 82 | JSONReader reader = new JSONReader(bufferedReader); 83 | JSONArray array = reader.toJSONArray(); 84 | for(int i = 0; i < array.length(); i++) 85 | { 86 | try 87 | { 88 | list.add((E) array.get(i)); 89 | }catch(ClassCastException e){} 90 | } 91 | } 92 | catch(IOException e) 93 | { 94 | IElementCity.getSandsCity().getLogger().log(Level.SEVERE, e.getMessage(), e); 95 | } 96 | 97 | return list; 98 | } 99 | 100 | public static Map toMap(String path) 101 | { 102 | return toMap(new File(path)); 103 | } 104 | 105 | public static Map toMap(File file) 106 | { 107 | try 108 | { 109 | return toMap(new InputStreamReader(new FileInputStream(file))); 110 | } 111 | catch(IOException e) 112 | { 113 | IElementCity.getSandsCity().getLogger().log(Level.SEVERE, e.getMessage(), e); 114 | } 115 | return new HashMap<>(); 116 | } 117 | 118 | public static Map toMap(Reader reader) 119 | { 120 | return toMap(new BufferedReader(reader)); 121 | } 122 | 123 | public static Map toMap(BufferedReader bufferedReader) 124 | { 125 | Map map = new HashMap<>(); 126 | 127 | try 128 | { 129 | JSONReader reader = new JSONReader(bufferedReader); 130 | JSONObject object = reader.toJSONObject(); 131 | for(String key : object.keySet()) 132 | { 133 | Object obj = object.get(key); 134 | try 135 | { 136 | map.put(key, (V) object.get(key)); 137 | } 138 | catch(ClassCastException e) {} 139 | } 140 | } 141 | catch(IOException e) 142 | { 143 | IElementCity.getSandsCity().getLogger().log(Level.SEVERE, e.getMessage(), e); 144 | } 145 | 146 | return map; 147 | } 148 | 149 | public JSONArray toJSONArray() 150 | { 151 | return new JSONArray(json); 152 | } 153 | 154 | public JSONObject toJSONObject() 155 | { 156 | return new JSONObject(json); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/json/JSONWriter.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.json; 2 | 3 | import org.json.JSONArray; 4 | import org.json.JSONObject; 5 | 6 | import java.io.*; 7 | 8 | /** 9 | * Created by NeutronStars on 14/07/2017 10 | */ 11 | public final class JSONWriter implements Closeable 12 | { 13 | private final BufferedWriter writer; 14 | private int space; 15 | 16 | public JSONWriter(String path) throws IOException 17 | { 18 | this(new File(path)); 19 | } 20 | 21 | public JSONWriter(File file) throws IOException 22 | { 23 | this(new FileWriter(file)); 24 | } 25 | 26 | public JSONWriter(Writer writer) 27 | { 28 | this(new BufferedWriter(writer)); 29 | } 30 | 31 | public JSONWriter(BufferedWriter writer) 32 | { 33 | this.writer = writer; 34 | } 35 | 36 | public void write(JSONArray array) throws IOException 37 | { 38 | writer.write("["); 39 | writer.newLine(); 40 | 41 | this.space+=2; 42 | String space = spaceBuilder(); 43 | 44 | for(int i = 0; i < array.length(); i++) 45 | { 46 | Object object = array.get(i); 47 | 48 | if(object instanceof Number || object instanceof Boolean) writer.write(space+object); 49 | else if(object instanceof JSONObject) write((JSONObject) object, true); 50 | else if(object instanceof JSONArray) write((JSONArray) object); 51 | else writer.write(space+"\""+object.toString()+"\""); 52 | 53 | if(i < array.length()-1) writer.write(","); 54 | writer.newLine(); 55 | } 56 | 57 | this.space-=2; 58 | space = spaceBuilder(); 59 | 60 | writer.write(space+"]"); 61 | } 62 | 63 | private void write(JSONObject jsonObject, boolean spacing) throws IOException 64 | { 65 | writer.write((spacing ? spaceBuilder() : "") + "{"); 66 | writer.newLine(); 67 | 68 | this.space+=2; 69 | String space = spaceBuilder(); 70 | 71 | int i = 0; 72 | final int max = jsonObject.length(); 73 | 74 | for(String key : jsonObject.keySet()) 75 | { 76 | writer.write(space+"\""+key+"\":"); 77 | Object object = jsonObject.get(key); 78 | 79 | if(object instanceof Number || object instanceof Boolean) writer.write(object.toString()); 80 | else if(object instanceof JSONObject) write((JSONObject) object, false); 81 | else if(object instanceof JSONArray) write((JSONArray) object); 82 | else writer.write("\""+object.toString()+"\""); 83 | 84 | if(i < max-1) writer.write(","); 85 | i++; 86 | 87 | writer.newLine(); 88 | } 89 | 90 | this.space-=2; 91 | space = spaceBuilder(); 92 | 93 | writer.write(space+"}"); 94 | } 95 | 96 | public void write(JSONObject jsonObject) throws IOException 97 | { 98 | write(jsonObject, false); 99 | } 100 | 101 | private String spaceBuilder() 102 | { 103 | StringBuilder builder = new StringBuilder(); 104 | for(int i = 0; i < space; i++) builder.append(" "); 105 | return builder.length() == 0 ? "" : builder.toString(); 106 | } 107 | 108 | public void flush() throws IOException 109 | { 110 | writer.flush(); 111 | } 112 | 113 | public void close() throws IOException 114 | { 115 | writer.close(); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/money/IMoneyManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.money; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import fr.neutronstars.sands_city.api.team.ITeam; 20 | import fr.neutronstars.sands_city.api.team.TeamType; 21 | 22 | import java.util.Collection; 23 | 24 | /** 25 | * Systeme de transaction de money. 26 | */ 27 | public interface IMoneyManager 28 | { 29 | /** 30 | * Récupère toutes les transactions d'un joueur 31 | * @param player 32 | * @return collection de transaction 33 | */ 34 | Collection getTransactions(ICustomPlayer player); 35 | 36 | /** 37 | * Récupère toutes les transactions des joueurs d'une team. 38 | * @param teamType 39 | * @return collection de transaction. 40 | */ 41 | Collection getTransactions(TeamType teamType); 42 | 43 | /** 44 | * Créer une nouvelle instance de transaction. 45 | * @param money 46 | * @param reason 47 | * @param type 48 | * @return iTransaction 49 | */ 50 | ITransaction newTransaction(TransactionType type, String reason, long money); 51 | 52 | /** 53 | * Créer une nouvelle instance de transaction. 54 | * @param reason 55 | * @param type 56 | * @return iTransaction 57 | */ 58 | ITransaction newTransaction(TransactionType type, String reason); 59 | 60 | /** 61 | * Execute la transaction et la return. 62 | * @param player 63 | * @param transaction 64 | * @param team (Attention cette objet peut-être null, si la transaction n'est pas un transfert d'emeraude à la team.) 65 | * @return param transaction 66 | */ 67 | ITransaction apply(ICustomPlayer player, ITransaction transaction, ITeam team); 68 | } 69 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/money/ITransaction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.money; 17 | 18 | import java.util.UUID; 19 | 20 | /** 21 | * Object de transaction. 22 | */ 23 | public interface ITransaction 24 | { 25 | /** 26 | * L'id du joueur qui fait la transaction 27 | * @return 28 | */ 29 | UUID getIdPlayer(); 30 | 31 | /** 32 | * Money utilisé pour la transaction. 33 | * @return 34 | */ 35 | long getMoney(); 36 | 37 | /** 38 | * Petite description de la raison de la transaction. 39 | * @return 40 | */ 41 | String getReason(); 42 | 43 | /** 44 | * Type de transaction. 45 | * @return 46 | */ 47 | TransactionType getTransactionType(); 48 | 49 | /** 50 | * La temps en seconde ou la transaction a été faite. 51 | * @return 52 | */ 53 | long getTimestamp(); 54 | 55 | /** 56 | * Si la transaction à bien été réussi. 57 | * @return 58 | */ 59 | boolean isSuccess(); 60 | 61 | MoneyType getMoneyType(); 62 | 63 | void setMoneyType(MoneyType moneyType); 64 | } 65 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/money/MoneyType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.money; 17 | 18 | import org.bukkit.Material; 19 | 20 | public enum MoneyType 21 | { 22 | ITEM(Material.EMERALD), BLOCK(Material.EMERALD_BLOCK); 23 | 24 | private final Material material; 25 | 26 | MoneyType(Material material){ 27 | this.material = material; 28 | } 29 | 30 | public Material getMaterial(){ 31 | return material; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/money/TransactionType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.money; 17 | 18 | /** 19 | * Type de transaction. 20 | */ 21 | public enum TransactionType 22 | { 23 | CREDIT_TEAM, 24 | CREDIT, 25 | DEBIT; 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/sql/IColumn.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.sql; 2 | 3 | /** 4 | * Les information d'une colonne. 5 | */ 6 | public interface IColumn 7 | { 8 | /** 9 | * Nom de la colonne. 10 | * @return name 11 | */ 12 | String getName(); 13 | 14 | /** 15 | * La commande sql complete pour créer la colonne. 16 | * @return 17 | */ 18 | String getCommand(); 19 | 20 | /** 21 | * Le nom de sa table. 22 | * @return 23 | */ 24 | String getTableName(); 25 | 26 | /** 27 | * true si la colonne a la clef primaire. 28 | * @return primary 29 | */ 30 | boolean isPrimary(); 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/sql/ISQLManager.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.sql; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.ResultSetMetaData; 5 | 6 | /** 7 | * Cette class permet d'effectuer divers action avec la base de donnée. 8 | */ 9 | public interface ISQLManager 10 | { 11 | /** 12 | * Ce connecter à la base de donnée. 13 | * @return boolean 14 | */ 15 | boolean connect(); 16 | 17 | /** 18 | * Ce déconnecter à la base de donnée. 19 | */ 20 | void disconnect(); 21 | 22 | /** 23 | * Ce reconnecter à la base de donnée. 24 | */ 25 | void reconnect(); 26 | 27 | /** 28 | * Récuperer une donnée stocké dans la base de donnée. 29 | * @param query 30 | * @param objects 31 | * @return resultSet 32 | */ 33 | ResultSet getResult(String query, Object... objects); 34 | 35 | /** 36 | * Récupère les colonnes ou autre donnée interne d'une table. 37 | * @param tableName 38 | * @return 39 | */ 40 | ResultSetMetaData getResultMetaData(String tableName); 41 | 42 | /** 43 | * Mets a jour la base de donnée. 44 | * @param query 45 | * @param objects 46 | */ 47 | void execute(String query, Object... objects); 48 | 49 | /** 50 | * Libere la resources du thread SQL en fermant les donnée récupéré. 51 | * @param resultSet 52 | */ 53 | void close(ResultSet resultSet); 54 | 55 | /** 56 | * Charge une table dans la base de donnée en la créant s'il n'existe pas ou bien en la met à jour. 57 | * @param table 58 | */ 59 | void loadTable(ITable table); 60 | } 61 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/sql/ISave.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.sql; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Cette annotation sert a indiquer a sql comment sauvegarder ou charger les donnée d'un objet. 7 | */ 8 | 9 | @Documented 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target(ElementType.FIELD) 12 | public @interface ISave 13 | { 14 | /** 15 | * La colonne cible de la variable. Si ignorer alors la nom de la variable sera pris en compte. 16 | * @return 17 | */ 18 | String column() default ""; 19 | 20 | boolean callToString() default false; 21 | } 22 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/sql/ITable.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.sql; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Information d'une table de la base de donnée. 7 | */ 8 | public interface ITable 9 | { 10 | /** 11 | * Le nom de la table. 12 | * @return 13 | */ 14 | String getName(); 15 | 16 | /** 17 | * Le type de moteur de la table. INNODB est conseillé. 18 | * @return 19 | */ 20 | String getEngine(); 21 | 22 | 23 | /** 24 | * La clef primaire de la table. 25 | * @return 26 | */ 27 | IColumn getPrimaryKey(); 28 | 29 | /** 30 | * La list des colonne. 31 | * @return List 32 | */ 33 | List getColumns(); 34 | 35 | /** 36 | * Ajoute une nouvelle colonne a la table. (N'oubliez pas de mettre a jour la table avec la methode 'loadTable(ITable table) de ISQLManager !) 37 | * @param column 38 | */ 39 | void addColumn(IColumn column); 40 | } 41 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/team/ITeam.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.team; 2 | 3 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 4 | import fr.neutronstars.sands_city.api.utils.MessageBuilder; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Gestion des teams de la cité. 10 | */ 11 | public interface ITeam 12 | { 13 | /** 14 | * Recupère le type de la team. 15 | * @return teamType 16 | */ 17 | TeamType getType(); 18 | 19 | /** 20 | * Nom de la team 21 | * @return name 22 | */ 23 | String getName(); 24 | 25 | /** 26 | * Les emeraudes enregistrer a la team. 27 | * @return 28 | */ 29 | long getMoney(); 30 | 31 | /** 32 | * Retourne le nombre rééle de joueur dans la team. 33 | */ 34 | int getSize(); 35 | 36 | /** 37 | * Prefix de la team. 38 | * @return prefix 39 | */ 40 | String getPrefix(); 41 | 42 | /** 43 | * Suffix de la team 44 | * @return suffix 45 | */ 46 | String getSuffix(); 47 | 48 | /** 49 | * Liste des joueurs dans la team. 50 | * @return list 51 | */ 52 | List getPlayersOnline(); 53 | 54 | /** 55 | * Nombre de joueur dans la team. 56 | * @return count 57 | */ 58 | int getPlayerCount(); 59 | 60 | /** 61 | * Check si le joueur fait partie de la team. 62 | * @param player 63 | * @return boolean 64 | */ 65 | boolean hasPlayer(ICustomPlayer player); 66 | 67 | /** 68 | * Check si la team est une team de joueur. 69 | * @return boolean 70 | */ 71 | boolean isPlayerTeam(); 72 | 73 | void sendMessage(MessageBuilder messageBuilder); 74 | } 75 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/team/ITeamManager.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.team; 2 | 3 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 4 | import org.bukkit.scoreboard.Scoreboard; 5 | 6 | import java.util.Collection; 7 | 8 | /** 9 | * Permet de gérer la liste des teams. 10 | */ 11 | public interface ITeamManager 12 | { 13 | /** 14 | * Recupère le scoreboard spécial. 15 | * @return scoreboard 16 | */ 17 | Scoreboard getScoreboard(); 18 | 19 | /** 20 | * Recupère la liste des teams enregistré 21 | * @return teams 22 | */ 23 | Collection getTeams(); 24 | 25 | /** 26 | * Recupère la team. 27 | * @param teamType 28 | * @return iTeam 29 | */ 30 | ITeam getTeam(TeamType teamType); 31 | 32 | /** 33 | * Récupère la team par defaut. 34 | * @return 35 | */ 36 | ITeam getDefaultTeam(); 37 | 38 | /** 39 | * Ajoute un joueur a une team. 40 | * @param teamType 41 | * @param player 42 | */ 43 | public boolean addPlayer(TeamType teamType, ICustomPlayer player); 44 | 45 | /** 46 | * Retirer un joueur a une team et l'ajoute à la Team par defaut. 47 | * @param player 48 | */ 49 | public boolean removePlayer(ICustomPlayer player); 50 | } 51 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/team/TeamType.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.team; 2 | 3 | /** 4 | * Liste des teams 5 | */ 6 | public enum TeamType 7 | { 8 | WATER("Eau", "§2§9", true, false), 9 | FIRE("Feu", "§1§4", true, false), 10 | WIND("Air", "§3§d", true, false), 11 | GROUND("Terre", "§4§6", true, false), 12 | 13 | ORGANIZER("Orga", "§0§3", false, true), 14 | 15 | SPECTATOR("Spect", "§5§7", false, false); 16 | 17 | private final String name, color; 18 | private final boolean player, admin; 19 | 20 | TeamType(String name, String color, boolean player, boolean admin) 21 | { 22 | this.name = name; 23 | this.color = color; 24 | this.player = player; 25 | this.admin = admin; 26 | } 27 | 28 | public String getName() 29 | { 30 | return name; 31 | } 32 | 33 | public String getColor() 34 | { 35 | return color; 36 | } 37 | 38 | public String getPrefix() 39 | { 40 | return color+"["+name+"] "; 41 | } 42 | 43 | public String getSuffix() 44 | { 45 | return "§f"; 46 | } 47 | 48 | public boolean isPlayerTeam() 49 | { 50 | return player; 51 | } 52 | 53 | public boolean isAdmin() { 54 | return admin; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/utils/IArticle.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.utils; 17 | 18 | import org.bukkit.inventory.ItemStack; 19 | 20 | public interface IArticle 21 | { 22 | ItemStack getItemStack(); 23 | long getPrice(); 24 | void setPrice(long price); 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/utils/IConfiguration.java: -------------------------------------------------------------------------------- 1 | package fr.neutronstars.sands_city.api.utils; 2 | 3 | /** 4 | * Systeme de configuration en JSON. 5 | */ 6 | public interface IConfiguration 7 | { 8 | /** 9 | * Check si le path existe. 10 | * @param path 11 | * @return exist 12 | */ 13 | boolean has(String path); 14 | 15 | /** 16 | * Recupère la valeur du path. 17 | * @param path 18 | * @param 19 | * @return T 20 | */ 21 | T get(String path); 22 | 23 | /** 24 | * Récupère la valeur d'une clef et si celle ci n'est pas trouvé alors value est donné par default. 25 | * @param path 26 | * @param value 27 | * @param 28 | * @return T ou value 29 | */ 30 | T getOrSet(String path, T value); 31 | 32 | /** 33 | * Donner une valeur au path 34 | * @param path 35 | * @param value 36 | */ 37 | void set(String path, Object value); 38 | 39 | /** 40 | * Sauvegarde la configuration. 41 | */ 42 | void save(); 43 | } 44 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/utils/MessageBuilder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.utils; 17 | 18 | import fr.neutronstars.sands_city.api.IElementCity; 19 | import net.md_5.bungee.api.ChatColor; 20 | import net.md_5.bungee.api.chat.BaseComponent; 21 | import net.md_5.bungee.api.chat.ClickEvent; 22 | import net.md_5.bungee.api.chat.HoverEvent; 23 | import net.md_5.bungee.api.chat.TextComponent; 24 | import org.bukkit.entity.Player; 25 | 26 | import java.lang.reflect.InvocationTargetException; 27 | import java.util.Collection; 28 | import java.util.List; 29 | import java.util.logging.Level; 30 | 31 | public interface MessageBuilder 32 | { 33 | PlayerType BUKKIT = (player, builder)->{ 34 | if(player instanceof Player) 35 | ((Player) player).spigot().sendMessage(builder.build()); 36 | }; 37 | 38 | PlayerType BUNGEECORD = (player, builder) -> { 39 | try { 40 | player.getClass().getDeclaredMethod("sendMessage", BaseComponent[].class).invoke(player, builder.build()); 41 | }catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { 42 | IElementCity.getSandsCity().getLogger().log(Level.SEVERE, e.getMessage(), e); 43 | } 44 | }; 45 | 46 | interface PlayerType 47 | { 48 | void sendMessage(Object player, MessageBuilder builder); 49 | } 50 | 51 | MessageBuilder next(String text); 52 | 53 | MessageBuilder next(ChatColor color, String text); 54 | 55 | MessageBuilder nextln(String text); 56 | 57 | MessageBuilder nextln(ChatColor color, String text); 58 | 59 | MessageBuilder setColor(ChatColor color); 60 | 61 | MessageBuilder setBold(boolean bold); 62 | 63 | MessageBuilder setItalic(boolean italic); 64 | 65 | MessageBuilder setUnderlined(boolean underlined); 66 | 67 | MessageBuilder setStrikethrough(boolean strikethrough); 68 | 69 | MessageBuilder setObfuscated(boolean obfuscated); 70 | 71 | MessageBuilder setClick(ClickEvent.Action action, String value); 72 | 73 | MessageBuilder setClick(int index); 74 | 75 | MessageBuilder setHover(String text); 76 | 77 | MessageBuilder setHover(TextComponent text); 78 | 79 | MessageBuilder setHover(HoverEvent event); 80 | 81 | MessageBuilder setHover(int index); 82 | 83 | MessageBuilder addExtra(MessageBuilder builder); 84 | 85 | MessageBuilder addExtra(BaseComponent[] components); 86 | 87 | MessageBuilder addExtra(List components); 88 | 89 | MessageBuilder addExtra(BaseComponent component); 90 | 91 | BaseComponent[] build(); 92 | 93 | void sendPlayer(PlayerType playerType, Object player); 94 | 95 | void sendPlayers(PlayerType playerType, Collection players); 96 | } 97 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/utils/VillagerManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.utils; 17 | 18 | import fr.neutronstars.sands_city.api.entities.IVillager; 19 | import org.bukkit.Location; 20 | 21 | import java.util.List; 22 | import java.util.Optional; 23 | import java.util.UUID; 24 | 25 | public interface VillagerManager 26 | { 27 | List getVillagers(); 28 | Optional getVillager(String name); 29 | Optional getVillager(UUID uuid); 30 | boolean hasVillager(UUID uuid); 31 | 32 | Optional registerVillager(String name, Location location); 33 | void unregisterVillager(IVillager villager); 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/zone/House.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.zone; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import org.bukkit.Location; 20 | 21 | import java.util.Optional; 22 | import java.util.UUID; 23 | 24 | public interface House 25 | { 26 | String getName(); 27 | 28 | Optional getOwner(); 29 | 30 | boolean hasOwner(); 31 | 32 | boolean isOwner(UUID uuid); 33 | 34 | void setOwner(UUID uuid); 35 | 36 | long getPrice(); 37 | 38 | void setPrice(long price); 39 | 40 | boolean isInZone(Location location); 41 | 42 | ZoneArea getZoneParent(); 43 | 44 | ZoneArea getZoneArea(); 45 | 46 | Location getSignLocation(); 47 | 48 | boolean canBuy(ICustomPlayer player); 49 | 50 | boolean isLock(); 51 | 52 | void setLock(boolean lock); 53 | 54 | boolean isClose(); 55 | 56 | void setClose(boolean close); 57 | } 58 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/zone/HouseManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.zone; 17 | 18 | import org.bukkit.Location; 19 | 20 | import java.util.List; 21 | import java.util.Optional; 22 | 23 | public interface HouseManager 24 | { 25 | 26 | List getHousesByZone(String zone); 27 | 28 | List getHousesByName(String name); 29 | Optional getHouse(String zone, String name); 30 | 31 | Optional getHouseByLocation(String parent, Location location); 32 | 33 | Optional getHouseBySignLocation(String parent, Location location); 34 | 35 | Optional createHouse(ZoneArea parent, ZoneArea zoneArea, String name, Location sign); 36 | 37 | void removeHouse(House house); 38 | } 39 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/zone/ZoneArea.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.zone; 17 | 18 | import fr.neutronstars.sands_city.api.entities.ICustomPlayer; 19 | import fr.neutronstars.sands_city.api.team.ITeam; 20 | import fr.neutronstars.sands_city.api.team.TeamType; 21 | import org.bukkit.Location; 22 | import org.bukkit.entity.Player; 23 | import org.json.JSONObject; 24 | 25 | import java.util.Optional; 26 | 27 | public interface ZoneArea 28 | { 29 | String getName(); 30 | 31 | boolean isInZone(Location location); 32 | 33 | ZoneType getType(); 34 | 35 | void addZone(ZoneArea zoneArea); 36 | void removeZone(ZoneArea zoneArea); 37 | 38 | boolean isOwner(ICustomPlayer player); 39 | boolean isOwner(ITeam team); 40 | 41 | JSONObject toJSONObject(); 42 | 43 | void setBuy(boolean buy); 44 | boolean canBuy(); 45 | 46 | Optional getTeamType(); 47 | void setTeamType(TeamType teamType); 48 | 49 | void teleport(Player player); 50 | 51 | Optional getLocationTeleport(); 52 | 53 | boolean canPVP(); 54 | 55 | boolean canPVP(Location location); 56 | 57 | boolean canBuild(); 58 | 59 | void setCanBuild(boolean canBuild); 60 | 61 | boolean isSpleef(); 62 | 63 | void setSpleef(boolean spleef); 64 | 65 | int getSpleefHeight(); 66 | 67 | void setSpleefHeight(int spleefHeight); 68 | } 69 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/zone/ZoneManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.zone; 17 | 18 | import org.bukkit.Location; 19 | 20 | import java.util.List; 21 | import java.util.Optional; 22 | 23 | public interface ZoneManager 24 | { 25 | List getZones(); 26 | 27 | ZoneArea getZone(String name); 28 | void addZone(ZoneArea zoneArea); 29 | 30 | Optional getZoneByLocation(Location location); 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/neutronstars/sands_city/api/zone/ZoneType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2019 NeutronStars 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package fr.neutronstars.sands_city.api.zone; 17 | 18 | public enum ZoneType 19 | { 20 | CIRCLE, QUAD 21 | } 22 | --------------------------------------------------------------------------------